orbital-command 1.1.0 → 1.1.3

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 (51) hide show
  1. package/bin/commands/launch.js +0 -1
  2. package/bin/commands/update.js +18 -2
  3. package/bin/lib/helpers.js +1 -31
  4. package/bin/orbital.js +32 -30
  5. package/dist/assets/{Landing-B6q9U0Vd.js → Landing-D41fKTK0.js} +1 -1
  6. package/dist/assets/{PrimitivesConfig-TlFvypvg.js → PrimitivesConfig-BDKrqwMI.js} +1 -1
  7. package/dist/assets/{QualityGates-D8uvclW4.js → QualityGates-CcrwWI45.js} +1 -1
  8. package/dist/assets/{SessionTimeline-QUaJw6Aa.js → SessionTimeline-D2IN9T3a.js} +1 -1
  9. package/dist/assets/{Settings-CAEnAZAk.js → Settings-gAsObGj2.js} +1 -1
  10. package/dist/assets/{SourceControl-DPeSBaMV.js → SourceControl-CmrDWqSs.js} +1 -1
  11. package/dist/assets/{WorkflowVisualizer-DHrIjx6W.js → WorkflowVisualizer-SxM8rp11.js} +1 -1
  12. package/dist/assets/{arrow-down-DnfKgF33.js → arrow-down-CPRn0RJb.js} +1 -1
  13. package/dist/assets/{bot-DUPnHZfM.js → bot-D2wELs5q.js} +1 -1
  14. package/dist/assets/{circle-x-B4nA79je.js → circle-x-CXIlaZex.js} +1 -1
  15. package/dist/assets/{file-text-PnzRO4pO.js → file-text-b1U7rP0E.js} +1 -1
  16. package/dist/assets/{globe-CIX_GBr0.js → globe-Dxpor8Dk.js} +1 -1
  17. package/dist/assets/{index-DQVAzHMu.js → index-xFU6WWfl.js} +36 -36
  18. package/dist/assets/{key-DpAZM-3d.js → key-CBLFsYFp.js} +1 -1
  19. package/dist/assets/{minus-CJlpKNUB.js → minus-pmCQmtIS.js} +1 -1
  20. package/dist/assets/{radio-DhynLcSx.js → radio-Cf5n4Vr7.js} +1 -1
  21. package/dist/assets/{rocket-DnuQh3sF.js → rocket-grx18Wv8.js} +1 -1
  22. package/dist/assets/{shield-DLMQmvFQ.js → shield-Cgjh9h5t.js} +1 -1
  23. package/dist/assets/{useSocketListener-DPrExNDV.js → useSocketListener-BW3fKan5.js} +1 -1
  24. package/dist/assets/{useWorkflowEditor-BxN7phfr.js → useWorkflowEditor-BRepFz22.js} +1 -1
  25. package/dist/assets/{workflow-constants-ZcCN11vm.js → workflow-constants-YePmoWgU.js} +1 -1
  26. package/dist/assets/{zap-eJ3z8HRI.js → zap-rWDVJHlW.js} +1 -1
  27. package/dist/index.html +1 -1
  28. package/dist/server/server/index.js +1 -9
  29. package/dist/server/server/launch.js +0 -3
  30. package/dist/server/server/routes/sync-routes.js +2 -2
  31. package/dist/server/server/services/telemetry-service.js +143 -0
  32. package/dist/server/server/wizard/detect.js +0 -79
  33. package/dist/server/server/wizard/index.js +27 -91
  34. package/dist/server/server/wizard/types.js +2 -3
  35. package/package.json +1 -1
  36. package/server/index.ts +0 -13
  37. package/server/launch.ts +0 -3
  38. package/server/routes/sync-routes.ts +2 -2
  39. package/server/wizard/detect.ts +1 -81
  40. package/server/wizard/index.ts +29 -116
  41. package/server/wizard/types.ts +2 -17
  42. package/templates/hooks/block-push.sh +16 -2
  43. package/templates/hooks/git-commit-guard.sh +3 -2
  44. package/dist/server/server/wizard/phases/confirm.js +0 -39
  45. package/dist/server/server/wizard/phases/project-setup.js +0 -90
  46. package/dist/server/server/wizard/phases/welcome.js +0 -32
  47. package/dist/server/server/wizard/phases/workflow-setup.js +0 -22
  48. package/server/wizard/phases/confirm.ts +0 -45
  49. package/server/wizard/phases/project-setup.ts +0 -106
  50. package/server/wizard/phases/welcome.ts +0 -39
  51. package/server/wizard/phases/workflow-setup.ts +0 -28
@@ -38,7 +38,6 @@ export function cmdLaunchOrDev(forceViteFlag) {
38
38
  const env = {
39
39
  ...process.env,
40
40
  ORBITAL_LAUNCH_MODE: 'central',
41
- ORBITAL_AUTO_REGISTER: projectRoot,
42
41
  ORBITAL_SERVER_PORT: String(serverPort),
43
42
  };
44
43
 
@@ -1,6 +1,8 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
1
3
  import {
2
4
  detectProjectRoot,
3
- stampTemplateVersion,
5
+ getPackageVersion,
4
6
  loadSharedModule,
5
7
  } from '../lib/helpers.js';
6
8
 
@@ -11,7 +13,21 @@ export async function cmdUpdate(args) {
11
13
  const { runUpdate } = await loadSharedModule();
12
14
  runUpdate(projectRoot, { dryRun });
13
15
 
14
- if (!dryRun) stampTemplateVersion(projectRoot);
16
+ if (!dryRun) {
17
+ const configPath = path.join(projectRoot, '.claude', 'orbital.config.json');
18
+ if (fs.existsSync(configPath)) {
19
+ try {
20
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
21
+ const version = getPackageVersion();
22
+ if (config.templateVersion !== version) {
23
+ config.templateVersion = version;
24
+ const tmp = configPath + `.tmp.${process.pid}`;
25
+ fs.writeFileSync(tmp, JSON.stringify(config, null, 2) + '\n', 'utf8');
26
+ fs.renameSync(tmp, configPath);
27
+ }
28
+ } catch { /* ignore malformed config */ }
29
+ }
30
+ }
15
31
  }
16
32
 
17
33
  export async function cmdUninstall(args) {
@@ -39,15 +39,6 @@ export function resolveBin(name) {
39
39
  return null;
40
40
  }
41
41
 
42
- export function isGitRepo() {
43
- try {
44
- execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8', stdio: 'pipe' });
45
- return true;
46
- } catch {
47
- return false;
48
- }
49
- }
50
-
51
42
  export function detectProjectRoot() {
52
43
  try {
53
44
  return execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8', stdio: 'pipe' }).trim();
@@ -56,13 +47,6 @@ export function detectProjectRoot() {
56
47
  }
57
48
  }
58
49
 
59
- export function requireGitRepo() {
60
- if (!isGitRepo()) {
61
- console.error('Not a git repository. Run `orbital` from inside a project directory.');
62
- process.exit(1);
63
- }
64
- }
65
-
66
50
  export function loadConfig(projectRoot) {
67
51
  const configPath = path.join(projectRoot, '.claude', 'orbital.config.json');
68
52
  if (fs.existsSync(configPath)) {
@@ -84,21 +68,6 @@ export function getPackageVersion() {
84
68
  }
85
69
  }
86
70
 
87
- export function stampTemplateVersion(projectRoot) {
88
- const configPath = path.join(projectRoot, '.claude', 'orbital.config.json');
89
- if (!fs.existsSync(configPath)) return;
90
-
91
- try {
92
- const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
93
- const version = getPackageVersion();
94
- if (config.templateVersion !== version) {
95
- config.templateVersion = version;
96
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
97
- console.log(` Stamped templateVersion: ${version}`);
98
- }
99
- } catch { /* ignore malformed config */ }
100
- }
101
-
102
71
  export function openBrowser(url) {
103
72
  const platform = process.platform;
104
73
  if (platform === 'darwin') {
@@ -188,6 +157,7 @@ Usage:
188
157
  orbital <command> Run a specific command directly
189
158
 
190
159
  Commands:
160
+ launch Launch the dashboard directly
191
161
  config Modify project settings interactively
192
162
  doctor Health check and version diagnostics
193
163
  update Sync templates and apply migrations
package/bin/orbital.js CHANGED
@@ -10,7 +10,6 @@ import {
10
10
  loadSharedModule,
11
11
  loadWizardModule,
12
12
  orbitalSetupDone,
13
- stampTemplateVersion,
14
13
  printHelp,
15
14
  } from './lib/helpers.js';
16
15
 
@@ -34,9 +33,10 @@ async function runHubFlow() {
34
33
  const wiz = await loadWizardModule();
35
34
  const hubVersion = getPackageVersion();
36
35
 
37
- // First-time global setup — no menu, just run the wizard
36
+ // First-time global setup — run wizard then launch dashboard
38
37
  if (!orbitalSetupDone()) {
39
38
  await wiz.runSetupWizard(hubVersion);
39
+ cmdLaunchOrDev(false);
40
40
  return;
41
41
  }
42
42
 
@@ -45,23 +45,22 @@ async function runHubFlow() {
45
45
  path.join(hubRoot, '.claude', 'orbital.config.json')
46
46
  );
47
47
  const hubRegistry = loadRegistry();
48
- const projectNames = (hubRegistry.projects || []).map(p => p.name);
49
48
 
50
- // No registered projects — launch dashboard directly.
49
+ // Not an initialized project — launch dashboard directly.
51
50
  // The frontend Add Project modal handles project setup.
52
- if (!isInitialized && projectNames.length === 0) {
51
+ if (!isInitialized) {
53
52
  cmdLaunchOrDev(false);
54
53
  return;
55
54
  }
56
55
 
57
- // Show hub menu (initialized OR has registered projects)
56
+ // Show hub menu for initialized projects
57
+ const projectNames = (hubRegistry.projects || []).map(p => p.name);
58
58
  const projects = (hubRegistry.projects || [])
59
59
  .filter(p => p.enabled !== false)
60
60
  .map(p => ({ name: p.name, path: p.path }));
61
61
 
62
62
  const hubResult = await wiz.runHub({
63
63
  packageVersion: hubVersion,
64
- isProjectInitialized: isInitialized,
65
64
  projectNames,
66
65
  itermPromptShown: hubRegistry.itermPromptShown === true,
67
66
  isMac: process.platform === 'darwin',
@@ -85,26 +84,29 @@ async function runHubFlow() {
85
84
  writeRegistryAtomic(hubRegistry);
86
85
  }
87
86
 
88
- // Route the chosen action
89
- switch (hubResult.action) {
90
- case 'launch': cmdLaunchOrDev(false); break;
91
- case 'init':
92
- await wiz.runProjectSetup(hubRoot, hubVersion, []);
93
- stampTemplateVersion(hubRoot);
94
- break;
95
- case 'config': await cmdConfig([]); break;
96
- case 'doctor': await cmdDoctor(); break;
97
- case 'update': await cmdUpdate([]); break;
98
- case 'status': await cmdStatus(); break;
99
- case 'reset': {
100
- const { runInit } = await loadSharedModule();
101
- runInit(hubRoot, { force: true });
102
- stampTemplateVersion(hubRoot);
103
- break;
87
+ // Route the chosen action, then loop back to menu
88
+ let action = hubResult.action;
89
+
90
+ while (true) {
91
+ switch (action) {
92
+ case 'launch': cmdLaunchOrDev(false); return;
93
+ case 'config': await cmdConfig([]); break;
94
+ case 'doctor': await cmdDoctor(); break;
95
+ case 'update': await cmdUpdate([]); break;
96
+ case 'status': await cmdStatus(); break;
97
+ case 'reset': {
98
+ const { runInit } = await loadSharedModule();
99
+ runInit(hubRoot, { force: true });
100
+ break;
101
+ }
102
+ default:
103
+ console.error(`Unknown action: ${action}`);
104
+ process.exit(1);
104
105
  }
105
- default:
106
- console.error(`Unknown action: ${hubResult.action}`);
107
- process.exit(1);
106
+
107
+ // Show menu again after completing an action
108
+ console.log('');
109
+ action = await wiz.promptHubAction(projectNames);
108
110
  }
109
111
  }
110
112
 
@@ -116,14 +118,14 @@ const [command, ...args] = process.argv.slice(2);
116
118
 
117
119
  async function main() {
118
120
  switch (command) {
119
- // Deprecated commands — silently redirect to hub
120
- case 'init':
121
- case 'setup':
122
- case 'launch':
123
121
  case undefined:
124
122
  await runHubFlow();
125
123
  break;
126
124
 
125
+ case 'launch':
126
+ cmdLaunchOrDev(false);
127
+ break;
128
+
127
129
  // Active commands
128
130
  case 'config':
129
131
  await cmdConfig(args);
@@ -1,4 +1,4 @@
1
- import{j as e}from"./ui-QhrRH5wk.js";import{a as c}from"./vendor-Bqt8AJn2.js";import{c as ee,aV as j,aW as W,aX as te,aY as Ne,aZ as we,a_ as ne,a$ as ke,b0 as Se,b1 as se,b2 as Ee,b3 as ze,b4 as O,b5 as V,b6 as Le,b7 as N,b8 as ie,b9 as G,ba as Ce,bb as I,bc as u,G as R,bd as Ie,f as ae,K as re,C as Y,be as le,S as oe,aT as ce,V as Te,L as de,E as Ae}from"./index-DQVAzHMu.js";import{Z as ue}from"./zap-eJ3z8HRI.js";import{B as me}from"./bot-DUPnHZfM.js";import{R as H}from"./rocket-DnuQh3sF.js";import{R as he}from"./radio-DhynLcSx.js";import"./charts-LGLb8hyU.js";/**
1
+ import{j as e}from"./ui-QhrRH5wk.js";import{a as c}from"./vendor-Bqt8AJn2.js";import{c as ee,aV as j,aW as W,aX as te,aY as Ne,aZ as we,a_ as ne,a$ as ke,b0 as Se,b1 as se,b2 as Ee,b3 as ze,b4 as O,b5 as V,b6 as Le,b7 as N,b8 as ie,b9 as G,ba as Ce,bb as I,bc as u,G as R,bd as Ie,f as ae,K as re,C as Y,be as le,S as oe,aT as ce,V as Te,L as de,E as Ae}from"./index-xFU6WWfl.js";import{Z as ue}from"./zap-rWDVJHlW.js";import{B as me}from"./bot-D2wELs5q.js";import{R as H}from"./rocket-grx18Wv8.js";import{R as he}from"./radio-Cf5n4Vr7.js";import"./charts-LGLb8hyU.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{E as Mt,j as e,L as lt,G as ct,H as dt}from"./ui-QhrRH5wk.js";import{a as d,b as Tt}from"./vendor-Bqt8AJn2.js";import{c as Ee,s as ee,a as R,E as $t,T as Ht,S as Ft,X as ft,u as Pe,C as Ne,b as Ce,F as ut,d as Ge,P as ht,e as Me,f as Ue,g as mt,B as se,h as je,i as Rt,j as Ot,k as xt,W as Dt,l as At,A as Lt,m as It,n as Se,o as pt,p as Bt,G as Wt,L as zt,q as _t,r as Gt,t as Ut,v as Vt,D as Jt,w as Kt,x as qe,y as Yt,z as Zt}from"./index-DQVAzHMu.js";import{C as qt,a as Xt}from"./workflow-constants-ZcCN11vm.js";import{B as Te}from"./bot-DUPnHZfM.js";import{P as gt,S as Qt,u as es}from"./useWorkflowEditor-BxN7phfr.js";import{Z as $e}from"./zap-eJ3z8HRI.js";import{F as Xe}from"./file-text-PnzRO4pO.js";import{A as Qe}from"./arrow-down-DnfKgF33.js";import{G as ts}from"./globe-CIX_GBr0.js";import"./charts-LGLb8hyU.js";/**
1
+ import{E as Mt,j as e,L as lt,G as ct,H as dt}from"./ui-QhrRH5wk.js";import{a as d,b as Tt}from"./vendor-Bqt8AJn2.js";import{c as Ee,s as ee,a as R,E as $t,T as Ht,S as Ft,X as ft,u as Pe,C as Ne,b as Ce,F as ut,d as Ge,P as ht,e as Me,f as Ue,g as mt,B as se,h as je,i as Rt,j as Ot,k as xt,W as Dt,l as At,A as Lt,m as It,n as Se,o as pt,p as Bt,G as Wt,L as zt,q as _t,r as Gt,t as Ut,v as Vt,D as Jt,w as Kt,x as qe,y as Yt,z as Zt}from"./index-xFU6WWfl.js";import{C as qt,a as Xt}from"./workflow-constants-YePmoWgU.js";import{B as Te}from"./bot-D2wELs5q.js";import{P as gt,S as Qt,u as es}from"./useWorkflowEditor-BRepFz22.js";import{Z as $e}from"./zap-rWDVJHlW.js";import{F as Xe}from"./file-text-b1U7rP0E.js";import{A as Qe}from"./arrow-down-CPRn0RJb.js";import{G as ts}from"./globe-Dxpor8Dk.js";import"./charts-LGLb8hyU.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{j as e}from"./ui-QhrRH5wk.js";import{c as j,e as k,j as D,E as le,H as g,I as oe,J as ie,K as U,T as ce,a as x,B as v,M as de,s as $,o as B,N as W,O as X,Q as q,h as me,R as xe,U as ue,V as pe,w as he,S as fe}from"./index-DQVAzHMu.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{u as R,f as L}from"./useSocketListener-DPrExNDV.js";import{C as ge,E as K}from"./workflow-constants-ZcCN11vm.js";import{S as T}from"./shield-DLMQmvFQ.js";import{Z as y}from"./zap-eJ3z8HRI.js";import{F as je}from"./file-text-PnzRO4pO.js";import{C as Y}from"./circle-x-B4nA79je.js";import{R as S,A as be,C as J,X as E,Y as _,T as A,a as Ne,B as I,b as w,d as C}from"./charts-LGLb8hyU.js";/**
1
+ import{j as e}from"./ui-QhrRH5wk.js";import{c as j,e as k,j as D,E as le,H as g,I as oe,J as ie,K as U,T as ce,a as x,B as v,M as de,s as $,o as B,N as W,O as X,Q as q,h as me,R as xe,U as ue,V as pe,w as he,S as fe}from"./index-xFU6WWfl.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{u as R,f as L}from"./useSocketListener-BW3fKan5.js";import{C as ge,E as K}from"./workflow-constants-YePmoWgU.js";import{S as T}from"./shield-Cgjh9h5t.js";import{Z as y}from"./zap-rWDVJHlW.js";import{F as je}from"./file-text-b1U7rP0E.js";import{C as Y}from"./circle-x-CXIlaZex.js";import{R as S,A as be,C as J,X as E,Y as _,T as A,a as Ne,B as I,b as w,d as C}from"./charts-LGLb8hyU.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./ui-QhrRH5wk.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{q as V,ak as q,s as B,w as J,V as D,B as y,g as F,a as T,ab as b,al as E,am as U,a9 as K,h as W,f as Q}from"./index-DQVAzHMu.js";import{F as X}from"./file-text-PnzRO4pO.js";import"./charts-LGLb8hyU.js";const Y={createScope:"Created",reviewScope:"Reviewed",implementScope:"Implemented",verifyScope:"Verified",reviewGate:"Review Gate",fixReview:"Fix Review",commit:"Committed",pushToMain:"Pushed to Main",pushToDev:"Pushed to Dev",pushToStaging:"PR to Staging",pushToProduction:"PR to Production"};function z(s){return Y[s]??s}function ie(){const{activeProjectId:s,getApiBase:t}=V(),[n,o]=d.useState([]),[c,x]=d.useState(!0),[a,m]=d.useState(null),[r,j]=d.useState(null),[w,u]=d.useState(!1),[S,h]=d.useState(!1),v=d.useRef(),[R,_]=d.useState({}),{neonGlass:G}=q(),M=d.useCallback(async()=>{try{const l=await fetch("/api/orbital/aggregate/sessions");if(!l.ok)return;const p=await l.json(),g={};for(const A of p)A.project_id&&(g[A.project_id]=(g[A.project_id]??0)+1);_(g)}catch{}},[]);d.useEffect(()=>{M()},[M]);const k=d.useCallback(async()=>{try{const l=s?`${t(s)}/sessions`:"/api/orbital/aggregate/sessions",p=await fetch(l);p.ok&&o(await p.json())}catch{}finally{x(!1)}},[s,t]);d.useEffect(()=>{k()},[k]),d.useEffect(()=>{const l=()=>{k(),M()};return B.on("session:updated",l),()=>{B.off("session:updated",l)}},[k,M]);const f=n,$=d.useCallback(async l=>{m(l),j(null),u(!0);try{const p=t(l.project_id??s),g=await fetch(`${p}/sessions/${l.id}/content`);g.ok&&j(await g.json())}catch{}finally{u(!1)}},[t]);d.useEffect(()=>{a&&!f.some(l=>l.id===a.id)&&(m(null),j(null))},[f,a]),d.useEffect(()=>{!a&&f.length>0&&$(f[0])},[f,a,$]);const H=d.useCallback(async()=>{const l=r==null?void 0:r.claude_session_id;if(!(!a||!l)){h(!0);try{const p=t(a.project_id??s);await fetch(`${p}/sessions/${a.id}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claude_session_id:l})})}catch{}finally{v.current=setTimeout(()=>h(!1),2e3)}}},[a,r,t]);d.useEffect(()=>()=>{clearTimeout(v.current)},[]);const O=!c&&f.length>0;return e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[e.jsx(J,{countOverrides:R}),e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(D,{className:"h-4 w-4 text-primary"}),e.jsx("h1",{className:"text-xl font-light",children:"Sessions"}),!c&&e.jsxs(y,{variant:"secondary",children:[f.length," sessions"]})]}),e.jsxs("div",{className:"flex flex-1 gap-0 overflow-hidden rounded-lg border border-border/50",children:[e.jsx("div",{className:"w-[40%] border-r border-border/50 overflow-hidden",children:c?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):O?e.jsx(F,{className:"h-full",children:e.jsxs("div",{className:"relative p-3",children:[e.jsx("div",{className:"absolute left-6 top-[29px] bottom-3 w-px bg-border"}),e.jsx("div",{className:"space-y-1",children:f.map(l=>e.jsx(Z,{session:l,isSelected:(a==null?void 0:a.id)===l.id,neonGlass:G,onClick:()=>$(l)},l.id))})]})}):e.jsx("div",{className:"flex h-full items-center justify-center p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(D,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground/30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No session history yet."})]})})}),e.jsx("div",{className:"w-[60%] overflow-hidden",children:a?e.jsx(ee,{session:a,detail:r,loading:w,resuming:S,onResume:H}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(D,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground/30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c?"":O?"Select a session to view details":""})]})})})]})]})}function Z({session:s,isSelected:t,neonGlass:n,onClick:o}){var m;const c=s.scope_ids,x=Array.isArray(s.discoveries)?s.discoveries:[],a=Array.isArray(s.next_steps)?s.next_steps:[];return e.jsxs("div",{className:"relative pl-8 cursor-pointer",onClick:o,children:[e.jsx("div",{className:T("absolute left-[8px] top-3 h-2.5 w-2.5 rounded-full border-2",t?"border-primary bg-primary":"border-muted-foreground/40 bg-background",n&&"timeline-dot-glow glow-blue")}),e.jsxs("div",{className:T("rounded-md px-3 py-2 transition-colors",t?"bg-primary/10 border border-primary/30":"hover:bg-muted/50"),children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.started_at&&e.jsx("span",{className:"text-xxs text-muted-foreground",children:b(new Date(s.started_at),"MMM d")}),c.slice(0,3).map(r=>e.jsx(y,{variant:"outline",className:"font-mono text-xxs px-1 py-0",children:E(r)},r)),c.length>3&&e.jsxs("span",{className:"text-xxs text-muted-foreground",children:["+",c.length-3]}),(m=s.actions)==null?void 0:m.slice(0,2).map(r=>e.jsx(y,{variant:"secondary",className:"text-xxs px-1 py-0 font-light",children:z(r)},r))]}),e.jsx("p",{className:T("mt-0.5 text-xs font-normal truncate",t?"text-foreground":"text-foreground/80"),children:s.summary?P(s.summary,80):"Untitled Session"}),e.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xxs text-muted-foreground",children:[x.length>0&&e.jsxs("span",{className:"text-bid-green",children:[x.length," completed"]}),a.length>0&&e.jsxs("span",{className:"text-accent-blue",children:[a.length," next"]})]})]})]})}function ee({session:s,detail:t,loading:n,resuming:o,onResume:c}){var S;const x=s.scope_ids,a=Array.isArray(s.discoveries)?s.discoveries:[],m=Array.isArray(s.next_steps)?s.next_steps:[],r=(t==null?void 0:t.meta)??null,j=!!(t!=null&&t.claude_session_id),w=(r==null?void 0:r.summary)??s.summary??null,u=[];return x.length>0&&u.push(["Scopes",x.map(h=>E(h)).join(", ")]),((S=s.actions)==null?void 0:S.length)>0&&u.push(["Actions",s.actions.map(z).join(", ")]),s.summary&&u.push(["Summary",P(s.summary,200)]),u.push(["Started",s.started_at?b(new Date(s.started_at),"MMM d, h:mm a"):"—"]),u.push(["Ended",s.ended_at?b(new Date(s.ended_at),"MMM d, h:mm a"):"—"]),r!=null&&r.branch&&r.branch!=="unknown"&&u.push(["Branch",r.branch,"font-mono text-xxs"]),r&&r.fileSize>0&&u.push(["File size",te(r.fileSize)]),r&&u.push(["Plan",r.slug,"text-muted-foreground",`/api/orbital/open-file?path=scopes/${r.slug}.md`]),s.handoff_file&&u.push(["Handoff",s.handoff_file,"font-mono text-xxs"]),t!=null&&t.claude_session_id&&u.push(["Session ID",t.claude_session_id,"font-mono text-xxs text-muted-foreground"]),e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"px-5 pt-4 pb-3",children:[e.jsxs("div",{className:"text-xxs text-muted-foreground",children:[s.started_at&&b(new Date(s.started_at),"MMM d, yyyy — h:mm a"),x.length>0&&x.slice(0,4).map(h=>e.jsx("span",{className:"ml-1.5",children:e.jsx(y,{variant:"outline",className:"font-mono text-xxs",children:E(h)})},h)),x.length>4&&e.jsxs("span",{className:"ml-1 text-xxs",children:["+",x.length-4]})]}),e.jsx("h2",{className:"mt-1 text-sm font-light",children:w?P(w,120):"Untitled Session"})]}),e.jsx(U,{}),e.jsx(F,{className:"flex-1",children:e.jsx("div",{className:"px-5 py-4",children:n?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full table-fixed text-xs",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-28"}),e.jsx("col",{})]}),e.jsx("tbody",{className:"[&_td]:border-b [&_td]:border-border/30 [&_td]:py-2 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap [&_td:last-child]:break-all",children:u.map(([h,v,R,_])=>e.jsxs("tr",{children:[e.jsx("td",{children:h}),e.jsx("td",{className:R,children:_?e.jsxs("button",{onClick:()=>{fetch(_,{method:"POST"})},className:"inline-flex items-center gap-1.5 hover:text-accent-blue transition-colors",title:"Open file",children:[v,e.jsx(K,{className:"h-3 w-3 opacity-50"})]}):v})]},h))})]}),e.jsx(I,{title:"Completed",items:a,color:"text-bid-green"}),e.jsx(I,{title:"Next Steps",items:m,color:"text-accent-blue"}),(t==null?void 0:t.stats)&&e.jsx(se,{stats:t.stats}),s.handoff_file&&e.jsxs("div",{className:"mt-4 flex items-center gap-1.5 text-xxs text-muted-foreground/60",children:[e.jsx(X,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:s.handoff_file})]})]})})}),!n&&e.jsxs("div",{className:"border-t border-border/50 px-5 py-3",children:[e.jsxs(W,{className:"w-full",disabled:!j||o,onClick:c,title:j?"Open in iTerm":"No Claude Code session found",children:[e.jsx(Q,{className:"mr-2 h-4 w-4"}),o?"Opening iTerm...":"Resume Session"]}),!j&&e.jsx("p",{className:"mt-1.5 text-center text-xxs text-muted-foreground",children:"No matching Claude Code session found"})]})]})}function se({stats:s}){const{user:t,assistant:n,system:o,timing:c}=s,x=Object.entries(n.toolsUsed).sort((a,m)=>m[1]-a[1]);return e.jsxs("div",{className:"mt-5 space-y-4",children:[e.jsx(U,{}),e.jsxs(N,{title:"Timing",children:[c.durationMs>0&&e.jsx(i,{label:"Duration",value:L(c.durationMs)}),c.firstTimestamp&&e.jsx(i,{label:"First event",value:b(new Date(c.firstTimestamp),"MMM d, h:mm:ss a")}),c.lastTimestamp&&e.jsx(i,{label:"Last event",value:b(new Date(c.lastTimestamp),"MMM d, h:mm:ss a")})]}),e.jsxs(N,{title:"User",children:[e.jsx(i,{label:"Messages",value:`${t.totalMessages-t.metaMessages-t.toolResults} direct, ${t.metaMessages} meta, ${t.toolResults} tool results`}),t.commands.length>0&&e.jsx(i,{label:"Commands",value:t.commands.join(", "),cls:"font-mono"}),t.permissionModes.length>0&&e.jsx(i,{label:"Permission modes",value:t.permissionModes.join(", ")}),t.version&&e.jsx(i,{label:"Claude Code version",value:t.version,cls:"font-mono"}),t.cwd&&e.jsx(i,{label:"Working directory",value:t.cwd,cls:"font-mono text-xxs"})]}),e.jsxs(N,{title:"Assistant",children:[e.jsx(i,{label:"Responses",value:String(n.totalMessages)}),n.models.length>0&&e.jsx(i,{label:"Models",value:n.models.join(", "),cls:"font-mono"}),e.jsx(i,{label:"Input tokens",value:C(n.totalInputTokens)}),e.jsx(i,{label:"Output tokens",value:C(n.totalOutputTokens)}),n.totalCacheReadTokens>0&&e.jsx(i,{label:"Cache read tokens",value:C(n.totalCacheReadTokens)}),n.totalCacheCreationTokens>0&&e.jsx(i,{label:"Cache creation tokens",value:C(n.totalCacheCreationTokens)}),x.length>0&&e.jsxs("tr",{children:[e.jsx("td",{className:"pr-3 text-muted-foreground whitespace-nowrap align-top",children:"Tools used"}),e.jsx("td",{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:x.map(([a,m])=>e.jsxs(y,{variant:"outline",className:"font-mono text-xxs px-1.5 py-0",children:[a," ",e.jsx("span",{className:"ml-1 text-muted-foreground",children:m})]},a))})})]})]}),o.totalMessages>0&&e.jsxs(N,{title:"System",children:[e.jsx(i,{label:"Events",value:String(o.totalMessages)}),o.subtypes.length>0&&e.jsx(i,{label:"Subtypes",value:o.subtypes.join(", ")}),o.stopReasons.length>0&&e.jsx(i,{label:"Stop reasons",value:o.stopReasons.join(", ")}),o.totalDurationMs>0&&e.jsx(i,{label:"Total processing",value:L(o.totalDurationMs)}),o.hookCount>0&&e.jsx(i,{label:"Hooks fired",value:`${o.hookCount}${o.hookErrors>0?` (${o.hookErrors} errors)`:""}`})]}),e.jsx(N,{title:"Raw Counts",children:Object.entries(s.typeCounts).sort((a,m)=>m[1]-a[1]).map(([a,m])=>e.jsx(i,{label:a,value:String(m)},a))})]})}function N({title:s,children:t}){return e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-xxs font-medium uppercase tracking-wider text-foreground",children:s}),e.jsxs("table",{className:"w-full table-fixed text-xs",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-40"}),e.jsx("col",{})]}),e.jsx("tbody",{className:"[&_td]:border-b [&_td]:border-border/20 [&_td]:py-1.5 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap",children:t})]})]})}function i({label:s,value:t,cls:n}){return e.jsxs("tr",{children:[e.jsx("td",{children:s}),e.jsx("td",{className:n,children:t})]})}function I({title:s,items:t,color:n}){return t.length===0?null:e.jsxs("div",{className:"mt-5",children:[e.jsx("h4",{className:"mb-2 text-xxs font-medium uppercase tracking-wider text-foreground",children:s}),e.jsx("ul",{className:"space-y-1.5",children:t.map(o=>e.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[e.jsx("span",{className:T("mt-0.5",n),children:"•"}),e.jsx("span",{children:o})]},o))})]})}function P(s,t){return s.length>t?s.slice(0,t)+"...":s}function te(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function L(s){if(s<1e3)return`${s}ms`;const t=Math.floor(s/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),o=t%60;if(n<60)return`${n}m ${o}s`;const c=Math.floor(n/60),x=n%60;return`${c}h ${x}m`}function C(s){return s.toLocaleString()}export{ie as SessionTimeline};
1
+ import{j as e}from"./ui-QhrRH5wk.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{q as V,ak as q,s as B,w as J,V as D,B as y,g as F,a as T,ab as b,al as E,am as U,a9 as K,h as W,f as Q}from"./index-xFU6WWfl.js";import{F as X}from"./file-text-b1U7rP0E.js";import"./charts-LGLb8hyU.js";const Y={createScope:"Created",reviewScope:"Reviewed",implementScope:"Implemented",verifyScope:"Verified",reviewGate:"Review Gate",fixReview:"Fix Review",commit:"Committed",pushToMain:"Pushed to Main",pushToDev:"Pushed to Dev",pushToStaging:"PR to Staging",pushToProduction:"PR to Production"};function z(s){return Y[s]??s}function ie(){const{activeProjectId:s,getApiBase:t}=V(),[n,o]=d.useState([]),[c,x]=d.useState(!0),[a,m]=d.useState(null),[r,j]=d.useState(null),[w,u]=d.useState(!1),[S,h]=d.useState(!1),v=d.useRef(),[R,_]=d.useState({}),{neonGlass:G}=q(),M=d.useCallback(async()=>{try{const l=await fetch("/api/orbital/aggregate/sessions");if(!l.ok)return;const p=await l.json(),g={};for(const A of p)A.project_id&&(g[A.project_id]=(g[A.project_id]??0)+1);_(g)}catch{}},[]);d.useEffect(()=>{M()},[M]);const k=d.useCallback(async()=>{try{const l=s?`${t(s)}/sessions`:"/api/orbital/aggregate/sessions",p=await fetch(l);p.ok&&o(await p.json())}catch{}finally{x(!1)}},[s,t]);d.useEffect(()=>{k()},[k]),d.useEffect(()=>{const l=()=>{k(),M()};return B.on("session:updated",l),()=>{B.off("session:updated",l)}},[k,M]);const f=n,$=d.useCallback(async l=>{m(l),j(null),u(!0);try{const p=t(l.project_id??s),g=await fetch(`${p}/sessions/${l.id}/content`);g.ok&&j(await g.json())}catch{}finally{u(!1)}},[t]);d.useEffect(()=>{a&&!f.some(l=>l.id===a.id)&&(m(null),j(null))},[f,a]),d.useEffect(()=>{!a&&f.length>0&&$(f[0])},[f,a,$]);const H=d.useCallback(async()=>{const l=r==null?void 0:r.claude_session_id;if(!(!a||!l)){h(!0);try{const p=t(a.project_id??s);await fetch(`${p}/sessions/${a.id}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claude_session_id:l})})}catch{}finally{v.current=setTimeout(()=>h(!1),2e3)}}},[a,r,t]);d.useEffect(()=>()=>{clearTimeout(v.current)},[]);const O=!c&&f.length>0;return e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[e.jsx(J,{countOverrides:R}),e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(D,{className:"h-4 w-4 text-primary"}),e.jsx("h1",{className:"text-xl font-light",children:"Sessions"}),!c&&e.jsxs(y,{variant:"secondary",children:[f.length," sessions"]})]}),e.jsxs("div",{className:"flex flex-1 gap-0 overflow-hidden rounded-lg border border-border/50",children:[e.jsx("div",{className:"w-[40%] border-r border-border/50 overflow-hidden",children:c?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):O?e.jsx(F,{className:"h-full",children:e.jsxs("div",{className:"relative p-3",children:[e.jsx("div",{className:"absolute left-6 top-[29px] bottom-3 w-px bg-border"}),e.jsx("div",{className:"space-y-1",children:f.map(l=>e.jsx(Z,{session:l,isSelected:(a==null?void 0:a.id)===l.id,neonGlass:G,onClick:()=>$(l)},l.id))})]})}):e.jsx("div",{className:"flex h-full items-center justify-center p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(D,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground/30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No session history yet."})]})})}),e.jsx("div",{className:"w-[60%] overflow-hidden",children:a?e.jsx(ee,{session:a,detail:r,loading:w,resuming:S,onResume:H}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(D,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground/30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c?"":O?"Select a session to view details":""})]})})})]})]})}function Z({session:s,isSelected:t,neonGlass:n,onClick:o}){var m;const c=s.scope_ids,x=Array.isArray(s.discoveries)?s.discoveries:[],a=Array.isArray(s.next_steps)?s.next_steps:[];return e.jsxs("div",{className:"relative pl-8 cursor-pointer",onClick:o,children:[e.jsx("div",{className:T("absolute left-[8px] top-3 h-2.5 w-2.5 rounded-full border-2",t?"border-primary bg-primary":"border-muted-foreground/40 bg-background",n&&"timeline-dot-glow glow-blue")}),e.jsxs("div",{className:T("rounded-md px-3 py-2 transition-colors",t?"bg-primary/10 border border-primary/30":"hover:bg-muted/50"),children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.started_at&&e.jsx("span",{className:"text-xxs text-muted-foreground",children:b(new Date(s.started_at),"MMM d")}),c.slice(0,3).map(r=>e.jsx(y,{variant:"outline",className:"font-mono text-xxs px-1 py-0",children:E(r)},r)),c.length>3&&e.jsxs("span",{className:"text-xxs text-muted-foreground",children:["+",c.length-3]}),(m=s.actions)==null?void 0:m.slice(0,2).map(r=>e.jsx(y,{variant:"secondary",className:"text-xxs px-1 py-0 font-light",children:z(r)},r))]}),e.jsx("p",{className:T("mt-0.5 text-xs font-normal truncate",t?"text-foreground":"text-foreground/80"),children:s.summary?P(s.summary,80):"Untitled Session"}),e.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xxs text-muted-foreground",children:[x.length>0&&e.jsxs("span",{className:"text-bid-green",children:[x.length," completed"]}),a.length>0&&e.jsxs("span",{className:"text-accent-blue",children:[a.length," next"]})]})]})]})}function ee({session:s,detail:t,loading:n,resuming:o,onResume:c}){var S;const x=s.scope_ids,a=Array.isArray(s.discoveries)?s.discoveries:[],m=Array.isArray(s.next_steps)?s.next_steps:[],r=(t==null?void 0:t.meta)??null,j=!!(t!=null&&t.claude_session_id),w=(r==null?void 0:r.summary)??s.summary??null,u=[];return x.length>0&&u.push(["Scopes",x.map(h=>E(h)).join(", ")]),((S=s.actions)==null?void 0:S.length)>0&&u.push(["Actions",s.actions.map(z).join(", ")]),s.summary&&u.push(["Summary",P(s.summary,200)]),u.push(["Started",s.started_at?b(new Date(s.started_at),"MMM d, h:mm a"):"—"]),u.push(["Ended",s.ended_at?b(new Date(s.ended_at),"MMM d, h:mm a"):"—"]),r!=null&&r.branch&&r.branch!=="unknown"&&u.push(["Branch",r.branch,"font-mono text-xxs"]),r&&r.fileSize>0&&u.push(["File size",te(r.fileSize)]),r&&u.push(["Plan",r.slug,"text-muted-foreground",`/api/orbital/open-file?path=scopes/${r.slug}.md`]),s.handoff_file&&u.push(["Handoff",s.handoff_file,"font-mono text-xxs"]),t!=null&&t.claude_session_id&&u.push(["Session ID",t.claude_session_id,"font-mono text-xxs text-muted-foreground"]),e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"px-5 pt-4 pb-3",children:[e.jsxs("div",{className:"text-xxs text-muted-foreground",children:[s.started_at&&b(new Date(s.started_at),"MMM d, yyyy — h:mm a"),x.length>0&&x.slice(0,4).map(h=>e.jsx("span",{className:"ml-1.5",children:e.jsx(y,{variant:"outline",className:"font-mono text-xxs",children:E(h)})},h)),x.length>4&&e.jsxs("span",{className:"ml-1 text-xxs",children:["+",x.length-4]})]}),e.jsx("h2",{className:"mt-1 text-sm font-light",children:w?P(w,120):"Untitled Session"})]}),e.jsx(U,{}),e.jsx(F,{className:"flex-1",children:e.jsx("div",{className:"px-5 py-4",children:n?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full table-fixed text-xs",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-28"}),e.jsx("col",{})]}),e.jsx("tbody",{className:"[&_td]:border-b [&_td]:border-border/30 [&_td]:py-2 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap [&_td:last-child]:break-all",children:u.map(([h,v,R,_])=>e.jsxs("tr",{children:[e.jsx("td",{children:h}),e.jsx("td",{className:R,children:_?e.jsxs("button",{onClick:()=>{fetch(_,{method:"POST"})},className:"inline-flex items-center gap-1.5 hover:text-accent-blue transition-colors",title:"Open file",children:[v,e.jsx(K,{className:"h-3 w-3 opacity-50"})]}):v})]},h))})]}),e.jsx(I,{title:"Completed",items:a,color:"text-bid-green"}),e.jsx(I,{title:"Next Steps",items:m,color:"text-accent-blue"}),(t==null?void 0:t.stats)&&e.jsx(se,{stats:t.stats}),s.handoff_file&&e.jsxs("div",{className:"mt-4 flex items-center gap-1.5 text-xxs text-muted-foreground/60",children:[e.jsx(X,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:s.handoff_file})]})]})})}),!n&&e.jsxs("div",{className:"border-t border-border/50 px-5 py-3",children:[e.jsxs(W,{className:"w-full",disabled:!j||o,onClick:c,title:j?"Open in iTerm":"No Claude Code session found",children:[e.jsx(Q,{className:"mr-2 h-4 w-4"}),o?"Opening iTerm...":"Resume Session"]}),!j&&e.jsx("p",{className:"mt-1.5 text-center text-xxs text-muted-foreground",children:"No matching Claude Code session found"})]})]})}function se({stats:s}){const{user:t,assistant:n,system:o,timing:c}=s,x=Object.entries(n.toolsUsed).sort((a,m)=>m[1]-a[1]);return e.jsxs("div",{className:"mt-5 space-y-4",children:[e.jsx(U,{}),e.jsxs(N,{title:"Timing",children:[c.durationMs>0&&e.jsx(i,{label:"Duration",value:L(c.durationMs)}),c.firstTimestamp&&e.jsx(i,{label:"First event",value:b(new Date(c.firstTimestamp),"MMM d, h:mm:ss a")}),c.lastTimestamp&&e.jsx(i,{label:"Last event",value:b(new Date(c.lastTimestamp),"MMM d, h:mm:ss a")})]}),e.jsxs(N,{title:"User",children:[e.jsx(i,{label:"Messages",value:`${t.totalMessages-t.metaMessages-t.toolResults} direct, ${t.metaMessages} meta, ${t.toolResults} tool results`}),t.commands.length>0&&e.jsx(i,{label:"Commands",value:t.commands.join(", "),cls:"font-mono"}),t.permissionModes.length>0&&e.jsx(i,{label:"Permission modes",value:t.permissionModes.join(", ")}),t.version&&e.jsx(i,{label:"Claude Code version",value:t.version,cls:"font-mono"}),t.cwd&&e.jsx(i,{label:"Working directory",value:t.cwd,cls:"font-mono text-xxs"})]}),e.jsxs(N,{title:"Assistant",children:[e.jsx(i,{label:"Responses",value:String(n.totalMessages)}),n.models.length>0&&e.jsx(i,{label:"Models",value:n.models.join(", "),cls:"font-mono"}),e.jsx(i,{label:"Input tokens",value:C(n.totalInputTokens)}),e.jsx(i,{label:"Output tokens",value:C(n.totalOutputTokens)}),n.totalCacheReadTokens>0&&e.jsx(i,{label:"Cache read tokens",value:C(n.totalCacheReadTokens)}),n.totalCacheCreationTokens>0&&e.jsx(i,{label:"Cache creation tokens",value:C(n.totalCacheCreationTokens)}),x.length>0&&e.jsxs("tr",{children:[e.jsx("td",{className:"pr-3 text-muted-foreground whitespace-nowrap align-top",children:"Tools used"}),e.jsx("td",{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:x.map(([a,m])=>e.jsxs(y,{variant:"outline",className:"font-mono text-xxs px-1.5 py-0",children:[a," ",e.jsx("span",{className:"ml-1 text-muted-foreground",children:m})]},a))})})]})]}),o.totalMessages>0&&e.jsxs(N,{title:"System",children:[e.jsx(i,{label:"Events",value:String(o.totalMessages)}),o.subtypes.length>0&&e.jsx(i,{label:"Subtypes",value:o.subtypes.join(", ")}),o.stopReasons.length>0&&e.jsx(i,{label:"Stop reasons",value:o.stopReasons.join(", ")}),o.totalDurationMs>0&&e.jsx(i,{label:"Total processing",value:L(o.totalDurationMs)}),o.hookCount>0&&e.jsx(i,{label:"Hooks fired",value:`${o.hookCount}${o.hookErrors>0?` (${o.hookErrors} errors)`:""}`})]}),e.jsx(N,{title:"Raw Counts",children:Object.entries(s.typeCounts).sort((a,m)=>m[1]-a[1]).map(([a,m])=>e.jsx(i,{label:a,value:String(m)},a))})]})}function N({title:s,children:t}){return e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-xxs font-medium uppercase tracking-wider text-foreground",children:s}),e.jsxs("table",{className:"w-full table-fixed text-xs",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-40"}),e.jsx("col",{})]}),e.jsx("tbody",{className:"[&_td]:border-b [&_td]:border-border/20 [&_td]:py-1.5 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap",children:t})]})]})}function i({label:s,value:t,cls:n}){return e.jsxs("tr",{children:[e.jsx("td",{children:s}),e.jsx("td",{className:n,children:t})]})}function I({title:s,items:t,color:n}){return t.length===0?null:e.jsxs("div",{className:"mt-5",children:[e.jsx("h4",{className:"mb-2 text-xxs font-medium uppercase tracking-wider text-foreground",children:s}),e.jsx("ul",{className:"space-y-1.5",children:t.map(o=>e.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[e.jsx("span",{className:T("mt-0.5",n),children:"•"}),e.jsx("span",{children:o})]},o))})]})}function P(s,t){return s.length>t?s.slice(0,t)+"...":s}function te(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function L(s){if(s<1e3)return`${s}ms`;const t=Math.floor(s/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),o=t%60;if(n<60)return`${n}m ${o}s`;const c=Math.floor(n/60),x=n%60;return`${c}h ${x}m`}function C(s){return s.toLocaleString()}export{ie as SessionTimeline};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./ui-QhrRH5wk.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{c as Se,q as Te,Y as he,s as ye,C as $e,b as Pe,U as E,h as D,an as V,B as xe,a as v,a3 as pe,a5 as fe,a6 as ge,a7 as je,am as w,ao as J,K as Ue,ap as be,a8 as De,S as Ae,aq as _e,H as we,ar as Ie,as as Be,T as ze,at as Ve,aa as He,E as Je,au as Ge,d as We,P as z,X as Ee,av as Me,aw as ke,ax as Ke,ay as Ye,az as Le,g as qe}from"./index-DQVAzHMu.js";import{M as H}from"./minus-CJlpKNUB.js";import"./charts-LGLb8hyU.js";/**
1
+ import{j as e}from"./ui-QhrRH5wk.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{c as Se,q as Te,Y as he,s as ye,C as $e,b as Pe,U as E,h as D,an as V,B as xe,a as v,a3 as pe,a5 as fe,a6 as ge,a7 as je,am as w,ao as J,K as Ue,ap as be,a8 as De,S as Ae,aq as _e,H as we,ar as Ie,as as Be,T as ze,at as Ve,aa as He,E as Je,au as Ge,d as We,P as z,X as Ee,av as Me,aw as ke,ax as Ke,ay as Ye,az as Le,g as qe}from"./index-xFU6WWfl.js";import{M as H}from"./minus-pmCQmtIS.js";import"./charts-LGLb8hyU.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{j as e}from"./ui-QhrRH5wk.js";import{a as i}from"./vendor-Bqt8AJn2.js";import{c as $,e as G,Y as Pe,s as W,j as He,o as k,Q as S,G as B,Z as z,_ as Q,$ as E,a0 as J,B as f,a1 as T,a2 as K,q as ge,U as I,N as A,O as R,J as xe,g as je,a as w,K as Me,a3 as Ee,a4 as Te,h as V,a5 as $e,a6 as _e,a7 as Ie,a8 as Ge,a9 as pe,aa as ee,i as Oe,C as te,b as ae,X as Ue,V as Le,T as Ne,ab as be,H as Fe,w as he}from"./index-DQVAzHMu.js";import{u as qe,f as O}from"./useSocketListener-DPrExNDV.js";import{R as Ve,A as We,a as ze}from"./charts-LGLb8hyU.js";import{A as ye}from"./arrow-down-DnfKgF33.js";import{G as we}from"./globe-CIX_GBr0.js";import{K as Qe}from"./key-DpAZM-3d.js";import{R as se}from"./rocket-DnuQh3sF.js";import{C as me}from"./circle-x-B4nA79je.js";/**
1
+ import{j as e}from"./ui-QhrRH5wk.js";import{a as i}from"./vendor-Bqt8AJn2.js";import{c as $,e as G,Y as Pe,s as W,j as He,o as k,Q as S,G as B,Z as z,_ as Q,$ as E,a0 as J,B as f,a1 as T,a2 as K,q as ge,U as I,N as A,O as R,J as xe,g as je,a as w,K as Me,a3 as Ee,a4 as Te,h as V,a5 as $e,a6 as _e,a7 as Ie,a8 as Ge,a9 as pe,aa as ee,i as Oe,C as te,b as ae,X as Ue,V as Le,T as Ne,ab as be,H as Fe,w as he}from"./index-xFU6WWfl.js";import{u as qe,f as O}from"./useSocketListener-BW3fKan5.js";import{R as Ve,A as We,a as ze}from"./charts-LGLb8hyU.js";import{A as ye}from"./arrow-down-CPRn0RJb.js";import{G as we}from"./globe-Dxpor8Dk.js";import{K as Qe}from"./key-CBLFsYFp.js";import{R as se}from"./rocket-grx18Wv8.js";import{C as me}from"./circle-x-CXIlaZex.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{j as r,d as ts,a as ns,O as ss,b as rs,e as os,c as Ue}from"./ui-QhrRH5wk.js";import{r as Xr,g as ic,d as is,a as N,b as ac}from"./vendor-Bqt8AJn2.js";import{i as cc,e as Hs,f as Os,g as lc,h as dc,j as uc,k as qt,l as En}from"./charts-LGLb8hyU.js";import{c as Ce,e as as,p as Gr,an as qr,q as Ur,X as he,G as Kr,f as be,l as cs,K as De,H as Jt,C as fc,as as hc,d as ls,T as st,P as Te,a3 as pc,a5 as xc,a6 as mc,a7 as gc,a8 as bc,g as yc,U as Zr,V as Qr,b as Jr,a9 as wc,aa as eo,aA as to,aB as Ie,aC as vc,aD as Nc,aE as jc,aF as Cc,aG as zc,aH as kc,aI as no,n as Sc,u as Ec,aJ as _c,aK as Mc,aL as ds,aM as Ic,r as Tc,t as Bs,aN as Ac,z as Pc,D as $c,aO as Dc,aP as Lc,aQ as Rc,az as so,aR as Hc,E as Oc,k as Bc,M as Fc,aS as Vc,w as Yc,aT as Wc}from"./index-DQVAzHMu.js";import{Z as rt}from"./zap-eJ3z8HRI.js";import{b as ot,c as us,d as Xc}from"./workflow-constants-ZcCN11vm.js";import{K as Gc}from"./key-DpAZM-3d.js";import{G as fs}from"./globe-CIX_GBr0.js";import{R as hs}from"./radio-DhynLcSx.js";import{S as ro,u as qc,P as Uc}from"./useWorkflowEditor-BxN7phfr.js";import{M as oo}from"./minus-CJlpKNUB.js";import{S as hn}from"./shield-DLMQmvFQ.js";import{B as en}from"./bot-DUPnHZfM.js";import{C as Kc}from"./circle-x-B4nA79je.js";/**
1
+ import{j as r,d as ts,a as ns,O as ss,b as rs,e as os,c as Ue}from"./ui-QhrRH5wk.js";import{r as Xr,g as ic,d as is,a as N,b as ac}from"./vendor-Bqt8AJn2.js";import{i as cc,e as Hs,f as Os,g as lc,h as dc,j as uc,k as qt,l as En}from"./charts-LGLb8hyU.js";import{c as Ce,e as as,p as Gr,an as qr,q as Ur,X as he,G as Kr,f as be,l as cs,K as De,H as Jt,C as fc,as as hc,d as ls,T as st,P as Te,a3 as pc,a5 as xc,a6 as mc,a7 as gc,a8 as bc,g as yc,U as Zr,V as Qr,b as Jr,a9 as wc,aa as eo,aA as to,aB as Ie,aC as vc,aD as Nc,aE as jc,aF as Cc,aG as zc,aH as kc,aI as no,n as Sc,u as Ec,aJ as _c,aK as Mc,aL as ds,aM as Ic,r as Tc,t as Bs,aN as Ac,z as Pc,D as $c,aO as Dc,aP as Lc,aQ as Rc,az as so,aR as Hc,E as Oc,k as Bc,M as Fc,aS as Vc,w as Yc,aT as Wc}from"./index-xFU6WWfl.js";import{Z as rt}from"./zap-rWDVJHlW.js";import{b as ot,c as us,d as Xc}from"./workflow-constants-YePmoWgU.js";import{K as Gc}from"./key-CBLFsYFp.js";import{G as fs}from"./globe-Dxpor8Dk.js";import{R as hs}from"./radio-Cf5n4Vr7.js";import{S as ro,u as qc,P as Uc}from"./useWorkflowEditor-BRepFz22.js";import{M as oo}from"./minus-pmCQmtIS.js";import{S as hn}from"./shield-Cgjh9h5t.js";import{B as en}from"./bot-D2wELs5q.js";import{C as Kc}from"./circle-x-CXIlaZex.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-DQVAzHMu.js";/**
1
+ import{c as o}from"./index-xFU6WWfl.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-DQVAzHMu.js";/**
1
+ import{c as t}from"./index-xFU6WWfl.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DQVAzHMu.js";/**
1
+ import{c}from"./index-xFU6WWfl.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-DQVAzHMu.js";/**
1
+ import{c as e}from"./index-xFU6WWfl.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DQVAzHMu.js";/**
1
+ import{c}from"./index-xFU6WWfl.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.