glowtrace 0.3.2__tar.gz → 0.3.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glowtrace
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: See your multi-agent LLM app as a live graph: which agent is running, what it sent, and what came back.
5
5
  Author: Eman Khadim
6
6
  License-Expression: MIT
@@ -9,14 +9,14 @@ Project-URL: Source, https://github.com/emankhadim/glowtrace
9
9
  Project-URL: Issues, https://github.com/emankhadim/glowtrace/issues
10
10
  Keywords: agents,llm,opentelemetry,observability,tracing,multi-agent,visualization,genai
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Topic :: Software Development :: Debuggers
17
17
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
18
  Classifier: Framework :: AsyncIO
19
- Requires-Python: >=3.9
19
+ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: aiohttp>=3.9
@@ -36,6 +36,8 @@ Dynamic: license-file
36
36
 
37
37
  ![glowtrace demo](https://raw.githubusercontent.com/emankhadim/glowtrace/main/docs/demo.gif)
38
38
 
39
+ **[Try the demo in your browser](https://emankhadim.github.io/glowtrace/)**: it plays a built-in sample run, no install needed.
40
+
39
41
  When three or four agents start passing work to each other, logs stop being enough. You can't tell which agent is stuck, which tool call failed, or what prompt actually went to the model. glowtrace shows you that while the run is happening.
40
42
 
41
43
  - **Two commands, no code changes** for apps that already export OpenTelemetry traces
@@ -8,6 +8,8 @@
8
8
 
9
9
  ![glowtrace demo](https://raw.githubusercontent.com/emankhadim/glowtrace/main/docs/demo.gif)
10
10
 
11
+ **[Try the demo in your browser](https://emankhadim.github.io/glowtrace/)**: it plays a built-in sample run, no install needed.
12
+
11
13
  When three or four agents start passing work to each other, logs stop being enough. You can't tell which agent is stuck, which tool call failed, or what prompt actually went to the model. glowtrace shows you that while the run is happening.
12
14
 
13
15
  - **Two commands, no code changes** for apps that already export OpenTelemetry traces
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  from .tracer import Tracer
5
5
 
6
6
  __all__ = ["Tracer", "instrument"]
7
- __version__ = "0.3.2"
7
+ __version__ = "0.3.3"
8
8
 
9
9
 
10
10
  def instrument(endpoint: str | None = None, service_name: str | None = None, token: str | None = None):
@@ -7,61 +7,60 @@
7
7
  <title>Glowtrace — live multi-agent visualizer</title>
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
10
- <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const r of n.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function e(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(s){if(s.ep)return;s.ep=!0;const n=e(s);fetch(s.href,n)}})();const D=(()=>{const o=[],t=(n,r)=>o.push({t:n,ev:r}),e=(n,r)=>t(n,{type:"node",...r}),i=(n,r,a)=>t(n,{type:"update",id:r,...a}),s=(n,r,a,l,h={})=>t(n,{type:"message",from:r,to:a,content:l,...h});return e(0,{id:"orch",kind:"session",title:"Orchestrator",model:"claude-sonnet",role:"orchestrator",system:`You are the orchestrator of a quality-engineering agent team.
10
+ <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const r of n.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function e(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(s){if(s.ep)return;s.ep=!0;const n=e(s);fetch(s.href,n)}})();const F=(()=>{const o=[],t=(n,r)=>o.push({t:n,ev:r}),e=(n,r)=>t(n,{type:"node",...r}),i=(n,r,a)=>t(n,{type:"update",id:r,...a}),s=(n,r,a,l,h={})=>t(n,{type:"message",from:r,to:a,content:l,...h});return e(0,{id:"orch",kind:"session",title:"Orchestrator",model:"claude-sonnet",role:"orchestrator",system:`You are the orchestrator of a product-analytics agent team.
11
11
  - Break the request into steps and delegate each to a specialist.
12
12
  - Keep an evidence ledger (ctx:// ids) and pass ids, not raw data.
13
- - Finish only when the critic returns APPROVE.`,input:"Paint-defect rate on Line 4 jumped from 0.8% to 2.3% in Q3. Find the most likely root causes and draft a one-page report for Thursday's quality meeting."}),e(.7,{id:"s1",kind:"step",parent:"orch",title:"Plan the investigation"}),e(1,{id:"plan",kind:"agent",parent:"s1",title:"planner",role:"planning",model:"claude-sonnet",system:"You are a planning agent. Return a JSON plan of 3–6 steps. Each step: goal, owner_role, inputs, done_when. Prefer parallel steps when inputs are independent.",input:`Plan an investigation for:
14
- "Paint-defect rate on Line 4 jumped from 0.8% to 2.3% in Q3…"
13
+ - Finish only when the critic returns APPROVE.`,input:"Sign-up conversion in our mobile app fell from 4.1% to 2.6% after the v5.2 release. Find the most likely causes and draft a one-page summary for Monday's product review."}),e(.7,{id:"s1",kind:"step",parent:"orch",title:"Plan the investigation"}),e(1,{id:"plan",kind:"agent",parent:"s1",title:"planner",role:"planning",model:"claude-sonnet",system:"You are a planning agent. Return a JSON plan of 3–6 steps. Each step: goal, owner_role, inputs, done_when. Prefer parallel steps when inputs are independent.",input:`Plan an investigation for:
14
+ "Sign-up conversion fell from 4.1% to 2.6% after v5.2…"
15
15
 
16
- Specialists: retriever, stats-analyst, process-analyst, writer, critic.
17
- Tools: sql_query, vector_search, mes_api, python_exec, kb_lookup.`}),s(1.1,"orch","plan","Plan an investigation for the Line 4 paint-defect spike. Specialists: retriever, stats-analyst, process-analyst, writer, critic. Tools: sql_query, vector_search, mes_api, python_exec, kb_lookup.",{label:"plan request",tokens:412}),i(3.2,"plan",{status:"done",tokens:1830,output:JSON.stringify({steps:[{goal:"Collect inspections, 8D reports, booth parameters",owner_role:"retriever",done_when:"evidence pack stored"},{goal:"Locate change point + parameter drift (parallel)",owner_role:"stats-analyst, process-analyst",done_when:"ranked causes with effect sizes"},{goal:"Draft one-page report",owner_role:"writer",done_when:"draft v1"},{goal:"Review, fix, approve",owner_role:"critic → writer",done_when:"APPROVE"}]},null,2)}),s(3.3,"plan","orch","Plan ready: 4 steps — retrieve → analyze (2 agents in parallel) → draft → review/fix loop.",{label:"plan",tokens:640}),i(3.5,"s1",{status:"done"}),e(3.7,{id:"s2",kind:"step",parent:"orch",title:"Retrieve defect & process data",status:"waiting"}),e(3.85,{id:"s3",kind:"step",parent:"orch",title:"Analyze root causes",status:"waiting"}),e(4,{id:"s4",kind:"step",parent:"orch",title:"Draft report",status:"waiting"}),e(4.15,{id:"s5",kind:"step",parent:"orch",title:"Review & fix",status:"waiting"}),i(4.8,"s2",{status:"running"}),e(5,{id:"ret",kind:"agent",parent:"s2",title:"retriever",role:"evidence collection",model:"claude-haiku",system:"You fetch evidence. Prefer structured data first, then documents. Always return row counts and source ids. Never summarise away numbers.",input:`Step 2/5 — collect:
18
- 1. daily defect counts for Line 4, Jun–Sep
19
- 2. 8D reports / lessons learned mentioning paint
20
- 3. booth process parameters (temp, RH, air flow, film build)`}),s(5.1,"orch","ret","Step 2/5 — collect daily defect counts (Line 4, Jun–Sep), paint-related 8D reports, and booth process parameters. Store as an evidence pack and return its id.",{tokens:380}),e(5.9,{id:"t1",kind:"tool",parent:"ret",title:"sql_query",args:`SELECT date, shift, booth, defect_code, COUNT(*) AS n
21
- FROM qm.inspections
22
- WHERE line = 'L4'
23
- AND date BETWEEN '2026-06-01' AND '2026-09-30'
24
- AND defect_code LIKE 'PNT-%'
25
- GROUP BY 1,2,3,4;`}),s(5.95,"ret","t1","call sql_query(qm.inspections, line=L4, PNT-*)"),i(7.4,"t1",{status:"done",result:`1,284 rows
26
- top codes: PNT-07 orange peel 41% · PNT-03 craters 22% · PNT-11 runs 14%`}),s(7.45,"t1","ret","1,284 rows · PNT-07 41%, PNT-03 22%, PNT-11 14%"),e(7.8,{id:"t2",kind:"tool",parent:"ret",title:"vector_search",args:{query:"paint defect root cause booth humidity craters",index:"qm-8d-reports",k:8}}),s(7.85,"ret","t2",'call vector_search("paint defect root cause booth humidity craters", k=8)'),i(9.1,"t2",{status:"done",result:"8 docs: 8D-2291, 8D-2304, LL-0193 (humidity → craters), LL-0207, …"}),s(9.15,"t2","ret","8 docs incl. 8D-2304 and LL-0193"),e(9.4,{id:"t3",kind:"tool",parent:"ret",title:"mes_api.get_booth_params",args:{booth:[1,2,3],from:"2026-06-01",to:"2026-09-30",fields:["temp","rh","air_flow","film_build"]}}),s(9.45,"ret","t3","call mes_api.get_booth_params(booths 1–3, Jun–Sep)"),i(11.6,"t3",{status:"error",note:"504 timeout",result:"504 Gateway Timeout after 5.0s"}),s(11.65,"t3","ret","ERROR 504 Gateway Timeout after 5.0s"),e(12,{id:"t3b",kind:"tool",parent:"ret",title:"mes_api.get_booth_params",note:"retry · paged",args:{booth:[1,2,3],from:"2026-06-01",to:"2026-09-30",page_size:2e3}}),s(12.05,"ret","t3b","retry with paging (page_size=2000)"),i(13.6,"t3b",{status:"done",result:"3 booths × 2,928 hourly samples (temp, RH, air flow, film build)"}),s(13.65,"t3b","ret","8,784 samples"),i(14.1,"ret",{status:"done",tokens:4210,output:`Evidence pack ctx://triage/evidence-v1
27
- - 1,284 inspection rows
28
- - 8 documents (8D-2291, 8D-2304, LL-0193 …)
29
- - 8,784 booth samples
30
- Note: MES timed out once; retried with paging.`}),s(14.2,"ret","orch","Evidence ready → ctx://triage/evidence-v1 (1,284 rows · 8 docs · 8,784 samples).",{tokens:220}),i(14.4,"s2",{status:"done"}),i(14.9,"s3",{status:"running"}),e(15.1,{id:"sta",kind:"agent",parent:"s3",title:"stats-analyst",role:"statistics",model:"claude-sonnet",system:"You are a statistician. Quantify, don't speculate. Report effect sizes with confidence intervals and say what the data cannot show.",input:"Using ctx://triage/evidence-v1: when did the spike start, which defect codes drive it, which shifts / booths?"}),e(15.25,{id:"pro",kind:"agent",parent:"s3",title:"process-analyst",role:"paint-process engineering",model:"claude-sonnet",system:"You are a paint-process engineer. Link defects to physical causes using process parameters and past 8D reports. Cite document ids.",input:"Using ctx://triage/evidence-v1: which process parameters drifted around the spike? Check lessons-learned docs."}),s(15.2,"orch","sta","Using ctx://triage/evidence-v1: when did the spike start, which defect codes drive it, which shifts / booths?",{tokens:310}),s(15.35,"orch","pro","Using ctx://triage/evidence-v1: which process parameters drifted around the spike? Check lessons-learned docs.",{tokens:305}),e(16.2,{id:"t4",kind:"tool",parent:"sta",title:"python_exec",args:`df = load('ctx://triage/evidence-v1/inspections')
31
- rate = df.groupby('date').n.sum() / volume('L4')
16
+ Specialists: retriever, data-analyst, eng-analyst, writer, critic.
17
+ Tools: sql_query, vector_search, release_api, python_exec, kb_lookup.`}),s(1.1,"orch","plan","Plan an investigation for the sign-up drop after v5.2. Specialists: retriever, data-analyst, eng-analyst, writer, critic. Tools: sql_query, vector_search, release_api, python_exec, kb_lookup.",{label:"plan request",tokens:412}),i(3.2,"plan",{status:"done",tokens:1830,output:JSON.stringify({steps:[{goal:"Collect funnel events, support tickets, release notes",owner_role:"retriever",done_when:"evidence pack stored"},{goal:"Locate change point + suspect changes (parallel)",owner_role:"data-analyst, eng-analyst",done_when:"ranked causes with effect sizes"},{goal:"Draft one-page summary",owner_role:"writer",done_when:"draft v1"},{goal:"Review, fix, approve",owner_role:"critic → writer",done_when:"APPROVE"}]},null,2)}),s(3.3,"plan","orch","Plan ready: 4 steps — retrieve → analyze (2 agents in parallel) → draft → review/fix loop.",{label:"plan",tokens:640}),i(3.5,"s1",{status:"done"}),e(3.7,{id:"s2",kind:"step",parent:"orch",title:"Retrieve funnel & release data",status:"waiting"}),e(3.85,{id:"s3",kind:"step",parent:"orch",title:"Analyze causes",status:"waiting"}),e(4,{id:"s4",kind:"step",parent:"orch",title:"Draft summary",status:"waiting"}),e(4.15,{id:"s5",kind:"step",parent:"orch",title:"Review & fix",status:"waiting"}),i(4.8,"s2",{status:"running"}),e(5,{id:"ret",kind:"agent",parent:"s2",title:"retriever",role:"evidence collection",model:"claude-haiku",system:"You fetch evidence. Prefer structured data first, then documents. Always return row counts and source ids. Never summarise away numbers.",input:`Step 2/5 — collect:
18
+ 1. daily sign-up funnel events, 4 weeks before and after v5.2
19
+ 2. support tickets mentioning sign-up or login
20
+ 3. release notes and feature flags shipped in v5.2`}),s(5.1,"orch","ret","Step 2/5 — collect funnel events (±4 weeks around v5.2), sign-up related support tickets, and the v5.2 release notes. Store as an evidence pack and return its id.",{tokens:380}),e(5.9,{id:"t1",kind:"tool",parent:"ret",title:"sql_query",args:`SELECT date, platform, step, COUNT(DISTINCT user_id) AS users
21
+ FROM analytics.funnel_events
22
+ WHERE funnel = 'signup'
23
+ AND date BETWEEN '2026-09-01' AND '2026-10-31'
24
+ GROUP BY 1,2,3;`}),s(5.95,"ret","t1","call sql_query(analytics.funnel_events, funnel=signup)"),i(7.4,"t1",{status:"done",result:`1,284 rows
25
+ biggest drop: "verify email" step, 71% → 48% completion`}),s(7.45,"t1","ret",'1,284 rows · drop concentrated at "verify email" (71% → 48%)'),e(7.8,{id:"t2",kind:"tool",parent:"ret",title:"vector_search",args:{query:"sign up verification email not received",index:"support-tickets",k:8}}),s(7.85,"ret","t2",'call vector_search("sign up verification email not received", k=8)'),i(9.1,"t2",{status:"done",result:"8 tickets: T-2291, T-2304, … · postmortem PM-112 (email deliverability)"}),s(9.15,"t2","ret","8 tickets incl. T-2304 and postmortem PM-112"),e(9.4,{id:"t3",kind:"tool",parent:"ret",title:"release_api.get_changes",args:{release:"v5.2",include:["commits","flags","config"]}}),s(9.45,"ret","t3","call release_api.get_changes(v5.2)"),i(11.6,"t3",{status:"error",note:"504 timeout",result:"504 Gateway Timeout after 5.0s"}),s(11.65,"t3","ret","ERROR 504 Gateway Timeout after 5.0s"),e(12,{id:"t3b",kind:"tool",parent:"ret",title:"release_api.get_changes",note:"retry · paged",args:{release:"v5.2",include:["commits","flags","config"],page_size:200}}),s(12.05,"ret","t3b","retry with paging (page_size=200)"),i(13.6,"t3b",{status:"done",result:"412 commits · 6 feature flags · 3 config changes"}),s(13.65,"t3b","ret","412 commits, 6 flags, 3 config changes"),i(14.1,"ret",{status:"done",tokens:4210,output:`Evidence pack ctx://signup/evidence-v1
26
+ - 1,284 funnel rows
27
+ - 8 support tickets + PM-112
28
+ - v5.2: 412 commits, 6 flags, 3 config changes
29
+ Note: release API timed out once; retried with paging.`}),s(14.2,"ret","orch","Evidence ready → ctx://signup/evidence-v1 (1,284 rows · 8 tickets · v5.2 changes).",{tokens:220}),i(14.4,"s2",{status:"done"}),i(14.9,"s3",{status:"running"}),e(15.1,{id:"sta",kind:"agent",parent:"s3",title:"data-analyst",role:"statistics",model:"claude-sonnet",system:"You are a data analyst. Quantify, don't speculate. Report effect sizes with confidence intervals and say what the data cannot show.",input:"Using ctx://signup/evidence-v1: when did the drop start, which funnel step drives it, which platforms?"}),e(15.25,{id:"pro",kind:"agent",parent:"s3",title:"eng-analyst",role:"engineering review",model:"claude-sonnet",system:"You are a senior engineer. Link the drop to concrete changes in the release using commits, flags, config and past postmortems. Cite ids.",input:"Using ctx://signup/evidence-v1: which v5.2 changes touch sign-up or email verification? Check past postmortems."}),s(15.2,"orch","sta","Using ctx://signup/evidence-v1: when did the drop start, which funnel step drives it, which platforms?",{tokens:310}),s(15.35,"orch","pro","Using ctx://signup/evidence-v1: which v5.2 changes touch sign-up or email verification? Check past postmortems.",{tokens:305}),e(16.2,{id:"t4",kind:"tool",parent:"sta",title:"python_exec",args:`df = load('ctx://signup/evidence-v1/funnel')
30
+ rate = df[df.step == 'completed'].groupby('date').users.sum() / df[df.step == 'start'].groupby('date').users.sum()
32
31
  cp = changepoint(rate, method='pelt')
33
- by_booth = df[df.date >= cp].pivot_table('n', 'booth', 'defect_code', aggfunc='sum')
34
- by_booth.div(by_booth.sum()).round(2)`}),s(16.25,"sta","t4","run python_exec (change-point + booth split)"),e(16.6,{id:"t5",kind:"tool",parent:"pro",title:"kb_lookup",args:{ids:["LL-0193","8D-2291","8D-2304"]}}),s(16.65,"pro","t5","kb_lookup(LL-0193, 8D-2291, 8D-2304)"),i(18.2,"t5",{status:"done",result:`LL-0193: crater rate rises when booth RH > 70%.
35
- 8D-2304: filter change interval extended from 2 to 4 weeks in July (cost measure).`}),s(18.25,"t5","pro","LL-0193: RH > 70% → craters · 8D-2304: filter interval extended in July"),i(19,"t4",{status:"done",result:`change point: 2026-07-14 (p < 0.01)
36
- booth 3 share of PNT-07 + PNT-03 after cp: 63%`}),s(19.05,"t4","sta","change point 2026-07-14 · booth 3 = 63% of PNT-07/03"),s(19.6,"pro","sta","Booth 3 relative humidity was above 70% on 9 of the 11 worst days. Can you test the correlation between RH and PNT-03 craters in booth 3?",{label:"peer request",tokens:140}),i(19.7,"sta",{note:"checking RH correlation"}),s(21.4,"sta","pro","Booth 3, RH vs crater rate: r = 0.71 (95% CI 0.58–0.80). Orange peel (PNT-07) does not track RH — it follows film-build drift instead.",{label:"peer reply",tokens:160}),i(22.2,"sta",{status:"done",note:null,tokens:5120,output:`- Spike starts 2026-07-14 (p<0.01)
37
- - Booth 3 carries 63% of PNT-07/03 after the change point
38
- - Craters ~ RH in booth 3: r=0.71 (0.58–0.80)
39
- - Orange peel ~ film-build drift, not RH`}),i(22.5,"pro",{status:"done",tokens:3980,output:`Ranked causes:
40
- 1. Booth 3 humidity control failing (LL-0193 pattern) → craters
41
- 2. Filter interval extended in July (8D-2304) → air-flow / film-build drift → orange peel`}),s(22.6,"sta","orch","Stats findings ready (change point, booth split, r=0.71).",{tokens:260}),s(22.8,"pro","orch","Process findings ready: humidity control + filter interval.",{tokens:240}),i(23.1,"s3",{status:"done"}),i(23.6,"s4",{status:"running"}),e(23.8,{id:"wr",kind:"agent",parent:"s4",title:"writer",role:"report writing",model:"claude-sonnet",system:"You write one-page reports for plant quality meetings: summary, evidence, ranked root causes, actions with owners and dates. No filler.",input:"Draft the report from the stats + process findings. Audience: Thursday quality meeting."}),s(23.9,"orch","wr","Draft a one-page report from the stats-analyst and process-analyst findings. Audience: Thursday quality meeting.",{tokens:1450}),i(27.6,"wr",{status:"done",tokens:2870,output:`# Line 4 paint defects — Q3
42
- **Summary.** Defect rate rose 0.8% → 2.3% from 14 Jul, concentrated in booth 3.
43
- **Root causes.** (1) Booth 3 humidity control — dehumidifier maintenance overdue. (2) Filter change interval extended (8D-2304).
44
- **Actions.** Restore dehumidifier; revert filter interval.`}),s(27.7,"wr","orch","Draft v1 ready.",{tokens:90}),i(27.9,"s4",{status:"done"}),i(28.4,"s5",{status:"running"}),e(28.6,{id:"cr",kind:"agent",parent:"s5",title:"critic",role:"review",model:"claude-sonnet",system:"You review reports. Every claim must cite an evidence id. Return APPROVE, or a numbered list of issues.",input:"Review draft v1 against ctx://triage/evidence-v1."}),s(28.7,"orch","cr","Review draft v1 against ctx://triage/evidence-v1.",{tokens:1900}),i(30.6,"cr",{note:"2 issues"}),e(30.9,{id:"wr2",kind:"agent",parent:"s5",title:"writer · revision",role:"report writing",model:"claude-sonnet",system:"You write one-page reports for plant quality meetings: summary, evidence, ranked root causes, actions with owners and dates. No filler.",input:"Revise draft v1 to fix the critic's issues."}),s(30.95,"cr","wr2",`1) "Dehumidifier maintenance overdue" has no source — cite the maintenance log or soften the claim.
45
- 2) Actions have no owners or dates.`,{label:"2 issues",tokens:180}),e(31.6,{id:"t6",kind:"tool",parent:"wr2",title:"sql_query",args:`SELECT wo_id, asset, due_date, status
46
- FROM pm.work_orders
47
- WHERE asset = 'B3-DEHUM'
48
- AND due_date >= '2026-06-01';`}),s(31.65,"wr2","t6","call sql_query(pm.work_orders, asset=B3-DEHUM)"),i(32.9,"t6",{status:"done",result:"WO-55812 · B3-DEHUM · due 2026-07-09 · OVERDUE"}),s(32.95,"t6","wr2","WO-55812 overdue since 2026-07-09 (5 days before the change point)"),i(34.6,"wr2",{status:"done",tokens:2440,output:`Draft v2
49
- - Cites WO-55812: dehumidifier service overdue since 9 Jul (spike from 14 Jul)
50
- - Actions: service B3-DEHUM (paint-shop lead, 21 Nov); revert filter interval to 2 weeks (maintenance planner, 24 Nov); add RH alarm at 65% (process eng., 28 Nov)`}),s(34.7,"wr2","cr","v2 attached — source added (WO-55812), owners and dates assigned.",{tokens:1520}),i(36,"cr",{status:"done",note:"APPROVE",tokens:2210,output:"APPROVE — every claim cites an evidence id; actions have owners and dates."}),s(36.1,"cr","orch","APPROVE ✔",{tokens:40}),i(36.3,"s5",{status:"done"}),i(36.8,"orch",{status:"done",tokens:3100,output:`Report v2 approved and ready for Thursday.
51
- Top cause: booth 3 dehumidifier service overdue (WO-55812) → humidity > 70% → craters.
52
- Second: filter interval change → film-build drift → orange peel.`}),o.sort((n,r)=>n.t-r.t)})(),U={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},c=o=>String(o??"").replace(/[&<>"]/g,t=>U[t]);function P(o,t){const e=String(o??"").replace(/\s+/g," ").trim();return e.length>t?e.slice(0,t-1)+"…":e}function q(o){if(o==null||o<0)return"";if(o<1e4)return(o/1e3).toFixed(1)+"s";const t=Math.floor(o/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,"0")}s`}function x(o){const t=Math.max(0,Math.floor(o/1e3));return`${String(Math.floor(t/60)).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}const A=o=>(o??0)>=1e3?((o??0)/1e3).toFixed(1)+"k":String(o||0),F=o=>typeof o=="string"?o:JSON.stringify(o,null,2),$={session:"var(--run)",step:"var(--run)",agent:"var(--agent)",tool:"var(--tool)",llm:"var(--llm)"},Y={session:118,step:252,agent:252,tool:224,llm:236},O=o=>Y[o.kind]??252,j=o=>o.kind==="session"?118:48;function k(o){return o.status==="done"?"var(--done)":o.status==="error"?"var(--err)":o.status==="waiting"?"var(--wait)":$[o.kind]}function I(o){return o.status==="done"?"#3a4f94":o.status==="error"?"var(--err)":o.status==="waiting"?"#465082":$[o.kind]}function G(o){return o.status==="done"?"#5f78c8":o.status==="error"?"var(--err)":o.status==="waiting"?"#58628f":$[o.kind]}const T=o=>[o.x+O(o),o.cy],E=o=>[o.x,o.cy];function R(o,t){const e=Math.max(40,(t[0]-o[0])*.5);return`M${o[0]} ${o[1]} C${o[0]+e} ${o[1]} ${t[0]-e} ${t[1]} ${t[0]} ${t[1]}`}function K(o,t){const e=70+Math.abs(o[1]-t[1])*.3;return`M${o[0]} ${o[1]} C${o[0]+e} ${o[1]} ${t[0]+e} ${t[1]} ${t[0]} ${t[1]}`}const _=[22,196,472,748],L=58,M=30;function H(o){let t=0;const e=n=>o.nodes.get(n)?.startedAt??1e15,i=(n,r)=>{const a=o.nodes.get(n);if(a){if(a.depth=r,a.x=r<_.length?_[r]:_[3]+(r-3)*276,a.kids=a.children.filter(l=>o.nodes.has(l)).sort((l,h)=>e(l)-e(h)),!a.kids.length)a.cy=M+t*L+L/2,t++;else{for(const f of a.kids)i(f,r+1);const l=o.nodes.get(a.kids[0]),h=o.nodes.get(a.kids[a.kids.length-1]);a.cy=r===0?(l.cy+h.cy)/2:l.cy}r===1&&(t+=.35)}};for(const n of o.roots){const r=t;i(n,0),t-r<2.4&&(t=r+2.4);const a=o.nodes.get(n);a&&(a.cy=Math.max(a.cy,M+r*L+66)),t+=.6}let s=600;for(const n of o.nodes.values())s=Math.max(s,n.x+O(n)+50);return{w:s,h:Math.max(M+t*L+60,200)}}const W="http://www.w3.org/2000/svg",Q=7;function X(o,t,e,i,s){let n,r=!1;t.depth<e.depth?n=R(T(t),E(e)):t.depth>e.depth?(n=R(T(e),E(t)),r=!0):n=K(T(t),T(e));const a=$[t.kind],l=document.createElementNS(W,"path");l.setAttribute("d",n),l.setAttribute("class","ptrail"),l.style.stroke=a,o.appendChild(l);const h=l.getTotalLength(),f=Array.from({length:Q},(v,u)=>{const m=document.createElementNS(W,"circle");return m.setAttribute("r",String(u?Math.max(1,3.4-u*.4):4.4)),m.style.fill=u?a:"#fff",m.style.opacity=String(u?.85-u*.11:1),u||(m.style.filter=`drop-shadow(0 0 5px ${a}) drop-shadow(0 0 10px ${a})`),o.appendChild(m),m}),y=1150/Math.sqrt(i),p=performance.now(),g=v=>{const u=Math.min(1,(v-p)/y),m=u<.5?2*u*u:1-Math.pow(-2*u+2,2)/2;if(f.forEach((S,J)=>{const C=Math.max(0,m-J*.022),N=l.getPointAtLength((r?1-C:C)*h);S.setAttribute("cx",String(N.x)),S.setAttribute("cy",String(N.y))}),u<1){requestAnimationFrame(g);return}l.style.opacity="0",f.forEach(S=>S.remove()),setTimeout(()=>l.remove(),450),s()};g(p)}const b=o=>{const t=document.querySelector(o);if(!t)throw new Error(`missing element ${o}`);return t};class Z{constructor(t,e,i){this.store=t,this.elapsed=e,this.onPick=i}vp=b("#vp");sizer=b("#sizer");stage=b("#stage");edges=b("#edges");fx=b("#fx");els=new Map;renderedV=new Map;zoom=1;follow=!0;clear(){for(const t of this.els.values())t.remove();this.els.clear(),this.renderedV.clear(),this.fx.innerHTML="",this.edges.innerHTML=""}drop(t){this.els.get(t)?.remove(),this.els.delete(t),this.renderedV.delete(t)}measure(){return H(this.store)}render(){const t=H(this.store);this.stage.style.width=t.w+"px",this.stage.style.height=t.h+"px",this.stage.style.transform=`scale(${this.zoom})`,this.sizer.style.width=t.w*this.zoom+"px",this.sizer.style.height=t.h*this.zoom+"px";for(const e of this.store.nodes.values())this.renderNode(e);for(const e of this.store.roots){const i=this.store.nodes.get(e);i&&(this.renderedV.delete(e),this.renderNode(i))}this.renderEdges(t),this.followLatest()}tick(){this.stage.querySelectorAll(".el").forEach(t=>{const e=this.store.nodes.get(t.dataset.id??"");e&&(t.textContent=this.elapsed(e))})}animate(t,e){const i=this.store.nodes.get(t.from),s=this.store.nodes.get(t.to);!i||!s||requestAnimationFrame(()=>X(this.fx,i,s,e,()=>{const n=this.els.get(s.id);n&&(n.classList.remove("ping"),n.offsetWidth,n.classList.add("ping"))}))}renderNode(t){let e=this.els.get(t.id);e||(e=document.createElement("div"),e.dataset.id=t.id,e.addEventListener("click",l=>{l.stopPropagation(),this.onPick(t.id)}),this.stage.appendChild(e),this.els.set(t.id,e));const i=this.store.pinned!==null&&"node"in this.store.pinned&&this.store.pinned.node===t.id;if(e.className=`nd ${t.kind==="session"?"root":"card"} k-${t.kind} s-${t.status}${i?" pinned":""}${t.fresh?" enter":""}`,t.fresh=!1,e.style.setProperty("--c",I(t)),e.style.setProperty("--d",k(t)),e.style.left=t.x+"px",e.style.top=t.cy-j(t)/2+"px",t.kind!=="session"&&(e.style.width=O(t)+"px"),this.renderedV.get(t.id)===t.v)return;this.renderedV.set(t.id,t.v);const s=`<span class="el" data-id="${c(t.id)}">${this.elapsed(t)}</span>`;if(t.kind==="session"){const l=this.store.walk(t),h=l.filter(y=>y.kind==="agent").length,f=l.reduce((y,p)=>y+(p.tokens||0),0);e.innerHTML=`<div class="ring"></div><div><div class="rt">${c(P(t.title,18))}</div>
53
- <div class="rs">${t.status} · ${s}<br>${h} agent${h===1?"":"s"}${f?` · ${A(f)} tok`:""}</div></div>`;return}let n='<span class="dot"></span>';if(t.kind==="step"){const l=this.store.get(t.parent);n=`<span class="num">${(l?(l.kids.length?l.kids:l.children).indexOf(t.id)+1:0)||""}</span>`}const r=[t.kind==="agent"&&t.model?c(t.model):null,t.status,t.startedAt!=null?s:null,t.note?c(t.note):null].filter(Boolean).join(" · "),a=t.kind==="tool"?"⚙ ":t.kind==="llm"?"✦ ":"";e.innerHTML=`${n}<div class="t">${a}${c(t.title)}</div><div class="s">${r}</div>${t.tokens?`<span class="tk">${A(t.tokens)}</span>`:""}`}renderEdges(t){let e="";for(const i of this.store.nodes.values()){const s=this.store.get(i.parent);if(!s)continue;const n=R(T(s),E(i)),r=G(i),a=i.status==="running"?"flow":i.status==="waiting"?"wait":i.status==="done"?"done":"";i.status!=="waiting"&&(e+=`<path d="${n}" class="eg" style="stroke:${r}"/>`),e+=`<path d="${n}" class="ec ${a}" style="stroke:${r}"/>`}this.edges.innerHTML=e;for(const i of[this.edges,this.fx])i.setAttribute("width",String(t.w)),i.setAttribute("height",String(t.h))}followLatest(){if(!this.follow||!this.store.last)return;const t=this.store.nodes.get(this.store.last);if(this.store.last=null,!t)return;const e=t.cy*this.zoom,i=t.x*this.zoom,s=this.vp;(e<s.scrollTop+40||e>s.scrollTop+s.clientHeight-60||i+200>s.scrollLeft+s.clientWidth)&&s.scrollTo({top:Math.max(0,e-s.clientHeight*.4),left:Math.max(0,i-s.clientWidth*.35),behavior:"smooth"})}}const tt=["sys","in","args","res"];class et{constructor(t,e,i){this.el=t,this.store=e,this.ctx=i,t.addEventListener("click",s=>{const n=s.target.closest("[data-pin],[data-msg],[data-act],[data-copy]");!n||n.tagName==="SUMMARY"||(n.dataset.copy?(s.preventDefault(),this.copySection(n.dataset.copy)):n.dataset.act==="unpin"?i.pin(null):n.dataset.pin!=null?i.pin({node:n.dataset.pin}):n.dataset.msg!=null&&i.pin({msg:Number(n.dataset.msg)}))})}key="";lastFeedLen=0;invalidate(){this.key=""}render(){const t=this.signature();if(t===this.key)return;const e=this.key;this.key=t;const i=new Set([...this.el.querySelectorAll("details[open]")].map(r=>r.dataset.k)),s=this.el.scrollTop,n=this.store.pinned;n&&"msg"in n?this.el.innerHTML=this.messageView(n.msg):n&&"node"in n&&this.store.nodes.has(n.node)?this.el.innerHTML=this.nodeView(this.store.nodes.get(n.node),i,e):this.el.innerHTML=this.feedView(),this.el.scrollTop=s}signature(){const t=this.store.pinned;if(!t)return"f"+this.store.feed.length;if("node"in t){const e=this.store.nodes.get(t.node);return e?`n${e.id}:${e.v}:${e.msgs.length}:${e.children.length}`:"f"+this.store.feed.length}return"m"+t.msg}feedView(){const t=this.store.feed,e=t.slice(-120).reverse().map((n,r)=>{const a=r===0&&t.length!==this.lastFeedLen?"new":"",l=n.type==="msg"?`data-msg="${n.msg}"`:`data-pin="${c(n.id)}"`,h=n.type==="msg"?`<b>${c(n.fromTitle)}</b> <span class="ar">→</span> <b>${c(n.toTitle)}</b><br><span class="ar">${c(n.snippet)}</span>`:`<b>${c(n.title)}</b> <span class="ar">${c(n.detail)}</span>`;return`<div class="fi ${a}" ${l} style="--d:${n.d}"><span class="ft">${x(n.t)}</span><span class="fd"></span><span>${h}</span></div>`}).join("");this.lastFeedLen=t.length;const i=location.origin&&location.origin!=="null"?location.origin:"http://localhost:4318",s=this.ctx.mode()==="live"?`Connected. Point any OpenTelemetry exporter at <span class="mono">${c(i)}</span> (the OTLP default) and run your agents.`:"Waiting for events…";return`<div class="pbox"><div class="ph"><span>Live activity</span><span class="mono">${t.length} events</span></div>
32
+ df[df.date >= cp].pivot_table('users', 'platform', 'step', aggfunc='sum')`}),s(16.25,"sta","t4","run python_exec (change-point + platform split)"),e(16.6,{id:"t5",kind:"tool",parent:"pro",title:"kb_lookup",args:{ids:["PM-112","FLAG-new_email_provider","CFG-email_rate_limit"]}}),s(16.65,"pro","t5","kb_lookup(PM-112, FLAG-new_email_provider, CFG-email_rate_limit)"),i(18.2,"t5",{status:"done",result:`PM-112: new email providers need domain warm-up; inbox placement drops for ~2 weeks.
33
+ FLAG-new_email_provider: enabled at 100% in v5.2.
34
+ CFG-email_rate_limit: lowered from 50/s to 10/s.`}),s(18.25,"t5","pro","PM-112: provider switch → deliverability dip · new provider at 100% · rate limit lowered to 10/s"),i(19,"t4",{status:"done",result:`change point: 2026-10-06 (release day, p < 0.01)
35
+ Android share of the drop: 63%`}),s(19.05,"t4","sta","change point 2026-10-06 · Android = 63% of the drop"),s(19.6,"pro","sta","The email rate limit was lowered in v5.2. Can you check whether verification emails arrive later at peak hours, and whether late emails predict drop-off?",{label:"peer request",tokens:140}),i(19.7,"sta",{note:"checking email delay"}),s(21.4,"sta","pro","Median email delay at peak went from 4 s to 3 min. Delay vs drop-off: r = 0.71 (95% CI 0.58–0.80). The Android gap is separate: it follows a new keyboard bug on the email field.",{label:"peer reply",tokens:160}),i(22.2,"sta",{status:"done",note:null,tokens:5120,output:`- Drop starts 2026-10-06, release day (p<0.01)
36
+ - "Verify email" step carries most of it
37
+ - Email delay ~ drop-off: r=0.71 (0.58–0.80)
38
+ - Android carries 63%, linked to an input bug, not email delay`}),i(22.5,"pro",{status:"done",tokens:3980,output:`Ranked causes:
39
+ 1. Lower email rate limit + new provider without warm-up (PM-112 pattern) → late or missing verification emails
40
+ 2. Android email field bug in v5.2 → users cannot finish the form`}),s(22.6,"sta","orch","Data findings ready (change point, platform split, r=0.71).",{tokens:260}),s(22.8,"pro","orch","Engineering findings ready: email delivery + Android form bug.",{tokens:240}),i(23.1,"s3",{status:"done"}),i(23.6,"s4",{status:"running"}),e(23.8,{id:"wr",kind:"agent",parent:"s4",title:"writer",role:"report writing",model:"claude-sonnet",system:"You write one-page summaries for product reviews: summary, evidence, ranked causes, actions with owners and dates. No filler.",input:"Draft the summary from the data + engineering findings. Audience: Monday product review."}),s(23.9,"orch","wr","Draft a one-page summary from the data-analyst and eng-analyst findings. Audience: Monday product review.",{tokens:1450}),i(27.6,"wr",{status:"done",tokens:2870,output:`# Sign-up drop after v5.2
41
+ **Summary.** Conversion fell 4.1% → 2.6% from release day, mostly at email verification.
42
+ **Causes.** (1) Verification emails delayed — new provider not warmed up, rate limit lowered. (2) Android email-field bug.
43
+ **Actions.** Restore rate limit; fix Android bug.`}),s(27.7,"wr","orch","Draft v1 ready.",{tokens:90}),i(27.9,"s4",{status:"done"}),i(28.4,"s5",{status:"running"}),e(28.6,{id:"cr",kind:"agent",parent:"s5",title:"critic",role:"review",model:"claude-sonnet",system:"You review reports. Every claim must cite an evidence id. Return APPROVE, or a numbered list of issues.",input:"Review draft v1 against ctx://signup/evidence-v1."}),s(28.7,"orch","cr","Review draft v1 against ctx://signup/evidence-v1.",{tokens:1900}),i(30.6,"cr",{note:"2 issues"}),e(30.9,{id:"wr2",kind:"agent",parent:"s5",title:"writer · revision",role:"report writing",model:"claude-sonnet",system:"You write one-page summaries for product reviews: summary, evidence, ranked causes, actions with owners and dates. No filler.",input:"Revise draft v1 to fix the critic's issues."}),s(30.95,"cr","wr2",`1) "Android email-field bug" has no source — cite the bug ticket or soften the claim.
44
+ 2) Actions have no owners or dates.`,{label:"2 issues",tokens:180}),e(31.6,{id:"t6",kind:"tool",parent:"wr2",title:"sql_query",args:`SELECT issue_id, title, platform, status
45
+ FROM tracker.issues
46
+ WHERE component = 'signup-form'
47
+ AND created >= '2026-10-01';`}),s(31.65,"wr2","t6","call sql_query(tracker.issues, component=signup-form)"),i(32.9,"t6",{status:"done",result:'APP-5581 · Android: keyboard hides "Continue" on email field · OPEN'}),s(32.95,"t6","wr2","APP-5581 open since 7 Oct (one day after release)"),i(34.6,"wr2",{status:"done",tokens:2440,output:`Draft v2
48
+ - Cites APP-5581 for the Android form bug
49
+ - Actions: restore email rate limit to 50/s (platform team, 2 Nov); warm up the new email domain (growth eng., 6 Nov); fix APP-5581 (mobile team, 4 Nov)`}),s(34.7,"wr2","cr","v2 attached — source added (APP-5581), owners and dates assigned.",{tokens:1520}),i(36,"cr",{status:"done",note:"APPROVE",tokens:2210,output:"APPROVE — every claim cites an evidence id; actions have owners and dates."}),s(36.1,"cr","orch","APPROVE ✔",{tokens:40}),i(36.3,"s5",{status:"done"}),i(36.8,"orch",{status:"done",tokens:3100,output:`Summary v2 approved and ready for Monday.
50
+ Top cause: verification emails delayed (new provider not warmed up + lower rate limit).
51
+ Second: Android email-field bug (APP-5581).`}),o.sort((n,r)=>n.t-r.t)})(),Y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},c=o=>String(o??"").replace(/[&<>"]/g,t=>Y[t]);function E(o,t){const e=String(o??"").replace(/\s+/g," ").trim();return e.length>t?e.slice(0,t-1)+"…":e}function D(o){if(o==null||o<0)return"";if(o<1e4)return(o/1e3).toFixed(1)+"s";const t=Math.floor(o/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,"0")}s`}function b(o){const t=Math.max(0,Math.floor(o/1e3));return`${String(Math.floor(t/60)).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}const M=o=>(o??0)>=1e3?((o??0)/1e3).toFixed(1)+"k":String(o||0),z=o=>typeof o=="string"?o:JSON.stringify(o,null,2),$={session:"var(--run)",step:"var(--run)",agent:"var(--agent)",tool:"var(--tool)",llm:"var(--llm)"},U={session:118,step:252,agent:252,tool:224,llm:236},O=o=>U[o.kind]??252,j=o=>o.kind==="session"?118:48;function k(o){return o.status==="done"?"var(--done)":o.status==="error"?"var(--err)":o.status==="waiting"?"var(--wait)":$[o.kind]}function B(o){return o.status==="done"?"#3a4f94":o.status==="error"?"var(--err)":o.status==="waiting"?"#465082":$[o.kind]}function J(o){return o.status==="done"?"#5f78c8":o.status==="error"?"var(--err)":o.status==="waiting"?"#58628f":$[o.kind]}const S=o=>[o.x+O(o),o.cy],C=o=>[o.x,o.cy];function L(o,t){const e=Math.max(40,(t[0]-o[0])*.5);return`M${o[0]} ${o[1]} C${o[0]+e} ${o[1]} ${t[0]-e} ${t[1]} ${t[0]} ${t[1]}`}function K(o,t){const e=70+Math.abs(o[1]-t[1])*.3;return`M${o[0]} ${o[1]} C${o[0]+e} ${o[1]} ${t[0]+e} ${t[1]} ${t[0]} ${t[1]}`}const _=[22,196,472,748],T=58,P=30;function q(o){let t=0;const e=n=>o.nodes.get(n)?.startedAt??1e15,i=(n,r)=>{const a=o.nodes.get(n);if(a){if(a.depth=r,a.x=r<_.length?_[r]:_[3]+(r-3)*276,a.kids=a.children.filter(l=>o.nodes.has(l)).sort((l,h)=>e(l)-e(h)),!a.kids.length)a.cy=P+t*T+T/2,t++;else{for(const m of a.kids)i(m,r+1);const l=o.nodes.get(a.kids[0]),h=o.nodes.get(a.kids[a.kids.length-1]);a.cy=r===0?(l.cy+h.cy)/2:l.cy}r===1&&(t+=.35)}};for(const n of o.roots){const r=t;i(n,0),t-r<2.4&&(t=r+2.4);const a=o.nodes.get(n);a&&(a.cy=Math.max(a.cy,P+r*T+66)),t+=.6}let s=600;for(const n of o.nodes.values())s=Math.max(s,n.x+O(n)+50);return{w:s,h:Math.max(P+t*T+60,200)}}const V="http://www.w3.org/2000/svg",X=7;function Q(o,t,e,i,s){let n,r=!1;t.depth<e.depth?n=L(S(t),C(e)):t.depth>e.depth?(n=L(S(e),C(t)),r=!0):n=K(S(t),S(e));const a=$[t.kind],l=document.createElementNS(V,"path");l.setAttribute("d",n),l.setAttribute("class","ptrail"),l.style.stroke=a,o.appendChild(l);const h=l.getTotalLength(),m=Array.from({length:X},(v,u)=>{const f=document.createElementNS(V,"circle");return f.setAttribute("r",String(u?Math.max(1,3.4-u*.4):4.4)),f.style.fill=u?a:"#fff",f.style.opacity=String(u?.85-u*.11:1),u||(f.style.filter=`drop-shadow(0 0 5px ${a}) drop-shadow(0 0 10px ${a})`),o.appendChild(f),f}),y=1150/Math.sqrt(i),p=performance.now(),g=v=>{const u=Math.min(1,(v-p)/y),f=u<.5?2*u*u:1-Math.pow(-2*u+2,2)/2;if(m.forEach((A,I)=>{const R=Math.max(0,f-I*.022),N=l.getPointAtLength((r?1-R:R)*h);A.setAttribute("cx",String(N.x)),A.setAttribute("cy",String(N.y))}),u<1){requestAnimationFrame(g);return}l.style.opacity="0",m.forEach(A=>A.remove()),setTimeout(()=>l.remove(),450),s()};g(p)}const x=o=>{const t=document.querySelector(o);if(!t)throw new Error(`missing element ${o}`);return t};class Z{constructor(t,e,i){this.store=t,this.elapsed=e,this.onPick=i}vp=x("#vp");sizer=x("#sizer");stage=x("#stage");edges=x("#edges");fx=x("#fx");els=new Map;renderedV=new Map;zoom=1;follow=!0;clear(){for(const t of this.els.values())t.remove();this.els.clear(),this.renderedV.clear(),this.fx.innerHTML="",this.edges.innerHTML=""}drop(t){this.els.get(t)?.remove(),this.els.delete(t),this.renderedV.delete(t)}measure(){return q(this.store)}render(){const t=q(this.store);this.stage.style.width=t.w+"px",this.stage.style.height=t.h+"px",this.stage.style.transform=`scale(${this.zoom})`,this.sizer.style.width=t.w*this.zoom+"px",this.sizer.style.height=t.h*this.zoom+"px";for(const e of this.store.nodes.values())this.renderNode(e);for(const e of this.store.roots){const i=this.store.nodes.get(e);i&&(this.renderedV.delete(e),this.renderNode(i))}this.renderEdges(t),this.followLatest()}tick(){this.stage.querySelectorAll(".el").forEach(t=>{const e=this.store.nodes.get(t.dataset.id??"");e&&(t.textContent=this.elapsed(e))})}animate(t,e){const i=this.store.nodes.get(t.from),s=this.store.nodes.get(t.to);!i||!s||requestAnimationFrame(()=>Q(this.fx,i,s,e,()=>{const n=this.els.get(s.id);n&&(n.classList.remove("ping"),n.offsetWidth,n.classList.add("ping"))}))}renderNode(t){let e=this.els.get(t.id);e||(e=document.createElement("div"),e.dataset.id=t.id,e.addEventListener("click",l=>{l.stopPropagation(),this.onPick(t.id)}),this.stage.appendChild(e),this.els.set(t.id,e));const i=this.store.pinned!==null&&"node"in this.store.pinned&&this.store.pinned.node===t.id;if(e.className=`nd ${t.kind==="session"?"root":"card"} k-${t.kind} s-${t.status}${i?" pinned":""}${t.fresh?" enter":""}`,t.fresh=!1,e.style.setProperty("--c",B(t)),e.style.setProperty("--d",k(t)),e.style.left=t.x+"px",e.style.top=t.cy-j(t)/2+"px",t.kind!=="session"&&(e.style.width=O(t)+"px"),this.renderedV.get(t.id)===t.v)return;this.renderedV.set(t.id,t.v);const s=`<span class="el" data-id="${c(t.id)}">${this.elapsed(t)}</span>`;if(t.kind==="session"){const l=this.store.walk(t),h=l.filter(y=>y.kind==="agent").length,m=l.reduce((y,p)=>y+(p.tokens||0),0);e.innerHTML=`<div class="ring"></div><div><div class="rt">${c(E(t.title,18))}</div>
52
+ <div class="rs">${t.status} · ${s}<br>${h} agent${h===1?"":"s"}${m?` · ${M(m)} tok`:""}</div></div>`;return}let n='<span class="dot"></span>';if(t.kind==="step"){const l=this.store.get(t.parent);n=`<span class="num">${(l?(l.kids.length?l.kids:l.children).indexOf(t.id)+1:0)||""}</span>`}const r=[t.kind==="agent"&&t.model?c(t.model):null,t.status,t.startedAt!=null?s:null,t.note?c(t.note):null].filter(Boolean).join(" · "),a=t.kind==="tool"?"⚙ ":t.kind==="llm"?"✦ ":"";e.innerHTML=`${n}<div class="t">${a}${c(t.title)}</div><div class="s">${r}</div>${t.tokens?`<span class="tk">${M(t.tokens)}</span>`:""}`}renderEdges(t){let e="";for(const i of this.store.nodes.values()){const s=this.store.get(i.parent);if(!s)continue;const n=L(S(s),C(i)),r=J(i),a=i.status==="running"?"flow":i.status==="waiting"?"wait":i.status==="done"?"done":"";i.status!=="waiting"&&(e+=`<path d="${n}" class="eg" style="stroke:${r}"/>`),e+=`<path d="${n}" class="ec ${a}" style="stroke:${r}"/>`}this.edges.innerHTML=e;for(const i of[this.edges,this.fx])i.setAttribute("width",String(t.w)),i.setAttribute("height",String(t.h))}followLatest(){if(!this.follow||!this.store.last)return;const t=this.store.nodes.get(this.store.last);if(this.store.last=null,!t)return;const e=t.cy*this.zoom,i=t.x*this.zoom,s=this.vp;(e<s.scrollTop+40||e>s.scrollTop+s.clientHeight-60||i+200>s.scrollLeft+s.clientWidth)&&s.scrollTo({top:Math.max(0,e-s.clientHeight*.4),left:Math.max(0,i-s.clientWidth*.35),behavior:"smooth"})}}const tt=["sys","in","args","res"];class et{constructor(t,e,i){this.el=t,this.store=e,this.ctx=i,t.addEventListener("click",s=>{const n=s.target.closest("[data-pin],[data-msg],[data-act],[data-copy]");!n||n.tagName==="SUMMARY"||(n.dataset.copy?(s.preventDefault(),this.copySection(n.dataset.copy)):n.dataset.act==="unpin"?i.pin(null):n.dataset.pin!=null?i.pin({node:n.dataset.pin}):n.dataset.msg!=null&&i.pin({msg:Number(n.dataset.msg)}))})}key="";lastFeedLen=0;invalidate(){this.key=""}render(){const t=this.signature();if(t===this.key)return;const e=this.key;this.key=t;const i=new Set([...this.el.querySelectorAll("details[open]")].map(r=>r.dataset.k)),s=this.el.scrollTop,n=this.store.pinned;n&&"msg"in n?this.el.innerHTML=this.messageView(n.msg):n&&"node"in n&&this.store.nodes.has(n.node)?this.el.innerHTML=this.nodeView(this.store.nodes.get(n.node),i,e):this.el.innerHTML=this.feedView(),this.el.scrollTop=s}signature(){const t=this.store.pinned;if(!t)return"f"+this.store.feed.length;if("node"in t){const e=this.store.nodes.get(t.node);return e?`n${e.id}:${e.v}:${e.msgs.length}:${e.children.length}`:"f"+this.store.feed.length}return"m"+t.msg}feedView(){const t=this.store.feed,e=t.slice(-120).reverse().map((n,r)=>{const a=r===0&&t.length!==this.lastFeedLen?"new":"",l=n.type==="msg"?`data-msg="${n.msg}"`:`data-pin="${c(n.id)}"`,h=n.type==="msg"?`<b>${c(n.fromTitle)}</b> <span class="ar">→</span> <b>${c(n.toTitle)}</b><br><span class="ar">${c(n.snippet)}</span>`:`<b>${c(n.title)}</b> <span class="ar">${c(n.detail)}</span>`;return`<div class="fi ${a}" ${l} style="--d:${n.d}"><span class="ft">${b(n.t)}</span><span class="fd"></span><span>${h}</span></div>`}).join("");this.lastFeedLen=t.length;const i=location.origin&&location.origin!=="null"?location.origin:"http://localhost:4318",s=this.ctx.mode()==="live"?`Connected. Point any OpenTelemetry exporter at <span class="mono">${c(i)}</span> (the OTLP default) and run your agents.`:"Waiting for events…";return`<div class="pbox"><div class="ph"><span>Live activity</span><span class="mono">${t.length} events</span></div>
54
53
  <div class="hint">Click any node in the graph — or any line below — to pin it and see its prompts, tool args, outputs and messages.</div>
55
54
  <div class="feed">${e||`<div class="hint">${s}</div>`}</div></div>`}messageView(t){const e=this.store.msgs[t];if(!e)return this.feedView();const i=this.store.nodes.get(e.from),s=this.store.nodes.get(e.to),n=c(i?.title??e.from),r=c(s?.title??e.to);return`<div class="pbox"><div class="ph"><span>Pinned · message</span><button class="x" data-act="unpin">✕ back to live</button></div>
56
55
  <div class="ptitle"><span class="dot" style="--d:${i?$[i.kind]:"var(--run)"}"></span>${n} → ${r}</div>
57
56
  <div class="kv"><div>From</div><div class="link" data-pin="${c(e.from)}">${n}</div>
58
57
  <div>To</div><div class="link" data-pin="${c(e.to)}">${r}</div>
59
- <div>Sent at</div><div class="mono">T+${x(e.t)}</div>${e.tokens?`<div>Tokens</div><div>${e.tokens}</div>`:""}
58
+ <div>Sent at</div><div class="mono">T+${b(e.t)}</div>${e.tokens?`<div>Tokens</div><div>${e.tokens}</div>`:""}
60
59
  ${e.label?`<div>Label</div><div>${c(e.label)}</div>`:""}</div>
61
60
  <h4>Content</h4><details open data-k="mc"><summary>Full message<span class="sm">${e.content.length} chars</span></summary>
62
- <button class="btn copy" data-copy="msg">copy</button><pre>${c(e.content)}</pre></details></div>`}nodeView(t,e,i){const s=this.store.get(t.parent),n=!i.startsWith(`n${t.id}:`),r=[["Kind",t.kind]];t.role&&r.push(["Role",c(t.role)]),t.model&&r.push(["Model",`<span class="mono">${c(t.model)}</span>`]),r.push(["Started",t.startedAt!=null?`<span class="mono">T+${x(t.startedAt)}</span>`:"—"]),r.push([t.endedAt!=null?"Took":"Running for",`<span class="el" data-id="${c(t.id)}">${this.ctx.elapsed(t)||"—"}</span>`]),r.push(["Tokens",t.kind==="session"?A(this.store.totalTokens())+" (all)":String(t.tokens||"—")]),s&&r.push(["Parent",`<span class="link" data-pin="${c(s.id)}">${c(s.title)}</span>`]),t.note&&r.push(["Note",c(t.note)]),r.push(["ID",`<span class="mono">${c(t.id)}</span>`]);const a=r.map(([p,g])=>`<div>${p}</div><div>${g}</div>`).join(""),l=(p,g,v)=>{if(v==null)return"";const u=F(v),m=e.has(p)||n&&(tt.includes(p)||p==="out"&&t.kind==="session");return`<details data-k="${p}" ${m?"open":""}><summary>${g}<span class="sm">${u.length} chars</span></summary>
61
+ <button class="btn copy" data-copy="msg">copy</button><pre>${c(e.content)}</pre></details></div>`}nodeView(t,e,i){const s=this.store.get(t.parent),n=!i.startsWith(`n${t.id}:`),r=[["Kind",t.kind]];t.role&&r.push(["Role",c(t.role)]),t.model&&r.push(["Model",`<span class="mono">${c(t.model)}</span>`]),r.push(["Started",t.startedAt!=null?`<span class="mono">T+${b(t.startedAt)}</span>`:"—"]),r.push([t.endedAt!=null?"Took":"Running for",`<span class="el" data-id="${c(t.id)}">${this.ctx.elapsed(t)||"—"}</span>`]),r.push(["Tokens",t.kind==="session"?M(this.store.totalTokens())+" (all)":String(t.tokens||"—")]),s&&r.push(["Parent",`<span class="link" data-pin="${c(s.id)}">${c(s.title)}</span>`]),t.note&&r.push(["Note",c(t.note)]),r.push(["ID",`<span class="mono">${c(t.id)}</span>`]);const a=r.map(([p,g])=>`<div>${p}</div><div>${g}</div>`).join(""),l=(p,g,v)=>{if(v==null)return"";const u=z(v),f=e.has(p)||n&&(tt.includes(p)||p==="out"&&t.kind==="session");return`<details data-k="${p}" ${f?"open":""}><summary>${g}<span class="sm">${u.length} chars</span></summary>
63
62
  <button class="btn copy" data-copy="${p}">copy</button><pre>${c(u)}</pre></details>`},h=t.msgs.map(p=>{const g=this.store.msgs[p],v=g.from===t.id,u=this.store.nodes.get(v?g.to:g.from);return`<details data-k="m${p}" ${e.has("m"+p)?"open":""}><summary><span>${v?"↗ to":"↙ from"} <b>${c(u?.title??"parent")}</b></span>
64
- <span class="sm">T+${x(g.t)}</span></summary><pre>${c(g.content)}</pre></details>`}).join(""),f=t.children.map(p=>{const g=this.store.nodes.get(p);return g?`<span class="chip" data-pin="${c(p)}" style="--d:${k(g)}"><i></i>${c(g.title)}</span>`:""}).join(""),y=t.system||t.input||t.args||t.output||t.result;return`<div class="pbox"><div class="ph"><span>Pinned · ${t.kind}</span><button class="x" data-act="unpin">✕ back to live</button></div>
63
+ <span class="sm">T+${b(g.t)}</span></summary><pre>${c(g.content)}</pre></details>`}).join(""),m=t.children.map(p=>{const g=this.store.nodes.get(p);return g?`<span class="chip" data-pin="${c(p)}" style="--d:${k(g)}"><i></i>${c(g.title)}</span>`:""}).join(""),y=t.system||t.input||t.args||t.output||t.result;return`<div class="pbox"><div class="ph"><span>Pinned · ${t.kind}</span><button class="x" data-act="unpin">✕ back to live</button></div>
65
64
  <div class="ptitle"><span class="dot" style="--d:${k(t)}"></span><span>${c(t.title)}</span><span class="spill" style="--d:${k(t)}">${t.status}</span></div>
66
65
  <div class="kv">${a}</div>
67
66
  ${y?"<h4>Prompts & I/O</h4>":""}
@@ -71,9 +70,9 @@ Second: filter interval change → film-build drift → orange peel.`}),o.sort((
71
70
  ${l("out",t.kind==="llm"?"Completion":"Output",t.output)}
72
71
  ${t.attrs?`<h4>Span attributes</h4>${l("attrs",`${Object.keys(t.attrs).length} attributes`,t.attrs)}`:""}
73
72
  ${h?`<h4>Messages (${t.msgs.length})</h4>${h}`:""}
74
- ${f?`<h4>${t.kind==="agent"?"Calls":"Children"} (${t.children.length})</h4><div>${f}</div>`:""}</div>`}copySection(t){const e=this.store.pinned;if(e&&"msg"in e){const r=this.store.msgs[e.msg];r&&this.ctx.copy(r.content);return}if(!e||!("node"in e))return;const i=this.store.nodes.get(e.node);if(!i)return;const n={sys:i.system,in:i.input,args:i.args,res:i.result,out:i.output,attrs:i.attrs}[t];n!=null&&this.ctx.copy(F(n))}}function st(o){let t;try{t=JSON.parse(o)}catch{t=o.split(`
75
- `).filter(n=>n.trim()).map(n=>JSON.parse(n))}const e=(Array.isArray(t)?t:[t]).filter(n=>typeof n=="object"&&n!==null&&typeof n.type=="string"),i=Math.min(...e.map(n=>n.start_ts??n.ts??1/0));return{script:e.map(n=>{const r=n.t??(n.ts!=null&&Number.isFinite(i)?n.ts-i:0),{t:a,ts:l,...h}=n;return{t:r,ev:h}}).sort((n,r)=>n.t-r.t),base:Number.isFinite(i)?i*1e3:0}}class it{constructor(t){this.h=t}ws=null;retry;connect(t){this.disconnect();try{const e=new WebSocket(t);this.ws=e,this.h.onStatus("connecting…"),e.onopen=()=>{this.h.onStatus("● connected"),this.h.onOpen()},e.onmessage=i=>{try{const s=JSON.parse(String(i.data));this.h.onEvents(Array.isArray(s)?s:[s])}catch{}},e.onerror=()=>this.h.onStatus("Could not connect. Live mode needs `glowtrace serve` running (see README)."),e.onclose=()=>{this.ws===e&&(this.h.onStatus("disconnected — retrying…"),this.h.autoReconnect()&&(this.retry=window.setTimeout(()=>this.connect(t),2e3)))}}catch{this.h.onStatus("WebSocket blocked here — run glowtrace locally for live mode.")}}disconnect(){window.clearTimeout(this.retry);const t=this.ws;this.ws=null,t&&(t.onclose=null,t.close())}}const nt=["title","role","model","system","input","output","args","result","note","attrs"],ot=200;class rt{nodes=new Map;msgs=[];feed=[];roots=[];root=null;pinned=null;last=null;onMessage;onRemove;onReset;apply(t,e,i=0){switch(t.type){case"reset":this.onReset?.(),this.clear();return;case"remove":this.remove(t.id);return;case"node":this.upsert(t,e,i);return;case"update":this.update(t,e,i);return;case"message":this.message(t.from,t.to,t.content??"",t.label??"",t.tokens??0,e);return}}clear(){this.nodes=new Map,this.msgs=[],this.feed=[],this.roots=[],this.root=null,this.pinned=null,this.last=null}get(t){return t==null?void 0:this.nodes.get(t)}walk(t){const e=[],i=s=>{e.push(s);for(const n of s.children){const r=this.nodes.get(n);r&&i(r)}};return i(t),e}totalTokens(){let t=0;for(const e of this.nodes.values())t+=e.tokens||0;for(const e of this.msgs)t+=e.tokens||0;return t}upsert(t,e,i){let s=this.nodes.get(t.id);if(!s)s={id:t.id,kind:t.kind??"agent",parent:t.parent??null,children:[],msgs:[],title:t.id,status:"running",tokens:0,startedAt:null,endedAt:null,v:0,fresh:!0,x:0,cy:0,depth:0,kids:[]},s.kind!=="session"&&(s.parent==null||!this.nodes.has(s.parent))&&this.root&&(s.parent=this.root),this.nodes.set(s.id,s),this.get(s.parent)?.children.push(s.id),s.kind==="session"&&(this.roots.push(s.id),this.root=s.id),this.last=s.id,this.merge(s,t,e,i,!0);else{const r=t.parent!=null?this.nodes.get(t.parent):void 0;if(r&&t.parent!==s.parent&&s.kind!=="session"){const a=this.get(s.parent);a&&(a.children=a.children.filter(l=>l!==s.id)),s.parent=r.id,r.children.push(s.id)}t.kind&&t.kind!==s.kind&&s.kind!=="session"&&(s.kind=t.kind,s.fresh=!0),this.merge(s,t,e,i,!1)}s.title==="…"||s.kind==="step"&&this.get(s.parent)?.kind!=="session"||this.pushFeed({type:"node",id:s.id,title:s.title,detail:`${s.kind} · ${s.status}`,d:k(s),t:e})}update(t,e,i){const s=this.nodes.get(t.id);if(!s)return;const n=s.status;if(this.merge(s,t,e,i,!1),s.status==="running"&&n!=="running"&&(this.last=s.id),t.status==null&&t.note==null)return;const r=`→ ${s.status}${t.note?" · "+t.note:""}`;this.pushFeed({type:"node",id:s.id,title:s.title,detail:r,d:k(s),t:e})}remove(t){const e=this.nodes.get(t);if(!e)return;const i=this.get(e.parent);i&&(i.children=i.children.filter(s=>s!==t));for(const s of e.children){const n=this.nodes.get(s);n&&(n.parent=e.parent,i?.children.push(s))}this.nodes.delete(t),this.roots=this.roots.filter(s=>s!==t),this.pinned&&"node"in this.pinned&&this.pinned.node===t&&(this.pinned=null),this.onRemove?.(e)}message(t,e,i,s,n,r){const a={i:this.msgs.length,from:t,to:e,content:i,label:s,tokens:n,t:r};this.msgs.push(a);const l=this.nodes.get(t),h=this.nodes.get(e);l?.msgs.push(a.i),e!==t&&h?.msgs.push(a.i),this.pushFeed({type:"msg",msg:a.i,fromTitle:l?.title??t,toTitle:h?.title??e,snippet:P(s||i,70),d:l?$[l.kind]:"var(--run)",t:r}),this.onMessage?.(a)}merge(t,e,i,s,n){const r=t,a=e;for(const h of nt)a[h]!==void 0&&(r[h]=a[h]);t.title==null&&(t.title=t.id),e.tokens!=null&&(t.tokens=e.tokens);const l=e.status??(n?"running":void 0);l&&(n||l!==t.status)&&(t.status=l,l==="running"&&t.startedAt==null&&(t.startedAt=i),(l==="done"||l==="error")&&(t.startedAt==null&&(t.startedAt=i),t.endedAt=i)),s&&(e.start_ts!=null&&(t.startedAt=Math.max(0,e.start_ts*1e3-s)),e.end_ts!=null&&(t.endedAt=Math.max(0,e.end_ts*1e3-s))),t.v++}pushFeed(t){this.feed.push(t),this.feed.length>ot&&this.feed.shift()}}const d=o=>{const t=document.querySelector(o);if(!t)throw new Error(`missing element ${o}`);return t},at=7e3;class lt{store=new rt;mode="demo";simT=0;playing=!0;speed=1;script=D;idx=0;endAt=null;liveStart=0;traceBase=0;recorded=[];dirty=!0;get liveLike(){return this.mode==="live"}graph;panel;live;constructor(){const t=e=>e.startedAt==null?"":q((e.endedAt??this.simT)-e.startedAt);this.graph=new Z(this.store,t,e=>this.pin({node:e})),this.panel=new et(d("#side"),this.store,{mode:()=>this.mode,elapsed:t,pin:e=>this.pin(e),copy:e=>z(e)}),this.live=new it({onStatus:e=>d("#liveMsg").textContent=e,onOpen:()=>{this.clearStage(),this.liveStart=0,this.simT=0},onEvents:e=>e.forEach(i=>this.ingest(i)),autoReconnect:()=>!!window.GLOWTRACE_WS&&this.mode==="live"}),this.store.onMessage=e=>this.graph.animate(e,this.speed),this.store.onRemove=e=>this.graph.drop(e.id),this.store.onReset=()=>this.clearStage()}ingest(t){if(!t||!t.type)return;const e=t.start_ts??t.ts;this.liveLike&&e&&((!this.liveStart||t.type==="reset")&&(this.liveStart=e*1e3),this.simT=Math.max(this.simT,Date.now()-this.liveStart));const i=this.liveLike&&t.ts&&this.liveStart?Math.max(0,t.ts*1e3-this.liveStart):this.simT,s=this.liveLike?this.liveStart:this.mode==="trace"?this.traceBase:0;this.recorded.push({...t,t:+(i/1e3).toFixed(2)}),this.store.apply(t,i,s),this.dirty=!0}pin(t){this.store.pinned=t,this.panel.invalidate(),this.dirty=!0}clearStage(){this.graph.clear(),this.store.clear(),this.panel.invalidate(),this.dirty=!0}restart(){this.clearStage(),this.simT=0,this.idx=0,this.endAt=null,this.recorded=[],this.graph.vp.scrollTo({top:0,left:0})}lastFrame=performance.now();lastTick=0;frame=t=>{const e=t-this.lastFrame;if(this.lastFrame=t,this.liveLike)this.liveStart&&(this.simT=Date.now()-this.liveStart);else if(this.playing){for(this.simT+=e*this.speed;this.idx<this.script.length&&this.script[this.idx].t*1e3<=this.simT;)this.ingest(this.script[this.idx++].ev);this.idx>=this.script.length&&this.script.length&&(this.endAt==null?this.endAt=t:this.mode==="demo"&&t-this.endAt>at&&this.restart())}this.dirty&&(this.dirty=!1,this.graph.render(),this.renderChrome(),this.panel.render()),t-this.lastTick>250&&(this.lastTick=t,this.graph.tick(),document.querySelectorAll("#side .el").forEach(i=>{const s=this.store.nodes.get(i.dataset.id??"");s&&s.startedAt!=null&&(i.textContent=q((s.endedAt??this.simT)-s.startedAt))}),d("#clock").textContent="T+"+x(this.simT)),requestAnimationFrame(this.frame)};renderChrome(){const t={running:0,waiting:0,done:0,error:0};for(const i of this.store.nodes.values())i.kind!=="session"&&i.title!=="…"&&t[i.status]++;d("#cRun").textContent=String(t.running),d("#cWait").textContent=String(t.waiting),d("#cDone").textContent=String(t.done),d("#cErr").textContent=String(t.error),d("#cMsg").textContent=String(this.store.msgs.length),d("#cTok").textContent=A(this.store.totalTokens()),d("#replay").style.display=this.liveLike&&this.recorded.length?"":"none",document.body.dataset.mode=this.mode;const e=this.store.get(this.store.root);if(e){const i=this.store.roots.length>1?`${this.store.roots.length} sessions · latest: `:"",s=e.input?P(e.input,90):e.title;d("#sessTitle").textContent=i+s}}setMode(t){this.live.disconnect(),d("#liveBox").style.display=t==="live"?"flex":"none",t==="demo"?(this.mode="demo",this.script=D,this.restart()):t==="live"?(this.mode="live",this.clearStage(),this.simT=0,this.liveStart=0,d("#liveMsg").textContent="Run `glowtrace serve`, then connect."):d("#file").click()}async loadTrace(t){try{const{script:e,base:i}=st(await t.text());this.script=e,this.traceBase=i,this.mode="trace",this.restart(),w(`Loaded ${e.length} events`)}catch{w("Could not parse trace file"),d("#mode").value=this.mode}}replayLive(){if(!this.recorded.length)return;const t=this.liveStart;this.live.disconnect(),this.script=this.recorded.map(e=>({t:e.t??0,ev:e})).sort((e,i)=>e.t-i.t),this.traceBase=t,this.mode="trace",d("#mode").value="trace",d("#liveBox").style.display="none",d("#replay").style.display="none",this.restart(),this.speed=.5,d("#speed").value="0.5",w(`Replaying ${this.script.length} events at ½× — or Pause + Next ▸ for one step at a time`)}stepOnce(){if(this.mode==="live"||this.idx>=this.script.length)return;const t=this.script[this.idx++];this.simT=Math.max(this.simT,t.t*1e3),this.ingest(t.ev)}bindControls(){const t=d("#play");t.onclick=()=>{this.playing=!this.playing,t.textContent=this.playing?"❚❚ Pause":"▶ Play"},d("#next").onclick=()=>{this.playing&&t.click(),this.stepOnce()},d("#replay").onclick=()=>this.replayLive(),d("#restart").onclick=()=>{this.liveLike?(this.clearStage(),this.liveStart=Date.now()):this.restart()};const e=d("#speed");e.onchange=()=>this.speed=Number(e.value);const i=d("#follow");i.onclick=()=>{this.graph.follow=!this.graph.follow,i.classList.toggle("on",this.graph.follow)},d("#copyTrace").onclick=()=>z(this.recorded.map(r=>JSON.stringify(r)).join(`
76
- `)),document.querySelectorAll("[data-z]").forEach(r=>r.onclick=()=>{const a=this.graph;if(r.dataset.z==="+")a.zoom=Math.min(1.6,a.zoom+.1);else if(r.dataset.z==="-")a.zoom=Math.max(.35,a.zoom-.1);else{const l=a.measure();a.zoom=Math.max(.35,Math.min(1.2,(a.vp.clientWidth-20)/l.w,(a.vp.clientHeight-20)/l.h))}this.dirty=!0});const s=d("#mode");s.onchange=()=>this.setMode(s.value==="trace"?"pick-trace":s.value);const n=d("#file");n.onchange=()=>{const r=n.files?.[0];r?this.loadTrace(r):s.value=this.mode,n.value=""},d("#wsGo").onclick=()=>this.live.connect(d("#wsUrl").value.trim()),this.graph.vp.addEventListener("click",r=>{r.target.closest(".nd")||this.pin(null)})}boot(){if(this.bindControls(),window.GLOWTRACE_WS){const e=(location.protocol==="https:"?"wss://":"ws://")+location.host+window.GLOWTRACE_WS;d("#wsUrl").value=e,d("#mode").value="live",this.setMode("live"),this.live.connect(e)}const t=this.graph.vp.clientWidth;t<760&&(this.graph.zoom=Math.max(.45,(t-10)/1e3)),requestAnimationFrame(this.frame)}}function z(o){try{navigator.clipboard.writeText(o).then(()=>w("Copied"),()=>w("Copy blocked here"))}catch{w("Copy blocked here")}}let V;function w(o){const t=d("#toast");t.textContent=o,t.classList.add("show"),window.clearTimeout(V),V=window.setTimeout(()=>t.classList.remove("show"),1600)}const B=new lt;B.boot();window.glowtrace=B;</script>
73
+ ${m?`<h4>${t.kind==="agent"?"Calls":"Children"} (${t.children.length})</h4><div>${m}</div>`:""}</div>`}copySection(t){const e=this.store.pinned;if(e&&"msg"in e){const r=this.store.msgs[e.msg];r&&this.ctx.copy(r.content);return}if(!e||!("node"in e))return;const i=this.store.nodes.get(e.node);if(!i)return;const n={sys:i.system,in:i.input,args:i.args,res:i.result,out:i.output,attrs:i.attrs}[t];n!=null&&this.ctx.copy(z(n))}}function st(o){let t;try{t=JSON.parse(o)}catch{t=o.split(`
74
+ `).filter(n=>n.trim()).map(n=>JSON.parse(n))}const e=(Array.isArray(t)?t:[t]).filter(n=>typeof n=="object"&&n!==null&&typeof n.type=="string"),i=Math.min(...e.map(n=>n.start_ts??n.ts??1/0));return{script:e.map(n=>{const r=n.t??(n.ts!=null&&Number.isFinite(i)?n.ts-i:0),{t:a,ts:l,...h}=n;return{t:r,ev:h}}).sort((n,r)=>n.t-r.t),base:Number.isFinite(i)?i*1e3:0}}class it{constructor(t){this.h=t}ws=null;retry;connect(t){this.disconnect();try{const e=new WebSocket(t);this.ws=e,this.h.onStatus("connecting…"),e.onopen=()=>{this.h.onStatus("● connected"),this.h.onOpen()},e.onmessage=i=>{try{const s=JSON.parse(String(i.data));this.h.onEvents(Array.isArray(s)?s:[s])}catch{}},e.onerror=()=>this.h.onStatus("Could not connect. Live mode needs `glowtrace serve` running (see README)."),e.onclose=()=>{this.ws===e&&(this.h.onStatus("disconnected — retrying…"),this.h.autoReconnect()&&(this.retry=window.setTimeout(()=>this.connect(t),2e3)))}}catch{this.h.onStatus("WebSocket blocked here — run glowtrace locally for live mode.")}}disconnect(){window.clearTimeout(this.retry);const t=this.ws;this.ws=null,t&&(t.onclose=null,t.close())}}const nt=["title","role","model","system","input","output","args","result","note","attrs"],ot=200;class rt{nodes=new Map;msgs=[];feed=[];roots=[];root=null;pinned=null;last=null;onMessage;onRemove;onReset;apply(t,e,i=0){switch(t.type){case"reset":this.onReset?.(),this.clear();return;case"remove":this.remove(t.id);return;case"node":this.upsert(t,e,i);return;case"update":this.update(t,e,i);return;case"message":this.message(t.from,t.to,t.content??"",t.label??"",t.tokens??0,e);return}}clear(){this.nodes=new Map,this.msgs=[],this.feed=[],this.roots=[],this.root=null,this.pinned=null,this.last=null}get(t){return t==null?void 0:this.nodes.get(t)}walk(t){const e=[],i=s=>{e.push(s);for(const n of s.children){const r=this.nodes.get(n);r&&i(r)}};return i(t),e}totalTokens(){let t=0;for(const e of this.nodes.values())t+=e.tokens||0;for(const e of this.msgs)t+=e.tokens||0;return t}upsert(t,e,i){let s=this.nodes.get(t.id);if(!s)s={id:t.id,kind:t.kind??"agent",parent:t.parent??null,children:[],msgs:[],title:t.id,status:"running",tokens:0,startedAt:null,endedAt:null,v:0,fresh:!0,x:0,cy:0,depth:0,kids:[]},s.kind!=="session"&&(s.parent==null||!this.nodes.has(s.parent))&&this.root&&(s.parent=this.root),this.nodes.set(s.id,s),this.get(s.parent)?.children.push(s.id),s.kind==="session"&&(this.roots.push(s.id),this.root=s.id),this.last=s.id,this.merge(s,t,e,i,!0);else{const r=t.parent!=null?this.nodes.get(t.parent):void 0;if(r&&t.parent!==s.parent&&s.kind!=="session"){const a=this.get(s.parent);a&&(a.children=a.children.filter(l=>l!==s.id)),s.parent=r.id,r.children.push(s.id)}t.kind&&t.kind!==s.kind&&s.kind!=="session"&&(s.kind=t.kind,s.fresh=!0),this.merge(s,t,e,i,!1)}s.title==="…"||s.kind==="step"&&this.get(s.parent)?.kind!=="session"||this.pushFeed({type:"node",id:s.id,title:s.title,detail:`${s.kind} · ${s.status}`,d:k(s),t:e})}update(t,e,i){const s=this.nodes.get(t.id);if(!s)return;const n=s.status;if(this.merge(s,t,e,i,!1),s.status==="running"&&n!=="running"&&(this.last=s.id),t.status==null&&t.note==null)return;const r=`→ ${s.status}${t.note?" · "+t.note:""}`;this.pushFeed({type:"node",id:s.id,title:s.title,detail:r,d:k(s),t:e})}remove(t){const e=this.nodes.get(t);if(!e)return;const i=this.get(e.parent);i&&(i.children=i.children.filter(s=>s!==t));for(const s of e.children){const n=this.nodes.get(s);n&&(n.parent=e.parent,i?.children.push(s))}this.nodes.delete(t),this.roots=this.roots.filter(s=>s!==t),this.pinned&&"node"in this.pinned&&this.pinned.node===t&&(this.pinned=null),this.onRemove?.(e)}message(t,e,i,s,n,r){const a={i:this.msgs.length,from:t,to:e,content:i,label:s,tokens:n,t:r};this.msgs.push(a);const l=this.nodes.get(t),h=this.nodes.get(e);l?.msgs.push(a.i),e!==t&&h?.msgs.push(a.i),this.pushFeed({type:"msg",msg:a.i,fromTitle:l?.title??t,toTitle:h?.title??e,snippet:E(s||i,70),d:l?$[l.kind]:"var(--run)",t:r}),this.onMessage?.(a)}merge(t,e,i,s,n){const r=t,a=e;for(const h of nt)a[h]!==void 0&&(r[h]=a[h]);t.title==null&&(t.title=t.id),e.tokens!=null&&(t.tokens=e.tokens);const l=e.status??(n?"running":void 0);l&&(n||l!==t.status)&&(t.status=l,l==="running"&&t.startedAt==null&&(t.startedAt=i),(l==="done"||l==="error")&&(t.startedAt==null&&(t.startedAt=i),t.endedAt=i)),s&&(e.start_ts!=null&&(t.startedAt=Math.max(0,e.start_ts*1e3-s)),e.end_ts!=null&&(t.endedAt=Math.max(0,e.end_ts*1e3-s))),t.v++}pushFeed(t){this.feed.push(t),this.feed.length>ot&&this.feed.shift()}}const d=o=>{const t=document.querySelector(o);if(!t)throw new Error(`missing element ${o}`);return t},at=7e3;class lt{store=new rt;mode="demo";simT=0;playing=!0;speed=1;script=F;idx=0;endAt=null;liveStart=0;traceBase=0;recorded=[];dirty=!0;get liveLike(){return this.mode==="live"}graph;panel;live;constructor(){const t=e=>e.startedAt==null?"":D((e.endedAt??this.simT)-e.startedAt);this.graph=new Z(this.store,t,e=>this.pin({node:e})),this.panel=new et(d("#side"),this.store,{mode:()=>this.mode,elapsed:t,pin:e=>this.pin(e),copy:e=>W(e)}),this.live=new it({onStatus:e=>d("#liveMsg").textContent=e,onOpen:()=>{this.clearStage(),this.liveStart=0,this.simT=0},onEvents:e=>e.forEach(i=>this.ingest(i)),autoReconnect:()=>!!window.GLOWTRACE_WS&&this.mode==="live"}),this.store.onMessage=e=>this.graph.animate(e,this.speed),this.store.onRemove=e=>this.graph.drop(e.id),this.store.onReset=()=>this.clearStage()}ingest(t){if(!t||!t.type)return;const e=t.start_ts??t.ts;this.liveLike&&e&&((!this.liveStart||t.type==="reset")&&(this.liveStart=e*1e3),this.simT=Math.max(this.simT,Date.now()-this.liveStart));const i=this.liveLike&&t.ts&&this.liveStart?Math.max(0,t.ts*1e3-this.liveStart):this.simT,s=this.liveLike?this.liveStart:this.mode==="trace"?this.traceBase:0;this.recorded.push({...t,t:+(i/1e3).toFixed(2)}),this.store.apply(t,i,s),this.dirty=!0}pin(t){this.store.pinned=t,this.panel.invalidate(),this.dirty=!0}clearStage(){this.graph.clear(),this.store.clear(),this.panel.invalidate(),this.dirty=!0}restart(){this.clearStage(),this.simT=0,this.idx=0,this.endAt=null,this.recorded=[],this.graph.vp.scrollTo({top:0,left:0})}lastFrame=performance.now();lastTick=0;frame=t=>{const e=t-this.lastFrame;if(this.lastFrame=t,this.liveLike)this.liveStart&&(this.simT=Date.now()-this.liveStart);else if(this.playing){for(this.simT+=e*this.speed;this.idx<this.script.length&&this.script[this.idx].t*1e3<=this.simT;)this.ingest(this.script[this.idx++].ev);this.idx>=this.script.length&&this.script.length&&(this.endAt==null?this.endAt=t:this.mode==="demo"&&t-this.endAt>at&&this.restart())}this.dirty&&(this.dirty=!1,this.graph.render(),this.renderChrome(),this.panel.render()),t-this.lastTick>250&&(this.lastTick=t,this.graph.tick(),document.querySelectorAll("#side .el").forEach(i=>{const s=this.store.nodes.get(i.dataset.id??"");s&&s.startedAt!=null&&(i.textContent=D((s.endedAt??this.simT)-s.startedAt))}),d("#clock").textContent="T+"+b(this.simT)),requestAnimationFrame(this.frame)};renderChrome(){const t={running:0,waiting:0,done:0,error:0};for(const i of this.store.nodes.values())i.kind!=="session"&&i.title!=="…"&&t[i.status]++;d("#cRun").textContent=String(t.running),d("#cWait").textContent=String(t.waiting),d("#cDone").textContent=String(t.done),d("#cErr").textContent=String(t.error),d("#cMsg").textContent=String(this.store.msgs.length),d("#cTok").textContent=M(this.store.totalTokens()),d("#replay").style.display=this.liveLike&&this.recorded.length?"":"none",document.body.dataset.mode=this.mode;const e=this.store.get(this.store.root);if(e){const i=this.store.roots.length>1?`${this.store.roots.length} sessions · latest: `:"",s=e.input?E(e.input,90):e.title;d("#sessTitle").textContent=i+s}}setMode(t){this.live.disconnect(),d("#liveBox").style.display=t==="live"?"flex":"none",t==="demo"?(this.mode="demo",this.script=F,this.restart()):t==="live"?(this.mode="live",this.clearStage(),this.simT=0,this.liveStart=0,d("#liveMsg").textContent="Run `glowtrace serve`, then connect."):d("#file").click()}async loadTrace(t){try{const{script:e,base:i}=st(await t.text());this.script=e,this.traceBase=i,this.mode="trace",this.restart(),w(`Loaded ${e.length} events`)}catch{w("Could not parse trace file"),d("#mode").value=this.mode}}replayLive(){if(!this.recorded.length)return;const t=this.liveStart;this.live.disconnect(),this.script=this.recorded.map(e=>({t:e.t??0,ev:e})).sort((e,i)=>e.t-i.t),this.traceBase=t,this.mode="trace",d("#mode").value="trace",d("#liveBox").style.display="none",d("#replay").style.display="none",this.restart(),this.speed=.5,d("#speed").value="0.5",w(`Replaying ${this.script.length} events at ½× — or Pause + Next ▸ for one step at a time`)}stepOnce(){if(this.mode==="live"||this.idx>=this.script.length)return;const t=this.script[this.idx++];this.simT=Math.max(this.simT,t.t*1e3),this.ingest(t.ev)}bindControls(){const t=d("#play");t.onclick=()=>{this.playing=!this.playing,t.textContent=this.playing?"❚❚ Pause":"▶ Play"},d("#next").onclick=()=>{this.playing&&t.click(),this.stepOnce()},d("#replay").onclick=()=>this.replayLive(),d("#restart").onclick=()=>{this.liveLike?(this.clearStage(),this.liveStart=Date.now()):this.restart()};const e=d("#speed");e.onchange=()=>this.speed=Number(e.value);const i=d("#follow");i.onclick=()=>{this.graph.follow=!this.graph.follow,i.classList.toggle("on",this.graph.follow)},d("#copyTrace").onclick=()=>W(this.recorded.map(r=>JSON.stringify(r)).join(`
75
+ `)),document.querySelectorAll("[data-z]").forEach(r=>r.onclick=()=>{const a=this.graph;if(r.dataset.z==="+")a.zoom=Math.min(1.6,a.zoom+.1);else if(r.dataset.z==="-")a.zoom=Math.max(.35,a.zoom-.1);else{const l=a.measure();a.zoom=Math.max(.35,Math.min(1.2,(a.vp.clientWidth-20)/l.w,(a.vp.clientHeight-20)/l.h))}this.dirty=!0});const s=d("#mode");s.onchange=()=>this.setMode(s.value==="trace"?"pick-trace":s.value);const n=d("#file");n.onchange=()=>{const r=n.files?.[0];r?this.loadTrace(r):s.value=this.mode,n.value=""},d("#wsGo").onclick=()=>this.live.connect(d("#wsUrl").value.trim()),this.graph.vp.addEventListener("click",r=>{r.target.closest(".nd")||this.pin(null)})}boot(){if(this.bindControls(),window.GLOWTRACE_WS){const e=(location.protocol==="https:"?"wss://":"ws://")+location.host+window.GLOWTRACE_WS;d("#wsUrl").value=e,d("#mode").value="live",this.setMode("live"),this.live.connect(e)}const t=this.graph.vp.clientWidth;t<760&&(this.graph.zoom=Math.max(.45,(t-10)/1e3)),requestAnimationFrame(this.frame)}}function W(o){try{navigator.clipboard.writeText(o).then(()=>w("Copied"),()=>w("Copy blocked here"))}catch{w("Copy blocked here")}}let H;function w(o){const t=d("#toast");t.textContent=o,t.classList.add("show"),window.clearTimeout(H),H=window.setTimeout(()=>t.classList.remove("show"),1600)}const G=new lt;G.boot();window.glowtrace=G;</script>
77
76
  <style rel="stylesheet" crossorigin>:root{--bg0:#060a18;--bg1:#0c1330;--text:#e7ecff;--mute:#8f9bc9;--dim:#5a6694;--run:#a78bfa;--agent:#ffb454;--tool:#3fd8ff;--llm:#ff7ad9;--done:#3ee6a8;--wait:#6b7499;--err:#ff5c7a;--card:rgba(18,26,62,.88)}*{box-sizing:border-box}html,body{margin:0;height:100%;color:var(--text);font-family:Inter,system-ui,-apple-system,sans-serif;overflow:hidden;background:radial-gradient(1100px 700px at 28% 18%,#1a2763 0%,var(--bg1) 45%,var(--bg0) 100%)}button,select,input{font:inherit;color:inherit}.mono{font-family:JetBrains Mono,ui-monospace,monospace}#top{height:54px;display:flex;align-items:center;gap:14px;padding:0 16px;border-bottom:1px solid rgba(120,140,255,.14);background:linear-gradient(180deg,#0a1028e6,#0a10288c);backdrop-filter:blur(8px)}.brand{display:flex;align-items:center;gap:9px;font-weight:700;letter-spacing:.2px;white-space:nowrap}.brand i{width:12px;height:12px;border-radius:50%;background:var(--run);box-shadow:0 0 12px var(--run),0 0 26px var(--run)}.stat{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--mute);white-space:nowrap}.stat b{color:var(--text);font-weight:600}.stat i{width:8px;height:8px;border-radius:50%;background:var(--d);box-shadow:0 0 8px var(--d)}.sp{flex:1}.ctl{display:flex;align-items:center;gap:6px}.btn{background:#28346e8c;border:1px solid rgba(130,150,255,.22);border-radius:9px;padding:5px 10px;font-size:12px;cursor:pointer;white-space:nowrap}.btn:hover{border-color:#a78bfab3;box-shadow:0 0 12px -2px #a78bfa99}.btn.on{background:#7c5cff59;border-color:var(--run)}select.btn{padding:5px 8px}#liveBox{display:none;gap:6px;align-items:center}#liveBox input{background:#0a1028cc;border:1px solid rgba(130,150,255,.25);border-radius:8px;padding:5px 8px;font-size:12px;width:170px}#liveMsg{font-size:11px;color:var(--mute);max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#main{display:grid;grid-template-columns:1fr 370px;height:calc(100% - 54px)}#left{padding:14px 10px 14px 14px;min-width:0;display:flex;flex-direction:column}.cap{font-size:10.5px;letter-spacing:1.4px;color:var(--dim);text-transform:uppercase;margin:0 0 8px 6px;display:flex;gap:14px;align-items:center}.cap b{color:var(--mute);font-weight:600}.legend{display:flex;gap:12px;margin-left:auto;text-transform:none;letter-spacing:0}.legend span{display:flex;align-items:center;gap:5px;white-space:nowrap}.legend i{width:9px;height:9px;border-radius:3px;border:1.5px solid var(--d);box-shadow:0 0 6px var(--d)}#frame{flex:1;position:relative;border-radius:18px;border:1px solid rgba(110,140,255,.22);overflow:hidden;background:linear-gradient(180deg,#1c285c73,#10183a8c);box-shadow:0 0 0 1px #ffffff05 inset,0 0 40px -12px #5a78ff73}#vp{position:absolute;inset:0;overflow:auto;background-image:radial-gradient(rgba(130,150,230,.12) 1px,transparent 1px);background-size:22px 22px}#sizer{position:relative}#stage{position:absolute;left:0;top:0;transform-origin:0 0}#edges,#fx{position:absolute;left:0;top:0;overflow:visible;pointer-events:none}.eg{fill:none;stroke-width:7;opacity:.22;filter:blur(3px)}.ec{fill:none;stroke-width:1.7;stroke-linecap:round}.ec.flow{stroke-dasharray:5 7;animation:flow .9s linear infinite}.ec.wait{stroke-dasharray:2 5;opacity:.7}.ec.done{opacity:.55}@keyframes flow{to{stroke-dashoffset:-24}}.ptrail{fill:none;stroke-width:2.2;opacity:.45;filter:blur(1.5px);transition:opacity .4s}#zoom{position:absolute;right:12px;bottom:12px;display:flex;gap:4px;z-index:5}#zoom .btn{padding:4px 9px}.nd{position:absolute;cursor:pointer;transition:top .45s cubic-bezier(.2,.8,.2,1),left .45s,opacity .4s,box-shadow .3s,border-color .3s}.nd.enter{animation:pop .45s cubic-bezier(.2,.9,.3,1.3)}@keyframes pop{0%{opacity:0;transform:translate(-14px) scale(.96)}to{opacity:1;transform:none}}.card{height:48px;border-radius:12px;padding:7px 12px 7px 30px;background:var(--card);border:1px solid var(--c);box-shadow:0 0 18px -5px var(--c),inset 0 0 14px -8px var(--c)}.card.s-done{box-shadow:none;background:#121a3e99}.card.s-waiting{border-style:dashed;box-shadow:none;background:#121a3e73}.card:hover,.card.pinned{box-shadow:0 0 0 1px var(--c),0 0 26px -2px var(--c)}.card.pinned{border-color:#fff}.card .dot{position:absolute;left:11px;top:50%;width:9px;height:9px;margin-top:-4.5px;border-radius:50%;background:var(--d);box-shadow:0 0 8px var(--d)}.s-running .dot{animation:pulse 1.2s ease-in-out infinite}@keyframes pulse{0%,to{box-shadow:0 0 4px var(--d),0 0 0 0 var(--d)}50%{box-shadow:0 0 12px var(--d),0 0 0 4px transparent}}.card .t{font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:44px}.card .s{font-size:11px;color:var(--mute);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}.card .tk{position:absolute;right:9px;top:7px;font-size:10px;color:var(--mute);background:#788cff1f;border-radius:6px;padding:1px 6px}.k-step .num{position:absolute;left:6px;top:50%;margin-top:-9px;width:18px;height:18px;border-radius:50%;border:1.5px solid var(--d);font-size:10px;display:grid;place-items:center;color:var(--text);background:#0c1330;box-shadow:0 0 8px -1px var(--d)}.k-step .dot{display:none}.k-llm .t{font-size:11.5px}.k-tool .t{font-family:JetBrains Mono,monospace;font-weight:500;font-size:11.5px}.card.ping{animation:ping .6s ease-out}@keyframes ping{0%{box-shadow:0 0 0 0 var(--c),0 0 30px 2px var(--c)}to{box-shadow:0 0 18px -5px var(--c)}}.root{width:118px;height:118px;border-radius:50%;display:grid;place-items:center;text-align:center;background:radial-gradient(circle at 50% 40%,#2a3a8a,#121a48 70%);border:2px solid var(--c);box-shadow:0 0 22px var(--c),0 0 60px -10px var(--c),inset 0 0 24px -6px var(--c)}.root .ring{position:absolute;inset:-9px;border-radius:50%;border:1px solid var(--c);opacity:.4}.root.s-running .ring{animation:ring 2.2s ease-out infinite}@keyframes ring{0%{transform:scale(.92);opacity:.7}to{transform:scale(1.18);opacity:0}}.root .rt{font-weight:700;font-size:13px}.root .rs{font-size:10px;color:var(--mute);margin-top:3px;line-height:1.35}.root.pinned{border-color:#fff}#side{border-left:1px solid rgba(120,140,255,.14);padding:14px;overflow:auto;background:#080c2059}.pbox{border-radius:14px;border:1px solid rgba(120,150,255,.3);background:#141e48b8;padding:14px;box-shadow:0 0 30px -14px #7896ffcc}.ph{display:flex;align-items:center;justify-content:space-between;font-size:10.5px;letter-spacing:1.3px;text-transform:uppercase;color:var(--dim);margin-bottom:10px}.x{background:none;border:none;color:var(--mute);cursor:pointer;font-size:11px;letter-spacing:0;text-transform:none}.x:hover{color:var(--text)}.ptitle{display:flex;gap:9px;align-items:flex-start;font-weight:700;font-size:15px;line-height:1.3;margin-bottom:12px}.ptitle .dot{flex:none;width:9px;height:9px;border-radius:50%;margin-top:6px;background:var(--d);box-shadow:0 0 8px var(--d)}.spill{margin-left:auto;flex:none;font-size:10.5px;font-weight:600;padding:2px 9px;border-radius:999px;border:1px solid var(--d);color:var(--d);background:#0003}.kv{display:grid;grid-template-columns:96px 1fr;gap:5px 10px;font-size:12px;margin-bottom:6px}.kv div:nth-child(odd){color:var(--mute)}.kv .link{color:#c7b8ff;cursor:pointer}h4{font-size:10.5px;letter-spacing:1.3px;text-transform:uppercase;color:var(--dim);margin:16px 0 7px;font-weight:600}details{border:1px solid rgba(120,150,255,.18);border-radius:10px;margin-bottom:7px;background:#080c2273}summary{cursor:pointer;padding:7px 10px;font-size:12px;list-style:none;display:flex;gap:7px;align-items:center}summary::-webkit-details-marker{display:none}summary:before{content:"›";color:var(--mute);transition:transform .2s;display:inline-block}details[open] summary:before{transform:rotate(90deg)}summary .sm{color:var(--mute);margin-left:auto;font-size:10.5px;white-space:nowrap}pre{margin:0;padding:9px 11px;border-top:1px solid rgba(120,150,255,.14);font:11.5px/1.5 JetBrains Mono,monospace;white-space:pre-wrap;word-break:break-word;color:#d4dbff;max-height:300px;overflow:auto}.copy{float:right;margin:6px 8px 0 0;font-size:10.5px;padding:2px 7px}.chip{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;padding:4px 9px;border-radius:8px;border:1px solid rgba(120,150,255,.2);margin:0 6px 6px 0;cursor:pointer;background:#080c2273}.chip i{width:7px;height:7px;border-radius:50%;background:var(--d)}.chip:hover{border-color:var(--run)}.feed{display:flex;flex-direction:column;gap:2px}.fi{display:grid;grid-template-columns:46px 10px 1fr;gap:8px;align-items:start;font-size:12px;padding:6px 7px;border-radius:8px;cursor:pointer;line-height:1.35}.fi:hover{background:#788cff1a}.fi .ft{color:var(--dim);font-family:JetBrains Mono,monospace;font-size:10.5px;padding-top:1px}.fi .fd{width:8px;height:8px;border-radius:50%;background:var(--d);box-shadow:0 0 6px var(--d);margin-top:4px}.fi .ar{color:var(--mute)}.fi.new{animation:fin .5s}@keyframes fin{0%{background:#a78bfa40}to{background:transparent}}.hint{font-size:11.5px;color:var(--mute);line-height:1.5;margin:4px 0 12px}#toast{position:fixed;left:50%;bottom:22px;transform:translate(-50%) translateY(20px);opacity:0;background:#1d2a66;border:1px solid var(--run);padding:7px 14px;border-radius:10px;font-size:12px;transition:.3s;pointer-events:none;z-index:50}#toast.show{opacity:1;transform:translate(-50%)}@media(max-width:900px){#top{height:auto;flex-wrap:wrap;padding:8px 10px;gap:8px}.stat.hide-m,.legend{display:none}#main{grid-template-columns:1fr;grid-template-rows:58% 42%;height:calc(100% - 92px)}#side{border-left:none;border-top:1px solid rgba(120,140,255,.18)}#left{padding:8px}}body[data-mode=live] .no-live{display:none}@media(max-width:1500px){.stat.hide-m{display:none}#liveMsg{max-width:110px}}body{display:flex;flex-direction:column}#top{flex:none}#main{flex:1;min-height:0;height:auto}@media(max-width:900px){#main{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,58fr) minmax(0,42fr);height:auto}#top .ctl{flex-wrap:wrap;width:100%;gap:6px}#liveBox{flex:1 1 100%;order:-1}#liveBox input{flex:1;width:auto;min-width:0}#follow,#copyTrace,.stat:has(#cWait),.stat:has(#cErr),#clock{display:none}}</style>
78
77
  </head>
79
78
  <body>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glowtrace
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: See your multi-agent LLM app as a live graph: which agent is running, what it sent, and what came back.
5
5
  Author: Eman Khadim
6
6
  License-Expression: MIT
@@ -9,14 +9,14 @@ Project-URL: Source, https://github.com/emankhadim/glowtrace
9
9
  Project-URL: Issues, https://github.com/emankhadim/glowtrace/issues
10
10
  Keywords: agents,llm,opentelemetry,observability,tracing,multi-agent,visualization,genai
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Topic :: Software Development :: Debuggers
17
17
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
18
  Classifier: Framework :: AsyncIO
19
- Requires-Python: >=3.9
19
+ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: aiohttp>=3.9
@@ -36,6 +36,8 @@ Dynamic: license-file
36
36
 
37
37
  ![glowtrace demo](https://raw.githubusercontent.com/emankhadim/glowtrace/main/docs/demo.gif)
38
38
 
39
+ **[Try the demo in your browser](https://emankhadim.github.io/glowtrace/)**: it plays a built-in sample run, no install needed.
40
+
39
41
  When three or four agents start passing work to each other, logs stop being enough. You can't tell which agent is stuck, which tool call failed, or what prompt actually went to the model. glowtrace shows you that while the run is happening.
40
42
 
41
43
  - **Two commands, no code changes** for apps that already export OpenTelemetry traces
@@ -4,19 +4,19 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "glowtrace"
7
- version = "0.3.2"
7
+ version = "0.3.3"
8
8
  description = "See your multi-agent LLM app as a live graph: which agent is running, what it sent, and what came back."
9
9
  readme = "README.md"
10
- requires-python = ">=3.9"
10
+ requires-python = ">=3.10"
11
11
  license = "MIT"
12
12
  license-files = ["LICENSE"]
13
13
  authors = [{name = "Eman Khadim"}]
14
14
  classifiers = [
15
15
  "Programming Language :: Python :: 3",
16
- "Programming Language :: Python :: 3.9",
17
16
  "Programming Language :: Python :: 3.10",
18
17
  "Programming Language :: Python :: 3.11",
19
18
  "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
20
  "Topic :: Software Development :: Debuggers",
21
21
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
22
  "Framework :: AsyncIO",
@@ -41,3 +41,6 @@ include = ["glowtrace*"]
41
41
 
42
42
  [tool.setuptools.package-data]
43
43
  glowtrace = ["static/*.html"]
44
+
45
+ [tool.pytest.ini_options]
46
+ testpaths = ["tests"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes