@kumion/cli 0.6.3 → 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 +24 -9
- package/dist/client.js +8 -3
- package/dist/data-ops.js +196 -0
- package/dist/main.js +140 -11
- package/dist/mcp.js +28 -4
- package/package.json +1 -1
- package/skills/kumion/SKILL.md +16 -10
package/README.md
CHANGED
|
@@ -119,6 +119,25 @@ would use.
|
|
|
119
119
|
| `kumion staff list` | `agents:read` |
|
|
120
120
|
| `kumion staff create --name <name> [--transfer-target <number>] [--department <text>] [--kana <text>] [--email <address>] [--note <text>] [--enabled false]` | `agents:write` (draft-side: no call reaches a new row until a 用件's 転送 names its key and the agent is published) |
|
|
121
121
|
| `kumion staff update <staffId> --revision <rev> [--name ...] [--transfer-target ...] [--enabled true\|false]` | `agents:live` (live: no publish) |
|
|
122
|
+
| `kumion contacts list [--q <text>] [--limit <n>] [--offset <n>]` | `contacts:read` |
|
|
123
|
+
| `kumion contacts get <contactId>` | `contacts:read` |
|
|
124
|
+
| `kumion contacts create --name <text> [--phone <text>] [--kana <text>] [--department <text>] [--email <text>] [--note <text>] [--topics <value> ...] [--custom <key>=<value> ...]` | `contacts:write` |
|
|
125
|
+
| `kumion contacts update <contactId> [--name <text>] [--phone <text>] [--kana <text>] [--department <text>] [--email <text>] [--note <text>] [--enabled true\|false] [--topics <value> ...] [--custom <key>=<value> ...]` | `contacts:write` |
|
|
126
|
+
| `kumion contacts calls <contactId> [--limit <n>] [--offset <n>]` | `contacts:read` |
|
|
127
|
+
| `kumion contact-fields list` | `contacts:read` |
|
|
128
|
+
| `kumion calls link-contact <callId> --name <text>` | `calls:write` |
|
|
129
|
+
| `kumion call-marks list <callId>` | `calls:read` |
|
|
130
|
+
| `kumion call-marks set <callId> --type <text> [--citation <text>] [--note <text>]` | `calls:write` |
|
|
131
|
+
| `kumion call-marks clear <callId> <typeId>` | `calls:write` |
|
|
132
|
+
| `kumion call-marks create-type --name <text>` | `calls:write` |
|
|
133
|
+
| `kumion callback-lists create --call <value> ... [--name <text>]` | `calls:write` |
|
|
134
|
+
| `kumion captures list [--type <text>] [--spec <text>] [--agent <text>] [--field <text>] [--value <text>] [--q <text>] [--status open\|done\|dismissed] [--from <text>] [--to <text>] [--limit <n>] [--offset <n>]` | `captures:read` |
|
|
135
|
+
| `kumion captures update <captureId> [--status open\|done\|dismissed] [--note <text>]` | `captures:write` |
|
|
136
|
+
| `kumion captures status-log <captureId>` | `captures:read` |
|
|
137
|
+
| `kumion documents history <documentId>` | `agents:read` |
|
|
138
|
+
| `kumion documents version-diff <documentId> --from <n> --to <n>` | `agents:read` |
|
|
139
|
+
| `kumion documents rollback <documentId> --target-version <n>` | `agents:live` (live: no publish) |
|
|
140
|
+
| `kumion analytics get [--agent <text>] [--channel <text>] [--from <text>] [--to <text>] [--spec <text>] [--field-key <text>]` | `analytics:read` |
|
|
122
141
|
| `kumion hours get [--from <date>] [--to <date>] [--json]` | `agents:read` |
|
|
123
142
|
| `kumion hours update --revision <rev> [--business-hours-file <path>] [--closed-rules-file <path>] [--observe-jp-holidays true\|false] [--dry-run]` | `agents:live` (live: no publish) |
|
|
124
143
|
| `kumion hours exception set <date> --revision <rev> --kind closed\|open\|inherit [--hours-file <path>] [--note <text>] [--dry-run]` | `agents:live` (live: no publish) |
|
|
@@ -357,9 +376,9 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
357
376
|
|
|
358
377
|
| Key | Node types | Layer | Type | Note |
|
|
359
378
|
| --- | --- | --- | --- | --- |
|
|
360
|
-
| `display_name` | start, agent, end, global, trigger, webhook,
|
|
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. |
|
|
361
380
|
| `leaf_label` | start, agent | `internal` | `string` | Set by the manual compiler. The purpose name the diagnostics quote. |
|
|
362
|
-
| `canvas_flow` | start, agent, end, global, trigger, webhook,
|
|
381
|
+
| `canvas_flow` | start, agent, end, global, trigger, webhook, ivr, transfer, notify | `internal` | `object` | Canvas layout state. Not a setting. |
|
|
363
382
|
| `flow_expectations` | global | `internal` | `object` | Written by the scenario interview. Not a setting. |
|
|
364
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. |
|
|
365
384
|
| `trigger_path` | trigger | `internal` | `string` | Generated. Shown read-only as the trigger URL. |
|
|
@@ -367,6 +386,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
367
386
|
| `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool?}[]` | 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. |
|
|
368
387
|
| `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
|
|
369
388
|
| `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`). |
|
|
389
|
+
| `ai_disclosure_stated` | start | `tune` | `boolean` | Absent means not declared. Only an explicit true is stored. The author's own statement that the opening tells the caller they are speaking with an AI; the platform does not read the opening for it. Not declared: graph diagnostics `opening_no_ai_disclosure` (a warning, never blocks). |
|
|
370
390
|
| `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
391
|
| `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. |
|
|
372
392
|
| `respond_on_enter` | agent | `tune` | `boolean` | Absent means the node answers on arrival. Only an explicit false (wait for the caller) is stored. |
|
|
@@ -380,7 +400,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
380
400
|
| `opening_audio_filename` | start | `internal` | `string` | Display name of the uploaded opening audio. |
|
|
381
401
|
| `precall_fetch_url` | start | `advanced` | `string` | URL fetched before the call starts; the response becomes call variables. |
|
|
382
402
|
| `precall_fetch_method` | start | `advanced` | `string` | HTTP method of the pre-call fetch. |
|
|
383
|
-
| `precall_fetch_headers` | start | `advanced` | `{ key,
|
|
403
|
+
| `precall_fetch_headers` | start | `advanced` | `{ key, secret }[]` | Headers of the pre-call fetch. 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. |
|
|
384
404
|
| `no_response` | start, agent | `advanced` | `{ timeout_s, reprompt_speech?, max_reprompts, then }` | Node-level no-response timer. { timeout_s: 0 } turns the agent default off here. |
|
|
385
405
|
| `kb_fallback` | start, agent | `advanced` | `{ noResult?, unavailable? }` | Wording when a knowledge search finds nothing or is unavailable. Overrides the tenant operations setting. |
|
|
386
406
|
| `end_speech` | end | `required` | `string` | Default goodbye line. A connection into this node can override it. |
|
|
@@ -391,12 +411,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
391
411
|
| `http_method` | webhook | `required` | `string` | GET, POST, PUT, PATCH or DELETE. |
|
|
392
412
|
| `endpoint_url` | webhook | `required` | `string` | Destination URL. |
|
|
393
413
|
| `payload_template` | webhook | `required` | `string` | Request body template with {{variables}}. |
|
|
394
|
-
| `custom_headers` | webhook | `advanced` | `{ key,
|
|
395
|
-
| `qa_system_prompt` | qa | `required` | `string` | Evaluation prompt. |
|
|
396
|
-
| `qa_sample_rate` | qa | `required` | `number` | Percentage of calls analysed, 1 to 100. |
|
|
397
|
-
| `qa_min_call_duration` | qa | `required` | `number` | Shortest call (seconds) that is analysed. |
|
|
398
|
-
| `qa_model` | qa | `advanced` | `string` | Model override for this analysis. |
|
|
399
|
-
| `qa_voicemail_calls` | qa | `advanced` | `boolean` | Whether voicemail calls are analysed (default true). |
|
|
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. |
|
|
400
415
|
|
|
401
416
|
A required item's 種類 is stored as a pair on the item: `source` and `value_type`.
|
|
402
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
|
|
241
|
-
|
|
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
|
|
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/data-ops.js
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const page = [
|
|
3
|
+
{ name: "limit", kind: "number", help: "page size (default 20, at most 100)" },
|
|
4
|
+
{ name: "offset", kind: "number", help: "rows to skip" },
|
|
5
|
+
];
|
|
6
|
+
const STATUS = ["open", "done", "dismissed"];
|
|
7
|
+
export const DATA_OPS = [
|
|
8
|
+
{
|
|
9
|
+
cli: "contacts list", mcp: "list_contacts", method: "GET", path: "/contacts", scope: "contacts:read",
|
|
10
|
+
query: [{ name: "q", kind: "string", help: "search text (name, number)" }, ...page],
|
|
11
|
+
description: "List the tenant's お客様 (customer contacts), one page at a time. スタッフ are list_staff. Needs contacts:read.",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
cli: "contacts get", mcp: "get_contact", method: "GET", path: "/contacts/{contactId}", scope: "contacts:read",
|
|
15
|
+
description: "Read one お客様 with the phone numbers on it. Needs contacts:read.",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
cli: "contacts create", mcp: "create_contact", method: "POST", path: "/contacts", scope: "contacts:write",
|
|
19
|
+
body: [
|
|
20
|
+
{ name: "displayName", kind: "string", required: true, flag: "name", help: "the name shown in the contact book" },
|
|
21
|
+
{ name: "phone", kind: "string", help: "phone number" },
|
|
22
|
+
{ name: "kana", kind: "string", help: "the name in kana" },
|
|
23
|
+
{ name: "department", kind: "string", help: "team or company" },
|
|
24
|
+
{ name: "email", kind: "string", help: "email address" },
|
|
25
|
+
{ name: "note", kind: "string", help: "a note" },
|
|
26
|
+
{ name: "topics", kind: "list", help: "topics (repeat the flag)" },
|
|
27
|
+
{ name: "custom", kind: "map", help: "custom fields as <fieldId>=<value> (ids from contact-fields list)" },
|
|
28
|
+
],
|
|
29
|
+
description: "Register an お客様. Saved at once; 409 when a customer already has that phone number. Needs contacts:write.",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
cli: "contacts update", mcp: "update_contact", method: "PATCH", path: "/contacts/{contactId}", scope: "contacts:write",
|
|
33
|
+
body: [
|
|
34
|
+
{ name: "displayName", kind: "string", flag: "name", help: "the name" },
|
|
35
|
+
{ name: "phone", kind: "string", help: "phone number (an empty string clears it)" },
|
|
36
|
+
{ name: "kana", kind: "string", help: "kana (an empty string clears it)" },
|
|
37
|
+
{ name: "department", kind: "string", help: "team or company (an empty string clears it)" },
|
|
38
|
+
{ name: "email", kind: "string", help: "email (an empty string clears it)" },
|
|
39
|
+
{ name: "note", kind: "string", help: "a note (an empty string clears it)" },
|
|
40
|
+
{ name: "enabled", kind: "boolean", help: "true or false" },
|
|
41
|
+
{ name: "topics", kind: "list", help: "topics (repeat the flag; replaces the list)" },
|
|
42
|
+
{ name: "custom", kind: "map", help: "custom fields as <fieldId>=<value>" },
|
|
43
|
+
],
|
|
44
|
+
description: "Change an お客様; only the fields you pass change. Needs contacts:write.",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
cli: "contacts calls", mcp: "list_contact_calls", method: "GET", path: "/contacts/{contactId}/calls", scope: "contacts:read",
|
|
48
|
+
query: [...page],
|
|
49
|
+
description: "The calls tied to one お客様 (made by them, or transferred to them), newest first. Needs contacts:read.",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
cli: "contact-fields list", mcp: "list_contact_fields", method: "GET", path: "/contact-fields", scope: "contacts:read",
|
|
53
|
+
description: "The definitions of the お客様 custom fields (the ids `custom` is keyed by). Needs contacts:read.",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
cli: "calls link-contact", mcp: "link_call_contact", method: "POST", path: "/calls/{callId}/contact", scope: "calls:write",
|
|
57
|
+
body: [{ name: "displayName", kind: "string", required: true, flag: "name", help: "the お客様's name" }],
|
|
58
|
+
description: "Register (or find) the お客様 for a call's caller number and link the call to them, with every other unlinked call from that number. 409 when the call is already linked. Needs calls:write.",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
cli: "call-marks list", mcp: "list_call_marks", method: "GET", path: "/calls/{callId}/marks", scope: "calls:read",
|
|
62
|
+
description: "The marks on a call, the mark types to choose from, and the knowledge entries a 誤案内 mark may name. Needs calls:read.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
cli: "call-marks set", mcp: "set_call_mark", method: "POST", path: "/calls/{callId}/marks", scope: "calls:write",
|
|
66
|
+
body: [
|
|
67
|
+
{ name: "typeId", kind: "string", required: true, flag: "type", help: "mark type id (from call-marks list)" },
|
|
68
|
+
{ name: "citationId", kind: "string", flag: "citation", help: "the entry behind a 誤案内 mark" },
|
|
69
|
+
{ name: "note", kind: "string", help: "a note" },
|
|
70
|
+
],
|
|
71
|
+
description: "Put a mark on a call; marking the same type again replaces its note and entry. Needs calls:write.",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
cli: "call-marks clear", mcp: "clear_call_mark", method: "DELETE", path: "/calls/{callId}/marks/{typeId}", scope: "calls:write",
|
|
75
|
+
description: "Take one mark off a call. Needs calls:write.",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
cli: "call-marks create-type", mcp: "create_call_mark_type", method: "POST", path: "/call-mark-types", scope: "calls:write",
|
|
79
|
+
body: [{ name: "name", kind: "string", required: true, help: "the mark's name" }],
|
|
80
|
+
description: "Add a mark type of the tenant's own. Needs calls:write.",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
cli: "callback-lists create", mcp: "create_callback_list", method: "POST", path: "/callback-lists", scope: "calls:write",
|
|
84
|
+
body: [
|
|
85
|
+
{ name: "callIds", kind: "list", required: true, flag: "call", help: "a call id (repeat the flag)" },
|
|
86
|
+
{ name: "name", kind: "string", help: "the list's name" },
|
|
87
|
+
],
|
|
88
|
+
description: "Make a draft callback list from calls. Nothing is dialled; starting it is done on the callback list screen. Needs calls:write.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
cli: "captures list", mcp: "list_captures", method: "GET", path: "/captures", scope: "captures:read",
|
|
92
|
+
query: [
|
|
93
|
+
{ name: "type", kind: "string", help: "summary definition key" },
|
|
94
|
+
{ name: "specId", kind: "string", flag: "spec", help: "summary definition id" },
|
|
95
|
+
{ name: "agentId", kind: "string", flag: "agent", help: "only this agent's" },
|
|
96
|
+
{ name: "field", kind: "string", help: "field key (with --value)" },
|
|
97
|
+
{ name: "value", kind: "string", help: "that field's value (with --field)" },
|
|
98
|
+
{ name: "q", kind: "string", help: "search text" },
|
|
99
|
+
{ name: "status", kind: "string", values: STATUS, help: "open|done|dismissed" },
|
|
100
|
+
{ name: "from", kind: "string", help: "at or after (ISO 8601)" },
|
|
101
|
+
{ name: "to", kind: "string", help: "at or before (ISO 8601)" },
|
|
102
|
+
...page,
|
|
103
|
+
],
|
|
104
|
+
description: "List the summaries recorded during calls, newest first, one page at a time. Needs captures:read.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
cli: "captures update", mcp: "update_capture", method: "PATCH", path: "/captures/{captureId}", scope: "captures:write",
|
|
108
|
+
body: [
|
|
109
|
+
{ name: "status", kind: "string", values: STATUS, help: "open|done|dismissed" },
|
|
110
|
+
{ name: "handledNote", kind: "string", flag: "note", help: "handling note (up to 1000 characters; an empty string clears it)" },
|
|
111
|
+
],
|
|
112
|
+
description: "Change a summary's handling status and note. The assignee is set on the screen. A status change is logged under the API key's name. Needs captures:write.",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
cli: "captures status-log", mcp: "get_capture_status_log", method: "GET", path: "/captures/{captureId}/status-log", scope: "captures:read",
|
|
116
|
+
description: "Who changed a summary's handling status, when, from what to what, newest first. Needs captures:read.",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
cli: "documents history", mcp: "get_document_history", method: "GET", path: "/documents/{documentId}/history", scope: "agents:read",
|
|
120
|
+
description: "The version history of one document. Needs agents:read.",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
cli: "documents version-diff", mcp: "get_document_version_diff", method: "GET", path: "/documents/{documentId}/version-diff", scope: "agents:read",
|
|
124
|
+
query: [
|
|
125
|
+
{ name: "from", kind: "number", required: true, help: "the version to compare from" },
|
|
126
|
+
{ name: "to", kind: "number", required: true, help: "the version to compare to" },
|
|
127
|
+
],
|
|
128
|
+
description: "Two versions of one document as the lines a call's model reads. Needs agents:read.",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
cli: "documents rollback", mcp: "rollback_document", method: "POST", path: "/documents/{documentId}/rollback", scope: "agents:live",
|
|
132
|
+
body: [{ name: "version", kind: "number", required: true, flag: "target-version", help: "the version to restore (from documents history)" }],
|
|
133
|
+
description: "Put an earlier version of a document back as its content; history is kept and the restored content becomes a new version. LIVE: the next call already reads it, no publish — confirm with the person first. Needs agents:live.",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
cli: "analytics get", mcp: "get_analytics", method: "GET", path: "/analytics", scope: "analytics:read",
|
|
137
|
+
query: [
|
|
138
|
+
{ name: "agentId", kind: "string", flag: "agent", help: "only this agent's calls" },
|
|
139
|
+
{ name: "channel", kind: "string", help: "webcall|sip_did|trigger" },
|
|
140
|
+
{ name: "from", kind: "string", help: "started at or after (ISO 8601)" },
|
|
141
|
+
{ name: "to", kind: "string", help: "started before (ISO 8601)" },
|
|
142
|
+
{ name: "specId", kind: "string", flag: "spec", help: "summary definition id (with --field-key)" },
|
|
143
|
+
{ name: "fieldKey", kind: "string", help: "select field key (with --spec)" },
|
|
144
|
+
],
|
|
145
|
+
description: "The analytics screen's numbers; filters are the call list's. specId + fieldKey add that select field's distribution. Needs analytics:read.",
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
export function pathArgs(op) {
|
|
149
|
+
return [...op.path.matchAll(/\{(\w+)\}/g)].map((m) => m[1]);
|
|
150
|
+
}
|
|
151
|
+
export const flagOf = (field) => field.flag ?? field.name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
152
|
+
export async function runDataOp(client, op, input) {
|
|
153
|
+
const path = op.path.replace(/\{(\w+)\}/g, (_, name) => encodeURIComponent(String(input[name])));
|
|
154
|
+
const query = new URLSearchParams();
|
|
155
|
+
for (const field of op.query ?? []) {
|
|
156
|
+
const value = input[field.name];
|
|
157
|
+
if (value !== undefined && value !== "")
|
|
158
|
+
query.set(field.name, String(value));
|
|
159
|
+
}
|
|
160
|
+
const qs = query.toString();
|
|
161
|
+
const bodyFields = op.body ?? [];
|
|
162
|
+
const body = {};
|
|
163
|
+
for (const field of bodyFields)
|
|
164
|
+
if (input[field.name] !== undefined)
|
|
165
|
+
body[field.name] = input[field.name];
|
|
166
|
+
const { body: answer } = await client.request(op.method, client.tenantPath(`${path}${qs ? `?${qs}` : ""}`), op.scope, {
|
|
167
|
+
...(op.method === "POST" || op.method === "PATCH" ? { body } : {}),
|
|
168
|
+
});
|
|
169
|
+
return answer;
|
|
170
|
+
}
|
|
171
|
+
export function mcpShape(op) {
|
|
172
|
+
const shape = {};
|
|
173
|
+
for (const name of pathArgs(op))
|
|
174
|
+
shape[name] = z.string().min(1).describe(`The ${name}.`);
|
|
175
|
+
for (const field of [...(op.query ?? []), ...(op.body ?? [])]) {
|
|
176
|
+
let type;
|
|
177
|
+
switch (field.kind) {
|
|
178
|
+
case "number":
|
|
179
|
+
type = z.number();
|
|
180
|
+
break;
|
|
181
|
+
case "boolean":
|
|
182
|
+
type = z.boolean();
|
|
183
|
+
break;
|
|
184
|
+
case "list":
|
|
185
|
+
type = z.array(z.string());
|
|
186
|
+
break;
|
|
187
|
+
case "map":
|
|
188
|
+
type = z.record(z.string(), z.string());
|
|
189
|
+
break;
|
|
190
|
+
default:
|
|
191
|
+
type = field.values ? z.enum(field.values) : z.string();
|
|
192
|
+
}
|
|
193
|
+
shape[field.name] = (field.required ? type : type.optional()).describe(field.help);
|
|
194
|
+
}
|
|
195
|
+
return shape;
|
|
196
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import { basename, join } from "node:path";
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
|
+
import { DATA_OPS, flagOf, pathArgs, runDataOp } from "./data-ops.js";
|
|
4
5
|
import { ApiError, KumionClient, isTextFile, specText, } from "./client.js";
|
|
5
6
|
import { DEFAULT_BASE_URL, keyPrefix, looksLikeApiKey, normalizeBaseUrl, resolveCredentials, } from "./credentials.js";
|
|
6
7
|
import { DEFAULT_DEVICE_SCOPES, deviceLogin } from "./device-login.js";
|
|
7
8
|
import { describeError, ReportedFailure, UsageError } from "./errors.js";
|
|
8
|
-
export const VERSION = "0.6.
|
|
9
|
+
export const VERSION = "0.6.5";
|
|
9
10
|
const HELP = `kumion — manage your Kumion voice agents over the Partner API
|
|
10
11
|
|
|
11
12
|
Usage: kumion <command> [options]
|
|
@@ -34,7 +35,7 @@ Agents
|
|
|
34
35
|
出力日時 on the cover is the moment of the export
|
|
35
36
|
agents patch <agentId> --revision <rev> [--prompt <text> | --prompt-file <path>] [--graph-file <path>]
|
|
36
37
|
Edit the draft (never goes live by itself)
|
|
37
|
-
agents publish <agentId> [--revision <rev>] [--accept-intermittent]
|
|
38
|
+
agents publish <agentId> [--revision <rev>] [--accept-intermittent] [--accept-low-confidence]
|
|
38
39
|
Publish the draft through the pre-publish check
|
|
39
40
|
agents opening-name <agentId> --revision <rev> (--on | --off)
|
|
40
41
|
Whether the opening line uses the caller's name (a draft write:
|
|
@@ -46,6 +47,7 @@ Agents
|
|
|
46
47
|
(needs a key with agents:live)
|
|
47
48
|
agents create-from-template --template <id> --business-name <name> [--name <name>]
|
|
48
49
|
[--url <url> | --document <documentId>] [--idempotency-key <key>]
|
|
50
|
+
[--fallback-staff <contactKey>]
|
|
49
51
|
Create a DRAFT agent from an onboarding template. With no
|
|
50
52
|
source, every fact is 「まだない情報」. With a URL (same site,
|
|
51
53
|
up to 10 pages) or a document already uploaded and extracted
|
|
@@ -74,6 +76,53 @@ Flow
|
|
|
74
76
|
Templates
|
|
75
77
|
templates list List the onboarding templates and their ids
|
|
76
78
|
|
|
79
|
+
Customers, marks and records (need the contacts:*, calls:write, captures:* or analytics:read scope; rollback needs agents:live)
|
|
80
|
+
contacts list [--q <text>] [--limit <n>] [--offset <n>]
|
|
81
|
+
List the お客様 (customers); staff are under "staff list"
|
|
82
|
+
contacts get <contactId>
|
|
83
|
+
Show one お客様 with their phone numbers
|
|
84
|
+
contacts create --name <text> [--phone <text>] [--kana <text>] [--department
|
|
85
|
+
<text>] [--email <text>] [--note <text>] [--topics <value> ...]
|
|
86
|
+
[--custom <key>=<value> ...]
|
|
87
|
+
Register an お客様
|
|
88
|
+
contacts update <contactId> [--name <text>] [--phone <text>] [--kana <text>]
|
|
89
|
+
[--department <text>] [--email <text>] [--note <text>] [--enabled
|
|
90
|
+
true|false] [--topics <value> ...] [--custom <key>=<value> ...]
|
|
91
|
+
Change an お客様 ("" clears a text field)
|
|
92
|
+
contacts calls <contactId> [--limit <n>] [--offset <n>]
|
|
93
|
+
The calls tied to one お客様
|
|
94
|
+
contact-fields list
|
|
95
|
+
The custom-field definitions (ids for --custom)
|
|
96
|
+
calls link-contact <callId> --name <text>
|
|
97
|
+
Link a call and its caller number to an お客様 (made if new)
|
|
98
|
+
call-marks list <callId>
|
|
99
|
+
The marks on a call and the mark types to choose from
|
|
100
|
+
call-marks set <callId> --type <text> [--citation <text>] [--note <text>]
|
|
101
|
+
Put a mark on a call
|
|
102
|
+
call-marks clear <callId> <typeId>
|
|
103
|
+
Take a mark off a call
|
|
104
|
+
call-marks create-type --name <text>
|
|
105
|
+
Add a mark type
|
|
106
|
+
callback-lists create --call <value> ... [--name <text>]
|
|
107
|
+
Make a draft callback list from calls (nothing is dialled)
|
|
108
|
+
captures list [--type <text>] [--spec <text>] [--agent <text>] [--field
|
|
109
|
+
<text>] [--value <text>] [--q <text>] [--status open|done|dismissed]
|
|
110
|
+
[--from <text>] [--to <text>] [--limit <n>] [--offset <n>]
|
|
111
|
+
List the recorded summaries, newest first
|
|
112
|
+
captures update <captureId> [--status open|done|dismissed] [--note <text>]
|
|
113
|
+
Set a summary's handling status and note
|
|
114
|
+
captures status-log <captureId>
|
|
115
|
+
Who changed a summary's status, when
|
|
116
|
+
documents history <documentId>
|
|
117
|
+
Version history of one document
|
|
118
|
+
documents version-diff <documentId> --from <n> --to <n>
|
|
119
|
+
Two versions of a document, as the model reads them
|
|
120
|
+
documents rollback <documentId> --target-version <n>
|
|
121
|
+
Restore an earlier version. LIVE: the next call reads it, no publish
|
|
122
|
+
analytics get [--agent <text>] [--channel <text>] [--from <text>] [--to
|
|
123
|
+
<text>] [--spec <text>] [--field-key <text>]
|
|
124
|
+
The analytics screen's numbers
|
|
125
|
+
|
|
77
126
|
Staff (the people a 用件 can transfer a call to)
|
|
78
127
|
staff list List the スタッフ with their transfer key, 転送先 and revision
|
|
79
128
|
staff create --name <name> [--transfer-target <number>] [--department <text>]
|
|
@@ -202,8 +251,9 @@ Calls
|
|
|
202
251
|
Start a web call with the agent; with --to, dial that
|
|
203
252
|
domestic number instead (--var is read as {{vars.<name>}})
|
|
204
253
|
calls list [--agent <id>] [--channel webcall|sip_did|trigger] [--from <iso>] [--to <iso>]
|
|
205
|
-
[--search <text>] [--limit <n>] [--offset <n>]
|
|
206
|
-
List the tenant's call history, newest first (20 per page)
|
|
254
|
+
[--search <text>] [--content <text>] [--limit <n>] [--offset <n>]
|
|
255
|
+
List the tenant's call history, newest first (20 per page);
|
|
256
|
+
--content searches what was said (needs --from and --to)
|
|
207
257
|
scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset> [--var <name>=<value> ...]
|
|
208
258
|
Schedule one dial at that time (e.g. 2026-10-31T13:00:00+09:00)
|
|
209
259
|
scheduled-calls list List the dials scheduled through the API, newest first
|
|
@@ -379,6 +429,7 @@ export const COMMANDS = {
|
|
|
379
429
|
"calls list": callsList,
|
|
380
430
|
"calls get": callsGet,
|
|
381
431
|
"calls transcript": callsTranscript,
|
|
432
|
+
...Object.fromEntries(DATA_OPS.map((op) => [op.cli, dataOpHandler(op)])),
|
|
382
433
|
};
|
|
383
434
|
async function authLogin(args, deps) {
|
|
384
435
|
const { values } = parse(args, {
|
|
@@ -761,6 +812,7 @@ async function agentsCreateFromTemplate(args, deps) {
|
|
|
761
812
|
url: { type: "string" },
|
|
762
813
|
document: { type: "string" },
|
|
763
814
|
"idempotency-key": { type: "string" },
|
|
815
|
+
"fallback-staff": { type: "string" },
|
|
764
816
|
});
|
|
765
817
|
if (!values.template)
|
|
766
818
|
throw new UsageError("Pass --template <id> (see `kumion templates list`).");
|
|
@@ -775,6 +827,7 @@ async function agentsCreateFromTemplate(args, deps) {
|
|
|
775
827
|
...(values.url ? { url: values.url } : {}),
|
|
776
828
|
...(values.document ? { documentId: values.document } : {}),
|
|
777
829
|
...(values["idempotency-key"] ? { idempotencyKey: values["idempotency-key"] } : {}),
|
|
830
|
+
...(values["fallback-staff"] ? { fallbackStaffKey: values["fallback-staff"] } : {}),
|
|
778
831
|
});
|
|
779
832
|
if (values.json) {
|
|
780
833
|
printJson(deps, result);
|
|
@@ -1577,12 +1630,15 @@ function formatFindings(findings, indent) {
|
|
|
1577
1630
|
return (findings ?? []).map((f) => `${indent}- ${f.kind}${f.nodeKey ? ` @${f.nodeKey}` : ""}: ${f.detail}`);
|
|
1578
1631
|
}
|
|
1579
1632
|
async function agentsPublish(args, deps) {
|
|
1580
|
-
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" } });
|
|
1581
1634
|
const agentId = need(positionals, 0, "agentId");
|
|
1582
1635
|
const client = await clientFor(values, deps);
|
|
1583
1636
|
deps.io.err("Publishing — the pre-publish check runs first and can take a few minutes…");
|
|
1584
1637
|
try {
|
|
1585
|
-
const result = await client.publishAgent(agentId, values.revision, {
|
|
1638
|
+
const result = await client.publishAgent(agentId, values.revision, {
|
|
1639
|
+
acceptIntermittent: values["accept-intermittent"] === true,
|
|
1640
|
+
acceptLowConfidence: values["accept-low-confidence"] === true,
|
|
1641
|
+
});
|
|
1586
1642
|
if (values.json)
|
|
1587
1643
|
printJson(deps, result);
|
|
1588
1644
|
else {
|
|
@@ -1620,18 +1676,29 @@ async function agentsPublish(args, deps) {
|
|
|
1620
1676
|
}
|
|
1621
1677
|
if (body.publishRunId)
|
|
1622
1678
|
lines.push(`Publish run: ${String(body.publishRunId)} (details in the Portal).`);
|
|
1623
|
-
if (body.code === "intermittent") {
|
|
1679
|
+
if (body.code === "intermittent" || body.code === "low_confidence") {
|
|
1624
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";
|
|
1625
1684
|
for (const c of detail) {
|
|
1626
|
-
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):`);
|
|
1627
1686
|
for (const a of c.attempts ?? []) {
|
|
1628
1687
|
lines.push(` #${a.attempt} ${a.outcome}`);
|
|
1629
1688
|
lines.push(...(a.reasons ?? []).map((r) => ` - ${r.kind}: ${r.detail}`));
|
|
1630
1689
|
}
|
|
1631
1690
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
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.");
|
|
1635
1702
|
}
|
|
1636
1703
|
else if (verdict?.cases?.some((c) => c.gate === "reproduced")) {
|
|
1637
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.");
|
|
@@ -1867,6 +1934,9 @@ export function summarizeTestRun(run) {
|
|
|
1867
1934
|
if (run.status === "failed" && gates.has("intermittent")) {
|
|
1868
1935
|
lines.push("[intermittent] cases failed only in some runs. `agents publish --accept-intermittent` can publish past them if the user accepts the reasons.");
|
|
1869
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
|
+
}
|
|
1870
1940
|
return lines.join("\n");
|
|
1871
1941
|
}
|
|
1872
1942
|
async function testRunsStart(args, deps) {
|
|
@@ -2018,6 +2088,63 @@ function wholeNumber(raw, flag) {
|
|
|
2018
2088
|
throw new UsageError(`--${flag} must be a whole number (0 or more).`);
|
|
2019
2089
|
return n;
|
|
2020
2090
|
}
|
|
2091
|
+
function dataOpHandler(op) {
|
|
2092
|
+
return async (args, deps) => {
|
|
2093
|
+
const fields = [...(op.query ?? []), ...(op.body ?? [])];
|
|
2094
|
+
const options = {};
|
|
2095
|
+
for (const f of fields)
|
|
2096
|
+
options[flagOf(f)] = { type: "string", ...(f.kind === "list" || f.kind === "map" ? { multiple: true } : {}) };
|
|
2097
|
+
const { values, positionals } = parse(args, options);
|
|
2098
|
+
const input = {};
|
|
2099
|
+
pathArgs(op).forEach((name, i) => {
|
|
2100
|
+
input[name] = need(positionals, i, name);
|
|
2101
|
+
});
|
|
2102
|
+
const given = values;
|
|
2103
|
+
for (const f of fields) {
|
|
2104
|
+
const raw = given[flagOf(f)];
|
|
2105
|
+
if (raw === undefined)
|
|
2106
|
+
continue;
|
|
2107
|
+
switch (f.kind) {
|
|
2108
|
+
case "number": {
|
|
2109
|
+
const n = Number(raw);
|
|
2110
|
+
if (!Number.isInteger(n) || n < 0)
|
|
2111
|
+
throw new UsageError(`--${flagOf(f)} must be a whole number (0 or more).`);
|
|
2112
|
+
input[f.name] = n;
|
|
2113
|
+
break;
|
|
2114
|
+
}
|
|
2115
|
+
case "boolean":
|
|
2116
|
+
if (raw !== "true" && raw !== "false")
|
|
2117
|
+
throw new UsageError(`--${flagOf(f)} takes true or false.`);
|
|
2118
|
+
input[f.name] = raw === "true";
|
|
2119
|
+
break;
|
|
2120
|
+
case "list":
|
|
2121
|
+
input[f.name] = raw;
|
|
2122
|
+
break;
|
|
2123
|
+
case "map":
|
|
2124
|
+
input[f.name] = Object.fromEntries(raw.map((pair) => {
|
|
2125
|
+
const at = pair.indexOf("=");
|
|
2126
|
+
if (at < 1)
|
|
2127
|
+
throw new UsageError(`--${flagOf(f)} takes <key>=<value>.`);
|
|
2128
|
+
return [pair.slice(0, at), pair.slice(at + 1)];
|
|
2129
|
+
}));
|
|
2130
|
+
break;
|
|
2131
|
+
default:
|
|
2132
|
+
if (f.values && !f.values.includes(raw))
|
|
2133
|
+
throw new UsageError(`--${flagOf(f)} must be one of ${f.values.join(", ")}.`);
|
|
2134
|
+
input[f.name] = raw;
|
|
2135
|
+
}
|
|
2136
|
+
if (f.required && f.kind === "string" && raw === "")
|
|
2137
|
+
throw new UsageError(`--${flagOf(f)} cannot be empty.`);
|
|
2138
|
+
}
|
|
2139
|
+
for (const f of fields) {
|
|
2140
|
+
if (f.required && input[f.name] === undefined)
|
|
2141
|
+
throw new UsageError(`Pass --${flagOf(f)} — ${f.help}.`);
|
|
2142
|
+
}
|
|
2143
|
+
const answer = await runDataOp(await clientFor(values, deps), op, input);
|
|
2144
|
+
printJson(deps, answer);
|
|
2145
|
+
return 0;
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2021
2148
|
async function callsList(args, deps) {
|
|
2022
2149
|
const { values } = parse(args, {
|
|
2023
2150
|
agent: { type: "string" },
|
|
@@ -2025,6 +2152,7 @@ async function callsList(args, deps) {
|
|
|
2025
2152
|
from: { type: "string" },
|
|
2026
2153
|
to: { type: "string" },
|
|
2027
2154
|
search: { type: "string" },
|
|
2155
|
+
content: { type: "string" },
|
|
2028
2156
|
limit: { type: "string" },
|
|
2029
2157
|
offset: { type: "string" },
|
|
2030
2158
|
});
|
|
@@ -2034,6 +2162,7 @@ async function callsList(args, deps) {
|
|
|
2034
2162
|
from: values.from,
|
|
2035
2163
|
to: values.to,
|
|
2036
2164
|
q: values.search,
|
|
2165
|
+
content: values.content,
|
|
2037
2166
|
limit: values.limit === undefined ? undefined : positiveNumber(values.limit, "limit", 20),
|
|
2038
2167
|
offset: wholeNumber(values.offset, "offset"),
|
|
2039
2168
|
};
|
package/dist/mcp.js
CHANGED
|
@@ -3,6 +3,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { basename } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ApiError, isTextFile, specText } from "./client.js";
|
|
6
|
+
import { DATA_OPS, mcpShape, runDataOp } from "./data-ops.js";
|
|
6
7
|
import { describeError, UsageError } from "./errors.js";
|
|
7
8
|
export const MAX_TEST_RUN_WAIT_SECONDS = 120;
|
|
8
9
|
const TERMINAL = new Set(["passed", "failed", "could_not_run", "timeout", "cancelled", "completed"]);
|
|
@@ -87,6 +88,11 @@ export function createKumionMcpServer(client, options) {
|
|
|
87
88
|
.max(200)
|
|
88
89
|
.optional()
|
|
89
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 伝言)."),
|
|
90
96
|
},
|
|
91
97
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
92
98
|
}, (args) => attempt(() => client.createAgentFromTemplate({
|
|
@@ -96,6 +102,7 @@ export function createKumionMcpServer(client, options) {
|
|
|
96
102
|
...(args.url ? { url: args.url } : {}),
|
|
97
103
|
...(args.documentId ? { documentId: args.documentId } : {}),
|
|
98
104
|
...(args.idempotencyKey ? { idempotencyKey: args.idempotencyKey } : {}),
|
|
105
|
+
...(args.fallbackStaffKey ? { fallbackStaffKey: args.fallbackStaffKey } : {}),
|
|
99
106
|
})));
|
|
100
107
|
server.registerTool("get_agent", {
|
|
101
108
|
description: "Read one agent: its draft (prompt, flow graph) and its published version. The returned `revision` is " +
|
|
@@ -303,9 +310,11 @@ export function createKumionMcpServer(client, options) {
|
|
|
303
310
|
server.registerTool("publish_agent", {
|
|
304
311
|
description: "Publish the agent's draft so callers get it. Runs the same pre-publish check as the Portal first and " +
|
|
305
312
|
"publishes only if it passes; a check that failed again on re-run (`gate: reproduced`) cannot be skipped. " +
|
|
306
|
-
"The
|
|
313
|
+
"The exceptions: a check that failed " +
|
|
307
314
|
"only in some of its runs comes back with code `intermittent` and the cases (`gate: intermittent`), and " +
|
|
308
|
-
"`acceptIntermittent` publishes it anyway;
|
|
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 " +
|
|
309
318
|
"failing cases are returned. A success carries `unconfirmedFacts`: how many of the agent's 資料 facts " +
|
|
310
319
|
"nobody has confirmed yet — for each of them the agent says it will check and call back instead of " +
|
|
311
320
|
"stating it (confirm_facts confirms them). Needs agents:publish.",
|
|
@@ -315,10 +324,17 @@ export function createKumionMcpServer(client, options) {
|
|
|
315
324
|
acceptIntermittent: z
|
|
316
325
|
.boolean()
|
|
317
326
|
.optional()
|
|
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
|
|
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."),
|
|
319
332
|
},
|
|
320
333
|
annotations: { destructiveHint: true, idempotentHint: false },
|
|
321
|
-
}, (args) => attempt(() => client.publishAgent(args.agentId, args.revision, {
|
|
334
|
+
}, (args) => attempt(() => client.publishAgent(args.agentId, args.revision, {
|
|
335
|
+
acceptIntermittent: args.acceptIntermittent === true,
|
|
336
|
+
acceptLowConfidence: args.acceptLowConfidence === true,
|
|
337
|
+
})));
|
|
322
338
|
server.registerTool("start_test_run", {
|
|
323
339
|
description: "Run the agent's regression tests against its draft (publishes nothing). Returns at once with the run " +
|
|
324
340
|
`unless waitSeconds is set (at most ${MAX_TEST_RUN_WAIT_SECONDS}); follow a running run with ` +
|
|
@@ -414,6 +430,7 @@ export function createKumionMcpServer(client, options) {
|
|
|
414
430
|
from: z.string().optional().describe("Started at or after this instant (ISO 8601)."),
|
|
415
431
|
to: z.string().optional().describe("Started before this instant (ISO 8601)."),
|
|
416
432
|
q: z.string().optional().describe("Caller number, or the start of a call id."),
|
|
433
|
+
content: z.string().optional().describe("Words said on the call (transcript). Needs from and to; the period is capped; a timeout is a 408."),
|
|
417
434
|
limit: z.number().int().min(1).max(100).optional(),
|
|
418
435
|
offset: z.number().int().min(0).optional(),
|
|
419
436
|
},
|
|
@@ -998,5 +1015,12 @@ export function createKumionMcpServer(client, options) {
|
|
|
998
1015
|
},
|
|
999
1016
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
1000
1017
|
}, (args) => attempt(() => client.replaceDocument(args.documentId, { sourceDocumentId: args.sourceDocumentId, sourceRevision: args.sourceRevision }, args.revision, { dryRun: args.dryRun === true })));
|
|
1018
|
+
for (const op of DATA_OPS) {
|
|
1019
|
+
server.registerTool(op.mcp, {
|
|
1020
|
+
description: op.description,
|
|
1021
|
+
inputSchema: mcpShape(op),
|
|
1022
|
+
annotations: op.method === "GET" ? { readOnlyHint: true } : op.method === "DELETE" ? { destructiveHint: true, idempotentHint: true } : { destructiveHint: op.scope === "agents:live" },
|
|
1023
|
+
}, (args) => attempt(() => runDataOp(client, op, args)));
|
|
1024
|
+
}
|
|
1001
1025
|
return server;
|
|
1002
1026
|
}
|
package/package.json
CHANGED
package/skills/kumion/SKILL.md
CHANGED
|
@@ -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,
|
|
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,
|
|
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. |
|
|
@@ -273,6 +273,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
273
273
|
| `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool?}[]` | 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. |
|
|
274
274
|
| `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
|
|
275
275
|
| `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`). |
|
|
276
|
+
| `ai_disclosure_stated` | start | `tune` | `boolean` | Absent means not declared. Only an explicit true is stored. The author's own statement that the opening tells the caller they are speaking with an AI; the platform does not read the opening for it. Not declared: graph diagnostics `opening_no_ai_disclosure` (a warning, never blocks). |
|
|
276
277
|
| `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`). |
|
|
277
278
|
| `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. |
|
|
278
279
|
| `respond_on_enter` | agent | `tune` | `boolean` | Absent means the node answers on arrival. Only an explicit false (wait for the caller) is stored. |
|
|
@@ -286,7 +287,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
286
287
|
| `opening_audio_filename` | start | `internal` | `string` | Display name of the uploaded opening audio. |
|
|
287
288
|
| `precall_fetch_url` | start | `advanced` | `string` | URL fetched before the call starts; the response becomes call variables. |
|
|
288
289
|
| `precall_fetch_method` | start | `advanced` | `string` | HTTP method of the pre-call fetch. |
|
|
289
|
-
| `precall_fetch_headers` | start | `advanced` | `{ key,
|
|
290
|
+
| `precall_fetch_headers` | start | `advanced` | `{ key, secret }[]` | Headers of the pre-call fetch. 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. |
|
|
290
291
|
| `no_response` | start, agent | `advanced` | `{ timeout_s, reprompt_speech?, max_reprompts, then }` | Node-level no-response timer. { timeout_s: 0 } turns the agent default off here. |
|
|
291
292
|
| `kb_fallback` | start, agent | `advanced` | `{ noResult?, unavailable? }` | Wording when a knowledge search finds nothing or is unavailable. Overrides the tenant operations setting. |
|
|
292
293
|
| `end_speech` | end | `required` | `string` | Default goodbye line. A connection into this node can override it. |
|
|
@@ -297,12 +298,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
297
298
|
| `http_method` | webhook | `required` | `string` | GET, POST, PUT, PATCH or DELETE. |
|
|
298
299
|
| `endpoint_url` | webhook | `required` | `string` | Destination URL. |
|
|
299
300
|
| `payload_template` | webhook | `required` | `string` | Request body template with {{variables}}. |
|
|
300
|
-
| `custom_headers` | webhook | `advanced` | `{ key,
|
|
301
|
-
| `qa_system_prompt` | qa | `required` | `string` | Evaluation prompt. |
|
|
302
|
-
| `qa_sample_rate` | qa | `required` | `number` | Percentage of calls analysed, 1 to 100. |
|
|
303
|
-
| `qa_min_call_duration` | qa | `required` | `number` | Shortest call (seconds) that is analysed. |
|
|
304
|
-
| `qa_model` | qa | `advanced` | `string` | Model override for this analysis. |
|
|
305
|
-
| `qa_voicemail_calls` | qa | `advanced` | `boolean` | Whether voicemail calls are analysed (default true). |
|
|
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. |
|
|
306
302
|
|
|
307
303
|
A required item's 種類 is stored as a pair on the item: `source` and `value_type`.
|
|
308
304
|
These are the pairs the Portal offers:
|
|
@@ -338,6 +334,16 @@ field in the item's `tool` as `{ "tool_key": "…", "result_field": "…" }`;
|
|
|
338
334
|
only that tool succeeding at this step records it. Keys in `optional_slots` are
|
|
339
335
|
recorded only when the caller says them first; they are not required at that step.
|
|
340
336
|
|
|
337
|
+
## Customers, marks and records
|
|
338
|
+
|
|
339
|
+
These cover what the Portal's 顧客, 通話 and 分析 screens already do. Each needs its own scope; keys issued before the scope existed do not have it.
|
|
340
|
+
|
|
341
|
+
- `list_contacts`, `get_contact`, `list_contact_calls`, `list_contact_fields` (`contacts:read`); `create_contact`, `update_contact` (`contacts:write`). Customers only; staff are `list_staff`.
|
|
342
|
+
- `link_call_contact`, `set_call_mark`, `clear_call_mark`, `create_call_mark_type`, `create_callback_list` (`calls:write`); `list_call_marks` (`calls:read`). A callback list is a draft: nothing is dialled.
|
|
343
|
+
- `list_captures`, `get_capture_status_log` (`captures:read`); `update_capture` (`captures:write`): status and note only, the assignee is set on the screen.
|
|
344
|
+
- `get_document_history`, `get_document_version_diff` (`agents:read`); `rollback_document` (`agents:live`): LIVE, the next call reads the restored version with no publish, so confirm with the person first.
|
|
345
|
+
- `get_analytics` (`analytics:read`).
|
|
346
|
+
|
|
341
347
|
## When it refuses
|
|
342
348
|
|
|
343
349
|
- **401** — key wrong, revoked, expired, or for another tenant. A personal key from
|
|
@@ -345,7 +351,7 @@ recorded only when the caller says them first; they are not required at that ste
|
|
|
345
351
|
tenant administrator (`kumion auth status` shows its expiry). The user re-runs
|
|
346
352
|
`kumion auth login`.
|
|
347
353
|
- **403 naming a scope** — the key lacks it (`agents:read`, `agents:write`,
|
|
348
|
-
`agents:publish`, `agents:live`, `tests:run`, `calls:create`, `calls:read`). The user issues a key with that scope
|
|
354
|
+
`agents:publish`, `agents:live`, `tests:run`, `calls:create`, `calls:read`, `calls:write`, `contacts:read`, `contacts:write`, `captures:read`, `captures:write`, `analytics:read`). The user issues a key with that scope
|
|
349
355
|
in the Portal (設定 → 開発者) and logs in again. Do not work around it.
|
|
350
356
|
- **403 without a scope name** — the tenant's plan cannot publish, or `create_call` hit
|
|
351
357
|
the call-minute limit. Tell the user; a new key does not help.
|