WSaiOS™ 项目结构 v1.0
WSaiOS™ 项目结构 v1.0
单节点认知运行时系统
1. Project Root Structure(项目结构)
wsaios/
│
├── core/
│ ├── kernel.py
│ ├── goal_engine.py
│ ├── knowledge_engine.py
│ ├── memory_engine.py
│ ├── workflow_engine.py
│ ├── runtime_engine.py
│ ├── rule_engine.py
│ └── capability_router.py
│
├── runtime/
│ ├── executor.py
│ ├── context.py
│ ├── state.py
│ └── scheduler.py
│
├── models/
│ ├── ws_object.py
│ ├── ws_goal.py
│ ├── ws_workflow.py
│ ├── ws_memory.py
│ └── ws_rule.py
│
├── storage/
│ ├── file_store.py
│ ├── memory_db.py
│ ├── vector_db.py
│ └── indexer.py
│
├── tools/
│ ├── llm_client.py
│ ├── pdf_parser.py
│ ├── text_parser.py
│ └── tool_registry.py
│
├── workflows/
│ ├── templates/
│ ├── compiler.py
│ └── executor_map.json
│
├── api/
│ ├── interface.py
│ └── gateway.py
│
├── config/
│ ├── system_config.json
│ ├── model_config.json
│ └── rule_config.json
│
├── tests/
│ ├── test_goal.py
│ ├── test_workflow.py
│ ├── test_runtime.py
│ └── test_full_flow.py
│
├── main.py
└── README.md
2. System Boot Entry(启动入口)
from core.kernel import WSKernel
def main():
kernel = WSKernel()
while True:
user_input = input("WSaiOS > ")
if user_input == "exit":
break
result = kernel.run(user_input)
print("\nRESULT:\n", result)
if __name__ == "__main__":
main()
3. Kernel Structure(核心内核)
class WSKernel:
def __init__(self):
self.goal_engine = GoalEngine()
self.knowledge_engine = KnowledgeEngine()
self.memory_engine = MemoryEngine()
self.workflow_engine = WorkflowEngine()
self.runtime_engine = RuntimeEngine()
self.rule_engine = RuleEngine()
self.capability_router = CapabilityRouter()
def run(self, input_text):
goal = self.goal_engine.parse(input_text)
context = {
"knowledge": self.knowledge_engine.retrieve(goal),
"memory": self.memory_engine.load(goal)
}
workflow = self.workflow_engine.build(goal, context)
execution_result = self.runtime_engine.execute(workflow, context)
validated = self.rule_engine.validate(execution_result)
self.memory_engine.store(goal, validated)
return validated
4. Workflow Format(工作流标准格式)
{
"workflow_id": "wf_001",
"nodes": [
{
"id": "n1",
"type": "llm",
"task": "understand_goal"
},
{
"id": "n2",
"type": "tool",
"tool": "knowledge_search"
},
{
"id": "n3",
"type": "llm",
"task": "generate_output"
}
],
"edges": [
["n1", "n2"],
["n2", "n3"]
]
}
5. Execution Engine(执行引擎)
class RuntimeEngine:
def execute(self, workflow, context):
results = {}
for node in workflow["nodes"]:
results[node["id"]] = self._execute(node, context, results)
return results
def _execute(self, node, context, state):
if node["type"] == "llm":
return LLM.call(node["task"], context)
if node["type"] == "tool":
return ToolRegistry.run(node["tool"], context)
return None
6. Capability System(能力系统)
class CapabilityRouter:
def run(self, tool_name, context):
if tool_name == "knowledge_search":
return VectorDB.search(context)
if tool_name == "pdf_parser":
return PDFParser.extract(context)
if tool_name == "text_parser":
return TextParser.parse(context)
return None
7. Memory System(记忆系统)
class MemoryEngine:
def load(self, goal):
return MemoryDB.query(goal["intent"])
def store(self, goal, result):
MemoryDB.insert({
"goal": goal,
"result": result
})
8. Knowledge System(知识系统)
class KnowledgeEngine:
def retrieve(self, goal):
docs = FileStore.load(goal["intent"])
return VectorDB.embed(docs)
9. Rule System(规则系统)
class RuleEngine:
def validate(self, result):
if not result:
return {"status": "FAIL"}
if "error" in str(result):
return {"status": "RETRY"}
return {"status": "PASS", "data": result}
10. Minimal Runtime Flow(最小运行闭环)
Input
→ Goal Parsing
→ Knowledge + Memory Retrieval
→ Workflow Generation
→ Node Execution
→ Rule Validation
→ Memory Storage
→ Output
11. System Type Definition(系统定义)
WSaiOS v1.0 是:
一种单节点认知执行系统,可将用户目标转化为结构化工作流程,并通过受控能力路由和基于规则的验证来执行这些工作流程。
中文定义:
WSaiOS v1.0 是一个单机认知执行系统,将用户目标转化为结构化工作流,并通过能力路由与规则引擎完成可控执行。
12. 你现在这个版本的真实状态
不是:
- 产品
- 平台
- AI替代系统
而是:
可运行的认知系统原型(Executable Cognitive Prototype)
应用延伸
A. 真可跑版本(MVP代码完整可执行)
? 能直接跑 PDF → GEO输出
B. JSON Workflow 可视化系统
? 类似“AI流程编辑器”
C. GEO专用引擎版