@kumion/cli 0.5.0 → 0.6.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/README.md CHANGED
@@ -106,7 +106,7 @@ would use.
106
106
  | `kumion agents get <agentId> [--json]` | `agents:read` |
107
107
  | `kumion agents spec <agentId> [--version published\|draft\|<n>] [--format pdf\|docx\|markdown] [--out <path>]` | `agents:read` (the 応対仕様書 as a file: PDF by default, Word and Markdown too; `--out`, or a file in the current directory for PDF/Word) |
108
108
  | `kumion agents patch <agentId> --revision <rev> [--prompt <text> \| --prompt-file <path>] [--graph-file <path>]` | `agents:write` |
109
- | `kumion agents publish <agentId> [--revision <rev>]` | `agents:publish` |
109
+ | `kumion agents publish <agentId> [--revision <rev>] [--accept-intermittent]` | `agents:publish` |
110
110
  | `kumion agents opening-name <agentId> --revision <rev> (--on \| --off)` | `agents:write` (a draft write: live after the next publish) |
111
111
  | `kumion agents availability <agentId> --revision <rev> [--operating-hours-file <path>] [--off-hours-file <path>]` | `agents:live` (live: no publish) |
112
112
  | `kumion agents create-from-template --template <id> --business-name <name> [--name <name>] [--url <url> \| --document <documentId>] [--idempotency-key <key>]` | `agents:write` (a `url` makes it read an external site and call the model; the key makes a resend return the first agent) |
@@ -145,7 +145,7 @@ would use.
145
145
  | `kumion test-runs list <agentId>` | `tests:run` |
146
146
  | `kumion calls create <agentId> [--to <phone>] [--campaign-contact <id>] [--var <name>=<value> ...]` | `calls:create` |
147
147
  | `kumion calls list [--agent <id>] [--channel webcall\|sip_did\|trigger] [--from <iso>] [--to <iso>] [--search <text>] [--limit <n>] [--offset <n>]` | `calls:read` |
148
- | `kumion scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset>` | `calls:create` |
148
+ | `kumion scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset> [--var <name>=<value> ...]` | `calls:create` |
149
149
  | `kumion scheduled-calls list` | `calls:read` |
150
150
  | `kumion scheduled-calls cancel <id>` | `calls:create` |
151
151
  | `kumion calls get <callId>` | `calls:read` |
@@ -153,7 +153,9 @@ would use.
153
153
 
154
154
  A command whose key lacks the scope fails with a message naming the scope it needs.
155
155
 
156
- `scheduled-calls create` places one dial at the time you give: `--at` must carry a timezone offset
156
+ `scheduled-calls create` takes `--var <name>=<value>` (repeatable; MCP `variables`) like `calls create`; see
157
+ "Per-call variables". The values are stored with the schedule and handed to the call when it is placed.
158
+ It places one dial at the time you give: `--at` must carry a timezone offset
157
159
  (`2026-10-31T13:00:00+09:00`; a bare `13:00` is refused), be in the future, and the number a domestic one.
158
160
  The dial happens once, with no automatic redial. It is refused with 403 when the tenant's automatic
159
161
  outbound dialing is off or the plan is `free`, and with 409 when that number already has a scheduled or
@@ -220,6 +222,14 @@ body: an object of strings, at most 50 names, 1000 characters per value, 10000 i
220
222
  larger or non-string value is a 400 naming the item). With `--campaign-contact`, the list row's
221
223
  columns are the base and `--var` wins. A name that is not passed reads as an empty string.
222
224
 
225
+ The flag splits at the first `=` (`--var url=https://x.test/?a=b` keeps the second one in the value;
226
+ `--var tag=` is an empty value). `--var foo` and `--var =x` are refused before anything is sent.
227
+ A name takes letters, digits and `_` only. Passing the same name twice keeps the last one. With no `--var`
228
+ the request carries no `variables`. A variable the agent's published version marks 必須 must be given a
229
+ value: otherwise the call is not placed (`calls create`) or not scheduled (`scheduled-calls create`), with
230
+ `400 missing_variables` and the names in `missing`. `scheduled-calls create` takes `--var` the same way and
231
+ checks the same rules at the time you schedule, not when the dial happens.
232
+
223
233
  ### Dialing a phone
224
234
 
225
235
  `calls create <agentId> --to 08012345678` places a real call from the phone number assigned to
@@ -413,7 +423,11 @@ kumion agents publish <agentId> # runs the pre-publish check, then publishe
413
423
  `test-runs start` checks the draft without publishing anything. `agents publish` runs
414
424
  the Portal's pre-publish check and publishes only when it passes; when it does not, the
415
425
  failing cases are printed and nothing goes live. The CLI has no way to skip or override
416
- the check. When a check before the test calls refuses (most often the dependency check:
426
+ the check, with one exception: a case that failed only in some of its re-runs is marked
427
+ `[intermittent]` (one that failed again is `[reproduced]`), and when nothing else is wrong the refusal
428
+ says so and `agents publish <agentId> --accept-intermittent` (MCP: `acceptIntermittent`) publishes it
429
+ anyway. It never applies to a check that failed every time. `test-runs get` marks the same cases and lists
430
+ each re-run's outcome. When a check before the test calls refuses (most often the dependency check:
417
431
  コンタクト or the booking calendar not connected, a tool not enabled), there are no
418
432
  cases to print: the server's message after `Server said:` is the whole reason, one
419
433
  problem per line.
package/dist/client.js CHANGED
@@ -236,9 +236,9 @@ export class KumionClient {
236
236
  });
237
237
  return body;
238
238
  }
239
- async publishAgent(agentId, revision) {
239
+ async publishAgent(agentId, revision, options = {}) {
240
240
  const { body } = await this.request("POST", this.agentPath(agentId, "/publish"), "agents:publish", {
241
- body: {},
241
+ body: options.acceptIntermittent ? { acceptIntermittent: true } : {},
242
242
  ifMatch: revision,
243
243
  });
244
244
  return body;
@@ -277,10 +277,15 @@ export class KumionClient {
277
277
  const { body } = await this.request("GET", this.tenantPath(`/calls${qs ? `?${qs}` : ""}`), "calls:read");
278
278
  return body;
279
279
  }
280
- async createScheduledCall(agentId, phoneNumber, scheduledAt) {
280
+ async createScheduledCall(agentId, phoneNumber, scheduledAt, variables) {
281
281
  try {
282
282
  const { body } = await this.request("POST", this.tenantPath("/scheduled-calls"), "calls:create", {
283
- body: { agentId, phoneNumber, scheduledAt },
283
+ body: {
284
+ agentId,
285
+ phoneNumber,
286
+ scheduledAt,
287
+ ...(variables && Object.keys(variables).length > 0 ? { variables } : {}),
288
+ },
284
289
  });
285
290
  return body;
286
291
  }
package/dist/errors.js CHANGED
@@ -46,6 +46,12 @@ export function describeApiError(err) {
46
46
  if (err.code === "invalid_version") {
47
47
  return `--version takes published, draft, or a version number (400 invalid_version).${serverSaid(err)}`;
48
48
  }
49
+ if (err.code === "missing_variables") {
50
+ const missing = Array.isArray(err.body.missing) ? err.body.missing.map(String).join(", ") : "";
51
+ return (`The call was not placed (400 missing_variables): the agent's published version has 必須 call variables that were ` +
52
+ `left empty${missing ? ` (${missing})` : ""}. Nothing was dialed or scheduled. Pass each one as ` +
53
+ `\`--var <name>=<value>\`.${serverSaid(err)}`);
54
+ }
49
55
  return `Request failed (400).${serverSaid(err)}`;
50
56
  case 404:
51
57
  if (err.code === "not_published") {
package/dist/main.js CHANGED
@@ -5,7 +5,7 @@ import { ApiError, KumionClient, isTextFile, specText, } from "./client.js";
5
5
  import { DEFAULT_BASE_URL, keyPrefix, looksLikeApiKey, normalizeBaseUrl, resolveCredentials, } from "./credentials.js";
6
6
  import { DEFAULT_DEVICE_SCOPES, deviceLogin } from "./device-login.js";
7
7
  import { describeError, ReportedFailure, UsageError } from "./errors.js";
8
- export const VERSION = "0.5.0";
8
+ export const VERSION = "0.6.0";
9
9
  const HELP = `kumion — manage your Kumion voice agents over the Partner API
10
10
 
11
11
  Usage: kumion <command> [options]
@@ -34,7 +34,7 @@ Agents
34
34
  出力日時 on the cover is the moment of the export
35
35
  agents patch <agentId> --revision <rev> [--prompt <text> | --prompt-file <path>] [--graph-file <path>]
36
36
  Edit the draft (never goes live by itself)
37
- agents publish <agentId> [--revision <rev>]
37
+ agents publish <agentId> [--revision <rev>] [--accept-intermittent]
38
38
  Publish the draft through the pre-publish check
39
39
  agents opening-name <agentId> --revision <rev> (--on | --off)
40
40
  Whether the opening line uses the caller's name (a draft write:
@@ -196,7 +196,7 @@ Calls
196
196
  calls list [--agent <id>] [--channel webcall|sip_did|trigger] [--from <iso>] [--to <iso>]
197
197
  [--search <text>] [--limit <n>] [--offset <n>]
198
198
  List the tenant's call history, newest first (20 per page)
199
- scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset>
199
+ scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset> [--var <name>=<value> ...]
200
200
  Schedule one dial at that time (e.g. 2026-10-31T13:00:00+09:00)
201
201
  scheduled-calls list List the dials scheduled through the API, newest first
202
202
  scheduled-calls cancel <id> Cancel a scheduled dial that has not started
@@ -1562,16 +1562,19 @@ async function factsConfirm(args, deps) {
1562
1562
  }
1563
1563
  return 0;
1564
1564
  }
1565
+ function gateTag(gate) {
1566
+ return gate ? ` [${gate}]` : "";
1567
+ }
1565
1568
  function formatFindings(findings, indent) {
1566
1569
  return (findings ?? []).map((f) => `${indent}- ${f.kind}${f.nodeKey ? ` @${f.nodeKey}` : ""}: ${f.detail}`);
1567
1570
  }
1568
1571
  async function agentsPublish(args, deps) {
1569
- const { values, positionals } = parse(args, { revision: { type: "string" } });
1572
+ const { values, positionals } = parse(args, { revision: { type: "string" }, "accept-intermittent": { type: "boolean" } });
1570
1573
  const agentId = need(positionals, 0, "agentId");
1571
1574
  const client = await clientFor(values, deps);
1572
1575
  deps.io.err("Publishing — the pre-publish check runs first and can take a few minutes…");
1573
1576
  try {
1574
- const result = await client.publishAgent(agentId, values.revision);
1577
+ const result = await client.publishAgent(agentId, values.revision, { acceptIntermittent: values["accept-intermittent"] === true });
1575
1578
  if (values.json)
1576
1579
  printJson(deps, result);
1577
1580
  else {
@@ -1603,13 +1606,19 @@ async function agentsPublish(args, deps) {
1603
1606
  for (const c of verdict.cases) {
1604
1607
  if (!c.failures?.length)
1605
1608
  continue;
1606
- lines.push(` case ${c.caseId ?? "?"}${c.expectedLeafKey ? ` (→ ${c.expectedLeafKey})` : ""}:`);
1609
+ lines.push(` case ${c.caseId ?? "?"}${c.expectedLeafKey ? ` (→ ${c.expectedLeafKey})` : ""}${gateTag(c.gate)}:`);
1607
1610
  lines.push(...formatFindings(c.failures, " "));
1608
1611
  }
1609
1612
  }
1610
1613
  if (body.publishRunId)
1611
1614
  lines.push(`Publish run: ${String(body.publishRunId)} (details in the Portal).`);
1612
- lines.push("There is no override from the CLI: fix the draft, run `kumion test-runs start`, and publish again.");
1615
+ if (body.code === "intermittent") {
1616
+ lines.push("The check failed only in some of its runs (intermittent), nothing else is wrong. Fix the draft and publish again, " +
1617
+ "or accept the risk with `kumion agents publish " + agentId + " --accept-intermittent`.");
1618
+ }
1619
+ else {
1620
+ lines.push("There is no override from the CLI: fix the draft, run `kumion test-runs start`, and publish again.");
1621
+ }
1613
1622
  throw new ReportedFailure(lines.join("\n"));
1614
1623
  }
1615
1624
  }
@@ -1770,7 +1779,9 @@ export function summarizeTestRun(run) {
1770
1779
  for (const r of run.results ?? []) {
1771
1780
  if (!r.failures?.length)
1772
1781
  continue;
1773
- lines.push(`Case ${r.caseId}${r.expectedLeafKey ? ` (→ ${r.expectedLeafKey})` : ""}:`);
1782
+ lines.push(`Case ${r.caseId}${r.expectedLeafKey ? ` (→ ${r.expectedLeafKey})` : ""}${gateTag(r.gate)}:`);
1783
+ if (r.attempts?.length)
1784
+ lines.push(` runs: ${r.attempts.map((a) => `#${a.attempt} ${a.outcome}`).join(", ")}`);
1774
1785
  lines.push(...formatFindings(r.failures, " "));
1775
1786
  }
1776
1787
  }
@@ -1841,14 +1852,25 @@ async function testRunsList(args, deps) {
1841
1852
  deps.io.out(`${r.id} ${r.status.padEnd(13)} ${r.casesDone}/${r.casesTotal} ${r.startedAt}`);
1842
1853
  return 0;
1843
1854
  }
1855
+ function parseVarFlags(pairs) {
1856
+ const variables = {};
1857
+ for (const pair of pairs ?? []) {
1858
+ const at = pair.indexOf("=");
1859
+ if (at < 1)
1860
+ throw new UsageError(`--var must be <name>=<value> (got "${pair}").`);
1861
+ variables[pair.slice(0, at)] = pair.slice(at + 1);
1862
+ }
1863
+ return variables;
1864
+ }
1844
1865
  async function scheduledCallsCreate(args, deps) {
1845
- const { values, positionals } = parse(args, { to: { type: "string" }, at: { type: "string" } });
1866
+ const { values, positionals } = parse(args, { to: { type: "string" }, at: { type: "string" }, var: { type: "string", multiple: true } });
1846
1867
  const agentId = need(positionals, 0, "agentId");
1868
+ const variables = parseVarFlags(values.var);
1847
1869
  if (!values.to)
1848
1870
  throw new UsageError("--to <phone> is required.");
1849
1871
  if (!values.at)
1850
1872
  throw new UsageError("--at <iso8601 with offset> is required.");
1851
- const result = await (await clientFor(values, deps)).createScheduledCall(agentId, values.to, values.at);
1873
+ const result = await (await clientFor(values, deps)).createScheduledCall(agentId, values.to, values.at, variables);
1852
1874
  if (values.json)
1853
1875
  printJson(deps, result);
1854
1876
  else
@@ -1884,13 +1906,7 @@ async function callsCreate(args, deps) {
1884
1906
  var: { type: "string", multiple: true },
1885
1907
  });
1886
1908
  const agentId = need(positionals, 0, "agentId");
1887
- const variables = {};
1888
- for (const pair of values.var ?? []) {
1889
- const at = pair.indexOf("=");
1890
- if (at < 1)
1891
- throw new UsageError(`--var must be <name>=<value> (got "${pair}").`);
1892
- variables[pair.slice(0, at)] = pair.slice(at + 1);
1893
- }
1909
+ const variables = parseVarFlags(values.var);
1894
1910
  const result = await (await clientFor(values, deps)).createCall(agentId, values["campaign-contact"], variables, values.to);
1895
1911
  if (values.json)
1896
1912
  printJson(deps, result);
package/dist/mcp.js CHANGED
@@ -302,16 +302,22 @@ export function createKumionMcpServer(client, options) {
302
302
  }, (args) => attempt(() => client.confirmFacts(args.agentId, args.factIds)));
303
303
  server.registerTool("publish_agent", {
304
304
  description: "Publish the agent's draft so callers get it. Runs the same pre-publish check as the Portal first and " +
305
- "publishes only if it passes; there is no way to skip it. Can take a few minutes. On failure the " +
305
+ "publishes only if it passes; a failing check cannot be skipped. The one exception: a check that failed " +
306
+ "only in some of its runs comes back with code `intermittent` and the cases (`gate: intermittent`), and " +
307
+ "`acceptIntermittent` publishes it anyway. Can take a few minutes. On failure the " +
306
308
  "failing cases are returned. A success carries `unconfirmedFacts`: how many of the agent's 資料 facts " +
307
309
  "nobody has confirmed yet — for each of them the agent says it will check and call back instead of " +
308
310
  "stating it (confirm_facts confirms them). Needs agents:publish.",
309
311
  inputSchema: {
310
312
  agentId,
311
313
  revision: z.string().optional().describe("Refuse to publish if the draft is no longer at this revision."),
314
+ acceptIntermittent: z
315
+ .boolean()
316
+ .optional()
317
+ .describe("Publish although the check failed only in some of its runs (code `intermittent`). Has no effect on a check that failed every time."),
312
318
  },
313
319
  annotations: { destructiveHint: true, idempotentHint: false },
314
- }, (args) => attempt(() => client.publishAgent(args.agentId, args.revision)));
320
+ }, (args) => attempt(() => client.publishAgent(args.agentId, args.revision, { acceptIntermittent: args.acceptIntermittent === true })));
315
321
  server.registerTool("start_test_run", {
316
322
  description: "Run the agent's regression tests against its draft (publishes nothing). Returns at once with the run " +
317
323
  `unless waitSeconds is set (at most ${MAX_TEST_RUN_WAIT_SECONDS}); follow a running run with ` +
@@ -373,9 +379,13 @@ export function createKumionMcpServer(client, options) {
373
379
  agentId,
374
380
  phoneNumber: z.string().describe("Domestic Japanese number to dial."),
375
381
  scheduledAt: z.string().describe("When to dial, ISO 8601 with a timezone offset."),
382
+ variables: z
383
+ .record(z.string(), z.string())
384
+ .optional()
385
+ .describe("Values for {{vars.<name>}} in the agent's prompts, opening line and edge conditions (optional)."),
376
386
  },
377
387
  annotations: { idempotentHint: false },
378
- }, (args) => attempt(() => client.createScheduledCall(args.agentId, args.phoneNumber, args.scheduledAt)));
388
+ }, (args) => attempt(() => client.createScheduledCall(args.agentId, args.phoneNumber, args.scheduledAt, args.variables)));
379
389
  server.registerTool("list_scheduled_calls", {
380
390
  description: "List the calls scheduled through the API, newest first (at most 100), with state and reason. Needs calls:read.",
381
391
  inputSchema: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumion/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Manage your Kumion voice agents from the terminal over the Kumion Partner API",
5
5
  "author": "KAOPA株式会社",
6
6
  "license": "MIT",
@@ -87,7 +87,9 @@ A partner with several customers has one profile per customer tenant
87
87
  `kumion agents publish <agentId>`. It runs the same pre-publish check as the Portal
88
88
  and can take a few minutes. If the check fails, nothing goes live and the failing
89
89
  cases come back: fix, test, publish again. There is no skip or override; do not
90
- look for one.
90
+ look for one. One case is the exception: when the refusal says the check failed only
91
+ intermittently (`[intermittent]`, code `intermittent`), `--accept-intermittent` /
92
+ `acceptIntermittent` publishes it. Use it only when the user said to accept that risk.
91
93
  6. **Try it** (optional) — `create_call` / `kumion calls create <agentId>` starts a web
92
94
  test call and returns a LiveKit room and token. With `phoneNumber` / `--to <phone>` it
93
95
  places a real outbound call instead (a domestic number; the agent must be published
@@ -96,6 +98,9 @@ A partner with several customers has one profile per customer tenant
96
98
  To dial at a stated time instead, `create_scheduled_call` / `kumion scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset>`
97
99
  (the offset is required, the time must be in the future, one dial with no redial; 403 when the tenant's
98
100
  automatic outbound dialing is off or the plan is free, 409 when the number already has a pending dial).
101
+ Both take per-call values, `--var <name>=<value>` (repeatable) / `variables`, read as `{{vars.<name>}}` in
102
+ the agent's prompts and opening line. The flag splits at the first `=`; a name left out reads as empty; a
103
+ 変数 marked 必須 must be given or the call is refused (400 `missing_variables`).
99
104
  `list_scheduled_calls` shows the state; `cancel_scheduled_call` works only before the dial starts.
100
105
 
101
106
  ## From a template to a published agent