@ph0ny/cli 0.1.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.
Files changed (111) hide show
  1. package/README.md +155 -0
  2. package/bin/phony.js +2 -0
  3. package/dist/commands/agents.d.ts +14 -0
  4. package/dist/commands/agents.d.ts.map +1 -0
  5. package/dist/commands/agents.js +145 -0
  6. package/dist/commands/agents.js.map +1 -0
  7. package/dist/commands/auth.d.ts +11 -0
  8. package/dist/commands/auth.d.ts.map +1 -0
  9. package/dist/commands/auth.js +50 -0
  10. package/dist/commands/auth.js.map +1 -0
  11. package/dist/commands/call.d.ts +17 -0
  12. package/dist/commands/call.d.ts.map +1 -0
  13. package/dist/commands/call.js +165 -0
  14. package/dist/commands/call.js.map +1 -0
  15. package/dist/commands/campaign.d.ts +11 -0
  16. package/dist/commands/campaign.d.ts.map +1 -0
  17. package/dist/commands/campaign.js +26 -0
  18. package/dist/commands/campaign.js.map +1 -0
  19. package/dist/commands/contacts.d.ts +6 -0
  20. package/dist/commands/contacts.d.ts.map +1 -0
  21. package/dist/commands/contacts.js +45 -0
  22. package/dist/commands/contacts.js.map +1 -0
  23. package/dist/commands/conversations.d.ts +6 -0
  24. package/dist/commands/conversations.d.ts.map +1 -0
  25. package/dist/commands/conversations.js +58 -0
  26. package/dist/commands/conversations.js.map +1 -0
  27. package/dist/commands/domains.d.ts +6 -0
  28. package/dist/commands/domains.d.ts.map +1 -0
  29. package/dist/commands/domains.js +70 -0
  30. package/dist/commands/domains.js.map +1 -0
  31. package/dist/commands/keys.d.ts +13 -0
  32. package/dist/commands/keys.d.ts.map +1 -0
  33. package/dist/commands/keys.js +58 -0
  34. package/dist/commands/keys.js.map +1 -0
  35. package/dist/commands/knowledge.d.ts +9 -0
  36. package/dist/commands/knowledge.d.ts.map +1 -0
  37. package/dist/commands/knowledge.js +180 -0
  38. package/dist/commands/knowledge.js.map +1 -0
  39. package/dist/commands/observability.d.ts +6 -0
  40. package/dist/commands/observability.d.ts.map +1 -0
  41. package/dist/commands/observability.js +97 -0
  42. package/dist/commands/observability.js.map +1 -0
  43. package/dist/commands/products.d.ts +6 -0
  44. package/dist/commands/products.d.ts.map +1 -0
  45. package/dist/commands/products.js +70 -0
  46. package/dist/commands/products.js.map +1 -0
  47. package/dist/commands/providers.d.ts +9 -0
  48. package/dist/commands/providers.d.ts.map +1 -0
  49. package/dist/commands/providers.js +70 -0
  50. package/dist/commands/providers.js.map +1 -0
  51. package/dist/commands/raw.d.ts +8 -0
  52. package/dist/commands/raw.d.ts.map +1 -0
  53. package/dist/commands/raw.js +46 -0
  54. package/dist/commands/raw.js.map +1 -0
  55. package/dist/commands/tasks.d.ts +6 -0
  56. package/dist/commands/tasks.d.ts.map +1 -0
  57. package/dist/commands/tasks.js +120 -0
  58. package/dist/commands/tasks.js.map +1 -0
  59. package/dist/commands/tests.d.ts +6 -0
  60. package/dist/commands/tests.d.ts.map +1 -0
  61. package/dist/commands/tests.js +190 -0
  62. package/dist/commands/tests.js.map +1 -0
  63. package/dist/commands/tools.d.ts +6 -0
  64. package/dist/commands/tools.d.ts.map +1 -0
  65. package/dist/commands/tools.js +105 -0
  66. package/dist/commands/tools.js.map +1 -0
  67. package/dist/commands/voices.d.ts +6 -0
  68. package/dist/commands/voices.d.ts.map +1 -0
  69. package/dist/commands/voices.js +114 -0
  70. package/dist/commands/voices.js.map +1 -0
  71. package/dist/index.d.ts +11 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +87 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/lib/agent-payload.d.ts +28 -0
  76. package/dist/lib/agent-payload.d.ts.map +1 -0
  77. package/dist/lib/agent-payload.js +65 -0
  78. package/dist/lib/agent-payload.js.map +1 -0
  79. package/dist/lib/call-payload.d.ts +42 -0
  80. package/dist/lib/call-payload.d.ts.map +1 -0
  81. package/dist/lib/call-payload.js +63 -0
  82. package/dist/lib/call-payload.js.map +1 -0
  83. package/dist/lib/client.d.ts +23 -0
  84. package/dist/lib/client.d.ts.map +1 -0
  85. package/dist/lib/client.js +25 -0
  86. package/dist/lib/client.js.map +1 -0
  87. package/dist/lib/command-utils.d.ts +10 -0
  88. package/dist/lib/command-utils.d.ts.map +1 -0
  89. package/dist/lib/command-utils.js +55 -0
  90. package/dist/lib/command-utils.js.map +1 -0
  91. package/dist/lib/config.d.ts +47 -0
  92. package/dist/lib/config.d.ts.map +1 -0
  93. package/dist/lib/config.js +90 -0
  94. package/dist/lib/config.js.map +1 -0
  95. package/dist/lib/errors.d.ts +25 -0
  96. package/dist/lib/errors.d.ts.map +1 -0
  97. package/dist/lib/errors.js +73 -0
  98. package/dist/lib/errors.js.map +1 -0
  99. package/dist/lib/exit.d.ts +20 -0
  100. package/dist/lib/exit.d.ts.map +1 -0
  101. package/dist/lib/exit.js +24 -0
  102. package/dist/lib/exit.js.map +1 -0
  103. package/dist/lib/json-file.d.ts +7 -0
  104. package/dist/lib/json-file.d.ts.map +1 -0
  105. package/dist/lib/json-file.js +29 -0
  106. package/dist/lib/json-file.js.map +1 -0
  107. package/dist/lib/output.d.ts +18 -0
  108. package/dist/lib/output.d.ts.map +1 -0
  109. package/dist/lib/output.js +60 -0
  110. package/dist/lib/output.js.map +1 -0
  111. package/package.json +55 -0
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # @ph0ny/cli
2
+
3
+ Command-line interface for the [Phony](https://api.ph0ny.com) Voice API — manage agents, knowledge, voices, tools, tests, API keys, provider keys, tasks, contacts, products, domains, observability, and outbound calls.
4
+
5
+ Built to be driven by autonomous LLM agents: every read/list command supports `--json` (machine-readable, no colors), there are no interactive prompts, and secrets are never accepted on the command line.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add -g @ph0ny/cli
11
+ # or run via the workspace
12
+ node ./bin/phony.js --help
13
+ ```
14
+
15
+ ## Authentication
16
+
17
+ The CLI resolves credentials in this order:
18
+
19
+ | What | Source (in order) |
20
+ |------|-------------------|
21
+ | API key | `PHONY_API_KEY` env, then the active profile's `apiKey` in `~/.phony/config.json` |
22
+ | Base URL | `PHONY_BASE_URL` env, then the active profile's `baseUrl`, then `https://api.ph0ny.com` |
23
+ | Active profile | `PHONY_PROFILE` env, then `activeProfile` in the config file, then `default` |
24
+
25
+ API keys must use the `plabs_` prefix. **Secrets are never passed via flags** — there is no `--api-key` option, because argv leaks into process listings and shell history. Set `PHONY_API_KEY` or use a profile.
26
+
27
+ `~/.phony/config.json`:
28
+
29
+ ```json
30
+ {
31
+ "activeProfile": "default",
32
+ "profiles": {
33
+ "default": { "apiKey": "plabs_...", "baseUrl": "https://api.ph0ny.com" },
34
+ "staging": { "apiKey": "plabs_...", "baseUrl": "https://staging.ph0ny.com" }
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## Environment variables
40
+
41
+ | Variable | Purpose |
42
+ |----------|---------|
43
+ | `PHONY_API_KEY` | Bearer API key (`plabs_…`) |
44
+ | `PHONY_BASE_URL` | API base URL (default `https://api.ph0ny.com`) |
45
+ | `PHONY_PROFILE` | Active profile name in `~/.phony/config.json` |
46
+
47
+ ## Command tree
48
+
49
+ ```
50
+ phony
51
+ ├── auth
52
+ │ └── status Verify the key authenticates; show tier + profile
53
+ ├── keys
54
+ │ ├── create --name <n> Create a key (printed once)
55
+ │ └── rotate <id> Rotate a key (printed once)
56
+ ├── agents
57
+ │ ├── list [--limit <n>]
58
+ │ ├── get <id>
59
+ │ ├── create --file <json> OR --name/--system-prompt/--voice/--llm
60
+ │ ├── update <id> --file <json> OR --name/--system-prompt/--voice/--llm
61
+ │ ├── delete <id>
62
+ │ └── test <id> Run a self-play test (tests/run-selfplay)
63
+ ├── knowledge
64
+ │ ├── list|get|create|delete
65
+ │ ├── documents <collectionId>
66
+ │ ├── ingest <collectionId> --file <json> OR --content/--source-url
67
+ │ ├── search <collectionId> --file <json> OR --query <text>
68
+ │ └── delete-document <collectionId> <documentId>
69
+ ├── voices
70
+ │ ├── list|get
71
+ │ ├── clone --name <n> --audio-file <path...>
72
+ │ ├── synthesize <voiceId> --text <text>
73
+ │ └── delete <id>
74
+ ├── providers
75
+ │ ├── list
76
+ │ ├── set <provider> --key-env <ENV_VAR>
77
+ │ ├── verify <provider>
78
+ │ └── delete <provider>
79
+ ├── tools
80
+ │ ├── list --agent <id>
81
+ │ ├── create/update/delete --agent <id> [--file <json>]
82
+ │ ├── test <toolId> --agent <id> [--payload-file <json>]
83
+ │ └── discover-mcp --agent <id> --url <url> [--auth-token-env <ENV>]
84
+ ├── tests
85
+ │ ├── cases|create|update|delete --agent <id>
86
+ │ ├── run|synthetic|self-play|voice|quality-gate --agent <id>
87
+ │ ├── runs --agent <id>
88
+ │ └── generate --agent <id>
89
+ ├── call
90
+ │ ├── start --agent --to --from --goal --consent-recorded
91
+ │ │ [--success-schema <file.json>] [--ivr-hints <text>] [--dry-run]
92
+ │ ├── get <id>
93
+ │ ├── list [--limit <n>]
94
+ │ └── watch <id> Poll to a terminal status [--interval 5] [--timeout 600]
95
+ ├── tasks Dispatch/list/cancel/delete agent tasks
96
+ ├── conversations List/get/delete conversation history
97
+ ├── contacts List/get/export agent contacts
98
+ ├── products Manage agent product catalogs
99
+ ├── domains Manage custom agent domains
100
+ ├── observability List sessions and fetch trace/root-cause JSON
101
+ ├── raw <method> <path> Authenticated /v1 escape hatch
102
+ └── campaign Not yet available upstream (exits 2)
103
+ ```
104
+
105
+ Every read/list command accepts `--json` for 2-space, color-free output you can pipe into `jq`.
106
+
107
+ ## Outbound calls + consent
108
+
109
+ `phony call start` **requires** `--consent-recorded`. It maps to `userConsentRecorded: true`, which the API enforces. Pass it only after the user has explicitly authorized the call (TCPA / recording-disclosure compliance). Omitting it exits `2` without contacting the API.
110
+
111
+ ```bash
112
+ phony call start \
113
+ --agent agent_123 \
114
+ --to +14155550123 \
115
+ --from +14155550199 \
116
+ --goal "Book a table for two at 7pm Friday" \
117
+ --success-schema ./schema.json \
118
+ --ivr-hints "press 1, reservations" \
119
+ --consent-recorded
120
+
121
+ phony call watch <callId> --interval 5 --timeout 600
122
+ ```
123
+
124
+ Use `--dry-run` to validate the full configuration (auth, agent kind, from-number ownership, Twilio config) without placing a real call.
125
+
126
+ Campaigns are not built upstream (see `docs/OUTBOUND-CAMPAIGNS-SPEC.md`, Phase 1). To run many calls, loop `phony call start` per target.
127
+
128
+ ## Developer portal/API coverage
129
+
130
+ The CLI intentionally targets the API-key `/v1` surface that autonomous agents can use without browser cookies. Current coverage includes:
131
+
132
+ - Agents, tools, tests, conversations, tasks, contacts, products, and domains.
133
+ - Knowledge collections/documents/search/ingest.
134
+ - Voices and TTS synthesis, including local audio-file voice cloning.
135
+ - API keys and BYOK provider keys. Provider secret values are read from env vars via `--key-env`, never argv.
136
+ - Runtime observability sessions, call traces, and root-cause JSON.
137
+ - `raw <method> <path>` for newly shipped `/v1` endpoints before a typed command exists.
138
+
139
+ Browser-session developer portal routes such as OAuth integration start/revoke currently live under `/portal/integrations/...`; they are not exposed by this API-key CLI until there is a project-scoped `/v1` or MCP-safe auth surface for them.
140
+
141
+ ## Exit codes
142
+
143
+ | Code | Meaning |
144
+ |------|---------|
145
+ | `0` | Success. For `call watch`, the call reached `completed`. |
146
+ | `1` | Runtime failure — API error, network error, not found, or `call watch` ending in `failed`. |
147
+ | `2` | Usage / compliance error — bad arguments, missing required flag, missing `--consent-recorded`, or an unbuilt feature (`campaign`). |
148
+
149
+ ## Agent ergonomics
150
+
151
+ - `--json` on every read/list command; output is the raw API shape.
152
+ - No interactive prompts — the CLI never blocks on a TTY.
153
+ - No secrets in argv — keys come from the environment or the config file only.
154
+ - Errors are a single line (or `{ "error": { code, message, status? } }` in `--json`); no stack traces reach stdout/stderr.
155
+ - `call watch` exits `0`/`1` on the terminal call status so a supervising agent can branch without parsing output.
package/bin/phony.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/index.js'
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `phony agents …` — agent CRUD + self-play test.
3
+ *
4
+ * Wraps @ph0ny/sdk's typed agent + test clients:
5
+ * list -> agents.list GET /v1/agents
6
+ * get -> agents.get GET /v1/agents/:id
7
+ * create -> agents.create POST /v1/agents
8
+ * update -> agents.update PUT /v1/agents/:id
9
+ * delete -> agents.delete DELETE /v1/agents/:id
10
+ * test -> tests.runSelfPlay POST /v1/agents/:id/tests/run-selfplay
11
+ */
12
+ import { Command } from 'commander';
13
+ export declare function createAgentsCommand(): Command;
14
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA0BnC,wBAAgB,mBAAmB,IAAI,OAAO,CA2I7C"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * `phony agents …` — agent CRUD + self-play test.
3
+ *
4
+ * Wraps @ph0ny/sdk's typed agent + test clients:
5
+ * list -> agents.list GET /v1/agents
6
+ * get -> agents.get GET /v1/agents/:id
7
+ * create -> agents.create POST /v1/agents
8
+ * update -> agents.update PUT /v1/agents/:id
9
+ * delete -> agents.delete DELETE /v1/agents/:id
10
+ * test -> tests.runSelfPlay POST /v1/agents/:id/tests/run-selfplay
11
+ */
12
+ import { Command } from 'commander';
13
+ import { createCliClient } from '../lib/client.js';
14
+ import { run } from '../lib/errors.js';
15
+ import { printJson, printKeyValue, printTable, spinner, success } from '../lib/output.js';
16
+ import { readJsonObjectFile } from '../lib/json-file.js';
17
+ import { buildCreateAgentBody, buildUpdateAgentBody } from '../lib/agent-payload.js';
18
+ function collectAgentFlags(options) {
19
+ return {
20
+ file: options.file ? readJsonObjectFile(options.file, '--file') : undefined,
21
+ name: options.name,
22
+ systemPrompt: options.systemPrompt,
23
+ voice: options.voice,
24
+ llm: options.llm,
25
+ };
26
+ }
27
+ export function createAgentsCommand() {
28
+ const cmd = new Command('agents').description('Manage agents');
29
+ cmd
30
+ .command('list')
31
+ .description('List agents')
32
+ .option('--limit <n>', 'Max agents to return')
33
+ .option('--json', 'Output as JSON')
34
+ .action(run(async (options) => {
35
+ const client = createCliClient();
36
+ const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
37
+ const page = await client.voice.agents.list({ limit });
38
+ if (options.json) {
39
+ printJson(page);
40
+ return;
41
+ }
42
+ printTable(['ID', 'Name', 'Status', 'LLM', 'Voice'], page.data.map((a) => [a.id, a.name, a.status, a.llmProvider, a.voiceId ?? '—']));
43
+ }));
44
+ cmd
45
+ .command('get')
46
+ .description('Get an agent by ID')
47
+ .argument('<id>', 'Agent ID')
48
+ .option('--json', 'Output as JSON')
49
+ .action(run(async (id, options) => {
50
+ const client = createCliClient();
51
+ const agent = await client.voice.agents.get(id);
52
+ if (options.json) {
53
+ printJson(agent);
54
+ return;
55
+ }
56
+ printKeyValue({
57
+ ID: agent.id,
58
+ Name: agent.name,
59
+ Status: agent.status,
60
+ LLM: agent.llmProvider,
61
+ 'LLM model': agent.llmModel,
62
+ 'TTS provider': agent.ttsProvider,
63
+ Voice: agent.voiceId,
64
+ Language: agent.language,
65
+ });
66
+ }));
67
+ cmd
68
+ .command('create')
69
+ .description('Create an agent')
70
+ .option('--file <json>', 'Path to a JSON file with the full agent body')
71
+ .option('--name <name>', 'Agent name')
72
+ .option('--system-prompt <text>', 'System prompt')
73
+ .option('--voice <voiceId>', 'Voice ID')
74
+ .option('--llm <provider>', 'LLM provider')
75
+ .option('--json', 'Output as JSON')
76
+ .action(run(async (options) => {
77
+ const client = createCliClient();
78
+ const body = buildCreateAgentBody(collectAgentFlags(options));
79
+ const agent = await client.voice.agents.create(body);
80
+ if (options.json) {
81
+ printJson(agent);
82
+ return;
83
+ }
84
+ success(`Created agent ${agent.id} (${agent.name})`);
85
+ }));
86
+ cmd
87
+ .command('update')
88
+ .description('Update an agent')
89
+ .argument('<id>', 'Agent ID')
90
+ .option('--file <json>', 'Path to a JSON file with the update body')
91
+ .option('--name <name>', 'Agent name')
92
+ .option('--system-prompt <text>', 'System prompt')
93
+ .option('--voice <voiceId>', 'Voice ID')
94
+ .option('--llm <provider>', 'LLM provider')
95
+ .option('--json', 'Output as JSON')
96
+ .action(run(async (id, options) => {
97
+ const client = createCliClient();
98
+ const body = buildUpdateAgentBody(collectAgentFlags(options));
99
+ const agent = await client.voice.agents.update(id, body);
100
+ if (options.json) {
101
+ printJson(agent);
102
+ return;
103
+ }
104
+ success(`Updated agent ${agent.id} (${agent.name})`);
105
+ }));
106
+ cmd
107
+ .command('delete')
108
+ .description('Delete (archive) an agent')
109
+ .argument('<id>', 'Agent ID')
110
+ .option('--json', 'Output as JSON')
111
+ .action(run(async (id, options) => {
112
+ const client = createCliClient();
113
+ await client.voice.agents.delete(id);
114
+ if (options.json) {
115
+ printJson({ id, deleted: true });
116
+ return;
117
+ }
118
+ success(`Deleted agent ${id}`);
119
+ }));
120
+ cmd
121
+ .command('test')
122
+ .description('Run a self-play test against the agent')
123
+ .argument('<id>', 'Agent ID')
124
+ .option('--agent-b <id>', 'Second agent ID (defaults to the same agent)')
125
+ .option('--max-exchanges <n>', 'Max conversational exchanges')
126
+ .option('--json', 'Output as JSON')
127
+ .action(run(async (id, options) => {
128
+ const client = createCliClient();
129
+ const spin = spinner('Running self-play...', Boolean(options.json));
130
+ spin.start();
131
+ const testRun = await client.voice.tests.runSelfPlay(id, {
132
+ agentBId: options.agentB,
133
+ maxExchanges: options.maxExchanges ? Number.parseInt(options.maxExchanges, 10) : undefined,
134
+ });
135
+ spin.stop();
136
+ if (options.json) {
137
+ printJson(testRun);
138
+ return;
139
+ }
140
+ success(`Self-play complete (run ${testRun.id})`);
141
+ printKeyValue({ Status: testRun.status });
142
+ }));
143
+ return cmd;
144
+ }
145
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAA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H,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,wCAAwC,CAAC;SACrD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;SAC5B,MAAM,CAAC,gBAAgB,EAAE,8CAA8C,CAAC;SACxE,MAAM,CAAC,qBAAqB,EAAE,8BAA8B,CAAC;SAC7D,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CACL,GAAG,CAAC,KAAK,EAAE,EAAU,EAAE,OAAmE,EAAE,EAAE;QAC5F,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;QAChC,MAAM,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QACnE,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE;YACvD,QAAQ,EAAE,OAAO,CAAC,MAAM;YACxB,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;SAC3F,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,EAAE,CAAA;QACX,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,OAAO,CAAC,CAAA;YAClB,OAAM;QACR,CAAC;QACD,OAAO,CAAC,2BAA2B,OAAO,CAAC,EAAE,GAAG,CAAC,CAAA;QACjD,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3C,CAAC,CAAC,CACH,CAAA;IAEH,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `phony auth status` — verify the resolved credentials authenticate.
3
+ *
4
+ * There is no /v1/me endpoint on the API. The cheapest authenticated GET that
5
+ * both proves the key works and reveals developer/tier information is
6
+ * GET /v1/keys (key management route): it returns the developer's keys, each
7
+ * carrying its tier. We report the tier and how the credentials were resolved.
8
+ */
9
+ import { Command } from 'commander';
10
+ export declare function createAuthCommand(): Command;
11
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAiBnC,wBAAgB,iBAAiB,IAAI,OAAO,CA2C3C"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * `phony auth status` — verify the resolved credentials authenticate.
3
+ *
4
+ * There is no /v1/me endpoint on the API. The cheapest authenticated GET that
5
+ * both proves the key works and reveals developer/tier information is
6
+ * GET /v1/keys (key management route): it returns the developer's keys, each
7
+ * carrying its tier. We report the tier and how the credentials were resolved.
8
+ */
9
+ import { Command } from 'commander';
10
+ import { createCliClient } from '../lib/client.js';
11
+ import { run } from '../lib/errors.js';
12
+ import { info, printJson, printKeyValue, spinner, success } from '../lib/output.js';
13
+ export function createAuthCommand() {
14
+ const cmd = new Command('auth').description('Inspect authentication state');
15
+ cmd
16
+ .command('status')
17
+ .description('Verify the resolved API key authenticates and show tier/profile')
18
+ .option('--json', 'Output as JSON')
19
+ .action(run(async (options) => {
20
+ const client = createCliClient();
21
+ const spin = spinner('Checking authentication...', Boolean(options.json));
22
+ spin.start();
23
+ const res = await client.request('GET', '/keys', { query: { limit: 1 } });
24
+ spin.stop();
25
+ const tier = res.data[0]?.tier ?? null;
26
+ const result = {
27
+ authenticated: true,
28
+ profile: client.context.profile,
29
+ baseUrl: client.context.baseUrl,
30
+ apiKeySource: client.context.apiKeySource,
31
+ tier,
32
+ };
33
+ if (options.json) {
34
+ printJson(result);
35
+ return;
36
+ }
37
+ success('Authenticated');
38
+ printKeyValue({
39
+ Profile: result.profile,
40
+ 'Base URL': result.baseUrl,
41
+ 'Key source': result.apiKeySource,
42
+ Tier: result.tier ?? 'unknown',
43
+ });
44
+ if (!tier) {
45
+ info('No API keys returned for this account, so tier could not be determined.');
46
+ }
47
+ }));
48
+ return cmd;
49
+ }
50
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAcnF,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,8BAA8B,CAAC,CAAA;IAE3E,GAAG;SACA,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CACL,GAAG,CAAC,KAAK,EAAE,OAA2B,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;QAChC,MAAM,IAAI,GAAG,OAAO,CAAC,4BAA4B,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QACzE,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAkB,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;QAC1F,IAAI,CAAC,IAAI,EAAE,CAAA;QAEX,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAA;QACtC,MAAM,MAAM,GAAG;YACb,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;YAC/B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;YAC/B,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY;YACzC,IAAI;SACL,CAAA;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,MAAM,CAAC,CAAA;YACjB,OAAM;QACR,CAAC;QAED,OAAO,CAAC,eAAe,CAAC,CAAA;QACxB,aAAa,CAAC;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,OAAO;YAC1B,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,SAAS;SAC/B,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,yEAAyE,CAAC,CAAA;QACjF,CAAC;IACH,CAAC,CAAC,CACH,CAAA;IAEH,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `phony call …` — outbound call origination + monitoring.
3
+ *
4
+ * The API has no SDK wrapper for outbound, so these go through the raw request
5
+ * helper against the outbound routes:
6
+ * start -> POST /v1/outbound/start -> { callSid, callId, status } | dry-run report
7
+ * get -> GET /v1/outbound/:id -> { call }
8
+ * list -> GET /v1/outbound -> { calls }
9
+ * watch -> poll GET /v1/outbound/:id to a terminal status
10
+ *
11
+ * `call start` enforces the consent gate before constructing any request: a
12
+ * call cannot be placed without --consent-recorded (maps userConsentRecorded:
13
+ * true). Missing consent exits 2 (usage), never 1.
14
+ */
15
+ import { Command } from 'commander';
16
+ export declare function createCallCommand(): Command;
17
+ //# sourceMappingURL=call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/commands/call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA8BnC,wBAAgB,iBAAiB,IAAI,OAAO,CAyJ3C"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * `phony call …` — outbound call origination + monitoring.
3
+ *
4
+ * The API has no SDK wrapper for outbound, so these go through the raw request
5
+ * helper against the outbound routes:
6
+ * start -> POST /v1/outbound/start -> { callSid, callId, status } | dry-run report
7
+ * get -> GET /v1/outbound/:id -> { call }
8
+ * list -> GET /v1/outbound -> { calls }
9
+ * watch -> poll GET /v1/outbound/:id to a terminal status
10
+ *
11
+ * `call start` enforces the consent gate before constructing any request: a
12
+ * call cannot be placed without --consent-recorded (maps userConsentRecorded:
13
+ * true). Missing consent exits 2 (usage), never 1.
14
+ */
15
+ import { Command } from 'commander';
16
+ import { createCliClient } from '../lib/client.js';
17
+ import { run } from '../lib/errors.js';
18
+ import { info, printJson, printKeyValue, printTable, spinner, success, warn } from '../lib/output.js';
19
+ import { readJsonObjectFile } from '../lib/json-file.js';
20
+ import { buildOutboundStartPayload } from '../lib/call-payload.js';
21
+ import { UsageError, EXIT_FAILURE, EXIT_OK } from '../lib/exit.js';
22
+ /** Terminal statuses for an outbound call (from the outbound route lifecycle). */
23
+ const TERMINAL_STATUSES = new Set(['completed', 'failed']);
24
+ export function createCallCommand() {
25
+ const cmd = new Command('call').description('Place and monitor outbound calls');
26
+ cmd
27
+ .command('start')
28
+ .description('Place an outbound call on a user\'s behalf')
29
+ .requiredOption('--agent <id>', 'Agent ID (must be a personal_assistant agent)')
30
+ .requiredOption('--to <e164>', 'Number to call (E.164)')
31
+ .requiredOption('--from <e164>', 'Number to call from (must be provisioned to you, E.164)')
32
+ .requiredOption('--goal <text>', 'Mission goal for the call')
33
+ .option('--success-schema <file.json>', 'JSON file describing the structured success schema')
34
+ .option('--ivr-hints <text>', 'Comma-separated IVR navigation hints')
35
+ .option('--dry-run', 'Validate config end-to-end without placing the call')
36
+ .option('--consent-recorded', 'Confirm the user explicitly authorized this call (REQUIRED)')
37
+ .option('--json', 'Output as JSON')
38
+ .action(run(async (options) => {
39
+ const successSchema = options.successSchema
40
+ ? readJsonObjectFile(options.successSchema, '--success-schema')
41
+ : undefined;
42
+ const payload = buildOutboundStartPayload({
43
+ agent: options.agent,
44
+ to: options.to,
45
+ from: options.from,
46
+ goal: options.goal,
47
+ ivrHints: options.ivrHints,
48
+ successSchema,
49
+ dryRun: options.dryRun,
50
+ consentRecorded: options.consentRecorded,
51
+ });
52
+ const client = createCliClient();
53
+ const spin = spinner(options.dryRun ? 'Validating call (dry run)...' : 'Placing call...', Boolean(options.json));
54
+ spin.start();
55
+ const res = await client.request('POST', '/outbound/start', { body: payload });
56
+ spin.stop();
57
+ if (options.json) {
58
+ printJson(res);
59
+ return;
60
+ }
61
+ if (res.dryRun) {
62
+ success('Dry run passed — no call was placed');
63
+ printKeyValue({ Status: res.status });
64
+ return;
65
+ }
66
+ success(`Call placed (${res.callId})`);
67
+ printKeyValue({ 'Call ID': res.callId, 'Call SID': res.callSid, Status: res.status });
68
+ info(`Watch it: phony call watch ${res.callId}`);
69
+ }));
70
+ cmd
71
+ .command('get')
72
+ .description('Get a single outbound call')
73
+ .argument('<id>', 'Outbound call ID')
74
+ .option('--json', 'Output as JSON')
75
+ .action(run(async (id, options) => {
76
+ const client = createCliClient();
77
+ const res = await client.request('GET', `/outbound/${encodeURIComponent(id)}`);
78
+ if (options.json) {
79
+ printJson(res);
80
+ return;
81
+ }
82
+ printCallDetails(res.call);
83
+ }));
84
+ cmd
85
+ .command('list')
86
+ .description('List recent outbound calls')
87
+ .option('--limit <n>', 'Max calls to return')
88
+ .option('--json', 'Output as JSON')
89
+ .action(run(async (options) => {
90
+ const client = createCliClient();
91
+ const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
92
+ const res = await client.request('GET', '/outbound', {
93
+ query: { limit },
94
+ });
95
+ if (options.json) {
96
+ printJson(res);
97
+ return;
98
+ }
99
+ printTable(['ID', 'Agent', 'To', 'Status', 'Goal met'], res.calls.map((c) => [c.id, c.agentId ?? '—', c.toNumber ?? '—', c.status, c.goalMet ?? false]));
100
+ }));
101
+ cmd
102
+ .command('watch')
103
+ .description('Poll an outbound call until it reaches a terminal status')
104
+ .argument('<id>', 'Outbound call ID')
105
+ .option('--interval <seconds>', 'Poll interval in seconds', '5')
106
+ .option('--timeout <seconds>', 'Give up after N seconds', '600')
107
+ .option('--json', 'Output as JSON')
108
+ .action(run(async (id, options) => {
109
+ const intervalMs = parsePositiveSeconds(options.interval, '--interval') * 1000;
110
+ const timeoutMs = parsePositiveSeconds(options.timeout, '--timeout') * 1000;
111
+ const json = Boolean(options.json);
112
+ const client = createCliClient();
113
+ const spin = spinner(`Watching ${id}...`, json);
114
+ spin.start();
115
+ const deadline = Date.now() + timeoutMs;
116
+ let last;
117
+ while (Date.now() < deadline) {
118
+ const res = await client.request('GET', `/outbound/${encodeURIComponent(id)}`);
119
+ last = res.call;
120
+ spin.text = `Watching ${id} — ${last.status}`;
121
+ if (TERMINAL_STATUSES.has(last.status)) {
122
+ spin.stop();
123
+ if (json) {
124
+ printJson(res);
125
+ }
126
+ else if (last.status === 'completed') {
127
+ success(`Call ${id} completed`);
128
+ printCallDetails(last);
129
+ }
130
+ else {
131
+ warn(`Call ${id} failed (${last.hangupReason ?? 'unknown'})`);
132
+ printCallDetails(last);
133
+ }
134
+ process.exit(last.status === 'completed' ? EXIT_OK : EXIT_FAILURE);
135
+ }
136
+ await sleep(intervalMs);
137
+ }
138
+ spin.stop();
139
+ throw new UsageError(`Timed out after ${options.timeout}s waiting for ${id} to reach a terminal status (last: ${last?.status ?? 'unknown'}).`, 'WATCH_TIMEOUT');
140
+ }));
141
+ return cmd;
142
+ }
143
+ function printCallDetails(call) {
144
+ printKeyValue({
145
+ ID: call.id,
146
+ Agent: call.agentId,
147
+ To: call.toNumber,
148
+ From: call.fromNumber,
149
+ Status: call.status,
150
+ 'Goal met': call.goalMet ?? false,
151
+ 'Hangup reason': call.hangupReason,
152
+ 'Duration (ms)': call.durationMs,
153
+ });
154
+ }
155
+ function parsePositiveSeconds(value, flag) {
156
+ const n = Number.parseInt(value ?? '', 10);
157
+ if (!Number.isInteger(n) || n <= 0) {
158
+ throw new UsageError(`${flag} must be a positive integer (seconds).`, 'INVALID_ARG');
159
+ }
160
+ return n;
161
+ }
162
+ function sleep(ms) {
163
+ return new Promise((resolve) => setTimeout(resolve, ms));
164
+ }
165
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/commands/call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAElE,kFAAkF;AAClF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;AAqB1D,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAA;IAE/E,GAAG;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,4CAA4C,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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,wCAAwC,EAAE,aAAa,CAAC,CAAA;IACtF,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `phony campaign …` — placeholder for the unbuilt outbound-campaigns surface.
3
+ *
4
+ * There is no /v1/campaigns route on the API (it is Phase 1 of
5
+ * docs/OUTBOUND-CAMPAIGNS-SPEC.md, not yet implemented). Every invocation exits
6
+ * 2 with an actionable message rather than silently failing or pretending to
7
+ * work — agents should loop `phony call start` per target instead.
8
+ */
9
+ import { Command } from 'commander';
10
+ export declare function createCampaignCommand(): Command;
11
+ //# sourceMappingURL=campaign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign.d.ts","sourceRoot":"","sources":["../../src/commands/campaign.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,wBAAgB,qBAAqB,IAAI,OAAO,CAc/C"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `phony campaign …` — placeholder for the unbuilt outbound-campaigns surface.
3
+ *
4
+ * There is no /v1/campaigns route on the API (it is Phase 1 of
5
+ * docs/OUTBOUND-CAMPAIGNS-SPEC.md, not yet implemented). Every invocation exits
6
+ * 2 with an actionable message rather than silently failing or pretending to
7
+ * work — agents should loop `phony call start` per target instead.
8
+ */
9
+ import { Command } from 'commander';
10
+ import { handleError } from '../lib/errors.js';
11
+ import { UsageError } from '../lib/exit.js';
12
+ const MESSAGE = 'campaigns not yet available upstream (OUTBOUND-CAMPAIGNS-SPEC Phase 1). Loop `phony call start` per target instead.';
13
+ export function createCampaignCommand() {
14
+ const cmd = new Command('campaign').description('Outbound campaigns (not yet available upstream)');
15
+ // Accept any args/subcommands so the gate fires uniformly instead of
16
+ // commander emitting its own "unknown command" with a different exit code.
17
+ cmd
18
+ .argument('[args...]', 'ignored')
19
+ .allowUnknownOption(true)
20
+ .option('--json', 'Output as JSON')
21
+ .action((_args, options) => {
22
+ handleError(new UsageError(MESSAGE, 'CAMPAIGNS_UNAVAILABLE'), Boolean(options.json));
23
+ });
24
+ return cmd;
25
+ }
26
+ //# sourceMappingURL=campaign.js.map