@getdial/cli 0.33.4 → 0.33.6
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 +10 -3
- package/dist/lib/local-targets.js +27 -8
- package/dist/mcp/tools/place-call.js +3 -1
- package/package.json +1 -1
- package/skills.tar.gz +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from "commander";
|
|
2
|
+
import { Command, InvalidArgumentError } from "commander";
|
|
3
3
|
import { VERSION } from "./lib/version.js";
|
|
4
4
|
import { runDoctor } from "./commands/doctor.js";
|
|
5
5
|
import { runBilling } from "./commands/billing.js";
|
|
@@ -35,6 +35,13 @@ import { isSandbox, SANDBOX_DISABLED_COMMANDS, sandboxDisabledMessage } from "./
|
|
|
35
35
|
// keyless so the proxy injects auth. Computed once (memoized in lib/sandbox).
|
|
36
36
|
const sandbox = isSandbox();
|
|
37
37
|
const program = new Command();
|
|
38
|
+
function parsePositiveInteger(value) {
|
|
39
|
+
const parsed = Number(value);
|
|
40
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0 || String(parsed) !== value.trim()) {
|
|
41
|
+
throw new InvalidArgumentError(`must be a positive integer, got: ${value}`);
|
|
42
|
+
}
|
|
43
|
+
return parsed;
|
|
44
|
+
}
|
|
38
45
|
program
|
|
39
46
|
.name("dial")
|
|
40
47
|
.description("Dial CLI — set up your account and run the listen service.")
|
|
@@ -327,7 +334,7 @@ if (!sandbox) {
|
|
|
327
334
|
.option("--secret <value>", "HMAC-SHA256 key. The daemon signs each request body and sends the hex digest.")
|
|
328
335
|
.option("--signature-header <name>", "HTTP header for the HMAC signature (defaults to X-Dial-Signature; only used with --secret)")
|
|
329
336
|
.option("--bearer <token>", "static bearer token, sent as `Authorization: Bearer <token>`")
|
|
330
|
-
.option("--timeout <seconds>", "per-attempt timeout (default 5)",
|
|
337
|
+
.option("--timeout <seconds>", "per-attempt timeout (default 5)", parsePositiveInteger)
|
|
331
338
|
.option("--json", "machine-readable output")
|
|
332
339
|
.action(async (url, opts) => process.exit(await runLocalTargetAddUrl({
|
|
333
340
|
url,
|
|
@@ -340,7 +347,7 @@ if (!sandbox) {
|
|
|
340
347
|
localTargetAdd
|
|
341
348
|
.command("cmd <path> [args...]")
|
|
342
349
|
.description("Register an executable. The daemon spawns it per event with the event JSON as the final positional argument.")
|
|
343
|
-
.option("--timeout <seconds>", "per-attempt timeout (default 5)",
|
|
350
|
+
.option("--timeout <seconds>", "per-attempt timeout (default 5)", parsePositiveInteger)
|
|
344
351
|
.option("--json", "machine-readable output")
|
|
345
352
|
.passThroughOptions(true)
|
|
346
353
|
.action(async (path, args, opts) => process.exit(await runLocalTargetAddCmd({
|
|
@@ -11,13 +11,23 @@ export const UrlTargetSchema = z.object({
|
|
|
11
11
|
secret: z.string().optional(),
|
|
12
12
|
signatureHeader: z.string().optional(),
|
|
13
13
|
bearer: z.string().optional(),
|
|
14
|
-
timeoutSeconds: z
|
|
14
|
+
timeoutSeconds: z
|
|
15
|
+
.number()
|
|
16
|
+
.int()
|
|
17
|
+
.positive()
|
|
18
|
+
.refine(Number.isSafeInteger, "timeout must be a safe integer")
|
|
19
|
+
.optional(),
|
|
15
20
|
});
|
|
16
21
|
export const CmdTargetSchema = z.object({
|
|
17
22
|
kind: z.literal("cmd"),
|
|
18
23
|
path: z.string(),
|
|
19
24
|
args: z.array(z.string()).default([]),
|
|
20
|
-
timeoutSeconds: z
|
|
25
|
+
timeoutSeconds: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.positive()
|
|
29
|
+
.refine(Number.isSafeInteger, "timeout must be a safe integer")
|
|
30
|
+
.optional(),
|
|
21
31
|
});
|
|
22
32
|
export const LocalTargetSchema = z.discriminatedUnion("kind", [UrlTargetSchema, CmdTargetSchema]);
|
|
23
33
|
const RegistrySchema = z.object({
|
|
@@ -66,19 +76,28 @@ export function listTargets() {
|
|
|
66
76
|
return readRegistry().targets;
|
|
67
77
|
}
|
|
68
78
|
export function addTarget(t) {
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
const parsed = LocalTargetSchema.safeParse(t);
|
|
80
|
+
if (!parsed.success) {
|
|
81
|
+
const timeoutIssue = parsed.error.issues.find((issue) => issue.path[0] === "timeoutSeconds");
|
|
82
|
+
if (timeoutIssue) {
|
|
83
|
+
throw new LocalTargetError("invalid_timeout", "timeout must be a positive integer");
|
|
84
|
+
}
|
|
85
|
+
throw new LocalTargetError("invalid_target", parsed.error.issues[0]?.message ?? "invalid target");
|
|
86
|
+
}
|
|
87
|
+
const target = parsed.data;
|
|
88
|
+
if (target.kind === "url") {
|
|
89
|
+
assertLoopbackUrl(target.url);
|
|
71
90
|
}
|
|
72
91
|
else {
|
|
73
|
-
if (!
|
|
92
|
+
if (!target.path)
|
|
74
93
|
throw new LocalTargetError("invalid_path", "executable path is required");
|
|
75
94
|
}
|
|
76
95
|
const reg = readRegistry();
|
|
77
|
-
const id = targetId(
|
|
78
|
-
if (reg.targets.some((existing) => targetId(existing) === id && existing.kind ===
|
|
96
|
+
const id = targetId(target);
|
|
97
|
+
if (reg.targets.some((existing) => targetId(existing) === id && existing.kind === target.kind)) {
|
|
79
98
|
return { added: false };
|
|
80
99
|
}
|
|
81
|
-
reg.targets.push(
|
|
100
|
+
reg.targets.push(target);
|
|
82
101
|
writeRegistry(reg);
|
|
83
102
|
return { added: true };
|
|
84
103
|
}
|
|
@@ -45,7 +45,9 @@ export const placeCallTool = {
|
|
|
45
45
|
config: {
|
|
46
46
|
title: "Place AI Voice Call",
|
|
47
47
|
description: "Place an outbound voice call handled by an AI agent. The call runs asynchronously — " +
|
|
48
|
-
"use wait_for_event to block until it ends, then get_call for the transcript."
|
|
48
|
+
"use wait_for_event to block until it ends, then get_call for the transcript. " +
|
|
49
|
+
"Free accounts (no top-up or subscription yet) are capped at 5 minutes per call and " +
|
|
50
|
+
"2 concurrent calls (429 call_limit_reached); both limits lift on the first top-up or subscription.",
|
|
49
51
|
inputSchema,
|
|
50
52
|
outputSchema: {
|
|
51
53
|
call: callSchema,
|
package/package.json
CHANGED
package/skills.tar.gz
CHANGED
|
Binary file
|