@dsmm/dsmm 0.3.9 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +9 -5
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +6 -10
  3. package/agent-presets/dsmm-clarifier/agent.cordis.yml +10 -14
  4. package/agent-presets/dsmm-code-search/agent.cordis.yml +10 -14
  5. package/agent-presets/dsmm-coding/agent.cordis.yml +10 -14
  6. package/agent-presets/dsmm-complex/agent.cordis.yml +10 -14
  7. package/agent-presets/dsmm-creative/agent.cordis.yml +10 -14
  8. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +10 -14
  9. package/agent-presets/dsmm-deep/agent.cordis.yml +10 -14
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +10 -14
  11. package/agent-presets/dsmm-documenting/agent.cordis.yml +10 -14
  12. package/agent-presets/dsmm-frontend/agent.cordis.yml +10 -14
  13. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +10 -14
  14. package/agent-presets/dsmm-media-reader/agent.cordis.yml +10 -14
  15. package/agent-presets/dsmm-normal-task/agent.cordis.yml +10 -14
  16. package/agent-presets/dsmm-oracle/agent.cordis.yml +10 -14
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +10 -14
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +8 -12
  19. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +10 -14
  20. package/agent-presets/dsmm-planner/agent.cordis.yml +10 -14
  21. package/agent-presets/dsmm-quick/agent.cordis.yml +10 -14
  22. package/agent-presets/dsmm-research/agent.cordis.yml +10 -14
  23. package/agent-presets/dsmm-reviewer/agent.cordis.yml +10 -14
  24. package/docs/agent-presets.md +3 -3
  25. package/docs/compatibility.md +2 -2
  26. package/docs/deferred-native-approval-risk.md +11 -1
  27. package/docs/design.md +1 -1
  28. package/docs/lsp.md +6 -2
  29. package/docs/maintenance.md +65 -0
  30. package/docs/model-routing.md +1 -1
  31. package/docs/native-permissions.md +23 -1
  32. package/docs/profiles.md +1 -1
  33. package/docs/releasing.md +51 -32
  34. package/docs/roadmap.md +3 -3
  35. package/docs/runtime-recovery.md +1 -1
  36. package/docs/safety-guards.md +23 -5
  37. package/docs/settings-status.md +1 -1
  38. package/lib/child-capture.js +5 -1
  39. package/lib/client/deployment-locales.js +1 -0
  40. package/lib/client/permission-locales.js +8 -8
  41. package/lib/client.js +18 -17
  42. package/lib/command-approval.d.ts +50 -0
  43. package/lib/command-approval.js +148 -0
  44. package/lib/core-permissions.d.ts +2 -1
  45. package/lib/core-permissions.js +6 -3
  46. package/lib/guards.d.ts +2 -1
  47. package/lib/guards.js +45 -8
  48. package/lib/index.d.ts +1 -1
  49. package/lib/index.js +4 -2
  50. package/lib/lsp.js +1 -1
  51. package/lib/permission-control.d.ts +5 -2
  52. package/lib/permission-control.js +46 -24
  53. package/lib/permission-controller.d.ts +2 -0
  54. package/lib/permission-controller.js +13 -8
  55. package/lib/permission-native-command.d.ts +2 -0
  56. package/lib/permission-native-command.js +9 -4
  57. package/lib/permission-native-rules.d.ts +2 -2
  58. package/lib/permission-native-rules.js +18 -13
  59. package/lib/permission-shell.d.ts +1 -1
  60. package/lib/permission-shell.js +2 -2
  61. package/lib/profile-diagnostics.js +1 -1
  62. package/lib/profiles.js +2 -1
  63. package/lib/prompt-content.js +2 -2
  64. package/lib/roles.js +2 -2
  65. package/lib/settings.d.ts +2 -0
  66. package/lib/settings.js +10 -0
  67. package/lib/shell-command.d.ts +16 -0
  68. package/lib/shell-command.js +443 -119
  69. package/package.json +38 -38
  70. package/patches/ocmm-lsp-mcp.example.cordis.patch.yml +1 -1
  71. package/prompts/deepwork.md +2 -2
  72. package/prompts/source/shared/dsh-host-contract.md +2 -2
  73. package/prompts/source/shared/locale.md +2 -2
  74. package/prompts/source/terminal/builder.md +2 -2
  75. package/prompts/source/terminal/clarifier.md +6 -6
  76. package/prompts/source/terminal/code-search.md +6 -6
  77. package/prompts/source/terminal/coding.md +6 -6
  78. package/prompts/source/terminal/complex.md +6 -6
  79. package/prompts/source/terminal/creative.md +6 -6
  80. package/prompts/source/terminal/cross-cutting.md +6 -6
  81. package/prompts/source/terminal/deep.md +6 -6
  82. package/prompts/source/terminal/doc-search.md +6 -6
  83. package/prompts/source/terminal/documenting.md +6 -6
  84. package/prompts/source/terminal/frontend.md +6 -6
  85. package/prompts/source/terminal/hard-reasoning.md +6 -6
  86. package/prompts/source/terminal/media-reader.md +6 -6
  87. package/prompts/source/terminal/normal-task.md +6 -6
  88. package/prompts/source/terminal/oracle-2nd.md +6 -6
  89. package/prompts/source/terminal/oracle.md +6 -6
  90. package/prompts/source/terminal/orchestrator.md +4 -4
  91. package/prompts/source/terminal/plan-critic.md +6 -6
  92. package/prompts/source/terminal/planner.md +6 -6
  93. package/prompts/source/terminal/quick.md +6 -6
  94. package/prompts/source/terminal/research.md +6 -6
  95. package/prompts/source/terminal/reviewer.md +6 -6
  96. package/skills/ast-grep/SKILL.md +3 -3
  97. package/skills/ast-grep/SOURCE +1 -1
  98. package/skills/ast-grep/install.ps1 +1 -1
  99. package/skills/ast-grep/install.sh +1 -1
  100. package/skills/ast-grep/scripts/ast_grep_helper.py +10 -10
  101. package/skills/ast-grep/tests/smoke.sh +11 -11
  102. package/skills/ast-grep/tests/test_resolver.py +4 -23
  103. package/skills/brainstorming/SKILL.md +3 -3
  104. package/skills/coding-agent-sessions/NOTICE.md +2 -2
  105. package/skills/coding-agent-sessions/SKILL.md +3 -3
  106. package/skills/debugging/SKILL.md +3 -3
  107. package/skills/debugging/references/methodology/03-flaky-triage.md +1 -1
  108. package/skills/debugging/references/scripts/dap.mjs +3 -3
  109. package/skills/debugging/references/tools/playwright-cli.md +3 -3
  110. package/skills/dispatching-parallel-agents/SKILL.md +3 -3
  111. package/skills/frontend/ATTRIBUTION.md +4 -4
  112. package/skills/frontend/SKILL.md +3 -3
  113. package/skills/frontend/references/perfection/README.md +4 -4
  114. package/skills/frontend/references/perfection/react-perf-tooling.md +4 -4
  115. package/skills/git-master/SKILL.md +3 -3
  116. package/skills/git-master/agents/openai.yaml +1 -1
  117. package/skills/init-deep/SKILL.md +3 -3
  118. package/skills/receiving-code-review/SKILL.md +3 -3
  119. package/skills/remove-ai-slops/SKILL.md +3 -3
  120. package/skills/requesting-code-review/SKILL.md +3 -3
  121. package/skills/subagent-driven-development/SKILL.md +3 -3
  122. package/skills/using-git-worktrees/SKILL.md +4 -4
  123. package/skills/writing-plans/SKILL.md +3 -3
  124. package/docs/migration-from-ocmm.md +0 -57
  125. package/docs/skill-sync.md +0 -94
  126. package/prompts/source/manifest.json +0 -3168
@@ -1,8 +1,8 @@
1
1
  export const PERMISSIONS_NS = "settings.dsmm-permissions";
2
2
  export const permissionEn = {
3
3
  title: "Permission control", rules: "Rules",
4
- nativeApproval: "Approve commands in the native prompt; Allow covers that call only.",
5
- sandboxScope: "These rules set allow, ask or deny. The Host sandbox and its native prompt still decide what an approved call may touch.",
4
+ nativeApproval: "Approve commands in the native prompt. Native grants cover that call only; DSMM command-rule approvals are remembered only by the exact live Agent, never by children or restored sessions.",
5
+ sandboxScope: "Git high-risk narrows only the automatic Git guard; explicit ask/deny rules remain effective. The Host sandbox still decides access; native escalation and third-party prompts may still appear.",
6
6
  unconfirmedObservation: "Showing the last successful observation. The current selection is not confirmed yet, so editing and saving stay unavailable.",
7
7
  root: "Selected main session", noRoot: "Select a main session to view its permission rules.",
8
8
  child: "Select this child’s main session to edit Global rules.",
@@ -41,10 +41,10 @@ export const permissionEn = {
41
41
  coverageTitle: "Tool coverage", coverageDetails: "Details", coverage: "Last observation for this main session; executor readiness and network access need separate checks.",
42
42
  coverageUnavailable: "Coverage unavailable / unknown. No trusted live observation was returned.", coverageEmpty: "No trusted tool registrations observed for this Root.",
43
43
  coverageRuntime: "Observed consumer state", coverageRevision: "Observed consumer runtime source", toolName: "Observed tool name", toolKind: "Trusted registration kind",
44
- toolApproval: "Approval boundary", nativeOnce: "Native prompt — once only", toolMemory: "Scoped approval memory", notProvided: "Not provided",
44
+ toolApproval: "Approval boundary", nativeOnce: "Native prompt — once only", toolMemory: "Scoped approval memory", notProvided: "Native grants are not reused",
45
45
  finalInode: "Final-inode / full filesystem guarantee", searchDestinations: "Web search destination rules", proxyBinding: "Proxy / address binding", shellSockets: "Shell / socket isolation", providerAuthMcp: "Provider authentication / MCP",
46
46
  "limit:outsideReads": "Tool-call boundary only; no complete filesystem confinement.", "limit:finalInode": "Not guaranteed.",
47
- "limit:scopedMemory": "Not provided by native rules.", "limit:webFetch": "Native public-address checks remain authoritative; private-network access is not granted.",
47
+ "limit:scopedMemory": "DSMM command rules: exact live Agent only; native once targets are never reused.", "limit:webFetch": "Native public-address checks remain authoritative; private-network access is not granted.",
48
48
  "limit:webSearchDestinations": "Unsupported.", "limit:proxyAddressBinding": "Depends on the native proxy; no stronger address-binding guarantee.",
49
49
  "limit:shellSockets": "Depends on the native executor; no all-Shell or socket firewall.", "limit:providerAuthMcp": "Not covered by these rules.",
50
50
  pathEvidence: "Read checks its active filesystem. Search and shell path checks depend on the executor. Final-file identity, full filesystem confinement and socket isolation are not guaranteed.",
@@ -63,8 +63,8 @@ export const permissionEn = {
63
63
  };
64
64
  export const permissionZh = {
65
65
  title: "权限控制", rules: "规则",
66
- nativeApproval: "请在原生提示中批准命令;「允许」仅批准本次调用。",
67
- sandboxScope: "这些规则决定允许、询问或拒绝;具体调用可触及的范围仍由宿主沙箱及其原生提示决定。",
66
+ nativeApproval: "请在原生提示中批准命令。原生授权仅限本次调用;DSMM 命令规则批准仅由精确的存活 Agent 记忆,不传给子 Agent 或恢复的会话。",
67
+ sandboxScope: "Git high-risk 仅缩小自动 Git 保护,显式 ask/deny 规则仍生效。访问范围仍由宿主沙箱决定;原生提权和第三方审批仍可能询问。",
68
68
  unconfirmedObservation: "当前显示上次成功观测;当前选择尚未确认,编辑与保存暂不可用。",
69
69
  root: "所选主会话", noRoot: "请选择主会话以查看权限规则。", child: "请切换到此子会话的主会话后编辑全局规则。",
70
70
  unknown: "不可用/未知", reading: "正在读取…", busy: "操作处理中…",
@@ -102,10 +102,10 @@ export const permissionZh = {
102
102
  coverageTitle: "工具覆盖范围", coverageDetails: "详细信息", coverage: "所选主会话最近观测的覆盖范围,执行器就绪和网络访问需另行检查。",
103
103
  coverageUnavailable: "覆盖不可用/未知:未返回可信的实时观测。", coverageEmpty: "未观测到此 Root 的可信工具注册。",
104
104
  coverageRuntime: "已观测 consumer 状态", coverageRevision: "已观测 consumer 运行时来源", toolName: "已观测工具名称", toolKind: "可信注册类型",
105
- toolApproval: "批准边界", nativeOnce: "原生提示——仅本次", toolMemory: "作用域批准记忆", notProvided: "不提供",
105
+ toolApproval: "批准边界", nativeOnce: "原生提示——仅本次", toolMemory: "作用域批准记忆", notProvided: "原生授权不复用",
106
106
  finalInode: "最终 inode/完整文件系统保证", searchDestinations: "网页搜索目标规则", proxyBinding: "代理/地址绑定", shellSockets: "Shell/socket 隔离", providerAuthMcp: "Provider 认证/MCP",
107
107
  "limit:outsideReads": "仅工具调用边界,不是完整文件系统隔离。", "limit:finalInode": "不保证。",
108
- "limit:scopedMemory": "原生规则不提供。", "limit:webFetch": "仍以原生 public-address 检查为准,不授予私网访问。",
108
+ "limit:scopedMemory": "DSMM 命令规则仅限精确的存活 Agent;原生 once 目标绝不复用。", "limit:webFetch": "仍以原生 public-address 检查为准,不授予私网访问。",
109
109
  "limit:webSearchDestinations": "不支持。", "limit:proxyAddressBinding": "依赖原生代理,不提供更强的地址绑定保证。",
110
110
  "limit:shellSockets": "依赖原生执行器,不是全部 Shell 或 socket 的防火墙。", "limit:providerAuthMcp": "不在这些规则覆盖范围。",
111
111
  pathEvidence: "读取检查当前文件系统;搜索和 Shell 的路径检查取决于执行器。不保证最终文件身份、完整文件系统或 socket 隔离。",
package/lib/client.js CHANGED
@@ -255,7 +255,7 @@ function parseModelParameterPolicy(value) {
255
255
  // src/profile-types.ts
256
256
  var DSMM_ROUTE_SOURCES = ["inherited", "primary", "level", "invocation-route"];
257
257
 
258
- // ../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
258
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
259
259
  function createScanner(text5, ignoreTrivia = false) {
260
260
  const len = text5.length;
261
261
  let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
@@ -676,7 +676,7 @@ var CharacterCodes;
676
676
  CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
677
677
  })(CharacterCodes || (CharacterCodes = {}));
678
678
 
679
- // ../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
679
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
680
680
  var cachedSpaces = new Array(20).fill(0).map((_, index) => {
681
681
  return " ".repeat(index);
682
682
  });
@@ -707,7 +707,7 @@ var cachedBreakLinesWithSpaces = {
707
707
  };
708
708
  var supportedEols = ["\n", "\r", "\r\n"];
709
709
 
710
- // ../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
710
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
711
711
  function format(documentText, range, options) {
712
712
  let initialIndentLevel;
713
713
  let formatText;
@@ -943,7 +943,7 @@ function isEOL(text5, offset) {
943
943
  return "\r\n".indexOf(text5.charAt(offset)) !== -1;
944
944
  }
945
945
 
946
- // ../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
946
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
947
947
  var ParseOptions;
948
948
  (function(ParseOptions2) {
949
949
  ParseOptions2.DEFAULT = {
@@ -1408,7 +1408,7 @@ function getNodeType(value) {
1408
1408
  }
1409
1409
  }
1410
1410
 
1411
- // ../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
1411
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
1412
1412
  function setProperty(text5, originalPath, value, options) {
1413
1413
  const path = originalPath.slice();
1414
1414
  const errors = [];
@@ -1552,7 +1552,7 @@ function applyEdit(text5, edit) {
1552
1552
  return text5.substring(0, edit.offset) + edit.content + text5.substring(edit.offset + edit.length);
1553
1553
  }
1554
1554
 
1555
- // ../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
1555
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
1556
1556
  var ScanError;
1557
1557
  (function(ScanError2) {
1558
1558
  ScanError2[ScanError2["None"] = 0] = "None";
@@ -1629,7 +1629,7 @@ function applyEdits(text5, edits) {
1629
1629
  return text5;
1630
1630
  }
1631
1631
 
1632
- // ../node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.6/node_modules/@deepseek-ai/cosmokit/lib/index.js
1632
+ // node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.6/node_modules/@deepseek-ai/cosmokit/lib/index.js
1633
1633
  function isNullable(value) {
1634
1634
  return value === null || value === void 0;
1635
1635
  }
@@ -1854,7 +1854,7 @@ var Time;
1854
1854
  Time2.template = template;
1855
1855
  })(Time || (Time = {}));
1856
1856
 
1857
- // ../node_modules/.pnpm/@deepseek-ai+schemastery@3.18.5/node_modules/@deepseek-ai/schemastery/lib/index.mjs
1857
+ // node_modules/.pnpm/@deepseek-ai+schemastery@3.18.5/node_modules/@deepseek-ai/schemastery/lib/index.mjs
1858
1858
  var kSchema = Symbol.for("schemastery");
1859
1859
  var kValidationError = Symbol.for("ValidationError");
1860
1860
  globalThis.__schemastery_index__ ??= 0;
@@ -2711,7 +2711,7 @@ var configFields = {
2711
2711
  presets: { materialize: null, root: null },
2712
2712
  subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, backgroundMode: null, maxDepth: null },
2713
2713
  workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
2714
- guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
2714
+ guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, gitWriteScope: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
2715
2715
  runtimeRecovery: { enabled: null, retryOnStatusCodes: [null], retryOnCodes: [null], fallbackRoutes: [route], maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
2716
2716
  lsp: { enabled: null, serverName: null, command: null, args: [null], cwd: null, env: {}, toolCallTimeoutMs: null, failOnStartupError: null }
2717
2717
  };
@@ -6265,6 +6265,7 @@ var deploymentFieldLabels = {
6265
6265
  scope: ["Guard scope", "保护范围"],
6266
6266
  shellCommandSafety: ["Shell command safety", "Shell 命令安全"],
6267
6267
  gitWriteGuard: ["Git write policy", "Git 写入策略"],
6268
+ gitWriteScope: ["Automatic Git write scope (all-writes / high-risk)", "自动 Git 写入范围(all-writes 全部写入 / high-risk 仅高危)"],
6268
6269
  toolOutputTruncation: ["Tool output truncation", "工具输出截断"],
6269
6270
  maxInlineBytes: ["Inline byte limit", "内联字节上限"],
6270
6271
  planFormatValidation: ["Plan format validation", "计划格式校验"],
@@ -6308,8 +6309,8 @@ var PERMISSIONS_NS = "settings.dsmm-permissions";
6308
6309
  var permissionEn = {
6309
6310
  title: "Permission control",
6310
6311
  rules: "Rules",
6311
- nativeApproval: "Approve commands in the native prompt; Allow covers that call only.",
6312
- sandboxScope: "These rules set allow, ask or deny. The Host sandbox and its native prompt still decide what an approved call may touch.",
6312
+ nativeApproval: "Approve commands in the native prompt. Native grants cover that call only; DSMM command-rule approvals are remembered only by the exact live Agent, never by children or restored sessions.",
6313
+ sandboxScope: "Git high-risk narrows only the automatic Git guard; explicit ask/deny rules remain effective. The Host sandbox still decides access; native escalation and third-party prompts may still appear.",
6313
6314
  unconfirmedObservation: "Showing the last successful observation. The current selection is not confirmed yet, so editing and saving stay unavailable.",
6314
6315
  root: "Selected main session",
6315
6316
  noRoot: "Select a main session to view its permission rules.",
@@ -6423,7 +6424,7 @@ var permissionEn = {
6423
6424
  toolApproval: "Approval boundary",
6424
6425
  nativeOnce: "Native prompt — once only",
6425
6426
  toolMemory: "Scoped approval memory",
6426
- notProvided: "Not provided",
6427
+ notProvided: "Native grants are not reused",
6427
6428
  finalInode: "Final-inode / full filesystem guarantee",
6428
6429
  searchDestinations: "Web search destination rules",
6429
6430
  proxyBinding: "Proxy / address binding",
@@ -6431,7 +6432,7 @@ var permissionEn = {
6431
6432
  providerAuthMcp: "Provider authentication / MCP",
6432
6433
  "limit:outsideReads": "Tool-call boundary only; no complete filesystem confinement.",
6433
6434
  "limit:finalInode": "Not guaranteed.",
6434
- "limit:scopedMemory": "Not provided by native rules.",
6435
+ "limit:scopedMemory": "DSMM command rules: exact live Agent only; native once targets are never reused.",
6435
6436
  "limit:webFetch": "Native public-address checks remain authoritative; private-network access is not granted.",
6436
6437
  "limit:webSearchDestinations": "Unsupported.",
6437
6438
  "limit:proxyAddressBinding": "Depends on the native proxy; no stronger address-binding guarantee.",
@@ -6467,8 +6468,8 @@ var permissionEn = {
6467
6468
  var permissionZh = {
6468
6469
  title: "权限控制",
6469
6470
  rules: "规则",
6470
- nativeApproval: "请在原生提示中批准命令;「允许」仅批准本次调用。",
6471
- sandboxScope: "这些规则决定允许、询问或拒绝;具体调用可触及的范围仍由宿主沙箱及其原生提示决定。",
6471
+ nativeApproval: "请在原生提示中批准命令。原生授权仅限本次调用;DSMM 命令规则批准仅由精确的存活 Agent 记忆,不传给子 Agent 或恢复的会话。",
6472
+ sandboxScope: "Git high-risk 仅缩小自动 Git 保护,显式 ask/deny 规则仍生效。访问范围仍由宿主沙箱决定;原生提权和第三方审批仍可能询问。",
6472
6473
  unconfirmedObservation: "当前显示上次成功观测;当前选择尚未确认,编辑与保存暂不可用。",
6473
6474
  root: "所选主会话",
6474
6475
  noRoot: "请选择主会话以查看权限规则。",
@@ -6582,7 +6583,7 @@ var permissionZh = {
6582
6583
  toolApproval: "批准边界",
6583
6584
  nativeOnce: "原生提示——仅本次",
6584
6585
  toolMemory: "作用域批准记忆",
6585
- notProvided: "不提供",
6586
+ notProvided: "原生授权不复用",
6586
6587
  finalInode: "最终 inode/完整文件系统保证",
6587
6588
  searchDestinations: "网页搜索目标规则",
6588
6589
  proxyBinding: "代理/地址绑定",
@@ -6590,7 +6591,7 @@ var permissionZh = {
6590
6591
  providerAuthMcp: "Provider 认证/MCP",
6591
6592
  "limit:outsideReads": "仅工具调用边界,不是完整文件系统隔离。",
6592
6593
  "limit:finalInode": "不保证。",
6593
- "limit:scopedMemory": "原生规则不提供。",
6594
+ "limit:scopedMemory": "DSMM 命令规则仅限精确的存活 Agent;原生 once 目标绝不复用。",
6594
6595
  "limit:webFetch": "仍以原生 public-address 检查为准,不授予私网访问。",
6595
6596
  "limit:webSearchDestinations": "不支持。",
6596
6597
  "limit:proxyAddressBinding": "依赖原生代理,不提供更强的地址绑定保证。",
@@ -0,0 +1,50 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import type { Agent } from "@deepseek-ai/dsh-agent";
3
+ import type { PreToolDecision, ToolExecution } from "@deepseek-ai/dsh-tools";
4
+ type Approval = Context["approval"];
5
+ type Outcome = Awaited<ReturnType<Approval["request"]>>;
6
+ /** A matcher supplies the whole rule semantics, not a command/reason-derived permission. */
7
+ export interface CommandRuleContribution {
8
+ readonly kind: "git" | "shell" | "native-command";
9
+ readonly semantics: unknown;
10
+ readonly reusable?: boolean;
11
+ }
12
+ export interface CommandApprovalScope {
13
+ /** Managed entry points commit only after their stronger final integrity check. */
14
+ readonly deferredCommit?: boolean;
15
+ readonly source?: object;
16
+ sourceCurrent?(): object;
17
+ readonly owner?: object;
18
+ readonly ownerGeneration?: string | number;
19
+ readonly realm?: object;
20
+ assertCurrent?(): void;
21
+ }
22
+ export interface CommandApprovalBinding {
23
+ readonly missing: readonly CommandRuleContribution[];
24
+ readonly signal: AbortSignal;
25
+ assertCurrent(): void;
26
+ /** Only the caller awaiting its own complete service request may supply this outcome. */
27
+ resolved(outcome: Outcome): void;
28
+ }
29
+ /** Core-owned memory. Invocation records never serve as reusable native target grants. */
30
+ export declare class CommandApprovals {
31
+ private readonly ctx;
32
+ private memory;
33
+ private invocations;
34
+ private readonly retiredAgents;
35
+ private generation;
36
+ private readonly lifetime;
37
+ constructor(ctx: Context);
38
+ capture(exec: Readonly<ToolExecution>, contributions: readonly CommandRuleContribution[], scope?: CommandApprovalScope): CommandApprovalBinding | undefined;
39
+ /** Generic guard-owned request, including no-target calls and independent downstream asks. */
40
+ decide(exec: Readonly<ToolExecution>, binding: CommandApprovalBinding | undefined, next: () => Promise<PreToolDecision>, reason: string): Promise<PreToolDecision>;
41
+ check(exec: Readonly<ToolExecution>): void;
42
+ commit(exec: Readonly<ToolExecution>, includeDeferred?: boolean): void;
43
+ guard(exec: Readonly<ToolExecution>): string | undefined;
44
+ finish(exec: Readonly<ToolExecution>): void;
45
+ invalidate(): void;
46
+ revokeAgent(agent: Agent): void;
47
+ retire(): void;
48
+ }
49
+ export {};
50
+ //# sourceMappingURL=command-approval.d.ts.map
@@ -0,0 +1,148 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import { symbols } from "@deepseek-ai/cordis";
3
+ import { PermissionRefusal } from "./permission-errors.js";
4
+ const original = (value) => Reflect.get(value, symbols.original) ?? value;
5
+ /** Core-owned memory. Invocation records never serve as reusable native target grants. */
6
+ export class CommandApprovals {
7
+ ctx;
8
+ memory = new WeakMap();
9
+ invocations = new WeakMap();
10
+ retiredAgents = new WeakSet();
11
+ generation = {};
12
+ lifetime = new AbortController();
13
+ constructor(ctx) {
14
+ this.ctx = ctx;
15
+ ctx.inject(["tools"], scope => { scope.tools.guard(exec => this.guard(exec)); });
16
+ ctx.on("tools/execute", async (exec, next) => { this.commit(exec, false); return next(); }, { global: true, prepend: true });
17
+ ctx.on("tools/result", exec => { this.finish(exec); }, { global: true });
18
+ ctx.on("agent/disposed", ({ agent }) => { this.revokeAgent(agent); }, { global: true });
19
+ ctx.effect(() => () => this.retire());
20
+ }
21
+ capture(exec, contributions, scope = {}) {
22
+ const agent = exec.agent;
23
+ if (agent === undefined || this.retiredAgents.has(agent))
24
+ return undefined;
25
+ const resolveTools = () => agent.ctx.get("agentPresets")?.serviceFor(agent, "tools") ?? agent.ctx.get("tools");
26
+ const tools = resolveTools(), definition = tools?.get(exec.name, agent), registry = agent.ctx.get("agents");
27
+ if (tools === undefined || definition === undefined || registry === undefined || registry.get(agent.id) !== agent)
28
+ return undefined;
29
+ const session = agent.session, workspace = session.header.cwd, context = agent.ctx, token = exec.token, args = exec.arguments;
30
+ const values = structuredClone(args), name = exec.name, callId = exec.callId;
31
+ const owner = scope.owner ?? this, realm = scope.realm ?? context, generation = this.generation;
32
+ const signal = AbortSignal.any([exec.signal, this.lifetime.signal]);
33
+ const rules = contributions.map(rule => ({ ...rule, semantics: structuredClone(rule.semantics) }));
34
+ let approved = false;
35
+ const assertCurrent = () => {
36
+ const currentTools = resolveTools(), currentRegistry = agent.ctx.get("agents");
37
+ if (signal.aborted || exec.signal.aborted || this.retiredAgents.has(agent))
38
+ throw new PermissionRefusal("cancelled");
39
+ if (agent.session !== session || agent.ctx !== context
40
+ || currentTools === undefined || original(currentTools) !== original(tools) || currentTools.get(name, agent) !== definition
41
+ || currentRegistry === undefined || original(currentRegistry) !== original(registry) || currentRegistry.get(agent.id) !== agent) {
42
+ this.memory.delete(agent);
43
+ throw new PermissionRefusal("stale");
44
+ }
45
+ if (exec.token !== token || exec.arguments !== args || !isDeepStrictEqual(exec.arguments, values)
46
+ || exec.agent !== agent || exec.name !== name || exec.callId !== callId || session.header.cwd !== workspace)
47
+ throw new PermissionRefusal("stale");
48
+ try {
49
+ scope.assertCurrent?.();
50
+ }
51
+ catch (error) {
52
+ this.memory.delete(agent);
53
+ throw error;
54
+ }
55
+ };
56
+ const sourceCurrent = () => {
57
+ try {
58
+ return generation === this.generation && (scope.sourceCurrent === undefined || scope.sourceCurrent() === scope.source);
59
+ }
60
+ catch {
61
+ return false;
62
+ }
63
+ };
64
+ const policyAllows = () => {
65
+ const approval = this.ctx.get("approval");
66
+ return approval !== undefined && (approval.overrideOf(session) ?? approval.config.policy ?? "ask") !== "never";
67
+ };
68
+ const previous = this.memory.get(agent);
69
+ if (previous !== undefined && previous.session !== session)
70
+ this.memory.delete(agent);
71
+ const remembered = previous?.session === session ? previous.rules : [];
72
+ const missing = rules.filter(rule => rule.reusable === false || !sourceCurrent() || !policyAllows() || !remembered.some(item => item.tools === original(tools) && item.definition === definition && item.source === scope.source && item.owner === owner
73
+ && item.ownerGeneration === scope.ownerGeneration && item.realm === realm && isDeepStrictEqual(item.rule, rule)));
74
+ const binding = {
75
+ missing, signal, assertCurrent, deferredCommit: scope.deferredCommit === true,
76
+ resolved: outcome => { assertCurrent(); approved = outcome === "allowed-once"; },
77
+ commit: () => {
78
+ assertCurrent();
79
+ if (!approved || !sourceCurrent() || !policyAllows())
80
+ return;
81
+ approved = false;
82
+ let state = this.memory.get(agent);
83
+ if (state?.session !== session) {
84
+ state = { session, rules: [] };
85
+ this.memory.set(agent, state);
86
+ }
87
+ for (const rule of missing) {
88
+ if (rule.reusable === false)
89
+ continue;
90
+ const item = { rule, tools: original(tools), definition, source: scope.source, owner, ownerGeneration: scope.ownerGeneration, realm };
91
+ if (!state.rules.some(previous => previous.tools === item.tools && previous.definition === definition && previous.source === item.source
92
+ && previous.owner === owner && previous.ownerGeneration === item.ownerGeneration && previous.realm === realm && isDeepStrictEqual(previous.rule, rule)))
93
+ state.rules.push(item);
94
+ }
95
+ },
96
+ };
97
+ assertCurrent();
98
+ const bindings = this.invocations.get(exec) ?? [];
99
+ bindings.push(binding);
100
+ this.invocations.set(exec, bindings);
101
+ return binding;
102
+ }
103
+ /** Generic guard-owned request, including no-target calls and independent downstream asks. */
104
+ async decide(exec, binding, next, reason) {
105
+ const downstream = await next();
106
+ if (exec.signal.aborted || binding?.signal.aborted)
107
+ return { kind: "cancel" };
108
+ binding?.assertCurrent();
109
+ if (downstream.kind === "deny" || downstream.kind === "cancel" || binding?.missing.length === 0)
110
+ return downstream;
111
+ const combined = [downstream.kind === "ask" ? downstream.reason : undefined, reason].filter(Boolean).join("\n");
112
+ if (binding === undefined)
113
+ return downstream.kind === "allow" ? { kind: "ask", reason: combined } : downstream;
114
+ const approval = this.ctx.get("approval");
115
+ if (approval === undefined || exec.agent === undefined)
116
+ return { kind: "deny", reason: "Command approval is unavailable." };
117
+ const displayReason = Object.freeze({ en: combined, zh: combined,
118
+ ...downstream.kind === "ask" && downstream.displayReason !== undefined
119
+ ? Object.fromEntries(Object.entries(downstream.displayReason).map(([locale, text]) => [locale, `${text}\n${reason}`])) : {} });
120
+ const outcome = await approval.request({ agent: exec.agent, callId: exec.callId, toolName: exec.name, signal: binding.signal, reason: combined, displayReason });
121
+ if (exec.signal.aborted || binding.signal.aborted)
122
+ return { kind: "cancel" };
123
+ binding.resolved(outcome);
124
+ return outcome === "allowed-once" ? { kind: "allow" } : { kind: outcome === "cancelled" ? "cancel" : "deny", reason: "Command approval was not granted." };
125
+ }
126
+ check(exec) { for (const binding of this.invocations.get(exec) ?? [])
127
+ binding.assertCurrent(); }
128
+ commit(exec, includeDeferred = true) {
129
+ this.check(exec);
130
+ for (const binding of this.invocations.get(exec) ?? [])
131
+ if (includeDeferred || !binding.deferredCommit)
132
+ binding.commit();
133
+ }
134
+ guard(exec) {
135
+ try {
136
+ this.check(exec);
137
+ return undefined;
138
+ }
139
+ catch {
140
+ return "Command execution identity is no longer current.";
141
+ }
142
+ }
143
+ finish(exec) { this.invocations.delete(exec); }
144
+ invalidate() { this.generation = {}; this.memory = new WeakMap(); }
145
+ revokeAgent(agent) { this.retiredAgents.add(agent); this.memory.delete(agent); }
146
+ retire() { this.lifetime.abort(); this.invalidate(); }
147
+ }
148
+ //# sourceMappingURL=command-approval.js.map
@@ -3,6 +3,7 @@ import type { Agent } from "@deepseek-ai/dsh-agent";
3
3
  import type { DsmmDeploymentConfig } from "./deployment-config.js";
4
4
  import type { PermissionControlCollaborators } from "./permission-control.js";
5
5
  import type { DsmmPermissionController } from "./permission-controller.js";
6
+ import type { CommandApprovals } from "./command-approval.js";
6
7
  /** The native Core fiber owns one source backend, execution controller and RPC service. */
7
- export declare function installCorePermissions(ctx: Context, deployment: DsmmDeploymentConfig, authority: PermissionControlCollaborators, assertWritable: (root: Agent) => void): DsmmPermissionController;
8
+ export declare function installCorePermissions(ctx: Context, deployment: DsmmDeploymentConfig, authority: PermissionControlCollaborators, assertWritable: (root: Agent) => void, commandApprovals?: CommandApprovals): DsmmPermissionController;
8
9
  //# sourceMappingURL=core-permissions.d.ts.map
@@ -3,11 +3,14 @@ import { PermissionRefusal, permissionOriginal } from "./permission-control.js";
3
3
  import { installPermissionController } from "./permission-controller.js";
4
4
  import { registerPermissionControlRpc } from "./permission-rpc.js";
5
5
  /** The native Core fiber owns one source backend, execution controller and RPC service. */
6
- export function installCorePermissions(ctx, deployment, authority, assertWritable) {
6
+ export function installCorePermissions(ctx, deployment, authority, assertWritable, commandApprovals) {
7
7
  let controller;
8
8
  const backend = installDeploymentPermissionRules(ctx, {
9
9
  deployment, assertWritable,
10
- revoke: () => { },
10
+ revoke: () => { if (controller === undefined)
11
+ commandApprovals?.invalidate();
12
+ else
13
+ controller.permissions.revokePolicy(); },
11
14
  notify: async () => {
12
15
  const current = ctx.get("dsmmPermissionController");
13
16
  if (controller === undefined || current === undefined || permissionOriginal(current) !== permissionOriginal(controller)
@@ -16,7 +19,7 @@ export function installCorePermissions(ctx, deployment, authority, assertWritabl
16
19
  },
17
20
  });
18
21
  controller = installPermissionController(ctx, {
19
- authority, rules: backend.runtime,
22
+ authority, rules: backend.runtime, commandApprovals,
20
23
  // The public ShellExecutor has no executable/environment resolution proof.
21
24
  // This identity never grants read trust or filesystem colocation.
22
25
  shellIdentity: (_scope, kind) => Object.freeze({ executable: `unresolved-native-${kind}`,
package/lib/guards.d.ts CHANGED
@@ -2,10 +2,11 @@ import type { DshContext, DshPostToolDecision, DshPreToolDecision, DshToolExecut
2
2
  import type { DsmmSettings, DsmmSettingsGetter } from "./settings.js";
3
3
  import type { DeepworkModeController } from "./state.js";
4
4
  import type { DsmmRolePolicy } from "./role-policy.js";
5
+ import type { CommandApprovals } from "./command-approval.js";
5
6
  export declare const DSMM_GUARD_PREFIX = "[dsmm safety]";
6
7
  export declare function truncateTextMiddle(text: string, maxBytes: number, toolName: string): string;
7
8
  export declare function isSafetyScopeActive(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController): boolean;
8
9
  export declare function decidePreToolExecution(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController, nativeFullAccess?: boolean, simple?: boolean): DshPreToolDecision | undefined;
9
10
  export declare function decidePostToolExecution(exec: DshToolExecution, result: Readonly<DshToolExecutionResult>, decision: DshPostToolDecision, settings: DsmmSettings, controller: DeepworkModeController): DshPostToolDecision;
10
- export declare function registerSafetyGuards(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, rolePolicy?: DsmmRolePolicy): void;
11
+ export declare function registerSafetyGuards(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, rolePolicy?: DsmmRolePolicy, commandApprovals?: CommandApprovals): void;
11
12
  //# sourceMappingURL=guards.d.ts.map
package/lib/guards.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { isDsmmRoleId } from "./roles.js";
2
2
  import { resolveSelectedAgentPreset } from "./session-scope.js";
3
3
  import { validatePlanMutation } from "./plan-validation.js";
4
- import { classifyKnownGitWrite, classifyShellDialectViolation } from "./shell-command.js";
4
+ import { evaluateGitCommand, classifyShellDialectViolation } from "./shell-command.js";
5
+ import { isAbsolute, resolve } from "node:path";
6
+ import { isDeepStrictEqual } from "node:util";
5
7
  import { resolveAdmittedDsmmRole } from "./role-policy.js";
6
8
  import { Context } from "@deepseek-ai/cordis";
7
9
  import { nativeStandingFullAccess } from "./permission-native-access.js";
@@ -118,25 +120,43 @@ function shellDialectViolationDecision(violation) {
118
120
  reason: `${DSMM_GUARD_PREFIX} bash command appears to use PowerShell syntax (\`$env:\`). Use POSIX environment syntax for bash.`
119
121
  };
120
122
  }
121
- function gitWriteDecision(exec, settings, simple = false) {
123
+ function gitActions(exec, settings) {
122
124
  if (settings.guards.gitWriteGuard === "off")
123
- return undefined;
125
+ return [];
124
126
  const command = commandText(exec);
125
127
  const dialect = shellDialect(exec);
126
- const operation = command === undefined || dialect === undefined ? undefined : classifyKnownGitWrite(command, dialect);
127
- if (operation === undefined)
128
+ return command === undefined || dialect === undefined ? [] : evaluateGitCommand(command, dialect)
129
+ .filter(action => settings.guards.gitWriteScope !== "high-risk" || action.risk === "high-risk");
130
+ }
131
+ function gitRuleReason(actions) {
132
+ return actions.map(({ action, ruleId }) => `git ${action === "reset.hard" ? "reset --hard" : action.replaceAll(".", " ")} [${ruleId}]`).join(", ");
133
+ }
134
+ function commandWorkingDirectory(exec) {
135
+ const workspace = exec.agent?.session.header?.cwd, workdir = asRecord(exec.arguments)?.workdir;
136
+ return typeof workspace === "string" && isAbsolute(workspace) && (workdir === undefined || typeof workdir === "string")
137
+ ? resolve(workspace, workdir ?? ".") : undefined;
138
+ }
139
+ function gitContributions(exec, actions) {
140
+ const cwd = commandWorkingDirectory(exec);
141
+ const dialect = shellDialect(exec);
142
+ return actions.map(action => ({ kind: "git", reusable: action.reusable && cwd !== undefined,
143
+ semantics: { ruleId: action.ruleId, risk: action.risk, context: action.context, cwd, dialect } }));
144
+ }
145
+ function gitWriteDecision(exec, settings, simple = false) {
146
+ const actions = gitActions(exec, settings);
147
+ if (actions.length === 0)
128
148
  return undefined;
129
149
  if (settings.guards.gitWriteGuard === "deny") {
130
150
  return {
131
151
  kind: "deny",
132
- reason: `${DSMM_GUARD_PREFIX} git write command is disabled by dsmm settings: git ${operation}`
152
+ reason: `${DSMM_GUARD_PREFIX} git write command is disabled by dsmm settings: ${gitRuleReason(actions)}`
133
153
  };
134
154
  }
135
155
  if (simple)
136
156
  return undefined;
137
157
  return {
138
158
  kind: "ask",
139
- reason: `${DSMM_GUARD_PREFIX} git write command requires explicit user approval before running: git ${operation}`
159
+ reason: `${DSMM_GUARD_PREFIX} git write command requires explicit user approval before running: ${gitRuleReason(actions)}`
140
160
  };
141
161
  }
142
162
  function questionLabelDecision(exec, settings) {
@@ -236,8 +256,18 @@ export function decidePostToolExecution(exec, result, decision, settings, contro
236
256
  content: [{ type: "text", text: truncateTextMiddle(text, truncation.maxInlineBytes, exec.name) }]
237
257
  };
238
258
  }
239
- export function registerSafetyGuards(ctx, controller, getSettings, rolePolicy) {
259
+ export function registerSafetyGuards(ctx, controller, getSettings, rolePolicy, commandApprovals) {
240
260
  const truncationLimits = new WeakMap();
261
+ const sources = new WeakMap();
262
+ const sourceFor = (agent, settings = getSettings(agent)) => {
263
+ const value = getSettings.admission?.(agent) ?? settings;
264
+ let source = sources.get(agent);
265
+ if (source?.value !== value) {
266
+ source = { value, generation: {} };
267
+ sources.set(agent, source);
268
+ }
269
+ return source.generation;
270
+ };
241
271
  const tools = ctx.get?.("tools");
242
272
  if (rolePolicy !== undefined && tools !== undefined) {
243
273
  const guard = tools.guard((execution) => execution.agent === undefined ? undefined : rolePolicy.toolDenial(execution.agent, execution.name, tools, execution));
@@ -260,6 +290,7 @@ export function registerSafetyGuards(ctx, controller, getSettings, rolePolicy) {
260
290
  throw error;
261
291
  }
262
292
  const simple = Context.is(ctx) && await ctx.get("dsmmPermissionController")?.simpleCommandAllowed(execution) === true;
293
+ const source = commandApprovals === undefined || full || simple || exec.agent === undefined ? undefined : sourceFor(exec.agent, settings);
263
294
  const decision = decidePreToolExecution(exec, settings, controller, full, simple);
264
295
  if (!full && settings.modules.deepwork.enabled && settings.guards.toolOutputTruncation.enabled && isSafetyScopeActive(exec, settings, controller))
265
296
  truncationLimits.set(exec, settings.guards.toolOutputTruncation.maxInlineBytes);
@@ -267,6 +298,12 @@ export function registerSafetyGuards(ctx, controller, getSettings, rolePolicy) {
267
298
  return next();
268
299
  if (decision.kind === "deny")
269
300
  return decision;
301
+ if (commandApprovals !== undefined && decision.kind === "ask") {
302
+ const actions = gitActions(exec, settings), contributions = gitContributions(exec, actions);
303
+ const binding = commandApprovals.capture(execution, contributions, { source, sourceCurrent: exec.agent === undefined ? undefined : () => sourceFor(exec.agent) });
304
+ const missing = binding === undefined ? actions : actions.filter((_action, index) => binding.missing.some(rule => isDeepStrictEqual(rule, contributions[index])));
305
+ return commandApprovals.decide(execution, binding, next, `${DSMM_GUARD_PREFIX} git write command requires explicit user approval before running: ${gitRuleReason(missing)}\nCommand: ${commandText(exec)}\nWorking directory: ${commandWorkingDirectory(exec) ?? "unresolved"}`);
306
+ }
270
307
  const downstream = await next();
271
308
  return downstream.kind === "allow" ? decision : downstream;
272
309
  }, { prepend: true });
package/lib/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { DSMM_STATUS_VERSION, createDsmmStatusSnapshot, formatDsmmStatus } from
23
23
  export type { DsmmStatusSnapshot } from "./status.js";
24
24
  export type * from "./dsh-types.js";
25
25
  export { DSMM_SKILL_NAMES, DSMM_SETTINGS_SCHEMA, DEFAULT_DSMM_SETTINGS, MVP_SKILL_NAMES, deploymentEditorSchema, isRoleEnabled, resolveConfig, resolveDeployment, resolveRoleRouting, registerSettings, validateNativeConfig } from "./settings.js";
26
- export type { DsmmFinalReviewPolicy, DsmmGitWritePolicy, DsmmGuardScope, DsmmGuardSettings, DsmmPluginConfig, DsmmNativeConfig, DsmmModelRoute, DsmmRoleRoutingConfig, DsmmRoleRouting, DsmmRecoveryRoute, DsmmRuntimeRecoverySettings, DsmmSettings, DsmmSettingsGetter, DsmmSkillName, DsmmWorkflowSettings, MvpSkillName, DsmmSubagentSettings, DsmmDeploymentSnapshot } from "./settings.js";
26
+ export type { DsmmFinalReviewPolicy, DsmmGitWritePolicy, DsmmGitWriteScope, DsmmGuardScope, DsmmGuardSettings, DsmmPluginConfig, DsmmNativeConfig, DsmmModelRoute, DsmmRoleRoutingConfig, DsmmRoleRouting, DsmmRecoveryRoute, DsmmRuntimeRecoverySettings, DsmmSettings, DsmmSettingsGetter, DsmmSkillName, DsmmWorkflowSettings, MvpSkillName, DsmmSubagentSettings, DsmmDeploymentSnapshot } from "./settings.js";
27
27
  export { createProfileRuntime, DsmmProfileRuntime } from "./profile-runtime.js";
28
28
  export type { DsmmProfileRuntimeStore, DsmmProfileRuntimeOptions } from "./profile-runtime.js";
29
29
  export { resolveDshHome } from "./dsh-home.js";
package/lib/index.js CHANGED
@@ -18,6 +18,7 @@ import { scopeLifetime } from "./lifetime.js";
18
18
  import { runtimeAdmissionView, assertSupportedHostStartup } from "./runtime-integration.js";
19
19
  import { createCorePermissionAuthority } from "./core-permission-authority.js";
20
20
  import { installCorePermissions } from "./core-permissions.js";
21
+ import { CommandApprovals } from "./command-approval.js";
21
22
  import { registerRoleControlRpc } from "./role-control-rpc.js";
22
23
  import { nativeStandingFullAccess } from "./permission-native-access.js";
23
24
  import { DsmmProfileError } from "./profiles.js";
@@ -56,6 +57,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
56
57
  const ctx = input;
57
58
  const deployment = new DsmmDeploymentConfig(ctx, config);
58
59
  const lifetime = new AbortController();
60
+ const commandApprovals = new CommandApprovals(ctx);
59
61
  scopeLifetime(ctx, "dsmm: retire Core", () => lifetime.abort());
60
62
  let admission;
61
63
  const assert = (agent) => { lifetime.signal.throwIfAborted(); if (!admission)
@@ -145,7 +147,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
145
147
  return;
146
148
  }
147
149
  registerModelRouting(scope, controller, candidate);
148
- registerSafetyGuards(scope, controller, candidate, policy);
150
+ registerSafetyGuards(scope, controller, candidate, policy, commandApprovals);
149
151
  if (startup.settings.modules.deepwork.enabled) {
150
152
  if (ctx.get("subagents") !== undefined)
151
153
  await registerHeadlessRoleTools(scope, controller, candidate, policy, nativeAdmission, agent);
@@ -160,7 +162,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
160
162
  ctx.inject(["typert"], scope => { registerConfigRpc(scope, deployment, startup.settings, () => profiles, startup.sources, mountedPermission); new DsmmProfilesHost(scope, profiles); registerRoleControlRpc(scope, nativeAdmission); });
161
163
  const permissions = createCorePermissionAuthority(ctx, { getSettings, rolePolicy: policy, signal: lifetime.signal });
162
164
  const installPermissions = () => ctx.inject(["tools", ...(ctx.fiber.entry === undefined ? [] : ["settings"])], scope => {
163
- const installed = installCorePermissions(scope, deployment, permissions.authority, permissions.assertWritable);
165
+ const installed = installCorePermissions(scope, deployment, permissions.authority, permissions.assertWritable, commandApprovals);
164
166
  const identity = Reflect.get(installed, symbols.original) ?? installed;
165
167
  scopeLifetime(scope, "dsmm: release permission projection", () => { if (permissionOwner === identity)
166
168
  permissionOwner = undefined; }, () => { permissionOwner = identity; });
package/lib/lsp.js CHANGED
@@ -123,7 +123,7 @@ export function renderLspMcpPatch(input = {}) {
123
123
  const settings = resolveLspSettings(input);
124
124
  const lines = [
125
125
  "# Example only: opt-in dsmm LSP MCP bridge.",
126
- "# Requires ocmm-lsp to be on PATH or command to be replaced with an absolute wrapper path.",
126
+ "# Uses the ocmm-lsp executable published by the ocmm npm package; no LSP source or native build is bundled by DSMM.",
127
127
  "- insert:",
128
128
  " - id: dsmm-lsp-mcp",
129
129
  " name: '@deepseek-ai/dsh-mcp-client'",
@@ -3,6 +3,8 @@ import type { Agent } from "@deepseek-ai/dsh-agent";
3
3
  import type { PreToolDecision, ToolDefinition, ToolExecution, ToolRunContext } from "@deepseek-ai/dsh-tools";
4
4
  import type { NativeCommandEntry } from "./permission-settings.js";
5
5
  import type { NativePermissionMode } from "./permission-native-access.js";
6
+ import { CommandApprovals } from "./command-approval.js";
7
+ import type { CommandApprovalScope, CommandRuleContribution } from "./command-approval.js";
6
8
  export { PermissionRefusal } from "./permission-errors.js";
7
9
  export interface PermissionExecutionAuthority {
8
10
  readonly agent: Agent;
@@ -55,8 +57,9 @@ export declare class PermissionControl {
55
57
  private readonly bindings;
56
58
  private readonly requests;
57
59
  private readonly execution;
58
- constructor(ctx: Context, collaborators: PermissionControlCollaborators);
59
- compose(exec: Readonly<ToolExecution>, registration: PermissionRegistration, entry: NativeCommandEntry | undefined, action: "inherit" | "allow" | "ask", next: () => Promise<PreToolDecision>, cwd: string, simple?: boolean): Promise<PreToolDecision>;
60
+ readonly commandApprovals: CommandApprovals;
61
+ constructor(ctx: Context, collaborators: PermissionControlCollaborators, approvals?: CommandApprovals);
62
+ compose(exec: Readonly<ToolExecution>, registration: PermissionRegistration, entry: NativeCommandEntry | undefined, action: "inherit" | "allow" | "ask", next: () => Promise<PreToolDecision>, cwd: string, simple?: boolean, contributions?: readonly CommandRuleContribution[], source?: CommandApprovalScope): Promise<PreToolDecision>;
60
63
  private composeDecision;
61
64
  private checkIntegrity;
62
65
  guard(exec: Readonly<ToolExecution>): string | undefined;