@vincemakes/kiso-core 0.1.1 → 0.1.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/dist/kernel/project.js
CHANGED
|
@@ -71,16 +71,23 @@ export function projectMessages(events) {
|
|
|
71
71
|
text = null;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
+
// 自举 P1: the reasoning of the turn being built, accumulated from its
|
|
75
|
+
// `thinking` events and attached to the assistant message at flush —
|
|
76
|
+
// deterministic (same events → same messages → same request body, D 区).
|
|
77
|
+
let pendingReasoning = null;
|
|
74
78
|
const flushAssistant = () => {
|
|
75
79
|
pushText();
|
|
76
80
|
if (blocks.length === 0) {
|
|
77
81
|
assistantSource = undefined;
|
|
78
82
|
return;
|
|
79
83
|
}
|
|
84
|
+
const reasoning = pendingReasoning;
|
|
85
|
+
pendingReasoning = null;
|
|
80
86
|
out.push({
|
|
81
87
|
role: "assistant",
|
|
82
88
|
blocks: [...blocks],
|
|
83
89
|
...(assistantSource !== undefined ? { source: assistantSource } : {}),
|
|
90
|
+
...(reasoning !== null ? { reasoning } : {}),
|
|
84
91
|
});
|
|
85
92
|
blocks = [];
|
|
86
93
|
assistantSource = undefined;
|
|
@@ -256,6 +263,12 @@ export function projectMessages(events) {
|
|
|
256
263
|
break;
|
|
257
264
|
}
|
|
258
265
|
case "thinking":
|
|
266
|
+
// 自举 P1: accumulate the turn's reasoning — the flush (an
|
|
267
|
+
// empty one at the turn's start) keeps the pending text, and
|
|
268
|
+
// the assistant message that follows carries it.
|
|
269
|
+
flushAssistant();
|
|
270
|
+
pendingReasoning = (pendingReasoning ?? "") + ev.text;
|
|
271
|
+
break;
|
|
259
272
|
case "usage":
|
|
260
273
|
case "stop":
|
|
261
274
|
case "terminal":
|
|
@@ -297,6 +310,11 @@ export function messagesToEvents(messages) {
|
|
|
297
310
|
case "assistant": {
|
|
298
311
|
// D 组: an explicit assistant_start/assistant_end pair frames
|
|
299
312
|
// the message — adjacent and empty assistants round-trip.
|
|
313
|
+
// 自举 P1: the reasoning re-enters the log as its ORIGINAL
|
|
314
|
+
// thinking event — the projection re-attaches it identically.
|
|
315
|
+
if (msg.reasoning !== undefined) {
|
|
316
|
+
out.push({ type: "thinking", text: msg.reasoning });
|
|
317
|
+
}
|
|
300
318
|
out.push({
|
|
301
319
|
type: "assistant_start",
|
|
302
320
|
...(msg.source !== undefined ? { source: msg.source } : {}),
|
|
@@ -71,6 +71,12 @@ export interface AssistantMessage {
|
|
|
71
71
|
readonly role: "assistant";
|
|
72
72
|
readonly blocks: readonly AssistantBlock[];
|
|
73
73
|
readonly source?: MessageSource;
|
|
74
|
+
/**
|
|
75
|
+
* 自举 P1: the turn's reasoning, derived deterministically from its
|
|
76
|
+
* `thinking` events (DeepSeek's thinking mode requires it back on
|
|
77
|
+
* follow-up requests). Present only when the turn actually reasoned.
|
|
78
|
+
*/
|
|
79
|
+
readonly reasoning?: string;
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Sent back to the model after a tool ran.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "kiso(\u57fa\u790e) core \u2014 protocol, event log, loop, hooks, modes, permissions, compaction, delivery truth. The 2,000-line kernel at the bottom of the kiso framework.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"openai"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@vincemakes/kiso-evals": "0.1.
|
|
36
|
+
"@vincemakes/kiso-evals": "0.1.3",
|
|
37
37
|
"@types/node": "^26.1.2",
|
|
38
38
|
"typescript": "^5.7.2",
|
|
39
39
|
"vitest": "^3.0.0"
|