Repository navigation
Conversation
…rt (with knowledge base) - 角色可打包为 zip:persona.md 磁盘原文 + 自定义头像 + 专属技能整目录 + 专属 MCP 配置(含解密密钥)+ 知识库目录(personas/knowledge/<id>/)+ manifest;Rail 角色右键导出(内置角色灰显拒绝)、花名册 + 菜单导入 / bundle a persona into a zip (raw persona.md, avatar, exclusive skill folders, exclusive MCP servers with decrypted secrets, knowledge directory) with export from the Rail context menu (builtins rejected) and import from the roster add-menu - 导入 id 判定序:原 id 安全且空闲则沿用;已被占且 personas.imports 簿记在案(同源包)→ 就地更新;冲突/外来 id → makeId 铸新 id 绝不覆盖;内置 general/xiaomajiang 永不落位 / import keeps a safe free id, updates same-provenance bundles in place via the provenance ledger, mints fresh ids on conflicts, and never lands on builtin ids - persona.md 经 writePersonaMdRaw 原样字节落盘,不做 frontmatter 重组——手改键与未来字段(sqfcyily#65 knowledge、sqfcyily#49 workspace)往返不丢失;删除角色级联清理头像、知识库目录与导入簿记 / persona.md is written verbatim via writePersonaMdRaw (no frontmatter recomposition, so hand-edited and future keys survive); persona deletion cascades avatar, knowledge dir and import bookkeeping - 安全:zip-slip 逐段守卫 + 30MB/500 文件/10MB 单文件限额;目录收集 lstat 跳过符号链接(防环递归与越界拉取);MCP 密钥导出解密进包(开箱即用的明示取舍)、导入重加密回 secrets.json,加密不可用字段跳过并警告 / security: per-segment zip-slip guards with 30MB/500-file/10MB limits, lstat-based symlink skipping against loop recursion and out-of-tree pulls, MCP secrets decrypted into the bundle (explicit trade-off) and re-encrypted into secrets.json on import with warnings for undecryptable fields - atomic-write 支持 Uint8Array 二进制原子写;preload personas 桥新增 exportBundle/importBundle;i18n 中英文案;随包 MCP 导入即启用并收窄为仅该角色,手机端经既有 WebPersona 推送自动可见 / binary-safe writeFileAtomic, exportBundle/importBundle on the preload personas bridge, bilingual i18n; bundled MCP servers import enabled and scoped to the persona, visible on phones via existing WebPersona pushes
Owner
|
感谢这个 PR,实现很完整。 不过角色的导入导出目前不在近期规划内,说明一下原因:
如果之后启动这个方向,会参考这里的实现。届时有几处需要调整,先记在这里:
另外说明下,我们添加了角色默认工作区,并重构了记忆,增加了角色记忆,会在下个版本发布。 再次感谢。 |
|
未来规划的角色分享的畅想: 不但是skill,还包括mcp/知识库/可以用到工具 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
角色目前锁在单机:换机、备份、分享都没有路径。而且一个「角色」往往不只是
<id>.md一段提示词——它常带从属内容:专属技能(整目录含参考文档/脚本)、专属 MCP 服务(配置 + 加密存储的密钥)、知识库目录(personas/knowledge/<id>/,#65 的档 0 约定)、自定义头像。只导出 md 正文,另一半资产就断在现场。功能
persona.md磁盘原文 + 头像 + 专属技能整目录 + 专属 MCP 配置与密钥 + 知识库整目录 +manifest.json)。内置角色(Deva / 小码酱)不可导出。personas.imports簿记在案(同源包再导入)→ 就地更新,不产生重复角色makeId铸新 id,绝不覆盖(主进程本无防覆盖闸,此闸由本功能显式实现)WebPersona推送自动看到导入的角色,无新增远端面。设计决策摘要
personas.imports簿记判定);冲突/外来 id 铸新 id,绝不覆盖既有角色。general/xiaomajiang拒绝导出、导入永不落位——覆盖会毁掉种子文件。安全考虑
secrets.json,加密不可用的字段跳过并警告,绝不静默存明文。请在 PR 里知悉这一点再合并。lstat跳过符号链接(防链接环递归与越界拉取)。persona.md原样字节落盘(writePersonaMdRaw),不经 frontmatter 重组——手改键与未来字段(【功能建议】角色 frontmatter 增加 knowledge 字段:给每个角色挂一个随角色走的知识库目录 #65knowledge、feat(personas): 角色默认工作区——新对话开场即挂载 / persona default workspace #49workspace)在往返中不丢失。personas:export/import,对话框在主进程),零授权弹窗立场不变。验证
pnpm typecheck双侧 +pnpm build通过。originalId=general硬闸 + 坏 manifest 拒绝 / 删除级联(簿记+头像+知识库随删)/ 缺秘密导出警告。~/.deva纯读,zip 落 /tmp):两个真实角色回环与更新均字节级一致;带知识库角色(6 md / 83KB)导入后 sha256 逐一匹配。已知边界
DEVA_HOME时失效(档 0 约定固有局限,静默按无知识库处理;【功能建议】角色 frontmatter 增加 knowledge 字段:给每个角色挂一个随角色走的知识库目录 #65 字段化是正解)。.zip后缀的包文件。两处均为 P3 备注。兼容性
纯新增功能,无迁移。
config.json新增personas.imports[id]簿记键(删除角色时级联清理);其余键不动。