@kumion/cli 0.6.1 → 0.6.3
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 +30 -3
- package/dist/cli.js +7 -0
- package/dist/client.js +4 -2
- package/dist/main.js +87 -10
- package/dist/mcp.js +16 -7
- package/package.json +1 -1
- package/skills/kumion/SKILL.md +11 -3
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ would use.
|
|
|
140
140
|
| `kumion documents jobs get <jobId>` | `agents:read` (exits 1 when the job failed or timed out) |
|
|
141
141
|
| `kumion documents get <documentId>` | `agents:read` |
|
|
142
142
|
| `kumion documents replace <documentId> --source <sourceDocumentId> --source-revision <rev> --revision <rev> [--dry-run]` | `agents:live` (live: no publish) |
|
|
143
|
-
| `kumion test-runs start <agentId> [--no-wait] [--interval <sec>] [--timeout <sec>]` | `tests:run` |
|
|
143
|
+
| `kumion test-runs start <agentId> [--turns <file\|->] [--no-wait] [--interval <sec>] [--timeout <sec>]` | `tests:run` |
|
|
144
144
|
| `kumion test-runs get <agentId> <runId>` | `tests:run` |
|
|
145
145
|
| `kumion test-runs list <agentId>` | `tests:run` |
|
|
146
146
|
| `kumion calls create <agentId> [--to <phone>] [--campaign-contact <id>] [--var <name>=<value> ...]` | `calls:create` |
|
|
@@ -167,7 +167,10 @@ them. `calls list` returns one page (20 by default, at most 100) and prints the
|
|
|
167
167
|
`--offset` of the next one. Every call in `calls list` and `calls get` carries what it came to: `outcome`
|
|
168
168
|
(`ai_resolved`, `ai_unresolved_hangup`, `invalid_call`, `handoff`, `system_ended`, or `na` when not judged),
|
|
169
169
|
`endedAtNode` (the node it ended on), `durationSec`, `transferred`, and `capturedItems` (the names of the
|
|
170
|
-
items it recorded, never their values).
|
|
170
|
+
items it recorded, never their values). `calls get` also returns `direction` (the raw value stored with
|
|
171
|
+
the call: `inbound`, `outbound`, `on_net`) and `portalDirection`, which is the 着信/発信 the Portal's call history
|
|
172
|
+
shows: `inbound`, `outbound`, or `null` when the call is neither (a trigger run, say). An `on_net` web call is
|
|
173
|
+
`inbound` there. Count 着信/発信 from `portalDirection`. A transcript's `turns` hold only what the caller and the agent said. A call handed to a person adds `handoffSegment` (`status` `transcribed` / `failed` / `not_sent`, `reason`, `fromSec` / `toSec`, and `turns` of `speaker`, `text`, `offsetSec`, in seconds into the call recording); `not_sent` means the tenant's contract forbids sending the recording out, so it has no text.
|
|
171
174
|
Add `--json` to any command for the API's JSON instead of a summary.
|
|
172
175
|
|
|
173
176
|
`hours` is the shop clock the call answers 「何時までですか」 from, and it is one calendar for the
|
|
@@ -361,7 +364,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
361
364
|
| `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. |
|
|
362
365
|
| `trigger_path` | trigger | `internal` | `string` | Generated. Shown read-only as the trigger URL. |
|
|
363
366
|
| `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
|
|
364
|
-
| `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool
|
|
367
|
+
| `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. |
|
|
365
368
|
| `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
|
|
366
369
|
| `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`). |
|
|
367
370
|
| `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`). |
|
|
@@ -435,6 +438,30 @@ each re-run's outcome. When a check before the test calls refuses (most often th
|
|
|
435
438
|
cases to print: the server's message after `Server said:` is the whole reason, one
|
|
436
439
|
problem per line.
|
|
437
440
|
|
|
441
|
+
### Replaying a caller's own lines
|
|
442
|
+
|
|
443
|
+
`test-runs start` builds the caller's side from the examples in the flow. To run the lines of a
|
|
444
|
+
real call that failed, hand them over instead:
|
|
445
|
+
|
|
446
|
+
```sh
|
|
447
|
+
kumion test-runs start <agentId> --turns lines.json # or: ... --turns - < lines.json
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
`lines.json` is `["予約したいです", "山田太郎です"]` or `[{ "caller": "予約したいです" }, ...]`
|
|
451
|
+
(MCP: `start_test_run` with `turns`; HTTP: `POST .../test-runs` with `{ "turns": [{ "caller": "..." }] }`).
|
|
452
|
+
The lines go to the draft one per turn, in order. Nothing is graded and no "please hang up" line is added:
|
|
453
|
+
the result is the conversation, the path the call took, the tool calls and a trace (`event`, `tool`,
|
|
454
|
+
`status`, a short `detail`). `stopReason` says why it stopped: `lines_done` (every line played, the
|
|
455
|
+
call still going), `agent_ended` (the agent ended the call first; the lines never sent are in
|
|
456
|
+
`unsentLines`) or `reply_timeout` (a line got no answer in time). The run ends `completed` and the
|
|
457
|
+
CLI exits 0 in all three; `could_not_run`, `timeout` and `cancelled` exit 1.
|
|
458
|
+
|
|
459
|
+
Limits: at most 30 lines, 500 characters per line and 6,000 characters in all (more is `400
|
|
460
|
+
replay_too_long`). One test run per agent at a time (`409`) and the same hourly limit per key as a
|
|
461
|
+
suite run (`429`). A replay needs the same `tests:run` scope, publishes nothing, makes no call in the
|
|
462
|
+
tenant's call history and counts against no call quota. The lines may hold what a real caller said:
|
|
463
|
+
they are kept in the run's results for as long as any test run is.
|
|
464
|
+
|
|
438
465
|
## From a template to public
|
|
439
466
|
|
|
440
467
|
One path from an empty tenant to a published agent, with nothing but the CLI (each command is also
|
package/dist/cli.js
CHANGED
|
@@ -50,6 +50,12 @@ async function prompt(question, options = {}) {
|
|
|
50
50
|
stdin.on("data", onData);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
async function readStdin() {
|
|
54
|
+
const chunks = [];
|
|
55
|
+
for await (const chunk of process.stdin)
|
|
56
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
57
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
58
|
+
}
|
|
53
59
|
const io = {
|
|
54
60
|
out: (text) => process.stdout.write(text.endsWith("\n") ? text : text + "\n"),
|
|
55
61
|
err: (text) => process.stderr.write(text.endsWith("\n") ? text : text + "\n"),
|
|
@@ -68,6 +74,7 @@ const code = await run(process.argv.slice(2), {
|
|
|
68
74
|
config: ConfigFile.forEnv(process.env),
|
|
69
75
|
io,
|
|
70
76
|
sleep: (ms) => sleep(ms),
|
|
77
|
+
readStdin,
|
|
71
78
|
mcpTransport: stdioTransport,
|
|
72
79
|
});
|
|
73
80
|
process.exitCode = code;
|
package/dist/client.js
CHANGED
|
@@ -243,8 +243,10 @@ export class KumionClient {
|
|
|
243
243
|
});
|
|
244
244
|
return body;
|
|
245
245
|
}
|
|
246
|
-
async startTestRun(agentId) {
|
|
247
|
-
const { body } = await this.request("POST", this.agentPath(agentId, "/test-runs"), "tests:run", {
|
|
246
|
+
async startTestRun(agentId, turns) {
|
|
247
|
+
const { body } = await this.request("POST", this.agentPath(agentId, "/test-runs"), "tests:run", {
|
|
248
|
+
body: turns ? { turns } : {},
|
|
249
|
+
});
|
|
248
250
|
return body.testRun;
|
|
249
251
|
}
|
|
250
252
|
async getTestRun(agentId, runId) {
|
package/dist/main.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ApiError, KumionClient, isTextFile, specText, } from "./client.js";
|
|
|
5
5
|
import { DEFAULT_BASE_URL, keyPrefix, looksLikeApiKey, normalizeBaseUrl, resolveCredentials, } from "./credentials.js";
|
|
6
6
|
import { DEFAULT_DEVICE_SCOPES, deviceLogin } from "./device-login.js";
|
|
7
7
|
import { describeError, ReportedFailure, UsageError } from "./errors.js";
|
|
8
|
-
export const VERSION = "0.6.
|
|
8
|
+
export const VERSION = "0.6.3";
|
|
9
9
|
const HELP = `kumion — manage your Kumion voice agents over the Partner API
|
|
10
10
|
|
|
11
11
|
Usage: kumion <command> [options]
|
|
@@ -184,8 +184,16 @@ Documents (資料 — the source an agent's facts are extracted from)
|
|
|
184
184
|
LIVE: the next call reads the new facts. Needs agents:live
|
|
185
185
|
|
|
186
186
|
Test runs
|
|
187
|
-
test-runs start <agentId> [--no-wait] [--interval <sec>] [--timeout <sec>]
|
|
188
|
-
Run the agent's regression tests against its draft
|
|
187
|
+
test-runs start <agentId> [--turns <file|->] [--no-wait] [--interval <sec>] [--timeout <sec>]
|
|
188
|
+
Run the agent's regression tests against its draft.
|
|
189
|
+
With --turns, play the caller's own lines instead of the
|
|
190
|
+
suite's: a JSON file (or - for stdin) holding ["line", ...]
|
|
191
|
+
or [{ "caller": "line" }, ...], at most 30 lines, 500
|
|
192
|
+
characters each and 6,000 in all. The lines go in order,
|
|
193
|
+
nothing is graded, and the result is the conversation, the
|
|
194
|
+
path, the tool calls and the trace. Exit 0 once the lines
|
|
195
|
+
were played or the call ended first. The lines may hold
|
|
196
|
+
what a real caller said; the run keeps them like any run
|
|
189
197
|
test-runs get <agentId> <runId> Show one run and its results
|
|
190
198
|
test-runs list <agentId> [--limit <n>]
|
|
191
199
|
|
|
@@ -1778,8 +1786,64 @@ async function flowEditSteps(args, deps) {
|
|
|
1778
1786
|
deps.io.out(lines.join("\n"));
|
|
1779
1787
|
return 0;
|
|
1780
1788
|
}
|
|
1781
|
-
const TERMINAL = new Set(["passed", "failed", "could_not_run", "timeout", "cancelled"]);
|
|
1789
|
+
const TERMINAL = new Set(["passed", "failed", "could_not_run", "timeout", "cancelled", "completed"]);
|
|
1790
|
+
export function replayTurnsFrom(raw) {
|
|
1791
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
1792
|
+
throw new UsageError('--turns needs a JSON array of lines: ["line", ...] or [{ "caller": "line" }, ...].');
|
|
1793
|
+
}
|
|
1794
|
+
return raw.map((item, index) => {
|
|
1795
|
+
const caller = typeof item === "string" ? item : item && typeof item === "object" ? item.caller : undefined;
|
|
1796
|
+
if (typeof caller !== "string" || caller.trim() === "") {
|
|
1797
|
+
throw new UsageError(`--turns: item ${index} must be a non-empty string or { "caller": "..." }.`);
|
|
1798
|
+
}
|
|
1799
|
+
return { caller };
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
async function readTurns(source, deps) {
|
|
1803
|
+
let text;
|
|
1804
|
+
if (source === "-") {
|
|
1805
|
+
if (!deps.readStdin)
|
|
1806
|
+
throw new UsageError("--turns - needs stdin, which this host does not provide.");
|
|
1807
|
+
text = await deps.readStdin();
|
|
1808
|
+
}
|
|
1809
|
+
else {
|
|
1810
|
+
text = await readTextFile(source);
|
|
1811
|
+
}
|
|
1812
|
+
try {
|
|
1813
|
+
return replayTurnsFrom(JSON.parse(text));
|
|
1814
|
+
}
|
|
1815
|
+
catch (err) {
|
|
1816
|
+
if (err instanceof UsageError)
|
|
1817
|
+
throw err;
|
|
1818
|
+
throw new UsageError(`--turns ${source === "-" ? "(stdin)" : source} is not valid JSON: ${err.message}`);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
const STOP_REASON_TEXT = {
|
|
1822
|
+
lines_done: "all lines were played and the call was still going",
|
|
1823
|
+
agent_ended: "the agent ended the call before the lines ran out",
|
|
1824
|
+
reply_timeout: "the agent did not answer a line in time",
|
|
1825
|
+
};
|
|
1826
|
+
export function summarizeReplay(run) {
|
|
1827
|
+
const lines = [`Replay ${run.id}: ${run.status.toUpperCase()}`];
|
|
1828
|
+
const result = (run.results ?? []).find((r) => r.caseId === "replay");
|
|
1829
|
+
if (!result)
|
|
1830
|
+
return lines.join("\n");
|
|
1831
|
+
lines.push(`Stopped: ${result.stopReason ? `${result.stopReason} (${STOP_REASON_TEXT[result.stopReason] ?? result.stopReason})` : "unknown"}`);
|
|
1832
|
+
for (const [i, turn] of (result.turns ?? []).entries()) {
|
|
1833
|
+
lines.push(`#${i + 1} caller: ${turn.user}`, `#${i + 1} agent : ${turn.assistant || "(no reply)"} [${turn.nodeKey}]`);
|
|
1834
|
+
}
|
|
1835
|
+
if (result.unsentLines?.length)
|
|
1836
|
+
lines.push(`Not sent (${result.unsentLines.length}): ${result.unsentLines.join(" / ")}`);
|
|
1837
|
+
if (result.observedPath?.length)
|
|
1838
|
+
lines.push(`Path: ${result.observedPath.join(" → ")}${result.reachedEnd ? " (call ended)" : ""}`);
|
|
1839
|
+
for (const row of result.trace ?? []) {
|
|
1840
|
+
lines.push(`trace #${row.turn} ${row.event} ${row.tool ?? ""} ${row.status ?? ""} ${JSON.stringify(row.detail)}`.replace(/ {2,}/g, " "));
|
|
1841
|
+
}
|
|
1842
|
+
return lines.join("\n");
|
|
1843
|
+
}
|
|
1782
1844
|
export function summarizeTestRun(run) {
|
|
1845
|
+
if (run.kind === "replay")
|
|
1846
|
+
return summarizeReplay(run);
|
|
1783
1847
|
const lines = [
|
|
1784
1848
|
`Test run ${run.id}: ${run.status.toUpperCase()} (${run.casesDone}/${run.casesTotal} cases)`,
|
|
1785
1849
|
];
|
|
@@ -1810,12 +1874,14 @@ async function testRunsStart(args, deps) {
|
|
|
1810
1874
|
"no-wait": { type: "boolean" },
|
|
1811
1875
|
interval: { type: "string" },
|
|
1812
1876
|
timeout: { type: "string" },
|
|
1877
|
+
turns: { type: "string" },
|
|
1813
1878
|
});
|
|
1814
1879
|
const agentId = need(positionals, 0, "agentId");
|
|
1815
1880
|
const intervalMs = positiveNumber(values.interval, "interval", 3) * 1000;
|
|
1816
1881
|
const timeoutMs = positiveNumber(values.timeout, "timeout", 900) * 1000;
|
|
1817
1882
|
const client = await clientFor(values, deps);
|
|
1818
|
-
|
|
1883
|
+
const turns = values.turns === undefined ? undefined : await readTurns(values.turns, deps);
|
|
1884
|
+
let run = await client.startTestRun(agentId, turns);
|
|
1819
1885
|
if (values["no-wait"]) {
|
|
1820
1886
|
if (values.json)
|
|
1821
1887
|
printJson(deps, { testRun: run });
|
|
@@ -1843,7 +1909,7 @@ async function testRunsStart(args, deps) {
|
|
|
1843
1909
|
printJson(deps, { testRun: run });
|
|
1844
1910
|
else
|
|
1845
1911
|
deps.io.out(summarizeTestRun(run));
|
|
1846
|
-
return run.status === "passed" ? 0 : 1;
|
|
1912
|
+
return run.status === "passed" || run.status === "completed" ? 0 : 1;
|
|
1847
1913
|
}
|
|
1848
1914
|
async function testRunsGet(args, deps) {
|
|
1849
1915
|
const { values, positionals } = parse(args, {});
|
|
@@ -2008,6 +2074,7 @@ async function callsGet(args, deps) {
|
|
|
2008
2074
|
`Call ${call.id}`,
|
|
2009
2075
|
`Agent: ${call.agentName ?? "-"}${call.agentId ? ` (${call.agentId})` : ""}`,
|
|
2010
2076
|
`Source: ${call.source}${call.direction ? ` (${call.direction})` : ""}`,
|
|
2077
|
+
`Direction: ${call.portalDirection ?? "-"}`,
|
|
2011
2078
|
`Caller: ${call.remoteE164 ?? "-"}${call.localE164 ? ` → ${call.localE164}` : ""}`,
|
|
2012
2079
|
`Started: ${call.startedAt}`,
|
|
2013
2080
|
`Answered: ${call.answeredAt ?? "-"}`,
|
|
@@ -2026,11 +2093,21 @@ export function formatTranscript(transcript) {
|
|
|
2026
2093
|
if (!transcript.available) {
|
|
2027
2094
|
return "No transcript yet — it is written when the call ends, and a call that never connected has none.";
|
|
2028
2095
|
}
|
|
2029
|
-
|
|
2096
|
+
const segment = transcript.handoffSegment;
|
|
2097
|
+
if (transcript.turns.length === 0 && !segment)
|
|
2030
2098
|
return "The transcript is empty: nobody said anything.";
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
.
|
|
2099
|
+
const lines = transcript.turns.map((t) => `${t.at ? `[${t.at}] ` : ""}${t.role === "user" ? "Caller" : "Agent "}: ${t.text}`);
|
|
2100
|
+
if (segment) {
|
|
2101
|
+
lines.push("--- After the handover to a person ---");
|
|
2102
|
+
if (segment.status === "not_sent")
|
|
2103
|
+
lines.push("Not transcribed: the tenant's contract forbids sending the recording out.");
|
|
2104
|
+
else if (segment.status === "failed")
|
|
2105
|
+
lines.push(`Transcription failed${segment.reason ? ` (${segment.reason})` : ""}.`);
|
|
2106
|
+
for (const t of segment.turns) {
|
|
2107
|
+
lines.push(`${t.offsetSec !== null ? `[+${t.offsetSec}s] ` : ""}${t.speaker !== null ? `Person (speaker ${t.speaker})` : "Person"}: ${t.text}`);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
return lines.join("\n");
|
|
2034
2111
|
}
|
|
2035
2112
|
async function callsTranscript(args, deps) {
|
|
2036
2113
|
const { values, positionals } = parse(args, {});
|
package/dist/mcp.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { ApiError, isTextFile, specText } from "./client.js";
|
|
6
6
|
import { describeError, UsageError } from "./errors.js";
|
|
7
7
|
export const MAX_TEST_RUN_WAIT_SECONDS = 120;
|
|
8
|
-
const TERMINAL = new Set(["passed", "failed", "could_not_run", "timeout", "cancelled"]);
|
|
8
|
+
const TERMINAL = new Set(["passed", "failed", "could_not_run", "timeout", "cancelled", "completed"]);
|
|
9
9
|
function json(value) {
|
|
10
10
|
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
11
11
|
}
|
|
@@ -196,8 +196,8 @@ export function createKumionMcpServer(client, options) {
|
|
|
196
196
|
"assistant does. `ops` is a batch, run in order, at most 20: each element is `{ op, …that operation's " +
|
|
197
197
|
"arguments }`, with `op` one of set_node_field (nodeKey, field, value), set_edge_words (fromKey, toKey, " +
|
|
198
198
|
"condition?, transitionSpeech?), add_step (type `agent`|`transfer`, name, between?, next_condition?, prompt?, " +
|
|
199
|
-
"items?, staff?, before_speech?, key?), remove_step (node), connect_steps (from, to, condition, speech
|
|
200
|
-
"
|
|
199
|
+
"items?, staff?, before_speech?, key?), remove_step (node), connect_steps (from, to, condition, speech?), " +
|
|
200
|
+
"reconnect (from, to, new_to, via_tool?), disconnect (from, to, via_tool?). The batch is atomic: " +
|
|
201
201
|
"one refused operation refuses all of them, and nothing is stored. `add_step.key` (optional, lowercase " +
|
|
202
202
|
"letters/digits/_) names the new step so a later operation of the same batch can point at it; without one the " +
|
|
203
203
|
"server picks the key and returns it in `added`. A 用件 flow (`editLayer` = `flow`) is refused: use " +
|
|
@@ -322,7 +322,8 @@ export function createKumionMcpServer(client, options) {
|
|
|
322
322
|
server.registerTool("start_test_run", {
|
|
323
323
|
description: "Run the agent's regression tests against its draft (publishes nothing). Returns at once with the run " +
|
|
324
324
|
`unless waitSeconds is set (at most ${MAX_TEST_RUN_WAIT_SECONDS}); follow a running run with ` +
|
|
325
|
-
"get_test_run.
|
|
325
|
+
"get_test_run. With turns, plays those caller lines in order instead of the suite's (nothing is graded; " +
|
|
326
|
+
"the result is the conversation, path, tool calls and trace). Needs tests:run.",
|
|
326
327
|
inputSchema: {
|
|
327
328
|
agentId,
|
|
328
329
|
waitSeconds: z
|
|
@@ -332,9 +333,14 @@ export function createKumionMcpServer(client, options) {
|
|
|
332
333
|
.max(MAX_TEST_RUN_WAIT_SECONDS)
|
|
333
334
|
.optional()
|
|
334
335
|
.describe("Wait up to this many seconds for the run to finish before returning."),
|
|
336
|
+
turns: z
|
|
337
|
+
.array(z.object({ caller: z.string().min(1) }))
|
|
338
|
+
.optional()
|
|
339
|
+
.describe("The caller's own lines, played in order instead of the suite: [{ caller }]. At most 30 lines, 500 characters each, 6000 in all. " +
|
|
340
|
+
"The lines may hold what a real caller said; the run keeps them like any test run."),
|
|
335
341
|
},
|
|
336
342
|
}, (args) => attempt(async () => {
|
|
337
|
-
let run = await client.startTestRun(args.agentId);
|
|
343
|
+
let run = await client.startTestRun(args.agentId, args.turns);
|
|
338
344
|
const deadline = (args.waitSeconds ?? 0) * 1000;
|
|
339
345
|
let waited = 0;
|
|
340
346
|
while (!TERMINAL.has(run.status) && waited < deadline) {
|
|
@@ -414,7 +420,7 @@ export function createKumionMcpServer(client, options) {
|
|
|
414
420
|
annotations: { readOnlyHint: true },
|
|
415
421
|
}, (args) => attempt(() => client.listCalls(args)));
|
|
416
422
|
server.registerTool("get_call", {
|
|
417
|
-
description: "Read one call: agent, source and
|
|
423
|
+
description: "Read one call: agent, source, `direction` (the raw column) and `portalDirection` (inbound / outbound as the Portal 通話履歴 counts it; null when neither), numbers, when it started, was answered and ended, how it " +
|
|
418
424
|
"ended, its result (`outcome`, `endedAtNode`, `durationSec`, `transferred`, `capturedItems`), and whether " +
|
|
419
425
|
"a transcript exists (read it with get_call_transcript). The channel is only on list_calls. Needs calls:read.",
|
|
420
426
|
inputSchema: { callId },
|
|
@@ -423,7 +429,10 @@ export function createKumionMcpServer(client, options) {
|
|
|
423
429
|
server.registerTool("get_call_transcript", {
|
|
424
430
|
description: "Read what the caller (`user`) and the agent (`assistant`) said on one call, in order. Tool calls and " +
|
|
425
431
|
"the agent's instructions are not included. `available: false` means no transcript has been written " +
|
|
426
|
-
"yet (the call is still up, or never connected) — not that the call was silent.
|
|
432
|
+
"yet (the call is still up, or never connected) — not that the call was silent. A call handed to a " +
|
|
433
|
+
"person also carries `handoffSegment`: what the person said after the pickup (`status` transcribed / " +
|
|
434
|
+
"failed / not_sent; not_sent means the tenant's contract forbids sending the recording out, so there is " +
|
|
435
|
+
"no text). Needs calls:read.",
|
|
427
436
|
inputSchema: { callId },
|
|
428
437
|
annotations: { readOnlyHint: true },
|
|
429
438
|
}, (args) => attempt(async () => ({ transcript: await client.getTranscript(args.callId) })));
|
package/package.json
CHANGED
package/skills/kumion/SKILL.md
CHANGED
|
@@ -83,7 +83,11 @@ A partner with several customers has one profile per customer tenant
|
|
|
83
83
|
(only when the user gave the name and number), then use the key it returns.
|
|
84
84
|
4. **Test** — `start_test_run` (then `get_test_run` until it leaves `running`) /
|
|
85
85
|
`kumion test-runs start <agentId>` (waits; exit 0 only on pass). Fix failures in
|
|
86
|
-
the draft and test again.
|
|
86
|
+
the draft and test again. To re-run the words of a real call that went wrong, pass
|
|
87
|
+
them with `turns` / `--turns <file|->` (at most 30 lines, 500 characters each,
|
|
88
|
+
6,000 in all): they are played in order, nothing is graded, and the run ends
|
|
89
|
+
`completed` with the conversation, path, tool calls and trace. The lines may hold
|
|
90
|
+
what a real caller said; do not paste them anywhere else.
|
|
87
91
|
5. **Publish** — only when the user asked for it. `publish_agent` /
|
|
88
92
|
`kumion agents publish <agentId>`. It runs the same pre-publish check as the Portal
|
|
89
93
|
and can take a few minutes. If the check fails, nothing goes live and the failing
|
|
@@ -152,7 +156,11 @@ channel, time range, or caller number). Each call already carries its result (`o
|
|
|
152
156
|
transcript only for the call you need. `get_call_transcript` /
|
|
153
157
|
`kumion calls transcript <callId>` returns what the caller (`user`) and the agent
|
|
154
158
|
(`assistant`) said. `available: false` means no transcript has been written yet, not a
|
|
155
|
-
silent call.
|
|
159
|
+
silent call. A call handed to a person also has `handoffSegment`: what the person said after
|
|
160
|
+
the pickup (`status` is `transcribed`, `failed` or `not_sent`; `not_sent` means the tenant's
|
|
161
|
+
contract forbids sending the recording out, so there is no text). `turns` stays the AI part. `get_call` carries `direction` (the raw stored value) and `portalDirection` (`inbound` /
|
|
162
|
+
`outbound` / null: the 着信/発信 the Portal call history shows); count from `portalDirection`.
|
|
163
|
+
Use a transcript to find where the agent went wrong before editing its
|
|
156
164
|
draft. Transcripts are the tenant's customers' conversations: quote only what the task
|
|
157
165
|
needs.
|
|
158
166
|
|
|
@@ -262,7 +270,7 @@ A key a node does not store follows the agent's setting (会話の運用) or the
|
|
|
262
270
|
| `wait_cover` | start, agent | `tune` | `{ enabled?, on_threshold?, threshold_ms?, on_query_start?, query_grace_ms? }` | Node-level hold phrase. By default it plays only when a lookup tool is still running after `query_grace_ms` (100 to 10000, default 1000); `on_query_start: false` turns that off. `on_threshold: true` also plays it after `threshold_ms` (2000 to 15000, default 2000) of silence on an ordinary turn (default off). `enabled: false` turns it off for this node. The phrase text is set per agent. |
|
|
263
271
|
| `trigger_path` | trigger | `internal` | `string` | Generated. Shown read-only as the trigger URL. |
|
|
264
272
|
| `opening_speech` | start | `required` | `string` | The opening line. Supports {{variables}}. |
|
|
265
|
-
| `items` | start, agent | `required` | `{key,label?,example?,source?,value_type?,options?,must_ask?,min_digits?,max_digits?,tool
|
|
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. |
|
|
266
274
|
| `allow_interruptions` | start, agent | `tune` | `boolean` | Absent means the caller may interrupt. Only an explicit false is stored. |
|
|
267
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`). |
|
|
268
276
|
| `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`). |
|