@kumion/cli 0.6.3 → 0.6.4
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 +22 -2
- package/dist/data-ops.js +196 -0
- package/dist/main.js +112 -3
- package/dist/mcp.js +9 -0
- package/package.json +1 -1
- package/skills/kumion/SKILL.md +14 -3
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) |
|
|
@@ -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,7 +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,
|
|
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. |
|
|
395
415
|
| `qa_system_prompt` | qa | `required` | `string` | Evaluation prompt. |
|
|
396
416
|
| `qa_sample_rate` | qa | `required` | `number` | Percentage of calls analysed, 1 to 100. |
|
|
397
417
|
| `qa_min_call_duration` | qa | `required` | `number` | Shortest call (seconds) that is analysed. |
|
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.4";
|
|
9
10
|
const HELP = `kumion — manage your Kumion voice agents over the Partner API
|
|
10
11
|
|
|
11
12
|
Usage: kumion <command> [options]
|
|
@@ -74,6 +75,53 @@ Flow
|
|
|
74
75
|
Templates
|
|
75
76
|
templates list List the onboarding templates and their ids
|
|
76
77
|
|
|
78
|
+
Customers, marks and records (need the contacts:*, calls:write, captures:* or analytics:read scope; rollback needs agents:live)
|
|
79
|
+
contacts list [--q <text>] [--limit <n>] [--offset <n>]
|
|
80
|
+
List the お客様 (customers); staff are under "staff list"
|
|
81
|
+
contacts get <contactId>
|
|
82
|
+
Show one お客様 with their phone numbers
|
|
83
|
+
contacts create --name <text> [--phone <text>] [--kana <text>] [--department
|
|
84
|
+
<text>] [--email <text>] [--note <text>] [--topics <value> ...]
|
|
85
|
+
[--custom <key>=<value> ...]
|
|
86
|
+
Register an お客様
|
|
87
|
+
contacts update <contactId> [--name <text>] [--phone <text>] [--kana <text>]
|
|
88
|
+
[--department <text>] [--email <text>] [--note <text>] [--enabled
|
|
89
|
+
true|false] [--topics <value> ...] [--custom <key>=<value> ...]
|
|
90
|
+
Change an お客様 ("" clears a text field)
|
|
91
|
+
contacts calls <contactId> [--limit <n>] [--offset <n>]
|
|
92
|
+
The calls tied to one お客様
|
|
93
|
+
contact-fields list
|
|
94
|
+
The custom-field definitions (ids for --custom)
|
|
95
|
+
calls link-contact <callId> --name <text>
|
|
96
|
+
Link a call and its caller number to an お客様 (made if new)
|
|
97
|
+
call-marks list <callId>
|
|
98
|
+
The marks on a call and the mark types to choose from
|
|
99
|
+
call-marks set <callId> --type <text> [--citation <text>] [--note <text>]
|
|
100
|
+
Put a mark on a call
|
|
101
|
+
call-marks clear <callId> <typeId>
|
|
102
|
+
Take a mark off a call
|
|
103
|
+
call-marks create-type --name <text>
|
|
104
|
+
Add a mark type
|
|
105
|
+
callback-lists create --call <value> ... [--name <text>]
|
|
106
|
+
Make a draft callback list from calls (nothing is dialled)
|
|
107
|
+
captures list [--type <text>] [--spec <text>] [--agent <text>] [--field
|
|
108
|
+
<text>] [--value <text>] [--q <text>] [--status open|done|dismissed]
|
|
109
|
+
[--from <text>] [--to <text>] [--limit <n>] [--offset <n>]
|
|
110
|
+
List the recorded summaries, newest first
|
|
111
|
+
captures update <captureId> [--status open|done|dismissed] [--note <text>]
|
|
112
|
+
Set a summary's handling status and note
|
|
113
|
+
captures status-log <captureId>
|
|
114
|
+
Who changed a summary's status, when
|
|
115
|
+
documents history <documentId>
|
|
116
|
+
Version history of one document
|
|
117
|
+
documents version-diff <documentId> --from <n> --to <n>
|
|
118
|
+
Two versions of a document, as the model reads them
|
|
119
|
+
documents rollback <documentId> --target-version <n>
|
|
120
|
+
Restore an earlier version. LIVE: the next call reads it, no publish
|
|
121
|
+
analytics get [--agent <text>] [--channel <text>] [--from <text>] [--to
|
|
122
|
+
<text>] [--spec <text>] [--field-key <text>]
|
|
123
|
+
The analytics screen's numbers
|
|
124
|
+
|
|
77
125
|
Staff (the people a 用件 can transfer a call to)
|
|
78
126
|
staff list List the スタッフ with their transfer key, 転送先 and revision
|
|
79
127
|
staff create --name <name> [--transfer-target <number>] [--department <text>]
|
|
@@ -202,8 +250,9 @@ Calls
|
|
|
202
250
|
Start a web call with the agent; with --to, dial that
|
|
203
251
|
domestic number instead (--var is read as {{vars.<name>}})
|
|
204
252
|
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)
|
|
253
|
+
[--search <text>] [--content <text>] [--limit <n>] [--offset <n>]
|
|
254
|
+
List the tenant's call history, newest first (20 per page);
|
|
255
|
+
--content searches what was said (needs --from and --to)
|
|
207
256
|
scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset> [--var <name>=<value> ...]
|
|
208
257
|
Schedule one dial at that time (e.g. 2026-10-31T13:00:00+09:00)
|
|
209
258
|
scheduled-calls list List the dials scheduled through the API, newest first
|
|
@@ -379,6 +428,7 @@ export const COMMANDS = {
|
|
|
379
428
|
"calls list": callsList,
|
|
380
429
|
"calls get": callsGet,
|
|
381
430
|
"calls transcript": callsTranscript,
|
|
431
|
+
...Object.fromEntries(DATA_OPS.map((op) => [op.cli, dataOpHandler(op)])),
|
|
382
432
|
};
|
|
383
433
|
async function authLogin(args, deps) {
|
|
384
434
|
const { values } = parse(args, {
|
|
@@ -2018,6 +2068,63 @@ function wholeNumber(raw, flag) {
|
|
|
2018
2068
|
throw new UsageError(`--${flag} must be a whole number (0 or more).`);
|
|
2019
2069
|
return n;
|
|
2020
2070
|
}
|
|
2071
|
+
function dataOpHandler(op) {
|
|
2072
|
+
return async (args, deps) => {
|
|
2073
|
+
const fields = [...(op.query ?? []), ...(op.body ?? [])];
|
|
2074
|
+
const options = {};
|
|
2075
|
+
for (const f of fields)
|
|
2076
|
+
options[flagOf(f)] = { type: "string", ...(f.kind === "list" || f.kind === "map" ? { multiple: true } : {}) };
|
|
2077
|
+
const { values, positionals } = parse(args, options);
|
|
2078
|
+
const input = {};
|
|
2079
|
+
pathArgs(op).forEach((name, i) => {
|
|
2080
|
+
input[name] = need(positionals, i, name);
|
|
2081
|
+
});
|
|
2082
|
+
const given = values;
|
|
2083
|
+
for (const f of fields) {
|
|
2084
|
+
const raw = given[flagOf(f)];
|
|
2085
|
+
if (raw === undefined)
|
|
2086
|
+
continue;
|
|
2087
|
+
switch (f.kind) {
|
|
2088
|
+
case "number": {
|
|
2089
|
+
const n = Number(raw);
|
|
2090
|
+
if (!Number.isInteger(n) || n < 0)
|
|
2091
|
+
throw new UsageError(`--${flagOf(f)} must be a whole number (0 or more).`);
|
|
2092
|
+
input[f.name] = n;
|
|
2093
|
+
break;
|
|
2094
|
+
}
|
|
2095
|
+
case "boolean":
|
|
2096
|
+
if (raw !== "true" && raw !== "false")
|
|
2097
|
+
throw new UsageError(`--${flagOf(f)} takes true or false.`);
|
|
2098
|
+
input[f.name] = raw === "true";
|
|
2099
|
+
break;
|
|
2100
|
+
case "list":
|
|
2101
|
+
input[f.name] = raw;
|
|
2102
|
+
break;
|
|
2103
|
+
case "map":
|
|
2104
|
+
input[f.name] = Object.fromEntries(raw.map((pair) => {
|
|
2105
|
+
const at = pair.indexOf("=");
|
|
2106
|
+
if (at < 1)
|
|
2107
|
+
throw new UsageError(`--${flagOf(f)} takes <key>=<value>.`);
|
|
2108
|
+
return [pair.slice(0, at), pair.slice(at + 1)];
|
|
2109
|
+
}));
|
|
2110
|
+
break;
|
|
2111
|
+
default:
|
|
2112
|
+
if (f.values && !f.values.includes(raw))
|
|
2113
|
+
throw new UsageError(`--${flagOf(f)} must be one of ${f.values.join(", ")}.`);
|
|
2114
|
+
input[f.name] = raw;
|
|
2115
|
+
}
|
|
2116
|
+
if (f.required && f.kind === "string" && raw === "")
|
|
2117
|
+
throw new UsageError(`--${flagOf(f)} cannot be empty.`);
|
|
2118
|
+
}
|
|
2119
|
+
for (const f of fields) {
|
|
2120
|
+
if (f.required && input[f.name] === undefined)
|
|
2121
|
+
throw new UsageError(`Pass --${flagOf(f)} — ${f.help}.`);
|
|
2122
|
+
}
|
|
2123
|
+
const answer = await runDataOp(await clientFor(values, deps), op, input);
|
|
2124
|
+
printJson(deps, answer);
|
|
2125
|
+
return 0;
|
|
2126
|
+
};
|
|
2127
|
+
}
|
|
2021
2128
|
async function callsList(args, deps) {
|
|
2022
2129
|
const { values } = parse(args, {
|
|
2023
2130
|
agent: { type: "string" },
|
|
@@ -2025,6 +2132,7 @@ async function callsList(args, deps) {
|
|
|
2025
2132
|
from: { type: "string" },
|
|
2026
2133
|
to: { type: "string" },
|
|
2027
2134
|
search: { type: "string" },
|
|
2135
|
+
content: { type: "string" },
|
|
2028
2136
|
limit: { type: "string" },
|
|
2029
2137
|
offset: { type: "string" },
|
|
2030
2138
|
});
|
|
@@ -2034,6 +2142,7 @@ async function callsList(args, deps) {
|
|
|
2034
2142
|
from: values.from,
|
|
2035
2143
|
to: values.to,
|
|
2036
2144
|
q: values.search,
|
|
2145
|
+
content: values.content,
|
|
2037
2146
|
limit: values.limit === undefined ? undefined : positiveNumber(values.limit, "limit", 20),
|
|
2038
2147
|
offset: wholeNumber(values.offset, "offset"),
|
|
2039
2148
|
};
|
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"]);
|
|
@@ -414,6 +415,7 @@ export function createKumionMcpServer(client, options) {
|
|
|
414
415
|
from: z.string().optional().describe("Started at or after this instant (ISO 8601)."),
|
|
415
416
|
to: z.string().optional().describe("Started before this instant (ISO 8601)."),
|
|
416
417
|
q: z.string().optional().describe("Caller number, or the start of a call id."),
|
|
418
|
+
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
419
|
limit: z.number().int().min(1).max(100).optional(),
|
|
418
420
|
offset: z.number().int().min(0).optional(),
|
|
419
421
|
},
|
|
@@ -998,5 +1000,12 @@ export function createKumionMcpServer(client, options) {
|
|
|
998
1000
|
},
|
|
999
1001
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
1000
1002
|
}, (args) => attempt(() => client.replaceDocument(args.documentId, { sourceDocumentId: args.sourceDocumentId, sourceRevision: args.sourceRevision }, args.revision, { dryRun: args.dryRun === true })));
|
|
1003
|
+
for (const op of DATA_OPS) {
|
|
1004
|
+
server.registerTool(op.mcp, {
|
|
1005
|
+
description: op.description,
|
|
1006
|
+
inputSchema: mcpShape(op),
|
|
1007
|
+
annotations: op.method === "GET" ? { readOnlyHint: true } : op.method === "DELETE" ? { destructiveHint: true, idempotentHint: true } : { destructiveHint: op.scope === "agents:live" },
|
|
1008
|
+
}, (args) => attempt(() => runDataOp(client, op, args)));
|
|
1009
|
+
}
|
|
1001
1010
|
return server;
|
|
1002
1011
|
}
|
package/package.json
CHANGED
package/skills/kumion/SKILL.md
CHANGED
|
@@ -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,7 +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
|
+
| `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. |
|
|
301
302
|
| `qa_system_prompt` | qa | `required` | `string` | Evaluation prompt. |
|
|
302
303
|
| `qa_sample_rate` | qa | `required` | `number` | Percentage of calls analysed, 1 to 100. |
|
|
303
304
|
| `qa_min_call_duration` | qa | `required` | `number` | Shortest call (seconds) that is analysed. |
|
|
@@ -338,6 +339,16 @@ field in the item's `tool` as `{ "tool_key": "…", "result_field": "…" }`;
|
|
|
338
339
|
only that tool succeeding at this step records it. Keys in `optional_slots` are
|
|
339
340
|
recorded only when the caller says them first; they are not required at that step.
|
|
340
341
|
|
|
342
|
+
## Customers, marks and records
|
|
343
|
+
|
|
344
|
+
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.
|
|
345
|
+
|
|
346
|
+
- `list_contacts`, `get_contact`, `list_contact_calls`, `list_contact_fields` (`contacts:read`); `create_contact`, `update_contact` (`contacts:write`). Customers only; staff are `list_staff`.
|
|
347
|
+
- `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.
|
|
348
|
+
- `list_captures`, `get_capture_status_log` (`captures:read`); `update_capture` (`captures:write`): status and note only, the assignee is set on the screen.
|
|
349
|
+
- `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.
|
|
350
|
+
- `get_analytics` (`analytics:read`).
|
|
351
|
+
|
|
341
352
|
## When it refuses
|
|
342
353
|
|
|
343
354
|
- **401** — key wrong, revoked, expired, or for another tenant. A personal key from
|
|
@@ -345,7 +356,7 @@ recorded only when the caller says them first; they are not required at that ste
|
|
|
345
356
|
tenant administrator (`kumion auth status` shows its expiry). The user re-runs
|
|
346
357
|
`kumion auth login`.
|
|
347
358
|
- **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
|
|
359
|
+
`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
360
|
in the Portal (設定 → 開発者) and logs in again. Do not work around it.
|
|
350
361
|
- **403 without a scope name** — the tenant's plan cannot publish, or `create_call` hit
|
|
351
362
|
the call-minute limit. Tell the user; a new key does not help.
|