Phase 8: TypeScript migration, i18n rewrite, Activity Tree, Projects API, Heartbeats

This commit is contained in:
Rose
2026-04-29 11:50:00 +02:00
parent c705fad626
commit 255914c9f1
43 changed files with 17948 additions and 6899 deletions

View File

@@ -341,6 +341,9 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
const d=JSON.parse(e.data);
if(d.name==='clarify') return;
const tc={name:d.name, preview:d.preview||'', args:d.args||{}, snippet:'', done:false, tid:d.tid||`live-${Date.now()}-${Math.random().toString(36).slice(2,8)}`};
// ── Activity Tree: track tool call ──
if(typeof _atTrackTool==='function') _atTrackTool(d);
if(typeof renderActivityTree==='function') renderActivityTree();
const inflight = INFLIGHT[activeSid] || (INFLIGHT[activeSid] = {
messages:[...S.messages],
uploaded:[],
@@ -366,6 +369,9 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
source.addEventListener('tool_complete',e=>{
const d=JSON.parse(e.data);
if(d.name==='clarify') return;
// ── Activity Tree: track tool complete ──
if(typeof _atTrackToolComplete==='function') _atTrackToolComplete(d);
if(typeof renderActivityTree==='function') renderActivityTree();
const inflight=INFLIGHT[activeSid];
if(!inflight) return;
if(!Array.isArray(inflight.toolCalls)) inflight.toolCalls=[];
@@ -393,6 +399,13 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
scrollIfPinned();
});
// ── Subagent lifecycle: subagent.start / subagent.complete ──────────
source.addEventListener('subagent',e=>{
const d=JSON.parse(e.data);
if(typeof _atTrackSubagent==='function') _atTrackSubagent(d);
if(typeof renderActivityTree==='function') renderActivityTree();
});
source.addEventListener('approval',e=>{
const d=JSON.parse(e.data);
d._session_id=activeSid;
@@ -444,6 +457,9 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
source.addEventListener('done',e=>{
_terminalStateReached=true;
// ── Activity Tree: finalize turn ──
if(typeof _atTrackDone==='function') _atTrackDone();
if(typeof renderActivityTree==='function') renderActivityTree();
const d=JSON.parse(e.data);
delete INFLIGHT[activeSid];
clearInflight();clearInflightState(activeSid);