feat: 初始化 sundynix-agentix 分层式 AI Agent 平台脚手架

5 层 + 1 条 NATS 零拷贝消息总线的 monorepo(Monolith First → Microservices Morph B)。
纵向主干(任务流 + Token 流回流)已真实跑通,横向各层能力为带注释的桩。

已贯通(real code):
- sundynix-shared: 共享契约 + JetStream/core NATS 真实收发(bus) + 内嵌 NATS(devnats) + e2e 测试
- sundynix-gateway: Gin 接入 + DSL 解析组装 + NATS Publish + SSE 流式输出
- sundynix-dispatcher: NATS 消费 + Eino Orchestrator 流式回流 + 熔断器 + LLM Pool 占位流式
- 链路: HTTP POST → DSL → sundynix.tasks.* → Dispatcher → Token 经 sundynix.streams.<id> 回流 → SSE
- 基础设施: docker-compose(nats/postgres/redis/neo4j/milvus) + Makefile(make demo/e2e)

待填(桩):
- Eino 图编排 compose.NewGraph、LLM Pool 接 vLLM/Ollama
- Gateway store 换真实 pgx/redis
- sundynix-mcp-go: Bleve+Milvus+Neo4j 混合检索 / UniOffice / 外部 API
- sundynix-mcp-py: gVisor 沙箱 / MinerU(PaddleOCR) / Docker 解释器
- sundynix-desktop: React Flow 画布 → DSL 导出 → SSE 展示
This commit is contained in:
Blizzard
2026-06-10 11:00:29 +08:00
commit c7a02c3905
74 changed files with 2570 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package main
import "context"
// App 通过 Wails 的 TS/Go 强绑定暴露给前端,承载本地文件 I/O 等能力。
type App struct {
ctx context.Context
}
func NewApp() *App { return &App{} }
// SubmitDSL 接收 React Flow 导出的 JSON DSL,转发到 Gateway。
func (a *App) SubmitDSL(dsl string) (string, error) {
// TODO: HTTP POST 到 sundynix-gateway /api/v1/tasks
return "task_placeholder", nil
}
// ReadLocalFile 本地文件系统 I/OLocal File System I/O)。
func (a *App) ReadLocalFile(path string) (string, error) {
// TODO: os.ReadFile,受权限白名单约束
return "", nil
}
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>sundynix-agentix</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+26
View File
@@ -0,0 +1,26 @@
{
"name": "sundynix-desktop-frontend",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"@xyflow/react": "^12.3.0"
},
"devDependencies": {
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.0",
"typescript": "^5.6.0",
"vite": "^5.4.0",
"tailwindcss": "^3.4.0",
"autoprefixer": "^10.4.0",
"postcss": "^8.4.0"
}
}
+16
View File
@@ -0,0 +1,16 @@
import { AgentCanvas } from "./canvas/AgentCanvas";
import { WikiPanel } from "./wiki/WikiPanel";
// UI Representation Layer —— 顶层布局:左侧编排画布 + 右侧 Wiki 面板。
export default function App() {
return (
<div className="flex h-screen w-screen">
<main className="flex-1 border-r">
<AgentCanvas />
</main>
<aside className="w-96 overflow-auto">
<WikiPanel />
</aside>
</div>
);
}
@@ -0,0 +1,49 @@
import { useCallback } from "react";
import {
ReactFlow,
Background,
Controls,
addEdge,
useNodesState,
useEdgesState,
type Connection,
} from "@xyflow/react";
import "@xyflow/react/dist/style.css";
import { exportDsl } from "../lib/dsl";
// React Flow Canvas —— Agent 编排,可导出 JSON DSL 提交到 Gateway。
export function AgentCanvas() {
const [nodes, , onNodesChange] = useNodesState([]);
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
const onConnect = useCallback(
(c: Connection) => setEdges((eds) => addEdge(c, eds)),
[setEdges],
);
const onExport = useCallback(() => {
const dsl = exportDsl(nodes, edges); // → JSON DSL export
// TODO: 经 Wails 强绑定调用 App.SubmitDSL(dsl)
console.log(dsl);
}, [nodes, edges]);
return (
<div className="h-full w-full">
<button onClick={onExport} className="absolute z-10 m-2 rounded border px-3 py-1">
DSL
</button>
<ReactFlow
nodes={nodes}
edges={edges}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
fitView
>
<Background />
<Controls />
</ReactFlow>
</div>
);
}
+10
View File
@@ -0,0 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
html,
body,
#root {
height: 100%;
margin: 0;
}
+17
View File
@@ -0,0 +1,17 @@
import type { Edge, Node } from "@xyflow/react";
// Task DSL —— React Flow 画布的可序列化表示,提交给 Gateway 解析组装。
export interface TaskDsl {
version: "1";
nodes: Array<{ id: string; type?: string; data: unknown }>;
edges: Array<{ source: string; target: string }>;
}
// exportDsl 把画布的节点/连线导出为 JSON DSL。
export function exportDsl(nodes: Node[], edges: Edge[]): TaskDsl {
return {
version: "1",
nodes: nodes.map((n) => ({ id: n.id, type: n.type, data: n.data })),
edges: edges.map((e) => ({ source: e.source, target: e.target })),
};
}
+10
View File
@@ -0,0 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./index.css";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
@@ -0,0 +1,13 @@
// LLM Wiki Management Panel —— 管理知识库条目,触发第 5 层混合检索。
export function WikiPanel() {
return (
<div className="p-4">
<h2 className="mb-2 text-lg font-semibold">LLM Wiki</h2>
<input
className="mb-3 w-full rounded border px-2 py-1"
placeholder="搜索 WikiHybrid: Bleve + Qdrant + Neo4j"
/>
{/* TODO: 检索结果列表 / 条目编辑 */}
</div>
);
}
@@ -0,0 +1,6 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ["./index.html", "./src/**/*.{ts,tsx}"],
theme: { extend: {} },
plugins: [],
};
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"baseUrl": ".",
"paths": { "@/*": ["./src/*"] }
},
"include": ["src"]
}
+10
View File
@@ -0,0 +1,10 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "node:path";
export default defineConfig({
plugins: [react()],
resolve: {
alias: { "@": path.resolve(__dirname, "./src") },
},
});
+5
View File
@@ -0,0 +1,5 @@
module github.com/sundynix/sundynix-desktop
go 1.23
require github.com/wailsapp/wails/v2 v2.9.2
+1
View File
@@ -0,0 +1 @@
github.com/wailsapp/wails/v2 v2.9.2/go.mod h1:uehvlCwJSFcBq7rMCGfk4rxca67QQGsbg5Nm4m9UnBs=
+22
View File
@@ -0,0 +1,22 @@
// Command sundynix-desktop —— 第 1 层客户端,Wails 本地 Go 运行时入口。
package main
import (
"embed"
"github.com/wailsapp/wails/v2/pkg/options"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
app := NewApp()
_ = wails.Run(&options.App{
Title: "sundynix-agentix",
Width: 1280,
Height: 800,
// Bind: TS/Go 强绑定 —— 把 App 的方法暴露给前端
Bind: []any{app},
})
}
+12
View File
@@ -0,0 +1,12 @@
{
"$schema": "https://wails.io/schemas/config.v2.json",
"name": "sundynix_desktop",
"outputfilename": "sundynix_desktop",
"frontend:install": "npm install",
"frontend:build": "npm run build",
"frontend:dev:watcher": "npm run dev",
"frontend:dev:serverUrl": "auto",
"author": {
"name": "sundynix"
}
}