@wrongstack/tui 0.272.0 → 0.272.1
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 +27 -38
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7689,24 +7689,30 @@ function useDirectorFleetBridge({
|
|
|
7689
7689
|
for (const [id, text] of streamBuf) {
|
|
7690
7690
|
const cleaned = stripNextStepsBlock(text);
|
|
7691
7691
|
if (!cleaned) continue;
|
|
7692
|
-
const label = labelFor(labelsRef, id);
|
|
7693
7692
|
enq({ type: "fleetMessage", id, text: cleaned });
|
|
7694
|
-
if (streamFleetRef.current) {
|
|
7695
|
-
enq({
|
|
7696
|
-
type: "addEntry",
|
|
7697
|
-
entry: {
|
|
7698
|
-
kind: "subagent",
|
|
7699
|
-
agentLabel: label.label,
|
|
7700
|
-
agentColor: label.color,
|
|
7701
|
-
icon: "\u{1F4AC}",
|
|
7702
|
-
text: cleaned
|
|
7703
|
-
}
|
|
7704
|
-
});
|
|
7705
|
-
}
|
|
7706
7693
|
}
|
|
7707
7694
|
streamBuf.clear();
|
|
7708
7695
|
streamFlushTimer = null;
|
|
7709
7696
|
};
|
|
7697
|
+
const historyBuf = /* @__PURE__ */ new Map();
|
|
7698
|
+
const finalizeHistory = (id) => {
|
|
7699
|
+
const text = historyBuf.get(id);
|
|
7700
|
+
historyBuf.delete(id);
|
|
7701
|
+
if (!text || !streamFleetRef.current) return;
|
|
7702
|
+
const cleaned = stripNextStepsBlock(text);
|
|
7703
|
+
if (!cleaned.trim()) return;
|
|
7704
|
+
const label = labelFor(labelsRef, id);
|
|
7705
|
+
enq({
|
|
7706
|
+
type: "addEntry",
|
|
7707
|
+
entry: {
|
|
7708
|
+
kind: "subagent",
|
|
7709
|
+
agentLabel: label.label,
|
|
7710
|
+
agentColor: label.color,
|
|
7711
|
+
icon: "\u{1F4AC}",
|
|
7712
|
+
text: cleaned
|
|
7713
|
+
}
|
|
7714
|
+
});
|
|
7715
|
+
};
|
|
7710
7716
|
const status = d.status();
|
|
7711
7717
|
for (const subagent of status.subagents) {
|
|
7712
7718
|
const meta = d.getSubagentMeta(subagent.id);
|
|
@@ -7778,6 +7784,10 @@ function useDirectorFleetBridge({
|
|
|
7778
7784
|
event.subagentId,
|
|
7779
7785
|
(streamBuf.get(event.subagentId) ?? "") + payload.text
|
|
7780
7786
|
);
|
|
7787
|
+
historyBuf.set(
|
|
7788
|
+
event.subagentId,
|
|
7789
|
+
(historyBuf.get(event.subagentId) ?? "") + payload.text
|
|
7790
|
+
);
|
|
7781
7791
|
if (streamFlushTimer) clearTimeout(streamFlushTimer);
|
|
7782
7792
|
streamFlushTimer = setTimeout(flushStreamBufs, FLUSH_MS * 4);
|
|
7783
7793
|
}
|
|
@@ -7820,6 +7830,7 @@ function useDirectorFleetBridge({
|
|
|
7820
7830
|
case "tool.started": {
|
|
7821
7831
|
const payload = event.payload;
|
|
7822
7832
|
if (payload?.name) {
|
|
7833
|
+
finalizeHistory(event.subagentId);
|
|
7823
7834
|
enqueue({ type: "fleetToolStart", id: event.subagentId, name: payload.name });
|
|
7824
7835
|
}
|
|
7825
7836
|
break;
|
|
@@ -7861,6 +7872,7 @@ function useDirectorFleetBridge({
|
|
|
7861
7872
|
});
|
|
7862
7873
|
break;
|
|
7863
7874
|
case "session.ended":
|
|
7875
|
+
finalizeHistory(event.subagentId);
|
|
7864
7876
|
break;
|
|
7865
7877
|
case "compaction.fired":
|
|
7866
7878
|
enqueue({
|
|
@@ -7945,6 +7957,7 @@ function useDirectorFleetBridge({
|
|
|
7945
7957
|
output: d.snapshot().total.output,
|
|
7946
7958
|
perAgent: d.snapshot().perSubagent
|
|
7947
7959
|
});
|
|
7960
|
+
finalizeHistory(payload.result.subagentId);
|
|
7948
7961
|
if (streamFlushTimer) {
|
|
7949
7962
|
clearTimeout(streamFlushTimer);
|
|
7950
7963
|
flushStreamBufs();
|
|
@@ -7959,6 +7972,7 @@ function useDirectorFleetBridge({
|
|
|
7959
7972
|
doFlush();
|
|
7960
7973
|
if (streamFlushTimer) clearTimeout(streamFlushTimer);
|
|
7961
7974
|
flushStreamBufs();
|
|
7975
|
+
for (const id of [...historyBuf.keys()]) finalizeHistory(id);
|
|
7962
7976
|
if (batchTimer) clearTimeout(batchTimer);
|
|
7963
7977
|
flushBatch();
|
|
7964
7978
|
};
|
|
@@ -8258,29 +8272,6 @@ function useSubagentEvents(events, dispatch, setActiveMaxContext) {
|
|
|
8258
8272
|
const offCtxPct = events.on("subagent.ctx_pct", (e) => {
|
|
8259
8273
|
dispatch({ type: "fleetCtxPct", id: e.subagentId, load: e.load, tokens: e.tokens, maxContext: e.maxContext });
|
|
8260
8274
|
});
|
|
8261
|
-
const offAgentTimeline = events.on("agent.timeline.message", (e) => {
|
|
8262
|
-
const l = lbl(e.subagentId, e.agentName);
|
|
8263
|
-
const iconMap = {
|
|
8264
|
-
text: "\u{1F4AC}",
|
|
8265
|
-
// 💬
|
|
8266
|
-
tool_use: "\u{1F527}",
|
|
8267
|
-
// 🔧
|
|
8268
|
-
error: "\u274C",
|
|
8269
|
-
// ❌
|
|
8270
|
-
status: "\u{1F4AC}"
|
|
8271
|
-
// 💬
|
|
8272
|
-
};
|
|
8273
|
-
const icon = iconMap[e.kind] ?? "\u25CF";
|
|
8274
|
-
const toolSuffix = e.toolName ? ` [${e.toolName}]` : "";
|
|
8275
|
-
const text = `#${e.iteration}${toolSuffix} ${e.content.slice(0, 200)}`;
|
|
8276
|
-
dispatch({ type: "addEntry", entry: { kind: "subagent", agentLabel: l.label, agentColor: l.color, icon, text } });
|
|
8277
|
-
});
|
|
8278
|
-
const offAgentStatus = events.on("agent.status_changed", (e) => {
|
|
8279
|
-
const l = lbl(e.subagentId, e.agentName);
|
|
8280
|
-
const icon = e.status === "spawned" || e.status === "running" ? "\u25B6" : e.status === "completed" ? "\u2713" : e.status === "failed" || e.status === "timeout" ? "\u2717" : "\u2299";
|
|
8281
|
-
const text = e.summary ? `${e.status}: ${e.summary.slice(0, 160)}` : e.status;
|
|
8282
|
-
dispatch({ type: "addEntry", entry: { kind: "subagent", agentLabel: l.label, agentColor: l.color, icon, text } });
|
|
8283
|
-
});
|
|
8284
8275
|
const offConcurrencyChanged = events.on("concurrency.changed", (e) => {
|
|
8285
8276
|
const { n } = e;
|
|
8286
8277
|
if (typeof n === "number" && n > 0) {
|
|
@@ -8310,8 +8301,6 @@ function useSubagentEvents(events, dispatch, setActiveMaxContext) {
|
|
|
8310
8301
|
offLeaderCtxPct();
|
|
8311
8302
|
offLeaderMaxContext();
|
|
8312
8303
|
offTool();
|
|
8313
|
-
offAgentTimeline();
|
|
8314
|
-
offAgentStatus();
|
|
8315
8304
|
};
|
|
8316
8305
|
}, [events, dispatch, setActiveMaxContext, lbl]);
|
|
8317
8306
|
}
|