@arcforge/kernel 2.0.178 → 2.0.180
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/package.json +8 -8
- package/src/engine.ts +72 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/kernel",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.180",
|
|
4
4
|
"description": "The Axon kernel — ring 0. Owns resources and execution, enforces policy, and is the only constructor of the unprivileged capsule.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"deploy": "echo \"This package is published ONLY by apps/tui/scripts/release.ts, which pins workspace:* deps to concrete versions first. Publishing it directly ships an unresolvable dependency.\" && exit 1"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@arcforge/air": "2.0.
|
|
19
|
-
"@arcforge/engines": "2.0.
|
|
20
|
-
"@arcforge/err": "2.0.
|
|
21
|
-
"@arcforge/session": "2.0.
|
|
22
|
-
"@arcforge/types": "2.0.
|
|
23
|
-
"@arcforge/cloud": "2.0.
|
|
24
|
-
"@arcforge/capsule": "2.0.
|
|
18
|
+
"@arcforge/air": "2.0.180",
|
|
19
|
+
"@arcforge/engines": "2.0.180",
|
|
20
|
+
"@arcforge/err": "2.0.180",
|
|
21
|
+
"@arcforge/session": "2.0.180",
|
|
22
|
+
"@arcforge/types": "2.0.180",
|
|
23
|
+
"@arcforge/cloud": "2.0.180",
|
|
24
|
+
"@arcforge/capsule": "2.0.180"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/bun": "latest",
|
package/src/engine.ts
CHANGED
|
@@ -900,32 +900,76 @@ export function Engine(opts: EngineOpts) {
|
|
|
900
900
|
break
|
|
901
901
|
|
|
902
902
|
case "text:delta":
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
903
|
+
/**
|
|
904
|
+
* A whitespace-only delta is CARRIED, never dropped.
|
|
905
|
+
*
|
|
906
|
+
* The guard here was `pending?.trim()`, which discarded
|
|
907
|
+
* the pending chunk outright when it held nothing but
|
|
908
|
+
* whitespace — and the next line overwrote `pending`,
|
|
909
|
+
* so those characters were gone. A provider that split
|
|
910
|
+
* a stream as `"…projectRoot:string"`, `"\n"`,
|
|
911
|
+
* `" cron:string"` therefore committed
|
|
912
|
+
* `projectRoot:string cron:string`: the newline
|
|
913
|
+
* deleted, the indentation of everything after it
|
|
914
|
+
* wrong, and a fenced block progressively less
|
|
915
|
+
* readable the longer the reply ran.
|
|
916
|
+
*
|
|
917
|
+
* That is not cosmetic. Markdown is whitespace-
|
|
918
|
+
* significant — a lost newline merges a list item into
|
|
919
|
+
* the prose above it and collapses a code fence's
|
|
920
|
+
* indentation — and the damage compounds, because every
|
|
921
|
+
* later line inherits the drift. It renders as "the
|
|
922
|
+
* model produced malformed output" when the engine's
|
|
923
|
+
* own recorded text is perfectly formed.
|
|
924
|
+
*
|
|
925
|
+
* What the old guard was RIGHT about: an
|
|
926
|
+
* `engine:text` carrying only whitespace paints a
|
|
927
|
+
* bullet with nothing beside it. So the test moves from
|
|
928
|
+
* "is this chunk worth keeping" to "is this chunk worth
|
|
929
|
+
* EMITTING YET" — whitespace accumulates into the next
|
|
930
|
+
* chunk instead of being thrown away, and reaches the
|
|
931
|
+
* UI attached to the text it belongs to.
|
|
932
|
+
*/
|
|
933
|
+
if (pending !== null && pending.trim()) {
|
|
914
934
|
group ??= crypto.randomUUID()
|
|
915
935
|
spoke = true
|
|
916
936
|
events.push({ type: "engine:text", content: pending, lang, chunk: { of: group } })
|
|
937
|
+
pending = block.content
|
|
938
|
+
break
|
|
917
939
|
}
|
|
918
|
-
|
|
940
|
+
|
|
941
|
+
// Nothing emittable yet — keep what we have and let the
|
|
942
|
+
// next delta carry it.
|
|
943
|
+
pending = (pending ?? "") + block.content
|
|
919
944
|
break
|
|
920
945
|
|
|
921
946
|
case "text:done": {
|
|
922
947
|
if (block.incomplete) { truncated = "text"; break }
|
|
923
948
|
const last = pending ?? block.content
|
|
924
949
|
pending = null
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* An empty block is dropped; an OPEN GROUP is always
|
|
953
|
+
* closed.
|
|
954
|
+
*
|
|
955
|
+
* These are two different questions and the old
|
|
956
|
+
* `if (!last.trim()) break` answered both with one
|
|
957
|
+
* test. A reply whose tail was whitespace — which is
|
|
958
|
+
* most of them, since models end on a newline — lost
|
|
959
|
+
* those characters AND never emitted `final: true`,
|
|
960
|
+
* so the group stayed open in the consumer's fold
|
|
961
|
+
* forever (`openGroups` in the timeline's incremental
|
|
962
|
+
* fold keys on exactly that flag).
|
|
963
|
+
*
|
|
964
|
+
* So: if a group is open, the closing event goes out
|
|
965
|
+
* carrying whatever the tail actually was, whitespace
|
|
966
|
+
* included. Only a block that was NEVER opened and has
|
|
967
|
+
* nothing visible is dropped — that is the empty
|
|
968
|
+
* bubble the original guard existed to prevent, and it
|
|
969
|
+
* is the only case where dropping loses nothing.
|
|
970
|
+
*/
|
|
971
|
+
if (!group && !last.trim()) break
|
|
972
|
+
|
|
929
973
|
spoke = true
|
|
930
974
|
texts++
|
|
931
975
|
events.push(group
|
|
@@ -1107,7 +1151,18 @@ export function Engine(opts: EngineOpts) {
|
|
|
1107
1151
|
// the difference between a diagnostic and a contradiction. The
|
|
1108
1152
|
// model sent a `<script>`; telling it that it sent no script —
|
|
1109
1153
|
// while quoting the script — leaves it nothing to correct.
|
|
1110
|
-
|
|
1154
|
+
// NOT gated on `!spoke`. A truncated block is malformed whether or
|
|
1155
|
+
// not anything reached the screen, and text streams as it arrives —
|
|
1156
|
+
// so `spoke` is already true by the time the missing `</text>` is
|
|
1157
|
+
// known. Gating on it meant a truncated TEXT was always accepted
|
|
1158
|
+
// (only a truncated script, which streams nothing, was ever
|
|
1159
|
+
// caught), and any `<done/>` swallowed inside the unclosed block
|
|
1160
|
+
// ended the turn: a long answer stopping mid-sentence, with the tag
|
|
1161
|
+
// sitting in the prose.
|
|
1162
|
+
//
|
|
1163
|
+
// `!acted` stays: a reply that ran a script has committed a real
|
|
1164
|
+
// side effect, and re-requesting it would run that script twice.
|
|
1165
|
+
if (violations.length === 0 && !acted && truncated) {
|
|
1111
1166
|
lastFault = describeTruncatedBlock(truncated, step.value?.text)
|
|
1112
1167
|
lastFailure = "empty"
|
|
1113
1168
|
await opts.fault({ code: "OUTPUT_TRUNCATED", message: lastFault, rejected: step.value?.text, attempt: attempt + 1 })
|