皮氏飞行员
将Petri网模型编译到正在运行的应用程序中。
Petri网模型定义了位置(状态)、转换(动作)和弧(连接)。Petri pilot将该模型编译成一个完整的、可部署的应用程序。生成是确定的——相同的模型总是产生相同的代码。
Model ──> Context ──> Templates ──> Running Application模型是真理的源泉。代码是派生工件。
现场演示: 飞行员.pflow.xyz | 书: book.pflow.xyz
它产生了什么
从单个模型文件中,petri pilot生成:
- 转到后端 -事件源聚合、REST API、SQLite存储
- ES模块前端 --管理仪表板、模拟、事件历史
- GraphQL API --内置游乐场的统一查询层
- pflow查看器 --交互式Petri网可视化
没有生成LLM代码。LLM设计模型。模板可编译应用程序。
安装
# From source
go install github.com/pflow-xyz/petri-pilot/cmd/petri-pilot@latest
# Or via Docker
docker run ghcr.io/pflow-xyz/petri-pilot version
# Or download a binary from GitHub Releases
# https://github.com/pflow-xyz/petri-pilot/releases快速开始
# Run the demo server
petri-pilot serve tic-tac-toe coffeeshop knapsack
# Or start the MCP server
petri-pilot mcpMCP服务器
Petri pilot作为MCP服务器运行。LLM可以在不离开对话的情况下进行设计、验证、模拟和生成。
通过Smithery连接
将此提示发送给您的代理:
curl https://smithery.ai/skill.md and connect to stackdump/pflow-pilot using smithery mcp add stackdump/pflow-pilot或直接安装:
npx @smithery/cli install stackdump/pflow-pilot --client claude在本地运行
petri-pilot mcp| 工具 | 目的 |
|---|---|
petri_validate | 结构正确性 |
petri_analyze | 可达性、死锁、活性 |
petri_simulate | 火灾过渡、痕迹状态 |
petri_code_to_flow | 将源代码转换为Petri网模型 |
petri_codegen | 生成Go后端 |
petri_frontend | 生成ES模块前端 |
petri_application | 高级规格的全栈 |
petri_extend | 修改现有模型 |
service_start/stop/logs | 管理正在运行的服务 |
克劳德桌面/光标
添加到MCP配置中:
{
"mcpServers": {
"petri-pilot": {
"command": "petri-pilot",
"args": ["mcp"]
}
}
}或者使用Docker:
{
"mcpServers": {
"petri-pilot": {
"command": "docker",
"args": ["run", "-i", "--rm", "ghcr.io/pflow-xyz/petri-pilot", "mcp"]
}
}
}模型格式
{
"name": "order",
"places": [
{"id": "pending", "initial": 1},
{"id": "shipped"}
],
"transitions": [
{"id": "ship", "event": "order_shipped"}
],
"arcs": [
{"from": "pending", "to": "ship"},
{"from": "ship", "to": "shipped"}
]
}模型可以包括角色、访问规则、类型化事件、视图和导航。看 services/ 例如。
生态系统
Petri飞行员是 pflow 工具链。这三个工具共享相同的JSON-LD模型格式。
在编辑器中设计的网络可以通过库进行分析,并通过petri网进行编译,而无需进行格式转换。
项目结构
cmd/petri-pilot/ CLI and MCP server entry point
pkg/mcp/ MCP server and tools
pkg/codegen/ Go and ES modules templates
pkg/serve/ Multi-model HTTP server
pkg/validator/ Model analysis
services/ Example models (tic-tac-toe, coffeeshop, knapsack, texas-holdem)
frontends/ Custom frontends for demos
generated/ Output from codegen (derived, not source)许可证
麻省理工学院
