@serkanalgur/opencode-nexus 1.7.0 → 1.8.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.
Files changed (4) hide show
  1. package/README.md +234 -331
  2. package/dist/index.js +1165 -50
  3. package/dist/tui.js +174 -13
  4. package/package.json +1 -1
package/dist/tui.js CHANGED
@@ -34535,20 +34535,24 @@ var tui_default = define({
34535
34535
  break;
34536
34536
  case "web":
34537
34537
  case "w":
34538
- try {
34538
+ {
34539
34539
  const port = parts[1] ? parseInt(parts[1]) : 4747;
34540
+ const host = parts[2] || "127.0.0.1";
34540
34541
  context.ui.toast.show({
34541
- title: "Nexus Dashboard",
34542
- message: `Starting web dashboard on port ${port}...
34543
- Open http://localhost:${port} in your browser`,
34544
- variant: "success",
34545
- duration: 5000
34546
- });
34547
- } catch (e) {
34548
- context.ui.toast.show({
34549
- title: "Nexus",
34550
- message: `Failed to start dashboard: ${e.message}`,
34551
- variant: "error"
34542
+ title: "⚡ Nexus Web Dashboard",
34543
+ message: [
34544
+ `Port: ${port} Host: ${host}`,
34545
+ "",
34546
+ "To start the dashboard, ask the agent:",
34547
+ ` nexus.dashboard.start(port=${port}, host="${host}")`,
34548
+ "",
34549
+ `Then open: http://${host}:${port}`,
34550
+ "",
34551
+ "Or use /nexus-dashboard for a config summary."
34552
+ ].join(`
34553
+ `),
34554
+ variant: "info",
34555
+ duration: 12000
34552
34556
  });
34553
34557
  }
34554
34558
  break;
@@ -34621,6 +34625,35 @@ Open http://localhost:${port} in your browser`,
34621
34625
  await handleDashboard();
34622
34626
  }
34623
34627
  },
34628
+ {
34629
+ id: "nexus.web",
34630
+ title: "Start Nexus Web Dashboard",
34631
+ group: "Nexus",
34632
+ palette: true,
34633
+ slash: { name: "nexus-web", aliases: ["nw"], arguments: true },
34634
+ enabled: () => true,
34635
+ suggested: true,
34636
+ run: async (input) => {
34637
+ const port = input ? parseInt(input) : 4747;
34638
+ const host = "127.0.0.1";
34639
+ context.ui.toast.show({
34640
+ title: "⚡ Nexus Web Dashboard",
34641
+ message: [
34642
+ `Port: ${port} Host: ${host}`,
34643
+ "",
34644
+ "To start the dashboard, ask the agent:",
34645
+ ` nexus.dashboard.start(port=${port}, host="${host}")`,
34646
+ "",
34647
+ `Then open: http://${host}:${port}`,
34648
+ "",
34649
+ "Tip: The dashboard shows live agent status, costs, and history."
34650
+ ].join(`
34651
+ `),
34652
+ variant: "info",
34653
+ duration: 12000
34654
+ });
34655
+ }
34656
+ },
34624
34657
  {
34625
34658
  id: "nexus.model",
34626
34659
  title: "Select Agent Model",
@@ -34699,7 +34732,135 @@ Open http://localhost:${port} in your browser`,
34699
34732
  variant: "info",
34700
34733
  duration: 3000
34701
34734
  });
34702
- return () => {};
34735
+ const [sidebarState, setSidebarState] = context.storage.memory("nexus-sidebar-state", {
34736
+ initial: {
34737
+ agents: [],
34738
+ totalCost: 0,
34739
+ budgetRemaining: 10
34740
+ }
34741
+ });
34742
+ const unsubStorage = context.data.on("model.updated", (event) => {});
34743
+ const unsubSidebar = context.ui.slot({
34744
+ append: "sidebar.content",
34745
+ render: (props) => {
34746
+ const family = context.data.session.family(props.sessionID);
34747
+ const sessions = context.data.session.list();
34748
+ const childSessions = family.filter((id) => id !== props.sessionID).map((id) => context.data.session.get(id)).filter(Boolean);
34749
+ if (childSessions.length === 0 && sidebarState.agents.length === 0) {
34750
+ return null;
34751
+ }
34752
+ const agents = sidebarState.agents.length > 0 ? sidebarState.agents : childSessions.map((s) => ({
34753
+ id: s.id,
34754
+ name: s.title || s.id.slice(0, 12),
34755
+ role: "agent",
34756
+ status: "idle",
34757
+ model: "",
34758
+ sessionID: s.id,
34759
+ spawnedAt: new Date().toISOString(),
34760
+ tasksCompleted: 0,
34761
+ tasksFailed: 0
34762
+ }));
34763
+ const activeAgents = agents.filter((a) => a.status === "working" || a.status === "idle");
34764
+ const completedAgents = agents.filter((a) => a.status === "completed");
34765
+ const failedAgents = agents.filter((a) => a.status === "failed");
34766
+ return /* @__PURE__ */ jsxDEV("div", {
34767
+ style: {
34768
+ padding: "8px",
34769
+ borderTop: "1px solid #333",
34770
+ marginTop: "8px"
34771
+ },
34772
+ children: [
34773
+ /* @__PURE__ */ jsxDEV("div", {
34774
+ style: {
34775
+ fontSize: "11px",
34776
+ color: "#888",
34777
+ marginBottom: "4px",
34778
+ display: "flex",
34779
+ justifyContent: "space-between",
34780
+ alignItems: "center"
34781
+ },
34782
+ children: [
34783
+ /* @__PURE__ */ jsxDEV("span", {
34784
+ children: "\uD83E\uDD16 Nexus Agents"
34785
+ }, undefined, false, undefined, this),
34786
+ /* @__PURE__ */ jsxDEV("span", {
34787
+ style: { color: "#666" },
34788
+ children: [
34789
+ activeAgents.length,
34790
+ " active"
34791
+ ]
34792
+ }, undefined, true, undefined, this)
34793
+ ]
34794
+ }, undefined, true, undefined, this),
34795
+ activeAgents.map((agent) => /* @__PURE__ */ jsxDEV("div", {
34796
+ style: {
34797
+ fontSize: "10px",
34798
+ padding: "2px 0",
34799
+ color: agent.status === "working" ? "#4ade80" : "#94a3b8"
34800
+ },
34801
+ children: [
34802
+ /* @__PURE__ */ jsxDEV("span", {
34803
+ children: agent.status === "working" ? "\uD83D\uDD04" : "⏸️"
34804
+ }, undefined, false, undefined, this),
34805
+ " ",
34806
+ agent.name,
34807
+ agent.model && /* @__PURE__ */ jsxDEV("span", {
34808
+ style: { color: "#64748b" },
34809
+ children: [
34810
+ " — ",
34811
+ agent.model.split("/").pop()
34812
+ ]
34813
+ }, undefined, true, undefined, this)
34814
+ ]
34815
+ }, agent.id, true, undefined, this)),
34816
+ completedAgents.length > 0 && /* @__PURE__ */ jsxDEV("div", {
34817
+ style: {
34818
+ marginTop: "4px",
34819
+ paddingTop: "4px",
34820
+ borderTop: "1px solid #222"
34821
+ },
34822
+ children: /* @__PURE__ */ jsxDEV("div", {
34823
+ style: { fontSize: "10px", color: "#666", marginBottom: "2px" },
34824
+ children: [
34825
+ "✅ ",
34826
+ completedAgents.length,
34827
+ " completed"
34828
+ ]
34829
+ }, undefined, true, undefined, this)
34830
+ }, undefined, false, undefined, this),
34831
+ failedAgents.length > 0 && /* @__PURE__ */ jsxDEV("div", {
34832
+ style: { marginTop: "2px" },
34833
+ children: /* @__PURE__ */ jsxDEV("div", {
34834
+ style: { fontSize: "10px", color: "#ef4444", marginBottom: "2px" },
34835
+ children: [
34836
+ "❌ ",
34837
+ failedAgents.length,
34838
+ " failed"
34839
+ ]
34840
+ }, undefined, true, undefined, this)
34841
+ }, undefined, false, undefined, this),
34842
+ sidebarState.totalCost > 0 && /* @__PURE__ */ jsxDEV("div", {
34843
+ style: {
34844
+ marginTop: "4px",
34845
+ fontSize: "10px",
34846
+ color: "#666"
34847
+ },
34848
+ children: [
34849
+ "\uD83D\uDCB0 $",
34850
+ sidebarState.totalCost.toFixed(4),
34851
+ " / $",
34852
+ sidebarState.budgetRemaining.toFixed(2),
34853
+ " remaining"
34854
+ ]
34855
+ }, undefined, true, undefined, this)
34856
+ ]
34857
+ }, undefined, true, undefined, this);
34858
+ }
34859
+ });
34860
+ return () => {
34861
+ unsubStorage();
34862
+ unsubSidebar();
34863
+ };
34703
34864
  }
34704
34865
  });
34705
34866
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serkanalgur/opencode-nexus",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Adaptive Multi-Agent Orchestration with Cost Intelligence for OpenCode V2",
5
5
  "keywords": [
6
6
  "opencode",