@vincemakes/kiso-core 0.1.34 → 1.0.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/kernel/project.js +34 -3
- package/package.json +2 -2
package/dist/kernel/project.js
CHANGED
|
@@ -150,13 +150,25 @@ export function projectMessages(events) {
|
|
|
150
150
|
// (voidFromSeq, its seq] — the abandoned draft's events. The ranges are
|
|
151
151
|
// disjoint and in seq order; the skip below treats them exactly like the
|
|
152
152
|
// summary ranges (the marker itself renders nothing and skips itself).
|
|
153
|
+
// R-E 0.1.44 (the void scope sentence): the void range voids MODEL
|
|
154
|
+
// OUTPUT only — text_delta / thinking / tool_call_* — never the
|
|
155
|
+
// framework's facts (permission*, tool_execution, tool_result,
|
|
156
|
+
// user_input, terminal). The summary ranges keep their blanket reach
|
|
157
|
+
// (the summary replaces everything it covers).
|
|
158
|
+
const MODEL_OUTPUT_TYPES = new Set([
|
|
159
|
+
"text_delta",
|
|
160
|
+
"thinking",
|
|
161
|
+
"tool_call_start",
|
|
162
|
+
"tool_call_input_delta",
|
|
163
|
+
"tool_call_end",
|
|
164
|
+
]);
|
|
153
165
|
const voidRanges = [];
|
|
154
166
|
for (const ev of events) {
|
|
155
167
|
if (ev.type === "model_output_abandoned")
|
|
156
168
|
voidRanges.push({ from: ev.voidFromSeq, to: ev.seq ?? -1 });
|
|
157
169
|
}
|
|
158
|
-
const
|
|
159
|
-
|
|
170
|
+
const coveredBySummary = (seq) => summaryRanges.some((r) => seq > r.from && seq <= r.to);
|
|
171
|
+
const coveredByVoid = (seq) => voidRanges.some((r) => seq > r.from && seq <= r.to);
|
|
160
172
|
// Summaries render in range order as the pass crosses their boundaries.
|
|
161
173
|
let renderedSummaries = 0;
|
|
162
174
|
// 0.1.26 (ADR-0024 Amd, parallel execution): the tool results of ONE turn
|
|
@@ -170,6 +182,11 @@ export function projectMessages(events) {
|
|
|
170
182
|
let resultBuf = [];
|
|
171
183
|
const callOrder = new Map();
|
|
172
184
|
let callOrderNext = 0;
|
|
185
|
+
// R-E 0.1.44 (sentence 1): the declarations that PROJECTED (their
|
|
186
|
+
// tool_use blocks were actually pushed) — the pair-atomicity signal a
|
|
187
|
+
// tool_result consults. A declaration the void skipped is not here, so
|
|
188
|
+
// its (possibly post-marker) receipt drops — both or neither.
|
|
189
|
+
const projectedDeclarations = new Set();
|
|
173
190
|
// P1 (0.1.42): the mid-execution input deferral. A user input arriving
|
|
174
191
|
// while the last closed assistant's tool_calls are UNANSWERED (the
|
|
175
192
|
// result lands later in the log — the boundary straddle's durable
|
|
@@ -204,7 +221,11 @@ export function projectMessages(events) {
|
|
|
204
221
|
// never covered. The summarized events themselves are exempt (their
|
|
205
222
|
// own event sits inside the NEXT range's coverage; the boundary
|
|
206
223
|
// render below is where their message lands).
|
|
207
|
-
|
|
224
|
+
const evSeq = ev.seq ?? -1;
|
|
225
|
+
// R-E 0.1.44 (sentence 2): the VOID skip is type-filtered — model
|
|
226
|
+
// output dies with the draft, the framework's facts never do (a
|
|
227
|
+
// straddling tool_result inside the void range keeps its pair).
|
|
228
|
+
if (ev.type !== "summarized" && (coveredBySummary(evSeq) || (MODEL_OUTPUT_TYPES.has(ev.type) && coveredByVoid(evSeq))))
|
|
208
229
|
continue;
|
|
209
230
|
// The boundary render: every range whose end this event crosses
|
|
210
231
|
// yields its assistant summary message, before this event renders.
|
|
@@ -331,6 +352,7 @@ export function projectMessages(events) {
|
|
|
331
352
|
if (blocks.length === 0 && text === null && resultBuf.length > 0)
|
|
332
353
|
flushResults();
|
|
333
354
|
pushText();
|
|
355
|
+
projectedDeclarations.add(ev.callId);
|
|
334
356
|
callOrder.set(ev.callId, callOrderNext++);
|
|
335
357
|
blocks.push({
|
|
336
358
|
type: "tool_use",
|
|
@@ -340,6 +362,15 @@ export function projectMessages(events) {
|
|
|
340
362
|
});
|
|
341
363
|
break;
|
|
342
364
|
case "tool_result": {
|
|
365
|
+
// R-E 0.1.44 (sentence 1): PAIR ATOMICITY — a result whose
|
|
366
|
+
// declaration never projected is dropped (both or neither).
|
|
367
|
+
// The straddling receipt (declaration committed before the
|
|
368
|
+
// stop, result landing inside the void) still projects — its
|
|
369
|
+
// declaration is in the set; the voided draft's post-marker
|
|
370
|
+
// receipt (0143) is the orphan — dropped here, kept in the
|
|
371
|
+
// audit (persist facts, derive state).
|
|
372
|
+
if (!projectedDeclarations.has(ev.callId))
|
|
373
|
+
break;
|
|
343
374
|
// 0.1.26: NO flushAssistant — the streaming execution lands
|
|
344
375
|
// results BETWEEN the turn's tool_call_ends; closing the
|
|
345
376
|
// assistant here splits the turn's tool_calls message (the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "kiso (foundation) core — 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.
|
|
36
|
+
"@vincemakes/kiso-evals": "1.0.0",
|
|
37
37
|
"@types/node": "^26.1.2",
|
|
38
38
|
"typescript": "^5.7.2",
|
|
39
39
|
"vitest": "^3.0.0"
|