@kumion/cli 0.6.8 → 0.6.9
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 +45 -8
- package/dist/client.js +42 -0
- package/dist/data-ops.js +3 -3
- package/dist/errors.js +19 -1
- package/dist/main.js +182 -7
- package/dist/mcp.js +74 -2
- package/package.json +1 -1
- package/skills/kumion/SKILL.md +31 -6
package/README.md
CHANGED
|
@@ -50,9 +50,9 @@ Your Portal session stays in the browser; the CLI only ever holds the key.
|
|
|
50
50
|
`kumion auth status` shows the key's kind and expiry. `--scopes agents:read,calls:read`
|
|
51
51
|
asks for less than every permission the CLI can use.
|
|
52
52
|
|
|
53
|
-
### With an API key from 設定 → 開発者
|
|
53
|
+
### With an API key from 設定 → 開発者API
|
|
54
54
|
|
|
55
|
-
For a key someone issued on the Portal's **設定 →
|
|
55
|
+
For a key someone issued on the Portal's **設定 → 開発者API** page (a *service* key —
|
|
56
56
|
the tenant's, not a person's; choose the scopes you need, see below). You also need
|
|
57
57
|
the tenant ID: the UUID in the Portal URL (`/tenants/<tenant-id>/…`) and in the curl
|
|
58
58
|
examples on the same page.
|
|
@@ -120,6 +120,13 @@ would use.
|
|
|
120
120
|
| `kumion flow get <agentId>` | `agents:read` |
|
|
121
121
|
| `kumion flow update <agentId> --revision <rev> --patch-file <path> [--dry-run]` | `agents:write` |
|
|
122
122
|
| `kumion flow edit-steps <agentId> --revision <rev> --ops-file <path> [--dry-run]` | `agents:write` |
|
|
123
|
+
| `kumion chat-agents list` | `agents:read` (the チャットエージェント — text agents; the plan must include them) |
|
|
124
|
+
| `kumion chat-agents get <chatAgentId>` | `agents:read` |
|
|
125
|
+
| `kumion chat-agents draft get <chatAgentId>` | `agents:read` (`--json` prints the whole graph and the `revision` a write needs) |
|
|
126
|
+
| `kumion chat-agents draft update <chatAgentId> --revision <rev> --graph-file <path> [--name <name>] [--dry-run]` | `agents:write` (a draft write: visitors see it after the next publish; a stale revision is a 412) |
|
|
127
|
+
| `kumion chat-agents diagnostics <chatAgentId>` | `agents:read` |
|
|
128
|
+
| `kumion chat-agents publish <chatAgentId> [--revision <rev>]` | `agents:publish` (refused with the findings while an error is left) |
|
|
129
|
+
| `kumion chat-agents versions <chatAgentId>` | `agents:read` |
|
|
123
130
|
| `kumion templates list` | `agents:read` |
|
|
124
131
|
| `kumion staff list` | `agents:read` |
|
|
125
132
|
| `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) |
|
|
@@ -136,8 +143,8 @@ would use.
|
|
|
136
143
|
| `kumion call-marks clear <callId> <typeId>` | `calls:write` |
|
|
137
144
|
| `kumion call-marks create-type --name <text>` | `calls:write` |
|
|
138
145
|
| `kumion callback-lists create --call <value> ... [--name <text>]` | `calls:write` |
|
|
139
|
-
| `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` |
|
|
140
|
-
| `kumion captures update <captureId> [--status open\|done\|dismissed] [--note <text>]` | `captures:write` |
|
|
146
|
+
| `kumion captures list [--type <text>] [--spec <text>] [--agent <text>] [--field <text>] [--value <text>] [--q <text>] [--status open\|in_progress\|done\|dismissed] [--from <text>] [--to <text>] [--limit <n>] [--offset <n>]` | `captures:read` |
|
|
147
|
+
| `kumion captures update <captureId> [--status open\|in_progress\|done\|dismissed] [--note <text>]` | `captures:write` |
|
|
141
148
|
| `kumion captures status-log <captureId>` | `captures:read` |
|
|
142
149
|
| `kumion documents history <documentId>` | `agents:read` |
|
|
143
150
|
| `kumion documents version-diff <documentId> --from <n> --to <n>` | `agents:read` |
|
|
@@ -163,6 +170,7 @@ would use.
|
|
|
163
170
|
| `kumion documents upload (--text-file <path> \| --file <path> [--file <path> ...]) --title <title> --idempotency-key <key> [--template <templateId>] [--dry-run]` | `agents:write` (one counted model extraction; see [From a template to public](#from-a-template-to-public)) |
|
|
164
171
|
| `kumion documents jobs get <jobId>` | `agents:read` (exits 1 when the job failed or timed out) |
|
|
165
172
|
| `kumion documents get <documentId>` | `agents:read` |
|
|
173
|
+
| `kumion documents delete <documentId>` | `agents:live` (cannot be undone; refused with the list of what uses it, and an archived agent does not count) |
|
|
166
174
|
| `kumion documents replace <documentId> --source <sourceDocumentId> --source-revision <rev> --revision <rev> [--dry-run]` | `agents:live` (live: no publish) |
|
|
167
175
|
| `kumion test-runs start <agentId> [--turns <file\|->] [--no-wait] [--interval <sec>] [--timeout <sec>]` | `tests:run` |
|
|
168
176
|
| `kumion test-runs get <agentId> <runId>` | `tests:run` |
|
|
@@ -190,7 +198,7 @@ dial starts; after that it answers 404.
|
|
|
190
198
|
them. When the workspace has personal-information masking on, `calls list`, `calls get`,
|
|
191
199
|
`calls transcript` and the captured items show masked values; only a key that also holds
|
|
192
200
|
`calls:read_unmasked` sees the stored values (each such read is audited). `kumion auth login`
|
|
193
|
-
does not ask for `calls:read_unmasked`; issue a key with it on the Portal's 設定 → 開発者 page. `calls list` returns one page (20 by default, at most 100) and prints the
|
|
201
|
+
does not ask for `calls:read_unmasked`; issue a key with it on the Portal's 設定 → 開発者API page. `calls list` returns one page (20 by default, at most 100) and prints the
|
|
194
202
|
`--offset` of the next one. Every call in `calls list` and `calls get` carries what it came to: `outcome`
|
|
195
203
|
(`ai_resolved`, `ai_unresolved_hangup`, `invalid_call`, `handoff`, `system_ended`, or `na` when not judged),
|
|
196
204
|
`endedAtNode` (the node it ended on), `durationSec`, `transferred`, and `capturedItems` (the names of the
|
|
@@ -347,7 +355,7 @@ Three settings are not part of the draft, so a write to them needs no publish:
|
|
|
347
355
|
- `agents availability`: 受付時間 (`--operating-hours-file`, JSON `{ "mode": "always" | "staffed" | "custom", "hours": { "mon": [{ "start": "09:00", "end": "18:00" }] } }`) and 時間外の対応 (`--off-hours-file`, JSON `{ "kind": "answer" | "announce_end" | "route_to", ... }`). A file holding `null` clears the setting. `agents get --json` shows both under `live`.
|
|
348
356
|
- `facts edit` and `facts confirm`: the facts taken from the agent's 資料 (prices, menu). `facts list` shows each fact's `revision`; `facts edit` is refused when that fact changed since.
|
|
349
357
|
|
|
350
|
-
They need the scope **`agents:live`**, which is not part of `agents:write` (that scope only writes the draft and never publishes) and is not added to keys issued before it existed: issue a new key with it on 設定 →
|
|
358
|
+
They need the scope **`agents:live`**, which is not part of `agents:write` (that scope only writes the draft and never publishes) and is not added to keys issued before it existed: issue a new key with it on 設定 → 開発者API. `agents opening-name` is an ordinary draft write (`agents:write`): it reaches callers with the next publish.
|
|
351
359
|
|
|
352
360
|
`staff update` is the third: a 用件's 転送 looks its スタッフ up by key when the transfer happens and reads 転送先 and whether the row is enabled then, so `staff update --enabled false` takes someone off the 転送 candidates from the next call on, with no publish. `--revision` is the row's own, from `staff list`; a write based on a stale one is refused with a conflict and nothing is written. The transfer key is generated when the row is created and cannot be changed — a published flow stores it.
|
|
353
361
|
|
|
@@ -393,7 +401,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
393
401
|
| `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
|
|
394
402
|
| `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,require_day?,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). `require_day`: for a `birthdate` item, tell the model the value needs a year, a month and a day (off = year and month). `tool`: `{tool_key,result_field}` for a tool-sourced item. |
|
|
395
403
|
| `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
|
|
396
|
-
| `route_judge` | start | `tune` | `boolean` | Absent means off
|
|
404
|
+
| `route_judge` | start | `tune` | `boolean` | Absent means on wherever the step can be judged, and off without any diagnostic where it cannot; `false` turns it off. 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 800 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. A step can be judged when the call is Japanese, the call model's endpoint has a calibrated readout, and the step has no items, exactly three AI connections without items and no fixed connections. An explicit `true` on a step that cannot be judged is reported (graph diagnostics `route_judge_not_applicable`). |
|
|
397
405
|
| `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). |
|
|
398
406
|
| `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`). |
|
|
399
407
|
| `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. |
|
|
@@ -414,7 +422,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
414
422
|
| `kb_fallback` | start, agent | `advanced` | `{ noResult?, unavailable? }` | Wording when a knowledge search finds nothing or is unavailable. Overrides the tenant operations setting. |
|
|
415
423
|
| `end_speech` | end | `required` | `string` | Default goodbye line. A connection into this node can override it. |
|
|
416
424
|
| `caller_leaves` | end | `required` | `boolean` | Marks the end a caller who walks away is sent to from every agent step, connected or not. Required on exactly one end when the flow has two or more end nodes. |
|
|
417
|
-
| `ivr` | ivr | `required` | `object` | Announcement, digit table and
|
|
425
|
+
| `ivr` | ivr | `required` | `object` | Announcement, digit table, wait time, and the optional speech exit. input and max_retries are fixed; other values are rejected. `voice_enabled: true` also lets a spoken answer leave the menu once it reaches `voice_min_chars` letters and digits (2–30, default 5); the edge it takes has the condition `ivr.<key>.status == "voice"`, and without that edge a spoken answer follows the no-input / failure edge. Omit both keys for the digit-only menu. |
|
|
418
426
|
| `transfer` | transfer | `required` | `object` | Transfer target and the line spoken before transferring. |
|
|
419
427
|
| `notify` | notify | `required` | `object` | Recipients, subject and body templates. |
|
|
420
428
|
| `http_method` | webhook | `required` | `string` | GET, POST, PUT, PATCH or DELETE. |
|
|
@@ -443,6 +451,12 @@ and a row in a node's 「動きの調整」), and an IVR node's `ivr.input` and
|
|
|
443
451
|
(`{ "mode": "single", "max_digits": 1, "finish_key": null }` and `0`): any other value
|
|
444
452
|
makes the patch fail.
|
|
445
453
|
|
|
454
|
+
An IVR node can also take a spoken answer (「声でも次へ進む」): set `ivr.voice_enabled: true`
|
|
455
|
+
(and optionally `ivr.voice_min_chars`, an integer 2–30, default 5 — the letters and digits an
|
|
456
|
+
utterance needs before it leaves the menu), then add an edge with the condition
|
|
457
|
+
`ivr.<key>.status == "voice"`. Without that edge a spoken answer follows the no-input / failure
|
|
458
|
+
edge. Leave both keys out for the digit-only menu.
|
|
459
|
+
|
|
446
460
|
### Testing and publishing
|
|
447
461
|
|
|
448
462
|
```sh
|
|
@@ -666,6 +680,29 @@ Two things are closed here on purpose:
|
|
|
666
680
|
- **Booking records** (making, moving or cancelling a customer's booking) and notifications are not
|
|
667
681
|
Partner API operations. `booking slots` reads openings; nothing here writes a booking.
|
|
668
682
|
|
|
683
|
+
## Chat agents (チャットエージェント)
|
|
684
|
+
|
|
685
|
+
A chat agent is the text counterpart of a voice agent: its own list, its own ids, its own draft canvas and its own
|
|
686
|
+
versions. Use `chat-agents list` for the ids; the voice `agents` commands do not see them. Every command needs the
|
|
687
|
+
tenant's plan to include chat agents (a plan without them answers 403 whatever the key's scopes).
|
|
688
|
+
|
|
689
|
+
```bash
|
|
690
|
+
kumion chat-agents list
|
|
691
|
+
kumion chat-agents draft get <chatAgentId> --json > draft.json # note "revision"; "graph" is the canvas
|
|
692
|
+
# edit draft.json (the file may stay whole: `--graph-file` takes the output of `draft get --json`)
|
|
693
|
+
kumion chat-agents draft update <chatAgentId> --revision <rev> --graph-file draft.json --dry-run
|
|
694
|
+
kumion chat-agents draft update <chatAgentId> --revision <rev> --graph-file draft.json
|
|
695
|
+
kumion chat-agents diagnostics <chatAgentId> # errors block publishing; warnings do not
|
|
696
|
+
kumion chat-agents publish <chatAgentId> --revision <new rev>
|
|
697
|
+
kumion chat-agents versions <chatAgentId>
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
`draft update` replaces the whole draft, through the same structural check as the canvas's save (a graph that fails it
|
|
701
|
+
is a 400 and nothing is written). `--dry-run` runs every check and prints the findings the draft would have, without
|
|
702
|
+
saving. A `--revision` that is no longer the draft's is refused with a 412 and nothing is written: read the draft again
|
|
703
|
+
and re-apply the change. `publish` is refused (422) while any finding is an error, and `--revision` makes it refuse
|
|
704
|
+
a draft that moved since you read it.
|
|
705
|
+
|
|
669
706
|
## Use it from an AI coding assistant (MCP)
|
|
670
707
|
|
|
671
708
|
`kumion mcp` serves the same operations as MCP tools over stdio, for Claude Code,
|
package/dist/client.js
CHANGED
|
@@ -268,6 +268,44 @@ export class KumionClient {
|
|
|
268
268
|
});
|
|
269
269
|
return response;
|
|
270
270
|
}
|
|
271
|
+
chatAgentPath(chatAgentId, rest = "") {
|
|
272
|
+
return this.tenantPath(`/chat-agents/${encodeURIComponent(chatAgentId)}${rest}`);
|
|
273
|
+
}
|
|
274
|
+
async listChatAgents() {
|
|
275
|
+
const { body } = await this.request("GET", this.tenantPath("/chat-agents"), "agents:read");
|
|
276
|
+
return body.agents;
|
|
277
|
+
}
|
|
278
|
+
async getChatAgent(chatAgentId) {
|
|
279
|
+
const { body } = await this.request("GET", this.chatAgentPath(chatAgentId), "agents:read");
|
|
280
|
+
return body.agent;
|
|
281
|
+
}
|
|
282
|
+
async getChatAgentDraft(chatAgentId) {
|
|
283
|
+
const { body } = await this.request("GET", this.chatAgentPath(chatAgentId, "/draft"), "agents:read");
|
|
284
|
+
return body;
|
|
285
|
+
}
|
|
286
|
+
async updateChatAgentDraft(chatAgentId, input, revision, options = {}) {
|
|
287
|
+
const query = options.dryRun ? "?dryRun=1" : "";
|
|
288
|
+
const { body } = await this.request("PATCH", this.chatAgentPath(chatAgentId, `/draft${query}`), "agents:write", {
|
|
289
|
+
body: input,
|
|
290
|
+
ifMatch: revision,
|
|
291
|
+
});
|
|
292
|
+
return body;
|
|
293
|
+
}
|
|
294
|
+
async getChatAgentDiagnostics(chatAgentId) {
|
|
295
|
+
const { body } = await this.request("GET", this.chatAgentPath(chatAgentId, "/diagnostics"), "agents:read");
|
|
296
|
+
return body;
|
|
297
|
+
}
|
|
298
|
+
async publishChatAgent(chatAgentId, revision) {
|
|
299
|
+
const { body } = await this.request("POST", this.chatAgentPath(chatAgentId, "/publish"), "agents:publish", {
|
|
300
|
+
body: {},
|
|
301
|
+
ifMatch: revision,
|
|
302
|
+
});
|
|
303
|
+
return body;
|
|
304
|
+
}
|
|
305
|
+
async listChatAgentVersions(chatAgentId) {
|
|
306
|
+
const { body } = await this.request("GET", this.chatAgentPath(chatAgentId, "/versions"), "agents:read");
|
|
307
|
+
return body.versions;
|
|
308
|
+
}
|
|
271
309
|
async startTestRun(agentId, turns) {
|
|
272
310
|
const { body } = await this.request("POST", this.agentPath(agentId, "/test-runs"), "tests:run", {
|
|
273
311
|
body: turns ? { turns } : {},
|
|
@@ -450,6 +488,10 @@ export class KumionClient {
|
|
|
450
488
|
const { body } = await this.request("GET", this.tenantPath(`/documents/${encodeURIComponent(documentId)}`), "agents:read");
|
|
451
489
|
return body;
|
|
452
490
|
}
|
|
491
|
+
async deleteDocument(documentId) {
|
|
492
|
+
const { body } = await this.request("DELETE", this.tenantPath(`/documents/${encodeURIComponent(documentId)}`), "agents:live");
|
|
493
|
+
return body;
|
|
494
|
+
}
|
|
453
495
|
async replaceDocument(documentId, input, revision, options = {}) {
|
|
454
496
|
const query = options.dryRun ? "?dryRun=1" : "";
|
|
455
497
|
const { body } = await this.request("POST", this.tenantPath(`/documents/${encodeURIComponent(documentId)}/replace${query}`), "agents:live", { body: input, ifMatch: revision });
|
package/dist/data-ops.js
CHANGED
|
@@ -3,7 +3,7 @@ const page = [
|
|
|
3
3
|
{ name: "limit", kind: "number", help: "page size (default 20, at most 100)" },
|
|
4
4
|
{ name: "offset", kind: "number", help: "rows to skip" },
|
|
5
5
|
];
|
|
6
|
-
const STATUS = ["open", "done", "dismissed"];
|
|
6
|
+
const STATUS = ["open", "in_progress", "done", "dismissed"];
|
|
7
7
|
export const DATA_OPS = [
|
|
8
8
|
{
|
|
9
9
|
cli: "contacts list", mcp: "list_contacts", method: "GET", path: "/contacts", scope: "contacts:read",
|
|
@@ -98,7 +98,7 @@ export const DATA_OPS = [
|
|
|
98
98
|
{ name: "field", kind: "string", help: "field key (with --value)" },
|
|
99
99
|
{ name: "value", kind: "string", help: "that field's value (with --field)" },
|
|
100
100
|
{ name: "q", kind: "string", help: "search text" },
|
|
101
|
-
{ name: "status", kind: "string", values: STATUS, help: "open|done|dismissed" },
|
|
101
|
+
{ name: "status", kind: "string", values: STATUS, help: "open|in_progress|done|dismissed" },
|
|
102
102
|
{ name: "from", kind: "string", help: "at or after (ISO 8601)" },
|
|
103
103
|
{ name: "to", kind: "string", help: "at or before (ISO 8601)" },
|
|
104
104
|
...page,
|
|
@@ -108,7 +108,7 @@ export const DATA_OPS = [
|
|
|
108
108
|
{
|
|
109
109
|
cli: "captures update", mcp: "update_capture", method: "PATCH", path: "/captures/{captureId}", scope: "captures:write",
|
|
110
110
|
body: [
|
|
111
|
-
{ name: "status", kind: "string", values: STATUS, help: "open|done|dismissed" },
|
|
111
|
+
{ name: "status", kind: "string", values: STATUS, help: "open|in_progress|done|dismissed" },
|
|
112
112
|
{ name: "handledNote", kind: "string", flag: "note", help: "handling note (up to 1000 characters; an empty string clears it)" },
|
|
113
113
|
],
|
|
114
114
|
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.",
|
package/dist/errors.js
CHANGED
|
@@ -17,7 +17,7 @@ export function describeApiError(err) {
|
|
|
17
17
|
const detail = typeof err.body.error === "string" ? err.body.error : "";
|
|
18
18
|
if (detail.includes(err.scope)) {
|
|
19
19
|
return (`This API key does not have the \`${err.scope}\` scope, which this command needs (403). ` +
|
|
20
|
-
`Issue a key that includes it in the Kumion Portal (設定 → 開発者).` +
|
|
20
|
+
`Issue a key that includes it in the Kumion Portal (設定 → 開発者API).` +
|
|
21
21
|
serverSaid(err));
|
|
22
22
|
}
|
|
23
23
|
if (err.code === "plan_publish_required") {
|
|
@@ -79,6 +79,14 @@ export function describeApiError(err) {
|
|
|
79
79
|
"client. Nothing was written. Run `kumion facts list <agentId>` for its new revision and try again." +
|
|
80
80
|
serverSaid(err));
|
|
81
81
|
}
|
|
82
|
+
if (err.code === "document_in_use") {
|
|
83
|
+
const refs = Array.isArray(err.body.references) ? err.body.references : [];
|
|
84
|
+
const lines = refs.map((ref) => ref.kind === "agent"
|
|
85
|
+
? ` - agent ${String(ref.agentName)} (${String(ref.agentId)}) — the whole agent`
|
|
86
|
+
: ` - flow ${String(ref.workflowName)} / step ${String(ref.nodeName ?? ref.nodeKey)}`);
|
|
87
|
+
return ("The 資料 is still in use (409 document_in_use). Nothing was deleted. Detach it from these first:" +
|
|
88
|
+
`${lines.length > 0 ? `\n${lines.join("\n")}` : ""}${serverSaid(err)}`);
|
|
89
|
+
}
|
|
82
90
|
if (err.code === "test_run_in_progress") {
|
|
83
91
|
return ("This agent already has a test run in progress (409). Wait for it with " +
|
|
84
92
|
"`kumion test-runs list <agentId>` / `kumion test-runs get <agentId> <runId>`, then start another." +
|
|
@@ -90,6 +98,11 @@ export function describeApiError(err) {
|
|
|
90
98
|
serverSaid(err));
|
|
91
99
|
}
|
|
92
100
|
return `Conflict (409).${serverSaid(err)}`;
|
|
101
|
+
case 412:
|
|
102
|
+
return ("The chat agent's draft changed since you read it (412): someone saved it in the Portal or from another " +
|
|
103
|
+
"client. Nothing was written. Run `kumion chat-agents draft get <id>` for the new revision, re-apply your " +
|
|
104
|
+
"change on top of it, and try again." +
|
|
105
|
+
serverSaid(err));
|
|
93
106
|
case 428:
|
|
94
107
|
return `The API asked for an If-Match revision the CLI did not send (428). This is a CLI bug.${serverSaid(err)}`;
|
|
95
108
|
case 422: {
|
|
@@ -109,6 +122,11 @@ export function describeApiError(err) {
|
|
|
109
122
|
`sends or whom it notifies, and the API cannot add or change them. Edit them on the Portal's canvas:${listed}` +
|
|
110
123
|
serverSaid(err));
|
|
111
124
|
}
|
|
125
|
+
if (err.code === "chat_agent_not_publishable") {
|
|
126
|
+
const findings = Array.isArray(err.body.diagnostics) ? err.body.diagnostics : [];
|
|
127
|
+
const lines = findings.filter((d) => d.severity === "error").map((d) => ` - ${String(d.code)}${d.nodeId ? ` (node ${String(d.nodeId)})` : ""}${d.edgeId ? ` (line ${String(d.edgeId)})` : ""}`);
|
|
128
|
+
return `Not published (422). Nothing was stored — the draft still has errors:${lines.length > 0 ? `\n${lines.join("\n")}` : ""}\nFix them with \`kumion chat-agents draft update\`; \`kumion chat-agents diagnostics <id>\` lists them again.`;
|
|
129
|
+
}
|
|
112
130
|
if (err.code === "flow_edit_refused" && reason) {
|
|
113
131
|
const which = typeof err.body.opIndex === "number" ? `Operation ${err.body.opIndex + 1} was refused` : "The change was refused";
|
|
114
132
|
return `${which} (422). Nothing was written.\nServer said: ${reason}`;
|
package/dist/main.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ApiError, KumionClient, isTextFile, specText, } from "./client.js";
|
|
|
6
6
|
import { DEFAULT_BASE_URL, keyPrefix, looksLikeApiKey, normalizeBaseUrl, resolveCredentials, } from "./credentials.js";
|
|
7
7
|
import { DEFAULT_DEVICE_SCOPES, deviceLogin } from "./device-login.js";
|
|
8
8
|
import { describeError, ReportedFailure, UsageError } from "./errors.js";
|
|
9
|
-
export const VERSION = "0.6.
|
|
9
|
+
export const VERSION = "0.6.9";
|
|
10
10
|
const HELP = `kumion — manage your Kumion voice agents over the Partner API
|
|
11
11
|
|
|
12
12
|
Usage: kumion <command> [options]
|
|
@@ -17,7 +17,7 @@ Auth
|
|
|
17
17
|
Portal and get a personal key (12 hours at most;
|
|
18
18
|
tenant administrators only) in the OS keychain
|
|
19
19
|
auth login --with-api-key [--profile <name>] [--tenant <id>] [--base-url <url>]
|
|
20
|
-
Save an API key issued on 設定 → 開発者 instead
|
|
20
|
+
Save an API key issued on 設定 → 開発者API instead
|
|
21
21
|
auth status Show which tenant and key commands will use
|
|
22
22
|
auth list List saved profiles
|
|
23
23
|
auth use <profile> Make a profile the default
|
|
@@ -46,7 +46,7 @@ Agents
|
|
|
46
46
|
null to clear it. LIVE: callers get it at once, no publish
|
|
47
47
|
(needs a key with agents:live)
|
|
48
48
|
webcall get <agentId> Show the Webコール access limits (allowed IPs / embedding sites; empty = no limit)
|
|
49
|
-
webcall update <agentId> [--ip <a,b,...>] [--embed <a,b,...>] [--accent <#RRGGBB>] [--title <t>] [--greeting <t>]
|
|
49
|
+
webcall update <agentId> [--ip <a,b,...>] [--embed <a,b,...>] [--signed-only on|off] [--accent <#RRGGBB>] [--title <t>] [--greeting <t>]
|
|
50
50
|
[--quick-reply <t> (repeat, max 4)] [--launcher-label <t>] [--position right|left]
|
|
51
51
|
[--entry both|voice|text] [--logo <png|jpg|webp file> | --remove-logo]
|
|
52
52
|
(an empty value clears an appearance item back to the default)
|
|
@@ -85,6 +85,24 @@ Flow
|
|
|
85
85
|
is atomic (one refused operation refuses all of them) and moves the
|
|
86
86
|
revision once. --dry-run prints the change and saves nothing
|
|
87
87
|
|
|
88
|
+
Chat agents (チャットエージェント — the text agent, a resource of its own; the plan must include it)
|
|
89
|
+
chat-agents list List the chat agents: id, name, published version, whether the
|
|
90
|
+
draft has changes not yet published
|
|
91
|
+
chat-agents get <id> One chat agent: name, draft revision, published version
|
|
92
|
+
chat-agents draft get <id> Read the draft canvas (nodes and lines) and its revision.
|
|
93
|
+
--json prints the whole graph
|
|
94
|
+
chat-agents draft update <id> --revision <rev> --graph-file <path> [--name <name>] [--dry-run]
|
|
95
|
+
Replace the draft with the graph in the file (a bare graph, or the
|
|
96
|
+
output of \`draft get --json\`), through the checks the canvas's save
|
|
97
|
+
runs. Prints the findings the draft now has. A draft write: nothing
|
|
98
|
+
reaches visitors until publish. --dry-run runs every check and
|
|
99
|
+
saves nothing
|
|
100
|
+
chat-agents diagnostics <id> The draft's findings (errors block publishing; warnings do not)
|
|
101
|
+
chat-agents publish <id> [--revision <rev>]
|
|
102
|
+
Publish the draft as the next version. Refused while an error is
|
|
103
|
+
left; with --revision, also refused if the draft has moved since
|
|
104
|
+
chat-agents versions <id> The published versions, newest first
|
|
105
|
+
|
|
88
106
|
Templates
|
|
89
107
|
templates list List the onboarding templates and their ids
|
|
90
108
|
|
|
@@ -118,10 +136,10 @@ Customers, marks and records (need the contacts:*, calls:write, captures:* or an
|
|
|
118
136
|
callback-lists create --call <value> ... [--name <text>]
|
|
119
137
|
Make a draft callback list from calls (nothing is dialled)
|
|
120
138
|
captures list [--type <text>] [--spec <text>] [--agent <text>] [--field
|
|
121
|
-
<text>] [--value <text>] [--q <text>] [--status open|done|dismissed]
|
|
139
|
+
<text>] [--value <text>] [--q <text>] [--status open|in_progress|done|dismissed]
|
|
122
140
|
[--from <text>] [--to <text>] [--limit <n>] [--offset <n>]
|
|
123
141
|
List the recorded summaries, newest first
|
|
124
|
-
captures update <captureId> [--status open|done|dismissed] [--note <text>]
|
|
142
|
+
captures update <captureId> [--status open|in_progress|done|dismissed] [--note <text>]
|
|
125
143
|
Set a summary's handling status and note
|
|
126
144
|
captures status-log <captureId>
|
|
127
145
|
Who changed a summary's status, when
|
|
@@ -237,6 +255,9 @@ Documents (資料 — the source an agent's facts are extracted from)
|
|
|
237
255
|
documents jobs get <jobId> Show an upload job: status, the document it produced, the error.
|
|
238
256
|
Exits non-zero when the job failed or timed out
|
|
239
257
|
documents get <documentId> Show a 資料: its fields, review state and revision (not the text)
|
|
258
|
+
documents delete <documentId> Delete a 資料. Refused with the list of what uses it while an agent or a flow
|
|
259
|
+
step still does; an archived agent does not count (its link is cleared).
|
|
260
|
+
Cannot be undone (needs agents:live)
|
|
240
261
|
documents replace <documentId> --source <sourceDocumentId> --source-revision <rev> --revision <rev>
|
|
241
262
|
[--dry-run]
|
|
242
263
|
Give a 資料 another document's content and facts, keeping its id, so the
|
|
@@ -409,6 +430,13 @@ export const COMMANDS = {
|
|
|
409
430
|
"flow get": flowGet,
|
|
410
431
|
"flow update": flowUpdate,
|
|
411
432
|
"flow edit-steps": flowEditSteps,
|
|
433
|
+
"chat-agents list": chatAgentsList,
|
|
434
|
+
"chat-agents get": chatAgentsGet,
|
|
435
|
+
"chat-agents draft get": chatAgentsDraftGet,
|
|
436
|
+
"chat-agents draft update": chatAgentsDraftUpdate,
|
|
437
|
+
"chat-agents diagnostics": chatAgentsDiagnostics,
|
|
438
|
+
"chat-agents publish": chatAgentsPublish,
|
|
439
|
+
"chat-agents versions": chatAgentsVersions,
|
|
412
440
|
"templates list": templatesList,
|
|
413
441
|
"staff list": staffList,
|
|
414
442
|
"staff create": staffCreate,
|
|
@@ -435,6 +463,7 @@ export const COMMANDS = {
|
|
|
435
463
|
"documents upload": documentsUpload,
|
|
436
464
|
"documents jobs get": documentsJobsGet,
|
|
437
465
|
"documents get": documentsGet,
|
|
466
|
+
"documents delete": documentsDelete,
|
|
438
467
|
"documents replace": documentsReplace,
|
|
439
468
|
"test-runs start": testRunsStart,
|
|
440
469
|
"test-runs get": testRunsGet,
|
|
@@ -501,7 +530,7 @@ async function authLoginWithApiKey(values, deps) {
|
|
|
501
530
|
const name = values.profile ?? "default";
|
|
502
531
|
const tenantId = (values.tenant ?? (await deps.io.prompt("Tenant ID: "))).trim();
|
|
503
532
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(tenantId)) {
|
|
504
|
-
throw new UsageError("The tenant ID must be a UUID — the one in the Portal URL (/tenants/<id>/) and in the curl examples on 設定 →
|
|
533
|
+
throw new UsageError("The tenant ID must be a UUID — the one in the Portal URL (/tenants/<id>/) and in the curl examples on 設定 → 開発者API.");
|
|
505
534
|
}
|
|
506
535
|
const apiKey = (await deps.io.prompt("API key (input hidden): ", { hidden: true })).trim();
|
|
507
536
|
if (!looksLikeApiKey(apiKey))
|
|
@@ -791,6 +820,7 @@ function splitList(v) {
|
|
|
791
820
|
function webcallLines(w, deps) {
|
|
792
821
|
deps.io.out(`IP allowlist: ${w.accessIpAllowlist.length ? w.accessIpAllowlist.join(", ") : "(none — no limit)"}`);
|
|
793
822
|
deps.io.out(`Embed sites: ${w.embedOriginAllowlist.length ? w.embedOriginAllowlist.join(", ") : "(none — deployment default)"}`);
|
|
823
|
+
deps.io.out(`Signed only: ${w.requireSignedVisitor ? "on — a start with no signed visitorToken is refused" : "off"}`);
|
|
794
824
|
const shown = Object.entries(w.appearance ?? {}).filter(([, v]) => v !== undefined);
|
|
795
825
|
deps.io.out(`Appearance: ${shown.length ? shown.map(([k, v]) => `${k}=${Array.isArray(v) ? v.join(" | ") : String(v)}`).join("; ") : "(defaults)"}`);
|
|
796
826
|
deps.io.out(`Logo: ${w.hasLogo ? "set" : "(none)"}`);
|
|
@@ -845,6 +875,7 @@ async function webcallUpdate(args, deps) {
|
|
|
845
875
|
const { values, positionals } = parse(args, {
|
|
846
876
|
ip: { type: "string" },
|
|
847
877
|
embed: { type: "string" },
|
|
878
|
+
"signed-only": { type: "string" },
|
|
848
879
|
accent: { type: "string" },
|
|
849
880
|
title: { type: "string" },
|
|
850
881
|
greeting: { type: "string" },
|
|
@@ -861,6 +892,11 @@ async function webcallUpdate(args, deps) {
|
|
|
861
892
|
patch.accessIpAllowlist = splitList(values.ip);
|
|
862
893
|
if (values.embed !== undefined)
|
|
863
894
|
patch.embedOriginAllowlist = splitList(values.embed);
|
|
895
|
+
if (values["signed-only"] !== undefined) {
|
|
896
|
+
if (values["signed-only"] !== "on" && values["signed-only"] !== "off")
|
|
897
|
+
throw new UsageError("--signed-only takes on or off.");
|
|
898
|
+
patch.requireSignedVisitor = values["signed-only"] === "on";
|
|
899
|
+
}
|
|
864
900
|
const appearance = {};
|
|
865
901
|
const orNull = (v) => (v === "" ? null : v);
|
|
866
902
|
if (values.accent !== undefined)
|
|
@@ -891,7 +927,7 @@ async function webcallUpdate(args, deps) {
|
|
|
891
927
|
patch.logo = { contentType, dataBase64: Buffer.from(await readFile(values.logo)).toString("base64") };
|
|
892
928
|
}
|
|
893
929
|
if (Object.keys(patch).length === 0) {
|
|
894
|
-
throw new UsageError("Nothing to change. Pass --ip, --embed or an appearance flag (see `kumion help`).");
|
|
930
|
+
throw new UsageError("Nothing to change. Pass --ip, --embed, --signed-only or an appearance flag (see `kumion help`).");
|
|
895
931
|
}
|
|
896
932
|
const w = await (await clientFor(values, deps)).setWebcallAccess(agentId, patch);
|
|
897
933
|
if (values.json)
|
|
@@ -1690,6 +1726,21 @@ async function documentsGet(args, deps) {
|
|
|
1690
1726
|
}
|
|
1691
1727
|
return 0;
|
|
1692
1728
|
}
|
|
1729
|
+
async function documentsDelete(args, deps) {
|
|
1730
|
+
const { values, positionals } = parse(args, {});
|
|
1731
|
+
const documentId = need(positionals, 0, "documentId");
|
|
1732
|
+
const result = await (await clientFor(values, deps)).deleteDocument(documentId);
|
|
1733
|
+
if (values.json) {
|
|
1734
|
+
printJson(deps, result);
|
|
1735
|
+
return 0;
|
|
1736
|
+
}
|
|
1737
|
+
deps.io.out(`Deleted ${documentId}.`);
|
|
1738
|
+
const archived = Array.isArray(result.archivedAgents) ? result.archivedAgents : [];
|
|
1739
|
+
if (archived.length > 0) {
|
|
1740
|
+
deps.io.out(`Archived agents that lost their link: ${archived.map((agent) => agent.agentName).join(", ")}`);
|
|
1741
|
+
}
|
|
1742
|
+
return 0;
|
|
1743
|
+
}
|
|
1693
1744
|
async function documentsReplace(args, deps) {
|
|
1694
1745
|
const { values, positionals } = parse(args, {
|
|
1695
1746
|
source: { type: "string" },
|
|
@@ -1931,6 +1982,130 @@ async function flowUpdate(args, deps) {
|
|
|
1931
1982
|
deps.io.out(lines.join("\n"));
|
|
1932
1983
|
return 0;
|
|
1933
1984
|
}
|
|
1985
|
+
function chatDiagnosticLines(diagnostics) {
|
|
1986
|
+
if (diagnostics.length === 0)
|
|
1987
|
+
return ["Findings: none."];
|
|
1988
|
+
return [
|
|
1989
|
+
`Findings (${diagnostics.length}):`,
|
|
1990
|
+
...diagnostics.map((d) => {
|
|
1991
|
+
const where = [d.nodeId && `node ${d.nodeId}`, d.edgeId && `line ${d.edgeId}`, d.detail].filter(Boolean).join(", ");
|
|
1992
|
+
return ` [${d.severity === "error" ? "error" : "warning"}] ${d.code}${where ? ` (${where})` : ""}`;
|
|
1993
|
+
}),
|
|
1994
|
+
];
|
|
1995
|
+
}
|
|
1996
|
+
const publishedText = (version) => (version === null ? "never published" : `v${version}`);
|
|
1997
|
+
async function chatAgentsList(args, deps) {
|
|
1998
|
+
const { values } = parse(args, {});
|
|
1999
|
+
const agents = await (await clientFor(values, deps)).listChatAgents();
|
|
2000
|
+
if (values.json) {
|
|
2001
|
+
printJson(deps, agents);
|
|
2002
|
+
return 0;
|
|
2003
|
+
}
|
|
2004
|
+
if (agents.length === 0) {
|
|
2005
|
+
deps.io.out("No chat agents.");
|
|
2006
|
+
return 0;
|
|
2007
|
+
}
|
|
2008
|
+
deps.io.out(agents
|
|
2009
|
+
.map((a) => `${a.id} ${a.name} ${publishedText(a.publishedVersion)}${a.unpublishedChanges ? " (draft has unpublished changes)" : ""}`)
|
|
2010
|
+
.join("\n"));
|
|
2011
|
+
return 0;
|
|
2012
|
+
}
|
|
2013
|
+
async function chatAgentsGet(args, deps) {
|
|
2014
|
+
const { values, positionals } = parse(args, {});
|
|
2015
|
+
const agent = await (await clientFor(values, deps)).getChatAgent(need(positionals, 0, "chatAgentId"));
|
|
2016
|
+
if (values.json) {
|
|
2017
|
+
printJson(deps, agent);
|
|
2018
|
+
return 0;
|
|
2019
|
+
}
|
|
2020
|
+
deps.io.out([
|
|
2021
|
+
`${agent.name} (${agent.id})`,
|
|
2022
|
+
`Draft revision: ${agent.revision}`,
|
|
2023
|
+
`Published: ${publishedText(agent.publishedVersion)}${agent.publishedAt ? ` at ${agent.publishedAt}` : ""}`,
|
|
2024
|
+
agent.unpublishedChanges ? "The draft has changes that are not published." : "The draft matches the published version.",
|
|
2025
|
+
].join("\n"));
|
|
2026
|
+
return 0;
|
|
2027
|
+
}
|
|
2028
|
+
async function chatAgentsDraftGet(args, deps) {
|
|
2029
|
+
const { values, positionals } = parse(args, {});
|
|
2030
|
+
const draft = await (await clientFor(values, deps)).getChatAgentDraft(need(positionals, 0, "chatAgentId"));
|
|
2031
|
+
if (values.json) {
|
|
2032
|
+
printJson(deps, draft);
|
|
2033
|
+
return 0;
|
|
2034
|
+
}
|
|
2035
|
+
const nodes = Array.isArray(draft.graph.nodes) ? draft.graph.nodes : [];
|
|
2036
|
+
const edges = Array.isArray(draft.graph.edges) ? draft.graph.edges.length : 0;
|
|
2037
|
+
deps.io.out([
|
|
2038
|
+
`${draft.name} (${draft.id})`,
|
|
2039
|
+
`Revision: ${draft.revision}`,
|
|
2040
|
+
`Nodes (${nodes.length}): ${nodes.map((n) => `${String(n.id)} [${String(n.type)}]`).join(", ") || "none"}`,
|
|
2041
|
+
`Lines: ${edges}`,
|
|
2042
|
+
"Use --json for the whole graph (what `draft update --graph-file` takes).",
|
|
2043
|
+
].join("\n"));
|
|
2044
|
+
return 0;
|
|
2045
|
+
}
|
|
2046
|
+
async function chatAgentsDraftUpdate(args, deps) {
|
|
2047
|
+
const { values, positionals } = parse(args, {
|
|
2048
|
+
revision: { type: "string" },
|
|
2049
|
+
"graph-file": { type: "string" },
|
|
2050
|
+
name: { type: "string" },
|
|
2051
|
+
"dry-run": { type: "boolean" },
|
|
2052
|
+
});
|
|
2053
|
+
const chatAgentId = need(positionals, 0, "chatAgentId");
|
|
2054
|
+
const graphFile = values["graph-file"];
|
|
2055
|
+
if (!graphFile) {
|
|
2056
|
+
throw new UsageError("Pass --graph-file <path> — the whole graph as JSON, as `kumion chat-agents draft get --json` prints it.");
|
|
2057
|
+
}
|
|
2058
|
+
const file = await readJsonFile(graphFile);
|
|
2059
|
+
if (!file || typeof file !== "object" || Array.isArray(file))
|
|
2060
|
+
throw new UsageError(`${graphFile} must hold a JSON object.`);
|
|
2061
|
+
const graph = "graph" in file && typeof file.graph === "object" ? file.graph : file;
|
|
2062
|
+
const revision = requireRevision(values.revision, "the revision `kumion chat-agents draft get` showed when you read the draft you are changing.");
|
|
2063
|
+
const result = await (await clientFor(values, deps)).updateChatAgentDraft(chatAgentId, { graph, ...(values.name === undefined ? {} : { name: values.name }) }, revision, { dryRun: values["dry-run"] === true });
|
|
2064
|
+
if (values.json) {
|
|
2065
|
+
printJson(deps, result);
|
|
2066
|
+
return 0;
|
|
2067
|
+
}
|
|
2068
|
+
deps.io.out([
|
|
2069
|
+
values["dry-run"] ? `Dry run — nothing was saved. Revision stays ${result.revision}.` : `Draft saved. New revision: ${result.revision}`,
|
|
2070
|
+
...chatDiagnosticLines(result.diagnostics),
|
|
2071
|
+
...(values["dry-run"] ? [] : [`Nothing is live until you run \`kumion chat-agents publish ${chatAgentId}\`.`]),
|
|
2072
|
+
].join("\n"));
|
|
2073
|
+
return 0;
|
|
2074
|
+
}
|
|
2075
|
+
async function chatAgentsDiagnostics(args, deps) {
|
|
2076
|
+
const { values, positionals } = parse(args, {});
|
|
2077
|
+
const result = await (await clientFor(values, deps)).getChatAgentDiagnostics(need(positionals, 0, "chatAgentId"));
|
|
2078
|
+
if (values.json) {
|
|
2079
|
+
printJson(deps, result);
|
|
2080
|
+
return 0;
|
|
2081
|
+
}
|
|
2082
|
+
deps.io.out([
|
|
2083
|
+
`Revision: ${result.revision}`,
|
|
2084
|
+
result.publishable ? "Publishable: yes" : "Publishable: no — an error-level finding is left.",
|
|
2085
|
+
...chatDiagnosticLines(result.diagnostics),
|
|
2086
|
+
].join("\n"));
|
|
2087
|
+
return 0;
|
|
2088
|
+
}
|
|
2089
|
+
async function chatAgentsPublish(args, deps) {
|
|
2090
|
+
const { values, positionals } = parse(args, { revision: { type: "string" } });
|
|
2091
|
+
const result = await (await clientFor(values, deps)).publishChatAgent(need(positionals, 0, "chatAgentId"), values.revision);
|
|
2092
|
+
if (values.json) {
|
|
2093
|
+
printJson(deps, result);
|
|
2094
|
+
return 0;
|
|
2095
|
+
}
|
|
2096
|
+
deps.io.out(`Published as v${result.version} at ${result.publishedAt}.`);
|
|
2097
|
+
return 0;
|
|
2098
|
+
}
|
|
2099
|
+
async function chatAgentsVersions(args, deps) {
|
|
2100
|
+
const { values, positionals } = parse(args, {});
|
|
2101
|
+
const versions = await (await clientFor(values, deps)).listChatAgentVersions(need(positionals, 0, "chatAgentId"));
|
|
2102
|
+
if (values.json) {
|
|
2103
|
+
printJson(deps, versions);
|
|
2104
|
+
return 0;
|
|
2105
|
+
}
|
|
2106
|
+
deps.io.out(versions.length === 0 ? "No published versions." : versions.map((v) => `v${v.version} ${v.publishedAt}`).join("\n"));
|
|
2107
|
+
return 0;
|
|
2108
|
+
}
|
|
1934
2109
|
function flowStepChangeLine(change) {
|
|
1935
2110
|
if (change.kind === "add_step")
|
|
1936
2111
|
return ` + ステップ ${change.node}(${change.key}・${change.stepType ?? "agent"})`;
|
package/dist/mcp.js
CHANGED
|
@@ -55,6 +55,11 @@ const flowLeaf = z
|
|
|
55
55
|
.optional()
|
|
56
56
|
.describe("Hand this 用件 to this registered staff member (a `key` from get_call_flow's staffChoices)."),
|
|
57
57
|
removeTransfer: z.boolean().optional().describe("Take the transfer off this 用件 (it goes back to a message)."),
|
|
58
|
+
transferBrowserFirst: z
|
|
59
|
+
.boolean()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe("For a 用件 that transfers to a staff member: ring the browser of the portal account bound to them first when it is on reception (default true)."),
|
|
62
|
+
transferBrowserFirstSeconds: z.number().int().min(10).max(30).optional().describe("How many seconds that browser rings before the phone is dialled (10-30, default 15)."),
|
|
58
63
|
requiredBeforeEnd: z.array(z.record(z.string(), z.unknown())).optional().describe("The whole list the 用件 must ask."),
|
|
59
64
|
steps: z.array(flowStep).optional(),
|
|
60
65
|
})
|
|
@@ -307,7 +312,8 @@ export function createKumionMcpServer(client, options) {
|
|
|
307
312
|
}, (args) => attempt(() => client.getWebcallAccess(args.agentId)));
|
|
308
313
|
server.registerTool("set_webcall_access", {
|
|
309
314
|
description: "Set the Webコール access limits. accessIpAllowlist: IPs or CIDRs (empty list = no limit); embedOriginAllowlist: " +
|
|
310
|
-
"origins like https://example.com or https://*.example.com.
|
|
315
|
+
"origins like https://example.com or https://*.example.com. requireSignedVisitor: true refuses a start without a visitorToken signed " +
|
|
316
|
+
"by the tenant's own server (default false; the /call share link cannot carry a token, so it stops working). appearance: the widget look (accent #RRGGBB, title <=40, " +
|
|
311
317
|
"greeting <=200, quickReplies <=4 x <=30, launcherLabel <=20, launcherPosition, entry); null clears an item. logo: " +
|
|
312
318
|
"{contentType, dataBase64} PNG/JPEG/WebP <=512KB, or null to remove. LIVE: applies at once, no publish, so confirm with the " +
|
|
313
319
|
"person first (a wrong IP list locks them out). Needs agents:live.",
|
|
@@ -315,6 +321,7 @@ export function createKumionMcpServer(client, options) {
|
|
|
315
321
|
agentId,
|
|
316
322
|
accessIpAllowlist: z.array(z.string()).optional().describe("Allowed IPs/CIDRs; [] clears."),
|
|
317
323
|
embedOriginAllowlist: z.array(z.string()).optional().describe("Allowed embedding origins; [] clears."),
|
|
324
|
+
requireSignedVisitor: z.boolean().optional().describe("true: only visitors with a signed visitorToken may start a call; false: anonymous starts allowed."),
|
|
318
325
|
appearance: z
|
|
319
326
|
.object({
|
|
320
327
|
accent: z.string().nullable().optional(),
|
|
@@ -340,12 +347,14 @@ export function createKumionMcpServer(client, options) {
|
|
|
340
347
|
patch.accessIpAllowlist = args.accessIpAllowlist;
|
|
341
348
|
if (args.embedOriginAllowlist)
|
|
342
349
|
patch.embedOriginAllowlist = args.embedOriginAllowlist;
|
|
350
|
+
if (args.requireSignedVisitor !== undefined)
|
|
351
|
+
patch.requireSignedVisitor = args.requireSignedVisitor;
|
|
343
352
|
if (args.appearance)
|
|
344
353
|
patch.appearance = args.appearance;
|
|
345
354
|
if (args.logo !== undefined)
|
|
346
355
|
patch.logo = args.logo;
|
|
347
356
|
if (Object.keys(patch).length === 0) {
|
|
348
|
-
return failure(new UsageError("Nothing to change: pass `accessIpAllowlist`, `embedOriginAllowlist`, `appearance` or `logo`."));
|
|
357
|
+
return failure(new UsageError("Nothing to change: pass `accessIpAllowlist`, `embedOriginAllowlist`, `requireSignedVisitor`, `appearance` or `logo`."));
|
|
349
358
|
}
|
|
350
359
|
return attempt(() => client.setWebcallAccess(args.agentId, patch));
|
|
351
360
|
});
|
|
@@ -1056,6 +1065,13 @@ export function createKumionMcpServer(client, options) {
|
|
|
1056
1065
|
},
|
|
1057
1066
|
annotations: { readOnlyHint: true },
|
|
1058
1067
|
}, (args) => attempt(() => client.getDocument(args.documentId)));
|
|
1068
|
+
server.registerTool("delete_document", {
|
|
1069
|
+
description: "Delete a 資料. Refused with the list of what uses it (`references`) while an agent or a flow step still " +
|
|
1070
|
+
"does; nothing is written then. An archived agent is not a user: deleting clears its link and the " +
|
|
1071
|
+
"answer names it in `archivedAgents`. Cannot be undone, so confirm with the person first. Needs agents:live.",
|
|
1072
|
+
inputSchema: { documentId: z.string().min(1).describe("The 資料 to delete, from get_document.") },
|
|
1073
|
+
annotations: { destructiveHint: true, idempotentHint: true },
|
|
1074
|
+
}, (args) => attempt(() => client.deleteDocument(args.documentId)));
|
|
1059
1075
|
server.registerTool("replace_document", {
|
|
1060
1076
|
description: "Replace a 資料's content and facts with another 資料's, keeping its id — so every agent already " +
|
|
1061
1077
|
"reading it switches over, with no re-creation and no publish (LIVE: the next call reads the new " +
|
|
@@ -1087,6 +1103,62 @@ export function createKumionMcpServer(client, options) {
|
|
|
1087
1103
|
},
|
|
1088
1104
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
1089
1105
|
}, (args) => attempt(() => client.replaceDocument(args.documentId, { sourceDocumentId: args.sourceDocumentId, sourceRevision: args.sourceRevision }, args.revision, { dryRun: args.dryRun === true })));
|
|
1106
|
+
const chatAgentId = z.string().min(1).describe("The chat agent's id, from list_chat_agents.");
|
|
1107
|
+
server.registerTool("list_chat_agents", {
|
|
1108
|
+
description: "List the tenant's チャットエージェント (text agents): id, name, published version and whether the draft has " +
|
|
1109
|
+
"changes that are not published. Needs agents:read and a plan that includes chat agents.",
|
|
1110
|
+
inputSchema: {},
|
|
1111
|
+
annotations: { readOnlyHint: true },
|
|
1112
|
+
}, () => attempt(() => client.listChatAgents()));
|
|
1113
|
+
server.registerTool("get_chat_agent", {
|
|
1114
|
+
description: "One チャットエージェント: name, draft revision, published version and whether the draft has unpublished " +
|
|
1115
|
+
"changes. The canvas itself is get_chat_agent_draft. Needs agents:read.",
|
|
1116
|
+
inputSchema: { chatAgentId },
|
|
1117
|
+
annotations: { readOnlyHint: true },
|
|
1118
|
+
}, (args) => attempt(() => client.getChatAgent(args.chatAgentId)));
|
|
1119
|
+
server.registerTool("get_chat_agent_draft", {
|
|
1120
|
+
description: "Read a チャットエージェント's draft canvas: `graph` (nodes, lines and settings, the shape " +
|
|
1121
|
+
"update_chat_agent_draft takes) and `revision`, which update_chat_agent_draft needs. Needs agents:read.",
|
|
1122
|
+
inputSchema: { chatAgentId },
|
|
1123
|
+
annotations: { readOnlyHint: true },
|
|
1124
|
+
}, (args) => attempt(() => client.getChatAgentDraft(args.chatAgentId)));
|
|
1125
|
+
server.registerTool("update_chat_agent_draft", {
|
|
1126
|
+
description: "Replace a チャットエージェント's draft with `graph` (the whole canvas, as get_chat_agent_draft returns it), " +
|
|
1127
|
+
"through the same structural check the canvas's save runs: a graph that fails it is a 400 and nothing is " +
|
|
1128
|
+
"written. Returns the new `revision` and the `diagnostics` the draft now has. A stale `revision` is a 412 " +
|
|
1129
|
+
"and nothing is written. `dryRun` runs every check and returns the diagnostics without saving, so you can " +
|
|
1130
|
+
"try a change first. A draft write: visitors see it only after publish_chat_agent. Needs agents:write.",
|
|
1131
|
+
inputSchema: {
|
|
1132
|
+
chatAgentId,
|
|
1133
|
+
revision: z.string().min(1).describe("The draft revision your change is based on, from get_chat_agent_draft."),
|
|
1134
|
+
graph: z.record(z.string(), z.unknown()).describe("The whole new graph."),
|
|
1135
|
+
name: z.string().optional().describe("A new name; left as it is when omitted."),
|
|
1136
|
+
dryRun: z.boolean().optional().describe("Run the checks and return the diagnostics; store nothing."),
|
|
1137
|
+
},
|
|
1138
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
1139
|
+
}, (args) => attempt(() => client.updateChatAgentDraft(args.chatAgentId, { graph: args.graph, ...(args.name === undefined ? {} : { name: args.name }) }, args.revision, { dryRun: args.dryRun === true })));
|
|
1140
|
+
server.registerTool("get_chat_agent_diagnostics", {
|
|
1141
|
+
description: "The findings on a チャットエージェント's draft: each has a `code`, a `severity` (error or warning) and the " +
|
|
1142
|
+
"node or line it is about. `publishable` is false while an error is left. Needs agents:read.",
|
|
1143
|
+
inputSchema: { chatAgentId },
|
|
1144
|
+
annotations: { readOnlyHint: true },
|
|
1145
|
+
}, (args) => attempt(() => client.getChatAgentDiagnostics(args.chatAgentId)));
|
|
1146
|
+
server.registerTool("publish_chat_agent", {
|
|
1147
|
+
description: "Publish a チャットエージェント's draft as its next version. Refused (422, with the diagnostics) while an " +
|
|
1148
|
+
"error-level finding is left, and nothing is stored. Pass `revision` to publish only if the draft is still " +
|
|
1149
|
+
"the one you read (412 otherwise). This puts the agent in front of its visitors, so confirm with the " +
|
|
1150
|
+
"person first. Needs agents:publish.",
|
|
1151
|
+
inputSchema: {
|
|
1152
|
+
chatAgentId,
|
|
1153
|
+
revision: z.string().min(1).optional().describe("The draft revision you mean to publish, from get_chat_agent_draft."),
|
|
1154
|
+
},
|
|
1155
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
1156
|
+
}, (args) => attempt(() => client.publishChatAgent(args.chatAgentId, args.revision)));
|
|
1157
|
+
server.registerTool("list_chat_agent_versions", {
|
|
1158
|
+
description: "The published versions of a チャットエージェント, newest first. Needs agents:read.",
|
|
1159
|
+
inputSchema: { chatAgentId },
|
|
1160
|
+
annotations: { readOnlyHint: true },
|
|
1161
|
+
}, (args) => attempt(() => client.listChatAgentVersions(args.chatAgentId)));
|
|
1090
1162
|
for (const op of DATA_OPS) {
|
|
1091
1163
|
server.registerTool(op.mcp, {
|
|
1092
1164
|
description: op.description,
|
package/package.json
CHANGED
package/skills/kumion/SKILL.md
CHANGED
|
@@ -13,8 +13,8 @@ Two ways in, same operations and same permissions:
|
|
|
13
13
|
|
|
14
14
|
- **MCP tools** when the host has the `kumion` MCP server registered. Each CLI
|
|
15
15
|
command has one: `list_agents`, `get_agent`, `get_agent_spec`, `patch_agent`,
|
|
16
|
-
`publish_agent`, `get_call_flow`, `update_call_flow`, `edit_call_flow_steps`,
|
|
17
|
-
`set_agent_opening_name`, `set_agent_availability`, `get_webcall_access`, `set_webcall_access`, `list_widget_signing_keys`, `create_widget_signing_key`, `revoke_widget_signing_key`, `create_agent_from_template`,
|
|
16
|
+
`publish_agent`, `list_chat_agents`, `get_chat_agent`, `get_chat_agent_draft`, `update_chat_agent_draft`, `get_chat_agent_diagnostics`, `publish_chat_agent`, `list_chat_agent_versions`, `get_call_flow`, `update_call_flow`, `edit_call_flow_steps`,
|
|
17
|
+
`set_agent_opening_name`, `set_agent_availability`, `get_webcall_access`, `set_webcall_access`, `list_widget_signing_keys`, `create_widget_signing_key`, `revoke_widget_signing_key`, `delete_document`, `create_agent_from_template`,
|
|
18
18
|
`list_agent_templates`, `list_facts`, `edit_fact`, `confirm_facts`,
|
|
19
19
|
`list_staff`, `create_staff`, `update_staff`, `get_store_hours`,
|
|
20
20
|
`update_store_hours`, `set_store_hours_exception`, `get_booking_settings`,
|
|
@@ -34,7 +34,7 @@ Two ways in, same operations and same permissions:
|
|
|
34
34
|
Run `kumion auth status`. If it says "Not logged in", **stop and ask the user** to run
|
|
35
35
|
`kumion auth login` themselves: it prints a link and a code, and the user approves
|
|
36
36
|
it in the Portal in their browser (a tenant administrator gets a personal key good for
|
|
37
|
-
12 hours). With a key from 設定 → 開発者 it is `kumion auth login --with-api-key`,
|
|
37
|
+
12 hours). With a key from 設定 → 開発者API it is `kumion auth login --with-api-key`,
|
|
38
38
|
which prompts for the tenant ID and the key with hidden input. Do not run the login
|
|
39
39
|
yourself and do not approve anything on the user's behalf. Never ask the user to paste
|
|
40
40
|
an API key into the chat, never put a key in a command line, a file, `.mcp.json` or an
|
|
@@ -148,6 +148,24 @@ number. `--json` everywhere; the names below are the CLI's, the MCP tool is in t
|
|
|
148
148
|
`publishState.live: true`, `unpublishedChanges: false`, and the publish answer's
|
|
149
149
|
`agent.publishedSnapshotId`. `unconfirmedFacts` above zero means the agent is not finished.
|
|
150
150
|
|
|
151
|
+
## Chat agents (チャットエージェント)
|
|
152
|
+
|
|
153
|
+
A chat agent is the text agent: its own ids (`list_chat_agents` / `kumion chat-agents list`, never `list_agents`), its
|
|
154
|
+
own draft canvas and its own versions. The tenant's plan has to include it; a 403 with no scope name on these tools
|
|
155
|
+
means it does not, and a new key does not help.
|
|
156
|
+
|
|
157
|
+
1. `get_chat_agent_draft` / `kumion chat-agents draft get <id> --json` — the `graph` (the canvas) and its `revision`.
|
|
158
|
+
2. Change the graph and try it first: `update_chat_agent_draft` with `dryRun: true` /
|
|
159
|
+
`kumion chat-agents draft update <id> --revision <rev> --graph-file <path> --dry-run`. It runs the canvas's own
|
|
160
|
+
structural check (a failing graph is a 400, nothing written) and returns the `diagnostics` the draft would have.
|
|
161
|
+
3. Save it without `dryRun`; the answer carries the new `revision`. A 412 means someone saved first: read the draft again
|
|
162
|
+
and re-apply your change, do not retry with the old revision.
|
|
163
|
+
4. `get_chat_agent_diagnostics` / `kumion chat-agents diagnostics <id>` — `publishable` is false while any finding has
|
|
164
|
+
`severity: "error"`. Fix those before publishing.
|
|
165
|
+
5. `publish_chat_agent` / `kumion chat-agents publish <id> --revision <rev>` puts it in front of visitors, so confirm
|
|
166
|
+
with the person first. A 422 carries the `diagnostics` that refused it. `list_chat_agent_versions` /
|
|
167
|
+
`kumion chat-agents versions <id>` shows the new version; `get_chat_agent` shows `unpublishedChanges`.
|
|
168
|
+
|
|
151
169
|
## Reading real calls
|
|
152
170
|
|
|
153
171
|
`list_calls` / `kumion calls list` pages through the call history (filter by agent,
|
|
@@ -272,7 +290,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
272
290
|
| `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
|
|
273
291
|
| `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,require_day?,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). `require_day`: for a `birthdate` item, tell the model the value needs a year, a month and a day (off = year and month). `tool`: `{tool_key,result_field}` for a tool-sourced item. |
|
|
274
292
|
| `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
|
|
275
|
-
| `route_judge` | start | `tune` | `boolean` | Absent means off
|
|
293
|
+
| `route_judge` | start | `tune` | `boolean` | Absent means on wherever the step can be judged, and off without any diagnostic where it cannot; `false` turns it off. 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 800 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. A step can be judged when the call is Japanese, the call model's endpoint has a calibrated readout, and the step has no items, exactly three AI connections without items and no fixed connections. An explicit `true` on a step that cannot be judged is reported (graph diagnostics `route_judge_not_applicable`). |
|
|
276
294
|
| `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). |
|
|
277
295
|
| `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`). |
|
|
278
296
|
| `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. |
|
|
@@ -293,7 +311,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
293
311
|
| `kb_fallback` | start, agent | `advanced` | `{ noResult?, unavailable? }` | Wording when a knowledge search finds nothing or is unavailable. Overrides the tenant operations setting. |
|
|
294
312
|
| `end_speech` | end | `required` | `string` | Default goodbye line. A connection into this node can override it. |
|
|
295
313
|
| `caller_leaves` | end | `required` | `boolean` | Marks the end a caller who walks away is sent to from every agent step, connected or not. Required on exactly one end when the flow has two or more end nodes. |
|
|
296
|
-
| `ivr` | ivr | `required` | `object` | Announcement, digit table and
|
|
314
|
+
| `ivr` | ivr | `required` | `object` | Announcement, digit table, wait time, and the optional speech exit. input and max_retries are fixed; other values are rejected. `voice_enabled: true` also lets a spoken answer leave the menu once it reaches `voice_min_chars` letters and digits (2–30, default 5); the edge it takes has the condition `ivr.<key>.status == "voice"`, and without that edge a spoken answer follows the no-input / failure edge. Omit both keys for the digit-only menu. |
|
|
297
315
|
| `transfer` | transfer | `required` | `object` | Transfer target and the line spoken before transferring. |
|
|
298
316
|
| `notify` | notify | `required` | `object` | Recipients, subject and body templates. |
|
|
299
317
|
| `http_method` | webhook | `required` | `string` | GET, POST, PUT, PATCH or DELETE. |
|
|
@@ -326,6 +344,13 @@ The `internal` keys that are settings, not bookkeeping, have no Portal screen:
|
|
|
326
344
|
with no finish key (`{ "mode": "single", "max_digits": 1, "finish_key": null }`)
|
|
327
345
|
and `max_retries` must be `0`; any other value makes the patch fail. Only
|
|
328
346
|
`ivr.timeout_ms` (3000–30000, default 8000) can change.
|
|
347
|
+
- `ivr.voice_enabled` and `ivr.voice_min_chars` (IVR nodes) — optional speech exit
|
|
348
|
+
(the Portal's 「声でも次へ進む」). Set `voice_enabled: true` to let a spoken answer leave
|
|
349
|
+
the menu; `voice_min_chars` (integer 2–30, default 5) is how many letters and digits
|
|
350
|
+
the utterance needs, so a back-channel does not end the menu. Draw the exit as an edge
|
|
351
|
+
with the condition `ivr.<key>.status == "voice"`; without it a spoken answer follows the
|
|
352
|
+
no-input / failure edge, and a voice edge on a node with the option off is flagged.
|
|
353
|
+
Leave both keys out for the digit-only menu.
|
|
329
354
|
|
|
330
355
|
A required item whose 種類 is 選択肢 (`derived` / `select`) needs its options in
|
|
331
356
|
the item's `options`: the AI picks one of them and the write is checked
|
|
@@ -353,7 +378,7 @@ These cover what the Portal's 顧客, 通話 and 分析 screens already do. Each
|
|
|
353
378
|
`kumion auth login`.
|
|
354
379
|
- **403 naming a scope** — the key lacks it (`agents:read`, `agents:write`,
|
|
355
380
|
`agents:publish`, `agents:live`, `tests:run`, `calls:create`, `calls:read`, `calls:read_unmasked`, `calls:write`, `contacts:read`, `contacts:write`, `captures:read`, `captures:write`, `analytics:read`). The user issues a key with that scope
|
|
356
|
-
in the Portal (設定 → 開発者) and logs in again. Do not work around it.
|
|
381
|
+
in the Portal (設定 → 開発者API) and logs in again. Do not work around it.
|
|
357
382
|
- **403 without a scope name** — the tenant's plan cannot publish, or `create_call` hit
|
|
358
383
|
the call-minute limit. Tell the user; a new key does not help.
|
|
359
384
|
- **422 on publish with only a message** — a check before the test calls refused,
|