@dexto/core 1.16.3 → 1.16.5

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.
@@ -0,0 +1,64 @@
1
+ import "../chunk-C6A6W6XS.js";
2
+ const MODEL_HISTORY_COUNT_CASES = [
3
+ { name: "empty", history: "" },
4
+ { name: "one message", history: "u" },
5
+ { name: "plain", history: "u a u a u a" },
6
+ { name: "plain with pruned rows", history: "u a t t u a t u a" },
7
+ { name: "legacy summary", history: "u a u a S u a" },
8
+ { name: "summary with preserved messages", history: "u a u a u a S:2 u a" },
9
+ { name: "summary preserving everything", history: "u a u a S:0 u" },
10
+ { name: "summary preserving nothing", history: "u a u a S:4 u" },
11
+ { name: "original count past the summary", history: "u a u a S:99 u" },
12
+ { name: "negative original count", history: "u a u a S:-3 u" },
13
+ { name: "summary with messages after it", history: "u a u a S:1 u a u a" },
14
+ { name: "summary as the last message", history: "u a u a u S:3" },
15
+ { name: "two summaries", history: "u a S:1 u a u a S:3 u" },
16
+ { name: "two summaries with pruned rows", history: "u a t t S:1 u t a S:4 t u" },
17
+ { name: "session summary with preserved messages", history: "u a u a u SS:2 u a" },
18
+ { name: "session summary with a clamped count", history: "u a u a SS:50 u" }
19
+ ];
20
+ function buildModelHistoryCountMessages(history) {
21
+ return history.split(" ").filter((token) => token !== "").map((token, index) => {
22
+ const id = `message-${index}`;
23
+ const timestamp = index + 1;
24
+ if (token === "u") {
25
+ return { id, role: "user", content: [{ type: "text", text: token }], timestamp };
26
+ }
27
+ if (token === "a") {
28
+ return {
29
+ id,
30
+ role: "assistant",
31
+ assistantOutput: { status: "complete" },
32
+ content: [{ type: "text", text: token }],
33
+ timestamp
34
+ };
35
+ }
36
+ if (token === "t") {
37
+ return {
38
+ id,
39
+ role: "tool",
40
+ name: "read",
41
+ toolCallId: `call-${index}`,
42
+ content: [{ type: "text", text: "old result" }],
43
+ compactedAt: 1,
44
+ timestamp
45
+ };
46
+ }
47
+ const [kind, count] = token.split(":");
48
+ return {
49
+ id,
50
+ role: "assistant",
51
+ assistantOutput: { status: "complete" },
52
+ content: [{ type: "text", text: "summary" }],
53
+ metadata: {
54
+ ...kind === "SS" ? { isSessionSummary: true } : { isSummary: true },
55
+ ...count === void 0 ? {} : { originalMessageCount: Number(count) }
56
+ },
57
+ timestamp
58
+ };
59
+ });
60
+ }
61
+ export {
62
+ MODEL_HISTORY_COUNT_CASES,
63
+ buildModelHistoryCountMessages
64
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/core",
3
- "version": "1.16.3",
3
+ "version": "1.16.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -174,7 +174,7 @@
174
174
  "nanoid": "^5.1.16",
175
175
  "winston": "^3.17.0",
176
176
  "yaml": "^2.8.3",
177
- "@dexto/llm": "1.16.3"
177
+ "@dexto/llm": "1.16.5"
178
178
  },
179
179
  "devDependencies": {
180
180
  "@opentelemetry/context-async-hooks": "^2.12.0",