orbital-command 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/orbital.js +3 -3
- package/dist/assets/Landing-B6q9U0Vd.js +11 -0
- package/dist/assets/{PrimitivesConfig-DThSipFy.js → PrimitivesConfig-TlFvypvg.js} +9 -14
- package/dist/assets/{QualityGates-B4kxM5UU.js → QualityGates-D8uvclW4.js} +1 -1
- package/dist/assets/SessionTimeline-QUaJw6Aa.js +1 -0
- package/dist/assets/Settings-CAEnAZAk.js +12 -0
- package/dist/assets/{SourceControl-BMNIz7Lt.js → SourceControl-DPeSBaMV.js} +7 -12
- package/dist/assets/{WorkflowVisualizer-CxuSBOYu.js → WorkflowVisualizer-DHrIjx6W.js} +1 -1
- package/dist/assets/{arrow-down-DVPp6_qp.js → arrow-down-DnfKgF33.js} +1 -1
- package/dist/assets/{bot-NFaJBDn_.js → bot-DUPnHZfM.js} +1 -1
- package/dist/assets/{circle-x-IsFCkBZu.js → circle-x-B4nA79je.js} +1 -1
- package/dist/assets/{file-text-J1cebZXF.js → file-text-PnzRO4pO.js} +1 -1
- package/dist/assets/{globe-WzeyHsUc.js → globe-CIX_GBr0.js} +1 -1
- package/dist/assets/index-B-B-tTjw.css +1 -0
- package/dist/assets/index-DQVAzHMu.js +354 -0
- package/dist/assets/{key-CKR8JJSj.js → key-DpAZM-3d.js} +1 -1
- package/dist/assets/{minus-CHBsJyjp.js → minus-CJlpKNUB.js} +1 -1
- package/dist/assets/{radio-xqZaR-Uk.js → radio-DhynLcSx.js} +1 -1
- package/dist/assets/{rocket-D_xvvNG6.js → rocket-DnuQh3sF.js} +1 -1
- package/dist/assets/{shield-TdB1yv_a.js → shield-DLMQmvFQ.js} +1 -1
- package/dist/assets/{ui-BmsSg9jU.js → ui-QhrRH5wk.js} +6 -6
- package/dist/assets/{useSocketListener-0L5yiN5i.js → useSocketListener-DPrExNDV.js} +1 -1
- package/dist/assets/{useWorkflowEditor-CqeRWVQX.js → useWorkflowEditor-BxN7phfr.js} +2 -2
- package/dist/assets/{workflow-constants-Rw-GmgHZ.js → workflow-constants-ZcCN11vm.js} +1 -1
- package/dist/assets/{zap-C9wqYMpl.js → zap-eJ3z8HRI.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/server/server/index.js +8 -1
- package/dist/server/server/routes/sync-routes.js +175 -0
- package/dist/server/server/wizard/index.js +18 -24
- package/dist/server/server/wizard/phases/setup-wizard.js +4 -34
- package/dist/server/server/wizard/types.js +1 -22
- package/dist/server/shared/workflow-presets.js +22 -0
- package/package.json +1 -1
- package/server/index.ts +7 -1
- package/server/routes/sync-routes.ts +205 -0
- package/server/wizard/index.ts +17 -31
- package/server/wizard/phases/setup-wizard.ts +7 -38
- package/server/wizard/types.ts +2 -28
- package/shared/workflow-presets.ts +28 -0
- package/dist/assets/Landing-CfQdHR0N.js +0 -11
- package/dist/assets/SessionTimeline-Bz1iZnmg.js +0 -1
- package/dist/assets/Settings-DLcZwbCT.js +0 -12
- package/dist/assets/index-BdJ57EhC.css +0 -1
- package/dist/assets/index-o4ScMAuR.js +0 -349
package/server/wizard/index.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { phaseWelcome } from './phases/welcome.js';
|
|
|
19
19
|
import { phaseProjectSetup } from './phases/project-setup.js';
|
|
20
20
|
import { phaseWorkflowSetup } from './phases/workflow-setup.js';
|
|
21
21
|
import { phaseConfirm, showPostInstall } from './phases/confirm.js';
|
|
22
|
-
import { NOTES } from './ui.js';
|
|
23
22
|
import { runConfigEditor } from './config-editor.js';
|
|
24
23
|
import { runDoctor } from './doctor.js';
|
|
25
24
|
import { isITerm2Available } from '../adapters/iterm2-adapter.js';
|
|
@@ -30,8 +29,8 @@ export { runConfigEditor, runDoctor };
|
|
|
30
29
|
// ─── Phase 1: Setup Wizard ─────────────────────────────────────
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
* First-time setup. Creates ~/.orbital
|
|
34
|
-
*
|
|
32
|
+
* First-time setup. Creates ~/.orbital/ and seeds primitives.
|
|
33
|
+
* Project setup is now handled by the frontend Add Project modal.
|
|
35
34
|
*/
|
|
36
35
|
export async function runSetupWizard(packageVersion: string): Promise<void> {
|
|
37
36
|
const state = buildSetupState(packageVersion);
|
|
@@ -40,21 +39,7 @@ export async function runSetupWizard(packageVersion: string): Promise<void> {
|
|
|
40
39
|
|
|
41
40
|
await phaseSetupWizard(state);
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
for (const projectRoot of state.linkedProjects) {
|
|
45
|
-
p.log.step(`Setting up ${pc.cyan(path.basename(projectRoot))}...`);
|
|
46
|
-
await runProjectSetupInline(projectRoot, packageVersion);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (state.linkedProjects.length === 0) {
|
|
50
|
-
p.note(NOTES.setupComplete, 'Done');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
p.outro(
|
|
54
|
-
state.linkedProjects.length > 0
|
|
55
|
-
? `Run ${pc.cyan('orbital')} to launch the dashboard.`
|
|
56
|
-
: `Run ${pc.cyan('orbital')} in a project directory to get started.`
|
|
57
|
-
);
|
|
42
|
+
p.outro(`Run ${pc.cyan('orbital')} to launch the dashboard and add your first project.`);
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
// ─── Phase 2: Project Setup ────────────────────────────────────
|
|
@@ -119,17 +104,6 @@ async function runProjectPhases(state: ReturnType<typeof buildProjectState>, use
|
|
|
119
104
|
showPostInstall(state);
|
|
120
105
|
}
|
|
121
106
|
|
|
122
|
-
/**
|
|
123
|
-
* Inline project setup — called from Phase 1 when user links a project.
|
|
124
|
-
* Skips intro/outro since the setup wizard already has those.
|
|
125
|
-
*/
|
|
126
|
-
async function runProjectSetupInline(projectRoot: string, packageVersion: string): Promise<void> {
|
|
127
|
-
const state = buildProjectState(projectRoot, packageVersion);
|
|
128
|
-
|
|
129
|
-
// Skip welcome gate for inline — this is a fresh project being linked
|
|
130
|
-
await runProjectPhases(state, false);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
107
|
// ─── Update Check ─────────────────────────────────────────────
|
|
134
108
|
|
|
135
109
|
interface UpdateInfo {
|
|
@@ -138,6 +112,18 @@ interface UpdateInfo {
|
|
|
138
112
|
isOutdated: boolean;
|
|
139
113
|
}
|
|
140
114
|
|
|
115
|
+
/** Returns true if `a` is older than `b` (semver comparison). */
|
|
116
|
+
function isOlderThan(a: string, b: string): boolean {
|
|
117
|
+
const pa = a.match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
118
|
+
const pb = b.match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
119
|
+
if (!pa || !pb) return false;
|
|
120
|
+
for (let i = 1; i <= 3; i++) {
|
|
121
|
+
if (parseInt(pa[i]) < parseInt(pb[i])) return true;
|
|
122
|
+
if (parseInt(pa[i]) > parseInt(pb[i])) return false;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
141
127
|
async function checkForUpdate(
|
|
142
128
|
currentVersion: string,
|
|
143
129
|
cache: { lastUpdateCheck?: string; latestVersion?: string },
|
|
@@ -146,7 +132,7 @@ async function checkForUpdate(
|
|
|
146
132
|
if (cache.lastUpdateCheck && cache.latestVersion) {
|
|
147
133
|
const age = Date.now() - new Date(cache.lastUpdateCheck).getTime();
|
|
148
134
|
if (age < 24 * 60 * 60 * 1000) {
|
|
149
|
-
const isOutdated = cache.latestVersion
|
|
135
|
+
const isOutdated = isOlderThan(currentVersion, cache.latestVersion);
|
|
150
136
|
return {
|
|
151
137
|
info: { current: currentVersion, latest: cache.latestVersion, isOutdated },
|
|
152
138
|
cacheChanged: false,
|
|
@@ -162,7 +148,7 @@ async function checkForUpdate(
|
|
|
162
148
|
const data = await res.json() as { version: string };
|
|
163
149
|
const latest = data.version;
|
|
164
150
|
return {
|
|
165
|
-
info: { current: currentVersion, latest, isOutdated: latest
|
|
151
|
+
info: { current: currentVersion, latest, isOutdated: isOlderThan(currentVersion, latest) },
|
|
166
152
|
cacheChanged: true,
|
|
167
153
|
};
|
|
168
154
|
} catch {
|
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import * as p from '@clack/prompts';
|
|
10
|
-
import pc from 'picocolors';
|
|
11
10
|
import type { SetupState } from '../types.js';
|
|
12
11
|
import { NOTES } from '../ui.js';
|
|
13
|
-
import {
|
|
12
|
+
import { ORBITAL_HOME } from '../detect.js';
|
|
14
13
|
|
|
15
|
-
export async function phaseSetupWizard(
|
|
14
|
+
export async function phaseSetupWizard(_state: SetupState): Promise<void> {
|
|
16
15
|
// Welcome and core concepts
|
|
17
16
|
p.note(NOTES.setupWelcome, 'Welcome');
|
|
18
17
|
|
|
@@ -40,39 +39,9 @@ export async function phaseSetupWizard(state: SetupState): Promise<void> {
|
|
|
40
39
|
process.exit(1);
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
//
|
|
44
|
-
p.note(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const wantsProject = await p.confirm({
|
|
49
|
-
message: state.linkedProjects.length === 0
|
|
50
|
-
? 'Add a project now?'
|
|
51
|
-
: 'Add another project?',
|
|
52
|
-
initialValue: state.linkedProjects.length === 0,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (p.isCancel(wantsProject) || !wantsProject) {
|
|
56
|
-
addMore = false;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const projectPath = await p.text({
|
|
61
|
-
message: 'Project path',
|
|
62
|
-
placeholder: '~/Code/my-project',
|
|
63
|
-
validate: (val) => {
|
|
64
|
-
if (!val || !val.trim()) return 'Path is required';
|
|
65
|
-
return isValidProjectPath(val.trim());
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (p.isCancel(projectPath)) {
|
|
70
|
-
addMore = false;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const resolved = resolveProjectPath(projectPath.trim());
|
|
75
|
-
state.linkedProjects.push(resolved);
|
|
76
|
-
p.log.success(`Added: ${pc.cyan(resolved)}`);
|
|
77
|
-
}
|
|
42
|
+
// Direct user to the dashboard for project setup
|
|
43
|
+
p.note(
|
|
44
|
+
'Launch the dashboard to add your first project.\nThe setup wizard will guide you through it.',
|
|
45
|
+
'Next Steps',
|
|
46
|
+
);
|
|
78
47
|
}
|
package/server/wizard/types.ts
CHANGED
|
@@ -26,31 +26,5 @@ export interface ProjectSetupState {
|
|
|
26
26
|
workflowPreset?: string; // 'default' | 'minimal' | 'development' | 'gitflow'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
label: string;
|
|
32
|
-
hint: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export const WORKFLOW_PRESETS: PresetInfo[] = [
|
|
36
|
-
{
|
|
37
|
-
value: 'default',
|
|
38
|
-
label: 'Default',
|
|
39
|
-
hint: '7 lists, trunk-based — Icebox → Planning → Backlog → Implementing → Review → Completed → Main',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
value: 'minimal',
|
|
43
|
-
label: 'Minimal',
|
|
44
|
-
hint: '3 lists — To Do → In Progress → Done',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
value: 'development',
|
|
48
|
-
label: 'Development',
|
|
49
|
-
hint: '5 lists, dev branch — Backlog → Implementing → Review → Completed → Dev',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
value: 'gitflow',
|
|
53
|
-
label: 'Gitflow',
|
|
54
|
-
hint: '9 lists, multi-branch — Full pipeline with Dev, Staging, and Production',
|
|
55
|
-
},
|
|
56
|
-
];
|
|
29
|
+
export type { PresetInfo } from '../../shared/workflow-presets.js';
|
|
30
|
+
export { WORKFLOW_PRESETS } from '../../shared/workflow-presets.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface PresetInfo {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
hint: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const WORKFLOW_PRESETS: PresetInfo[] = [
|
|
8
|
+
{
|
|
9
|
+
value: 'default',
|
|
10
|
+
label: 'Default',
|
|
11
|
+
hint: '7 lists, trunk-based — Icebox → Planning → Backlog → Implementing → Review → Completed → Main',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: 'minimal',
|
|
15
|
+
label: 'Minimal',
|
|
16
|
+
hint: '3 lists — To Do → In Progress → Done',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: 'development',
|
|
20
|
+
label: 'Development',
|
|
21
|
+
hint: '5 lists, dev branch — Backlog → Implementing → Review → Completed → Dev',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 'gitflow',
|
|
25
|
+
label: 'Gitflow',
|
|
26
|
+
hint: '9 lists, multi-branch — Full pipeline with Dev, Staging, and Production',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./ui-BmsSg9jU.js";import{a as c}from"./vendor-Bqt8AJn2.js";import{c as ee,aX as j,aY as O,aZ as te,a_ as Ne,a$ as we,b0 as ne,b1 as ke,b2 as Se,b3 as se,b4 as Ee,b5 as ze,b6 as W,b7 as V,b8 as Le,b9 as N,ba as ie,bb as G,bc as Ce,bd as I,be as u,G as T,bf as Ie,f as ae,J as re,C as Y,bg as le,S as oe,aV as ce,U as Ae,L as de,E as Me}from"./index-o4ScMAuR.js";import{Z as ue}from"./zap-C9wqYMpl.js";import{B as me}from"./bot-NFaJBDn_.js";import{R as H}from"./rocket-D_xvvNG6.js";import{R as he}from"./radio-xqZaR-Uk.js";import"./charts-LGLb8hyU.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Re=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],fe=ee("command",Re);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Te=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],ge=ee("cpu",Te);function xe(t,n){let a;const s=()=>{const{currentTime:i}=n,l=(i===null?0:i.value)/100;a!==l&&t(l),a=l};return j.update(s,!0),()=>O(s)}const z=new WeakMap;let p;function Fe(t,n){if(n){const{inlineSize:a,blockSize:s}=n[0];return{width:a,height:s}}else return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}function Oe({target:t,contentRect:n,borderBoxSize:a}){var s;(s=z.get(t))===null||s===void 0||s.forEach(i=>{i({target:t,contentSize:n,get size(){return Fe(t,a)}})})}function We(t){t.forEach(Oe)}function Ve(){typeof ResizeObserver>"u"||(p=new ResizeObserver(We))}function He(t,n){p||Ve();const a=te(t);return a.forEach(s=>{let i=z.get(s);i||(i=new Set,z.set(s,i)),i.add(n),p==null||p.observe(s)}),()=>{a.forEach(s=>{const i=z.get(s);i==null||i.delete(n),i!=null&&i.size||p==null||p.unobserve(s)})}}const L=new Set;let w;function Be(){w=()=>{const t={width:window.innerWidth,height:window.innerHeight},n={target:window,size:t,contentSize:t};L.forEach(a=>a(n))},window.addEventListener("resize",w)}function Pe(t){return L.add(t),w||Be(),()=>{L.delete(t),!L.size&&w&&(w=void 0)}}function De(t,n){return typeof t=="function"?Pe(t):He(t,n)}const _e=50,$=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),Ge=()=>({time:0,x:$(),y:$()}),Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function q(t,n,a,s){const i=a[n],{length:r,position:l}=Ye[n],o=i.current,m=a.time;i.current=t[`scroll${l}`],i.scrollLength=t[`scroll${r}`]-t[`client${r}`],i.offset.length=0,i.offset[0]=0,i.offset[1]=i.scrollLength,i.progress=Ne(0,i.scrollLength,i.current);const d=s-m;i.velocity=d>_e?0:we(i.current-o,d)}function $e(t,n,a){q(t,"x",n,a),q(t,"y",n,a),n.time=a}function qe(t,n){const a={x:0,y:0};let s=t;for(;s&&s!==n;)if(s instanceof HTMLElement)a.x+=s.offsetLeft,a.y+=s.offsetTop,s=s.offsetParent;else if(s.tagName==="svg"){const i=s.getBoundingClientRect();s=s.parentElement;const r=s.getBoundingClientRect();a.x+=i.left-r.left,a.y+=i.top-r.top}else if(s instanceof SVGGraphicsElement){const{x:i,y:r}=s.getBBox();a.x+=i,a.y+=r;let l=null,o=s.parentNode;for(;!l;)o.tagName==="svg"&&(l=o),o=s.parentNode;s=l}else break;return a}const F={start:0,center:.5,end:1};function X(t,n,a=0){let s=0;if(t in F&&(t=F[t]),typeof t=="string"){const i=parseFloat(t);t.endsWith("px")?s=i:t.endsWith("%")?t=i/100:t.endsWith("vw")?s=i/100*document.documentElement.clientWidth:t.endsWith("vh")?s=i/100*document.documentElement.clientHeight:t=i}return typeof t=="number"&&(s=n*t),a+s}const Xe=[0,0];function Ze(t,n,a,s){let i=Array.isArray(t)?t:Xe,r=0,l=0;return typeof t=="number"?i=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?i=t.split(" "):i=[t,F[t]?t:"0"]),r=X(i[0],a,s),l=X(i[1],n),r-l}const Ue={All:[[0,0],[1,1]]},Je={x:0,y:0};function Ke(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function Qe(t,n,a){const{offset:s=Ue.All}=a,{target:i=t,axis:r="y"}=a,l=r==="y"?"height":"width",o=i!==t?qe(i,t):Je,m=i===t?{width:t.scrollWidth,height:t.scrollHeight}:Ke(i),d={width:t.clientWidth,height:t.clientHeight};n[r].offset.length=0;let h=!n[r].interpolate;const x=s.length;for(let f=0;f<x;f++){const _=Ze(s[f],d[l],m[l],o[r]);!h&&_!==n[r].interpolatorOffsets[f]&&(h=!0),n[r].offset[f]=_}h&&(n[r].interpolate=ne(n[r].offset,ke(s),{clamp:!1}),n[r].interpolatorOffsets=[...n[r].offset]),n[r].progress=Se(0,1,n[r].interpolate(n[r].current))}function et(t,n=t,a){if(a.x.targetOffset=0,a.y.targetOffset=0,n!==t){let s=n;for(;s&&s!==t;)a.x.targetOffset+=s.offsetLeft,a.y.targetOffset+=s.offsetTop,s=s.offsetParent}a.x.targetLength=n===t?n.scrollWidth:n.clientWidth,a.y.targetLength=n===t?n.scrollHeight:n.clientHeight,a.x.containerLength=t.clientWidth,a.y.containerLength=t.clientHeight}function tt(t,n,a,s={}){return{measure:()=>et(t,s.target,a),update:i=>{$e(t,a,i),(s.offset||s.target)&&Qe(t,a,s)},notify:()=>n(a)}}const v=new WeakMap,Z=new WeakMap,A=new WeakMap,U=t=>t===document.documentElement?window:t;function B(t,{container:n=document.documentElement,...a}={}){let s=A.get(n);s||(s=new Set,A.set(n,s));const i=Ge(),r=tt(n,t,i,a);if(s.add(r),!v.has(n)){const o=()=>{for(const f of s)f.measure()},m=()=>{for(const f of s)f.update(se.timestamp)},d=()=>{for(const f of s)f.notify()},h=()=>{j.read(o,!1,!0),j.read(m,!1,!0),j.update(d,!1,!0)};v.set(n,h);const x=U(n);window.addEventListener("resize",h,{passive:!0}),n!==document.documentElement&&Z.set(n,De(n,h)),x.addEventListener("scroll",h,{passive:!0})}const l=v.get(n);return j.read(l,!1,!0),()=>{var o;O(l);const m=A.get(n);if(!m||(m.delete(r),m.size))return;const d=v.get(n);v.delete(n),d&&(U(n).removeEventListener("scroll",d),(o=Z.get(n))===null||o===void 0||o(),window.removeEventListener("resize",d))}}function nt({source:t,container:n,axis:a="y"}){t&&(n=t);const s={value:0},i=B(r=>{s.value=r[a].progress*100},{container:n,axis:a});return{currentTime:s,cancel:i}}const M=new Map;function pe({source:t,container:n=document.documentElement,axis:a="y"}={}){t&&(n=t),M.has(n)||M.set(n,{});const s=M.get(n);return s[a]||(s[a]=ze()?new ScrollTimeline({source:n,axis:a}):nt({source:n,axis:a})),s[a]}function st(t){return t.length===2}function je(t){return t&&(t.target||t.offset)}function it(t,n){return st(t)||je(n)?B(a=>{t(a[n.axis].progress,a)},n):xe(t,pe(n))}function at(t,n){if(t.flatten(),je(n))return t.pause(),B(a=>{t.time=t.duration*a[n.axis].progress},n);{const a=pe(n);return t.attachTimeline?t.attachTimeline(a,s=>(s.pause(),xe(i=>{s.time=s.duration*i},a))):Ee}}function rt(t,{axis:n="y",...a}={}){const s={axis:n,...a};return typeof t=="function"?it(t,s):at(t,s)}function J(t,n){Le(!!(!n||n.current))}const lt=()=>({scrollX:N(0),scrollY:N(0),scrollXProgress:N(0),scrollYProgress:N(0)});function P({container:t,target:n,layoutEffect:a=!0,...s}={}){const i=W(lt);return(a?V:c.useEffect)(()=>(J("target",n),J("container",t),rt((l,{x:o,y:m})=>{i.scrollX.set(o.current),i.scrollXProgress.set(o.progress),i.scrollY.set(m.current),i.scrollYProgress.set(m.progress)},{...s,container:(t==null?void 0:t.current)||void 0,target:(n==null?void 0:n.current)||void 0})),[t,n,JSON.stringify(s.offset)]),i}function ye(t){const n=W(()=>N(t)),{isStatic:a}=c.useContext(ie);if(a){const[,s]=c.useState(t);c.useEffect(()=>n.on("change",s),[])}return n}function be(t,n){const a=ye(n()),s=()=>a.set(n());return s(),V(()=>{const i=()=>j.preRender(s,!1,!0),r=t.map(l=>l.on("change",i));return()=>{r.forEach(l=>l()),O(s)}}),a}function K(t){return typeof t=="number"?t:parseFloat(t)}function ot(t,n={}){const{isStatic:a}=c.useContext(ie),s=c.useRef(null),i=ye(G(t)?K(t.get()):t),r=c.useRef(i.get()),l=c.useRef(()=>{}),o=()=>{const d=s.current;d&&d.time===0&&d.sample(se.delta),m(),s.current=Ce({keyframes:[i.get(),r.current],velocity:i.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:l.current})},m=()=>{s.current&&s.current.stop()};return c.useInsertionEffect(()=>i.attach((d,h)=>a?h(d):(r.current=d,l.current=h,j.update(o),i.get()),m),[JSON.stringify(n)]),V(()=>{if(G(t))return t.on("change",d=>i.set(K(d)))},[i]),i}const ct=t=>t&&typeof t=="object"&&t.mix,dt=t=>ct(t)?t.mix:void 0;function ut(...t){const n=!Array.isArray(t[0]),a=n?0:-1,s=t[0+a],i=t[1+a],r=t[2+a],l=t[3+a],o=ne(i,r,{mixer:dt(r[0]),...l});return n?o(s):o}function mt(t){I.current=[],t();const n=be(I.current,t);return I.current=void 0,n}function C(t,n,a,s){if(typeof t=="function")return mt(t);const i=typeof n=="function"?n:ut(n,a,s);return Array.isArray(t)?Q(t,i):Q([t],([r])=>i(r))}function Q(t,n){const a=W(()=>[]);return be(t,()=>{a.length=0;const s=t.length;for(let i=0;i<s;i++)a[i]=t[i].get();return n(a)})}const ht={some:0,all:1};function ft(t,n,{root:a,margin:s,amount:i="some"}={}){const r=te(t),l=new WeakMap,o=d=>{d.forEach(h=>{const x=l.get(h.target);if(h.isIntersecting!==!!x)if(h.isIntersecting){const f=n(h);typeof f=="function"?l.set(h.target,f):m.unobserve(h.target)}else typeof x=="function"&&(x(h),l.delete(h.target))})},m=new IntersectionObserver(o,{root:a,rootMargin:s,threshold:typeof i=="number"?i:ht[i]});return r.forEach(d=>m.observe(d)),()=>m.disconnect()}function ve(t,{root:n,margin:a,amount:s,once:i=!1}={}){const[r,l]=c.useState(!1);return c.useEffect(()=>{if(!t.current||i&&r)return;const o=()=>(l(!0),i?void 0:()=>l(!1)),m={root:n&&n.current||void 0,margin:a,amount:s};return ft(t.current,o,m)},[n,t,a,i,s]),r}const y=[.25,.46,.45,.94];function D(t,n=1500){const a=ve(t,{once:!0,amount:"some"}),[s,i]=c.useState(!1);return c.useEffect(()=>{const r=setTimeout(()=>i(!0),n);return()=>clearTimeout(r)},[n]),a||s}function g({children:t,delay:n=0,className:a=""}){const s=c.useRef(null),i=D(s);return e.jsx(u.div,{ref:s,initial:{opacity:0,y:48},animate:i?{opacity:1,y:0}:{},transition:{duration:.8,delay:n,ease:y},className:a,children:t})}function gt({children:t,delay:n=0,className:a=""}){const s=c.useRef(null),i=D(s);return e.jsx(u.div,{ref:s,initial:{opacity:0,scale:.85},animate:i?{opacity:1,scale:1}:{},transition:{duration:.7,delay:n,ease:y},className:a,children:t})}function k({children:t,delay:n=0,direction:a="left",className:s=""}){const i=c.useRef(null),r=D(i),l=a==="left"?-80:80;return e.jsx(u.div,{ref:i,initial:{opacity:0,x:l},animate:r?{opacity:1,x:0}:{},transition:{duration:.8,delay:n,ease:y},className:s,children:t})}function xt({text:t,className:n=""}){const a=t.split(" ");return e.jsx("span",{className:n,children:a.map((s,i)=>e.jsxs(c.Fragment,{children:[e.jsx(u.span,{initial:{opacity:0,y:40,filter:"blur(8px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},transition:{duration:.6,delay:.15+i*.12,ease:y},className:"inline-block",children:s})," "]},i))})}function pt(){return e.jsxs("div",{className:"landing-orbital-rings",children:[e.jsxs(u.div,{className:"landing-ring landing-ring-1",animate:{rotate:360},transition:{duration:30,repeat:1/0,ease:"linear"},children:[e.jsx("div",{className:"landing-ring-dot",style:{top:"0%",left:"50%"}}),e.jsx("div",{className:"landing-ring-dot",style:{bottom:"0%",left:"50%"}})]}),e.jsx(u.div,{className:"landing-ring landing-ring-2",animate:{rotate:-360},transition:{duration:45,repeat:1/0,ease:"linear"},children:e.jsx("div",{className:"landing-ring-dot landing-ring-dot-pink",style:{top:"50%",right:"0%"}})}),e.jsxs(u.div,{className:"landing-ring landing-ring-3",animate:{rotate:360},transition:{duration:60,repeat:1/0,ease:"linear"},children:[e.jsx("div",{className:"landing-ring-dot landing-ring-dot-green",style:{top:"10%",left:"15%"}}),e.jsx("div",{className:"landing-ring-dot",style:{bottom:"15%",right:"10%"}})]}),e.jsx("div",{className:"landing-center-glow"})]})}const jt=Array.from({length:30},(t,n)=>({id:n,x:Math.random()*100,y:Math.random()*100,size:1+Math.random()*2,duration:15+Math.random()*25,delay:Math.random()*10}));function yt(){return e.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:jt.map(t=>e.jsx(u.div,{className:"absolute rounded-full",style:{left:`${t.x}%`,top:`${t.y}%`,width:t.size,height:t.size,background:t.id%3===0?"rgba(0, 188, 212, 0.5)":t.id%3===1?"rgba(233, 30, 99, 0.4)":"rgba(255, 255, 255, 0.2)"},animate:{y:[-20,20,-20],x:[-10,10,-10],opacity:[.2,.7,.2]},transition:{duration:t.duration,delay:t.delay,repeat:1/0,ease:"easeInOut"}},t.id))})}function bt({value:t,suffix:n=""}){const[a,s]=c.useState(0);return c.useEffect(()=>{if(t===0)return;const i=setTimeout(()=>{const l=performance.now();function o(m){const d=m-l,h=Math.min(d/1500,1),x=1-Math.pow(1-h,3);s(Math.round(x*t)),h<1&&requestAnimationFrame(o)}requestAnimationFrame(o)},800);return()=>clearTimeout(i)},[t]),e.jsxs("span",{children:[a,n]})}function vt(){const{scrollYProgress:t}=P(),n=ot(t,{stiffness:100,damping:30});return e.jsx(u.div,{className:"fixed top-0 left-0 right-0 h-[2px] z-50 origin-left",style:{scaleX:n,background:"linear-gradient(90deg, #00bcd4, #e91e63, #00bcd4)"}})}function Nt(){const[t,n]=c.useState(!1);return c.useEffect(()=>{const a=()=>n(window.scrollY>50);return window.addEventListener("scroll",a,{passive:!0}),()=>window.removeEventListener("scroll",a)},[]),e.jsx(u.nav,{className:`fixed top-0 left-0 right-0 z-40 transition-all duration-500 ${t?"landing-nav-scrolled":"landing-nav-transparent"}`,initial:{y:-80},animate:{y:0},transition:{duration:.6,ease:y},children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6 h-16 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"landing-nav-logo",children:e.jsx(fe,{size:20,className:"text-[#00bcd4]"})}),e.jsx("span",{className:"text-base font-semibold tracking-tight text-white",children:"Orbital Command"})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[e.jsx("a",{href:"#features",className:"text-sm text-white/60 hover:text-white transition-colors",children:"Features"}),e.jsx("a",{href:"#how-it-works",className:"text-sm text-white/60 hover:text-white transition-colors",children:"How It Works"}),e.jsx("a",{href:"#architecture",className:"text-sm text-white/60 hover:text-white transition-colors",children:"Architecture"}),e.jsxs("a",{href:"https://github.com/SakaraLabs/orbital-command",target:"_blank",rel:"noopener noreferrer",className:"landing-nav-cta",children:[e.jsx(T,{size:14}),"GitHub"]})]})]})})}function wt(){const t=c.useRef(null),{scrollYProgress:n}=P({target:t,offset:["start start","end start"]}),a=C(n,[0,1],[0,200]),s=C(n,[0,.6],[1,0]),i=C(n,[0,1],[0,100]);return e.jsxs(e.Fragment,{children:[e.jsxs("section",{ref:t,className:"landing-hero",children:[e.jsx("div",{className:"landing-hero-orb landing-hero-orb-1"}),e.jsx("div",{className:"landing-hero-orb landing-hero-orb-2"}),e.jsx("div",{className:"landing-hero-orb landing-hero-orb-3"}),e.jsxs(u.div,{className:"landing-hero-content",style:{y:a,opacity:s},children:[e.jsxs(u.div,{className:"landing-badge",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.1},children:[e.jsx(Ie,{size:14,className:"text-[#00bcd4]"}),e.jsx("span",{children:"Mission control for Claude Code"})]}),e.jsxs("h1",{className:"landing-headline",children:[e.jsx(xt,{text:"Command your"}),e.jsx("br",{}),e.jsx(u.span,{className:"landing-headline-gradient",initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{duration:.7,delay:.5,ease:y},children:"AI fleet."})]}),e.jsxs(u.p,{className:"landing-subtitle",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.7,delay:.8},children:["Real-time project management dashboard for Claude Code.",e.jsx("br",{className:"hidden sm:block"}),"Kanban boards, sprint orchestration, quality gates, and deploy pipelines",e.jsx("br",{className:"hidden sm:block"}),"— all driven by a file-based event bus."]}),e.jsxs(u.div,{className:"landing-cta-row",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.7,delay:1},children:[e.jsxs("a",{href:"https://github.com/SakaraLabs/orbital-command",target:"_blank",rel:"noopener noreferrer",className:"landing-cta-primary group",children:[e.jsx(ae,{size:18}),"Get Started",e.jsx(re,{size:16,className:"ml-1 transition-transform group-hover:translate-x-1"})]}),e.jsxs("a",{href:"#features",className:"landing-cta-secondary",children:["See Features",e.jsx(Y,{size:16})]})]}),e.jsx(u.div,{className:"landing-install",initial:{opacity:0},animate:{opacity:1},transition:{duration:.6,delay:1.3},children:e.jsx("code",{children:"npm install orbital-command"})})]}),e.jsx(u.div,{className:"landing-hero-visual",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:1.2,delay:.5,ease:y},style:{y:i},children:e.jsx(pt,{})}),e.jsx(u.div,{className:"landing-scroll-indicator",animate:{y:[0,8,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:e.jsx(Y,{size:20,className:"text-white/30"})})]}),e.jsx("section",{className:"landing-stats",children:e.jsx("div",{className:"landing-stats-inner",children:[{value:7,suffix:"",label:"Dashboard Views"},{value:100,suffix:"%",label:"File-Based"},{value:0,suffix:"",label:"Lock-in",staticText:"0"},{label:"Real-time Sync",staticText:"RT"}].map((r,l)=>e.jsxs("div",{className:"contents",children:[l>0&&e.jsx("div",{className:"landing-stat-divider"}),e.jsxs("div",{className:"landing-stat",children:[e.jsx("span",{className:"landing-stat-value",children:r.staticText??e.jsx(bt,{value:r.value,suffix:r.suffix})}),e.jsx("span",{className:"landing-stat-label",children:r.label})]})]},r.label))})})]})}const kt={cyan:{glow:"rgba(0,188,212,0.15)",border:"rgba(0,188,212,0.3)",text:"#00bcd4"},pink:{glow:"rgba(233,30,99,0.15)",border:"rgba(233,30,99,0.3)",text:"#e91e63"},green:{glow:"rgba(0,230,118,0.15)",border:"rgba(0,230,118,0.3)",text:"#00e676"},amber:{glow:"rgba(255,171,0,0.15)",border:"rgba(255,171,0,0.3)",text:"#ffab00"},purple:{glow:"rgba(117,109,158,0.2)",border:"rgba(117,109,158,0.4)",text:"#9c8fd4"}};function b({icon:t,title:n,description:a,color:s,delay:i=0}){const r=kt[s];return e.jsx(g,{delay:i,children:e.jsxs(u.div,{className:"landing-feature-card group",whileHover:{y:-8,transition:{duration:.3}},children:[e.jsx("div",{className:"landing-feature-icon-wrap",style:{background:r.glow,borderColor:r.border},children:e.jsx(t,{size:24,style:{color:r.text}})}),e.jsx("h3",{className:"landing-feature-title",children:n}),e.jsx("p",{className:"landing-feature-desc",children:a}),e.jsx("div",{className:"landing-feature-glow",style:{background:`radial-gradient(ellipse at center, ${r.glow}, transparent 70%)`}})]})})}function St(){return e.jsx("section",{id:"features",className:"landing-section",children:e.jsxs("div",{className:"landing-section-inner",children:[e.jsx(g,{children:e.jsx("p",{className:"landing-section-tag",children:"Features"})}),e.jsx(g,{delay:.1,children:e.jsxs("h2",{className:"landing-section-title",children:["Everything you need to",e.jsx("br",{})," ",e.jsx("span",{className:"landing-gradient-text",children:"orchestrate AI agents."})]})}),e.jsx(g,{delay:.2,children:e.jsx("p",{className:"landing-section-desc",children:"A complete mission control system that turns Claude Code sessions into observable, manageable workflows with real-time feedback."})}),e.jsxs("div",{className:"landing-features-grid",children:[e.jsx(b,{icon:le,title:"Visual Kanban",description:"Drag-and-drop scope cards across workflow columns. Real-time status updates as Claude agents work through tasks.",color:"cyan",delay:0}),e.jsx(b,{icon:ue,title:"Sprint Orchestration",description:"Batch scopes into sprints with automatic sequencing, dependency resolution, and parallel execution across agents.",color:"pink",delay:.08}),e.jsx(b,{icon:oe,title:"Quality Gates",description:"Enforce standards with configurable gates — typecheck, lint, test, build. Auto-block deployments that fail checks.",color:"green",delay:.16}),e.jsx(b,{icon:ce,title:"Workflow DAG Editor",description:"Visual directed acyclic graph editor for custom workflows. Define columns, transitions, hooks, and inference rules.",color:"purple",delay:.08}),e.jsx(b,{icon:me,title:"Agent Feed",description:"Live stream of all Claude Code events across every session. Filter by agent, scope, or event type. Full audit trail.",color:"amber",delay:.16}),e.jsx(b,{icon:H,title:"Deploy Pipeline",description:"Multi-stage deployment visualization from dev to staging to production. Rollback controls and promotion gates.",color:"cyan",delay:.24})]})]})})}const S=({color:t,children:n})=>e.jsx("span",{style:{color:t},children:n}),E=[{elements:e.jsx(e.Fragment,{children:"$ orbital"}),delay:400},{elements:e.jsx(e.Fragment,{children:" Scaffolding hooks, skills, and agents..."}),delay:800},{elements:e.jsx(e.Fragment,{children:" Writing .claude/hooks/on-scope-change.sh"}),delay:200},{elements:e.jsx(e.Fragment,{children:" Writing .claude/hooks/on-quality-gate.sh"}),delay:200},{elements:e.jsx(e.Fragment,{children:" Creating orbital.config.json"}),delay:300},{elements:e.jsxs(e.Fragment,{children:[" ",e.jsx(S,{color:"#00e676",children:"✓"})," Orbital Command initialized"]}),delay:600},{elements:e.jsx(e.Fragment,{children:" "}),delay:300},{elements:e.jsx(e.Fragment,{children:" Launching dashboard..."}),delay:500},{elements:e.jsx(e.Fragment,{children:" Server running on http://localhost:4444"}),delay:400},{elements:e.jsx(e.Fragment,{children:" Client running on http://localhost:4445"}),delay:200},{elements:e.jsxs(e.Fragment,{children:[" ",e.jsx(S,{color:"#00bcd4",children:"◉"})," Watching scopes/ for changes..."]}),delay:300},{elements:e.jsxs(e.Fragment,{children:[" ",e.jsx(S,{color:"#00bcd4",children:"◉"})," Watching .claude/orbital-events/ for events..."]}),delay:200},{elements:e.jsxs(e.Fragment,{children:[" ",e.jsx(S,{color:"#00e676",children:"✓"})," Dashboard ready — mission control is live"]}),delay:0}];function Et(){const t=c.useRef(null),n=ve(t,{once:!0,amount:.1}),[a,s]=c.useState(0);return c.useEffect(()=>{if(!n)return;let i,r=0;function l(){r>=E.length||(s(r+1),r++,r<E.length&&(i=setTimeout(l,E[r].delay)))}return i=setTimeout(l,600),()=>clearTimeout(i)},[n]),e.jsxs("div",{ref:t,className:"landing-terminal",children:[e.jsxs("div",{className:"landing-terminal-header",children:[e.jsx("div",{className:"landing-terminal-dot landing-terminal-dot-red"}),e.jsx("div",{className:"landing-terminal-dot landing-terminal-dot-yellow"}),e.jsx("div",{className:"landing-terminal-dot landing-terminal-dot-green"}),e.jsx("span",{className:"landing-terminal-title",children:"orbital-command"})]}),e.jsxs("div",{className:"landing-terminal-body",children:[E.slice(0,a).map((i,r)=>e.jsx(u.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.3},className:"landing-terminal-line",children:i.elements},r)),e.jsx(u.span,{className:"landing-terminal-cursor",animate:{opacity:[1,0,1]},transition:{duration:1,repeat:1/0},children:"▌"})]})]})}const zt=[{label:"Kanban Board",gradient:"from-cyan-500/20 to-blue-500/20",icon:le},{label:"Quality Gates",gradient:"from-green-500/20 to-emerald-500/20",icon:oe},{label:"Workflow DAG",gradient:"from-purple-500/20 to-pink-500/20",icon:ce},{label:"Agent Feed",gradient:"from-pink-500/20 to-red-500/20",icon:me},{label:"Sprint View",gradient:"from-amber-500/20 to-orange-500/20",icon:ue},{label:"Deploy Pipeline",gradient:"from-cyan-500/20 to-teal-500/20",icon:H}];function Lt(){const t=c.useRef(null),{scrollYProgress:n}=P({target:t,offset:["start end","end start"]}),a=C(n,[0,1],["5%","-15%"]);return e.jsxs("section",{className:"landing-section-full",children:[e.jsxs(g,{className:"text-center mb-12",children:[e.jsx("p",{className:"landing-section-tag",children:"Dashboard"}),e.jsxs("h2",{className:"landing-section-title",children:["Six views. ",e.jsx("span",{className:"landing-gradient-text",children:"One command center."})]})]}),e.jsx("div",{ref:t,className:"overflow-hidden py-8",children:e.jsx(u.div,{className:"flex gap-6 px-8",style:{x:a},children:zt.map(s=>e.jsxs(u.div,{className:`landing-showcase-card bg-gradient-to-br ${s.gradient}`,whileHover:{scale:1.03},transition:{duration:.3},children:[e.jsx(s.icon,{size:48,className:"text-white/30 mb-4"}),e.jsx("span",{className:"text-lg font-medium text-white/80",children:s.label})]},s.label))})})]})}function R({number:t,title:n,description:a,icon:s,delay:i}){return e.jsxs(g,{delay:i,className:"landing-step",children:[e.jsx("div",{className:"landing-step-number",children:t}),e.jsx("div",{className:"landing-step-icon",children:e.jsx(s,{size:28})}),e.jsx("h3",{className:"text-lg font-semibold text-white mt-4 mb-2",children:n}),e.jsx("p",{className:"text-sm text-white/50 leading-relaxed",children:a})]})}const Ct=[{label:"Frontend",sub:"React + Vite + Tailwind",color:"#00bcd4",icon:Me},{label:"Real-time",sub:"Socket.io Push",color:"#e91e63",icon:he},{label:"API",sub:"Express REST",color:"#ffab00",icon:de},{label:"Engine",sub:"Workflow + Events",color:"#00e676",icon:ge}];function It(){return e.jsx("div",{className:"landing-arch-stack",children:Ct.map(t=>e.jsxs(u.div,{className:"landing-arch-layer",whileHover:{x:8,transition:{duration:.2}},style:{borderLeftColor:t.color},children:[e.jsx("div",{className:"landing-arch-icon",style:{color:t.color},children:e.jsx(t.icon,{size:20})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:t.label}),e.jsx("div",{className:"text-xs text-white/40",children:t.sub})]})]},t.label))})}function Ht(){return e.jsxs("div",{className:"landing-root",children:[e.jsx(vt,{}),e.jsx(Nt,{}),e.jsx(yt,{}),e.jsx(wt,{}),e.jsx(St,{}),e.jsx(Lt,{}),e.jsx("section",{id:"how-it-works",className:"landing-section",children:e.jsxs("div",{className:"landing-section-inner",children:[e.jsx(g,{children:e.jsx("p",{className:"landing-section-tag",children:"How It Works"})}),e.jsx(g,{delay:.1,children:e.jsxs("h2",{className:"landing-section-title",children:["Three steps to",e.jsx("br",{})," ",e.jsx("span",{className:"landing-gradient-text",children:"mission control."})]})}),e.jsxs("div",{className:"landing-steps-grid",children:[e.jsx(R,{number:"01",title:"Initialize",description:"Run orbital in your project. The setup wizard scaffolds hooks, skills, agents, and config into your .claude/ directory. Zero lock-in — everything is plain files.",icon:ae,delay:0}),e.jsx(R,{number:"02",title:"Define Scopes",description:"Write markdown files with YAML frontmatter in scopes/. Each scope is a task card — title, status, category, priority, assignee. Claude reads and updates them.",icon:T,delay:.15}),e.jsx(R,{number:"03",title:"Launch",description:"Select Launch from the hub menu and open the dashboard. Watch your AI fleet in real-time as Claude agents pick up scopes, emit events, and progress through your workflow.",icon:H,delay:.3})]})]})}),e.jsx("section",{className:"landing-section",children:e.jsx("div",{className:"landing-section-inner",children:e.jsxs("div",{className:"landing-split",children:[e.jsxs(k,{direction:"left",className:"flex-1 min-w-0",children:[e.jsx("p",{className:"landing-section-tag",children:"Developer Experience"}),e.jsxs("h2",{className:"landing-section-title text-left",children:["Get running in",e.jsx("br",{})," ",e.jsx("span",{className:"landing-gradient-text",children:"under a minute."})]}),e.jsx("p",{className:"landing-section-desc text-left mt-4",children:"One command to scaffold. One command to launch. File-based architecture means everything is inspectable, versionable, and customizable."}),e.jsxs("div",{className:"landing-dx-features",children:[e.jsxs("div",{className:"landing-dx-item",children:[e.jsx(Ae,{size:16,className:"text-[#00bcd4]"}),e.jsx("span",{children:"Zero-config setup"})]}),e.jsxs("div",{className:"landing-dx-item",children:[e.jsx(de,{size:16,className:"text-[#e91e63]"}),e.jsx("span",{children:"File-based event bus"})]}),e.jsxs("div",{className:"landing-dx-item",children:[e.jsx(he,{size:16,className:"text-[#00e676]"}),e.jsx("span",{children:"Real-time Socket.io sync"})]}),e.jsxs("div",{className:"landing-dx-item",children:[e.jsx(ge,{size:16,className:"text-[#ffab00]"}),e.jsx("span",{children:"SQLite persistence"})]})]})]}),e.jsx(k,{direction:"right",className:"flex-1 min-w-0",children:e.jsx(Et,{})})]})})}),e.jsx("section",{id:"architecture",className:"landing-section",children:e.jsx("div",{className:"landing-section-inner",children:e.jsxs("div",{className:"landing-split",children:[e.jsxs(k,{direction:"left",className:"flex-1 min-w-0",children:[e.jsx("p",{className:"landing-section-tag",children:"Architecture"}),e.jsxs("h2",{className:"landing-section-title text-left",children:["Built on",e.jsx("br",{})," ",e.jsx("span",{className:"landing-gradient-text",children:"open primitives."})]}),e.jsx("p",{className:"landing-section-desc text-left mt-4",children:"Markdown files are tasks. JSON files are events. The workflow engine is pure TypeScript with zero I/O. Everything is observable and hackable."})]}),e.jsx(k,{direction:"right",className:"flex-1 min-w-0",children:e.jsx(It,{})})]})})}),e.jsxs("section",{className:"landing-final-cta",children:[e.jsx("div",{className:"landing-final-cta-bg"}),e.jsxs("div",{className:"relative z-10 max-w-3xl mx-auto text-center px-6",children:[e.jsx(gt,{children:e.jsxs("h2",{className:"landing-final-headline",children:["Ready for",e.jsx("br",{})," ",e.jsx("span",{className:"landing-gradient-text",children:"liftoff?"})]})}),e.jsx(g,{delay:.2,children:e.jsx("p",{className:"text-lg text-white/50 mb-10 leading-relaxed",children:"Install Orbital Command and take control of your AI-powered development workflow. Open source. Zero lock-in. Fully extensible."})}),e.jsx(g,{delay:.4,children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[e.jsxs("a",{href:"https://github.com/SakaraLabs/orbital-command",target:"_blank",rel:"noopener noreferrer",className:"landing-cta-primary group text-base px-8 py-4",children:[e.jsx(T,{size:18}),"View on GitHub",e.jsx(re,{size:16,className:"ml-1 transition-transform group-hover:translate-x-1"})]}),e.jsx("div",{className:"landing-install",children:e.jsx("code",{children:"npm install orbital-command"})})]})})]})]}),e.jsx("footer",{className:"landing-footer",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6 flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{size:16,className:"text-[#00bcd4]"}),e.jsx("span",{className:"text-sm text-white/40",children:"Orbital Command"})]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx("a",{href:"https://github.com/SakaraLabs/orbital-command",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-white/30 hover:text-white/60 transition-colors",children:"GitHub"}),e.jsx("span",{className:"text-xs text-white/20",children:"MIT License"})]})]})})]})}export{Ht as Landing,Ht as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./ui-BmsSg9jU.js";import{a as d}from"./vendor-Bqt8AJn2.js";import{q,ai as J,s as B,w as K,U as D,B as y,g as F,a as T,a9 as b,aj as E,ak as U,a7 as V,h as W,f as Q}from"./index-o4ScMAuR.js";import{F as X}from"./file-text-J1cebZXF.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}=q(),[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}=J(),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(K,{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(V,{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,12 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./ui-BmsSg9jU.js";import{a as c}from"./vendor-Bqt8AJn2.js";import{c as Se,q as Te,V as he,s as ye,C as Pe,b as $e,R as M,h as O,al as H,B as xe,a as v,a1 as pe,a3 as fe,a4 as ge,a5 as je,ak as w,am as G,J as Ae,an as be,a6 as Ee,S as Ue,ao as _e,F as we,ap as Ie,aq as Be,T as ze,ar as Ve,a8 as He,E as Je,as as Ge,d as We,at as Ke,au as Le,av as Ye,aw as qe,P as V,X as De,ax as Oe,ay as ke,az as Xe,aA as Qe,aB as Ze,g as et}from"./index-o4ScMAuR.js";import{M as J}from"./minus-CHBsJyjp.js";import"./charts-LGLb8hyU.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const tt=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Me=Se("archive",tt);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const st=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],at=Se("skip-forward",st);function nt(){const{getApiBase:t}=Te(),[r,s]=c.useState(null),[o,n]=c.useState(null),[a,i]=c.useState([]),[h,u]=c.useState(null),[d,j]=c.useState(null),[y,x]=c.useState(null),[l,g]=c.useState(null),[m,S]=c.useState(null),[f,T]=c.useState(null),[U,W]=c.useState(null),[Z,ee]=c.useState(!0),[_,b]=c.useState(null),E=c.useCallback(async()=>{try{const p=await fetch("/api/orbital/aggregate/manifest/status");if(p.ok){const N=await p.json();s(N)}}catch{}finally{ee(!1)}},[]),C=c.useCallback(async p=>{try{const N=await fetch(`${t(p)}/manifest/files`);if(N.ok){const F=await N.json();i(F.data??[])}}catch{}},[t]);c.useEffect(()=>{E()},[E]),he(()=>{E(),o&&C(o)}),c.useEffect(()=>{const p=()=>{E(),o&&C(o)};return ye.on("manifest:changed",p),()=>{ye.off("manifest:changed",p)}},[E,C,o]);const te=c.useCallback(p=>{if(o===p){n(null),i([]);return}n(p),i([]),C(p)},[o,C]),se=c.useCallback(()=>{n(null),i([])},[]),K=c.useCallback(async()=>{b("update-all");try{await fetch("/api/orbital/aggregate/manifest/update-all",{method:"POST",headers:{"Content-Type":"application/json"}}),await E()}catch{}finally{b(null)}},[E]),L=c.useCallback(async p=>{b(`preview:${p}`);try{const N=await fetch(`${t(p)}/manifest/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dryRun:!0})});if(N.ok){const F=await N.json();j(F.data),x(p)}}catch{}finally{b(null)}},[t]),ae=c.useCallback(async p=>{b(`update:${p}`);try{(await fetch(`${t(p)}/manifest/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dryRun:!1})})).ok&&(j(null),x(null),await E())}catch{}finally{b(null)}},[t,E]),I=c.useCallback(async p=>{b(`init:${p}`);try{await fetch(`${t(p)}/manifest/init`,{method:"POST",headers:{"Content-Type":"application/json"}}),await E()}catch{}finally{b(null)}},[t,E]),ne=c.useCallback(async p=>{b(`validate:${p}`);try{const N=await fetch(`${t(p)}/manifest/validate`);if(N.ok){const F=await N.json();u(F.data)}}catch{}finally{b(null)}},[t]),re=c.useCallback(async(p,N,F)=>{b(`pin:${N}`);try{await fetch(`${t(p)}/manifest/pin`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:N,reason:F})})}catch{}finally{b(null)}},[t]),Y=c.useCallback(async(p,N)=>{b(`unpin:${N}`);try{await fetch(`${t(p)}/manifest/unpin`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:N})})}catch{}finally{b(null)}},[t]),q=c.useCallback(async(p,N)=>{b(`reset:${N}`);try{await fetch(`${t(p)}/manifest/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:N})})}catch{}finally{b(null)}},[t]),X=c.useCallback(async(p,N)=>{b(`revert:${N}`);try{await fetch(`${t(p)}/manifest/revert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:N})})}catch{}finally{b(null)}},[t]),Q=c.useCallback(async(p,N,F)=>{var Ne;b(`diff:${N}`),S(N),T(F??null),W(p);try{const ve=await fetch(`${t(p)}/manifest/diff?file=${encodeURIComponent(N)}`);if(ve.ok){const Re=await ve.json();g(((Ne=Re.data)==null?void 0:Ne.diff)??null)}}catch{}finally{b(null)}},[t]),k=c.useCallback(()=>{g(null),S(null),T(null),W(null)},[]),P=c.useCallback(()=>{j(null),x(null)},[]),le=c.useCallback(()=>u(null),[]);return{summary:r,loading:Z,actionLoading:_,expandedProjectId:o,projectFiles:a,validation:h,updatePreview:d,updatePreviewProjectId:y,diffContent:l,diffFile:m,diffFileStatus:f,diffProjectId:U,expandProject:te,collapseProject:se,fetchSummary:E,updateAll:K,previewProjectUpdate:L,applyProjectUpdate:ae,clearUpdatePreview:P,initProject:I,validateProject:ne,clearValidation:le,pinFile:re,unpinFile:Y,resetFile:q,revertFile:X,getDiff:Q,clearDiff:k}}function rt({files:t,actionLoading:r,onPin:s,onUnpin:o,onReset:n,onRevert:a,onDiff:i}){const h=t.filter(l=>l.status==="missing"),u=t.filter(l=>l.status==="outdated"),d=t.filter(l=>l.status==="modified"),j=t.filter(l=>l.status==="pinned"),y=t.filter(l=>l.status==="synced"),x=t.filter(l=>l.status==="user-owned");return t.length===0?e.jsx("div",{className:"text-xs text-muted-foreground/40 py-2 pl-4",children:"No tracked files."}):e.jsxs("div",{className:"pl-4 pb-2",children:[e.jsx(B,{title:`Missing (${h.length})`,description:"expected but not found on disk",files:h,defaultOpen:!0,renderRow:l=>e.jsx(z,{file:l,children:e.jsx(D,{label:"Restore",variant:"cyan",onClick:()=>n(l.path),loading:r===`reset:${l.path}`})},l.path)}),e.jsx(B,{title:`Outdated (${u.length})`,description:"newer template version available",files:u,defaultOpen:!1,renderRow:l=>e.jsxs(z,{file:l,children:[e.jsx(D,{label:"View changes",onClick:()=>i(l.path,l.status),loading:r===`diff:${l.path}`}),e.jsx(D,{label:"Update",variant:"cyan",onClick:()=>n(l.path),loading:r===`reset:${l.path}`}),l.hasPrev&&e.jsx(D,{label:"Revert",onClick:()=>a(l.path),loading:r===`revert:${l.path}`})]},l.path)}),e.jsx(B,{title:`Modified (${d.length})`,description:"edited by you",files:d,defaultOpen:!1,renderRow:l=>e.jsxs(z,{file:l,children:[e.jsx(D,{label:"View changes",onClick:()=>i(l.path,l.status),loading:r===`diff:${l.path}`}),e.jsx(D,{label:"Reset",onClick:()=>n(l.path),loading:r===`reset:${l.path}`}),e.jsx(D,{label:"Pin",variant:"blue",onClick:()=>s(l.path),loading:r===`pin:${l.path}`}),l.hasPrev&&e.jsx(D,{label:"Revert",onClick:()=>a(l.path),loading:r===`revert:${l.path}`})]},l.path)}),e.jsx(B,{title:`Pinned (${j.length})`,description:"locked from updates",files:j,defaultOpen:!1,renderRow:l=>e.jsxs(z,{file:l,meta:l.pinnedReason?`"${l.pinnedReason}"`:void 0,children:[e.jsx(D,{label:"View changes",onClick:()=>i(l.path,l.status),loading:r===`diff:${l.path}`}),e.jsx(D,{label:"Unpin",onClick:()=>o(l.path),loading:r===`unpin:${l.path}`}),e.jsx(D,{label:"Reset",onClick:()=>n(l.path),loading:r===`reset:${l.path}`}),l.hasPrev&&e.jsx(D,{label:"Revert",onClick:()=>a(l.path),loading:r===`revert:${l.path}`})]},l.path)}),e.jsx(B,{title:`Synced (${y.length})`,description:"matches template",files:y,defaultOpen:!1,renderRow:l=>e.jsx(z,{file:l,children:l.hasPrev&&e.jsx(D,{label:"Revert",onClick:()=>a(l.path),loading:r===`revert:${l.path}`})},l.path)}),e.jsx(B,{title:`User (${x.length})`,description:"your files, not managed",files:x,defaultOpen:!1,renderRow:l=>e.jsx(z,{file:l},l.path)})]})}function B({title:t,description:r,files:s,defaultOpen:o,renderRow:n}){const[a,i]=c.useState(o);return s.length===0?null:e.jsxs("div",{className:"mt-2",children:[e.jsxs("button",{onClick:()=>i(!a),className:"flex items-center gap-1.5 text-xs text-muted-foreground/70 hover:text-muted-foreground transition-colors mb-1",children:[a?e.jsx(Pe,{className:"h-3 w-3"}):e.jsx($e,{className:"h-3 w-3"}),e.jsx("span",{children:t}),e.jsx("span",{className:"text-muted-foreground/40 font-normal",children:r})]}),a&&e.jsx("div",{className:"space-y-1.5 ml-4",children:s.map(n)})]})}function z({file:t,meta:r,children:s}){return e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-xs font-mono text-foreground/70",children:t.path}),r&&e.jsx("span",{className:"text-xs text-muted-foreground/40 italic",children:r}),s]})}function D({label:t,variant:r,onClick:s,loading:o}){const n="rounded border px-1.5 py-0 text-[10px] leading-5 transition-colors disabled:opacity-40",a={cyan:"border-cyan-500/30 bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20",blue:"border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20",default:"border-border bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"};return e.jsxs("button",{onClick:s,disabled:o,className:`${n} ${a[r??"default"]}`,children:[o?e.jsx(M,{className:"h-3 w-3 animate-spin inline mr-1"}):null,t]})}function lt({project:t,expanded:r,files:s,actionLoading:o,onToggle:n,onUpdate:a,onInit:i,onPin:h,onUnpin:u,onReset:d,onRevert:j,onDiff:y}){const{projectId:x,projectName:l,projectColor:g,status:m,manifest:S}=t;if(m==="no-manifest")return e.jsx("div",{className:"py-1.5",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:`hsl(${g})`}}),e.jsx("span",{className:"text-sm text-foreground truncate",children:l}),e.jsx("span",{className:"text-xs text-muted-foreground/40",children:"No manifest"})]}),e.jsxs(O,{size:"sm",variant:"outline",onClick:i,disabled:o===`init:${x}`,className:"h-6 px-2 text-xs border-[rgba(0,188,212,0.3)] text-cyan-400 hover:bg-cyan-500/10",children:[o===`init:${x}`?e.jsx(M,{className:"h-3 w-3 mr-1 animate-spin"}):e.jsx(H,{className:"h-3 w-3 mr-1"}),"Initialize"]})]})});if(m==="error")return e.jsx("div",{className:"py-1.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0 opacity-40",style:{backgroundColor:`hsl(${g})`}}),e.jsx("span",{className:"text-sm text-foreground/50 truncate",children:l}),e.jsx("span",{className:"text-xs text-red-400/60",children:"Offline"})]})});const f=S,T=f.files.outdated>0||f.files.missing>0||f.needsUpdate;return e.jsxs("div",{className:"py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer hover:opacity-80 transition-opacity",onClick:n,children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:`hsl(${g})`}}),e.jsx("span",{className:"text-sm text-foreground truncate w-[80px] sm:w-[140px] shrink-0",children:l}),e.jsxs(xe,{variant:"outline",className:v("text-[10px] px-1.5 py-0 shrink-0",f.needsUpdate?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-green-500/30 text-green-400 bg-green-500/10"),children:["v",f.installedVersion]}),f.needsUpdate&&e.jsxs("span",{className:"text-[10px] text-amber-400/60 shrink-0",children:["→ v",f.packageVersion]}),e.jsxs("span",{className:"hidden md:flex items-center text-xs shrink-0 tabular-nums",children:[e.jsxs("span",{className:v("w-[80px] text-center",f.files.missing>0?"text-red-400":"text-red-400/25"),children:[f.files.missing," missing"]}),e.jsxs("span",{className:v("w-[80px] text-center",f.files.outdated>0?"text-amber-400":"text-amber-400/25"),children:[f.files.outdated," outdated"]}),e.jsxs("span",{className:v("w-[80px] text-center",f.files.modified>0?"text-orange-400":"text-orange-400/25"),children:[f.files.modified," modified"]}),e.jsxs("span",{className:v("w-[80px] text-center",f.files.pinned>0?"text-blue-400":"text-blue-400/25"),children:[f.files.pinned," pinned"]}),e.jsxs("span",{className:v("w-[80px] text-center",f.files.synced>0?"text-green-400/50":"text-green-400/20"),children:[f.files.synced," synced"]}),e.jsxs("span",{className:v("w-[80px] text-center",f.files.userOwned>0?"text-muted-foreground/40":"text-muted-foreground/20"),children:[f.files.userOwned," user"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsxs(O,{size:"sm",variant:"outline",onClick:T?a:void 0,disabled:!T||o===`preview:${x}`||o===`update:${x}`,className:v("h-6 px-2 text-xs w-auto sm:w-[130px] justify-center",T?"border-[rgba(0,188,212,0.3)] text-cyan-400 hover:bg-cyan-500/10":"border-green-500/30 text-green-400/60"),children:[o===`preview:${x}`||o===`update:${x}`?e.jsx(M,{className:"h-3 w-3 mr-1 animate-spin"}):e.jsx(H,{className:"h-3 w-3 mr-1"}),T?"Update Project":"Up to Date"]}),e.jsx("button",{onClick:n,className:"flex items-center justify-center h-6 w-6 rounded text-muted-foreground/40 hover:text-muted-foreground hover:bg-white/5 transition-colors",children:r?e.jsx(Pe,{className:"h-3.5 w-3.5"}):e.jsx($e,{className:"h-3.5 w-3.5"})})]})]}),r&&e.jsx(rt,{files:s,actionLoading:o,onPin:h,onUnpin:u,onReset:d,onRevert:j,onDiff:y})]})}function it({updatePreview:t,projectName:r,updatePreviewProjectId:s,actionLoading:o,onApply:n,onClose:a}){return e.jsx(pe,{open:t!==null,onOpenChange:i=>{i||a()},children:e.jsxs(fe,{className:"max-w-md p-0 max-h-[80vh] overflow-hidden grid grid-rows-[auto_auto_1fr_auto_auto]",children:[e.jsxs(ge,{className:"px-5 pt-4 pb-3 pr-10",children:[e.jsxs(je,{className:"text-sm",children:["Update ",r]}),e.jsx("span",{className:"text-xs text-muted-foreground/60",children:"Review what will happen before applying"})]}),e.jsx(w,{}),t&&!t.isEmpty&&e.jsxs("div",{className:"px-5 py-4 space-y-3 overflow-auto min-h-0",children:[(t.toUpdate.length>0||t.toAdd.length>0)&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{className:"h-4 w-4 text-cyan-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-foreground",children:[t.toUpdate.length+t.toAdd.length," file",t.toUpdate.length+t.toAdd.length!==1?"s":""," will be updated"]}),e.jsx("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:"Synced and outdated files replaced with the latest template version"}),e.jsxs("div",{className:"mt-1.5 space-y-0.5",children:[t.toUpdate.map(i=>e.jsx("div",{className:"text-xs font-mono text-cyan-400/70",children:i},i)),t.toAdd.map(i=>e.jsxs("div",{className:"text-xs font-mono text-green-400/70",children:[i," ",e.jsx("span",{className:"text-muted-foreground/40",children:"(new)"})]},i))]})]})]}),t.toRename.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ae,{className:"h-4 w-4 text-purple-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-foreground",children:[t.toRename.length," file",t.toRename.length!==1?"s":""," will be renamed"]}),e.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.toRename.map(i=>e.jsxs("div",{className:"text-xs font-mono text-purple-400/70",children:[i.from," → ",i.to]},i.from))})]})]}),t.toRemove.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(J,{className:"h-4 w-4 text-red-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-foreground",children:[t.toRemove.length," file",t.toRemove.length!==1?"s":""," will be removed"]}),e.jsx("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:"No longer part of the template"}),e.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.toRemove.map(i=>e.jsx("div",{className:"text-xs font-mono text-red-400/70",children:i},i))})]})]}),t.toSkip.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(at,{className:"h-4 w-4 text-muted-foreground/50 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-foreground/70",children:[t.toSkip.length," file",t.toSkip.length!==1?"s":""," will be skipped"]}),e.jsx("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:"Modified or pinned files are never overwritten"}),e.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.toSkip.map(i=>e.jsxs("div",{className:"text-xs font-mono text-muted-foreground/40",children:[i.file," ",e.jsxs("span",{className:"text-muted-foreground/30",children:["(",i.reason,")"]})]},i.file))})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Me,{className:"h-4 w-4 text-muted-foreground/40 mt-0.5 shrink-0"}),e.jsx("div",{className:"text-xs text-muted-foreground/50",children:"Previous versions will be backed up and can be reverted"})]})]}),t&&t.isEmpty&&e.jsx("div",{className:"px-5 py-8 text-center text-sm text-muted-foreground",children:"Everything is up to date. No changes needed."}),e.jsx(w,{}),e.jsxs("div",{className:"px-5 py-3 flex justify-end gap-2",children:[e.jsx(be,{asChild:!0,children:e.jsx(O,{variant:"ghost",size:"sm",children:"Cancel"})}),t&&!t.isEmpty&&s&&e.jsxs(O,{size:"sm",onClick:()=>n(s),disabled:o===`update:${s}`,className:"bg-cyan-600 hover:bg-cyan-700 text-white",children:[o===`update:${s}`&&e.jsx(M,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Update Project"]})]})]})})}function ot({open:t,onOpenChange:r,summary:s,actionLoading:o,onUpdateAll:n}){return e.jsx(pe,{open:t,onOpenChange:r,children:e.jsxs(fe,{className:"max-w-md p-0 max-h-[80vh] overflow-hidden grid grid-rows-[auto_auto_1fr_auto_auto]",children:[e.jsxs(ge,{className:"px-5 pt-4 pb-3 pr-10",children:[e.jsx(je,{className:"text-sm",children:"Update All Projects"}),e.jsx(Ee,{className:"text-xs text-muted-foreground/60",children:"Review what will happen across all projects"})]}),e.jsx(w,{}),e.jsxs("div",{className:"px-5 py-4 space-y-3 overflow-auto min-h-0",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{className:"h-4 w-4 text-cyan-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-foreground",children:[s.totalOutdated+s.totalMissing," file",s.totalOutdated+s.totalMissing!==1?"s":""," to sync across ",s.projectsOutdated||s.projects.filter(a=>a.manifest&&(a.manifest.files.outdated>0||a.manifest.files.missing>0)).length," project",s.projects.filter(a=>a.manifest&&(a.manifest.files.outdated>0||a.manifest.files.missing>0)).length!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:"Synced and outdated files will be replaced with the latest template version"})]})]}),(s.totalModified>0||s.totalPinned>0)&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ue,{className:"h-4 w-4 text-green-400/60 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-foreground/70",children:[s.totalModified+s.totalPinned," file",s.totalModified+s.totalPinned!==1?"s":""," will not be touched"]}),e.jsxs("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:[s.totalModified>0&&e.jsxs(e.Fragment,{children:[s.totalModified," modified"]}),s.totalModified>0&&s.totalPinned>0&&" and ",s.totalPinned>0&&e.jsxs(e.Fragment,{children:[s.totalPinned," pinned"]})," ","file",s.totalModified+s.totalPinned!==1?"s":""," are never overwritten"]})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Me,{className:"h-4 w-4 text-muted-foreground/40 mt-0.5 shrink-0"}),e.jsx("div",{className:"text-xs text-muted-foreground/50",children:"Previous versions will be backed up and can be reverted"})]})]}),e.jsx(w,{}),e.jsxs("div",{className:"px-5 py-3 flex justify-end gap-2",children:[e.jsx(be,{asChild:!0,children:e.jsx(O,{variant:"ghost",size:"sm",children:"Cancel"})}),e.jsxs(O,{size:"sm",onClick:()=>{r(!1),n()},disabled:o==="update-all",className:"bg-cyan-600 hover:bg-cyan-700 text-white",children:[o==="update-all"&&e.jsx(M,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Update All Projects"]})]})]})})}function ct(t){const r=t.split(`
|
|
12
|
-
`),s=[];let o=0,n=0;for(const a of r){const i=a.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)/);if(i){o=parseInt(i[1],10),n=parseInt(i[2],10),s.push({type:"hunk",content:a});continue}if(a.startsWith("diff ")||a.startsWith("index ")||a.startsWith("--- ")||a.startsWith("+++ ")){s.push({type:"meta",content:a});continue}if(a.startsWith("-"))s.push({type:"remove",content:a.slice(1),oldNum:o}),o++;else if(a.startsWith("+"))s.push({type:"add",content:a.slice(1),newNum:n}),n++;else{const h=a.startsWith(" ")?a.slice(1):a;s.push({type:"context",content:h,oldNum:o,newNum:n}),o++,n++}}return s}function dt({diff:t}){const r=ct(t),s=r.reduce((n,a)=>Math.max(n,a.oldNum??0,a.newNum??0),0),o=String(s).length;return e.jsx("div",{className:"text-[11px] font-mono leading-[1.6] pb-1",children:r.map((n,a)=>{if(n.type==="meta")return null;if(n.type==="hunk")return e.jsx("div",{className:"px-3 py-1.5 mt-1 first:mt-0 text-cyan-400/60 bg-cyan-500/5 border-y border-cyan-500/10 select-none",children:n.content},a);const i=n.oldNum!=null?String(n.oldNum).padStart(o):"".padStart(o),h=n.newNum!=null?String(n.newNum).padStart(o):"".padStart(o),u=v("flex",n.type==="add"&&"bg-green-500/10",n.type==="remove"&&"bg-red-500/10"),d=v("select-none border-r border-border/40 px-2 text-right shrink-0",n.type==="add"&&"text-green-400/40",n.type==="remove"&&"text-red-400/40",n.type==="context"&&"text-muted-foreground/25"),j=v("px-3 whitespace-pre-wrap break-all flex-1 min-w-0",n.type==="add"&&"text-green-400",n.type==="remove"&&"text-red-400",n.type==="context"&&"text-foreground/50"),y=n.type==="add"?"+":n.type==="remove"?"-":" ";return e.jsxs("div",{className:u,children:[e.jsx("span",{className:d,children:i}),e.jsx("span",{className:d,children:h}),e.jsx("span",{className:v("w-4 text-center shrink-0 select-none",n.type==="add"&&"text-green-400/60",n.type==="remove"&&"text-red-400/60",n.type==="context"&&"text-transparent"),children:y}),e.jsx("span",{className:j,children:n.content||" "})]},a)})})}function xt({diffFile:t,diffContent:r,diffFileStatus:s,diffProjectId:o,actionLoading:n,onResetFile:a,onClearDiff:i}){return e.jsx(pe,{open:t!==null,onOpenChange:h=>{h||i()},children:e.jsxs(fe,{className:"max-w-2xl p-0 max-h-[80vh] overflow-hidden grid grid-rows-[auto_auto_auto_1fr_auto_auto]",children:[e.jsxs(ge,{className:"px-5 pt-4 pb-3 pr-10",children:[e.jsx(je,{className:"text-sm font-mono",children:t}),e.jsx(Ee,{className:"text-xs text-muted-foreground/60",children:"Template → Your file"})]}),e.jsx(w,{}),e.jsxs("div",{className:"px-5 py-2 text-xs text-muted-foreground/50",children:[e.jsx("span",{className:"text-red-400/70",children:"−"})," template version",e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("span",{className:"text-green-400/70",children:"+"})," your local file"]}),e.jsx("div",{className:"overflow-auto min-h-0",children:r?e.jsx(dt,{diff:r}):e.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:[e.jsx(M,{className:"h-4 w-4 mr-2 animate-spin"}),"Loading diff..."]})}),e.jsx(w,{}),e.jsxs("div",{className:"px-5 py-3 flex justify-end gap-2",children:[e.jsx(be,{asChild:!0,children:e.jsx(O,{variant:"ghost",size:"sm",children:"Close"})}),s==="outdated"&&o&&e.jsxs(O,{size:"sm",onClick:()=>{a(o,t),i()},disabled:n===`reset:${t}`,className:"bg-cyan-600 hover:bg-cyan-700 text-white",children:[n===`reset:${t}`&&e.jsx(M,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Update to latest"]}),s==="modified"&&o&&e.jsxs(O,{size:"sm",onClick:()=>{a(o,t),i()},disabled:n===`reset:${t}`,variant:"outline",children:[n===`reset:${t}`&&e.jsx(M,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Reset to template"]})]})]})})}function mt(){var Q;const{summary:t,loading:r,actionLoading:s,expandedProjectId:o,projectFiles:n,updatePreview:a,updatePreviewProjectId:i,diffContent:h,diffFile:u,diffFileStatus:d,diffProjectId:j,expandProject:y,updateAll:x,previewProjectUpdate:l,applyProjectUpdate:g,clearUpdatePreview:m,initProject:S,pinFile:f,unpinFile:T,resetFile:U,revertFile:W,getDiff:Z,clearDiff:ee}=nt(),{version:_,updateAvailable:b,behindCount:E,updateStage:C,updateError:te,checkForUpdate:se,performUpdate:K}=_e(),L=c.useRef(C);L.current=C;const ae=c.useCallback(async()=>{await K(),L.current!=="error"&&await x()},[K,x]),I=C==="pulling"||C==="installing",ne=C==="checking"||C==="checked",[re,Y]=c.useState(!1);if(r)return e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[e.jsx(M,{className:"h-4 w-4 animate-spin"}),"Loading configuration status..."]});if(!t||t.total===0)return e.jsx("div",{className:"text-sm text-muted-foreground/60",children:"No projects registered."});const q=t.projects.length>0&&t.projects.every(k=>{var P;return k.status==="ok"&&!((P=k.manifest)!=null&&P.needsUpdate)})&&t.noManifest===0&&t.totalOutdated===0&&t.totalMissing===0&&t.totalModified===0&&t.totalPinned===0,X=t.projects.filter(k=>{var P;return k.status==="ok"&&((P=k.manifest)==null?void 0:P.needsUpdate)}).length;return e.jsxs(e.Fragment,{children:[_&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-2 flex items-baseline gap-3",children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground/70",children:"Package"}),e.jsx("span",{className:"text-[11px] text-muted-foreground/40",children:"Globally installed Orbital Command version"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(H,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-sm text-foreground",children:"Orbital Command"}),e.jsxs(xe,{variant:"outline",className:v("text-[10px] px-1.5 py-0",b?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-green-500/30 text-green-400 bg-green-500/10"),children:["v",_.version]}),b&&e.jsxs("span",{className:"text-xs text-emerald-400/70",children:[E," update",E!==1?"s":""," available"]}),C==="checked"&&!b&&e.jsx("span",{className:"text-xs text-green-400",children:"Up to date"}),C==="done"&&e.jsx("span",{className:"text-xs text-green-400",children:"Updated — restart server to apply"}),C==="error"&&e.jsx("span",{className:"text-xs text-red-400 truncate",children:te}),I&&e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3 animate-spin"}),C==="pulling"?"Pulling...":"Installing..."]})]}),e.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[e.jsxs(O,{size:"sm",variant:"ghost",onClick:se,disabled:I||ne,className:"h-7 px-2 text-xs",children:[C==="checked"&&!b?e.jsx(we,{className:"h-3 w-3 mr-1 text-green-400"}):e.jsx(Ie,{className:v("h-3 w-3 mr-1",C==="checking"&&"animate-spin")}),C==="checked"&&!b?"Latest":"Check"]}),b&&C!=="done"&&e.jsxs(O,{size:"sm",variant:"outline",onClick:ae,disabled:I,className:"h-7 px-2.5 text-xs border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",children:[I?e.jsx(M,{className:"h-3 w-3 mr-1 animate-spin"}):e.jsx(Be,{className:"h-3 w-3 mr-1"}),"Update"]})]})]}),e.jsx(w,{className:"mb-4"})]}),e.jsxs("div",{className:"mb-2 flex items-baseline gap-3",children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground/70",children:"Project Sync"}),e.jsx("span",{className:"text-[11px] text-muted-foreground/40",children:"Sync templates and config to your installed version"})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 pl-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[q?e.jsx(we,{className:"h-2 w-2 text-green-400 shrink-0"}):e.jsx(ze,{className:"h-2 w-2 text-amber-400 shrink-0"}),e.jsx("span",{className:"text-sm text-foreground truncate w-[80px] sm:w-[140px] shrink-0",children:"All Projects"}),_&&e.jsxs(xe,{variant:"outline",className:"text-[10px] px-1.5 py-0 shrink-0 border-green-500/30 text-green-400 bg-green-500/10",children:["v",_.version]}),e.jsxs("span",{className:"hidden md:flex items-center text-xs shrink-0 tabular-nums",children:[e.jsxs("span",{className:v("w-[80px] text-center",t.totalMissing>0?"text-red-400":"text-red-400/25"),children:[t.totalMissing," missing"]}),e.jsxs("span",{className:v("w-[80px] text-center",t.totalOutdated>0?"text-amber-400":"text-amber-400/25"),children:[t.totalOutdated," outdated"]}),e.jsxs("span",{className:v("w-[80px] text-center",t.totalModified>0?"text-orange-400":"text-orange-400/25"),children:[t.totalModified," modified"]}),e.jsxs("span",{className:v("w-[80px] text-center",t.totalPinned>0?"text-blue-400":"text-blue-400/25"),children:[t.totalPinned," pinned"]}),e.jsxs("span",{className:v("w-[80px] text-center",t.totalSynced>0?"text-green-400/50":"text-green-400/20"),children:[t.totalSynced," synced"]}),e.jsxs("span",{className:v("w-[80px] text-center",t.totalUserOwned>0?"text-muted-foreground/40":"text-muted-foreground/20"),children:[t.totalUserOwned," user"]})]})]}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:q?e.jsxs(O,{size:"sm",variant:"outline",disabled:!0,className:"h-6 px-2 text-xs w-auto sm:w-[130px] justify-center border-green-500/30 text-green-400/60",children:[e.jsx(H,{className:"h-3 w-3 mr-1"}),"Up to Date"]}):e.jsxs(O,{size:"sm",variant:"outline",onClick:()=>Y(!0),disabled:s==="update-all",className:"h-6 px-2 text-xs w-auto sm:w-[130px] justify-center border-[rgba(0,188,212,0.3)] text-cyan-400 hover:bg-cyan-500/10",children:[s==="update-all"?e.jsx(M,{className:"h-3 w-3 mr-1 animate-spin"}):e.jsx(H,{className:"h-3 w-3 mr-1"}),X>0?`Update ${X}/${t.projects.length}`:"Update All"]})})]}),e.jsx(w,{className:"mb-2"}),e.jsx("div",{className:"space-y-0.5 pl-3",children:t.projects.map(k=>e.jsx(lt,{project:k,expanded:o===k.projectId,files:o===k.projectId?n:[],actionLoading:s,onToggle:()=>y(k.projectId),onUpdate:()=>l(k.projectId),onInit:()=>S(k.projectId),onPin:P=>f(k.projectId,P),onUnpin:P=>T(k.projectId,P),onReset:P=>U(k.projectId,P),onRevert:P=>W(k.projectId,P),onDiff:(P,le)=>Z(k.projectId,P,le)},k.projectId))}),e.jsx(it,{updatePreview:a,projectName:(Q=t.projects.find(k=>k.projectId===i))==null?void 0:Q.projectName,updatePreviewProjectId:i,actionLoading:s,onApply:g,onClose:m}),e.jsx(ot,{open:re,onOpenChange:Y,summary:t,actionLoading:s,onUpdateAll:x}),e.jsx(xt,{diffFile:u,diffContent:h,diffFileStatus:d,diffProjectId:j,actionLoading:s,onResetFile:U,onClearDiff:ee})]})}function ut(){return e.jsxs("section",{className:"card-glass settings-panel rounded-xl p-5",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary mb-5",children:"Configuration"}),e.jsx(mt,{})]})}function ht(){const{projects:t}=Te(),[r,s]=c.useState(!1),[o,n]=c.useState(null),[a,i]=c.useState(null),[h,u]=c.useState(null),[d,j]=c.useState(null),y=c.useRef(null);async function x(m,S){i(m),u(null);try{const f=await fetch(`/api/orbital/projects/${m}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)});if(!f.ok){const T=await f.json().catch(()=>({}));u(T.error??`Failed to update project (HTTP ${f.status})`)}}catch{u("Failed to update project")}finally{i(null)}}async function l(m){i(m),u(null);try{const S=await fetch(`/api/orbital/projects/${m}`,{method:"DELETE"});if(!S.ok){const f=await S.json().catch(()=>({}));u(f.error??`Failed to remove project (HTTP ${S.status})`)}}catch{u("Failed to remove project")}finally{i(null),j(null)}}async function g(m){if(!m||m.length===0)return;const f=m[0].webkitRelativePath.split("/")[0];n(null),s(!0);try{const T=await fetch("/api/orbital/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:f})});if(!T.ok){const U=await T.json().catch(()=>({}));throw new Error(U.error??`HTTP ${T.status}`)}}catch(T){n(T instanceof Error?T.message:"Failed to add project")}finally{s(!1),y.current&&(y.current.value="")}}return e.jsxs("section",{className:"card-glass settings-panel rounded-xl p-5",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary mb-5",children:"Projects"}),e.jsxs("div",{className:"space-y-2",children:[t.map(m=>e.jsx(pt,{project:m,updating:a===m.id,confirmDelete:d===m.id,onUpdate:S=>x(m.id,S),onDeleteRequest:()=>j(m.id),onDeleteConfirm:()=>l(m.id),onDeleteCancel:()=>j(null)},m.id)),e.jsxs("div",{onClick:()=>{var m;return!r&&((m=y.current)==null?void 0:m.click())},className:v("flex items-center gap-3 rounded border border-dashed border-white/[0.08] px-3 py-2","text-muted-foreground hover:text-foreground hover:border-primary/30 hover:bg-white/[0.03]","transition-colors cursor-pointer",r&&"opacity-50 pointer-events-none"),children:[e.jsx(Ve,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"text-xs",children:r?"Adding...":"Add Project"})]}),e.jsx("input",{ref:y,type:"file",webkitdirectory:"",className:"hidden",onChange:m=>g(m.target.files)}),(o||h)&&e.jsx("p",{className:"text-[11px] text-destructive",children:o||h})]})]})}function pt({project:t,updating:r,confirmDelete:s,onUpdate:o,onDeleteRequest:n,onDeleteConfirm:a,onDeleteCancel:i}){const[h,u]=c.useState(!1),[d,j]=c.useState(t.name),y=c.useRef(null);c.useEffect(()=>{var m;h&&((m=y.current)==null||m.focus())},[h]),c.useEffect(()=>{h||j(t.name)},[t.name,h]);const x=d.trim()!==""&&d.trim()!==t.name,l=c.useCallback(()=>{u(!1);const m=d.trim();m&&m!==t.name?o({name:m}):j(t.name)},[d,t.name,o]),g=t.status==="active"?"bg-green-400":t.status==="error"?"bg-red-400":"bg-muted-foreground/40";return e.jsxs("div",{className:v("flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 rounded border border-white/[0.08] px-3 py-2","transition-colors hover:border-[rgba(var(--neon-cyan),0.2)]",!t.enabled&&"opacity-50"),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(ft,{value:t.color,onChange:m=>o({color:m}),disabled:r}),e.jsxs("div",{className:"flex-1 min-w-0",children:[h?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{ref:y,value:d,onChange:m=>j(m.target.value),onBlur:()=>{j(t.name),u(!1)},onKeyDown:m=>{m.key==="Enter"&&l(),m.key==="Escape"&&(j(t.name),u(!1))},className:"flex-1 min-w-0 bg-transparent text-xs font-medium outline-none border-b border-primary/50 pb-0.5"}),x&&e.jsx("button",{onMouseDown:m=>{m.preventDefault(),l()},className:"shrink-0 text-primary hover:text-primary/80 transition-colors",title:"Save name",children:e.jsx(He,{className:"h-3.5 w-3.5"})})]}):e.jsx("div",{className:"text-xs font-medium truncate cursor-text hover:text-primary transition-colors",onClick:()=>u(!0),title:"Click to rename",children:t.name}),e.jsx("div",{className:"text-[10px] text-muted-foreground/60 font-mono truncate",children:t.path})]}),e.jsx("span",{className:v("h-1.5 w-1.5 rounded-full shrink-0",g),title:t.status})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0 self-end sm:self-auto",children:s?e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"text-destructive",children:"Remove?"}),e.jsx("button",{onClick:a,disabled:r,className:"text-destructive hover:text-destructive/80 font-medium transition-colors disabled:opacity-50",children:"Yes"}),e.jsx("button",{onClick:i,className:"text-muted-foreground hover:text-foreground transition-colors",children:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>o({enabled:!t.enabled}),disabled:r,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",title:t.enabled?"Disable project":"Enable project",children:t.enabled?e.jsx(Je,{className:"h-3.5 w-3.5"}):e.jsx(Ge,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:n,disabled:r,className:"shrink-0 text-muted-foreground/50 hover:text-destructive transition-colors disabled:opacity-50",title:"Remove project",children:e.jsx(We,{className:"h-3.5 w-3.5"})})]})})]})}function ft({value:t,onChange:r,disabled:s}){return e.jsxs(Ke,{children:[e.jsx(Le,{asChild:!0,children:e.jsx("button",{disabled:s,className:"h-5 w-5 rounded-full border border-white/20 shrink-0 transition-shadow hover:shadow-[0_0_8px_currentColor] disabled:opacity-50",style:{backgroundColor:`hsl(${t})`},title:"Change color"})}),e.jsx(Ye,{side:"bottom",align:"start",className:"w-auto p-2",children:e.jsx("div",{className:"grid grid-cols-5 gap-2",children:qe.map(o=>e.jsx("button",{onClick:()=>r(o),className:v("h-6 w-6 rounded-full border-2 transition-transform hover:scale-110",o===t?"border-white shadow-[0_0_8px_hsl(var(--primary))]":"border-transparent hover:border-white/40"),style:{backgroundColor:`hsl(${o})`}},o))})})]})}function A({checked:t,onCheckedChange:r,disabled:s}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:s,onClick:()=>r(!t),className:v("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-200",t?"border-[rgba(0,188,212,0.4)] bg-[rgba(0,188,212,0.25)]":"border-[rgba(255,255,255,0.1)] bg-[rgba(255,255,255,0.05)]",s&&"cursor-not-allowed opacity-40"),children:e.jsx("span",{className:v("pointer-events-none block h-3.5 w-3.5 rounded-full transition-all duration-200",t?"translate-x-[18px] bg-[rgb(0,188,212)] shadow-[0_0_8px_rgba(0,188,212,0.5)]":"translate-x-[2px] bg-[rgba(255,255,255,0.4)]")})})}const ie={permissionMode:"bypass",verbose:!0,allowedTools:[],disallowedTools:[],appendSystemPrompt:"",outputFormat:"",noMarkdown:!1,printMode:!1},gt={staleTimeoutMinutes:10,maxBatchSize:20,maxConcurrent:0,envVars:{}},oe="/api/orbital/aggregate/config/dispatch-flags";function jt(){const[t,r]=c.useState(ie),[s,o]=c.useState(!0),[n,a]=c.useState(!1),[i,h]=c.useState(null),u=c.useRef(t);u.current=t;const d=c.useCallback(async()=>{try{const x=await fetch(oe);if(!x.ok)throw new Error(`HTTP ${x.status}`);const{data:l}=await x.json();r(l),h(null)}catch(x){console.warn("[Orbital] Dispatch flags fetch failed:",x),h("Failed to load dispatch settings")}finally{o(!1)}},[]),j=c.useCallback(async x=>{const l={...u.current,...x};r(l),a(!0),h(null);try{const g=await fetch(oe,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!g.ok){const S=await g.json().catch(()=>({}));throw new Error(S.error??`HTTP ${g.status}`)}const{data:m}=await g.json();r(m)}catch(g){console.warn("[Orbital] Dispatch flags update failed:",g),h(g instanceof Error?g.message:"Failed to save"),d()}finally{a(!1)}},[d]),y=c.useCallback(async()=>{r(ie),a(!0),h(null);try{const x=await fetch(oe,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(!x.ok)throw new Error(`HTTP ${x.status}`);const{data:l}=await x.json();r(l)}catch(x){console.warn("[Orbital] Dispatch flags reset failed:",x),h("Failed to reset"),d()}finally{a(!1)}},[d]);return c.useEffect(()=>{d()},[d]),he(d),{flags:t,loading:s,saving:n,error:i,updateFlags:j,resetToDefaults:y}}const R="flex h-7 w-7 items-center justify-center rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed",Fe="flex items-center gap-1.5 rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground disabled:opacity-40",me="h-8 w-full rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-2.5 text-sm text-foreground outline-none transition-colors hover:border-[rgba(0,188,212,0.3)] focus:border-[rgba(0,188,212,0.5)] focus:shadow-[0_0_8px_rgba(0,188,212,0.15)] placeholder:text-muted-foreground/40";function ue({value:t,onChange:r,options:s,disabled:o,label:n}){return e.jsx("div",{role:"group","aria-label":n,className:"card-glass inline-flex flex-wrap rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.02)] p-0.5",children:s.map(a=>e.jsx("button",{onClick:()=>r(a.value),disabled:o,"aria-pressed":t===a.value,className:`px-2.5 py-1 text-xs rounded-[3px] transition-all duration-150 ${t===a.value?"bg-[rgba(0,188,212,0.2)] text-[rgb(0,188,212)] shadow-[0_0_8px_rgba(0,188,212,0.15)]":"text-muted-foreground hover:text-foreground"} ${o?"opacity-40 cursor-not-allowed":"cursor-pointer"}`,children:a.label},a.value))})}function $({label:t,description:r,children:s}){return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-foreground",children:t}),e.jsx("div",{className:"text-xs text-muted-foreground/60",children:r})]}),e.jsx("div",{className:"flex-shrink-0",children:s})]})}function Ce({label:t,description:r,value:s,onChange:o,disabled:n}){const[a,i]=c.useState(""),h=()=>{const u=a.trim();u&&!s.includes(u)&&(o([...s,u]),i(""))};return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"text-sm text-foreground",children:t}),e.jsx("div",{className:"text-xs text-muted-foreground/60",children:r})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{type:"text",value:a,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),h())},disabled:n,placeholder:"Tool name (e.g. Read, Bash)","aria-label":`Add ${t.toLowerCase()}`,className:me}),e.jsx("button",{onClick:h,disabled:n||!a.trim(),"aria-label":`Add tool to ${t.toLowerCase()}`,className:R+" !w-8 !h-8",children:e.jsx(V,{className:"h-3.5 w-3.5"})})]}),s.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(u=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-2 py-0.5 text-xs text-muted-foreground",children:[u,e.jsx("button",{onClick:()=>o(s.filter(d=>d!==u)),disabled:n,"aria-label":`Remove ${u}`,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:e.jsx(De,{className:"h-3 w-3"})})]},u))})]})}function bt({value:t,onChange:r,disabled:s}){const[o,n]=c.useState(""),[a,i]=c.useState(""),h=Object.entries(t),u=()=>{const d=o.trim();d&&(r({...t,[d]:a}),n(""),i(""))};return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"text-sm text-foreground",children:"Environment Variables"}),e.jsx("div",{className:"text-xs text-muted-foreground/60",children:"Custom env vars passed to every dispatched session"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mb-2",children:[e.jsx("input",{type:"text",value:o,onChange:d=>n(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),u())},disabled:s,placeholder:"KEY","aria-label":"Environment variable name",className:me+" sm:w-1/3"}),e.jsxs("div",{className:"flex gap-2 flex-1",children:[e.jsx("input",{type:"text",value:a,onChange:d=>i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),u())},disabled:s,placeholder:"value","aria-label":"Environment variable value",className:me+" flex-1"}),e.jsx("button",{onClick:u,disabled:s||!o.trim(),"aria-label":"Add environment variable",className:R+" !w-8 !h-8",children:e.jsx(V,{className:"h-3.5 w-3.5"})})]})]}),h.length>0&&e.jsx("div",{className:"flex flex-col gap-1.5",children:h.map(([d,j])=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-2.5 py-1",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:d}),e.jsx("span",{className:"text-xs text-muted-foreground/60",children:"="}),e.jsx("span",{className:"text-xs text-muted-foreground flex-1 truncate",children:j}),e.jsx("button",{onClick:()=>{const y={...t};delete y[d],r(y)},disabled:s,"aria-label":`Remove ${d}`,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:e.jsx(De,{className:"h-3 w-3"})})]},d))})]})}function Nt(){const{flags:t,loading:r,saving:s,error:o,updateFlags:n,resetToDefaults:a}=jt();return e.jsxs("section",{className:`card-glass settings-panel rounded-xl p-5 ${r?"opacity-60":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary",children:"Dispatch"}),o&&e.jsx("span",{className:"text-[11px] text-destructive",children:o})]}),e.jsxs("button",{onClick:a,disabled:s||r,className:Fe,children:[e.jsx(G,{className:"h-3 w-3"}),"Reset to defaults"]})]}),e.jsx($,{label:"Permission Mode",description:"How permission prompts are handled in dispatched sessions",children:e.jsx(ue,{label:"Permission Mode",value:t.permissionMode,onChange:i=>n({permissionMode:i}),options:[{value:"bypass",label:"Bypass"},{value:"default",label:"Default"},{value:"plan",label:"Plan"},{value:"acceptEdits",label:"Accept Edits"}],disabled:s})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Verbose Logging",description:"Enable verbose CLI output in dispatched sessions",children:e.jsx(A,{checked:t.verbose,onCheckedChange:i=>n({verbose:i}),disabled:s})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"No Markdown",description:"Disable markdown rendering in terminal output",children:e.jsx(A,{checked:t.noMarkdown,onCheckedChange:i=>n({noMarkdown:i}),disabled:s})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Print Mode",description:"Force non-interactive mode for single dispatches",children:e.jsx(A,{checked:t.printMode,onCheckedChange:i=>n({printMode:i}),disabled:s})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Output Format",description:"Output format for non-interactive mode",children:e.jsx(ue,{label:"Output Format",value:t.outputFormat,onChange:i=>n({outputFormat:i}),options:[{value:"",label:"Default"},{value:"text",label:"Text"},{value:"json",label:"JSON"},{value:"stream-json",label:"Stream"}],disabled:s})}),e.jsx(w,{className:"my-4"}),e.jsx(Ce,{label:"Allowed Tools",description:"Whitelist specific tools (leave empty for all)",value:t.allowedTools,onChange:i=>n({allowedTools:i}),disabled:s}),e.jsx(w,{className:"my-4"}),e.jsx(Ce,{label:"Disallowed Tools",description:"Block specific tools from being used",value:t.disallowedTools,onChange:i=>n({disallowedTools:i}),disabled:s}),e.jsx(w,{className:"my-4"}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"text-sm text-foreground",children:"System Prompt"}),e.jsx("div",{className:"text-xs text-muted-foreground/60",children:"Custom instructions appended to every dispatched session"})]}),e.jsx("textarea",{value:t.appendSystemPrompt,onChange:i=>n({appendSystemPrompt:i.target.value}),disabled:s,rows:3,placeholder:"Enter additional instructions...",className:"w-full rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-2.5 py-2 text-sm text-foreground outline-none transition-colors hover:border-[rgba(0,188,212,0.3)] focus:border-[rgba(0,188,212,0.5)] focus:shadow-[0_0_8px_rgba(0,188,212,0.15)] placeholder:text-muted-foreground/40 resize-y"})]})]})}const ce={...gt,terminalAdapter:"auto"},de="/api/orbital/aggregate/config/dispatch-settings";function vt(){const[t,r]=c.useState(ce),[s,o]=c.useState(!0),[n,a]=c.useState(!1),[i,h]=c.useState(null),u=c.useRef(t);u.current=t;const d=c.useCallback(async()=>{try{const x=await fetch(de);if(!x.ok)throw new Error(`HTTP ${x.status}`);const{data:l}=await x.json();r(l),h(null)}catch(x){console.warn("[Orbital] Dispatch settings fetch failed:",x),h("Failed to load dispatch operations")}finally{o(!1)}},[]),j=c.useCallback(async x=>{const l={...u.current,...x};r(l),a(!0),h(null);try{const g=await fetch(de,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!g.ok){const S=await g.json().catch(()=>({}));throw new Error(S.error??`HTTP ${g.status}`)}const{data:m}=await g.json();r(m)}catch(g){console.warn("[Orbital] Dispatch settings update failed:",g),h(g instanceof Error?g.message:"Failed to save"),d()}finally{a(!1)}},[d]),y=c.useCallback(async()=>{r(ce),a(!0),h(null);try{const x=await fetch(de,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)});if(!x.ok)throw new Error(`HTTP ${x.status}`);const{data:l}=await x.json();r(l)}catch(x){console.warn("[Orbital] Dispatch settings reset failed:",x),h("Failed to reset"),d()}finally{a(!1)}},[d]);return c.useEffect(()=>{d()},[d]),he(d),{settings:t,loading:s,saving:n,error:i,updateSettings:j,resetToDefaults:y}}function yt(){const{settings:t,loading:r,saving:s,error:o,updateSettings:n,resetToDefaults:a}=vt();return e.jsxs("section",{className:`card-glass settings-panel rounded-xl p-5 ${r?"opacity-60":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary",children:"Dispatch: Operations"}),o&&e.jsx("span",{className:"text-[11px] text-destructive",children:o})]}),e.jsxs("button",{onClick:a,disabled:s||r,className:Fe,children:[e.jsx(G,{className:"h-3 w-3"}),"Reset to defaults"]})]}),e.jsx($,{label:"Terminal Adapter",description:"How dispatch windows are opened",children:e.jsx(ue,{label:"Terminal Adapter",value:t.terminalAdapter,onChange:i=>n({terminalAdapter:i}),options:[{value:"auto",label:"Auto"},{value:"iterm2",label:"iTerm2"},{value:"subprocess",label:"Subprocess"},{value:"none",label:"None"}],disabled:s})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Stale Timeout",description:"Minutes before unlinked dispatch is marked abandoned",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>n({staleTimeoutMinutes:Math.max(1,t.staleTimeoutMinutes-1)}),disabled:s||t.staleTimeoutMinutes<=1,className:R,children:e.jsx(J,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"w-12 text-center text-sm tabular-nums",children:[t.staleTimeoutMinutes,"m"]}),e.jsx("button",{onClick:()=>n({staleTimeoutMinutes:t.staleTimeoutMinutes+1}),disabled:s,className:R,children:e.jsx(V,{className:"h-3.5 w-3.5"})})]})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Max Batch Size",description:"Maximum scopes per batch dispatch",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>n({maxBatchSize:Math.max(1,t.maxBatchSize-1)}),disabled:s||t.maxBatchSize<=1,className:R,children:e.jsx(J,{className:"h-3.5 w-3.5"})}),e.jsx("span",{className:"w-12 text-center text-sm tabular-nums",children:t.maxBatchSize}),e.jsx("button",{onClick:()=>n({maxBatchSize:t.maxBatchSize+1}),disabled:s,className:R,children:e.jsx(V,{className:"h-3.5 w-3.5"})})]})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Max Concurrent",description:"Limit simultaneous dispatches, 0 = unlimited",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>n({maxConcurrent:Math.max(0,t.maxConcurrent-1)}),disabled:s||t.maxConcurrent<=0,className:R,children:e.jsx(J,{className:"h-3.5 w-3.5"})}),e.jsx("span",{className:"w-12 text-center text-sm tabular-nums",children:t.maxConcurrent===0?"∞":t.maxConcurrent}),e.jsx("button",{onClick:()=>n({maxConcurrent:t.maxConcurrent+1}),disabled:s,className:R,children:e.jsx(V,{className:"h-3.5 w-3.5"})})]})}),e.jsx(w,{className:"my-4"}),e.jsx(bt,{value:t.envVars,onChange:i=>n({envVars:i}),disabled:s})]})}const wt={monospace:"Monospace","sans-serif":"Sans-Serif",display:"Display"},kt=["monospace","sans-serif","display"];function Ct(){var n;const{settings:t,updateSetting:r}=Oe(),s=()=>{const a=Math.max(.8,Math.round((t.fontScale-.05)*100)/100);r("fontScale",a)},o=()=>{const a=Math.min(1.3,Math.round((t.fontScale+.05)*100)/100);r("fontScale",a)};return e.jsxs("section",{className:"card-glass settings-panel rounded-xl p-5",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary mb-5",children:"Appearance"}),e.jsx($,{label:"Font Family",description:"Typeface used across the dashboard",children:e.jsx("select",{value:t.fontFamily,onChange:a=>r("fontFamily",a.target.value),style:{fontFamily:`'${t.fontFamily}', ${((n=ke.find(a=>a.family===t.fontFamily))==null?void 0:n.category)==="monospace"?"monospace":"sans-serif"}`,backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 8px center"},className:"h-8 rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-2.5 pr-7 text-sm text-foreground outline-none transition-colors hover:border-[rgba(0,188,212,0.3)] focus:border-[rgba(0,188,212,0.5)] focus:shadow-[0_0_8px_rgba(0,188,212,0.15)] appearance-none cursor-pointer",children:kt.map(a=>e.jsx("optgroup",{label:wt[a],children:ke.filter(i=>i.category===a).map(i=>e.jsxs("option",{value:i.family,children:[i.label,i.family==="Space Grotesk"?" (default)":""]},i.family))},a))})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Font Size",description:"Scale text across the dashboard",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:s,disabled:t.fontScale<=.8,className:"flex h-7 w-7 items-center justify-center rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed",children:e.jsx(J,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"w-12 text-center text-sm tabular-nums",children:[Math.round(t.fontScale*100),"%"]}),e.jsx("button",{onClick:o,disabled:t.fontScale>=1.3,className:"flex h-7 w-7 items-center justify-center rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed",children:e.jsx(V,{className:"h-3.5 w-3.5"})})]})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Reduce Motion",description:"Disable animations and transitions",children:e.jsx(A,{checked:t.reduceMotion,onCheckedChange:a=>r("reduceMotion",a)})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Background Effects",description:"Animated orbs and grid overlay",children:e.jsx(A,{checked:t.showBackgroundEffects,onCheckedChange:a=>r("showBackgroundEffects",a)})})]})}function St(){const{settings:t,updateSetting:r}=Oe();return e.jsxs("section",{className:"card-glass settings-panel rounded-xl p-5",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary mb-5",children:"Display"}),e.jsx($,{label:"Status Bar",description:"Scope progress bar at bottom",children:e.jsx(A,{checked:t.showStatusBar,onCheckedChange:s=>r("showStatusBar",s)})}),e.jsx(w,{className:"my-4"}),e.jsx($,{label:"Compact Mode",description:"Reduce spacing for denser layout",children:e.jsx(A,{checked:t.compactMode,onCheckedChange:s=>r("compactMode",s)})})]})}function Ot(){const{restart:t}=Xe();return c.useEffect(()=>{Qe()},[]),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col -mt-4",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(Ze,{className:"h-4 w-4 text-primary"}),e.jsx("h1",{className:"text-xl font-light",children:"Settings"})]}),e.jsx(et,{className:"flex-1",children:e.jsxs("div",{className:"columns-1 lg:columns-2 gap-4 sm:gap-6 pr-1 sm:pr-4 pb-8 [&>*]:mb-4 sm:[&>*]:mb-6 [&>*]:break-inside-avoid",children:[e.jsx("div",{className:"lg:[column-span:all]",children:e.jsx(ut,{})}),e.jsx("div",{className:"lg:[column-span:all]",children:e.jsx(ht,{})}),e.jsx(Nt,{}),e.jsx(yt,{}),e.jsx(Ct,{}),e.jsx(St,{}),e.jsxs("section",{className:"card-glass settings-panel rounded-xl p-5",children:[e.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-primary mb-5",children:"Onboarding"}),e.jsx($,{label:"Guided Tour",description:"Interactive walkthrough of all pages",children:e.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground",children:[e.jsx(G,{className:"h-3 w-3"}),"Restart tour"]})})]})]})})]})}export{Ot as Settings};
|