@geminilight/mindos 0.6.8 → 0.6.12

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 (78) hide show
  1. package/README.md +2 -0
  2. package/README_zh.md +2 -0
  3. package/app/app/api/mcp/install/route.ts +4 -1
  4. package/app/app/api/setup/check-path/route.ts +2 -7
  5. package/app/app/api/setup/ls/route.ts +3 -9
  6. package/app/app/api/setup/path-utils.ts +8 -0
  7. package/app/app/api/setup/route.ts +2 -7
  8. package/app/app/api/uninstall/route.ts +47 -0
  9. package/app/app/globals.css +11 -0
  10. package/app/components/ActivityBar.tsx +10 -3
  11. package/app/components/AskFab.tsx +7 -3
  12. package/app/components/CreateSpaceModal.tsx +1 -1
  13. package/app/components/DirView.tsx +1 -1
  14. package/app/components/FileTree.tsx +30 -23
  15. package/app/components/GuideCard.tsx +1 -1
  16. package/app/components/HomeContent.tsx +137 -109
  17. package/app/components/ImportModal.tsx +16 -477
  18. package/app/components/MarkdownView.tsx +3 -0
  19. package/app/components/OnboardingView.tsx +1 -1
  20. package/app/components/OrganizeToast.tsx +386 -0
  21. package/app/components/Panel.tsx +23 -2
  22. package/app/components/Sidebar.tsx +1 -1
  23. package/app/components/SidebarLayout.tsx +44 -1
  24. package/app/components/agents/AgentDetailContent.tsx +33 -12
  25. package/app/components/agents/AgentsMcpSection.tsx +1 -1
  26. package/app/components/agents/AgentsOverviewSection.tsx +3 -4
  27. package/app/components/agents/AgentsPrimitives.tsx +2 -2
  28. package/app/components/agents/AgentsSkillsSection.tsx +2 -2
  29. package/app/components/agents/SkillDetailPopover.tsx +24 -8
  30. package/app/components/ask/AskContent.tsx +124 -75
  31. package/app/components/ask/HighlightMatch.tsx +14 -0
  32. package/app/components/ask/MentionPopover.tsx +5 -3
  33. package/app/components/ask/MessageList.tsx +39 -11
  34. package/app/components/ask/SlashCommandPopover.tsx +4 -2
  35. package/app/components/changes/ChangesBanner.tsx +20 -2
  36. package/app/components/changes/ChangesContentPage.tsx +10 -2
  37. package/app/components/echo/EchoHero.tsx +1 -1
  38. package/app/components/echo/EchoInsightCollapsible.tsx +1 -1
  39. package/app/components/echo/EchoPageSections.tsx +1 -1
  40. package/app/components/explore/UseCaseCard.tsx +1 -1
  41. package/app/components/panels/DiscoverPanel.tsx +29 -25
  42. package/app/components/panels/ImportHistoryPanel.tsx +195 -0
  43. package/app/components/panels/PluginsPanel.tsx +2 -2
  44. package/app/components/settings/AiTab.tsx +24 -0
  45. package/app/components/settings/KnowledgeTab.tsx +1 -1
  46. package/app/components/settings/McpSkillCreateForm.tsx +1 -1
  47. package/app/components/settings/McpSkillRow.tsx +1 -1
  48. package/app/components/settings/McpSkillsSection.tsx +2 -2
  49. package/app/components/settings/McpTab.tsx +2 -2
  50. package/app/components/settings/PluginsTab.tsx +1 -1
  51. package/app/components/settings/Primitives.tsx +118 -6
  52. package/app/components/settings/SettingsContent.tsx +5 -2
  53. package/app/components/settings/UninstallTab.tsx +179 -0
  54. package/app/components/settings/UpdateTab.tsx +17 -5
  55. package/app/components/settings/types.ts +2 -1
  56. package/app/components/ui/dialog.tsx +1 -1
  57. package/app/hooks/useAiOrganize.ts +122 -10
  58. package/app/hooks/useMention.ts +21 -3
  59. package/app/hooks/useSlashCommand.ts +18 -4
  60. package/app/lib/agent/reconnect.ts +40 -0
  61. package/app/lib/core/backlinks.ts +2 -2
  62. package/app/lib/core/git.ts +14 -10
  63. package/app/lib/fs.ts +2 -1
  64. package/app/lib/i18n-en.ts +46 -2
  65. package/app/lib/i18n-zh.ts +46 -2
  66. package/app/lib/organize-history.ts +74 -0
  67. package/app/lib/settings.ts +2 -0
  68. package/app/lib/types.ts +2 -0
  69. package/app/next.config.ts +23 -5
  70. package/bin/cli.js +6 -9
  71. package/bin/lib/mcp-build.js +74 -0
  72. package/bin/lib/mcp-spawn.js +8 -5
  73. package/bin/lib/port.js +17 -2
  74. package/bin/lib/stop.js +12 -2
  75. package/mcp/dist/index.cjs +43 -43
  76. package/mcp/src/index.ts +58 -12
  77. package/package.json +1 -1
  78. package/scripts/setup.js +2 -2
package/mcp/src/index.ts CHANGED
@@ -92,9 +92,9 @@ async function logOp(tool: string, params: Record<string, unknown>, result: 'ok'
92
92
  }
93
93
  }
94
94
 
95
- // ─── MCP Server ──────────────────────────────────────────────────────────────
95
+ // ─── Tool Registration ───────────────────────────────────────────────────────
96
96
 
97
- const server = new McpServer({ name: "mindos-mcp-server", version: "1.0.0" });
97
+ function registerTools(server: McpServer) {
98
98
 
99
99
  // ── mindos_list_files ───────────────────────────────────────────────────────
100
100
 
@@ -582,23 +582,29 @@ server.registerTool("mindos_get_file_at_version", {
582
582
  } catch (e) { return error(String(e)); }
583
583
  });
584
584
 
585
+ } // end registerTools
586
+
587
+ // ─── Server Factory ──────────────────────────────────────────────────────────
588
+
589
+ function createMcpServer(): McpServer {
590
+ const server = new McpServer({ name: "mindos-mcp-server", version: "1.0.0" });
591
+ registerTools(server);
592
+ return server;
593
+ }
594
+
585
595
  // ─── Start ───────────────────────────────────────────────────────────────────
586
596
 
587
597
  async function main() {
588
598
  if (MCP_TRANSPORT === "http") {
589
- // ── Streamable HTTP mode ──────────────────────────────────────────────
590
- const transport = new StreamableHTTPServerTransport({
591
- sessionIdGenerator: () => randomUUID(),
592
- });
599
+ // ── Streamable HTTP mode (per-session transport) ─────────────────────
600
+ const sessions = new Map<string, { transport: StreamableHTTPServerTransport; server: McpServer }>();
593
601
 
594
602
  const expressApp = createMcpExpressApp({ host: MCP_HOST });
595
603
 
596
- // Health endpoint — allows check-port to detect this is a MindOS MCP instance
597
604
  expressApp.get("/api/health", (_req, res) => {
598
605
  res.json({ ok: true, service: "mindos" });
599
606
  });
600
607
 
601
- // Auth middleware
602
608
  if (AUTH_TOKEN) {
603
609
  expressApp.use(MCP_ENDPOINT, (req, res, next) => {
604
610
  const bearer = req.headers.authorization?.replace("Bearer ", "");
@@ -611,11 +617,40 @@ async function main() {
611
617
  }
612
618
 
613
619
  expressApp.all(MCP_ENDPOINT, async (req, res) => {
614
- // Pass pre-parsed body: express.json() already parsed it, SDK >= 1.7 expects it as 3rd arg
620
+ const sessionId = req.headers["mcp-session-id"] as string | undefined;
621
+
622
+ if (sessionId && sessions.has(sessionId)) {
623
+ const session = sessions.get(sessionId)!;
624
+ await session.transport.handleRequest(req, res, req.body);
625
+ return;
626
+ }
627
+
628
+ if (sessionId && !sessions.has(sessionId)) {
629
+ res.status(404).json({ jsonrpc: "2.0", error: { code: -32000, message: "Session not found" } });
630
+ return;
631
+ }
632
+
633
+ // New session: create dedicated transport + server
634
+ const transport = new StreamableHTTPServerTransport({
635
+ sessionIdGenerator: () => randomUUID(),
636
+ });
637
+ const server = createMcpServer();
638
+
639
+ transport.onclose = () => {
640
+ const sid = transport.sessionId;
641
+ if (sid) sessions.delete(sid);
642
+ console.error(`[MCP] Session ${sid?.slice(0, 8)} closed (${sessions.size} active)`);
643
+ };
644
+
645
+ await server.connect(transport);
615
646
  await transport.handleRequest(req, res, req.body);
616
- });
617
647
 
618
- await server.connect(transport);
648
+ const sid = transport.sessionId;
649
+ if (sid) {
650
+ sessions.set(sid, { transport, server });
651
+ console.error(`[MCP] New session ${sid.slice(0, 8)} (${sessions.size} active)`);
652
+ }
653
+ });
619
654
 
620
655
  const httpServer = createServer(expressApp as Parameters<typeof createServer>[1]);
621
656
  httpServer.listen(MCP_PORT, MCP_HOST, () => {
@@ -623,8 +658,19 @@ async function main() {
623
658
  console.error(`MindOS MCP server (HTTP) listening on http://${displayHost}:${MCP_PORT}${MCP_ENDPOINT}`);
624
659
  console.error(`API backend: ${BASE_URL}`);
625
660
  });
661
+
662
+ if (!process.stdin.isTTY) {
663
+ process.stdin.resume();
664
+ process.stdin.on('end', () => {
665
+ console.error('[MindOS MCP] Parent process exited (stdin closed), shutting down');
666
+ httpServer.close();
667
+ setTimeout(() => process.exit(0), 1000);
668
+ });
669
+ process.stdin.on('error', () => {});
670
+ }
626
671
  } else {
627
- // ── stdio mode (default) ──────────────────────────────────────────────
672
+ // ── stdio mode ───────────────────────────────────────────────────────
673
+ const server = createMcpServer();
628
674
  const transport = new StdioServerTransport();
629
675
  await server.connect(transport);
630
676
  console.error(`MindOS MCP server started (stdio, API: ${BASE_URL})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geminilight/mindos",
3
- "version": "0.6.8",
3
+ "version": "0.6.12",
4
4
  "description": "MindOS — Human-Agent Collaborative Mind System. Local-first knowledge base that syncs your mind to all AI Agents via MCP.",
5
5
  "keywords": [
6
6
  "mindos",
package/scripts/setup.js CHANGED
@@ -906,9 +906,9 @@ async function startGuiSetup() {
906
906
  write(c.dim(' First run: installing dependencies and building app (may take a few minutes)...\n'));
907
907
  }
908
908
 
909
- // Wait for the server to be ready (120s timeout)
909
+ // Wait for the server to be ready (10min timeout — first run involves npm install + build)
910
910
  const { waitForHttp } = await import('../bin/lib/gateway.js');
911
- const ready = await waitForHttp(usePort, { retries: 180, intervalMs: 1000, label: 'MindOS', logFile: LOG_PATH });
911
+ const ready = await waitForHttp(usePort, { retries: 600, intervalMs: 1000, label: 'MindOS', logFile: LOG_PATH });
912
912
 
913
913
  if (!ready) {
914
914
  write(c.red('\n✘ Server failed to start.\n'));