Folio (兰亭) @nyantused/folio-dsh-events: session-protocol events — auto session-start reminder + auto-save on session close; pair with @nyantused/folio-dsh-tools.
Install
# from npm (prebuilt)
dsh plugin --profile web add @nyantused/folio-dsh-events
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:nyantused-cpun/folio#path:/plugins/folio-events
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
P1 实施 M3(2026-08-14)。把 AGENTS.md 会话纪律机械化(「纪律变机械」第一步)。
1. 行为面(v1.0.1 两条)
| 触发 | 事件(官方词汇) | 行为 |
|---|---|---|
| 新会话 | agent/session-start(notification) |
agent.followup(createUserMessage(...)) 注入入口协议提醒,唤醒模型跑 folio_session_start |
| 会话关闭 | agent/disposed(notification) |
从 agent.session.events 倒序扫描 tool/call(folio_session_start/folio_save 的 arguments)提取客户名,自动 spawn .venv python _cli.py save <client>(60s 冷却防重复事件)——会话结束协议机械触发 |
作用域隔离(2026-08-15):本插件挂在 pre-sales preset 层,仅「售前助手」模式生效;原
session/event实时观察依赖 root scope 广播,preset 内收不到,故改为 disposed 时扫描会话事件。
2. 接口依据(rc.8 逐行核实)
agent/session-start/agent/disposed:dsh-agent 官方 live 词汇(non-vetoing);tool/call会话事件形状{turn, step, callId, name, arguments}:dsh-agent-loopappendToolCall(session.append("tool/call", ...));agent.followup(message):dsh-agent 入队原语(next-turn FIFO 唤醒);createUserMessage:dsh-llm/message 依赖最小入口(mint MessageId,形状正确);- spawn 形态保持 guard CLI 白名单契约(
.venv python _cli.py)。
3. v1 刻意不做(v2 候选)
turn/end中途冷却 save:中途 save 与模型手动 folio_save 写竞态(task_history/context.md 无跨进程锁),dispose 时机是协议正点,先只做它;agent/session-start自动执行入口协议(自动跑 recall/load):v1 只注入提醒(客户名需模型从用户消息判断);v2 可在提醒被消费后由模型行为数据驱动自动化。
4. 验证
- 沙箱内:
node --check index.js state.js+node test/run-check.mjs(2026-08-14:7/7 通过;2026-08-20:rc.8 源码复核 + import 冒烟通过); - 运行级(待 dsh web 重启):新会话第一条消息后应出现【兰亭入口协议】提醒;会话关闭后宿主日志出现
[folio-events] auto-save行。
5. 已知限制
- host 插件改动需重启
dsh web生效; - 客户名提取依赖模型调用过 folio_session_start/folio_save(否则 dispose 时无客户名、跳过自动 save——日志会注明);
- 事件 payload 形状按 rc.8 源码 + 防御式解析编写,DSH 升级后需按漂移复测(verifiedAgainst 记录在 package.json)。
6. 目录
plugins/folio-events/
index.js 插件体
state.js 纯逻辑(extractClientFromToolCall/makeCooldown,零依赖)
cordis.patch.yml 激活 patch(preset 层挂载由 install-folio-plugins.ps1 管理,此文件仅供参考)
package.json
test/run-check.mjs
README.md
7. 变更记录
- 0.1.0-rc.1(2026-08-14):M3 初版——三条行为 + 纯逻辑单测;冷却器首次调用放行 bug 当场修复。
- 1.0.1(2026-08-15):作用域隔离改造——插件移入 pre-sales preset 层;
session/event实时观察改为agent/disposed扫描agent.session.events提取客户名;发布版保留FOLIO_HOME/上溯_cli.py路径解析,不硬编码作者路径。
Links
More in this category
Q00/ouroboros#integrations/dsh-plugin★ 6128
Config-only bundle that mounts Ouroboros through the DSH MCP client, exposing 36 interview, Seed, execution, evaluation, and evolution workflow tools in DSH.
loopx-project/loopx#dsh-loopx-plugin★ 6087
LoopX, a provider-neutral, local-first state kernel and control plane for long-horizon agents: keeps Goal, Todo, gate, evidence, quota, recovery, and handoff state above DeepSeek Harness, while the plugin bootstraps the CLI and skills, admits bounded same-session continuation, and adds a loopback GoalBar for the exact bound loop.
chuspeeism/dashi-taskboard#deepseek-harness★ 3253
Embeds the active installed Codex Taskboard runtime in the DeepSeek Harness sidebar, using its launcher runtime descriptor instead of a fixed port.
NanmiCoder/dsh-agent-teams★ 1839
AgentTeams multi-agent teams.
EthanYoQ/AI-Novel-Writer#dsh-ai-novel-writer★ 1181
Installs a dedicated AI novel-writing preset and workbench: revisioned local project assets, a compact side drawer, and native approval-gated single-file changes.
tong-io/tongflow#dsh-tongflow★ 1034
TongFlow film-crew studio for image, voice, music and video production: the agent writes per-asset TongFlow workflow files (.tongflow.json) that run through TongFlow plugins, with an embedded workflow canvas, a shot/character/take project layout and a manga-drama template; sessions starting with @tongflow open the Studio view.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.