@kuralle-agents/cli 0.15.0 → 0.16.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/dist/cli.js +7 -0
- package/dist/resume.d.ts +2 -0
- package/dist/resume.js +35 -0
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* kuralle chat [--trace] [--store <file>] [--session <id>] [--auto "msg1|msg2"] [--agent <path.ts>]
|
|
6
6
|
* kuralle send --session <id> [--store <file>] [--state|--reset] "<message>"
|
|
7
|
+
* kuralle resume <session> [--store <file>] [--summary <text>]
|
|
7
8
|
* kuralle sim --goal "<goal>" [--turns N] [--profile "<who>"] [--agent <path.ts>]
|
|
8
9
|
* kuralle trace <session> [--last] [--json] [--web] [--port N]
|
|
9
10
|
*/
|
|
10
11
|
import { resolveBuildRuntime } from './agentLoader.js';
|
|
11
12
|
import { runChat } from './chat.js';
|
|
13
|
+
import { runResume } from './resume.js';
|
|
12
14
|
import { runSend } from './send.js';
|
|
13
15
|
import { runSim } from './sim.js';
|
|
14
16
|
import { runTrace } from './trace.js';
|
|
@@ -17,6 +19,7 @@ const HELP = `kuralle — Kuralle agent CLI
|
|
|
17
19
|
Usage:
|
|
18
20
|
kuralle chat [--trace] [--store <file>] [--session <id>] [--auto "msg1|msg2"] [--agent <path.ts>]
|
|
19
21
|
kuralle send --session <id> [--store <file>] [--state|--reset] "<message>"
|
|
22
|
+
kuralle resume <session> [--store <file>] [--summary <text>]
|
|
20
23
|
kuralle sim --goal "<goal>" [--turns N] [--profile "<who>"] [--agent <path.ts>]
|
|
21
24
|
kuralle trace <session> [--last] [--json] [--web] [--port N]
|
|
22
25
|
|
|
@@ -27,6 +30,7 @@ Options:
|
|
|
27
30
|
--trace Live trace side panel — the built-in AgentTrace of each turn (chat only)
|
|
28
31
|
--store <file> Persist the session + traces to JSON files so chat survives across launches (chat only)
|
|
29
32
|
--session <id> Session id to resume with --store (default: "default")
|
|
33
|
+
--summary <text> Resolution note appended on resume (seen by the agent post-resume)
|
|
30
34
|
`;
|
|
31
35
|
function flag(argv, name) {
|
|
32
36
|
const i = argv.indexOf(name);
|
|
@@ -65,6 +69,9 @@ async function main() {
|
|
|
65
69
|
case 'send':
|
|
66
70
|
await runSend(subArgv, buildRuntime);
|
|
67
71
|
break;
|
|
72
|
+
case 'resume':
|
|
73
|
+
await runResume(subArgv, buildRuntime);
|
|
74
|
+
break;
|
|
68
75
|
case 'sim':
|
|
69
76
|
await runSim(subArgv, buildRuntime);
|
|
70
77
|
break;
|
package/dist/resume.d.ts
ADDED
package/dist/resume.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* resume — hand a held-over session back to the bot after a human resolved an escalation.
|
|
3
|
+
*
|
|
4
|
+
* Usage: kuralle resume <session> [--store <path>] [--summary <text>]
|
|
5
|
+
*
|
|
6
|
+
* A terminal-handoff escalation parks the run (`status = 'paused'`, no `waitingFor`); every
|
|
7
|
+
* later turn is held with "a colleague is handling this" until this command runs.
|
|
8
|
+
* `runtime.resumeFromEscalation` appends the resolution note, clears the parked flow /
|
|
9
|
+
* escalation state, and marks the run runnable — the next `run()` continues with context.
|
|
10
|
+
*/
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { fileSessionStore } from './fileStore.js';
|
|
13
|
+
import { fileTraceStore } from './fileTraceStore.js';
|
|
14
|
+
function flag(argv, name) {
|
|
15
|
+
const i = argv.indexOf(name);
|
|
16
|
+
return i >= 0 ? argv[i + 1] : undefined;
|
|
17
|
+
}
|
|
18
|
+
export async function runResume(argv, buildRuntime) {
|
|
19
|
+
const storePath = flag(argv, '--store') ?? join(process.cwd(), 'runs/tui-sessions.json');
|
|
20
|
+
const summary = flag(argv, '--summary');
|
|
21
|
+
// Every flag whose VALUE must not be mistaken for the session id positional. Missing one
|
|
22
|
+
// here would let the value survive the filter and become the session id (see send.ts).
|
|
23
|
+
const consumesValue = new Set(['--store', '--summary']);
|
|
24
|
+
const positional = argv.filter((a, i) => !a.startsWith('--') && !(i > 0 && consumesValue.has(argv[i - 1])));
|
|
25
|
+
const sessionId = positional[0];
|
|
26
|
+
if (!sessionId) {
|
|
27
|
+
console.error('usage: kuralle resume <session> [--store <path>] [--summary <text>]');
|
|
28
|
+
process.exit(2);
|
|
29
|
+
}
|
|
30
|
+
const store = fileSessionStore(storePath);
|
|
31
|
+
const traces = fileTraceStore(storePath.replace(/\.json$/, '') + '.traces.json');
|
|
32
|
+
const demo = buildRuntime(sessionId, store, traces);
|
|
33
|
+
await demo.runtime.resumeFromEscalation(sessionId, summary !== undefined ? { resolutionSummary: summary } : undefined);
|
|
34
|
+
console.log(`resumed session "${sessionId}"${summary ? ` (${summary})` : ''}`);
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "git+https://github.com/kuralle/kuralle-agents.git",
|
|
7
7
|
"directory": "packages/cli"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.16.0",
|
|
10
10
|
"description": "Kuralle CLI — interactive TUI chat, adaptive send, and conversation simulation",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"bin": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"ink-text-input": "^6.0.0",
|
|
21
21
|
"react": "^19.2.7",
|
|
22
22
|
"zod": "^4.0.0",
|
|
23
|
-
"@kuralle-agents/trace-ui": "0.14.
|
|
24
|
-
"@kuralle-agents/core": "0.
|
|
23
|
+
"@kuralle-agents/trace-ui": "0.14.2",
|
|
24
|
+
"@kuralle-agents/core": "0.16.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@kuralle-agents/core": "0.x",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/node": "^20.11.0",
|
|
33
33
|
"@types/react": "^19.2.17",
|
|
34
34
|
"typescript": "^5.3.0",
|
|
35
|
-
"@kuralle-agents/fs": "0.14.
|
|
35
|
+
"@kuralle-agents/fs": "0.14.2"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|