@shmulikdav/solix 1.11.4 → 1.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -9
- package/dist/web/assets/{CrewPanel-BpMmfE6s.js → CrewPanel-DepMvwPH.js} +1 -1
- package/dist/web/assets/{GalaxyPanel-BzbOW-wW.js → GalaxyPanel-Cz0V3cHy.js} +1 -1
- package/dist/web/assets/{Scene-BHSA39B9.js → Scene-BdCOK9CA.js} +1 -1
- package/dist/web/assets/{TimelineDrawer-E_uyUiDt.js → TimelineDrawer-Do1R-WIF.js} +1 -1
- package/dist/web/assets/{WorkspacePanel-DeRgenwa.js → WorkspacePanel-CNH1H733.js} +1 -1
- package/dist/web/assets/{index-DAI-7ykV.js → index-CyM5pkQz.js} +2 -2
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -182,7 +182,11 @@ async function bootSandbox(preferredPort) {
|
|
|
182
182
|
{
|
|
183
183
|
env: {
|
|
184
184
|
...process.env,
|
|
185
|
-
SOLIX_DB_PATH: DEMO_DB_PATH
|
|
185
|
+
SOLIX_DB_PATH: DEMO_DB_PATH,
|
|
186
|
+
// The demo is an isolated, seeded sandbox — it must not mirror the
|
|
187
|
+
// user's real Agent View sessions into it, and scanning a heavy
|
|
188
|
+
// ~/.claude/jobs at boot would stall the sandbox before it's ready.
|
|
189
|
+
SOLIX_DISABLE_AGENTVIEW: "1"
|
|
186
190
|
},
|
|
187
191
|
stdio: ["ignore", "inherit", "inherit"],
|
|
188
192
|
detached: false
|
|
@@ -5379,13 +5383,20 @@ function readJobState(jobId) {
|
|
|
5379
5383
|
return null;
|
|
5380
5384
|
}
|
|
5381
5385
|
}
|
|
5382
|
-
function syncFromDisk({
|
|
5386
|
+
async function syncFromDisk({
|
|
5387
|
+
db,
|
|
5388
|
+
broadcaster
|
|
5389
|
+
}) {
|
|
5383
5390
|
const roster = readRoster();
|
|
5384
5391
|
const jobIds = readJobIds();
|
|
5385
5392
|
const liveIds = /* @__PURE__ */ new Set();
|
|
5386
5393
|
for (const e of roster) if (e.id) liveIds.add(e.id);
|
|
5387
5394
|
for (const id of jobIds) liveIds.add(id);
|
|
5395
|
+
let processed = 0;
|
|
5388
5396
|
for (const agentViewId of liveIds) {
|
|
5397
|
+
if ((processed++ & 15) === 0) {
|
|
5398
|
+
await new Promise((r) => setImmediate(r));
|
|
5399
|
+
}
|
|
5389
5400
|
const state = readJobState(agentViewId);
|
|
5390
5401
|
if (!state) continue;
|
|
5391
5402
|
const cwd = state.cwd ?? "";
|
|
@@ -5456,15 +5467,15 @@ function startAgentViewBridge(opts) {
|
|
|
5456
5467
|
const claudeRoot = join14(homedir10(), ".claude");
|
|
5457
5468
|
if (!existsSync12(claudeRoot)) return () => {
|
|
5458
5469
|
};
|
|
5459
|
-
const sync = () => {
|
|
5470
|
+
const sync = async () => {
|
|
5460
5471
|
try {
|
|
5461
|
-
syncFromDisk(opts);
|
|
5472
|
+
await syncFromDisk(opts);
|
|
5462
5473
|
} catch (err) {
|
|
5463
5474
|
console.warn("[agentview] sync failed:", err.message);
|
|
5464
5475
|
}
|
|
5465
5476
|
};
|
|
5466
|
-
const debounced = debounce(sync, 50);
|
|
5467
|
-
|
|
5477
|
+
const debounced = debounce(() => void sync(), 50);
|
|
5478
|
+
void sync();
|
|
5468
5479
|
const watchers = [];
|
|
5469
5480
|
const daemonDir = join14(homedir10(), ".claude", "daemon");
|
|
5470
5481
|
if (existsSync12(daemonDir)) {
|
|
@@ -5551,7 +5562,8 @@ async function createSolixServer(opts = {}) {
|
|
|
5551
5562
|
router,
|
|
5552
5563
|
broadcaster
|
|
5553
5564
|
});
|
|
5554
|
-
const stopAgentViewBridge =
|
|
5565
|
+
const stopAgentViewBridge = process.env.SOLIX_DISABLE_AGENTVIEW ? () => {
|
|
5566
|
+
} : startAgentViewBridge({ db, broadcaster });
|
|
5555
5567
|
const scheduleTimer = setInterval(() => {
|
|
5556
5568
|
try {
|
|
5557
5569
|
const due = listDueSchedules(db, now());
|
|
@@ -5599,7 +5611,7 @@ var BANNER = `
|
|
|
5599
5611
|
async function start(opts = {}) {
|
|
5600
5612
|
const port = opts.port ?? Number(process.env.SOLIX_PORT ?? 4242);
|
|
5601
5613
|
console.log(BANNER);
|
|
5602
|
-
const handle = await createSolixServer({ port, version: "1.11.
|
|
5614
|
+
const handle = await createSolixServer({ port, version: "1.11.6" });
|
|
5603
5615
|
const url = `http://${handle.hostname}:${handle.port}`;
|
|
5604
5616
|
console.log(`[solix] server listening on ${url}`);
|
|
5605
5617
|
console.log(`[solix] events -> POST ${url}/events`);
|
|
@@ -5654,7 +5666,7 @@ function uninstall() {
|
|
|
5654
5666
|
|
|
5655
5667
|
// src/index.ts
|
|
5656
5668
|
var program = new Command();
|
|
5657
|
-
program.name("solix").description("Solix \u2014 a solar-system command center for Claude Code agents").version("1.11.
|
|
5669
|
+
program.name("solix").description("Solix \u2014 a solar-system command center for Claude Code agents").version("1.11.6");
|
|
5658
5670
|
program.command("start", { isDefault: true }).description("Start the Solix server and open the browser").option("-p, --port <port>", "port to listen on", (v) => parseInt(v, 10), 4242).option("--no-open", "do not open browser automatically").action(async (opts) => {
|
|
5659
5671
|
await start({ port: opts.port, noOpen: !opts.open });
|
|
5660
5672
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aj as r,aE as u,r as j,j as e}from"./index-
|
|
1
|
+
import{aj as r,aE as u,r as j,j as e}from"./index-CyM5pkQz.js";function f({open:i,onClose:l}){const a=r(u),n=r(t=>t.enableAdvisor),d=r(t=>t.disableAdvisor),o=r(t=>t.pinAdvisor),c=r(t=>t.unpinAdvisor),x=r(t=>t.selectAdvisor);if(j.useEffect(()=>{if(!i)return;let t=!1;return fetch("/api/advisors").then(p=>p.ok?p.json():[]).then(p=>{if(t)return;const{applyMessage:v}=r.getState();for(const h of p)v({type:"advisor_upsert",advisor:h})}).catch(()=>{}),()=>{t=!0}},[i]),!i)return null;const s=a.filter(t=>t.enabled),b=a.filter(t=>!t.enabled);return e.jsxs("div",{className:"absolute inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-lg"}),e.jsxs("div",{className:"relative z-10 w-[620px] max-w-[94vw] max-h-[88vh] flex flex-col rounded-xl border border-solix-accent/40 bg-solix-panel shadow-2xl",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-solix-border flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"crew"}),e.jsx("div",{className:"text-lg font-semibold mt-0.5",children:"Advisor roster"}),e.jsxs("div",{className:"text-xs text-slate-400 mt-1",children:[s.length," active · ",b.length," available. Enable an advisor to add it to the inner ring and the + Task picker."]})]}),e.jsx("button",{onClick:l,className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-5",children:[e.jsx(m,{title:`Active crew · ${s.length}`,advisors:s,enableAdvisor:n,disableAdvisor:d,pinAdvisor:o,unpinAdvisor:c,selectAdvisor:x,onClose:l}),b.length>0&&e.jsx(m,{title:`Available (opt-in) · ${b.length}`,advisors:b,enableAdvisor:n,disableAdvisor:d,pinAdvisor:o,unpinAdvisor:c,selectAdvisor:x,onClose:l})]})]})]})}function m({title:i,advisors:l,enableAdvisor:a,disableAdvisor:n,pinAdvisor:d,unpinAdvisor:o,selectAdvisor:c,onClose:x}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-2",children:i}),e.jsx("div",{className:"space-y-2",children:l.map(s=>e.jsx("div",{className:"rounded border border-solix-border bg-black/20 p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{style:{color:s.color},children:s.glyph}),e.jsx("span",{className:"font-semibold text-slate-100",children:s.codename}),e.jsxs("span",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:[s.name," · ",String(s.defaultModel)]}),s.pinned&&e.jsx("span",{className:"text-[9px] uppercase tracking-wider text-amber-300 border border-amber-300/40 rounded px-1 py-0.5",children:"pinned"})]}),e.jsx("div",{className:"mt-1 text-xs text-slate-400 leading-snug",children:s.description})]}),e.jsxs("div",{className:"flex flex-col gap-1.5 shrink-0",children:[s.enabled?e.jsx("button",{onClick:()=>n(s.id),className:"px-2.5 py-1 rounded border border-solix-border text-slate-400 text-xs hover:text-white hover:bg-solix-border/30",children:"Disable"}):e.jsx("button",{onClick:()=>a(s.id),className:"px-2.5 py-1 rounded bg-cyan-500/20 border border-cyan-400/60 text-cyan-100 text-xs hover:bg-cyan-500/30",children:"+ Add"}),s.enabled&&(s.pinned?e.jsx("button",{onClick:()=>o(s.id),className:"px-2.5 py-1 rounded bg-amber-500/15 border border-amber-400/50 text-amber-200 text-xs hover:bg-amber-500/25",children:"Unpin"}):e.jsx("button",{onClick:()=>d(s.id),className:"px-2.5 py-1 rounded bg-amber-500/10 border border-amber-400/30 text-amber-200/80 text-xs hover:bg-amber-500/20",title:"Spawn an always-on session",children:"Pin"})),e.jsx("button",{onClick:()=>{c(s.id),x()},className:"px-2.5 py-1 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",children:"Details"})]})]})},s.id))})]})}export{f as CrewPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,aj as $,j as e}from"./index-DAI-7ykV.js";function H(s,i){const a=new Map(s.advisors.map(t=>[t.role,t])),n=new Map(i.advisors.map(t=>[t.role,t])),h=[...n.keys()].filter(t=>!a.has(t)),v=[...a.keys()].filter(t=>!n.has(t)),j=[...n.keys()].filter(t=>a.has(t)).map(t=>({role:t,from:a.get(t).pinned,to:n.get(t).pinned})).filter(t=>t.from!==t.to),x=new Set(s.skills.map(t=>t.id)),p=new Set(i.skills.map(t=>t.id)),r=[...p].filter(t=>!x.has(t)),b=[...x].filter(t=>!p.has(t)),d=new Set(s.projects.map(t=>t.name)),f=new Set(i.projects.map(t=>t.name)),u=[...f].filter(t=>!d.has(t)),g=[...d].filter(t=>!f.has(t));return{advisors:{added:h.sort(),removed:v.sort(),pinChanged:j.sort((t,S)=>t.role.localeCompare(S.role))},skills:{added:r.sort(),removed:b.sort()},projects:{added:u.sort(),removed:g.sort()}}}function W({open:s,onClose:i}){const[a,n]=c.useState("share"),[h,v]=c.useState("My Galaxy"),[j,x]=c.useState(""),[p,r]=c.useState(""),[b,d]=c.useState(!1),[f,u]=c.useState(null),[g,t]=c.useState(null),S=$(o=>Object.keys(o.sessions).length),I=$(o=>Object.values(o.advisors).filter(y=>y.enabled).length),l=$(o=>Object.keys(o.skills).length);if(!s)return null;const m=async()=>{d(!0),u(null);try{const o=new URLSearchParams({name:h}),y=await fetch(`/api/galaxy/export?${o.toString()}`);if(!y.ok)throw new Error(`HTTP ${y.status}`);const N=await y.json(),C=new Blob([JSON.stringify(N,null,2)],{type:"application/json"}),w=URL.createObjectURL(C),k=document.createElement("a");k.href=w,k.download=`${h.toLowerCase().replace(/\s+/g,"-")}.galaxy.json`,k.click(),URL.revokeObjectURL(w),u("Downloaded.")}catch(o){u(`Export failed: ${String(o)}`)}finally{d(!1)}},U=async o=>{d(!0),u(null);try{const N=await(await fetch("/api/galaxy/import",{method:"POST",headers:{"Content-Type":"application/json"},body:o})).json();N.ok?(u(`Imported: ${N.advisorsEnabled} enabled, ${N.advisorsDisabled} disabled, ${N.projectsHinted} projects.`),x(""),r("")):u(`Import failed: ${N.error??"unknown"}`)}catch(y){u(`Import failed: ${String(y)}`)}finally{d(!1)}},E=async(o,y,N)=>{u(null);let C,w=N;if(w)try{const k=await fetch("/api/galaxy/export?preview=1");if(k.ok){const B=await k.json();C=H(B,w)}}catch{}t({body:o,label:y,diff:C,manifest:w})},O=()=>{let o;try{o=JSON.parse(j)}catch{u("Could not parse JSON.");return}E(j,"pasted manifest",o)},D=()=>{E(JSON.stringify({url:p}),`URL: ${p}`,void 0)},_=()=>{if(!g)return;const o=g.body;t(null),U(o)},J=()=>{t(null)};return e.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-full sm:w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-30",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-accent",children:"Galaxy"}),e.jsx("div",{className:"text-lg font-semibold",children:"Share your space"}),e.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[I," advisors · ",l," skills ·"," ",S," sessions"]})]}),e.jsx("button",{onClick:i,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),e.jsxs("div",{className:"flex border-b border-solix-border text-xs",children:[e.jsx(P,{active:a==="share",onClick:()=>n("share"),children:"Sharing"}),e.jsx(P,{active:a==="versions",onClick:()=>n("versions"),children:"Versions"}),e.jsx(P,{active:a==="audit",onClick:()=>n("audit"),children:"Audit"})]}),a==="audit"?e.jsx(G,{open:s}):a==="versions"?e.jsx(V,{open:s}):e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[e.jsxs("section",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400 mb-2",children:"Export"}),e.jsx("input",{value:h,onChange:o=>v(o.target.value),placeholder:"Galaxy name",className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),e.jsx("button",{onClick:()=>void m(),disabled:b,className:"mt-2 w-full py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-50",children:"Download manifest (.galaxy.json)"})]}),e.jsxs("section",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400 mb-2",children:"Import from URL"}),e.jsx("input",{value:p,onChange:o=>r(o.target.value),placeholder:"https://… or local server URL",className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),e.jsx("button",{onClick:D,disabled:b||!p.trim(),className:"mt-2 w-full py-2 rounded bg-cyan-500/15 border border-cyan-400/40 text-cyan-200 text-sm hover:bg-cyan-500/25 disabled:opacity-50",children:"Pull and import"})]}),e.jsxs("section",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400 mb-2",children:"Import from JSON"}),e.jsx("textarea",{value:j,onChange:o=>x(o.target.value),placeholder:"Paste a galaxy manifest JSON here…",rows:10,className:"w-full text-xs bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent font-mono resize-none"}),e.jsx("button",{onClick:O,disabled:b||!j.trim(),className:"mt-2 w-full py-2 rounded bg-cyan-500/15 border border-cyan-400/40 text-cyan-200 text-sm hover:bg-cyan-500/25 disabled:opacity-50",children:"Apply manifest"})]}),g&&e.jsx(K,{label:g.label,diff:g.diff,manifest:g.manifest,busy:b,onConfirm:_,onCancel:J}),f&&e.jsx("div",{className:"text-xs text-slate-300 border border-solix-border rounded p-2 bg-black/30",children:f})]}),e.jsx("div",{className:"px-4 py-3 border-t border-solix-border text-xs text-slate-500",children:a==="audit"?"Append-only history. Read-only.":a==="versions"?"Each export snapshots a version. Identical re-exports are deduped.":"Imports never spawn pinned advisors or run shell commands. You're in control."})]})}function P({active:s,onClick:i,children:a}){return e.jsx("button",{onClick:i,className:`flex-1 px-3 py-2 ${s?"text-solix-accent border-b-2 border-solix-accent":"text-slate-400 hover:text-slate-200 border-b-2 border-transparent"}`,children:a})}const F=["permission_approved","permission_denied","advisor_invoked","advisor_pinned","advisor_unpinned","galaxy_imported"];function G({open:s}){const[i,a]=c.useState([]),[n,h]=c.useState("all"),[v,j]=c.useState(!1),[x,p]=c.useState(null);return c.useEffect(()=>{if(!s)return;let r=!1;j(!0),p(null);const b=`/api/audit${n==="all"?"":`?kind=${n}`}`;return fetch(b).then(d=>d.ok?d.json():Promise.reject(new Error(`HTTP ${d.status}`))).then(d=>{r||a(d)}).catch(d=>{r||p(d.message)}).finally(()=>{r||j(!1)}),()=>{r=!0}},[s,n]),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(T,{label:"all",active:n==="all",onClick:()=>h("all")}),F.map(r=>e.jsx(T,{label:A(r),active:n===r,onClick:()=>h(r)},r))]}),v&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:"Loading…"}),x&&e.jsxs("div",{className:"text-xs text-solix-danger italic",children:["Could not load audit events: ",x]}),!v&&i.length===0&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:"No audit events yet. Approve a permission or invoke an advisor and they'll start appearing here."}),e.jsx("ul",{className:"space-y-1.5",children:i.map(r=>e.jsxs("li",{className:"rounded border border-solix-border bg-black/20 p-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:`uppercase tracking-wide ${M(r.kind)}`,children:A(r.kind)}),e.jsx("span",{className:"text-slate-500 font-mono",children:new Date(r.ts).toLocaleString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,month:"short",day:"numeric"})})]}),e.jsx("div",{className:"text-[12px] text-slate-100 mt-1 leading-snug",children:r.summary})]},r.id))})]})}function T({label:s,active:i,onClick:a}){return e.jsx("button",{onClick:a,className:`text-[10px] px-2 py-0.5 rounded border ${i?"bg-solix-accent/15 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:s})}function A(s){return s==="all"?"all":s.replace(/_/g," ")}function M(s){return s==="permission_approved"?"text-solix-ok":s==="permission_denied"?"text-solix-danger":s==="galaxy_imported"?"text-cyan-300":s.startsWith("advisor_")?"text-amber-300":"text-slate-300"}function V({open:s}){const[i,a]=c.useState([]),[n,h]=c.useState(!1),[v,j]=c.useState(null),[x,p]=c.useState(null),[r,b]=c.useState(null),[d,f]=c.useState(null),[u,g]=c.useState(!1);c.useEffect(()=>{if(!s)return;let l=!1;return h(!0),fetch("/api/galaxy/versions").then(m=>m.ok?m.json():Promise.reject(new Error(`HTTP ${m.status}`))).then(m=>{l||a(m)}).catch(m=>{l||j(m.message)}).finally(()=>{l||h(!1)}),()=>{l=!0}},[s]),c.useEffect(()=>{if(!x||!r){f(null);return}if(x===r){f(null);return}let l=!1;return g(!0),fetch(`/api/galaxy/diff?from=${x}&to=${r}`).then(m=>m.ok?m.json():Promise.reject(new Error(`HTTP ${m.status}`))).then(m=>{l||f(m)}).catch(()=>{l||f(null)}).finally(()=>{l||g(!1)}),()=>{l=!0}},[x,r]);const t=l=>{x?!r&&l!==x?b(l):(p(l),b(null),f(null)):p(l)},S=()=>{p(null),b(null),f(null)},I=l=>l.id===x?"from":l.id===r?"to":null;return e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[(x||r)&&e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400",children:[e.jsxs("div",{children:[x&&!r&&"Pick a second version to diff…",x&&r&&u&&"Computing diff…",x&&r&&!u&&d&&e.jsxs(e.Fragment,{children:["v",d.from.ordinal," → v",d.to.ordinal]})]}),e.jsx("button",{onClick:S,className:"text-slate-500 hover:text-slate-100",children:"clear"})]}),d&&e.jsx(R,{diff:d.diff}),n&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:"Loading…"}),v&&e.jsxs("div",{className:"text-xs text-solix-danger italic",children:["Could not load versions: ",v]}),!n&&i.length===0&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:'No versions yet. Hit "Download manifest" on the Sharing tab to create one.'}),e.jsx("ul",{className:"space-y-1.5",children:i.map(l=>{const m=I(l);return e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(l.id),className:`w-full text-left rounded border p-2 ${m==="from"?"border-solix-accent bg-solix-accent/10":m==="to"?"border-cyan-400 bg-cyan-400/10":"border-solix-border bg-black/20 hover:bg-solix-border/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsxs("span",{className:"uppercase tracking-wide text-slate-400",children:["v",l.ordinal," · ",l.name]}),e.jsx("span",{className:"text-slate-500 font-mono",children:new Date(l.ts).toLocaleString("en-US",{hour:"2-digit",minute:"2-digit",month:"short",day:"numeric"})})]}),e.jsxs("div",{className:"text-[11px] text-slate-300 mt-1",children:[l.manifest.advisors.length," advisors ·"," ",l.manifest.skills.length," skills ·"," ",l.manifest.projects.length," projects",m&&e.jsxs("span",{className:"ml-2 text-[9px] uppercase tracking-wider text-slate-400",children:["[",m,"]"]})]})]})},l.id)})})]})}function R({diff:s}){return s.advisors.added.length===0&&s.advisors.removed.length===0&&s.advisors.pinChanged.length===0&&s.skills.added.length===0&&s.skills.removed.length===0&&s.projects.added.length===0&&s.projects.removed.length===0?e.jsx("div",{className:"text-xs text-slate-500 italic border border-solix-border rounded p-2 bg-black/20",children:"No changes between these versions."}):e.jsxs("div",{className:"rounded border border-solix-border bg-black/30 p-2 space-y-2 text-xs",children:[e.jsx(L,{label:"Advisors",added:s.advisors.added,removed:s.advisors.removed}),s.advisors.pinChanged.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"Advisor pin changes"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:s.advisors.pinChanged.map(a=>e.jsxs("li",{className:"text-slate-200",children:[e.jsx("span",{className:"font-mono",children:a.role}),":"," ",a.from?"pinned":"unpinned"," →"," ",a.to?"pinned":"unpinned"]},a.role))})]}),e.jsx(L,{label:"Skills",added:s.skills.added,removed:s.skills.removed}),e.jsx(L,{label:"Projects",added:s.projects.added,removed:s.projects.removed})]})}function K({label:s,diff:i,manifest:a,busy:n,onConfirm:h,onCancel:v}){return e.jsxs("div",{className:"rounded border border-amber-300/60 bg-amber-500/10 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wide text-amber-200",children:"confirm import"}),e.jsx("div",{className:"text-[10px] text-slate-400 font-mono truncate max-w-[55%]",children:s})]}),a&&e.jsxs("div",{className:"text-xs text-slate-200",children:[e.jsx("span",{className:"font-semibold",children:a.name}),a.author&&e.jsxs("span",{className:"text-slate-400",children:[" · by ",a.author]})]}),i?e.jsx(R,{diff:i}):a?e.jsx("div",{className:"text-xs text-slate-400 italic",children:"Could not compute a diff against the current galaxy. Apply will still proceed if you confirm."}):e.jsx("div",{className:"text-xs text-slate-300",children:"Solix will fetch the manifest from this URL and apply it. Diff preview is only available for pasted JSON."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:h,disabled:n,className:"flex-1 py-1.5 rounded bg-amber-500/20 border border-amber-300 text-amber-100 text-xs hover:bg-amber-500/30 disabled:opacity-50",children:"Apply"}),e.jsx("button",{onClick:v,disabled:n,className:"px-3 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white disabled:opacity-50",children:"Cancel"})]})]})}function L({label:s,added:i,removed:a}){return i.length===0&&a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:s}),e.jsxs("ul",{className:"mt-1 space-y-0.5",children:[i.map(n=>e.jsxs("li",{className:"text-solix-ok",children:["+ ",n]},`+${n}`)),a.map(n=>e.jsxs("li",{className:"text-solix-danger",children:["− ",n]},`-${n}`))]})]})}export{W as GalaxyPanel};
|
|
1
|
+
import{r as c,aj as $,j as e}from"./index-CyM5pkQz.js";function H(s,i){const a=new Map(s.advisors.map(t=>[t.role,t])),n=new Map(i.advisors.map(t=>[t.role,t])),h=[...n.keys()].filter(t=>!a.has(t)),v=[...a.keys()].filter(t=>!n.has(t)),j=[...n.keys()].filter(t=>a.has(t)).map(t=>({role:t,from:a.get(t).pinned,to:n.get(t).pinned})).filter(t=>t.from!==t.to),x=new Set(s.skills.map(t=>t.id)),p=new Set(i.skills.map(t=>t.id)),r=[...p].filter(t=>!x.has(t)),b=[...x].filter(t=>!p.has(t)),d=new Set(s.projects.map(t=>t.name)),f=new Set(i.projects.map(t=>t.name)),u=[...f].filter(t=>!d.has(t)),g=[...d].filter(t=>!f.has(t));return{advisors:{added:h.sort(),removed:v.sort(),pinChanged:j.sort((t,S)=>t.role.localeCompare(S.role))},skills:{added:r.sort(),removed:b.sort()},projects:{added:u.sort(),removed:g.sort()}}}function W({open:s,onClose:i}){const[a,n]=c.useState("share"),[h,v]=c.useState("My Galaxy"),[j,x]=c.useState(""),[p,r]=c.useState(""),[b,d]=c.useState(!1),[f,u]=c.useState(null),[g,t]=c.useState(null),S=$(o=>Object.keys(o.sessions).length),I=$(o=>Object.values(o.advisors).filter(y=>y.enabled).length),l=$(o=>Object.keys(o.skills).length);if(!s)return null;const m=async()=>{d(!0),u(null);try{const o=new URLSearchParams({name:h}),y=await fetch(`/api/galaxy/export?${o.toString()}`);if(!y.ok)throw new Error(`HTTP ${y.status}`);const N=await y.json(),C=new Blob([JSON.stringify(N,null,2)],{type:"application/json"}),w=URL.createObjectURL(C),k=document.createElement("a");k.href=w,k.download=`${h.toLowerCase().replace(/\s+/g,"-")}.galaxy.json`,k.click(),URL.revokeObjectURL(w),u("Downloaded.")}catch(o){u(`Export failed: ${String(o)}`)}finally{d(!1)}},U=async o=>{d(!0),u(null);try{const N=await(await fetch("/api/galaxy/import",{method:"POST",headers:{"Content-Type":"application/json"},body:o})).json();N.ok?(u(`Imported: ${N.advisorsEnabled} enabled, ${N.advisorsDisabled} disabled, ${N.projectsHinted} projects.`),x(""),r("")):u(`Import failed: ${N.error??"unknown"}`)}catch(y){u(`Import failed: ${String(y)}`)}finally{d(!1)}},E=async(o,y,N)=>{u(null);let C,w=N;if(w)try{const k=await fetch("/api/galaxy/export?preview=1");if(k.ok){const B=await k.json();C=H(B,w)}}catch{}t({body:o,label:y,diff:C,manifest:w})},O=()=>{let o;try{o=JSON.parse(j)}catch{u("Could not parse JSON.");return}E(j,"pasted manifest",o)},D=()=>{E(JSON.stringify({url:p}),`URL: ${p}`,void 0)},_=()=>{if(!g)return;const o=g.body;t(null),U(o)},J=()=>{t(null)};return e.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-full sm:w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-30",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-accent",children:"Galaxy"}),e.jsx("div",{className:"text-lg font-semibold",children:"Share your space"}),e.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[I," advisors · ",l," skills ·"," ",S," sessions"]})]}),e.jsx("button",{onClick:i,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),e.jsxs("div",{className:"flex border-b border-solix-border text-xs",children:[e.jsx(P,{active:a==="share",onClick:()=>n("share"),children:"Sharing"}),e.jsx(P,{active:a==="versions",onClick:()=>n("versions"),children:"Versions"}),e.jsx(P,{active:a==="audit",onClick:()=>n("audit"),children:"Audit"})]}),a==="audit"?e.jsx(G,{open:s}):a==="versions"?e.jsx(V,{open:s}):e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[e.jsxs("section",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400 mb-2",children:"Export"}),e.jsx("input",{value:h,onChange:o=>v(o.target.value),placeholder:"Galaxy name",className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),e.jsx("button",{onClick:()=>void m(),disabled:b,className:"mt-2 w-full py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-50",children:"Download manifest (.galaxy.json)"})]}),e.jsxs("section",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400 mb-2",children:"Import from URL"}),e.jsx("input",{value:p,onChange:o=>r(o.target.value),placeholder:"https://… or local server URL",className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),e.jsx("button",{onClick:D,disabled:b||!p.trim(),className:"mt-2 w-full py-2 rounded bg-cyan-500/15 border border-cyan-400/40 text-cyan-200 text-sm hover:bg-cyan-500/25 disabled:opacity-50",children:"Pull and import"})]}),e.jsxs("section",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400 mb-2",children:"Import from JSON"}),e.jsx("textarea",{value:j,onChange:o=>x(o.target.value),placeholder:"Paste a galaxy manifest JSON here…",rows:10,className:"w-full text-xs bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent font-mono resize-none"}),e.jsx("button",{onClick:O,disabled:b||!j.trim(),className:"mt-2 w-full py-2 rounded bg-cyan-500/15 border border-cyan-400/40 text-cyan-200 text-sm hover:bg-cyan-500/25 disabled:opacity-50",children:"Apply manifest"})]}),g&&e.jsx(K,{label:g.label,diff:g.diff,manifest:g.manifest,busy:b,onConfirm:_,onCancel:J}),f&&e.jsx("div",{className:"text-xs text-slate-300 border border-solix-border rounded p-2 bg-black/30",children:f})]}),e.jsx("div",{className:"px-4 py-3 border-t border-solix-border text-xs text-slate-500",children:a==="audit"?"Append-only history. Read-only.":a==="versions"?"Each export snapshots a version. Identical re-exports are deduped.":"Imports never spawn pinned advisors or run shell commands. You're in control."})]})}function P({active:s,onClick:i,children:a}){return e.jsx("button",{onClick:i,className:`flex-1 px-3 py-2 ${s?"text-solix-accent border-b-2 border-solix-accent":"text-slate-400 hover:text-slate-200 border-b-2 border-transparent"}`,children:a})}const F=["permission_approved","permission_denied","advisor_invoked","advisor_pinned","advisor_unpinned","galaxy_imported"];function G({open:s}){const[i,a]=c.useState([]),[n,h]=c.useState("all"),[v,j]=c.useState(!1),[x,p]=c.useState(null);return c.useEffect(()=>{if(!s)return;let r=!1;j(!0),p(null);const b=`/api/audit${n==="all"?"":`?kind=${n}`}`;return fetch(b).then(d=>d.ok?d.json():Promise.reject(new Error(`HTTP ${d.status}`))).then(d=>{r||a(d)}).catch(d=>{r||p(d.message)}).finally(()=>{r||j(!1)}),()=>{r=!0}},[s,n]),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(T,{label:"all",active:n==="all",onClick:()=>h("all")}),F.map(r=>e.jsx(T,{label:A(r),active:n===r,onClick:()=>h(r)},r))]}),v&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:"Loading…"}),x&&e.jsxs("div",{className:"text-xs text-solix-danger italic",children:["Could not load audit events: ",x]}),!v&&i.length===0&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:"No audit events yet. Approve a permission or invoke an advisor and they'll start appearing here."}),e.jsx("ul",{className:"space-y-1.5",children:i.map(r=>e.jsxs("li",{className:"rounded border border-solix-border bg-black/20 p-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:`uppercase tracking-wide ${M(r.kind)}`,children:A(r.kind)}),e.jsx("span",{className:"text-slate-500 font-mono",children:new Date(r.ts).toLocaleString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,month:"short",day:"numeric"})})]}),e.jsx("div",{className:"text-[12px] text-slate-100 mt-1 leading-snug",children:r.summary})]},r.id))})]})}function T({label:s,active:i,onClick:a}){return e.jsx("button",{onClick:a,className:`text-[10px] px-2 py-0.5 rounded border ${i?"bg-solix-accent/15 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:s})}function A(s){return s==="all"?"all":s.replace(/_/g," ")}function M(s){return s==="permission_approved"?"text-solix-ok":s==="permission_denied"?"text-solix-danger":s==="galaxy_imported"?"text-cyan-300":s.startsWith("advisor_")?"text-amber-300":"text-slate-300"}function V({open:s}){const[i,a]=c.useState([]),[n,h]=c.useState(!1),[v,j]=c.useState(null),[x,p]=c.useState(null),[r,b]=c.useState(null),[d,f]=c.useState(null),[u,g]=c.useState(!1);c.useEffect(()=>{if(!s)return;let l=!1;return h(!0),fetch("/api/galaxy/versions").then(m=>m.ok?m.json():Promise.reject(new Error(`HTTP ${m.status}`))).then(m=>{l||a(m)}).catch(m=>{l||j(m.message)}).finally(()=>{l||h(!1)}),()=>{l=!0}},[s]),c.useEffect(()=>{if(!x||!r){f(null);return}if(x===r){f(null);return}let l=!1;return g(!0),fetch(`/api/galaxy/diff?from=${x}&to=${r}`).then(m=>m.ok?m.json():Promise.reject(new Error(`HTTP ${m.status}`))).then(m=>{l||f(m)}).catch(()=>{l||f(null)}).finally(()=>{l||g(!1)}),()=>{l=!0}},[x,r]);const t=l=>{x?!r&&l!==x?b(l):(p(l),b(null),f(null)):p(l)},S=()=>{p(null),b(null),f(null)},I=l=>l.id===x?"from":l.id===r?"to":null;return e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[(x||r)&&e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400",children:[e.jsxs("div",{children:[x&&!r&&"Pick a second version to diff…",x&&r&&u&&"Computing diff…",x&&r&&!u&&d&&e.jsxs(e.Fragment,{children:["v",d.from.ordinal," → v",d.to.ordinal]})]}),e.jsx("button",{onClick:S,className:"text-slate-500 hover:text-slate-100",children:"clear"})]}),d&&e.jsx(R,{diff:d.diff}),n&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:"Loading…"}),v&&e.jsxs("div",{className:"text-xs text-solix-danger italic",children:["Could not load versions: ",v]}),!n&&i.length===0&&e.jsx("div",{className:"text-xs text-slate-500 italic",children:'No versions yet. Hit "Download manifest" on the Sharing tab to create one.'}),e.jsx("ul",{className:"space-y-1.5",children:i.map(l=>{const m=I(l);return e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(l.id),className:`w-full text-left rounded border p-2 ${m==="from"?"border-solix-accent bg-solix-accent/10":m==="to"?"border-cyan-400 bg-cyan-400/10":"border-solix-border bg-black/20 hover:bg-solix-border/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsxs("span",{className:"uppercase tracking-wide text-slate-400",children:["v",l.ordinal," · ",l.name]}),e.jsx("span",{className:"text-slate-500 font-mono",children:new Date(l.ts).toLocaleString("en-US",{hour:"2-digit",minute:"2-digit",month:"short",day:"numeric"})})]}),e.jsxs("div",{className:"text-[11px] text-slate-300 mt-1",children:[l.manifest.advisors.length," advisors ·"," ",l.manifest.skills.length," skills ·"," ",l.manifest.projects.length," projects",m&&e.jsxs("span",{className:"ml-2 text-[9px] uppercase tracking-wider text-slate-400",children:["[",m,"]"]})]})]})},l.id)})})]})}function R({diff:s}){return s.advisors.added.length===0&&s.advisors.removed.length===0&&s.advisors.pinChanged.length===0&&s.skills.added.length===0&&s.skills.removed.length===0&&s.projects.added.length===0&&s.projects.removed.length===0?e.jsx("div",{className:"text-xs text-slate-500 italic border border-solix-border rounded p-2 bg-black/20",children:"No changes between these versions."}):e.jsxs("div",{className:"rounded border border-solix-border bg-black/30 p-2 space-y-2 text-xs",children:[e.jsx(L,{label:"Advisors",added:s.advisors.added,removed:s.advisors.removed}),s.advisors.pinChanged.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:"Advisor pin changes"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:s.advisors.pinChanged.map(a=>e.jsxs("li",{className:"text-slate-200",children:[e.jsx("span",{className:"font-mono",children:a.role}),":"," ",a.from?"pinned":"unpinned"," →"," ",a.to?"pinned":"unpinned"]},a.role))})]}),e.jsx(L,{label:"Skills",added:s.skills.added,removed:s.skills.removed}),e.jsx(L,{label:"Projects",added:s.projects.added,removed:s.projects.removed})]})}function K({label:s,diff:i,manifest:a,busy:n,onConfirm:h,onCancel:v}){return e.jsxs("div",{className:"rounded border border-amber-300/60 bg-amber-500/10 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wide text-amber-200",children:"confirm import"}),e.jsx("div",{className:"text-[10px] text-slate-400 font-mono truncate max-w-[55%]",children:s})]}),a&&e.jsxs("div",{className:"text-xs text-slate-200",children:[e.jsx("span",{className:"font-semibold",children:a.name}),a.author&&e.jsxs("span",{className:"text-slate-400",children:[" · by ",a.author]})]}),i?e.jsx(R,{diff:i}):a?e.jsx("div",{className:"text-xs text-slate-400 italic",children:"Could not compute a diff against the current galaxy. Apply will still proceed if you confirm."}):e.jsx("div",{className:"text-xs text-slate-300",children:"Solix will fetch the manifest from this URL and apply it. Diff preview is only available for pasted JSON."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:h,disabled:n,className:"flex-1 py-1.5 rounded bg-amber-500/20 border border-amber-300 text-amber-100 text-xs hover:bg-amber-500/30 disabled:opacity-50",children:"Apply"}),e.jsx("button",{onClick:v,disabled:n,className:"px-3 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white disabled:opacity-50",children:"Cancel"})]})]})}function L({label:s,added:i,removed:a}){return i.length===0&&a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:s}),e.jsxs("ul",{className:"mt-1 space-y-0.5",children:[i.map(n=>e.jsxs("li",{className:"text-solix-ok",children:["+ ",n]},`+${n}`)),a.map(n=>e.jsxs("li",{className:"text-solix-danger",children:["− ",n]},`-${n}`))]})]})}export{W as GalaxyPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as E,g as Yf,j as S,R as Xf,O as Wn,P as Vn,S as $o,a as Bo,V as Kf,b as Zf,B as qf,N as Vu,A as Qu,W as Jf,C as $f,c as ve,d as Te,e as ed,L as No,f as td,U as An,T as nd,h as rd,D as Cn,i as Ss,M as pr,k as hr,l as el,Q as tl,m as id,n as sd,I as od,F as su,o as nl,p as xr,q as ld,s as dl,t as Yu,u as Ht,v as ou,w as lu,x as Xu,y as zn,z as ad,E as ud,G as tn,H as st,J as fs,K as Qn,X as ri,Y as it,Z as cd,_ as fd,$ as dd,a0 as Ku,a1 as Ft,a2 as ds,a3 as pd,a4 as ps,a5 as Tr,a6 as pl,a7 as Zu,a8 as qu,a9 as wr,aa as hd,ab as Kn,ac as _e,ad as Ju,ae as md,af as $u,ag as hs,ah as rl,ai as vd,aj as se,ak as ms,al as il,am as xs,an as sl,ao as ec,ap as gd,aq as yd,ar as Sd,as as xd,at as wd,au as Ed,av as Md,aw as _d,ax as Td,ay as Rd,az as hl,aA as Pd,aB as Cd,aC as Ad,aD as zd}from"./index-
|
|
1
|
+
import{r as E,g as Yf,j as S,R as Xf,O as Wn,P as Vn,S as $o,a as Bo,V as Kf,b as Zf,B as qf,N as Vu,A as Qu,W as Jf,C as $f,c as ve,d as Te,e as ed,L as No,f as td,U as An,T as nd,h as rd,D as Cn,i as Ss,M as pr,k as hr,l as el,Q as tl,m as id,n as sd,I as od,F as su,o as nl,p as xr,q as ld,s as dl,t as Yu,u as Ht,v as ou,w as lu,x as Xu,y as zn,z as ad,E as ud,G as tn,H as st,J as fs,K as Qn,X as ri,Y as it,Z as cd,_ as fd,$ as dd,a0 as Ku,a1 as Ft,a2 as ds,a3 as pd,a4 as ps,a5 as Tr,a6 as pl,a7 as Zu,a8 as qu,a9 as wr,aa as hd,ab as Kn,ac as _e,ad as Ju,ae as md,af as $u,ag as hs,ah as rl,ai as vd,aj as se,ak as ms,al as il,am as xs,an as sl,ao as ec,ap as gd,aq as yd,ar as Sd,as as xd,at as wd,au as Ed,av as Md,aw as _d,ax as Td,ay as Rd,az as hl,aA as Pd,aB as Cd,aC as Ad,aD as zd}from"./index-CyM5pkQz.js";var tc={exports:{}},Zn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-reconciler-constants.production.min.js
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aj as n,r,j as s}from"./index-
|
|
1
|
+
import{aj as n,r,j as s}from"./index-CyM5pkQz.js";const P=[1,4,16,64];function S({open:l,onClose:u}){const e=n(t=>t.playback),m=n(t=>t.enterPlayback),v=n(t=>t.exitPlayback),o=n(t=>t.setPlaybackTime),f=n(t=>t.setPlaybackSpeed),p=n(t=>t.setPlaybackPlaying),x=n(t=>t.setPlaybackLoading),[i,g]=r.useState(30);r.useEffect(()=>{if(!l||e.active&&e.events.length>0)return;x(!0);const t=Date.now()-i*60*1e3;fetch(`/api/timeline?sinceMs=${t}&untilMs=${Date.now()}`).then(a=>a.json()).then(a=>{if(a.events.length===0){x(!1),m([],Date.now()-6e4,Date.now());return}m(a.events,a.earliest,a.latest)}).catch(a=>{console.warn("[timeline] fetch failed",a),x(!1)})},[l,i]);const c=r.useRef(0);if(r.useEffect(()=>{if(!e.active||!e.playing)return;let t=0;const a=h=>{const N=c.current?h-c.current:16;c.current=h;const b=e.currentMs+N*e.speed;b>=e.latestMs?(o(e.latestMs),p(!1)):(o(b),t=requestAnimationFrame(a))};return t=requestAnimationFrame(a),()=>{cancelAnimationFrame(t),c.current=0}},[e.active,e.playing,e.speed,e.latestMs]),!l)return null;const j=()=>{v(),u()},y=Math.max(1,e.latestMs-e.earliestMs),k=e.active?(e.currentMs-e.earliestMs)/y*100:0,M=e.events.filter(t=>t.ts<=e.currentMs);return s.jsx("div",{className:"absolute bottom-0 inset-x-0 z-30 bg-solix-panel/95 backdrop-blur border-t border-solix-border",children:s.jsxs("div",{className:"px-4 py-3 max-w-6xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"▸ Playback"}),s.jsxs("span",{className:"text-[10px] text-slate-400",children:[e.events.length," events · last ",i," min"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,onChange:t=>g(parseInt(t.target.value,10)),className:"text-[10px] bg-black/40 border border-solix-border rounded px-1.5 py-0.5 text-slate-300",children:[s.jsx("option",{value:5,children:"5 min"}),s.jsx("option",{value:15,children:"15 min"}),s.jsx("option",{value:30,children:"30 min"}),s.jsx("option",{value:60,children:"1 hour"}),s.jsx("option",{value:180,children:"3 hours"})]}),s.jsx("button",{onClick:j,className:"text-slate-400 hover:text-slate-100 text-xs",children:"✕ Live"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>p(!e.playing),disabled:!e.active||e.events.length===0,className:"w-8 h-8 rounded-full bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40 flex items-center justify-center",children:e.playing?"⏸":"▶"}),s.jsxs("div",{className:"flex-1 relative",children:[s.jsx("input",{type:"range",min:e.earliestMs,max:e.latestMs,value:e.currentMs,onChange:t=>o(parseInt(t.target.value,10)),className:"w-full",disabled:!e.active}),s.jsx("div",{className:"absolute -top-1.5 h-0.5 bg-solix-accent/40 pointer-events-none",style:{left:0,width:`${k}%`}})]}),s.jsx("div",{className:"flex items-center gap-1",children:P.map(t=>s.jsxs("button",{onClick:()=>f(t),className:`text-[10px] px-1.5 py-0.5 rounded border ${e.speed===t?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:[t,"×"]},t))})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px] text-slate-500 font-mono",children:[s.jsx("span",{children:d(e.earliestMs)}),s.jsxs("span",{className:"text-solix-accent",children:[d(e.currentMs)," · ",M.length," events"]}),s.jsx("span",{children:d(e.latestMs)})]}),e.loading&&s.jsx("div",{className:"text-center text-xs text-slate-500 italic mt-2",children:"Loading timeline…"}),!e.loading&&e.events.length===0&&e.active&&s.jsx("div",{className:"text-center text-xs text-slate-500 italic mt-2",children:"No events in this range. Try a longer window or run some agents first."})]})})}function d(l){return l?new Date(l).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}):"—"}export{S as TimelineDrawer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aj as x,aF as g,r as m,j as e}from"./index-
|
|
1
|
+
import{aj as x,aF as g,r as m,j as e}from"./index-CyM5pkQz.js";const u=l=>`$${l.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=l=>Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(l);function r({label:l,value:a,hint:s}){return e.jsxs("div",{className:"rounded-lg border border-solix-border bg-black/20 p-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-400",children:l}),e.jsx("div",{className:"mt-1 text-xl font-semibold tabular-nums text-slate-100",children:a}),s?e.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:s}):null]})}function o({n:l,label:a,color:s}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${s}`}),e.jsx("span",{className:"tabular-nums font-medium text-slate-200",children:l}),e.jsx("span",{className:"text-slate-500",children:a})]})}function f({open:l,onClose:a}){const s=x(g),p=x(t=>t.selectSession),[c,d]=m.useState(null);if(m.useEffect(()=>{if(!l)return;let t=!1;return Promise.all([fetch("/api/audit?kind=permission_approved").then(i=>i.ok?i.json():Promise.resolve([])),fetch("/api/audit?kind=permission_denied").then(i=>i.ok?i.json():Promise.resolve([]))]).then(([i,j])=>{t||d(i.length+j.length)}).catch(()=>{t||d(null)}),()=>{t=!0}},[l]),!l)return null;const n=s.missions,h=[["done",n.completed],["failed",n.failed],["active",n.active],["cancelled",n.cancelled]];return e.jsxs("div",{className:"absolute top-16 right-0 bottom-0 w-full sm:w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-30",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-accent",children:"Mission Control"}),e.jsx("div",{className:"text-lg font-semibold",children:"Your workspace"}),e.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[s.sessionCount," sessions · ",s.projectCount," projects ·"," ",s.advisorCount," advisors · ",s.skillCount," skills"]})]}),e.jsx("button",{onClick:a,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(r,{label:"Total spend",value:u(s.totalSpendUsd)}),e.jsx(r,{label:"Total tokens",value:v(s.totalTokens)}),e.jsx(r,{label:"Cost / mission",value:u(s.costPerCompletedMission),hint:`${s.completedMissions} completed`}),e.jsx(r,{label:"Interventions",value:c===null?"—":String(c),hint:`${s.pendingPermissions} pending now`})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-2",children:"Status"}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsx(o,{n:s.activeCount,label:"active",color:"bg-solix-ok"}),e.jsx(o,{n:s.attentionCount,label:"need you",color:"bg-solix-danger"}),e.jsx(o,{n:s.idleCount,label:"idle",color:"bg-slate-600"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-2",children:"Missions"}),e.jsx("div",{className:"grid grid-cols-4 gap-2 text-center",children:h.map(([t,i])=>e.jsxs("div",{className:"rounded border border-solix-border bg-black/20 py-2",children:[e.jsx("div",{className:"text-lg font-semibold tabular-nums",children:i}),e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:t})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-2",children:"Context pressure"}),e.jsxs("div",{className:"text-sm text-slate-300 tabular-nums",children:["avg ",Math.round(s.contextAvgPct),"% · max"," ",e.jsxs("span",{className:s.contextMaxPct>=85?"text-solix-danger font-medium":"",children:[Math.round(s.contextMaxPct),"%"]}),s.contextMaxPct>=85?e.jsxs("span",{className:"text-solix-danger",children:[" ","— an agent is near its limit"]}):null]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-2",children:["Needs you (",s.needsYou.length,")"]}),s.needsYou.length===0?e.jsx("div",{className:"text-sm text-slate-500",children:"Nothing waiting — the fleet is running itself."}):e.jsx("div",{className:"space-y-1.5",children:s.needsYou.map(t=>e.jsx("button",{onClick:()=>p(t.id),className:"w-full text-left rounded border border-solix-danger/40 bg-solix-danger/5 px-3 py-2 hover:bg-solix-danger/10",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-slate-100 truncate",children:t.name??t.id.slice(0,8)}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-solix-danger whitespace-nowrap",children:t.status.replace(/_/g," ")})]})},t.id))})]})]})]})}export{f as WorkspacePanel};
|