@0xmaxma/claude-gateway 2.0.4 → 2.0.6

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.
Files changed (276) hide show
  1. package/README.md +10 -1
  2. package/dist/agent/builtin-commands.d.ts +1 -1
  3. package/dist/agent/builtin-commands.d.ts.map +1 -1
  4. package/dist/agent/builtin-commands.js +3 -2
  5. package/dist/agent/builtin-commands.js.map +1 -1
  6. package/dist/agent/runner.d.ts +123 -9
  7. package/dist/agent/runner.d.ts.map +1 -1
  8. package/dist/agent/runner.js +215 -182
  9. package/dist/agent/runner.js.map +1 -1
  10. package/dist/agent/session-compaction-scheduler.d.ts +22 -0
  11. package/dist/agent/session-compaction-scheduler.d.ts.map +1 -0
  12. package/dist/agent/session-compaction-scheduler.js +40 -0
  13. package/dist/agent/session-compaction-scheduler.js.map +1 -0
  14. package/dist/agent/skill-learning/index.d.ts.map +1 -1
  15. package/dist/agent/skill-learning/index.js +27 -8
  16. package/dist/agent/skill-learning/index.js.map +1 -1
  17. package/dist/agent/skill-learning/reviewer.d.ts +3 -1
  18. package/dist/agent/skill-learning/reviewer.d.ts.map +1 -1
  19. package/dist/agent/skill-learning/reviewer.js +6 -2
  20. package/dist/agent/skill-learning/reviewer.js.map +1 -1
  21. package/dist/agent/turn-stream.d.ts +3 -1
  22. package/dist/agent/turn-stream.d.ts.map +1 -1
  23. package/dist/agent/turn-stream.js +8 -4
  24. package/dist/agent/turn-stream.js.map +1 -1
  25. package/dist/api/gateway-router.d.ts +2 -0
  26. package/dist/api/gateway-router.d.ts.map +1 -1
  27. package/dist/api/gateway-router.js +323 -16
  28. package/dist/api/gateway-router.js.map +1 -1
  29. package/dist/api/memory-activity.d.ts +18 -0
  30. package/dist/api/memory-activity.d.ts.map +1 -0
  31. package/dist/api/memory-activity.js +97 -0
  32. package/dist/api/memory-activity.js.map +1 -0
  33. package/dist/api/router.js +11 -11
  34. package/dist/api/router.js.map +1 -1
  35. package/dist/api/slack-webhook-router.js +1 -1
  36. package/dist/api/slack-webhook-router.js.map +1 -1
  37. package/dist/api/voice-router.d.ts +1 -0
  38. package/dist/api/voice-router.d.ts.map +1 -1
  39. package/dist/api/voice-router.js +129 -7
  40. package/dist/api/voice-router.js.map +1 -1
  41. package/dist/config/claude-settings.d.ts +14 -0
  42. package/dist/config/claude-settings.d.ts.map +1 -1
  43. package/dist/config/claude-settings.js +20 -0
  44. package/dist/config/claude-settings.js.map +1 -1
  45. package/dist/orchestration/agent-cli-session.d.ts +46 -0
  46. package/dist/orchestration/agent-cli-session.d.ts.map +1 -0
  47. package/dist/orchestration/agent-cli-session.js +121 -0
  48. package/dist/orchestration/agent-cli-session.js.map +1 -0
  49. package/dist/orchestration/agent-tool-schemas.d.ts +6 -0
  50. package/dist/orchestration/agent-tool-schemas.d.ts.map +1 -0
  51. package/dist/orchestration/agent-tool-schemas.js +23 -0
  52. package/dist/orchestration/agent-tool-schemas.js.map +1 -0
  53. package/dist/orchestration/bridge.d.ts +6 -3
  54. package/dist/orchestration/bridge.d.ts.map +1 -1
  55. package/dist/orchestration/bridge.js +31 -14
  56. package/dist/orchestration/bridge.js.map +1 -1
  57. package/dist/orchestration/browser-voice.d.ts +14 -0
  58. package/dist/orchestration/browser-voice.d.ts.map +1 -0
  59. package/dist/orchestration/browser-voice.js +30 -0
  60. package/dist/orchestration/browser-voice.js.map +1 -0
  61. package/dist/orchestration/compact-measurements.d.ts +21 -0
  62. package/dist/orchestration/compact-measurements.d.ts.map +1 -0
  63. package/dist/orchestration/compact-measurements.js +62 -0
  64. package/dist/orchestration/compact-measurements.js.map +1 -0
  65. package/dist/orchestration/config.d.ts +4 -0
  66. package/dist/orchestration/config.d.ts.map +1 -1
  67. package/dist/orchestration/config.js +1 -1
  68. package/dist/orchestration/config.js.map +1 -1
  69. package/dist/orchestration/context-delivery.d.ts +32 -0
  70. package/dist/orchestration/context-delivery.d.ts.map +1 -0
  71. package/dist/orchestration/context-delivery.js +101 -0
  72. package/dist/orchestration/context-delivery.js.map +1 -0
  73. package/dist/orchestration/context-footprint.d.ts +14 -0
  74. package/dist/orchestration/context-footprint.d.ts.map +1 -0
  75. package/dist/orchestration/context-footprint.js +57 -0
  76. package/dist/orchestration/context-footprint.js.map +1 -0
  77. package/dist/orchestration/conversation-intake.d.ts +10 -6
  78. package/dist/orchestration/conversation-intake.d.ts.map +1 -1
  79. package/dist/orchestration/conversation-intake.js +22 -8
  80. package/dist/orchestration/conversation-intake.js.map +1 -1
  81. package/dist/orchestration/dashboard-charts.d.ts +32 -0
  82. package/dist/orchestration/dashboard-charts.d.ts.map +1 -0
  83. package/dist/orchestration/dashboard-charts.js +77 -0
  84. package/dist/orchestration/dashboard-charts.js.map +1 -0
  85. package/dist/orchestration/dashboard-reader-worker.d.ts +2 -0
  86. package/dist/orchestration/dashboard-reader-worker.d.ts.map +1 -0
  87. package/dist/orchestration/dashboard-reader-worker.js +173 -0
  88. package/dist/orchestration/dashboard-reader-worker.js.map +1 -0
  89. package/dist/orchestration/dashboard-reader.d.ts +15 -0
  90. package/dist/orchestration/dashboard-reader.d.ts.map +1 -0
  91. package/dist/orchestration/dashboard-reader.js +87 -0
  92. package/dist/orchestration/dashboard-reader.js.map +1 -0
  93. package/dist/orchestration/decision-context.d.ts +15 -0
  94. package/dist/orchestration/decision-context.d.ts.map +1 -0
  95. package/dist/orchestration/decision-context.js +57 -0
  96. package/dist/orchestration/decision-context.js.map +1 -0
  97. package/dist/orchestration/display-stream.d.ts +21 -2
  98. package/dist/orchestration/display-stream.d.ts.map +1 -1
  99. package/dist/orchestration/display-stream.js +61 -8
  100. package/dist/orchestration/display-stream.js.map +1 -1
  101. package/dist/orchestration/inference-errors.d.ts.map +1 -1
  102. package/dist/orchestration/inference-errors.js +19 -21
  103. package/dist/orchestration/inference-errors.js.map +1 -1
  104. package/dist/orchestration/mutation-recovery.d.ts +13 -0
  105. package/dist/orchestration/mutation-recovery.d.ts.map +1 -0
  106. package/dist/orchestration/mutation-recovery.js +49 -0
  107. package/dist/orchestration/mutation-recovery.js.map +1 -0
  108. package/dist/orchestration/native-compact.d.ts +8 -0
  109. package/dist/orchestration/native-compact.d.ts.map +1 -0
  110. package/dist/orchestration/native-compact.js +33 -0
  111. package/dist/orchestration/native-compact.js.map +1 -0
  112. package/dist/orchestration/notification-mailbox.d.ts +3 -1
  113. package/dist/orchestration/notification-mailbox.d.ts.map +1 -1
  114. package/dist/orchestration/notification-mailbox.js +4 -2
  115. package/dist/orchestration/notification-mailbox.js.map +1 -1
  116. package/dist/orchestration/process-turn.d.ts +16 -2
  117. package/dist/orchestration/process-turn.d.ts.map +1 -1
  118. package/dist/orchestration/process-turn.js +78 -14
  119. package/dist/orchestration/process-turn.js.map +1 -1
  120. package/dist/orchestration/progress-review.d.ts +8 -18
  121. package/dist/orchestration/progress-review.d.ts.map +1 -1
  122. package/dist/orchestration/progress-review.js +12 -14
  123. package/dist/orchestration/progress-review.js.map +1 -1
  124. package/dist/orchestration/provider-message.d.ts +7 -0
  125. package/dist/orchestration/provider-message.d.ts.map +1 -0
  126. package/dist/orchestration/provider-message.js +63 -0
  127. package/dist/orchestration/provider-message.js.map +1 -0
  128. package/dist/orchestration/response-errors.d.ts +6 -0
  129. package/dist/orchestration/response-errors.d.ts.map +1 -0
  130. package/dist/orchestration/response-errors.js +88 -0
  131. package/dist/orchestration/response-errors.js.map +1 -0
  132. package/dist/orchestration/response-schema.d.ts +33 -0
  133. package/dist/orchestration/response-schema.d.ts.map +1 -0
  134. package/dist/orchestration/response-schema.js +61 -0
  135. package/dist/orchestration/response-schema.js.map +1 -0
  136. package/dist/orchestration/runtime.d.ts +79 -0
  137. package/dist/orchestration/runtime.d.ts.map +1 -1
  138. package/dist/orchestration/runtime.js +415 -68
  139. package/dist/orchestration/runtime.js.map +1 -1
  140. package/dist/orchestration/session-compaction.d.ts +59 -0
  141. package/dist/orchestration/session-compaction.d.ts.map +1 -0
  142. package/dist/orchestration/session-compaction.js +212 -0
  143. package/dist/orchestration/session-compaction.js.map +1 -0
  144. package/dist/orchestration/skills.d.ts.map +1 -1
  145. package/dist/orchestration/skills.js +3 -2
  146. package/dist/orchestration/skills.js.map +1 -1
  147. package/dist/orchestration/source-policy.d.ts +1 -1
  148. package/dist/orchestration/source-policy.d.ts.map +1 -1
  149. package/dist/orchestration/source-policy.js +1 -1
  150. package/dist/orchestration/speech.d.ts +15 -17
  151. package/dist/orchestration/speech.d.ts.map +1 -1
  152. package/dist/orchestration/speech.js +90 -30
  153. package/dist/orchestration/speech.js.map +1 -1
  154. package/dist/orchestration/store.d.ts +2 -0
  155. package/dist/orchestration/store.d.ts.map +1 -1
  156. package/dist/orchestration/store.js +16 -1
  157. package/dist/orchestration/store.js.map +1 -1
  158. package/dist/orchestration/tasks/driver.d.ts.map +1 -1
  159. package/dist/orchestration/tasks/driver.js +8 -3
  160. package/dist/orchestration/tasks/driver.js.map +1 -1
  161. package/dist/orchestration/tasks/pool.d.ts.map +1 -1
  162. package/dist/orchestration/tasks/pool.js +8 -4
  163. package/dist/orchestration/tasks/pool.js.map +1 -1
  164. package/dist/orchestration/tasks/service.d.ts +48 -1
  165. package/dist/orchestration/tasks/service.d.ts.map +1 -1
  166. package/dist/orchestration/tasks/service.js +41 -17
  167. package/dist/orchestration/tasks/service.js.map +1 -1
  168. package/dist/orchestration/token-ledger.d.ts +132 -0
  169. package/dist/orchestration/token-ledger.d.ts.map +1 -0
  170. package/dist/orchestration/token-ledger.js +233 -0
  171. package/dist/orchestration/token-ledger.js.map +1 -0
  172. package/dist/orchestration/token-usage.d.ts +46 -0
  173. package/dist/orchestration/token-usage.d.ts.map +1 -0
  174. package/dist/orchestration/token-usage.js +102 -0
  175. package/dist/orchestration/token-usage.js.map +1 -0
  176. package/dist/orchestration/tool-activity.d.ts.map +1 -1
  177. package/dist/orchestration/tool-activity.js +5 -3
  178. package/dist/orchestration/tool-activity.js.map +1 -1
  179. package/dist/orchestration/tool-name.d.ts +10 -0
  180. package/dist/orchestration/tool-name.d.ts.map +1 -0
  181. package/dist/orchestration/tool-name.js +14 -0
  182. package/dist/orchestration/tool-name.js.map +1 -0
  183. package/dist/orchestration/transcript-checkpoint.d.ts +14 -0
  184. package/dist/orchestration/transcript-checkpoint.d.ts.map +1 -0
  185. package/dist/orchestration/transcript-checkpoint.js +83 -0
  186. package/dist/orchestration/transcript-checkpoint.js.map +1 -0
  187. package/dist/orchestration/unanswered-inputs.d.ts +6 -0
  188. package/dist/orchestration/unanswered-inputs.d.ts.map +1 -0
  189. package/dist/orchestration/unanswered-inputs.js +18 -0
  190. package/dist/orchestration/unanswered-inputs.js.map +1 -0
  191. package/dist/session/process.d.ts +10 -0
  192. package/dist/session/process.d.ts.map +1 -1
  193. package/dist/session/process.js +91 -9
  194. package/dist/session/process.js.map +1 -1
  195. package/dist/session/request-tool-capture.d.ts +31 -0
  196. package/dist/session/request-tool-capture.d.ts.map +1 -0
  197. package/dist/session/request-tool-capture.js +194 -0
  198. package/dist/session/request-tool-capture.js.map +1 -0
  199. package/dist/session/runtime-profile.d.ts +7 -3
  200. package/dist/session/runtime-profile.d.ts.map +1 -1
  201. package/dist/session/runtime-profile.js +3 -1
  202. package/dist/session/runtime-profile.js.map +1 -1
  203. package/dist/session/store.d.ts +7 -0
  204. package/dist/session/store.d.ts.map +1 -1
  205. package/dist/session/store.js +27 -0
  206. package/dist/session/store.js.map +1 -1
  207. package/dist/shell/tailer.d.ts +7 -5
  208. package/dist/shell/tailer.d.ts.map +1 -1
  209. package/dist/shell/tailer.js +6 -17
  210. package/dist/shell/tailer.js.map +1 -1
  211. package/dist/types.d.ts +3 -0
  212. package/dist/types.d.ts.map +1 -1
  213. package/dist/ui/cli-viewer-ui.js +1 -1
  214. package/dist/ui/dashboard-charts.d.ts +3 -0
  215. package/dist/ui/dashboard-charts.d.ts.map +1 -0
  216. package/dist/ui/dashboard-charts.js +130 -0
  217. package/dist/ui/dashboard-charts.js.map +1 -0
  218. package/dist/ui/dashboard-client.d.ts +3 -0
  219. package/dist/ui/dashboard-client.d.ts.map +1 -0
  220. package/dist/ui/dashboard-client.js +184 -0
  221. package/dist/ui/dashboard-client.js.map +1 -0
  222. package/dist/ui/dashboard-controls.d.ts +4 -0
  223. package/dist/ui/dashboard-controls.d.ts.map +1 -0
  224. package/dist/ui/dashboard-controls.js +27 -0
  225. package/dist/ui/dashboard-controls.js.map +1 -0
  226. package/dist/ui/dashboard-presentation.d.ts +12 -0
  227. package/dist/ui/dashboard-presentation.d.ts.map +1 -0
  228. package/dist/ui/dashboard-presentation.js +62 -0
  229. package/dist/ui/dashboard-presentation.js.map +1 -0
  230. package/dist/ui/dashboard-range.d.ts +5 -0
  231. package/dist/ui/dashboard-range.d.ts.map +1 -0
  232. package/dist/ui/dashboard-range.js +36 -0
  233. package/dist/ui/dashboard-range.js.map +1 -0
  234. package/dist/ui/dashboard-theme.d.ts +6 -0
  235. package/dist/ui/dashboard-theme.d.ts.map +1 -0
  236. package/dist/ui/dashboard-theme.js +562 -0
  237. package/dist/ui/dashboard-theme.js.map +1 -0
  238. package/dist/ui/memory-activity.d.ts +4 -0
  239. package/dist/ui/memory-activity.d.ts.map +1 -0
  240. package/dist/ui/memory-activity.js +115 -0
  241. package/dist/ui/memory-activity.js.map +1 -0
  242. package/dist/ui/token-report-client.d.ts +3 -0
  243. package/dist/ui/token-report-client.d.ts.map +1 -0
  244. package/dist/ui/token-report-client.js +34 -0
  245. package/dist/ui/token-report-client.js.map +1 -0
  246. package/dist/ui/token-report.d.ts +90 -0
  247. package/dist/ui/token-report.d.ts.map +1 -0
  248. package/dist/ui/token-report.js +203 -0
  249. package/dist/ui/token-report.js.map +1 -0
  250. package/dist/ui/web-ui.d.ts +1 -1
  251. package/dist/ui/web-ui.d.ts.map +1 -1
  252. package/dist/ui/web-ui.js +129 -409
  253. package/dist/ui/web-ui.js.map +1 -1
  254. package/dist/voice/replay.d.ts +8 -0
  255. package/dist/voice/replay.d.ts.map +1 -0
  256. package/dist/voice/replay.js +48 -0
  257. package/dist/voice/replay.js.map +1 -0
  258. package/dist/voice/session.d.ts +9 -0
  259. package/dist/voice/session.d.ts.map +1 -1
  260. package/dist/voice/session.js +72 -14
  261. package/dist/voice/session.js.map +1 -1
  262. package/mcp/lazy-connector.test.ts +58 -0
  263. package/mcp/lazy-connector.ts +67 -0
  264. package/mcp/lazy-tools.test.ts +152 -0
  265. package/mcp/lazy-tools.ts +41 -0
  266. package/mcp/server.ts +53 -34
  267. package/mcp/tools/discord/commands.ts +2 -0
  268. package/mcp/tools/tasks/module.ts +1 -12
  269. package/mcp/tools/telegram/receiver-server.ts +45 -31
  270. package/mcp/tools/telegram/session-browser.ts +10 -0
  271. package/package.json +2 -1
  272. package/resource/dashboard/OFL.txt +93 -0
  273. package/resource/dashboard/poppins-300.woff2 +0 -0
  274. package/resource/dashboard/poppins-400.woff2 +0 -0
  275. package/resource/dashboard/poppins-500.woff2 +0 -0
  276. package/resource/dashboard/poppins-600.woff2 +0 -0
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.memoryActivityClient = exports.memoryActivityHtml = void 0;
4
+ /** Memory maintenance shares the dashboard theme, but owns its refresh and drawer state. */
5
+ exports.memoryActivityHtml = String.raw `
6
+ <div class="heading"><h2>Nightly dreaming</h2><p>Completed compactions and memory reports, newest first.</p></div>
7
+ <div class="dash-grid" id="memory-stats"></div>
8
+ <div class="report-toolbar turn-filters memory-filters">
9
+ <div id="memory-kind" class="range-toggle" role="group" aria-label="Activity"><button type="button" data-kind="all" aria-pressed="true">All</button><button type="button" data-kind="memory_dream" aria-pressed="false">Memory Dream</button><button type="button" data-kind="session_compaction" aria-pressed="false">Session Compaction</button></div>
10
+ <div id="memory-status" class="range-toggle" role="group" aria-label="Status"><button type="button" data-status="all" aria-pressed="false">All</button><button type="button" data-status="pending" aria-pressed="true">Pending</button><button type="button" data-status="running" aria-pressed="true">Running</button><button type="button" data-status="completed" aria-pressed="true">Completed</button><button type="button" data-status="failed" aria-pressed="true">Failed</button><button type="button" data-status="partial_failure" aria-pressed="true">Partially failed</button><button type="button" data-status="interrupted" aria-pressed="true">Interrupted</button><button type="button" data-status="skipped" aria-pressed="false">Skipped</button></div>
11
+ <select id="memory-agent" aria-label="Filter by agent"><option value="">All agents</option></select>
12
+ </div>
13
+ <p class="live-note"><span id="memory-updated" role="status"></span> · <span id="memory-range-note">Uses the date range above.</span> Up to 100 recorded runs per activity per agent. Only successful compactions are shown. Missing measurements are shown as —.</p>
14
+ <p id="memory-error" class="error" role="status" hidden></p>
15
+ <div id="memory-results"></div><div class="dash-pager"><span id="memory-page"></span><div class="row"><button id="memory-prev">← Previous</button><button id="memory-next">Next →</button></div>
16
+ <div id="memory-back" class="dash-drawer-back"><section id="memory-drawer" class="dash-drawer" role="dialog" aria-modal="true" aria-label="Memory activity details" tabindex="-1"></section></div>
17
+ `;
18
+ exports.memoryActivityClient = String.raw `
19
+ (function(){
20
+ const byId=id=>document.getElementById(id),txt=escHtml;
21
+ let page=0,generation=0,detailGeneration=0,busy=false,controller=null,selected=null,focus=null,detailBusy=false,applying=false;
22
+ const field=id=>byId('memory-'+id).value;
23
+ let activity='all';
24
+ const statuses=['pending','running','completed','failed','partial_failure','interrupted','skipped'];
25
+ const selectedStatuses=new Set(statuses.filter(s=>s!=='skipped'));
26
+ const number=compactNumber;
27
+ const time=n=>n==null?'—':new Date(n).toLocaleString('en-GB',{timeZone:dashboardTimezone});
28
+ const age=n=>{if(n==null)return '—';const seconds=Math.max(0,Math.floor((Date.now()-n)/1000));return seconds<60?seconds+'s ago':seconds<3600?Math.floor(seconds/60)+'m ago':seconds<86400?Math.floor(seconds/3600)+'h '+Math.floor(seconds%3600/60)+'m ago':Math.floor(seconds/86400)+'d ago';};
29
+ const timeCell=n=>txt(time(n))+'<br><span class="live-note">'+txt(age(n))+'</span>';
30
+ const percent=(value,total)=>value==null||!(total>0)?'—':(value/total*100).toFixed(2)+'%';
31
+ const tokens=(value,window)=>number(value)+(value!=null&&window>0?'<br><span class="live-note">'+percent(value,window)+' of window</span>':'');
32
+ const reduction=(before,after)=>before==null||after==null?'—':number(before-after)+'<br><span class="live-note">'+percent(before-after,before)+' reduction</span>';
33
+ const title=kind=>kind==='memory_dream'?'Memory Dream':'Session Compaction';
34
+ const activityBadge=kind=>'<span class="memory-activity-label '+(kind==='memory_dream'?'memory-dream':'session-compaction')+'">'+title(kind)+'</span>';
35
+ const badge=taskStatusBadge;
36
+ const reason=value=>{const labels={pending_input:'Pending input',active_tasks:'Active tasks',recent_activity:'Recently active',unchanged_measurement:'No new measurement',no_measurement:'No recorded measurement',already_compacted:'Already compacted',context_changed:'Context changed; awaiting a fresh measurement',below_threshold:'Below context threshold',run_limit:'Run limit reached',model_window_unavailable:'Context window unavailable',missing_transcript:'Session transcript unavailable',agent_busy:'Agent is responding',gateway_stopping:'Gateway is stopping',COMPACTION_FAILED:'Compaction failed',INTERRUPTED:'Interrupted'};return labels[value]||String(value||'—').replace(/_/g,' ').toLowerCase().replace(/^./,c=>c.toUpperCase());};
37
+ const showError=message=>{byId('memory-error').textContent=message;byId('memory-error').hidden=!message;};
38
+ const table=(head,rows)=>{const widths=head.length===6?[17,15,15,14,29,10]:[24,18,19,17,22];return '<div class="table-wrap"><table class="data-table memory-table" style="min-width:'+(head.length===6?900:660)+'px"><colgroup>'+widths.map(w=>'<col style="width:'+w+'%">').join('')+'</colgroup><thead><tr>'+head.map(h=>'<th>'+h+'</th>').join('')+'</tr></thead><tbody>'+rows.join('')+'</tbody></table></div>';};
39
+ const query=()=>new URLSearchParams({agentId:field('agent'),kind:activity,status:selectedStatuses.size===statuses.length?'all':[...selectedStatuses].join(',')||'none',scope:dashboardScope,page:String(page),completedOnly:'true'});
40
+ function close(){detailGeneration++;selected=null;byId('memory-back').classList.remove('open');document.body.style.overflow='';if(focus?.isConnected)focus.focus();}
41
+ async function load(force){
42
+ if(document.hidden||byId('view-dreams').style.display==='none')return;
43
+ if(force){controller?.abort();busy=false;page=0;}
44
+ if(busy)return;
45
+ busy=true;const version=++generation;controller=new AbortController();
46
+ byId('memory-updated').textContent='Updating…';
47
+ try{
48
+ const response=await fetch(apiUrl('/dashboard/memory-activity')+'?'+query(),{signal:controller.signal});
49
+ if(response.status===401){onUnauthorized();return;}if(!response.ok)throw Error('HTTP '+response.status);
50
+ const data=await response.json();if(version!==generation)return;
51
+ byId('memory-range-note').textContent=dashboardScope==='all'?'All recorded history.':'Since '+new Date(data.since).toLocaleString('en-GB',{timeZone:data.timezone})+' ('+data.timezone+').';
52
+ const previous=field('agent');byId('memory-agent').innerHTML='<option value="">All agents</option>'+data.agents.map(a=>'<option value="'+txt(a)+'">'+txt(a)+'</option>').join('');byId('memory-agent').value=previous;
53
+ byId('memory-stats').innerHTML=[['Recorded runs',data.counts.runs],['Proposals to review',data.counts.pendingProposals],['Failed runs',data.counts.failed]].map(([label,n])=>'<div class="dash-stat"><span>'+label+'</span><strong>'+number(n)+'</strong></div>').join('');
54
+ showError((data.unavailable||[]).join(' · '));
55
+ byId('memory-results').innerHTML=data.runs.length?table(['Time','Agent','Activity','Status','Summary','Details'],data.runs.map(r=>'<tr data-memory-id="'+txt(r.id)+'" data-memory-agent="'+txt(r.agent)+'">'+('<td>'+timeCell(r.startedAt)+'</td><td>'+agentBadge(r.agent)+'</td><td>'+activityBadge(r.kind)+'</td><td>'+badge(r.status)+'</td><td>'+(r.kind==='memory_dream'?txt(r.summary||r.outcome):'<strong>'+number(r.beforeTokens)+' → '+number(r.afterTokens)+'</strong><br>'+percent(r.beforeTokens,r.contextWindow)+' → '+percent(r.afterTokens,r.contextWindow)+' of window<br>'+reduction(r.beforeTokens,r.afterTokens))+'</td>')+'<td><button data-memory-open>Inspect</button></td></tr>')):'<p class="empty">No recorded activities match these filters.</p>';
56
+ byId('memory-page').textContent='Page '+(page+1)+' · '+number(data.total)+' runs';byId('memory-prev').disabled=page===0;byId('memory-next').disabled=(page+1)*25>=data.total;
57
+ byId('memory-updated').textContent='Updated '+new Date().toLocaleTimeString('en-GB',{timeZone:dashboardTimezone});
58
+ if(selected?.status==='running'&&!detailBusy&&!applying)void detail(selected.agent,selected.id,true);
59
+ }catch(error){if(error.name!=='AbortError'&&version===generation){showError('Unable to load activity: '+error.message);byId('memory-updated').textContent='Retrying…';}}
60
+ finally{if(version===generation)busy=false;}
61
+ }
62
+ async function detail(agent,id,refresh=false){
63
+ const version=++detailGeneration;detailBusy=true;
64
+ if(!refresh){dashClose();focus=document.activeElement;selected={agent,id};}
65
+ const panel=byId('memory-drawer');
66
+ if(!refresh){byId('memory-back').classList.add('open');document.body.style.overflow='hidden';panel.focus();panel.innerHTML=dashboardCloseButton('memory')+'<p>Loading recorded details…</p>';}
67
+ try{
68
+ const response=await fetch(apiUrl('/dashboard/memory-activity')+'?'+new URLSearchParams({agentId:agent,id,completedOnly:'true'}));
69
+ if(response.status===401){onUnauthorized();return;}if(!response.ok)throw Error('HTTP '+response.status);
70
+ const {run:r}=await response.json();if(version!==detailGeneration)return;
71
+ let body=dashboardCloseButton('memory')+'<h1>'+title(r.kind)+'</h1><p class="live-note">'+agentBadge(agent)+' · '+txt(time(r.startedAt))+'</p>'+badge(r.status)+'<p id="memory-apply-result" role="status"></p>';
72
+ if(r.kind==='memory_dream'){
73
+ body+='<h2>Summary</h2><p>'+txt(r.summary||'No summary recorded')+'</p><p class="live-note">Mode: '+txt(r.mode)+' · Outcome: '+txt(r.outcome)+' · Tokens: '+number(r.tokens)+' · Sessions: '+number(r.sessions)+'</p>';
74
+ if(r.pendingProposals)body+='<button data-memory-accept="all" data-memory-ts="'+Number(r.ts)+'">Accept all pending ('+number(r.pendingProposals)+')</button>';
75
+ body+='<h2>Memory proposals</h2>'+(r.proposals||[]).map(p=>'<section class="dash-panel"><h3>'+txt(p.op)+' · '+txt(p.file)+'</h3><p>'+txt(p.reason)+'</p>'+(p.target?'<h4>Current text</h4><pre>'+txt(p.target)+'</pre>':'')+(p.content?'<h4>Proposed text</h4><pre>'+txt(p.content)+'</pre>':'')+'<p class="live-note">Score: '+number(p.score)+' · Recall: '+number(p.recallCount)+'</p>'+(p.accepted?badge('accepted'):r.mode==='propose'?'<button data-memory-accept="'+Number(p.index)+'" data-memory-ts="'+Number(r.ts)+'">Accept proposal</button>':'')+'</section>').join('');
76
+ }else{
77
+ body+='<h2>Run settings</h2><p>Context threshold '+number(r.config.thresholdPercent)+'% · Quiet '+number(r.config.quietMinutes)+' minutes · Maximum '+number(r.config.maxSessionsPerRun)+' sessions</p><p class="live-note">Ended: '+txt(time(r.endedAt))+'. Native context compaction preserves canonical chat history. Token values describe context, not cost. Before/after percentages use the context window; reduction uses the before value. Measurements use saved CLI metadata only—no additional model requests.</p><h2>Sessions</h2><p class="live-note">Showing '+number((r.items||[]).length)+' of '+number(r.itemCount??(r.items||[]).length)+' recorded sessions.</p>';
78
+ body+=table(['Session','Before','After','Reduced','Duration'],(r.items||[]).map(item=>'<tr><td style="white-space:normal;overflow-wrap:anywhere">'+txt(item.sessionId)+'</td><td>'+tokens(item.beforeTokens,item.contextWindow)+'</td><td>'+tokens(item.afterTokens,item.contextWindow)+'</td><td>'+reduction(item.beforeTokens,item.afterTokens)+'</td><td>'+txt(item.endedAt!=null?Math.round((item.endedAt-item.startedAt)/1000)+'s':'—')+'</td></tr>'));
79
+ }
80
+ const signature=JSON.stringify(r);selected.status=r.status;
81
+ if(!refresh||panel.dataset.record!==signature){
82
+ const scroll=panel.scrollTop,active=document.activeElement,inside=panel.contains(active),accept=active?.dataset?.memoryAccept;
83
+ const previousNotice=byId('memory-apply-result')?.textContent||'';const notice=previousNotice==='Detail refresh unavailable; retrying.'?'':previousNotice;
84
+ panel.innerHTML=body;panel.dataset.record=signature;panel.scrollTop=scroll;
85
+ byId('memory-apply-result').textContent=notice;
86
+ if(inside){const replacement=accept!==undefined?[...panel.querySelectorAll('[data-memory-accept]')].find(b=>b.dataset.memoryAccept===accept):active?.hasAttribute('data-memory-close')?panel.querySelector('[data-memory-close]'):panel; (replacement||panel).focus({preventScroll:true});}
87
+ }
88
+ }catch(error){if(version===detailGeneration){if(refresh&&byId('memory-apply-result'))byId('memory-apply-result').textContent='Detail refresh unavailable; retrying.';else panel.innerHTML=dashboardCloseButton('memory')+'<p class="error">Unable to read details: '+txt(error.message)+'</p>';}}finally{if(version===detailGeneration)detailBusy=false;}
89
+ }
90
+ byId('memory-results').addEventListener('click',e=>{const row=e.target.closest('[data-memory-id]');if(row)detail(row.dataset.memoryAgent,row.dataset.memoryId);});
91
+ byId('memory-back').addEventListener('click',async e=>{
92
+ if(e.target.id==='memory-back'||e.target.closest('[data-memory-close]')){close();return;}
93
+ const button=e.target.closest('[data-memory-accept]');if(!button||!selected||applying)return;applying=true;
94
+ const target={...selected};const version=detailGeneration;
95
+ byId('memory-drawer').querySelectorAll('[data-memory-accept]').forEach(b=>b.disabled=true);
96
+ try{
97
+ const payload={agentId:target.agent,ts:Number(button.dataset.memoryTs)};if(button.dataset.memoryAccept!=='all')payload.indexes=[Number(button.dataset.memoryAccept)];
98
+ const response=await fetch(apiUrl('/knowledge/dreams/apply'),{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)});
99
+ if(response.status===401){onUnauthorized();return;}const result=await response.json();if(!response.ok)throw Error(result.error||'Apply failed');
100
+ if(version!==detailGeneration)return;await detail(target.agent,target.id,true);
101
+ if(selected?.id===target.id&&selected?.agent===target.agent)byId('memory-apply-result')&&(byId('memory-apply-result').textContent='Applied '+number(result.applied)+' · Skipped '+number(result.skipped)+' · Already accepted '+number(result.alreadyAccepted));
102
+ load(false);
103
+ }catch(error){if(version===detailGeneration){byId('memory-apply-result').textContent=error.message;byId('memory-drawer').querySelectorAll('[data-memory-accept]').forEach(b=>b.disabled=false);}}finally{applying=false;if(selected?.id===target.id&&selected?.agent===target.agent)byId('memory-drawer').querySelectorAll('[data-memory-accept]').forEach(b=>b.disabled=false);}
104
+ });
105
+ document.addEventListener('keydown',e=>{if(!selected)return;if(e.key==='Escape')close();if(e.key==='Tab'){const nodes=[...byId('memory-drawer').querySelectorAll('button,a,summary')].filter(n=>n.getClientRects().length),first=nodes[0],last=nodes[nodes.length-1];if(e.shiftKey&&(document.activeElement===first||document.activeElement===byId('memory-drawer'))){e.preventDefault();last?.focus();}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first?.focus();}}});
106
+ byId('memory-agent').addEventListener('change',()=>{close();load(true);});
107
+ byId('memory-kind').addEventListener('click',e=>{const button=e.target.closest('[data-kind]');if(!button)return;activity=button.dataset.kind;byId('memory-kind').querySelectorAll('[data-kind]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.kind===activity)));close();load(true);});
108
+ byId('memory-status').addEventListener('click',e=>{const button=e.target.closest('[data-status]');if(!button)return;const status=button.dataset.status;if(status==='all'){statuses.forEach(s=>selectedStatuses.add(s));}else if(selectedStatuses.has(status)){selectedStatuses.delete(status);}else{selectedStatuses.add(status);}byId('memory-status').querySelectorAll('[data-status]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.status==='all'?selectedStatuses.size===statuses.length:selectedStatuses.has(b.dataset.status))));close();load(true);});
109
+ byId('memory-prev').onclick=()=>{page=Math.max(0,page-1);controller?.abort();busy=false;load(false);};byId('memory-next').onclick=()=>{page++;controller?.abort();busy=false;load(false);};
110
+ document.addEventListener('click',e=>{if(e.target.closest('.tab')&&selected)close();});
111
+ document.addEventListener('visibilitychange',()=>{if(!document.hidden)load(false);});
112
+ setInterval(()=>load(false),15000);window.__loadDreams=force=>load(Boolean(force));
113
+ })();
114
+ `;
115
+ //# sourceMappingURL=memory-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-activity.js","sourceRoot":"","sources":["../../src/ui/memory-activity.ts"],"names":[],"mappings":";;;AAAA,4FAA4F;AAC/E,QAAA,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;CAY3C,CAAC;AACW,QAAA,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgG7C,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Refresh rendered data only; keep filters, theme, scroll and the open turn-detail panel. */
2
+ export declare const tokenReportClient = "\nvar reportRefreshing=false;\nasync function refreshReport(){\n if(document.hidden||reportRefreshing)return;\n reportRefreshing=true;\n var status=document.getElementById('report-live');\n try{\n var response=await fetch(location.href,{cache:'no-store',headers:{Accept:'text/html'}});\n if(response.status===401){location.reload();return;}\n if(!response.ok)throw Error('Unavailable');\n var next=new DOMParser().parseFromString(await response.text(),'text/html');\n if(next.getElementById('login-form')){location.reload();return;}\n if(!next.getElementById('report-totals'))throw Error('Unavailable');\n var scrolls=Array.from(document.querySelectorAll('.table-scroll')).map(function(el){return el.scrollLeft;});\n var x=scrollX,y=scrollY;\n ['report-status','report-totals','report-footprint','report-distribution'].forEach(function(id){var old=document.getElementById(id),fresh=next.getElementById(id);if(old.innerHTML!==fresh.innerHTML)old.innerHTML=fresh.innerHTML;});\n var body=document.querySelector('.report-table tbody'),freshBody=next.querySelector('.report-table tbody');\n if(body.innerHTML!==freshBody.innerHTML)body.innerHTML=freshBody.innerHTML;\n var pagers=next.querySelectorAll('.report-pager');document.querySelectorAll('.report-pager').forEach(function(el,i){if(pagers[i])el.innerHTML=pagers[i].innerHTML;});\n var model=document.getElementById('turn-model'),freshModel=next.getElementById('turn-model'),selected=model.value;\n if(model.innerHTML!==freshModel.innerHTML){model.innerHTML=freshModel.innerHTML;if(selected&&!Array.from(model.options).some(function(o){return o.value===selected;})){var option=document.createElement('option');option.value=selected;option.textContent=selected+' (no turns on this page)';model.appendChild(option);}model.value=selected;}\n filter();if(typeof reportRenderDrawer==='function')reportRenderDrawer();document.querySelectorAll('.table-scroll').forEach(function(el,i){el.scrollLeft=scrolls[i]||0;});scrollTo(x,y);\n status.textContent='Live \u00B7 updated '+new Date().toLocaleTimeString('en-GB',{timeZone:dashboardTimezone});\n }catch(e){status.textContent='Reconnecting\u2026 \u00B7 data may be outdated';}\n finally{reportRefreshing=false;}\n}\nsetInterval(refreshReport,5000);\ndocument.addEventListener('visibilitychange',function(){if(!document.hidden)refreshReport();});\n";
3
+ //# sourceMappingURL=token-report-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-report-client.d.ts","sourceRoot":"","sources":["../../src/ui/token-report-client.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,wzEA4B7B,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tokenReportClient = void 0;
4
+ /** Refresh rendered data only; keep filters, theme, scroll and the open turn-detail panel. */
5
+ exports.tokenReportClient = `
6
+ var reportRefreshing=false;
7
+ async function refreshReport(){
8
+ if(document.hidden||reportRefreshing)return;
9
+ reportRefreshing=true;
10
+ var status=document.getElementById('report-live');
11
+ try{
12
+ var response=await fetch(location.href,{cache:'no-store',headers:{Accept:'text/html'}});
13
+ if(response.status===401){location.reload();return;}
14
+ if(!response.ok)throw Error('Unavailable');
15
+ var next=new DOMParser().parseFromString(await response.text(),'text/html');
16
+ if(next.getElementById('login-form')){location.reload();return;}
17
+ if(!next.getElementById('report-totals'))throw Error('Unavailable');
18
+ var scrolls=Array.from(document.querySelectorAll('.table-scroll')).map(function(el){return el.scrollLeft;});
19
+ var x=scrollX,y=scrollY;
20
+ ['report-status','report-totals','report-footprint','report-distribution'].forEach(function(id){var old=document.getElementById(id),fresh=next.getElementById(id);if(old.innerHTML!==fresh.innerHTML)old.innerHTML=fresh.innerHTML;});
21
+ var body=document.querySelector('.report-table tbody'),freshBody=next.querySelector('.report-table tbody');
22
+ if(body.innerHTML!==freshBody.innerHTML)body.innerHTML=freshBody.innerHTML;
23
+ var pagers=next.querySelectorAll('.report-pager');document.querySelectorAll('.report-pager').forEach(function(el,i){if(pagers[i])el.innerHTML=pagers[i].innerHTML;});
24
+ var model=document.getElementById('turn-model'),freshModel=next.getElementById('turn-model'),selected=model.value;
25
+ if(model.innerHTML!==freshModel.innerHTML){model.innerHTML=freshModel.innerHTML;if(selected&&!Array.from(model.options).some(function(o){return o.value===selected;})){var option=document.createElement('option');option.value=selected;option.textContent=selected+' (no turns on this page)';model.appendChild(option);}model.value=selected;}
26
+ filter();if(typeof reportRenderDrawer==='function')reportRenderDrawer();document.querySelectorAll('.table-scroll').forEach(function(el,i){el.scrollLeft=scrolls[i]||0;});scrollTo(x,y);
27
+ status.textContent='Live · updated '+new Date().toLocaleTimeString('en-GB',{timeZone:dashboardTimezone});
28
+ }catch(e){status.textContent='Reconnecting… · data may be outdated';}
29
+ finally{reportRefreshing=false;}
30
+ }
31
+ setInterval(refreshReport,5000);
32
+ document.addEventListener('visibilitychange',function(){if(!document.hidden)refreshReport();});
33
+ `;
34
+ //# sourceMappingURL=token-report-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-report-client.js","sourceRoot":"","sources":["../../src/ui/token-report-client.ts"],"names":[],"mappings":";;;AAAA,8FAA8F;AACjF,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhC,CAAC"}
@@ -0,0 +1,90 @@
1
+ import type { RequestToolSchemas } from '../session/request-tool-capture';
2
+ import type { ContextFootprint } from '../orchestration/context-footprint';
3
+ /** Read-only admin report. Escape all stored model/tool metadata as untrusted text. */
4
+ export interface TokenReportView {
5
+ timezone?: string;
6
+ contextFootprint?: ContextFootprint;
7
+ contextWindow?: {
8
+ used: number;
9
+ total: number | null;
10
+ model: string | null;
11
+ } | null;
12
+ sessionId: string;
13
+ sessionStatus?: 'running' | 'idle' | 'stopped';
14
+ activityStatus?: string;
15
+ scope?: string;
16
+ since?: number;
17
+ source?: string;
18
+ chatId?: string;
19
+ pagination?: {
20
+ offset: number;
21
+ limit: number;
22
+ total: number;
23
+ };
24
+ distribution?: Array<{
25
+ category: string;
26
+ tokens: number;
27
+ }>;
28
+ usageByRole?: Array<{
29
+ role: string;
30
+ inputTokens: number;
31
+ cacheCreationTokens: number;
32
+ cacheReadTokens: number;
33
+ outputTokens: number;
34
+ }>;
35
+ coverage: string;
36
+ totals: {
37
+ agentTokens: number | null;
38
+ workerTokens: number | null;
39
+ totalTokens: number | null;
40
+ };
41
+ backgroundReviews?: Array<{
42
+ ts: string | number;
43
+ outcome: string | null;
44
+ tokensSpent: number;
45
+ triggerReason: string | null;
46
+ }>;
47
+ turns: Array<{
48
+ id: string;
49
+ role: string;
50
+ category: string;
51
+ taskId?: string;
52
+ inputModalities?: string[];
53
+ inputSequences?: number[];
54
+ inputTexts?: string[];
55
+ responseText?: string;
56
+ taskTitle?: string;
57
+ state?: string;
58
+ failureCode?: string;
59
+ attemptGeneration?: number;
60
+ pending?: boolean;
61
+ queuedMs?: number;
62
+ startedAt: string | number;
63
+ endedAt?: string | number;
64
+ model?: string;
65
+ usage?: {
66
+ inputTokens: number;
67
+ cacheCreationTokens: number;
68
+ cacheReadTokens: number;
69
+ outputTokens: number;
70
+ totalTokens: number;
71
+ cacheCreation5mTokens?: number;
72
+ cacheCreation1hTokens?: number;
73
+ } | null;
74
+ requests?: Array<{
75
+ id: string;
76
+ model?: string;
77
+ toolSchemas?: RequestToolSchemas;
78
+ usage: NonNullable<TokenReportView['turns'][number]['usage']>;
79
+ }>;
80
+ contextTools?: string[] | null;
81
+ schemaCoverage?: {
82
+ measured: number;
83
+ total: number;
84
+ };
85
+ loadedTools?: string[] | null;
86
+ usedTools?: string[];
87
+ }>;
88
+ }
89
+ export declare function generateTokenReportHtml(agentId: string, report: TokenReportView): string;
90
+ //# sourceMappingURL=token-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-report.d.ts","sourceRoot":"","sources":["../../src/ui/token-report.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,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C;YAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;YAAC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;SAAE,CAAC,CAAC;QAClJ,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,cAAc,CAAC,EAAE;YAAC,QAAQ,EAAC,MAAM,CAAC;YAAA,KAAK,EAAC,MAAM,CAAA;SAAC,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACtI,CAAC,CAAC;CACJ;AAiFD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,MAAM,CA8FxF"}
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateTokenReportHtml = generateTokenReportHtml;
4
+ const dashboard_controls_1 = require("./dashboard-controls");
5
+ const dashboard_range_1 = require("./dashboard-range");
6
+ const token_report_client_1 = require("./token-report-client");
7
+ const dashboard_presentation_1 = require("./dashboard-presentation");
8
+ const dashboard_theme_1 = require("./dashboard-theme");
9
+ function escape(value) {
10
+ return String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
11
+ }
12
+ function n(value) { return (0, dashboard_presentation_1.compactNumber)(value); }
13
+ function tools(label, names) {
14
+ return `<div title="${escape(names?.join(', ') || 'Not recorded')}">${label}: ${names == null ? '—' : n(names.length)}</div>`;
15
+ }
16
+ function cacheWrite(usage) {
17
+ const total = usage?.cacheCreationTokens;
18
+ if (total == null || total === 0)
19
+ return n(total);
20
+ const five = usage?.cacheCreation5mTokens, hour = usage?.cacheCreation1hTokens;
21
+ const durations = [...(five && five > 0 ? ['5m'] : []), ...(hour && hour > 0 ? ['1h'] : [])];
22
+ // A partial breakdown cannot label the duration of the whole total.
23
+ if (!durations.length || (five ?? 0) + (hour ?? 0) !== total)
24
+ return n(total);
25
+ const title = [...(five && five > 0 ? ['5m: ' + n(five) + ' tokens'] : []), ...(hour && hour > 0 ? ['1h: ' + n(hour) + ' tokens'] : [])].join(' · ');
26
+ return `<span class="cache-write" title="${escape(title)}">${n(total)} <span class="cache-duration">(${durations.join(' + ')})</span></span>`;
27
+ }
28
+ function requestDetails(requests, aggregate) {
29
+ if (!requests?.length)
30
+ return '<span class="muted">Per-request usage: —</span>';
31
+ const incomplete = aggregate && aggregate.totalTokens > requests.reduce((sum, request) => sum + request.usage.totalTokens, 0);
32
+ // Requests are captured oldest-first; show newest at the top.
33
+ const ordered = [...requests].reverse();
34
+ return `<div class="request-details"><h3>Observed model requests: ${requests.length}</h3>${incomplete ? '<p class="muted">Observed requests do not cover the full turn aggregate; additional request usage was not reported separately.</p>' : ''}<table><thead><tr><th>Request / model</th><th title="Uncached input only. Total input = input + cache write + cache read.">Input</th><th>Cache write</th><th>Cache read</th><th>Output</th><th>Total</th></tr></thead><tbody>${ordered.map(request => `<tr><td>${escape(request.id)}<br>${escape(request.model ?? '—')}</td><td>${n(request.usage.inputTokens)}</td><td>${cacheWrite(request.usage)}</td><td>${n(request.usage.cacheReadTokens)}</td><td>${n(request.usage.outputTokens)}</td><td>${n(request.usage.totalTokens)}</td></tr>`).join('')}</tbody></table></div>`;
35
+ }
36
+ const statusBadge = dashboard_presentation_1.taskStatusBadge;
37
+ function conversationDetails(turn) {
38
+ const inputs = turn.inputTexts?.map(text => `<pre>${escape(text)}</pre>`).join('') ?? '';
39
+ const assignment = turn.taskTitle === undefined ? '' : `<h3>Assignment</h3><pre>${escape(turn.taskTitle)}</pre>`;
40
+ const response = turn.responseText === undefined ? '' : `<h3>Response / result</h3><pre>${escape(turn.responseText)}</pre>`;
41
+ if (!inputs && !assignment && !response && !turn.state)
42
+ return '<p class="muted">Conversation / assignment details: —</p>';
43
+ return `<div class="conversation-details"><h3>Conversation / assignment / result</h3>${turn.state ? '<p class="turn-status"><span>Status</span> ' + statusBadge(turn.state) + '</p>' : ''}${turn.failureCode ? '<p><strong>Failure:</strong> ' + escape(turn.failureCode) + '</p>' : ''}${turn.state === 'failed' && turn.category === 'report' ? '<p class="muted">This progress/result reporting turn failed. It does not mean the worker task failed.</p>' : ''}${assignment}${inputs ? '<h3>Input</h3>' + inputs : ''}${response}</div>`;
44
+ }
45
+ /** Compact wait duration ("9s", "2m 21s", "1h 04m"). Input is untrusted: a missing or
46
+ * nonsensical value yields '' so the caller simply renders nothing. */
47
+ function waited(ms) {
48
+ if (typeof ms !== 'number' || !Number.isFinite(ms) || ms < 0)
49
+ return '';
50
+ const s = Math.round(ms / 1000);
51
+ if (s < 60)
52
+ return s + 's';
53
+ if (s < 3600)
54
+ return Math.floor(s / 60) + 'm ' + String(s % 60).padStart(2, '0') + 's';
55
+ return Math.floor(s / 3600) + 'h ' + String(Math.floor(s % 3600 / 60)).padStart(2, '0') + 'm';
56
+ }
57
+ /** The row's stable identity label.
58
+ *
59
+ * Every branch reads a STORED value: conversation_inputs.input_seq for an agent turn and
60
+ * task_attempts.generation for a worker turn. The previous fallback numbered rows by their
61
+ * position in the rendered page, so every existing row's "Turn #N" shifted as soon as a
62
+ * newer row landed (and paging changed it too). A row with neither stored value now says
63
+ * so instead of displaying a number that does not mean anything. */
64
+ function turnLabel(turn) {
65
+ if (turn.inputSequences?.length)
66
+ return 'Input #' + turn.inputSequences.join(', #');
67
+ if (typeof turn.attemptGeneration === 'number' && Number.isFinite(turn.attemptGeneration))
68
+ return 'Attempt #' + turn.attemptGeneration;
69
+ return 'Unnumbered turn';
70
+ }
71
+ function time(value, timezone = 'UTC') {
72
+ const date = new Date(value);
73
+ return Number.isFinite(date.getTime()) ? date.toLocaleString('en-GB', { timeZone: timezone, day: '2-digit', month: 'short', hour: '2-digit', minute: '2-digit', second: '2-digit' }) + ' ' + timezone : '—';
74
+ }
75
+ /** Turn/Date display: "Xs/m/h ago" within the last 24h (full datetime on hover),
76
+ * switching to the full inline datetime once older than a day. */
77
+ function relativeTime(value, timezone = 'UTC') {
78
+ const t = new Date(value).getTime();
79
+ const full = time(value, timezone);
80
+ if (!Number.isFinite(t))
81
+ return { label: '—', title: '' };
82
+ const diff = Date.now() - t, day = 86400000;
83
+ if (diff >= day || diff < 0)
84
+ return { label: full, title: full };
85
+ let label;
86
+ if (diff < 60000)
87
+ label = Math.max(1, Math.round(diff / 1000)) + 's ago';
88
+ else if (diff < 3600000)
89
+ label = Math.round(diff / 60000) + 'm ago';
90
+ else
91
+ label = Math.round(diff / 3600000) + 'h ago';
92
+ return { label, title: full };
93
+ }
94
+ function footprintHtml(footprint, timezone = 'UTC') {
95
+ const parts = (footprint?.rows || []).filter(r => (r.name.startsWith('↳ ') || r.name.startsWith('Agent gateway tool schemas')) && r.hasContent !== false && r.tokens != null && r.tokens > 0);
96
+ const total = parts.reduce((sum, r) => sum + r.tokens, 0);
97
+ const colors = dashboard_presentation_1.dashboardChartPalette;
98
+ const names = ['AGENTS.md', 'IDENTITY.md', 'SOUL.md', 'USER.md', 'MEMORY.md', 'HEARTBEAT.md', 'Skill catalog', 'Memory rules', 'Memory retrieval instructions'];
99
+ const color = (name) => { const i = names.indexOf(name.replace(/^↳ /, '')); return colors[i < 0 ? 9 : i]; };
100
+ const items = parts.map(r => { const name = r.name.replace(/^↳ /, ''); const source = footprint?.rows.find(row => row.name === name + ' · source file'); return { name, tokens: r.tokens, color: color(r.name), note: source?.tokens != null ? 'Included in bootstrap: ' + n(r.tokens) + '; full source file: ' + n(source.tokens) + ' estimated tokens.' : r.note }; });
101
+ return `<section id="report-footprint"><div class="report-toolbar"><h2 style="margin:0">Context bootstrap</h2><strong style="margin-left:auto">${total ? n(total) + ' estimated tokens' : '—'}</strong></div>${total ? `<div class="stacked-distribution" aria-label="Estimated context tokens by source">${items.map(r => `<span class="segment" style="background:${r.color};width:${r.tokens / total * 100}%" title="${escape(r.name)}: ${n(r.tokens)} tokens"></span>`).join('')}</div><div class="distribution-legend">${items.map(r => `<div class="distribution-item" title="${escape(r.note)}"><i style="background:${r.color}"></i><span>${escape(r.name)}</span><strong>${n(r.tokens)}</strong></div>`).join('')}</div>` : '<p class="muted">—</p>'}<p class="muted">Current CLAUDE.md sections after context budgets, plus Agent gateway tool schemas. Hover a file to compare its included portion with the full source file; MEMORY.md may be longer on disk. Estimated with cl100k_base, not historical turn attribution or the selected model’s exact token count. Excludes section headers, conversation history, runtime overlays, CLI instructions/tools and provider framing. ${footprint ? 'Checked ' + escape(time(footprint.observedAt, timezone)) + ' · refreshes every 30s.' : ''}</p></section>`;
102
+ }
103
+ function generateTokenReportHtml(agentId, report) {
104
+ const timezone = report.timezone || 'UTC';
105
+ const labels = { input: 'Agent · User input', report: 'Agent · Progress / results', worker: 'Worker' };
106
+ const categories = new Map();
107
+ for (const turn of report.turns.filter(t => t.usage))
108
+ categories.set(turn.category, (categories.get(turn.category) || 0) + (turn.usage?.totalTokens || 0));
109
+ if (report.distribution) {
110
+ categories.clear();
111
+ for (const item of report.distribution)
112
+ categories.set(item.category, item.tokens);
113
+ }
114
+ const total = [...categories.values()].reduce((a, b) => a + b, 0);
115
+ const roleMeasured = (role) => report.pagination ? (role === 'agent' ? report.totals.agentTokens !== null : report.totals.workerTokens !== null) : report.turns.some(t => t.role === role && t.usage);
116
+ const measured = report.pagination ? report.totals.totalTokens !== null : report.turns.some(t => t.usage);
117
+ const usageOf = (role) => report.usageByRole?.find(u => u.role === role);
118
+ // Cached share = cache-read tokens / (input + cache read + cache write); output is not context.
119
+ const cachedRatio = (input, cacheRead, cacheWrite) => { const base = input + cacheRead + cacheWrite; return base ? cacheRead / base * 100 : 0; };
120
+ const cachedLineFor = (u) => u ? `<span class="card-cached">Cached: <b>${cachedRatio(u.inputTokens, u.cacheReadTokens, u.cacheCreationTokens).toFixed(2)}%</b></span>` : '';
121
+ const agentU = usageOf('agent'), workerU = usageOf('worker');
122
+ const totalU = (agentU || workerU) ? { inputTokens: (agentU?.inputTokens || 0) + (workerU?.inputTokens || 0), cacheReadTokens: (agentU?.cacheReadTokens || 0) + (workerU?.cacheReadTokens || 0), cacheCreationTokens: (agentU?.cacheCreationTokens || 0) + (workerU?.cacheCreationTokens || 0) } : undefined;
123
+ const windowCap = (t) => t >= 1e6 ? +(t / 1e6).toFixed(2) + 'M' : Math.round(t / 1000) + 'K';
124
+ const cw = report.contextWindow;
125
+ // Use the same durable session status as the dashboard, independent of process teardown.
126
+ const headerStatus = report.activityStatus || 'stopped';
127
+ const cwStopped = headerStatus === 'stopped';
128
+ const contextWindowBox = `<div class="card box-context">Context window<strong>${cwStopped ? '-' : (cw ? n(cw.used) + ' / ' + (cw.total == null ? '—' : windowCap(cw.total)) : '—')}</strong>${!cwStopped && cw && cw.model ? `<span class="card-cached" title="${escape(cw.model)}">Model: ${escape(cw.model)}</span>` : ''}</div>`;
129
+ const models = [...new Set(report.turns.map(t => t.model).filter((m) => Boolean(m)))].sort();
130
+ // Fixed status buckets; raw turn/attempt states are mapped into these client-side.
131
+ const statusBuckets = [['running', 'Running'], ['completed', 'Completed'], ['ended', 'Ended'], ['fail', 'Fail']];
132
+ const scope = (0, dashboard_range_1.dashboardRange)(report.scope);
133
+ const link = (offset, selected = scope) => '?agentId=' + encodeURIComponent(agentId) + '&sessionId=' + encodeURIComponent(report.sessionId) + '&scope=' + selected + '&offset=' + offset;
134
+ const page = report.pagination;
135
+ // Accepted-but-not-yet-measured rows are not recorded turns, so they are counted
136
+ // separately rather than folded into the pager's "of N recorded turns".
137
+ const queued = report.turns.filter(t => t.pending).length;
138
+ const pager = page ? `<nav class="report-pager"><span>${page.total ? page.offset + 1 : 0}–${Math.min(page.offset + page.limit, page.total)} of ${page.total} recorded turns${queued ? ' · ' + queued + ' queued (not yet recorded)' : ''} · Newest first</span><span class="report-pager-nav"><button type="button" data-report-href="${escape(link(Math.max(0, page.offset - page.limit)))}"${page.offset > 0 ? '' : ' disabled'}>← Previous</button><button type="button" data-report-href="${escape(link(page.offset + page.limit))}"${page.offset + page.limit < page.total ? '' : ' disabled'}>Next →</button></span></nav>` : '';
139
+ const distribution = [...categories].map(([category, value]) => `<span class="segment ${escape(category)}" style="width:${total ? value / total * 100 : 0}%" title="${escape(labels[category] || category)}: ${n(value)}"></span>`).join('');
140
+ const legend = [...categories].map(([category, value]) => `<div class="distribution-item"><i class="${escape(category)}"></i><span>${escape(labels[category] || category)}</span><strong>${n(value)} · ${total ? (value / total * 100).toFixed(1) : '0.0'}%</strong></div>`).join('');
141
+ const turns = [...report.turns].sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime() || b.id.localeCompare(a.id));
142
+ const rows = turns.map(turn => {
143
+ const modality = turn.inputModalities?.some(m => m === 'voice_note' || m === 'live_voice') ? 'Voice message' : 'Message';
144
+ const title = turn.category === 'report' ? (turn.responseText || turn.taskTitle || 'Task progress / results') : (turn.taskTitle || turn.inputTexts?.find(t => t.trim()) || turn.responseText || 'No conversation text recorded');
145
+ const number = turnLabel(turn);
146
+ const badge = turn.category === 'input' ? modality : labels[turn.category] || turn.category;
147
+ const started = relativeTime(turn.startedAt, timezone);
148
+ // Turns run one at a time per session by design, so a message can sit accepted for
149
+ // minutes before its own turn starts. Show that wait rather than leaving a slow turn
150
+ // looking broken; below ~2s it is just noise.
151
+ const wait = waited(turn.queuedMs);
152
+ const waitLine = turn.pending
153
+ ? `<small class="turn-wait" title="Accepted ${escape(time(turn.startedAt, timezone))}; waiting for the previous turn in this session to finish">Waiting ${escape(wait || '0s')}</small>`
154
+ : (wait && (turn.queuedMs ?? 0) >= 2000 ? `<small class="turn-wait" title="Time between accepting this message and its turn starting; turns run one at a time per session">Queued ${escape(wait)}</small>` : '');
155
+ const pendingNote = turn.pending ? '<p class="muted">This message has been accepted and is waiting for the previous turn in this session to finish. Token usage is recorded once its own turn runs, so this row is not counted in any total.</p>' : '';
156
+ return `<tr class="turn-row${turn.pending ? ' turn-pending' : ''}" tabindex="0" aria-expanded="false" data-turn-id="${escape(turn.id)}" data-category="${escape(turn.category)}" data-model="${escape(turn.model || '')}" data-status="${escape(turn.state || '')}"><td><strong>${escape(number)}</strong><small title="${escape(started.title)}">${escape(started.label)}</small>${waitLine}<small class="cell-model" title="${escape(turn.model)}">${escape(turn.model || '—')}</small></td><td><span class="turn-kind ${escape(turn.category)}">${escape(badge)}</span><strong class="turn-excerpt" title="${escape(title.slice(0, 1000))}">${escape(title.slice(0, 180))}${title.length > 180 ? '…' : ''}</strong>${turn.state ? statusBadge(turn.state) : ''}</td><td>${n(turn.usage?.inputTokens)}</td><td>${cacheWrite(turn.usage)}</td><td>${n(turn.usage?.cacheReadTokens)}</td><td>${n(turn.usage?.outputTokens)}</td><td><strong>${n(turn.usage?.totalTokens)}</strong></td><td>${turn.usage ? '<strong>' + cachedRatio(turn.usage.inputTokens, turn.usage.cacheReadTokens, turn.usage.cacheCreationTokens).toFixed(2) + '%</strong>' : '—'}</td><td>${tools('Loaded', turn.contextTools)}${tools('Used', turn.usedTools)}</td></tr><tr class="turn-extra" hidden data-turn-id="${escape(turn.id)}" data-category="${escape(turn.category)}"><td colspan="9"><h3>Conversation & request details</h3><p class="muted">Role: ${escape(turn.role)} · Turn ${escape(turn.id)}${turn.taskId ? ' · Task ' + escape(turn.taskId) : ''}${turn.endedAt ? ' · Ended ' + escape(time(turn.endedAt, timezone)) : ''}${wait ? ' · ' + escape(turn.pending ? 'Waiting ' + wait : 'Queued ' + wait + ' before starting') : ''}</p>${pendingNote}${conversationDetails(turn)}${requestDetails(turn.requests, turn.usage)}${turn.contextTools ? '<h3>Loaded tools</h3>' + (0, dashboard_presentation_1.toolNameList)(turn.contextTools) : ''}<h3>Used tools</h3>${(0, dashboard_presentation_1.toolNameList)(turn.usedTools)}<p class="muted">Loaded counts distinct schemas observed in requests, including referenced deferred tools. Used counts distinct tool names executed. ${turn.schemaCoverage ? `Schema capture: ${turn.schemaCoverage.measured}/${turn.schemaCoverage.total} observed requests.` : 'Schema capture was not recorded for this turn.'}</p></td></tr>`;
157
+ }).join('');
158
+ return `<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Session token report · Claude Gateway</title>${dashboard_theme_1.dashboardFontLink}<style>${dashboard_theme_1.dashboardTheme}
159
+ body{padding:28px;background:var(--bg);color:var(--text);font:15px/1.7 system-ui,-apple-system,"Noto Sans Thai",sans-serif}main{max-width:1560px;margin:auto;min-width:0}h1{font-size:28px;margin:20px 0 12px}h2{font-size:17px;color:var(--text);margin:0 0 20px}.report-title{margin:24px 0 18px}.report-header{display:flex;gap:20px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:24px}.report-identity{display:flex;flex-direction:column;gap:10px;min-width:0}.report-identity-meta{display:flex;align-items:center;gap:16px;flex-wrap:wrap;font-size:13px}.report-session{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;font-size:13px;overflow-wrap:anywhere}.report-range{flex:0 0 auto}.report-range .range-toggle{flex-wrap:nowrap}.report-range .range-toggle button{min-width:44px}.report-toolbar{display:flex;gap:12px;flex-wrap:wrap;align-items:center}.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px}.cards .card{padding:22px}.card strong{display:block;font-size:30px;font-weight:500;margin-top:10px}section{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:22px;margin-top:22px}.muted{font-size:11px;color:var(--muted);overflow-wrap:anywhere}pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:400px;overflow:auto;background:var(--raised);padding:16px;border-radius:10px;font:12px/1.7 ui-monospace,monospace}a{color:var(--accent)}.report-pager{display:flex;gap:16px;justify-content:space-between;flex-wrap:wrap;font-size:12px;padding:18px 0}.report-pager-nav{display:inline-flex;gap:8px;flex-wrap:wrap}.stacked-distribution{display:flex;height:24px;overflow:hidden;border-radius:8px;margin:14px 0 22px;background:var(--raised)}.segment{height:100%}.input{--category:var(--token-agent)}.report{--category:var(--token-report)}.worker{--category:var(--token-worker)}.segment+.segment{border-left:3px solid var(--panel)}.segment,.distribution-item i{background:var(--category)}.distribution-legend{display:flex;gap:24px;flex-wrap:wrap}.distribution-item{display:flex;gap:8px;align-items:center;font-size:11px}.distribution-item i{height:9px;width:9px;border-radius:3px}.turn-kind{display:inline-block;padding:3px 8px;border-radius:5px;background:color-mix(in srgb,var(--category) 12%,var(--panel));color:var(--category);font-size:10px;font-weight:550}.turn-excerpt{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.7;margin:7px 0;font-weight:500}.cache-write{display:inline-flex;flex-wrap:wrap;gap:0 4px;max-width:100%;white-space:normal}.cache-duration{font-size:11px;color:var(--muted);white-space:nowrap}.report-table{width:100%;min-width:1000px;table-layout:fixed}.report-table>thead>tr>th,.report-table>tbody>.turn-row>td{padding:12px 8px}.report-table>tbody>.turn-row>td:nth-child(n+3){white-space:nowrap;font-size:14px}.report-table td:not(:first-child){font-variant-numeric:tabular-nums}.report-table .turn-extra td{padding-top:0}.turn-extra summary{font-size:11px;color:var(--muted);cursor:pointer}.turn-extra table{min-width:760px}.turn-extra details{margin:8px 0}.report-table details p{max-width:100%;overflow-wrap:anywhere;white-space:normal}.report-table th{white-space:normal;line-height:1.4}.report-table td small{font-size:10px}.report-table .turn-row>td:first-child>strong,.report-table .turn-row>td:first-child>small{display:block}.cell-model{overflow-wrap:anywhere;white-space:normal}.report-table td{border-bottom:0}.turn-extra td{border-bottom:1px solid var(--line)!important}.report-table details{font-size:11px}body[data-theme=dark]{color:var(--text)}@media(max-width:700px){body{padding:16px}.cards{grid-template-columns:1fr}section{padding:16px}}
160
+ .report-table,.footprint-table{font-size:13px;line-height:1.7}.report-table td small,.muted{font-size:12px}.turn-kind,.report-table details,.turn-extra summary,.distribution-item{font-size:12px}.turn-excerpt{font-weight:650}.report-table td>strong,.distribution-item strong,.footprint-table td:first-child,.footprint-table td:nth-child(2){font-weight:700}.report-table th,.footprint-table th{font-size:12px;letter-spacing:.03em}.footprint-table{min-width:800px;table-layout:fixed}.footprint-table th:first-child{width:30%}.footprint-table th:nth-child(2),.footprint-table th:nth-child(3){width:15%}.footprint-table td{overflow-wrap:anywhere}
161
+ .report-table .turn-extra{font-size:13px;line-height:1.7}.report-table .turn-extra p,.report-table .turn-extra .muted,.report-table .turn-extra summary,.report-table .turn-extra pre,.report-table .turn-extra td{font-size:13px;line-height:1.7}.report-table .turn-extra h3{font-size:13px;font-weight:700;margin:18px 0 8px}.report-table .turn-extra pre{font-family:inherit;font-weight:400}.turn-status{display:flex;align-items:center;gap:8px}.turn-status .badge{font-size:12px;font-weight:500}.turn-extra>td>details>summary{font-weight:600}
162
+ .report-table .turn-row[aria-expanded=true]{background:color-mix(in srgb,var(--accent) 14%,var(--panel))}.report-table .turn-pending{background:color-mix(in srgb,#a16c11 9%,var(--panel))}.report-table .turn-pending>td:first-child{box-shadow:inset 3px 0 0 #a16c11}.turn-wait{color:#a16c11;font-weight:600;overflow-wrap:anywhere;white-space:normal}#report-drawer .muted{font-size:12px}#report-drawer table{width:100%;border-collapse:collapse;font-size:12px;margin:10px 0}#report-drawer th,#report-drawer td{padding:7px 8px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}#report-drawer .request-details,#report-drawer .conversation-details{margin-top:10px}
163
+ </style></head><body><main><div class="report-toolbar"><a href="../dashboard">← Dashboard</a><span id="report-live" class="muted" role="status">Live · every 5s</span>${(0, dashboard_controls_1.themeButtonHtml)('report-theme')}</div><h1 class="report-title">Session token report</h1><div class="report-header"><div class="report-identity"><div class="report-identity-meta">${(0, dashboard_presentation_1.agentBadge)(agentId)}<span id="report-status">${statusBadge(headerStatus)}</span>${(0, dashboard_presentation_1.channelBadge)(report.source || '')}</div><div class="report-session"><span class="muted">Session</span><span>${escape(report.sessionId)}</span></div></div><div class="report-range turn-filters">${(0, dashboard_range_1.rangeButtons)("report-scope", scope, timezone)}</div></div><div class="cards" id="report-totals">${contextWindowBox}<div class="card box-agent">Agent tokens<strong>${roleMeasured('agent') ? n(report.totals.agentTokens) : '—'}</strong>${roleMeasured('agent') ? cachedLineFor(agentU) : ''}</div><div class="card box-worker">Worker tokens<strong>${roleMeasured('worker') ? n(report.totals.workerTokens) : '—'}</strong>${roleMeasured('worker') ? cachedLineFor(workerU) : ''}</div><div class="card box-total">Total tokens<strong>${measured ? n(report.totals.totalTokens) : '—'}</strong>${measured ? cachedLineFor(totalU) : ''}</div></div><p class="muted">${report.since ? 'Turns started since ' + escape(time(report.since, timezone)) + '.' : 'All recorded turns.'} Totals include all pages. Token volume includes input, cache creation, cache reads and output; these percentages are not monetary costs. Missing measurements are shown as —. Input is the uncached portion; cache write creates cached context; cache read reuses context; output includes reported thinking. Total tokens is the sum of input, cache write, cache read and output.</p>${footprintHtml(report.contextFootprint, timezone)}<section id="report-distribution"><h2>Token distribution</h2>${total ? `<div class="stacked-distribution">${distribution}</div><div class="distribution-legend">${legend}</div>` : '<p>No recorded token usage.</p>'}</section><section><h2>Turn details</h2><div class="report-toolbar turn-filters"><div id="turn-category" class="range-toggle" role="group" aria-label="Filter turns on this page by purpose">${[['', 'All'], ['input', 'User input'], ['report', 'Progress / result'], ['worker', 'Worker']].map(([value, label]) => `<button type="button" data-purpose="${value}" aria-pressed="${value === ''}">${label}</button>`).join('')}</div><div id="turn-status" class="range-toggle" role="group" aria-label="Filter turns on this page by status"><button type="button" data-status="" aria-pressed="true">All</button>${statusBuckets.map(([value, label]) => `<button type="button" data-status="${value}" aria-pressed="false">${label}</button>`).join('')}</div><select id="turn-model" aria-label="Filter turns on this page by model"><option value="">All models</option>${models.map(m => `<option value="${escape(m)}">${escape(m)}</option>`).join('')}</select><input id="turn-search" placeholder="Search this page's messages or models" aria-label="Search turns on this page"></div>${pager}<div class="table-scroll"><table class="data-table report-table"><colgroup>${[120, 0, 96, 96, 96, 96, 96, 96, 96].map(width => width ? `<col style="width:${width}px">` : '<col>').join('')}</colgroup><thead><tr><th>Turn / Date</th><th>Conversation / assignment</th><th title="Uncached input only. Total input = input + cache write + cache read.">Input</th><th>Cache write</th><th>Cache read</th><th>Output</th><th>Totals</th><th title="Cache read ÷ (input + cache read + cache write)">%Cached</th><th>Tools</th></tr></thead><tbody>${rows || '<tr><td colspan="9">No recorded turns in this scope.</td></tr>'}</tbody></table></div>${pager}</section></main><div id="report-drawer-back" class="dash-drawer-back"><section id="report-drawer" class="dash-drawer" role="dialog" aria-modal="true" aria-label="Recorded turn details" tabindex="-1"></section></div><script>
164
+ const dashboardTimezone=${JSON.stringify(timezone).replace(/</g, '\\u003c')};
165
+ document.getElementById('report-scope').onclick=function(e){var button=e.target.closest('[data-range]');if(!button)return;var url=new URL(location.href);url.searchParams.set('scope',button.dataset.range);url.searchParams.set('offset','0');location.href=url.href;};
166
+ ${dashboard_controls_1.dashboardControlsClient}
167
+ var reportSelected=null,reportFocus=null;
168
+ function reportExtraFor(id){var found=null;document.querySelectorAll('.turn-extra').forEach(function(r){if(r.dataset.turnId===id)found=r;});return found;}
169
+ function reportRenderDrawer(){
170
+ var back=document.getElementById('report-drawer-back'),panel=document.getElementById('report-drawer');
171
+ document.querySelectorAll('.turn-row').forEach(function(r){r.setAttribute('aria-expanded',String(Boolean(reportSelected)&&r.dataset.turnId===reportSelected));});
172
+ var extra=reportSelected?reportExtraFor(reportSelected):null,cell=extra?extra.querySelector('td'):null;
173
+ if(!reportSelected||!cell){reportSelected=null;back.classList.remove('open');document.body.style.overflow='';if(panel.dataset.turn!==undefined){panel.innerHTML='';delete panel.dataset.turn;delete panel.dataset.html;}document.querySelectorAll('.turn-row').forEach(function(r){r.setAttribute('aria-expanded','false');});return;}
174
+ var html=dashboardCloseButton('report')+'<h1>Turn details</h1>'+cell.innerHTML;
175
+ back.classList.add('open');document.body.style.overflow='hidden';
176
+ if(panel.dataset.turn===reportSelected&&panel.dataset.html===html)return;
177
+ var sameTurn=panel.dataset.turn===reportSelected,scroll=panel.scrollTop,focused=panel.contains(document.activeElement),closeFocused=document.activeElement&&document.activeElement.hasAttribute('data-report-close');
178
+ panel.innerHTML=html;panel.dataset.turn=reportSelected;panel.dataset.html=html;
179
+ if(sameTurn){panel.scrollTop=scroll;if(focused)(closeFocused?panel.querySelector('[data-report-close]'):panel).focus({preventScroll:true});}
180
+ }
181
+ function reportOpen(id){if(reportSelected!==id)reportFocus=document.activeElement;reportSelected=id;reportRenderDrawer();var p=document.getElementById('report-drawer');if(reportSelected&&!p.contains(document.activeElement))p.focus({preventScroll:true});}
182
+ function reportClose(){var was=reportSelected;reportSelected=null;reportRenderDrawer();if(was&&reportFocus&&reportFocus.isConnected)reportFocus.focus({preventScroll:true});}
183
+ function statusBucket(s){if(!s)return '';s=String(s).toLowerCase();if(s==='failed'||s==='error'||s==='failure')return 'fail';if(s==='completed'||s==='succeeded'||s==='success'||s==='done')return 'completed';if(s==='cancelled'||s==='canceled'||s==='ended'||s==='stopped'||s==='interrupted'||s==='idle')return 'ended';if(s==='compacting'||s==='running'||s==='working'||s==='thinking'||s==='queued'||s==='starting'||s==='recovering'||s==='interrupting'||s==='cancel_requested'||s==='waiting_input'||s==='needs_reconciliation'||s.indexOf('progress')>=0)return 'running';return '';}
184
+ function filter(){var btn=document.querySelector('#turn-category button[aria-pressed=true]'),category=btn?btn.dataset.purpose:'',model=document.getElementById('turn-model').value,query=document.getElementById('turn-search').value.toLowerCase();var buckets=[].slice.call(document.querySelectorAll('#turn-status button[aria-pressed=true]')).map(function(b){return b.dataset.status;}).filter(function(s){return s;});document.querySelectorAll('.turn-row').forEach(function(row){var extra=row.nextElementSibling;var show=(!category||row.dataset.category===category)&&(!model||row.dataset.model===model)&&(!buckets.length||buckets.indexOf(statusBucket(row.dataset.status))>=0)&&(!query||(row.textContent+(extra?extra.textContent:'')).toLowerCase().includes(query));row.hidden=!show;if(extra)extra.hidden=true;if(!show&&reportSelected===row.dataset.turnId)reportClose();});}
185
+ document.addEventListener('click',function(e){
186
+ if(e.target.closest('[data-report-close]')||e.target.id==='report-drawer-back'){reportClose();return;}
187
+ var row=e.target.closest('.turn-row');if(!row||e.target.closest('a,button,input,select'))return;
188
+ if(reportSelected===row.dataset.turnId)reportClose();else reportOpen(row.dataset.turnId);
189
+ });
190
+ document.addEventListener('keydown',function(e){
191
+ if(e.key==='Escape'&&reportSelected){reportClose();return;}
192
+ if((e.key==='Enter'||e.key===' ')&&e.target.matches('.turn-row')){e.preventDefault();e.target.click();return;}
193
+ if(e.key==='Tab'&&document.getElementById('report-drawer-back').classList.contains('open')){var panel=document.getElementById('report-drawer'),nodes=[].slice.call(panel.querySelectorAll('button,a,summary,input,select')).filter(function(nd){return nd.getClientRects().length;});var first=nodes[0],last=nodes[nodes.length-1];if(e.shiftKey&&(document.activeElement===first||document.activeElement===panel)){e.preventDefault();if(last)last.focus();}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();if(first)first.focus();}}
194
+ });
195
+ document.getElementById('turn-category').addEventListener('click',function(e){var b=e.target.closest('button[data-purpose]');if(!b)return;this.querySelectorAll('button').forEach(function(x){x.setAttribute('aria-pressed',String(x===b));});filter();});
196
+ var turnStatus=document.getElementById('turn-status');
197
+ if(turnStatus)turnStatus.addEventListener('click',function(e){var b=e.target.closest('button[data-status]');if(!b)return;var all=this.querySelector('button[data-status=""]');if(b===all){this.querySelectorAll('button').forEach(function(x){x.setAttribute('aria-pressed',String(x===all));});}else{b.setAttribute('aria-pressed',String(b.getAttribute('aria-pressed')!=='true'));var any=[].slice.call(this.querySelectorAll('button[data-status]')).some(function(x){return x.dataset.status&&x.getAttribute('aria-pressed')==='true';});if(all)all.setAttribute('aria-pressed',String(!any));}filter();});
198
+ document.getElementById('turn-model').onchange=filter;document.getElementById('turn-search').oninput=filter;
199
+ document.addEventListener('click',function(e){var b=e.target.closest('[data-report-href]');if(!b||b.disabled)return;var href=b.getAttribute('data-report-href');if(href)location.href=href;});
200
+ ${token_report_client_1.tokenReportClient}
201
+ </script></body></html>`;
202
+ }
203
+ //# sourceMappingURL=token-report.js.map
@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AE,CAAC,qIAAqI,KAAK,8EAA8E,CAAC,GAAG,EAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAC,EAAE,EAAC,EAAE,EAAC,EAAE,EAAC,EAAE,EAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAA,EAAE,CAAA,KAAK,CAAA,CAAC,CAAA,qBAAqB,KAAK,MAAM,CAAA,CAAC,CAAA,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,yVAAyV,IAAI,IAAE,gEAAgE,yBAAyB,KAAK;0BACtiH,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAC,SAAS,CAAC;;EAExE,4CAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCvB,uCAAiB;wBACK,CAAC;AACzB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Generates a self-contained HTML dashboard page for the gateway status UI.
3
3
  * No external dependencies except xterm.js CDN for PTY viewer.
4
4
  */
5
- export declare function generateDashboardHtml(): string;
5
+ export declare function generateDashboardHtml(timezone?: string): string;
6
6
  /**
7
7
  * Minimal, self-contained login page served at GET /dashboard when API keys are
8
8
  * configured and the request has no valid dashboard session cookie. Posts the
@@ -1 +1 @@
1
- {"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../../src/ui/web-ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAkgE9C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,SAAK,GAAG,MAAM,CAiF7D"}
1
+ {"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../../src/ui/web-ui.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAQ,GAAG,MAAM,CAwtD9D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,SAAK,GAAG,MAAM,CA6F7D"}