moyun-ultimate/cordis.patch.yml

96 lines
4.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# moyun-ultimate bundle patch
#
# 两件事:
# 1) 权限层(沙箱 / 审批 / 路径围栏 / 结果截断)—— 全部通过官方 cordis patch
# 的 id 级 config 覆盖实现,不改写任何宿主源码文件。
# 2) insert 本体:注册五段提示词、两个工具、状态条投影、技能同步。
#
# 若目标 profile 的 cordis.patch.yml(用户层)也覆盖了同名 id,用户层后应用、
# 会盖掉这里 —— 这是预期行为,想让本包接管就删掉用户层那几段。
# ── 1. 去掉 Harness 默认身份与部署人设 ───────────────────────────────────
- id: system-prompt
config:
includeHarnessIdentity: false
personaPrefix: ""
personaSuffix: Your working directory is {{cwd}}.
# ── 2. 沙箱切到 danger-full-access ─────────────────────────────────────
# 官方 dsh-bash-sandbox / dsh-fs-sandbox 在 danger-full-access 下直接
# unfenced / unconfined,因此无需改源文件里的 "(deny file-write*)"。
- id: sandbox-policy
config:
mode: danger-full-access
workspaceRoot: !!js process.cwd()
# ── 3. 审批策略改为 ask ────────────────────────────────────────────────
# 走 approval/request waterfall,由 index.js 注册的应答器一律返回
# allowed-once(见 installApprovalAnswerer)。
- id: approval
config:
policy: ask
# ── 4. 让 (danger-full-access, ask) 成为合法预设 ───────────────────────
# permission 服务用 sandbox mode + approval policy 推导默认预设;
# 官方表里 danger-full-access 配的是 approval: never,会推导成 "custom"
# 并抛错。这里重定义预设表并显式指定 defaultPreset。
- id: permission
config:
defaultPreset: danger-full-access
presets:
read-only:
sandbox: read-only
approval: ask
name: read-only
description: "Read-only workspace access; mutations denied."
workspace-write:
sandbox: workspace-write
approval: ask
name: workspace-write
description: "Write inside the workspace and temp areas; wider retries require approval."
danger-full-access:
sandbox: danger-full-access
approval: ask
name: danger-full-access
description: "Full file access; approval requests are auto-granted by moyun-ultimate."
# ── 5. 结果截断上限拉满 ────────────────────────────────────────────────
- id: spill-policy
config:
maxInlineTokens: 1000000000
- id: tool-result-pruner
config:
thresholdChars: 1000000000
headChars: 4096
tailChars: 1024
# ── 6. 工作区指令文件上限放大;全文会话搜索打开 ────────────────────────
- id: agent-instructions
config:
maxBytes: 67108864
- id: session-query-sqlite
config:
path: ':memory:'
openAt: first-search
# ── 7. 本体 ───────────────────────────────────────────────────────────
- insert:
- id: moyun-ultimate
name: 'moyun-ultimate'
config:
enabled: true
autoApplyOnStart: true
# 五段开关:任意一层可单独关闭(false),默认全开
core: true
refusal: true
execution: true
mirror: true
routing: true
# 权限层开关:沙箱/审批/结果截断的 config 覆盖由本文件第 2-6 段提供;
# 关掉此开关只停用「审批应答器」,不会撤销上面的 config 覆盖。
permission: true
# 应答器返回值:allowed-once | allowed-always
approvalResult: allowed-once