@geminilight/mindos 0.6.8 → 0.6.13
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 +2 -0
- package/README_zh.md +2 -0
- package/app/app/api/mcp/install/route.ts +4 -1
- package/app/app/api/setup/check-path/route.ts +2 -7
- package/app/app/api/setup/ls/route.ts +3 -9
- package/app/app/api/setup/path-utils.ts +8 -0
- package/app/app/api/setup/route.ts +2 -7
- package/app/app/api/uninstall/route.ts +47 -0
- package/app/app/globals.css +11 -0
- package/app/components/ActivityBar.tsx +10 -3
- package/app/components/AskFab.tsx +7 -3
- package/app/components/CreateSpaceModal.tsx +1 -1
- package/app/components/DirView.tsx +1 -1
- package/app/components/FileTree.tsx +30 -23
- package/app/components/GuideCard.tsx +1 -1
- package/app/components/HomeContent.tsx +137 -109
- package/app/components/ImportModal.tsx +16 -477
- package/app/components/MarkdownView.tsx +3 -0
- package/app/components/OnboardingView.tsx +1 -1
- package/app/components/OrganizeToast.tsx +386 -0
- package/app/components/Panel.tsx +23 -2
- package/app/components/Sidebar.tsx +1 -1
- package/app/components/SidebarLayout.tsx +44 -1
- package/app/components/agents/AgentDetailContent.tsx +33 -12
- package/app/components/agents/AgentsMcpSection.tsx +1 -1
- package/app/components/agents/AgentsOverviewSection.tsx +3 -4
- package/app/components/agents/AgentsPrimitives.tsx +2 -2
- package/app/components/agents/AgentsSkillsSection.tsx +2 -2
- package/app/components/agents/SkillDetailPopover.tsx +24 -8
- package/app/components/ask/AskContent.tsx +124 -75
- package/app/components/ask/HighlightMatch.tsx +14 -0
- package/app/components/ask/MentionPopover.tsx +5 -3
- package/app/components/ask/MessageList.tsx +39 -11
- package/app/components/ask/SlashCommandPopover.tsx +4 -2
- package/app/components/changes/ChangesBanner.tsx +20 -2
- package/app/components/changes/ChangesContentPage.tsx +10 -2
- package/app/components/echo/EchoHero.tsx +1 -1
- package/app/components/echo/EchoInsightCollapsible.tsx +1 -1
- package/app/components/echo/EchoPageSections.tsx +1 -1
- package/app/components/explore/UseCaseCard.tsx +1 -1
- package/app/components/panels/DiscoverPanel.tsx +29 -25
- package/app/components/panels/ImportHistoryPanel.tsx +195 -0
- package/app/components/panels/PluginsPanel.tsx +2 -2
- package/app/components/settings/AiTab.tsx +24 -0
- package/app/components/settings/KnowledgeTab.tsx +1 -1
- package/app/components/settings/McpSkillCreateForm.tsx +1 -1
- package/app/components/settings/McpSkillRow.tsx +1 -1
- package/app/components/settings/McpSkillsSection.tsx +2 -2
- package/app/components/settings/McpTab.tsx +2 -2
- package/app/components/settings/PluginsTab.tsx +1 -1
- package/app/components/settings/Primitives.tsx +118 -6
- package/app/components/settings/SettingsContent.tsx +5 -2
- package/app/components/settings/UninstallTab.tsx +179 -0
- package/app/components/settings/UpdateTab.tsx +17 -5
- package/app/components/settings/types.ts +2 -1
- package/app/components/setup/StepDots.tsx +2 -2
- package/app/components/ui/dialog.tsx +1 -1
- package/app/hooks/useAiOrganize.ts +122 -10
- package/app/hooks/useMention.ts +21 -3
- package/app/hooks/useSlashCommand.ts +18 -4
- package/app/lib/agent/reconnect.ts +40 -0
- package/app/lib/core/backlinks.ts +2 -2
- package/app/lib/core/git.ts +14 -10
- package/app/lib/fs.ts +2 -1
- package/app/lib/i18n-en.ts +46 -2
- package/app/lib/i18n-zh.ts +46 -2
- package/app/lib/organize-history.ts +74 -0
- package/app/lib/settings.ts +2 -0
- package/app/lib/types.ts +2 -0
- package/app/next.config.ts +23 -5
- package/bin/cli.js +6 -9
- package/bin/lib/mcp-build.js +74 -0
- package/bin/lib/mcp-spawn.js +8 -5
- package/bin/lib/port.js +17 -2
- package/bin/lib/stop.js +12 -2
- package/mcp/dist/index.cjs +43 -43
- package/mcp/src/index.ts +58 -12
- package/package.json +1 -1
- 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
|
-
// ───
|
|
95
|
+
// ─── Tool Registration ───────────────────────────────────────────────────────
|
|
96
96
|
|
|
97
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
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 (
|
|
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:
|
|
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'));
|