feat: migrate to TypeScript for WaterFlow framework

- Add TypeScript graph memory module (GraphDatabase, MemoryService)
- Add GraphMemoryTool for WaterFlow Tool interface
- Add bundled-skills for graph_memory, persona, task
- Remove Python code (core/, ui/, tests/, etc.)
- Remove redundant docs and build files
- Keep only ts/, docs/integration/, .gitignore, LICENSE
This commit is contained in:
root
2026-04-15 15:45:12 +08:00
parent 43172e257a
commit 904661d73f
98 changed files with 2584 additions and 9701 deletions

View File

@ -0,0 +1,102 @@
---
name: graph_memory
description: 图记忆工具 - 让 AI 拥有真正的长期记忆能力
when_to_use: 需要 AI 记住或回忆信息时
context: inline
allowed_tools:
- builtin:graph_memory
arguments:
- name: action
type: string
required: true
enum: [recall, commit, purge, introspect]
description: 记忆操作类型
- name: params
type: object
required: true
description: 操作参数
user_invocable: true
---
# GraphMemory 图记忆操作
你可以通过以下操作与图记忆系统交互。
## 核心操作
### 1. recall - 检索记忆
从记忆图中检索相关信息。
**参数**:
- `queryIntent`: 搜索意图/关键词
- `seedEntities`: 可选的种子实体名
- `depth`: 检索深度
- `sessionFilter`: 可选的会话ID过滤
**示例**:
```
action: recall
params:
queryIntent: "用户 喜欢 编程"
seedEntities: ["用户"]
```
### 2. commit - 写入记忆
将信息写入记忆图。
**参数**:
- `triplets`: 三元组数组,每个包含 subject, relation, object
- `sessionId`: 会话ID
- `turnId`: 轮次ID
**示例**:
```
action: commit
params:
triplets:
- subject: "用户"
relation: "喜欢"
object: "Python"
- subject: "用户"
relation: "正在学习"
object: "TypeScript"
```
### 3. purge - 删除记忆
从记忆图中删除信息。
**参数**:
- `criteria`: 删除条件 (subject, target, relation, sessionId)
- `mode`: 删除模式 (soft/hard/supersede)
- `newRelation`: 可选的替代关系
**示例**:
```
action: purge
params:
criteria:
subject: "旧信息"
mode: "soft"
```
### 4. introspect - 查看状态
查看当前记忆状态统计。
**参数**: 无
**示例**:
```
action: introspect
params: {}
```
## 使用原则
1. **选择性记忆**: 只记住重要和持久的信息
2. **结构化**: 使用三元组 (主体-关系-客体) 格式
3. **关联**: 通过关系连接相关实体
4. **定期清理**: 删除过时或错误的信息

View File

@ -0,0 +1,66 @@
---
name: graph_memory_persona
description: 管理 AI 人设 - 更新或清除 AI 角色特征
when_to_use: 需要修改 AI 的角色设定或清除人设时
context: inline
allowed_tools:
- builtin:graph_memory
arguments:
- name: action
type: string
required: true
enum: [persona_update, persona_clear]
description: 操作类型
- name: attributes
type: array
description: 属性数组 (用于 update)
- name: mode
type: string
enum: [merge, replace]
default: merge
description: 更新模式
- name: confirm
type: boolean
description: 确认清除 (用于 clear)
user_invocable: true
---
# GraphMemory Persona 人设管理
管理 AI 的人设/角色特征。
## 操作
### 1. persona_update - 更新人设
更新 AI 的角色特征。
**参数**:
- `attributes`: 属性数组,每个包含 attribute 和 value
- `mode`: 更新模式
- `merge`: 合并到现有属性
- `replace`: 替换所有现有属性
**示例**:
```
action: persona_update
attributes:
- attribute: "角色"
value: "猫娘"
- attribute: "性格"
value: "活泼"
mode: "merge"
```
### 2. persona_clear - 清除人设
清除 AI 的所有角色特征。
**参数**:
- `confirm`: 确认为 true 才能执行清除
**示例**:
```
action: persona_clear
confirm: true
```

View File

@ -0,0 +1,98 @@
---
name: graph_memory_task
description: 管理连续性任务 - 创建、更新、删除任务节点
when_to_use: 需要创建或管理长期任务时
context: inline
allowed_tools:
- builtin:graph_memory
arguments:
- name: action
type: string
required: true
enum: [task_create, task_set_state, task_delete, task_link_info]
description: 操作类型
- name: task_id
type: string
required: true
description: 任务ID
- name: description
type: string
description: 任务描述 (用于 create)
- name: state
type: string
enum: [进行中, 已完成, 已暂停, 已取消]
description: 任务状态 (用于 set_state)
- name: info_nodes
type: array
description: 信息节点数组 (用于 create)
- name: info_node
type: string
description: 信息节点 (用于 link_info)
user_invocable: true
---
# GraphMemory Task 任务管理
管理长期/连续性任务。
## 操作
### 1. task_create - 创建任务
创建新的任务节点。
**参数**:
- `task_id`: 唯一任务标识
- `description`: 任务描述
- `info_nodes`: 可选的相关信息节点
**示例**:
```
action: task_create
task_id: "Task_学习TypeScript"
description: "学习 TypeScript 并完成项目"
info_nodes: ["TypeScript文档", "教程链接"]
```
### 2. task_set_state - 设置状态
更新任务状态。
**参数**:
- `task_id`: 任务ID
- `state`: 新状态 (进行中/已完成/已暂停/已取消)
**示例**:
```
action: task_set_state
task_id: "Task_学习TypeScript"
state: "已完成"
```
### 3. task_delete - 删除任务
删除任务节点。
**参数**:
- `task_id`: 任务ID
**示例**:
```
action: task_delete
task_id: "Task_学习TypeScript"
```
### 4. task_link_info - 关联信息
将信息节点关联到任务。
**参数**:
- `task_id`: 任务ID
- `info_node`: 信息节点
**示例**:
```
action: task_link_info
task_id: "Task_学习TypeScript"
info_node: "新教程链接"
```