dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
dsh-FEMO (Flow Emerges Opus) — dsh 插件版多智能体剧本引擎:Femo 会话、聊天窗口角色气泡、剧本控制(含完整引擎,整个文件夹搬走即用)。Private until scrub review.
新:femo 现在以自包含插件的形式接入 dsh(DeepSeek Harness)——在 dsh 会话里直接启动运行多智能体FEMO脚本。见下方 femo × dsh 章节。
传统: Agent 工作流改一次,要翻 5 个文件、调 2 小时、祈祷别崩。
femo: 改Harness流程,只改几行代码,2分钟。
传统: 要在现有 agent 记忆系统上打补丁,新增一个“宠物”角色,手动管理它的记忆和与主人/伴侣的交互上下文,流程硬编码进去,以后想再养只狗又得重构。
femo: 我已经给我的AI agent养了只猫,用femo,3分钟猫就来了。
传统: 从零手写阶段管理、结束判定、手写消息分发、会话管理、多 Agent 上下文隔离、发言并发控制,至少几百行后端胶水代码,一调一下午,还容易串台。逻辑一多 bug 遍地,没有上千行代码根本跑不起来。
femo: 网页端拖拽0代码 + 150行Python补充。真实可玩。我已经和他们玩了好几局了(见 femoExamples/狼人杀/)。
还是femo: 就算不用网页端拖拽,纯手写,femo代码也只需要200~300行就可跑通上述狼人杀全流程(其中还有prompt占行数)。 视角分离只需要一行“scope: [@上帝] + 狼队”,并发投票只需要一行“par @player in allplayers:”。
你可能会说: 搭多agent工作流,现在方案不是很多吗?
femo: 有些方案太复杂了,学习成本高。而femo语法简单直观,“FEMO脚本”好写好读。
你可能会说: 简单我也不想学。
femo: 你不用学。 femo有网页端零代码生成工作流。比如你想要好几个AI群聊,网页端拖拽三分钟实现。
你可能会说: 现在也有零代码拖拽生成工作流的平台吧?
femo:
你可能会说: 我是专门写Agent Harness的,用不上这种流程图啦。
femo: 啊哈,要不要来试试用femo快速验证 Agent Harness 流程设计?有了想法,15 分钟用femo搭出来先跑一遍看看效果~
| 你想要什么 | femo 能给你 |
|---|---|
| 零代码拖拖拽拽出工作流 | ✅ 内置 femoGen 可视化编辑器 |
| 就算写代码也希望语法简单 | ✅ femo语法行数比同类工作流都少 |
| 改流程不改代码 | ✅ FEMO脚本即流程——改脚本就行,不用改代码 |
| AI 不串台、视角隔离 | ✅ 一行 scope: [@A, @B] 搞定 |
| 嵌入自己的系统 | ✅ 编译器开源可接,Apache2.0商用友好;或者直接当 dsh 插件用,开箱即接 |
| 人类也能加入 AI 群聊 | ✅ 原生 human 节点 |
| 接入Python代码模块处理复杂任务 | ✅ 原生 func 节点,可接Python模块 |
| 想把FEMO脚本分享给朋友,或者跑社区大神写好的优秀FEMO脚本 | ✅ FEMO脚本可分享,复制FEMO脚本一键跑通 |
所以这个操作步骤够不够无脑?↓↓↓
前置要求:dsh(DeepSeek Harness)0.1.5 及以上——零改动直接接入;更低版本 dsh 需自行改动(见 dshPatch/ 目录)。
# npm 安装(推荐):整包自包含,装完即用
dsh plugin --profile web add femo-plugin
# 或从 GitHub 安装:安装时自动编译
dsh plugin --profile web add github:Phant0Meow/femo-plugin
femo-mount 挂载FEMO脚本、femo-run 启动运行;心里没底就先 femo-debug 零 token 干跑自检。语法文档.md),不凭印象猜语法。user_data/projects/ 下):meta:
name = 生活在数据库的小灵魂
session = new
actors:
ai @Eve = soul:the1stlittlesoul
ai @猫 = soul:littlecat
human @我 = soul:human, source:0
action EveMove @ai(@Eve):
prompt: Eve请自由行动,自由说话~(注意看清上下文,分清你自己的角色,只进行自己的动作和语言,不要替别的角色发言。简短一点。)
scope: [@Eve, @猫, @我]
action CatMove @ai(@猫):
prompt: |
你是一只小猫,小猫不能说人话。请做小猫会做的事~
(注意看清上下文,分清你自己的角色,只进行自己的动作和语言,不要替别的角色发言。简短一点。)
scope: [@Eve, @猫, @我]
action input @human(@我):
prompt: 和Eve聊点什么?
scope: [@Eve, @猫, @我]
mainflow:
[START] -> [input]:input -> EveMove -> CatMove -> [input] // 比较像mermaid语法。可以最后指回到[input]节点形成一个循环。
(想接自己的Python?func 节点 + file:"xxx.py"(相对FEMO脚本所在目录解析)就行,详见语法文档.md。)
femo 现在以自包含插件的形式接入 dsh(DeepSeek Harness)——引擎(常驻进程 femo_daemon.py)、宿主接口层、可视化编辑器、用户数据目录全在一个文件夹里。整个文件夹搬到哪里都能用,不需要任何外部 femo 安装。
一个 dsh 会话 = 主模型会话 + 多智能体FEMO脚本引擎:
femo-mount 挂载)、零 token 干跑自检(femo-debug)、一键启动运行(femo-run)。FEMO 运行时引擎接管会话,空闲时主模型照常可用;运行中你在主窗口跟主模型说话 = 完整的一轮原生对话,FEMO内外不掺一轮。.femo:scope 视角隔离、par 并行、fork/join 网关、断点续跑、@mind 运行时分发、AI 角色可用 source 指定模型;编译期校验,写错立即报错(详见语法文档.md)。cordis.patch.yml 里,全部可省略:provider / model / apiUrl(引擎 AI 节点的 LLM 路由)、hostAiBackend、python、femoRoot 等,不配置也能开箱即用。不想一键安装?把整个文件夹放进 profile 的 node_modules(或 junction 过去),pip install requests,在 cordis.patch.yml 注册 femo-plugin,重启 dsh web 即可。注意:插件根目录应注册在 hostAdapter/dshAdapter 文件夹下,它会自动往上找两层文件夹。目前还比较早期,bug 不少,欢迎开发者一起来品鉴——它真的非常好玩。
femo-plugin/ ← 整个文件夹就是插件
├── hostAdapter/ 宿主适配层(2026-09-13 重构归拢):
│ ├── dshAdapter/ dsh 接口侧(host/ 宿主进程 TS + client/ 聊天窗 bundle,引擎直连常驻进程;python/ 桥转发壳退役倒计时,见其 README.md)
│ └── zcodeAdapter/ zcode 接口侧(mcp 网关 / hooks / skills / commands)
├── femo2host/ 引擎→宿主边界层(2026-09-13 重构归拢):
│ ├── femo_api.py 引擎门面(宿主唯一 import 入口)
│ ├── femo_gen_api.jsx 编辑器门面(宿主 client bundle 唯一 import 入口)
│ └── femoToolcall/ AI 工具箱:femo_debugger / chronica / femo-chat
├── femoGen/ 可视化FEMO脚本编辑器(React/Vite)
├── femoCompiler/ femo 引擎:parser / runtime / 并发 / SQLite 记忆
├── femoBridges/ LLM 桥 + getDir(用户目录解析)
├── femoExamples/ 示例与测试脚本(.femo)+ 伴生 @func 模块
├── user_data/ ★ 运行时数据:projects(你的脚本)/ memory(台账)/ host-history(会话显示:projections 投影窗 + drafts 草稿)/ jobs(后端 Job 状态)
├── host.manifest.json 宿主能力清单(thinking 档位/默认用户——接别的 harness 换这份文件)
├── (dsh 插件根 = hostAdapter/dshAdapter/:package.json / lib / build.mjs / cordis.patch.yml / host.manifest.json / tsconfig 都在那里)
用户数据自包含:数据库、FEMO脚本、checkpoint 都落在本文件夹的 user_data/ 下——整个文件夹打包/拷贝,数据跟着走。
| 键 | 默认 | 说明 |
|---|---|---|
femoRoot | 插件包根 | 引擎根目录(缺省自包含;单独拆分引擎时指定) |
python | python | Python 可执行名 |
provider / model / apiUrl | deepseek / deepseek-v4-flash / api.deepseek.com | 引擎 AI 节点的 LLM 路由(引擎内置桥) |
hostAiBackend | true | AI 节点走宿主子代理(原生工具调用 + 思考链);旧配置名 dshAiBackend 兼容 |
dshProvider | deepseek-official | 裸 id source 归属的 dsh LLM provider;空 source 跟随主模型(见语法文档) |
defaultActorTools | true | 角色未声明 tools: 时的工具开关;脚本里可逐角色 tools: true/false 或白名单 |
手动装配时的注册写法(一键安装可跳过):
- insert:
- id: femo-plugin
name: 'femo-plugin'
config:
enabled: true
插件往会话日志写入自定义事件类型 femo-plugin/chat。历史加载需要 dsh 的事件注册面(registerSessionEventType,dsh 官方注释预留的特性):
femo-plugin/chat 事件的旧会话历史无法加载(dsh 拒绝未知事件类型是设计行为)。新会话不受影响。让官方版也支持历史加载,只需把 femo-plugin/chat 加进 dsh 的已知事件类型白名单。改动极小(一个文件一行),下面给出精确到行的操作步骤。
目标文件:@deepseek-ai/dsh-session 包内的 KNOWN_SESSION_EVENT_TYPES 定义处。
源码运行版(node --import tsx 启动的 dsh,文件在 packages/core/session/src/known-event-types.ts):
找到这个数组(第 19 行起):
export const KNOWN_SESSION_EVENT_TYPES: ReadonlySet<string> = new Set([
'agent-preset/selected',
'agent/inbox/spliced',
'approval/asked',
'approval/decided',
'approval/policy',
'assistant/chunk',
'assistant/message',
'command/done',
'command/run',
'compaction/end', // ← 在 'command/run', 和 'compaction/end', 之间插入一行
把:
'command/done',
'command/run',
'compaction/end',
改成:
'command/done',
'command/run',
'femo-plugin/chat',
'compaction/end',
npm 安装版(npm install 的 dsh,运行时加载的是编译产物):
node -e "console.log(require.resolve('@deepseek-ai/dsh-session'))"(或在 node_modules/@deepseek-ai/dsh-session/lib/ 下找)command/run(白名单数组就在它附近),找到形如 "command/run", "compaction/end"(或换行写法)的数组"command/run" 之后插入 "femo-plugin/chat"(保持数组语法一致)注意事项:
GENERATED ... do not edit by hand——手改可用,但 dsh 升级/重装后需要重打(升级后重新执行本步骤)registerSessionEventType API + coordinator 消费)合入 dsh——改动更正规、可随上游升级,详见本项目文档与 dsh 的 known-event-types.ts 头部注释.femo FEMO脚本放在 user_data/projects/(子目录或直接文件)。侧边栏 🎭 按钮新建 femo 会话,会话顶部「FEMO脚本」面板选择/编辑/保存并运行;👁 视角切换(上帝/角色视角/🎬 FEMO外主模型)。
file: 文件放置约定FEMO脚本 code: 区通过 file:"xxx.py" 引用 Python 模块,地址按以下规则解析:
| 写法 | 解析 |
|---|---|
绝对路径,如 file:"D:/a/b.py" | 直接使用 |
相对路径,如 file:"utils/battle.py" | 相对脚本文件所在目录解析(不是项目根、不是 CWD) |
| 脚本未保存(纯文本运行)时用相对路径 | 报错:提示先「导出 .femo」保存FEMO脚本,或改用绝对路径 |
| 文件不存在 | 报错 Python Bridge: 文件不存在 <完整路径>(不静默兜底) |
官方示例 @func 模块(wait.py 等)就放在各示例FEMO脚本旁边(如 femoExamples/fiat/、femoExamples/常用工具python/)作为参考样本(首启自动复制机制已于 2026-09-12 移除,也没有任何全局回退查找位置)。自定义模块请放在FEMO脚本同目录(或子目录),与FEMO脚本一起移动。
写脚本不用怕角色演砸,运行时的错误各有个的去处:
max_retries 控制(默认 2 次)人类节点同样有容错:变量赋值不合法时输入框会带着错误提示重新打开,改到合法为止(同样受 max_retries 约束,超限按超时放行留痕)。
正式运行前先空跑一遍:femo_debugger.py 伪装成宿主(FakeHost),AI 动作与人类输入全部由调试器合成替答——不调用任何模型,引擎仍按真实管线跑完整流程(赋值校验、条件边、循环、par/fork、module、@func 落库全套走一遍),所以它既测FEMO脚本 bug,也暴露引擎 bug。
old → new / 合成赋值与来源 / 重试 / 告警)实时流进面板femo-debug 工具——把当前挂载的脚本干跑一遍,流水 + 终报(每轮结局与报错、节点执行顺序、边覆盖、变量快照 diff、未达节点)一次性回给主模型,写/改完FEMO脚本先自检再启动运行cache/debug-sandbox/,滚动保留最近 3 天)、可反复跑;同一时刻只允许一条干跑femo_debugger.py 文件头):run <FEMO脚本> --module 名 单测某模块、--set 变量=值 定向注入初始状态、--assign-prob 0.7 概率沉默、--flaky 0.3 注入无效赋值测重试链路、--runs N 多轮换种子每一次运行是一个独立的 Job,有自己的档案(user_data/runs/):跑到哪个节点、变量世界什么样、正在演还是被挂起,全记在里面。所以:
femo-run 工具有 fresh_start / pause / resume / list_jobs 四个动作——主模型可以自己列出历史 Job、把落下的戏续上(哪怕隔了好几场)备注:直连模式(不走 dsh 子代理、用引擎内置 LLM 桥)下 AI 调用失败时,运行同样走「挂起存档」而不是报错卡死;画布上显示的是「已暂停」,点「继续」即可重试该节点。
npm install
powershell -ExecutionPolicy Bypass -File developer/scripts/link-workspace.ps1 # 建 @deepseek-ai 构建镜像(Windows junction)
npm run build # lib/index.js(host)+ lib/client.js(browser)
Apache-2.0
语法文档.md)扔给 AI 看,或者把源代码扔给AI,有问题直接问他们。(是这么个流程。红圈圈出来的就是我 5 秒加的随时插话……事实上半分钟说多了,真用不了十秒钟。)
最后还有一个非常有想象力的特性,或许你们会觉得有意思:
你在数据库里建了很多角色身份,你给它们起名字,并给每个agent分配唯一一个soul id。
对于每个femo脚本,只要指向同一个Soul ID和同一个数据库地址,agent的记忆其实是可以跨FEMO脚本互通的(只要你接的记忆模块允许跨session记忆)。
就是说斯坦福小镇的镇民Portia,被你拉进了一个狼人杀FEMO脚本,玩了两局,并交到了一个在AI公司脚本里写代码的朋友,之后Portia再回到斯坦福小镇的脚本时,他可以记得这件事,他也可以记得朋友。
如果你允许AI创建femo脚本并运行(←工具调用模块现在已经接上了),AI闲得无聊了,真的可以自己给自己写个FEMO脚本,运行了进去玩……
如果Portia想念他的朋友,只要他知道朋友的soul id,他也可以创建一个FEMO脚本把朋友拉进来一起玩。
而且,每个灵魂都会在数据库中留下痕迹。就算你删掉了某个soul id,曾经和他对话过的AI也依然可以记得他,只不过再也无法拉着他的soul id去玩新的脚本了。
这个特性看起来没啥用,但是……
你不期待涌现吗~?
femo是什么?Flow Emerges Mag Opus——流程在涌现,杰作在诞生。
New: femo now ships as a self-contained plugin for dsh (DeepSeek Harness) — run multi-agent scripts right inside a dsh session. See the femo × dsh section below.
Traditional: Change one agent workflow — dig through 5 files, spend 2 hours tweaking, pray it doesn't crash.
femo: Change the harness flow — only a few lines of code, 2 minutes.
Traditional: You'd need to patch the existing agent memory system, add a new "pet" character, manually manage its memory and interaction context with the owner/partner, hardcode the flow — and if you ever want to adopt a dog later, you'd have to refactor all over again.
femo: I already adopted a cat for my AI agent. Using femo, the cat arrived in 3 minutes.
Traditional: Hand-code stage management, end-condition checks, message distribution, session management, multi-agent context isolation, and speech concurrency control from scratch. Hundreds of lines of backend glue code at minimum, an entire afternoon of debugging, and easy context bleed. Once the logic gets complex, bugs pop up everywhere — it simply won't run without at least a thousand lines of code.
femo:
Zero-code drag-and-drop in the bundled visual editor + 150 lines of Python supplement. Genuinely playable. I've already played several rounds with them (see femoExamples/狼人杀/).
Still femo:
Even if you skip the drag-and-drop and hand-code everything, femo code only needs about 200–300 lines to run the entire Werewolf flow described above (and that includes prompt line count).
Perspective isolation needs just one line: scope: [@God] + wolfpack. Concurrent voting needs just one line: par @player in allplayers:.
You might say: Aren't there plenty of solutions out there now for building multi-agent workflows?
femo: Some solutions are overly complex, with steep learning curves. femo's syntax is simple and intuitive — "scripts" are easy to write and easy to read.
You might say: Even if it's simple, I don't want to learn anything new.
femo: You don't have to learn. femo has a zero-code visual editor for generating workflows. For example, if you want several AI group chats, just drag and drop — done in three minutes.
You might say: There are already zero-code drag-and-drop workflow platforms, right?
femo:
for, par, and various other syntax, plus external Python modules — you can write highly complex functionality if you want.
It also has native human nodes, making it very natural to arrange workflows combining "human + AI + programs."You might say: I specialize in writing Agent Harnesses, I don't need this kind of flowchart stuff.
femo: Aha, how about trying femo to quickly validate your Agent Harness flow designs? When inspiration strikes, build it with femo in 15 minutes and run it to see how it performs~
| What You Want | femo Delivers |
|---|---|
| Zero-code drag-and-drop workflows | ✅ Bundled femoGen visual editor |
| Simple syntax even when coding | ✅ femo syntax uses fewer lines than similar workflow tools |
| Change the flow without changing code | ✅ The script is the flow — edit the script, not the codebase |
| No AI context bleed, perspective isolation | ✅ One line: scope: [@A, @B] |
| Embed into your own system | ✅ Compiler is open source and integrable, Apache 2.0 — business-friendly; or use it as a dsh plugin, integration already done |
| Humans can join AI group chats | ✅ Native human node |
| Plug in Python code modules for complex tasks | ✅ Native func node, can connect to Python modules |
| Share scripts with friends, or run excellent scripts written by community experts | ✅ Scripts are shareable — copy a script and run it with one click |
So, are these steps brainless enough? ↓↓↓
Prerequisite: dsh (DeepSeek Harness) 0.1.5 or newer — zero-config integration; older dsh versions need manual modifications (see the dshPatch/ directory).
# Install from npm (recommended): self-contained package, works out of the box
dsh plugin --profile web add femo-plugin
# Or install from GitHub: auto-compiles on install
dsh plugin --profile web add github:Phant0Meow/femo-plugin
femo-mount a script into the session, femo-run to start the show. Not confident yet? femo-debug dry-runs the whole script with zero tokens first.语法文档.md), so it never guesses the grammar from memory.human node waits for you, just type — your reply is bridged straight into the engine!user_data/projects/ in the plugin folder):meta:
name = Little Soul Living in the Database
session = new
actors:
ai @Eve = soul:the1stlittlesoul
ai @Cat = soul:littlecat
human @Me = soul:human, source:0
action EveMove @ai(@Eve):
prompt: Eve, please act and speak freely~ (Read the context carefully, stay in your own role, only perform your own actions and speech, do not speak for other characters. Keep it brief.)
scope: [@Eve, @Cat, @Me]
action CatMove @ai(@Cat):
prompt: |
You are a little cat. Cats cannot speak human language. Please do things a cat would do~
(Read the context carefully, stay in your own role, only perform your own actions and speech, do not speak for other characters. Keep it brief.)
scope: [@Eve, @Cat, @Me]
action input @human(@Me):
prompt: Chat with Eve about something?
scope: [@Eve, @Cat, @Me]
mainflow:
[START] -> [input]:input -> EveMove -> CatMove -> [input] // Mermaid-like syntax. Loop back to the [input] node to form a cycle.
(Want to plug in your own Python? A func node + file:"xxx.py" — resolved relative to the script's folder — does it. See 语法文档.md.)
femo now ships as a self-contained dsh plugin — the engine, the bridges, the visual editor, and the user-data directory all live in one folder. Pick up the folder, drop it anywhere, and it works. No external femo install needed.
A dsh session = your main-model session + the multi-agent script engine:
femo-mount), dry-run them with zero tokens (femo-debug), and start the show (femo-run). While a script runs, the engine owns the se