@kumion/cli 0.3.0 → 0.5.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumion/cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Manage your Kumion voice agents from the terminal over the Kumion Partner API",
5
5
  "author": "KAOPA株式会社",
6
6
  "license": "MIT",
@@ -35,13 +35,14 @@
35
35
  "typecheck": "tsc --noEmit",
36
36
  "test": "vitest run",
37
37
  "docs:node-config": "../../node_modules/.bin/tsx scripts/node-config-reference.ts",
38
+ "docs:parity": "../../node_modules/.bin/tsx scripts/docs-parity.ts",
38
39
  "prepack": "npm run build"
39
40
  },
40
41
  "dependencies": {
41
42
  "@modelcontextprotocol/sdk": "^1.32.1",
42
43
  "@napi-rs/keyring": "^2.1.0",
43
44
  "undici": "^7.29.1",
44
- "zod": "^3.25.76"
45
+ "zod": "^4.6.7"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@types/node": "^22.10.2",
@@ -12,11 +12,19 @@ repository to clone and no local agent file to keep in sync — do not create on
12
12
  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
- command has one: `list_agents`, `get_agent`, `get_call_flow`, `update_call_flow`,
16
- `edit_call_flow_steps`, `patch_agent`, `publish_agent`, `start_test_run`,
17
- `get_test_run`, `list_staff`, `create_staff`, `update_staff`, `create_call`,
18
- `list_calls`, `get_call`, `get_call_transcript`, and the rest in
19
- `kumion --help`.
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`, `create_agent_from_template`,
18
+ `list_agent_templates`, `list_facts`, `edit_fact`, `confirm_facts`,
19
+ `list_staff`, `create_staff`, `update_staff`, `get_store_hours`,
20
+ `update_store_hours`, `set_store_hours_exception`, `get_booking_settings`,
21
+ `update_booking_calendar`, `create_booking_service`, `update_booking_service`,
22
+ `create_booking_resource`, `update_booking_resource`, `set_agent_booking`,
23
+ `list_booking_slots`, `list_capture_specs`, `create_capture_spec`,
24
+ `update_capture_spec`, `get_agent_capture`, `set_agent_capture`,
25
+ `upload_document`, `get_document_upload_job`, `get_document`,
26
+ `replace_document`, `start_test_run`, `get_test_run`, `list_test_runs`,
27
+ `create_call`, `list_calls`, `get_call`, `get_call_transcript`.
20
28
  - **The `kumion` CLI** otherwise (`kumion --help`). Add `--json` for machine-readable
21
29
  output.
22
30
 
@@ -59,7 +67,11 @@ A partner with several customers has one profile per customer tenant
59
67
  - Both accept `dryRun` / `--dry-run`: try it first and read the changes back.
60
68
  - `patch_agent` / `kumion agents patch` replaces the prompt or the whole graph. Use
61
69
  it only for a prompt-only agent or a change the two above cannot express, and
62
- send the whole edited graph, not a fragment.
70
+ send the whole edited graph, not a fragment. External send settings (webhook,
71
+ pre-call fetch, notification, transfer target, opening recording, IVR menu
72
+ recording) must be sent
73
+ back unchanged: a write that adds or changes one is refused with
74
+ `external_field_closed` (`paths` says which). Those are edited in the Portal.
63
75
 
64
76
  The draft is not live.
65
77
  - **Conflict (409)**: someone saved the agent since you read it. Nothing was
@@ -81,6 +93,50 @@ A partner with several customers has one profile per customer tenant
81
93
  places a real outbound call instead (a domestic number; the agent must be published
82
94
  and have a phone number assigned) — only when the user asked to dial a real person.
83
95
  The outcome is on `get_call` / `kumion calls get`.
96
+ To dial at a stated time instead, `create_scheduled_call` / `kumion scheduled-calls create <agentId> --to <phone> --at <iso8601-with-offset>`
97
+ (the offset is required, the time must be in the future, one dial with no redial; 403 when the tenant's
98
+ automatic outbound dialing is off or the plan is free, 409 when the number already has a pending dial).
99
+ `list_scheduled_calls` shows the state; `cancel_scheduled_call` works only before the dial starts.
100
+
101
+ ## From a template to a published agent
102
+
103
+ When the tenant has only a template, this is the path. Every write takes the `revision` the read
104
+ before it printed; a 409 means something moved in between — read again, never retry with the old
105
+ number. `--json` everywhere; the names below are the CLI's, the MCP tool is in the list above or in
106
+ `kumion --help`.
107
+
108
+ 1. **Create** — `kumion agents create-from-template --template <id> --business-name <name>
109
+ --idempotency-key <key> --json`. Keep `agent.id` (`A`), `workflow.id` and `document.id` (`D`);
110
+ the draft's `revision` comes later, from `get_agent` / `get_call_flow`. Nothing is published, and
111
+ a resend with the same key answers the same agent.
112
+ 2. **Upload the real 資料** — `kumion documents upload --text-file <path> --title <title>
113
+ --idempotency-key <key> [--template <id>] --json` (or repeated `--file` for pdf/docx/xlsx, up to
114
+ 10 files / 20 MiB). `--dry-run` writes nothing, spends no allowance and calls no model. Ten
115
+ extractions per key per hour and the tenant's own cap; one upload in flight per key.
116
+ 3. **Wait** — `kumion documents jobs get <jobId>` until `succeeded`; `failed` and `timed_out` exit
117
+ non-zero and nothing is retried for you (a new attempt needs a new idempotency key). Then
118
+ `kumion documents get <S>` for the fields and `revision`.
119
+ 4. **Replace** — `kumion documents replace <D> --source <S> --source-revision <rev> --revision <rev>
120
+ --json`. `D` keeps its id, so the agent keeps pointing at it. Every fact is pending again, an item
121
+ the new 資料 does not mention stays empty, and no model is called.
122
+ 5. **Confirm the facts** — `kumion facts list <A> --json`, then `facts edit` / `facts confirm`. An
123
+ unconfirmed fact is not an answer the agent may read out; publish counts them as `unconfirmedFacts`.
124
+ 6. **Shop hours** — `kumion hours get --json`, then `kumion hours update` with the revision it
125
+ printed (see 「The shop clock」 below).
126
+ 7. **Booking** — `kumion booking get <A> --json`, then create a 内容 and a 担当, then
127
+ `kumion booking mount <A> --mounted true --revision <rev>`. Read back `mounted: true` and
128
+ `bookableResourceCount > 0` — a template's agent starts neither mounted nor with a 担当.
129
+ `kumion booking slots <A> --resource <id> --date <YYYY-MM-DD>` shows the openings a call would
130
+ offer and reserves nothing.
131
+ 8. **記録項目** — `kumion agents capture get <A> --json` shows what this agent records; expect
132
+ `readiness.ready: true`. `kumion capture-specs list|create|update` and `kumion agents capture set`
133
+ (the whole set; `--clear` = nothing) change it.
134
+ 9. **Flow** — `kumion flow get <A> --json`, then `flow update` (or `flow edit-steps` when `editLayer`
135
+ is `"steps"`). A new 資料 does not recompile the flow. Before publishing there must be no
136
+ `severity: "error"` entry in `findings.canvas` and `findings.structural` must be empty.
137
+ 10. **Publish** — `kumion agents publish <A> --revision <rev> --json`, then `kumion agents get <A>`:
138
+ `publishState.live: true`, `unpublishedChanges: false`, and the publish answer's
139
+ `agent.publishedSnapshotId`. `unconfirmedFacts` above zero means the agent is not finished.
84
140
 
85
141
  ## Reading real calls
86
142
 
@@ -94,7 +150,82 @@ silent call. Use a transcript to find where the agent went wrong before editing
94
150
  draft. Transcripts are the tenant's customers' conversations: quote only what the task
95
151
  needs.
96
152
 
97
- Not available over the Partner API (do not look for a command): conversation-edit mode, the knowledge base, bookings, external-tool limits, the agent
153
+ ## The 応対仕様書 (the agent's settings as one document)
154
+
155
+ `get_agent_spec` / `kumion agents spec <agentId>` writes the 応対仕様書: the Japanese
156
+ document that states how this agent answers — the opening, the flow of a call, transfers,
157
+ booking, the facts it may read out, what it records, who it notifies, and the AI
158
+ instructions verbatim. It is built from the stored settings; no model writes or rewords
159
+ any of it. It is what a customer files, or hands to someone reviewing what the agent says.
160
+ Needs `agents:read`.
161
+
162
+ - **`version`** — `published` (the default; the version answering calls today), `draft`,
163
+ or a version number such as `3`. An agent with no canvas has no versions at all, and
164
+ `published` answers its 現在の設定; an agent that was never published answers with its
165
+ draft, labelled 未公開.
166
+ - **`format`** — `pdf` (the default), `docx`, or `markdown`. Markdown is text and comes
167
+ back as the answer itself (MCP tool content, CLI stdout). PDF and Word are binary: MCP
168
+ writes them to `outputPath`, which those two require, and the CLI writes them to `--out`
169
+ — or, with no `--out`, to the server's own filename in the current directory.
170
+ - **Two kinds of chapter.** 〔この版〕 chapters were frozen when the chosen version was
171
+ published. 〔出力時点〕 chapters read settings no version froze — 店舗, 予約, 記録項目,
172
+ 資料, 転送先, 通知 — and state them as they stand at export. Exporting an older version
173
+ therefore mixes that version's content with today's settings on purpose; say so when
174
+ handing one over. A draft carries 「下書き」 on every page.
175
+ - **Exporting changes nothing.** It is a read: 公開中 stays the version it was, and the
176
+ next call answers from it. The export date on the cover is the moment of the export.
177
+
178
+ Do not retype or summarise the document into the conversation: save it and give the user
179
+ the path (or hand it to them where the host can attach files).
180
+
181
+ ## The shop clock (営業時間)
182
+
183
+ When the call answers 「何時までですか」, it reads the tenant's one booking calendar.
184
+ `get_store_hours` / `kumion hours get` shows 営業時間, 定休日, 祝日休み and the 例外日 in a
185
+ window, and the `revision` the two writes need. Reading never creates the calendar.
186
+
187
+ - `update_store_hours` / `kumion hours update` — `businessHours` and `closedRules`
188
+ are **whole replacements**: send the entire week you want (a `businessHours` holding
189
+ Mon–Fri makes Sat and Sun closed), and omit a field to leave it alone. It is live on
190
+ the next call, with no publish.
191
+ - `set_store_hours_exception` / `kumion hours exception set <date>` — one date. `closed`
192
+ is 臨時休業, `open` is 振替出勤 (its own `hours`, or the weekday's when omitted), and
193
+ `inherit` deletes the date's row so the weekly rule applies again. `inherit` takes
194
+ neither `hours` nor `note`.
195
+ - Both carry `revision` from the read. Anything that changes the same calendar in the
196
+ meantime — the Portal's 予約設定, a 担当 or 内容, a mount — moves it, and a stale write
197
+ is refused with a conflict and nothing saved. Read again and re-apply.
198
+ - `dryRun` / `--dry-run` answers with what would be saved and moves nothing.
199
+
200
+ ## 予約設定 (what can be booked, and by whom)
201
+
202
+ The same calendar, from the booking side. `get_booking_settings` / `kumion booking get <agentId>`
203
+ answers the slot length, the lead time, the horizon, the **内容** (what can be booked and how
204
+ long it takes), the **担当**, whether that agent is mounted, and how many 担当 can actually be
205
+ booked. It is per agent because the mount is; the settings themselves are the tenant's. The
206
+ `revision` is the one `get_store_hours` shows — one calendar, one counter.
207
+
208
+ - `update_booking_calendar` / `kumion booking calendar update` — `defaultSlotMinutes` (1–1440),
209
+ `minLeadMinutes` (0–43200) and/or `maxAdvanceDays` (1–730). Omit a field to leave it alone.
210
+ Send JSON **numbers**: `"30"` is refused, not read as 30.
211
+ - `create_booking_service` / `kumion booking services create` — `name`, and `durationMinutes`
212
+ (1–1440). `null` (or omitted) means 「枠の長さを使う」, which is what the read-back shows.
213
+ - `update_booking_service` / `kumion booking services update <serviceId>` — a name and/or a
214
+ duration; `null` goes back to the slot length. A service id that is not this tenant's is a 404.
215
+ - `create_booking_resource` / `update_booking_resource` / `kumion booking resources create|update` —
216
+ a 担当: `name`, `enabled`, `weeklyHours` and `serviceIds` (`[]` = every 内容, omitted = unchanged).
217
+ `enabled: false` takes them out of service without deleting the row.
218
+ - `set_agent_booking` / `kumion booking mount <agentId> --mounted true|false` — whether this agent
219
+ books at all, and with it the retirement of the 受付サマリー's 「仮受付」 promise. Unmounting does not
220
+ bring the old summary back.
221
+ - `list_booking_slots` / `kumion booking slots <agentId> --resource <id> --date <date>` — one 担当's
222
+ openings on one day, computed the way a call computes them (6 by default, at most 20). It reserves
223
+ nothing and returns no other customer's data.
224
+ - All of them are live (the next call uses them, no publish), and **create carries the revision
225
+ too**: two callers holding one revision cannot both add a 内容 — the second is refused. `dryRun`
226
+ allocates nothing.
227
+
228
+ Not available over the Partner API (do not look for a command): conversation-edit mode, the knowledge base, the booking RECORDS themselves (making, moving or cancelling a customer's booking, and the notifications that go with it), external-tool limits, the agent
98
229
  language setting, a tool's display name (表示名), the agent's call-outcome categories
99
230
  (通話の結果), and the call model with its TTS voice. Those are Portal-only. A patch
100
231
  writes only `prompt` and `graph`; `agents get` shows the model and voice read-only.
@@ -125,10 +256,11 @@ A key a node does not store follows the agent's setting (会話の運用) or the
125
256
  | `wait_cover` | start, agent | `tune` | `{ enabled?, on_threshold?, threshold_ms?, on_query_start?, query_grace_ms? }` | Node-level hold phrase. By default it plays only when a lookup tool is still running after `query_grace_ms` (100 to 10000, default 1000); `on_query_start: false` turns that off. `on_threshold: true` also plays it after `threshold_ms` (2000 to 15000, default 2000) of silence on an ordinary turn (default off). `enabled: false` turns it off for this node. The phrase text is set per agent. |
126
257
  | `trigger_path` | trigger | `internal` | `string` | Generated. Shown read-only as the trigger URL. |
127
258
  | `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
128
- | `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,tool?,option_writes?}[]` | What this step collects, one object per item, in the order it asks. `key`: slot key. `label`: display name. `example`: test-call example. `source`: where the value comes from (caller, derived, system, tool). `value_type`: kind (text, select, boolean, ...). `options`: choices of a select item. `must_ask`: ask the caller to confirm on the spot even if already known (advanced). `tool`: `{tool_key,result_field}` for a tool-sourced item. `option_writes`: option → tool that must succeed before that option lets the call leave (advanced). |
259
+ | `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool?,option_writes?}[]` | What this step collects, one object per item, in the order it asks. `key`: slot key. `label`: display name. `example`: test-call example. `source`: where the value comes from (caller, derived, system, tool). `value_type`: kind (text, select, boolean, ...). `options`: choices of a select item. `must_ask`: ask the caller to confirm on the spot even if already known (advanced). `min_digits` / `max_digits`: for a `code` item, the fewest / most digits the value may hold, counted by the platform (the same number twice = exact length). `tool`: `{tool_key,result_field}` for a tool-sourced item. `option_writes`: option → tool that must succeed before that option lets the call leave (advanced). |
129
260
  | `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
130
261
  | `respond_on_enter` | agent | `tune` | `boolean` | Absent means the node answers on arrival. Only an explicit false (wait for the caller) is stored. |
131
262
  | `confirm_before_end` | agent | `tune` | `boolean` | Absent means off (agents published before this setting keep their behaviour); a node created on the canvas stores true, and a node compiled from a SOP or document stores true when its connection to an end node requires items (the `end_without_readback` rule). On: the platform reads the recorded items back once before the call ends, and the end opens on a later caller turn with caller_confirmed. |
263
+ | `confirm_before_end_keys` | agent | `internal` | `string[]` | Set by the compiler on a 伝言 step. With `confirm_before_end` on, the end readback reads only these item keys (the call-back number); absent means every item the ending requires. |
132
264
  | `entry_lookup` | agent | `tune` | `string` | Absent means no lookup on entry. A tool key from this step's tools (`booking_list`): the platform calls it when the call arrives at this step, and the call and its result are in the step's context before the AI speaks. |
133
265
  | `quiet_wait` | start, agent | `tune` | `{ seconds, listen?, resume_speech? }` | Node-level wait. { seconds: 0 } turns the agent default off here. |
134
266
  | `optional_slots` | start, agent | `tune` | `string[]` | Slots declared elsewhere that this step may record when the caller volunteers them. |