-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (17 loc) · 776 Bytes
/
Copy pathindex.js
File metadata and controls
21 lines (17 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Dzvinar CLI — запускає сценарій дзвінка в симуляторі.
// node index.js scenarios/demo.json
import { readFileSync } from "node:fs";
import { cliTelephony } from "./src/telephony.js";
import { runCall } from "./src/agent.js";
const file = process.argv[2] || "scenarios/demo.json";
let scenario;
try {
scenario = JSON.parse(readFileSync(file, "utf8"));
} catch (e) {
console.error(`Cannot read scenario "${file}": ${e.message}`);
process.exit(1);
}
console.log(`\n\x1b[1mDzvinar\x1b[0m — scenario: ${scenario.name}\n(type the caller's replies; Ctrl+C to abort)\n`);
const result = await runCall(scenario, cliTelephony());
console.log("\n\x1b[1m── CALL RESULT ──\x1b[0m");
console.log(JSON.stringify(result, null, 2));