@wrongstack/tui 0.6.1 → 0.6.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/index.js +97 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3526,6 +3526,34 @@ function App({
|
|
|
3526
3526
|
offRewound();
|
|
3527
3527
|
};
|
|
3528
3528
|
}, [events, onClearHistory]);
|
|
3529
|
+
useEffect(() => {
|
|
3530
|
+
const offFired = events.on("compaction.fired", (e) => {
|
|
3531
|
+
const { level, tokens, load, maxContext: maxContext2, report, aggressive } = e;
|
|
3532
|
+
const pct = (load * 100).toFixed(0);
|
|
3533
|
+
const before = report.before;
|
|
3534
|
+
const after = report.after;
|
|
3535
|
+
const saved = before - after;
|
|
3536
|
+
const table = [
|
|
3537
|
+
`\u25B8 context compacted at ${level} (${pct}% of ${maxContext2.toLocaleString()} tok)`,
|
|
3538
|
+
` tokens before ${before.toLocaleString().padStart(8)}`,
|
|
3539
|
+
` tokens after ${after.toLocaleString().padStart(8)}`,
|
|
3540
|
+
` saved ${saved.toLocaleString().padStart(8)} (${(saved / before * 100).toFixed(1)}%)`
|
|
3541
|
+
];
|
|
3542
|
+
for (const line of table) {
|
|
3543
|
+
dispatch({ type: "addEntry", entry: { kind: "info", text: line } });
|
|
3544
|
+
}
|
|
3545
|
+
});
|
|
3546
|
+
const offFailed = events.on("compaction.failed", (e) => {
|
|
3547
|
+
const { level, load, maxContext: maxContext2, fatal } = e;
|
|
3548
|
+
const pct = (load * 100).toFixed(0);
|
|
3549
|
+
const text = fatal ? `\u2717 compaction failed at ${level} (${pct}% of ${maxContext2.toLocaleString()} tok) \u2014 FATAL` : `\u26A0 compaction failed at ${level} (${pct}% of ${maxContext2.toLocaleString()} tok) \u2014 continuing`;
|
|
3550
|
+
dispatch({ type: "addEntry", entry: { kind: fatal ? "error" : "warn", text } });
|
|
3551
|
+
});
|
|
3552
|
+
return () => {
|
|
3553
|
+
offFired();
|
|
3554
|
+
offFailed();
|
|
3555
|
+
};
|
|
3556
|
+
}, [events]);
|
|
3529
3557
|
useEffect(() => {
|
|
3530
3558
|
if (!fleetStreamController) return;
|
|
3531
3559
|
fleetStreamController.enabled = state.streamFleet;
|
|
@@ -3623,6 +3651,9 @@ function App({
|
|
|
3623
3651
|
case "iteration.started":
|
|
3624
3652
|
dispatch({ type: "fleetStart", id: e.subagentId });
|
|
3625
3653
|
break;
|
|
3654
|
+
case "session.started":
|
|
3655
|
+
dispatch({ type: "fleetStart", id: e.subagentId });
|
|
3656
|
+
break;
|
|
3626
3657
|
case "provider.text_delta": {
|
|
3627
3658
|
const p = e.payload;
|
|
3628
3659
|
if (p?.text) {
|
|
@@ -3635,6 +3666,37 @@ function App({
|
|
|
3635
3666
|
}
|
|
3636
3667
|
break;
|
|
3637
3668
|
}
|
|
3669
|
+
case "provider.thinking_delta": {
|
|
3670
|
+
const p = e.payload;
|
|
3671
|
+
if (p?.text) {
|
|
3672
|
+
streamBuf.set(e.subagentId, (streamBuf.get(e.subagentId) ?? "") + p.text);
|
|
3673
|
+
if (streamFlushTimer) clearTimeout(streamFlushTimer);
|
|
3674
|
+
streamFlushTimer = setTimeout(flushStreamBufs, FLUSH_MS * 4);
|
|
3675
|
+
}
|
|
3676
|
+
break;
|
|
3677
|
+
}
|
|
3678
|
+
case "provider.retry": {
|
|
3679
|
+
const p = e.payload;
|
|
3680
|
+
dispatch({
|
|
3681
|
+
type: "addEntry",
|
|
3682
|
+
entry: {
|
|
3683
|
+
kind: "warn",
|
|
3684
|
+
text: `subagent retry ${p?.attempt ?? "?"}${p?.delayMs ? ` (${p.delayMs}ms)` : ""}`
|
|
3685
|
+
}
|
|
3686
|
+
});
|
|
3687
|
+
break;
|
|
3688
|
+
}
|
|
3689
|
+
case "provider.error": {
|
|
3690
|
+
const p = e.payload;
|
|
3691
|
+
dispatch({
|
|
3692
|
+
type: "addEntry",
|
|
3693
|
+
entry: {
|
|
3694
|
+
kind: "error",
|
|
3695
|
+
text: `subagent error${p?.description ? `: ${p.description}` : ""}`
|
|
3696
|
+
}
|
|
3697
|
+
});
|
|
3698
|
+
break;
|
|
3699
|
+
}
|
|
3638
3700
|
case "tool.started": {
|
|
3639
3701
|
const p = e.payload;
|
|
3640
3702
|
if (p?.name) {
|
|
@@ -3660,6 +3722,37 @@ function App({
|
|
|
3660
3722
|
dispatch({ type: "fleetCost", cost: d.snapshot().total.cost });
|
|
3661
3723
|
break;
|
|
3662
3724
|
}
|
|
3725
|
+
case "session.ended":
|
|
3726
|
+
break;
|
|
3727
|
+
case "compaction.fired":
|
|
3728
|
+
dispatch({
|
|
3729
|
+
type: "addEntry",
|
|
3730
|
+
entry: { kind: "info", text: "subagent compaction triggered" }
|
|
3731
|
+
});
|
|
3732
|
+
break;
|
|
3733
|
+
case "compaction.failed":
|
|
3734
|
+
dispatch({
|
|
3735
|
+
type: "addEntry",
|
|
3736
|
+
entry: { kind: "warn", text: "subagent compaction failed" }
|
|
3737
|
+
});
|
|
3738
|
+
break;
|
|
3739
|
+
case "token.threshold":
|
|
3740
|
+
dispatch({
|
|
3741
|
+
type: "addEntry",
|
|
3742
|
+
entry: { kind: "info", text: "subagent token threshold reached" }
|
|
3743
|
+
});
|
|
3744
|
+
break;
|
|
3745
|
+
case "budget.threshold_reached": {
|
|
3746
|
+
const p = e.payload;
|
|
3747
|
+
dispatch({
|
|
3748
|
+
type: "fleetBudgetWarning",
|
|
3749
|
+
id: e.subagentId,
|
|
3750
|
+
kind: p?.kind ?? "unknown",
|
|
3751
|
+
used: p?.used ?? 0,
|
|
3752
|
+
limit: p?.limit ?? 0
|
|
3753
|
+
});
|
|
3754
|
+
break;
|
|
3755
|
+
}
|
|
3663
3756
|
}
|
|
3664
3757
|
});
|
|
3665
3758
|
const offDone = d.on("task.completed", (payload) => {
|
|
@@ -4167,6 +4260,10 @@ function App({
|
|
|
4167
4260
|
}
|
|
4168
4261
|
} finally {
|
|
4169
4262
|
eternalLoopRunningRef.current = false;
|
|
4263
|
+
if (getAutonomy) {
|
|
4264
|
+
const finalMode = getAutonomy();
|
|
4265
|
+
if (finalMode !== autonomyLive) setAutonomyLive(finalMode);
|
|
4266
|
+
}
|
|
4170
4267
|
}
|
|
4171
4268
|
};
|
|
4172
4269
|
const eternalLoopRunningRef = useRef(false);
|