@vincemakes/kiso-runtime 0.15.3 → 0.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/store.js +36 -4
- package/package.json +5 -5
package/dist/store.js
CHANGED
|
@@ -62,6 +62,41 @@ export class StaleWriterError extends Error {
|
|
|
62
62
|
}
|
|
63
63
|
/** Session ids become file names — keep them host-safe. */
|
|
64
64
|
const ID_PATTERN = /^[A-Za-z0-9._-]+$/;
|
|
65
|
+
/** REL-0152-D6 — a session is named by its first REQUEST, not its first
|
|
66
|
+
* word.
|
|
67
|
+
*
|
|
68
|
+
* This used to take `records[0]` unconditionally, so a session was
|
|
69
|
+
* titled by whatever the user opened with. Three of the owner's five
|
|
70
|
+
* sessions opened with a greeting, and the picker showed three
|
|
71
|
+
* identical rows separated only by a timestamp they had to decode.
|
|
72
|
+
* RD1B-F9 made ids unique; unique is not meaningful.
|
|
73
|
+
*
|
|
74
|
+
* A greeting is skipped only when something follows it — a session that
|
|
75
|
+
* is genuinely nothing but "hello" is still titled "hello", because the
|
|
76
|
+
* alternative is naming it "(no prompt)" when a prompt plainly exists.
|
|
77
|
+
* No model call: this is a scan of the turns already on disk. */
|
|
78
|
+
/** A greeting is recognised by SHAPE, not by a word list: it is a
|
|
79
|
+
* handful of characters with nothing asked in them. Counting code
|
|
80
|
+
* points (never UTF-16 units) makes the rule the same in every
|
|
81
|
+
* language — a two-character greeting is two characters whatever
|
|
82
|
+
* script it is written in — and it keeps a word list out of a tree
|
|
83
|
+
* that is required to be English. The ASCII pattern catches the few
|
|
84
|
+
* openers long enough to pass the length test but still empty of a
|
|
85
|
+
* request. */
|
|
86
|
+
const MIN_TITLE_CHARS = 4;
|
|
87
|
+
const ASCII_OPENER = /^\s*(hi|hey|hello|yo|hiya|howdy|ping|test|ok|okay|thanks|thx)[\s!.,?~]*$/i;
|
|
88
|
+
const isOpener = (t) => [...t].length < MIN_TITLE_CHARS || ASCII_OPENER.test(t);
|
|
89
|
+
function titleOf(records) {
|
|
90
|
+
const asked = records
|
|
91
|
+
.map((r) => r.event)
|
|
92
|
+
.filter((e) => e.type === "user_input" && typeof e.content === "string")
|
|
93
|
+
.map((e) => e.content.trim())
|
|
94
|
+
.filter((t) => t !== "");
|
|
95
|
+
if (asked.length === 0)
|
|
96
|
+
return "(no prompt)";
|
|
97
|
+
const substantive = asked.find((t) => !isOpener(t));
|
|
98
|
+
return (substantive ?? asked[0]).slice(0, 60);
|
|
99
|
+
}
|
|
65
100
|
export class SessionStore {
|
|
66
101
|
root;
|
|
67
102
|
#fds = new Map();
|
|
@@ -293,12 +328,9 @@ export class SessionStore {
|
|
|
293
328
|
const records = this.load(id);
|
|
294
329
|
if (records.length === 0)
|
|
295
330
|
continue;
|
|
296
|
-
const first = records[0].event;
|
|
297
331
|
metas.push({
|
|
298
332
|
id,
|
|
299
|
-
title:
|
|
300
|
-
? first.content.slice(0, 60)
|
|
301
|
-
: "(no prompt)",
|
|
333
|
+
title: titleOf(records),
|
|
302
334
|
events: records.length,
|
|
303
335
|
runs: new Set(records.map((r) => r.runId)).size,
|
|
304
336
|
createdAt: records[0]?.ts ?? 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-runtime",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"description": "kiso runtime \u2014 durable multi-turn agent sessions: AgentDefinition, AgentRuntime, AgentSession, Run, append-only JSONL store.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@vincemakes/kiso-core": "0.15.
|
|
28
|
+
"@vincemakes/kiso-core": "0.15.4"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@vincemakes/kiso-provider-anthropic": "0.15.
|
|
32
|
-
"@vincemakes/kiso-provider-openai": "0.15.
|
|
31
|
+
"@vincemakes/kiso-provider-anthropic": "0.15.4",
|
|
32
|
+
"@vincemakes/kiso-provider-openai": "0.15.4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"@vincemakes/kiso-provider-anthropic": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@vincemakes/kiso-evals": "0.15.
|
|
43
|
+
"@vincemakes/kiso-evals": "0.15.4",
|
|
44
44
|
"@types/node": "^26.1.2",
|
|
45
45
|
"typescript": "^5.7.2",
|
|
46
46
|
"vitest": "^3.0.0"
|