@kumion/cli 0.6.0 → 0.6.2

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
@@ -15,7 +15,7 @@ npm i -g @kumion/cli
15
15
  kumion --help
16
16
  ```
17
17
 
18
- Requires Node.js 20.18 or later.
18
+ Requires Node.js 20.18.1 or later.
19
19
 
20
20
  By default the CLI talks to `https://app.kumion.jp`. Another environment can be
21
21
  selected with `--base-url` or `KUMION_API_BASE` (see [Options and environment](#options-and-environment)).
@@ -167,7 +167,10 @@ them. `calls list` returns one page (20 by default, at most 100) and prints the
167
167
  `--offset` of the next one. Every call in `calls list` and `calls get` carries what it came to: `outcome`
168
168
  (`ai_resolved`, `ai_unresolved_hangup`, `invalid_call`, `handoff`, `system_ended`, or `na` when not judged),
169
169
  `endedAtNode` (the node it ended on), `durationSec`, `transferred`, and `capturedItems` (the names of the
170
- items it recorded, never their values). A transcript holds only what the caller and the agent said.
170
+ items it recorded, never their values). `calls get` also returns `direction` (the raw value stored with
171
+ the call: `inbound`, `outbound`, `on_net`) and `portalDirection`, which is the 着信/発信 the Portal's call history
172
+ shows: `inbound`, `outbound`, or `null` when the call is neither (a trigger run, say). An `on_net` web call is
173
+ `inbound` there. Count 着信/発信 from `portalDirection`. A transcript's `turns` hold only what the caller and the agent said. A call handed to a person adds `handoffSegment` (`status` `transcribed` / `failed` / `not_sent`, `reason`, `fromSec` / `toSec`, and `turns` of `speaker`, `text`, `offsetSec`, in seconds into the call recording); `not_sent` means the tenant's contract forbids sending the recording out, so it has no text.
171
174
  Add `--json` to any command for the API's JSON instead of a summary.
172
175
 
173
176
  `hours` is the shop clock the call answers 「何時までですか」 from, and it is one calendar for the
@@ -363,6 +366,9 @@ A key a node does not store follows the agent's setting (会話の運用) or the
363
366
  | `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
364
367
  | `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool?,option_writes?}[]` | What this step collects, one object per item, in the order it asks. `key`: slot key. `label`: display name. `example`: test-call example. `source`: where the value comes from (caller, derived, system, tool). `value_type`: kind (text, select, boolean, ...). `options`: choices of a select item. `must_ask`: ask the caller to confirm on the spot even if already known (advanced). `min_digits` / `max_digits`: for a `code` item, the fewest / most digits the value may hold, counted by the platform (the same number twice = exact length). `tool`: `{tool_key,result_field}` for a tool-sourced item. `option_writes`: option → tool that must succeed before that option lets the call leave (advanced). |
365
368
  | `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
369
+ | `route_judge` | start | `tune` | `boolean` | Absent means off. Only an explicit true is stored. On: while the call stays on this start step, each caller turn is first read by the call model's own probability readout (at most 400 ms, before the AI answers); when it is sure which of the step's three connections fits, the call moves on without a model turn. Offered only for a call model whose endpoint has a calibrated readout; the step needs exactly three AI connections without items and no fixed connections (graph diagnostics `route_judge_not_applicable`). |
370
+ | `wait_for_first_word` | start | `tune` | `boolean` | Absent means off. Only an explicit true is stored. On: an outbound call waits for the customer to speak first and says the opening line when they finish or `first_word_wait_seconds` runs out. An inbound call never reads it (graph diagnostics `first_word_wait_outbound_only`). |
371
+ | `first_word_wait_seconds` | start | `tune` | `number` | Seconds `wait_for_first_word` waits (1 to 10, default 3). Absent means the default. Read only when `wait_for_first_word` is true. |
366
372
  | `respond_on_enter` | agent | `tune` | `boolean` | Absent means the node answers on arrival. Only an explicit false (wait for the caller) is stored. |
367
373
  | `confirm_before_end` | agent | `tune` | `boolean` | Absent means off (agents published before this setting keep their behaviour); a node created on the canvas stores true, and a node compiled from a SOP or document stores true when its connection to an end node requires items (the `end_without_readback` rule). On: the platform reads the recorded items back once before the call ends, and the end opens on a later caller turn with caller_confirmed. |
368
374
  | `confirm_before_end_keys` | agent | `internal` | `string[]` | Set by the compiler on a 伝言 step. With `confirm_before_end` on, the end readback reads only these item keys (the call-back number); absent means every item the ending requires. |
@@ -423,7 +429,7 @@ kumion agents publish <agentId> # runs the pre-publish check, then publishe
423
429
  `test-runs start` checks the draft without publishing anything. `agents publish` runs
424
430
  the Portal's pre-publish check and publishes only when it passes; when it does not, the
425
431
  failing cases are printed and nothing goes live. The CLI has no way to skip or override
426
- the check, with one exception: a case that failed only in some of its re-runs is marked
432
+ a case that failed again on re-run (`[reproduced]`). A refusal that carries no re-run verdict (for example a structural problem) is not intermittent either: fix its cause. The one exception: a case that failed only in some of its re-runs is marked
427
433
  `[intermittent]` (one that failed again is `[reproduced]`), and when nothing else is wrong the refusal
428
434
  says so and `agents publish <agentId> --accept-intermittent` (MCP: `acceptIntermittent`) publishes it
429
435
  anyway. It never applies to a check that failed every time. `test-runs get` marks the same cases and lists
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.6.0";
8
+ export const VERSION = "0.6.2";
9
9
  const HELP = `kumion — manage your Kumion voice agents over the Partner API
10
10
 
11
11
  Usage: kumion <command> [options]
@@ -1613,11 +1613,23 @@ async function agentsPublish(args, deps) {
1613
1613
  if (body.publishRunId)
1614
1614
  lines.push(`Publish run: ${String(body.publishRunId)} (details in the Portal).`);
1615
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`.");
1616
+ const detail = Array.isArray(body.intermittent) ? body.intermittent : [];
1617
+ for (const c of detail) {
1618
+ lines.push(`Case ${c.caseId ?? "?"} ran ${c.attempts?.length ?? 0} time(s):`);
1619
+ for (const a of c.attempts ?? []) {
1620
+ lines.push(` #${a.attempt} ${a.outcome}`);
1621
+ lines.push(...(a.reasons ?? []).map((r) => ` - ${r.kind}: ${r.detail}`));
1622
+ }
1623
+ }
1624
+ lines.push("The check failed only in some of its runs (intermittent) and nothing else is wrong. " +
1625
+ "If the reasons above are acceptable, publish anyway with `kumion agents publish " + agentId + " --accept-intermittent`. " +
1626
+ "Do not pass it unless the user has read them and agreed.");
1627
+ }
1628
+ else if (verdict?.cases?.some((c) => c.gate === "reproduced")) {
1629
+ lines.push("A failing case failed again on re-run (reproduced), so it cannot be skipped: fix the draft, run `kumion test-runs start`, and publish again.");
1618
1630
  }
1619
1631
  else {
1620
- lines.push("There is no override from the CLI: fix the draft, run `kumion test-runs start`, and publish again.");
1632
+ lines.push("The CLI cannot publish past this refusal: fix the cause above, run `kumion test-runs start`, and publish again.");
1621
1633
  }
1622
1634
  throw new ReportedFailure(lines.join("\n"));
1623
1635
  }
@@ -1785,6 +1797,12 @@ export function summarizeTestRun(run) {
1785
1797
  lines.push(...formatFindings(r.failures, " "));
1786
1798
  }
1787
1799
  }
1800
+ const gates = new Set((run.results ?? []).filter((r) => r.failures?.length).map((r) => r.gate));
1801
+ if (run.status === "failed" && gates.has("reproduced"))
1802
+ lines.push("[reproduced] cases failed again on re-run: fix the draft.");
1803
+ if (run.status === "failed" && gates.has("intermittent")) {
1804
+ lines.push("[intermittent] cases failed only in some runs. `agents publish --accept-intermittent` can publish past them if the user accepts the reasons.");
1805
+ }
1788
1806
  return lines.join("\n");
1789
1807
  }
1790
1808
  async function testRunsStart(args, deps) {
@@ -1990,6 +2008,7 @@ async function callsGet(args, deps) {
1990
2008
  `Call ${call.id}`,
1991
2009
  `Agent: ${call.agentName ?? "-"}${call.agentId ? ` (${call.agentId})` : ""}`,
1992
2010
  `Source: ${call.source}${call.direction ? ` (${call.direction})` : ""}`,
2011
+ `Direction: ${call.portalDirection ?? "-"}`,
1993
2012
  `Caller: ${call.remoteE164 ?? "-"}${call.localE164 ? ` → ${call.localE164}` : ""}`,
1994
2013
  `Started: ${call.startedAt}`,
1995
2014
  `Answered: ${call.answeredAt ?? "-"}`,
@@ -2008,11 +2027,21 @@ export function formatTranscript(transcript) {
2008
2027
  if (!transcript.available) {
2009
2028
  return "No transcript yet — it is written when the call ends, and a call that never connected has none.";
2010
2029
  }
2011
- if (transcript.turns.length === 0)
2030
+ const segment = transcript.handoffSegment;
2031
+ if (transcript.turns.length === 0 && !segment)
2012
2032
  return "The transcript is empty: nobody said anything.";
2013
- return transcript.turns
2014
- .map((t) => `${t.at ? `[${t.at}] ` : ""}${t.role === "user" ? "Caller" : "Agent "}: ${t.text}`)
2015
- .join("\n");
2033
+ const lines = transcript.turns.map((t) => `${t.at ? `[${t.at}] ` : ""}${t.role === "user" ? "Caller" : "Agent "}: ${t.text}`);
2034
+ if (segment) {
2035
+ lines.push("--- After the handover to a person ---");
2036
+ if (segment.status === "not_sent")
2037
+ lines.push("Not transcribed: the tenant's contract forbids sending the recording out.");
2038
+ else if (segment.status === "failed")
2039
+ lines.push(`Transcription failed${segment.reason ? ` (${segment.reason})` : ""}.`);
2040
+ for (const t of segment.turns) {
2041
+ lines.push(`${t.offsetSec !== null ? `[+${t.offsetSec}s] ` : ""}${t.speaker !== null ? `Person (speaker ${t.speaker})` : "Person"}: ${t.text}`);
2042
+ }
2043
+ }
2044
+ return lines.join("\n");
2016
2045
  }
2017
2046
  async function callsTranscript(args, deps) {
2018
2047
  const { values, positionals } = parse(args, {});
package/dist/mcp.js CHANGED
@@ -302,9 +302,10 @@ 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; a failing check cannot be skipped. The one exception: a check that failed " +
305
+ "publishes only if it passes; a check that failed again on re-run (`gate: reproduced`) cannot be skipped. " +
306
+ "The exception: a check that failed " +
306
307
  "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 " +
308
+ "`acceptIntermittent` publishes it anyway; pass it only after the user has seen each run's reasons and explicitly agreed. Can take a few minutes. On failure the " +
308
309
  "failing cases are returned. A success carries `unconfirmedFacts`: how many of the agent's 資料 facts " +
309
310
  "nobody has confirmed yet — for each of them the agent says it will check and call back instead of " +
310
311
  "stating it (confirm_facts confirms them). Needs agents:publish.",
@@ -314,7 +315,7 @@ export function createKumionMcpServer(client, options) {
314
315
  acceptIntermittent: z
315
316
  .boolean()
316
317
  .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."),
318
+ .describe("Publish although the check failed only in some of its runs (code `intermittent`). Pass only after the user has seen each run's reasons and explicitly agreed. Has no effect on a check that failed again on re-run."),
318
319
  },
319
320
  annotations: { destructiveHint: true, idempotentHint: false },
320
321
  }, (args) => attempt(() => client.publishAgent(args.agentId, args.revision, { acceptIntermittent: args.acceptIntermittent === true })));
@@ -413,7 +414,7 @@ export function createKumionMcpServer(client, options) {
413
414
  annotations: { readOnlyHint: true },
414
415
  }, (args) => attempt(() => client.listCalls(args)));
415
416
  server.registerTool("get_call", {
416
- description: "Read one call: agent, source and direction, numbers, when it started, was answered and ended, how it " +
417
+ description: "Read one call: agent, source, `direction` (the raw column) and `portalDirection` (inbound / outbound as the Portal 通話履歴 counts it; null when neither), numbers, when it started, was answered and ended, how it " +
417
418
  "ended, its result (`outcome`, `endedAtNode`, `durationSec`, `transferred`, `capturedItems`), and whether " +
418
419
  "a transcript exists (read it with get_call_transcript). The channel is only on list_calls. Needs calls:read.",
419
420
  inputSchema: { callId },
@@ -422,7 +423,10 @@ export function createKumionMcpServer(client, options) {
422
423
  server.registerTool("get_call_transcript", {
423
424
  description: "Read what the caller (`user`) and the agent (`assistant`) said on one call, in order. Tool calls and " +
424
425
  "the agent's instructions are not included. `available: false` means no transcript has been written " +
425
- "yet (the call is still up, or never connected) — not that the call was silent. Needs calls:read.",
426
+ "yet (the call is still up, or never connected) — not that the call was silent. A call handed to a " +
427
+ "person also carries `handoffSegment`: what the person said after the pickup (`status` transcribed / " +
428
+ "failed / not_sent; not_sent means the tenant's contract forbids sending the recording out, so there is " +
429
+ "no text). Needs calls:read.",
426
430
  inputSchema: { callId },
427
431
  annotations: { readOnlyHint: true },
428
432
  }, (args) => attempt(async () => ({ transcript: await client.getTranscript(args.callId) })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumion/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Manage your Kumion voice agents from the terminal over the Kumion Partner API",
5
5
  "author": "KAOPA株式会社",
6
6
  "license": "MIT",
@@ -24,7 +24,8 @@ Two ways in, same operations and same permissions:
24
24
  `update_capture_spec`, `get_agent_capture`, `set_agent_capture`,
25
25
  `upload_document`, `get_document_upload_job`, `get_document`,
26
26
  `replace_document`, `start_test_run`, `get_test_run`, `list_test_runs`,
27
- `create_call`, `list_calls`, `get_call`, `get_call_transcript`.
27
+ `create_call`, `create_scheduled_call`, `list_scheduled_calls`,
28
+ `cancel_scheduled_call`, `list_calls`, `get_call`, `get_call_transcript`.
28
29
  - **The `kumion` CLI** otherwise (`kumion --help`). Add `--json` for machine-readable
29
30
  output.
30
31
 
@@ -86,10 +87,10 @@ A partner with several customers has one profile per customer tenant
86
87
  5. **Publish** — only when the user asked for it. `publish_agent` /
87
88
  `kumion agents publish <agentId>`. It runs the same pre-publish check as the Portal
88
89
  and can take a few minutes. If the check fails, nothing goes live and the failing
89
- cases come back: fix, test, publish again. There is no skip or override; do not
90
- look for one. One case is the exception: when the refusal says the check failed only
90
+ cases come back: fix, test, publish again. A reproduced failure (`[reproduced]`) has no skip or
91
+ override; do not look for one. A refusal with no re-run verdict is not intermittent: fix its cause. One case is the exception: when the refusal says the check failed only
91
92
  intermittently (`[intermittent]`, code `intermittent`), `--accept-intermittent` /
92
- `acceptIntermittent` publishes it. Use it only when the user said to accept that risk.
93
+ `acceptIntermittent` publishes it. Use it only after the user has seen each run's reasons and said to accept that risk.
93
94
  6. **Try it** (optional) — `create_call` / `kumion calls create <agentId>` starts a web
94
95
  test call and returns a LiveKit room and token. With `phoneNumber` / `--to <phone>` it
95
96
  places a real outbound call instead (a domestic number; the agent must be published
@@ -151,7 +152,11 @@ channel, time range, or caller number). Each call already carries its result (`o
151
152
  transcript only for the call you need. `get_call_transcript` /
152
153
  `kumion calls transcript <callId>` returns what the caller (`user`) and the agent
153
154
  (`assistant`) said. `available: false` means no transcript has been written yet, not a
154
- silent call. Use a transcript to find where the agent went wrong before editing its
155
+ silent call. A call handed to a person also has `handoffSegment`: what the person said after
156
+ the pickup (`status` is `transcribed`, `failed` or `not_sent`; `not_sent` means the tenant's
157
+ contract forbids sending the recording out, so there is no text). `turns` stays the AI part. `get_call` carries `direction` (the raw stored value) and `portalDirection` (`inbound` /
158
+ `outbound` / null: the 着信/発信 the Portal call history shows); count from `portalDirection`.
159
+ Use a transcript to find where the agent went wrong before editing its
155
160
  draft. Transcripts are the tenant's customers' conversations: quote only what the task
156
161
  needs.
157
162
 
@@ -263,6 +268,9 @@ A key a node does not store follows the agent's setting (会話の運用) or the
263
268
  | `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
264
269
  | `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool?,option_writes?}[]` | What this step collects, one object per item, in the order it asks. `key`: slot key. `label`: display name. `example`: test-call example. `source`: where the value comes from (caller, derived, system, tool). `value_type`: kind (text, select, boolean, ...). `options`: choices of a select item. `must_ask`: ask the caller to confirm on the spot even if already known (advanced). `min_digits` / `max_digits`: for a `code` item, the fewest / most digits the value may hold, counted by the platform (the same number twice = exact length). `tool`: `{tool_key,result_field}` for a tool-sourced item. `option_writes`: option → tool that must succeed before that option lets the call leave (advanced). |
265
270
  | `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
271
+ | `route_judge` | start | `tune` | `boolean` | Absent means off. Only an explicit true is stored. On: while the call stays on this start step, each caller turn is first read by the call model's own probability readout (at most 400 ms, before the AI answers); when it is sure which of the step's three connections fits, the call moves on without a model turn. Offered only for a call model whose endpoint has a calibrated readout; the step needs exactly three AI connections without items and no fixed connections (graph diagnostics `route_judge_not_applicable`). |
272
+ | `wait_for_first_word` | start | `tune` | `boolean` | Absent means off. Only an explicit true is stored. On: an outbound call waits for the customer to speak first and says the opening line when they finish or `first_word_wait_seconds` runs out. An inbound call never reads it (graph diagnostics `first_word_wait_outbound_only`). |
273
+ | `first_word_wait_seconds` | start | `tune` | `number` | Seconds `wait_for_first_word` waits (1 to 10, default 3). Absent means the default. Read only when `wait_for_first_word` is true. |
266
274
  | `respond_on_enter` | agent | `tune` | `boolean` | Absent means the node answers on arrival. Only an explicit false (wait for the caller) is stored. |
267
275
  | `confirm_before_end` | agent | `tune` | `boolean` | Absent means off (agents published before this setting keep their behaviour); a node created on the canvas stores true, and a node compiled from a SOP or document stores true when its connection to an end node requires items (the `end_without_readback` rule). On: the platform reads the recorded items back once before the call ends, and the end opens on a later caller turn with caller_confirmed. |
268
276
  | `confirm_before_end_keys` | agent | `internal` | `string[]` | Set by the compiler on a 伝言 step. With `confirm_before_end` on, the end readback reads only these item keys (the call-back number); absent means every item the ending requires. |