@kumion/cli 0.6.4 → 0.6.5

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
@@ -376,9 +376,9 @@ A key a node does not store follows the agent's setting (会話の運用) or the
376
376
 
377
377
  | Key | Node types | Layer | Type | Note |
378
378
  | --- | --- | --- | --- | --- |
379
- | `display_name` | start, agent, end, global, trigger, webhook, qa, ivr, transfer, notify | `internal` | `string` | The name shown on the canvas. Edited by renaming the node. |
379
+ | `display_name` | start, agent, end, global, trigger, webhook, ivr, transfer, notify | `internal` | `string` | The name shown on the canvas. Edited by renaming the node. |
380
380
  | `leaf_label` | start, agent | `internal` | `string` | Set by the manual compiler. The purpose name the diagnostics quote. |
381
- | `canvas_flow` | start, agent, end, global, trigger, webhook, qa, ivr, transfer, notify | `internal` | `object` | Canvas layout state. Not a setting. |
381
+ | `canvas_flow` | start, agent, end, global, trigger, webhook, ivr, transfer, notify | `internal` | `object` | Canvas layout state. Not a setting. |
382
382
  | `flow_expectations` | global | `internal` | `object` | Written by the scenario interview. Not a setting. |
383
383
  | `wait_cover` | start, agent | `tune` | `{ enabled?, on_threshold?, threshold_ms?, on_query_start?, query_grace_ms? }` | Node-level hold phrase. By default it plays only when a lookup tool is still running after `query_grace_ms` (100 to 10000, default 1000); `on_query_start: false` turns that off. `on_threshold: true` also plays it after `threshold_ms` (2000 to 15000, default 2000) of silence on an ordinary turn (default off). `enabled: false` turns it off for this node. The phrase text is set per agent. |
384
384
  | `trigger_path` | trigger | `internal` | `string` | Generated. Shown read-only as the trigger URL. |
@@ -412,11 +412,6 @@ A key a node does not store follows the agent's setting (会話の運用) or the
412
412
  | `endpoint_url` | webhook | `required` | `string` | Destination URL. |
413
413
  | `payload_template` | webhook | `required` | `string` | Request body template with {{variables}}. |
414
414
  | `custom_headers` | webhook | `advanced` | `{ key, secret }[]` | Extra request headers. A value is never returned: a row you read has `secret` (a reference); to set a value send `{ key, value }` once, and the reply has the reference. Send read rows back unchanged. |
415
- | `qa_system_prompt` | qa | `required` | `string` | Evaluation prompt. |
416
- | `qa_sample_rate` | qa | `required` | `number` | Percentage of calls analysed, 1 to 100. |
417
- | `qa_min_call_duration` | qa | `required` | `number` | Shortest call (seconds) that is analysed. |
418
- | `qa_model` | qa | `advanced` | `string` | Model override for this analysis. |
419
- | `qa_voicemail_calls` | qa | `advanced` | `boolean` | Whether voicemail calls are analysed (default true). |
420
415
 
421
416
  A required item's 種類 is stored as a pair on the item: `source` and `value_type`.
422
417
  These are the pairs the Portal offers:
package/dist/client.js CHANGED
@@ -237,11 +237,16 @@ export class KumionClient {
237
237
  return body;
238
238
  }
239
239
  async publishAgent(agentId, revision, options = {}) {
240
- const { body } = await this.request("POST", this.agentPath(agentId, "/publish"), "agents:publish", {
241
- body: options.acceptIntermittent ? { acceptIntermittent: true } : {},
240
+ const body = {};
241
+ if (options.acceptIntermittent)
242
+ body.acceptIntermittent = true;
243
+ if (options.acceptLowConfidence)
244
+ body.acceptLowConfidence = true;
245
+ const { body: response } = await this.request("POST", this.agentPath(agentId, "/publish"), "agents:publish", {
246
+ body,
242
247
  ifMatch: revision,
243
248
  });
244
- return body;
249
+ return response;
245
250
  }
246
251
  async startTestRun(agentId, turns) {
247
252
  const { body } = await this.request("POST", this.agentPath(agentId, "/test-runs"), "tests:run", {
package/dist/main.js CHANGED
@@ -6,7 +6,7 @@ import { ApiError, KumionClient, isTextFile, specText, } from "./client.js";
6
6
  import { DEFAULT_BASE_URL, keyPrefix, looksLikeApiKey, normalizeBaseUrl, resolveCredentials, } from "./credentials.js";
7
7
  import { DEFAULT_DEVICE_SCOPES, deviceLogin } from "./device-login.js";
8
8
  import { describeError, ReportedFailure, UsageError } from "./errors.js";
9
- export const VERSION = "0.6.4";
9
+ export const VERSION = "0.6.5";
10
10
  const HELP = `kumion — manage your Kumion voice agents over the Partner API
11
11
 
12
12
  Usage: kumion <command> [options]
@@ -35,7 +35,7 @@ Agents
35
35
  出力日時 on the cover is the moment of the export
36
36
  agents patch <agentId> --revision <rev> [--prompt <text> | --prompt-file <path>] [--graph-file <path>]
37
37
  Edit the draft (never goes live by itself)
38
- agents publish <agentId> [--revision <rev>] [--accept-intermittent]
38
+ agents publish <agentId> [--revision <rev>] [--accept-intermittent] [--accept-low-confidence]
39
39
  Publish the draft through the pre-publish check
40
40
  agents opening-name <agentId> --revision <rev> (--on | --off)
41
41
  Whether the opening line uses the caller's name (a draft write:
@@ -47,6 +47,7 @@ Agents
47
47
  (needs a key with agents:live)
48
48
  agents create-from-template --template <id> --business-name <name> [--name <name>]
49
49
  [--url <url> | --document <documentId>] [--idempotency-key <key>]
50
+ [--fallback-staff <contactKey>]
50
51
  Create a DRAFT agent from an onboarding template. With no
51
52
  source, every fact is 「まだない情報」. With a URL (same site,
52
53
  up to 10 pages) or a document already uploaded and extracted
@@ -811,6 +812,7 @@ async function agentsCreateFromTemplate(args, deps) {
811
812
  url: { type: "string" },
812
813
  document: { type: "string" },
813
814
  "idempotency-key": { type: "string" },
815
+ "fallback-staff": { type: "string" },
814
816
  });
815
817
  if (!values.template)
816
818
  throw new UsageError("Pass --template <id> (see `kumion templates list`).");
@@ -825,6 +827,7 @@ async function agentsCreateFromTemplate(args, deps) {
825
827
  ...(values.url ? { url: values.url } : {}),
826
828
  ...(values.document ? { documentId: values.document } : {}),
827
829
  ...(values["idempotency-key"] ? { idempotencyKey: values["idempotency-key"] } : {}),
830
+ ...(values["fallback-staff"] ? { fallbackStaffKey: values["fallback-staff"] } : {}),
828
831
  });
829
832
  if (values.json) {
830
833
  printJson(deps, result);
@@ -1627,12 +1630,15 @@ function formatFindings(findings, indent) {
1627
1630
  return (findings ?? []).map((f) => `${indent}- ${f.kind}${f.nodeKey ? ` @${f.nodeKey}` : ""}: ${f.detail}`);
1628
1631
  }
1629
1632
  async function agentsPublish(args, deps) {
1630
- const { values, positionals } = parse(args, { revision: { type: "string" }, "accept-intermittent": { type: "boolean" } });
1633
+ const { values, positionals } = parse(args, { revision: { type: "string" }, "accept-intermittent": { type: "boolean" }, "accept-low-confidence": { type: "boolean" } });
1631
1634
  const agentId = need(positionals, 0, "agentId");
1632
1635
  const client = await clientFor(values, deps);
1633
1636
  deps.io.err("Publishing — the pre-publish check runs first and can take a few minutes…");
1634
1637
  try {
1635
- const result = await client.publishAgent(agentId, values.revision, { acceptIntermittent: values["accept-intermittent"] === true });
1638
+ const result = await client.publishAgent(agentId, values.revision, {
1639
+ acceptIntermittent: values["accept-intermittent"] === true,
1640
+ acceptLowConfidence: values["accept-low-confidence"] === true,
1641
+ });
1636
1642
  if (values.json)
1637
1643
  printJson(deps, result);
1638
1644
  else {
@@ -1670,18 +1676,29 @@ async function agentsPublish(args, deps) {
1670
1676
  }
1671
1677
  if (body.publishRunId)
1672
1678
  lines.push(`Publish run: ${String(body.publishRunId)} (details in the Portal).`);
1673
- if (body.code === "intermittent") {
1679
+ if (body.code === "intermittent" || body.code === "low_confidence") {
1674
1680
  const detail = Array.isArray(body.intermittent) ? body.intermittent : [];
1681
+ const gates = new Set(detail.map((c) => c.gate).filter((g) => typeof g === "string"));
1682
+ const wantsIntermittent = body.code === "intermittent" || gates.has("intermittent");
1683
+ const wantsLow = body.code === "low_confidence";
1675
1684
  for (const c of detail) {
1676
- lines.push(`Case ${c.caseId ?? "?"} ran ${c.attempts?.length ?? 0} time(s):`);
1685
+ lines.push(`Case ${c.caseId ?? "?"}${c.gate ? ` [${c.gate}]` : ""} ran ${c.attempts?.length ?? 0} time(s):`);
1677
1686
  for (const a of c.attempts ?? []) {
1678
1687
  lines.push(` #${a.attempt} ${a.outcome}`);
1679
1688
  lines.push(...(a.reasons ?? []).map((r) => ` - ${r.kind}: ${r.detail}`));
1680
1689
  }
1681
1690
  }
1682
- lines.push("The check failed only in some of its runs (intermittent) and nothing else is wrong. " +
1683
- "If the reasons above are acceptable, publish anyway with `kumion agents publish " + agentId + " --accept-intermittent`. " +
1684
- "Do not pass it unless the user has read them and agreed.");
1691
+ const flags = [
1692
+ wantsIntermittent ? "--accept-intermittent" : null,
1693
+ wantsLow ? "--accept-low-confidence" : null,
1694
+ ].filter((f) => f != null);
1695
+ lines.push((wantsLow && wantsIntermittent
1696
+ ? "The check has cases that failed only in some runs and cases that failed on an untrustworthy condition. "
1697
+ : wantsLow
1698
+ ? "The check failed on a condition whose own text is untrustworthy (low_confidence) and was not re-run. --accept-intermittent does not cover it. "
1699
+ : "The check failed only in some of its runs (intermittent) and nothing else is wrong. ") +
1700
+ "If the reasons above are acceptable, publish anyway with `kumion agents publish " + agentId + " " + flags.join(" ") + "`. " +
1701
+ "Do not pass " + (flags.length > 1 ? "them" : "it") + " unless the user has read them and agreed.");
1685
1702
  }
1686
1703
  else if (verdict?.cases?.some((c) => c.gate === "reproduced")) {
1687
1704
  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.");
@@ -1917,6 +1934,9 @@ export function summarizeTestRun(run) {
1917
1934
  if (run.status === "failed" && gates.has("intermittent")) {
1918
1935
  lines.push("[intermittent] cases failed only in some runs. `agents publish --accept-intermittent` can publish past them if the user accepts the reasons.");
1919
1936
  }
1937
+ if (run.status === "failed" && gates.has("low_confidence")) {
1938
+ lines.push("[low_confidence] cases failed on a condition whose own text is untrustworthy and were not re-run. `agents publish --accept-low-confidence` can publish past them; --accept-intermittent does not.");
1939
+ }
1920
1940
  return lines.join("\n");
1921
1941
  }
1922
1942
  async function testRunsStart(args, deps) {
package/dist/mcp.js CHANGED
@@ -88,6 +88,11 @@ export function createKumionMcpServer(client, options) {
88
88
  .max(200)
89
89
  .optional()
90
90
  .describe("Safe-retry key: send the same key again to get the agent the first call built instead of a second one."),
91
+ fallbackStaffKey: z
92
+ .string()
93
+ .min(1)
94
+ .optional()
95
+ .describe("company_switchboard only: key of the staff contact that urgent / ask-for-a-person calls go to (omit for 伝言)."),
91
96
  },
92
97
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
93
98
  }, (args) => attempt(() => client.createAgentFromTemplate({
@@ -97,6 +102,7 @@ export function createKumionMcpServer(client, options) {
97
102
  ...(args.url ? { url: args.url } : {}),
98
103
  ...(args.documentId ? { documentId: args.documentId } : {}),
99
104
  ...(args.idempotencyKey ? { idempotencyKey: args.idempotencyKey } : {}),
105
+ ...(args.fallbackStaffKey ? { fallbackStaffKey: args.fallbackStaffKey } : {}),
100
106
  })));
101
107
  server.registerTool("get_agent", {
102
108
  description: "Read one agent: its draft (prompt, flow graph) and its published version. The returned `revision` is " +
@@ -304,9 +310,11 @@ export function createKumionMcpServer(client, options) {
304
310
  server.registerTool("publish_agent", {
305
311
  description: "Publish the agent's draft so callers get it. Runs the same pre-publish check as the Portal first and " +
306
312
  "publishes only if it passes; a check that failed again on re-run (`gate: reproduced`) cannot be skipped. " +
307
- "The exception: a check that failed " +
313
+ "The exceptions: a check that failed " +
308
314
  "only in some of its runs comes back with code `intermittent` and the cases (`gate: intermittent`), and " +
309
- "`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 " +
315
+ "`acceptIntermittent` publishes it anyway; a check red on a condition whose own text is untrustworthy comes back " +
316
+ "with code `low_confidence` (`gate: low_confidence`) and `acceptLowConfidence` publishes it — `acceptIntermittent` does not. " +
317
+ "A check holding both needs both flags. Pass either only after the user has seen each run's reasons and explicitly agreed. Can take a few minutes. On failure the " +
310
318
  "failing cases are returned. A success carries `unconfirmedFacts`: how many of the agent's 資料 facts " +
311
319
  "nobody has confirmed yet — for each of them the agent says it will check and call back instead of " +
312
320
  "stating it (confirm_facts confirms them). Needs agents:publish.",
@@ -316,10 +324,17 @@ export function createKumionMcpServer(client, options) {
316
324
  acceptIntermittent: z
317
325
  .boolean()
318
326
  .optional()
319
- .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."),
327
+ .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, and does not cover `low_confidence`."),
328
+ acceptLowConfidence: z
329
+ .boolean()
330
+ .optional()
331
+ .describe("Publish although the check failed on a condition whose own text is untrustworthy and was not re-run (code `low_confidence`). Pass only after the user has seen the reasons and explicitly agreed. Does not cover `intermittent`; a check holding both needs both flags."),
320
332
  },
321
333
  annotations: { destructiveHint: true, idempotentHint: false },
322
- }, (args) => attempt(() => client.publishAgent(args.agentId, args.revision, { acceptIntermittent: args.acceptIntermittent === true })));
334
+ }, (args) => attempt(() => client.publishAgent(args.agentId, args.revision, {
335
+ acceptIntermittent: args.acceptIntermittent === true,
336
+ acceptLowConfidence: args.acceptLowConfidence === true,
337
+ })));
323
338
  server.registerTool("start_test_run", {
324
339
  description: "Run the agent's regression tests against its draft (publishes nothing). Returns at once with the run " +
325
340
  `unless waitSeconds is set (at most ${MAX_TEST_RUN_WAIT_SECONDS}); follow a running run with ` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumion/cli",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Manage your Kumion voice agents from the terminal over the Kumion Partner API",
5
5
  "author": "KAOPA株式会社",
6
6
  "license": "MIT",
@@ -263,9 +263,9 @@ A key a node does not store follows the agent's setting (会話の運用) or the
263
263
 
264
264
  | Key | Node types | Layer | Type | Note |
265
265
  | --- | --- | --- | --- | --- |
266
- | `display_name` | start, agent, end, global, trigger, webhook, qa, ivr, transfer, notify | `internal` | `string` | The name shown on the canvas. Edited by renaming the node. |
266
+ | `display_name` | start, agent, end, global, trigger, webhook, ivr, transfer, notify | `internal` | `string` | The name shown on the canvas. Edited by renaming the node. |
267
267
  | `leaf_label` | start, agent | `internal` | `string` | Set by the manual compiler. The purpose name the diagnostics quote. |
268
- | `canvas_flow` | start, agent, end, global, trigger, webhook, qa, ivr, transfer, notify | `internal` | `object` | Canvas layout state. Not a setting. |
268
+ | `canvas_flow` | start, agent, end, global, trigger, webhook, ivr, transfer, notify | `internal` | `object` | Canvas layout state. Not a setting. |
269
269
  | `flow_expectations` | global | `internal` | `object` | Written by the scenario interview. Not a setting. |
270
270
  | `wait_cover` | start, agent | `tune` | `{ enabled?, on_threshold?, threshold_ms?, on_query_start?, query_grace_ms? }` | Node-level hold phrase. By default it plays only when a lookup tool is still running after `query_grace_ms` (100 to 10000, default 1000); `on_query_start: false` turns that off. `on_threshold: true` also plays it after `threshold_ms` (2000 to 15000, default 2000) of silence on an ordinary turn (default off). `enabled: false` turns it off for this node. The phrase text is set per agent. |
271
271
  | `trigger_path` | trigger | `internal` | `string` | Generated. Shown read-only as the trigger URL. |
@@ -299,11 +299,6 @@ A key a node does not store follows the agent's setting (会話の運用) or the
299
299
  | `endpoint_url` | webhook | `required` | `string` | Destination URL. |
300
300
  | `payload_template` | webhook | `required` | `string` | Request body template with {{variables}}. |
301
301
  | `custom_headers` | webhook | `advanced` | `{ key, secret }[]` | Extra request headers. A value is never returned: a row you read has `secret` (a reference); to set a value send `{ key, value }` once, and the reply has the reference. Send read rows back unchanged. |
302
- | `qa_system_prompt` | qa | `required` | `string` | Evaluation prompt. |
303
- | `qa_sample_rate` | qa | `required` | `number` | Percentage of calls analysed, 1 to 100. |
304
- | `qa_min_call_duration` | qa | `required` | `number` | Shortest call (seconds) that is analysed. |
305
- | `qa_model` | qa | `advanced` | `string` | Model override for this analysis. |
306
- | `qa_voicemail_calls` | qa | `advanced` | `boolean` | Whether voicemail calls are analysed (default true). |
307
302
 
308
303
  A required item's 種類 is stored as a pair on the item: `source` and `value_type`.
309
304
  These are the pairs the Portal offers: