@dsmm/dsmm 0.3.8 → 0.3.10

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 (124) hide show
  1. package/README.md +9 -5
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +6 -6
  3. package/agent-presets/dsmm-clarifier/agent.cordis.yml +10 -10
  4. package/agent-presets/dsmm-code-search/agent.cordis.yml +10 -10
  5. package/agent-presets/dsmm-coding/agent.cordis.yml +10 -10
  6. package/agent-presets/dsmm-complex/agent.cordis.yml +10 -10
  7. package/agent-presets/dsmm-creative/agent.cordis.yml +10 -10
  8. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +10 -10
  9. package/agent-presets/dsmm-deep/agent.cordis.yml +10 -10
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +10 -10
  11. package/agent-presets/dsmm-documenting/agent.cordis.yml +10 -10
  12. package/agent-presets/dsmm-frontend/agent.cordis.yml +10 -10
  13. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +10 -10
  14. package/agent-presets/dsmm-media-reader/agent.cordis.yml +10 -10
  15. package/agent-presets/dsmm-normal-task/agent.cordis.yml +10 -10
  16. package/agent-presets/dsmm-oracle/agent.cordis.yml +10 -10
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +10 -10
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +8 -8
  19. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +10 -10
  20. package/agent-presets/dsmm-planner/agent.cordis.yml +10 -10
  21. package/agent-presets/dsmm-quick/agent.cordis.yml +10 -10
  22. package/agent-presets/dsmm-research/agent.cordis.yml +10 -10
  23. package/agent-presets/dsmm-reviewer/agent.cordis.yml +10 -10
  24. package/docs/agent-presets.md +2 -2
  25. package/docs/compatibility.md +2 -2
  26. package/docs/deferred-native-approval-risk.md +1 -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 +25 -7
  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 +1 -1
  37. package/docs/settings-status.md +3 -1
  38. package/lib/client/DeploymentFields.js +9 -6
  39. package/lib/client/NativeCommandEntries.d.ts +6 -6
  40. package/lib/client/NativeCommandEntries.js +38 -37
  41. package/lib/client/PermissionRuleEntries.js +3 -1
  42. package/lib/client/children-locales.d.ts +1 -1
  43. package/lib/client/deployment-locales.d.ts +2 -0
  44. package/lib/client/deployment-locales.js +2 -0
  45. package/lib/client/permission-locales.d.ts +4 -0
  46. package/lib/client/permission-locales.js +12 -10
  47. package/lib/client/styles.d.ts +1 -1
  48. package/lib/client/styles.js +11 -0
  49. package/lib/client.js +179 -132
  50. package/lib/guards.d.ts +1 -1
  51. package/lib/guards.js +12 -21
  52. package/lib/lsp.js +1 -1
  53. package/lib/permission-control.d.ts +8 -2
  54. package/lib/permission-control.js +48 -14
  55. package/lib/permission-controller.d.ts +4 -0
  56. package/lib/permission-controller.js +142 -7
  57. package/lib/permission-native-command.d.ts +5 -1
  58. package/lib/permission-native-command.js +35 -5
  59. package/lib/permission-native-rules.d.ts +3 -2
  60. package/lib/permission-native-rules.js +9 -4
  61. package/lib/permission-settings.d.ts +31 -1
  62. package/lib/permission-settings.js +24 -3
  63. package/lib/permission-shell.d.ts +1 -1
  64. package/lib/permission-shell.js +2 -2
  65. package/lib/roles.js +2 -2
  66. package/lib/settings.js +2 -2
  67. package/package.json +38 -38
  68. package/patches/ocmm-lsp-mcp.example.cordis.patch.yml +1 -1
  69. package/prompts/deepwork.md +2 -2
  70. package/prompts/source/shared/dsh-host-contract.md +2 -2
  71. package/prompts/source/shared/locale.md +2 -2
  72. package/prompts/source/terminal/builder.md +2 -2
  73. package/prompts/source/terminal/clarifier.md +6 -6
  74. package/prompts/source/terminal/code-search.md +6 -6
  75. package/prompts/source/terminal/coding.md +6 -6
  76. package/prompts/source/terminal/complex.md +6 -6
  77. package/prompts/source/terminal/creative.md +6 -6
  78. package/prompts/source/terminal/cross-cutting.md +6 -6
  79. package/prompts/source/terminal/deep.md +6 -6
  80. package/prompts/source/terminal/doc-search.md +6 -6
  81. package/prompts/source/terminal/documenting.md +6 -6
  82. package/prompts/source/terminal/frontend.md +6 -6
  83. package/prompts/source/terminal/hard-reasoning.md +6 -6
  84. package/prompts/source/terminal/media-reader.md +6 -6
  85. package/prompts/source/terminal/normal-task.md +6 -6
  86. package/prompts/source/terminal/oracle-2nd.md +6 -6
  87. package/prompts/source/terminal/oracle.md +6 -6
  88. package/prompts/source/terminal/orchestrator.md +4 -4
  89. package/prompts/source/terminal/plan-critic.md +6 -6
  90. package/prompts/source/terminal/planner.md +6 -6
  91. package/prompts/source/terminal/quick.md +6 -6
  92. package/prompts/source/terminal/research.md +6 -6
  93. package/prompts/source/terminal/reviewer.md +6 -6
  94. package/skills/ast-grep/SKILL.md +3 -3
  95. package/skills/ast-grep/SOURCE +1 -1
  96. package/skills/ast-grep/install.ps1 +1 -1
  97. package/skills/ast-grep/install.sh +1 -1
  98. package/skills/ast-grep/scripts/ast_grep_helper.py +10 -10
  99. package/skills/ast-grep/tests/smoke.sh +11 -11
  100. package/skills/ast-grep/tests/test_resolver.py +4 -23
  101. package/skills/brainstorming/SKILL.md +3 -3
  102. package/skills/coding-agent-sessions/NOTICE.md +2 -2
  103. package/skills/coding-agent-sessions/SKILL.md +3 -3
  104. package/skills/debugging/SKILL.md +3 -3
  105. package/skills/debugging/references/methodology/03-flaky-triage.md +1 -1
  106. package/skills/debugging/references/scripts/dap.mjs +3 -3
  107. package/skills/debugging/references/tools/playwright-cli.md +3 -3
  108. package/skills/dispatching-parallel-agents/SKILL.md +3 -3
  109. package/skills/frontend/ATTRIBUTION.md +4 -4
  110. package/skills/frontend/SKILL.md +3 -3
  111. package/skills/frontend/references/perfection/README.md +4 -4
  112. package/skills/frontend/references/perfection/react-perf-tooling.md +4 -4
  113. package/skills/git-master/SKILL.md +3 -3
  114. package/skills/git-master/agents/openai.yaml +1 -1
  115. package/skills/init-deep/SKILL.md +3 -3
  116. package/skills/receiving-code-review/SKILL.md +3 -3
  117. package/skills/remove-ai-slops/SKILL.md +3 -3
  118. package/skills/requesting-code-review/SKILL.md +3 -3
  119. package/skills/subagent-driven-development/SKILL.md +3 -3
  120. package/skills/using-git-worktrees/SKILL.md +4 -4
  121. package/skills/writing-plans/SKILL.md +3 -3
  122. package/docs/migration-from-ocmm.md +0 -57
  123. package/docs/skill-sync.md +0 -94
  124. package/prompts/source/manifest.json +0 -3168
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;
@@ -2601,6 +2601,17 @@ function parseNativeCommandPattern(input) {
2601
2601
  if (subcommands.some((value) => value.length === 0 || /[^\p{L}\p{M}\p{N}_./:=+%\-]/u.test(value))) throw new PermissionRefusal("validation");
2602
2602
  return Object.freeze({ executable: tokens[0], subcommands: Object.freeze(subcommands) });
2603
2603
  }
2604
+ function parseSimpleCommandPattern(input) {
2605
+ if (typeof input !== "string" || input.length > 32768) throw new PermissionRefusal("validation");
2606
+ const tokens = input.replace(/^[ \t]+|[ \t]+$/gu, "").split(/[ \t]+/u);
2607
+ if (tokens.at(-1) === "*") tokens.pop();
2608
+ if (!tokens.length) throw new PermissionRefusal("validation");
2609
+ return Object.freeze(tokens.map((token, index) => {
2610
+ const values = index === 1 ? token.split("|") : [token];
2611
+ if (values.some((value) => !value.length || /[^\p{L}\p{M}\p{N}_./:=+%\\\-]/u.test(value))) throw new PermissionRefusal("validation");
2612
+ return Object.freeze(values);
2613
+ }));
2614
+ }
2604
2615
  function parseNativeCommands(input = {}) {
2605
2616
  const row = permissionRuleRow(input, [], ["enabled", "entries"]);
2606
2617
  if (row.enabled !== void 0 && typeof row.enabled !== "boolean" || row.entries !== void 0 && (!Array.isArray(row.entries) || row.entries.length > 1024)) throw new PermissionRefusal("validation");
@@ -2610,6 +2621,10 @@ function parseNativeCommands(input = {}) {
2610
2621
  };
2611
2622
  const ids = /* @__PURE__ */ new Set();
2612
2623
  const entries = (row.entries ?? []).map((value) => {
2624
+ if (typeof value === "string") {
2625
+ parseSimpleCommandPattern(value);
2626
+ return value;
2627
+ }
2613
2628
  const entry = permissionRuleRow(value, ["id", "mode", "match", "sandboxMode"]);
2614
2629
  const match = permissionRuleRow(entry.match, ["tool", "workingDirectory", "commandPattern"]);
2615
2630
  const id2 = text5(entry.id), cwd = text5(match.workingDirectory);
@@ -2622,12 +2637,13 @@ function parseNativeCommands(input = {}) {
2622
2637
  return Object.freeze({ enabled: row.enabled ?? false, entries: Object.freeze(entries) });
2623
2638
  }
2624
2639
  var nativeCommandMatchSchema = Schema.object({ tool: Schema.union(["bash", "pwsh"]).required(), workingDirectory: Schema.string().required(), commandPattern: Schema.string().required() }).required();
2625
- var nativeCommands = Schema.object({ enabled: Schema.boolean().default(false), entries: Schema.array(Schema.object({
2640
+ var nativeCommandEntrySchema = Schema.object({
2626
2641
  id: Schema.string().required(),
2627
2642
  mode: Schema.union(["ask", "allow"]).required(),
2628
2643
  match: nativeCommandMatchSchema,
2629
2644
  sandboxMode: Schema.union(["workspace-write", "danger-full-access"]).required()
2630
- })).default([]) });
2645
+ }).required();
2646
+ var nativeCommands = Schema.object({ enabled: Schema.boolean().default(false), entries: Schema.array(Schema.union([Schema.string(), nativeCommandEntrySchema])).default([]) });
2631
2647
  var webDefault = Object.freeze({ enabled: true, rule: "inherit" });
2632
2648
  var DEFAULT_PERMISSION_CONTROL = Object.freeze({ enabled: true, outsideReads: "inherit", webSearch: webDefault, webFetch: webDefault, rules: Object.freeze([]), nativeCommands: parseNativeCommands() });
2633
2649
  var action = () => Schema.union(["inherit", "allow", "ask", "deny"]).default("inherit");
@@ -5483,6 +5499,17 @@ var PROFILE_STYLES = `
5483
5499
  .dsmm-children .dsmm-child-meta dt{font-weight:500;overflow-wrap:anywhere}
5484
5500
  .dsmm-children .dsmm-child-meta dd{margin:0;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
5485
5501
  .dsmm-children textarea.dsmm-child-message{font-family:var(--dsw-font-family);white-space:pre-wrap;overflow-wrap:anywhere}
5502
+ .dsmm-profiles .dsmm-command-entry{min-width:0;display:flex;flex-direction:column;gap:6px}
5503
+ .dsmm-profiles .dsmm-command-entry .dsmm-actions{display:flex;align-items:center;gap:8px}
5504
+ .dsmm-profiles .dsmm-command-entry .dsmm-input{flex:1 1 auto;min-width:0}
5505
+ .dsmm-profiles .dsmm-command-summary{display:flex;align-items:center;gap:8px;flex:1 1 auto;min-width:0;overflow-wrap:anywhere}
5506
+ .dsmm-profiles .dsmm-command-summary code{font-family:var(--ds-font-family-code);font-size:13px;color:var(--dsw-alias-label-primary)}
5507
+ .dsmm-profiles .dsmm-legacy-badge{display:inline-flex;align-items:center;padding:2px 6px;font-size:11px;font-weight:600;line-height:16px;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);text-transform:uppercase;letter-spacing:0.5px}
5508
+ .dsmm-profiles .dsmm-legacy-details{padding:4px 0}
5509
+ .dsmm-profiles .dsmm-legacy-details summary{font-size:12px;color:var(--dsw-alias-label-secondary);min-height:24px;line-height:24px}
5510
+ .dsmm-profiles .dsmm-kv{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;margin:4px 0 0;font-size:12px}
5511
+ .dsmm-profiles .dsmm-kv dt{font-weight:500;color:var(--dsw-alias-label-secondary)}
5512
+ .dsmm-profiles .dsmm-kv dd{margin:0;color:var(--dsw-alias-label-primary);font-family:var(--ds-font-family-code)}
5486
5513
  @media(prefers-reduced-motion:reduce){.dsmm-profiles *{transition:none!important;animation:none!important}}
5487
5514
  `;
5488
5515
 
@@ -6050,6 +6077,8 @@ var deploymentEn = {
6050
6077
  unsetGroup: "Use defaults for this group",
6051
6078
  unitBytes: "bytes",
6052
6079
  unitChars: "characters",
6080
+ useDefaults: "Use defaults",
6081
+ restoreInheritance: "Restore inheritance",
6053
6082
  nativeRuntimeState: "Observed native runtime",
6054
6083
  nativeRuntimeBinding: "Observed runtime composition",
6055
6084
  nativeRuntimeFence: "Execution admission ready",
@@ -6151,6 +6180,8 @@ var deploymentZh = {
6151
6180
  unsetGroup: "整组使用默认配置",
6152
6181
  unitBytes: "字节",
6153
6182
  unitChars: "字符",
6183
+ useDefaults: "使用默认值",
6184
+ restoreInheritance: "恢复继承",
6154
6185
  nativeRuntimeState: "已观测原生运行时",
6155
6186
  nativeRuntimeBinding: "已观测运行时组合",
6156
6187
  nativeRuntimeFence: "执行准入已就绪",
@@ -6326,7 +6357,7 @@ var permissionEn = {
6326
6357
  unitBytes: "bytes",
6327
6358
  unitChars: "characters",
6328
6359
  nativeCommands: "Command rules",
6329
- nativeCommandsHint: "Default Off. New entries use Ask and workspace-write; other permission limits still apply.",
6360
+ nativeCommandsHint: "Matching commands and programs they launch automatically receive full access for this invocation, including OS-permitted paths outside the workspace.",
6330
6361
  registrationUnresolved: "Executor identity unconfirmed; verify tool, executable, environment and sandbox.",
6331
6362
  entryId: "Entry ID",
6332
6363
  tool: "Tool",
@@ -6338,10 +6369,14 @@ var permissionEn = {
6338
6369
  unset: "Unset — restore inheritance",
6339
6370
  inheritedEntries: "Inherited entries; editing pins a replacement array in this layer.",
6340
6371
  explicitEntries: "Explicit replacement array in this layer.",
6341
- invalidEntry: "Invalid entry: IDs must be unique and nonblank, pattern valid, working directory absolute. Draft retained; Save locked.",
6342
- pattern: "Command pattern",
6343
- patternHint: "Example: go build|test *. With or without *, any trailing arguments (including program scripts) are allowed. No character glob, regex or path grants.",
6344
- invalidPattern: "Invalid pattern: one executable and the subcommand position only, space-separated. Pipe alternatives must be nonblank literals; * may only be the final token.",
6372
+ invalidEntry: "Invalid entry. Draft retained; Save locked.",
6373
+ pattern: "Command",
6374
+ patternHint: "Matching commands execute with full access automatically.",
6375
+ invalidPattern: "Enter an exact command or prefix (e.g. git, git status, go test)",
6376
+ useDefaults: "Use defaults",
6377
+ restoreInheritance: "Restore inheritance",
6378
+ legacyEntry: "Legacy rule",
6379
+ legacyDetails: "Rule constraints",
6345
6380
  restrictedFullAccess: "danger-full-access — retained from the saved value; not offered here",
6346
6381
  rulesUnavailable: "Editing requires an open main session, local editing permission and synced rules. Check profile overrides, then reconnect and refresh.",
6347
6382
  configRules: "Imported configuration rules",
@@ -6481,7 +6516,7 @@ var permissionZh = {
6481
6516
  unitBytes: "字节",
6482
6517
  unitChars: "字符",
6483
6518
  nativeCommands: "命令规则",
6484
- nativeCommandsHint: "默认关闭;新条目使用询问与 workspace-write,仍受其他权限限制。",
6519
+ nativeCommandsHint: "匹配命令及其启动的程序,本次自动获 full access,可访问操作系统允许的工作区外路径。",
6485
6520
  registrationUnresolved: "执行器身份未确认;请先核验工具、可执行程序、环境与沙箱。",
6486
6521
  entryId: "条目 ID",
6487
6522
  tool: "工具",
@@ -6493,10 +6528,14 @@ var permissionZh = {
6493
6528
  unset: "Unset——恢复继承",
6494
6529
  inheritedEntries: "继承的条目;编辑后在此层固定为整体替换数组。",
6495
6530
  explicitEntries: "此层显式整体替换数组。",
6496
- invalidEntry: "条目无效:ID 需唯一非空、模式有效、工作目录为绝对路径。草稿保留,保存已锁定。",
6497
- pattern: "命令模式",
6498
- patternHint: "例:go build|test *。省略 * 也允许任意后续参数(含程序脚本);不支持字符通配或正则,也不授予路径权限。",
6499
- invalidPattern: "模式无效:仅一个可执行程序与子命令位置,以空格分隔。竖线备选须为非空字面量,* 只能是最后一个 token。",
6531
+ invalidEntry: "条目无效。草稿保留,保存已锁定。",
6532
+ pattern: "命令",
6533
+ patternHint: "匹配命令自动以 full access 执行。",
6534
+ invalidPattern: "请输入确切命令或前缀(例如 git、git status、go test)",
6535
+ useDefaults: "使用默认值",
6536
+ restoreInheritance: "恢复继承",
6537
+ legacyEntry: "旧版规则",
6538
+ legacyDetails: "限制范围",
6500
6539
  restrictedFullAccess: "danger-full-access——保留自已保存的值,此处不提供创建",
6501
6540
  rulesUnavailable: "编辑需要已打开的主会话、本地编辑权限与已同步规则。请检查配置覆盖,再重连刷新。",
6502
6541
  configRules: "导入的配置规则",
@@ -6598,96 +6637,90 @@ function validNativeEntries(entries) {
6598
6637
  return false;
6599
6638
  }
6600
6639
  }
6601
- function emptyNativeEntry() {
6602
- return { id: "", mode: "ask", sandboxMode: "workspace-write", match: { tool: "bash", workingDirectory: "", commandPattern: "" } };
6603
- }
6604
- function patternValid(value) {
6640
+ function validNativeRule(rule) {
6605
6641
  try {
6606
- parseNativeCommandPattern(value);
6642
+ parseNativeCommands({ entries: [rule] });
6607
6643
  return true;
6608
6644
  } catch {
6609
6645
  return false;
6610
6646
  }
6611
6647
  }
6612
- function TextField({ id: id2, label, value, disabled, onChange }) {
6613
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field", children: [
6614
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: id2, children: label }),
6615
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Input, { className: "dsmm-input", id: id2, value, maxLength: 32768, disabled, required: true, onChange: (event) => onChange(event.currentTarget.value) })
6648
+ function LegacyEntry({ entry, index, disabled, remove, t }) {
6649
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field dsmm-command-entry dsmm-legacy-entry", children: [
6650
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-actions", children: [
6651
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-command-summary", children: [
6652
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "dsmm-legacy-badge", children: t("legacyEntry") }),
6653
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: entry.match.commandPattern || entry.id })
6654
+ ] }),
6655
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled, onClick: remove, children: [
6656
+ t("removeEntry"),
6657
+ " ",
6658
+ index + 1
6659
+ ] })
6660
+ ] }),
6661
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { className: "dsmm-legacy-details", children: [
6662
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
6663
+ t("legacyDetails"),
6664
+ ": ",
6665
+ entry.id
6666
+ ] }),
6667
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("dl", { className: "dsmm-kv", children: [
6668
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: t("tool") }),
6669
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: entry.match.tool }),
6670
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: t("cwd") }),
6671
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: entry.match.workingDirectory || "(any)" }),
6672
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: t("mode") }),
6673
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: t(`action:${entry.mode}`) || entry.mode }),
6674
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: t("sandboxMode") }),
6675
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: entry.sandboxMode })
6676
+ ] })
6677
+ ] })
6616
6678
  ] });
6617
6679
  }
6618
- function Pattern({ value, controller, name: name2, disabled, onChange, t }) {
6619
- const state = (0, import_react5.useSyncExternalStore)(controller.subscribe, controller.getSnapshot), id2 = (0, import_react5.useId)(), raw = state.raw[name2], text5 = raw?.text ?? value, bad = raw?.invalid === true;
6620
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field", children: [
6680
+ function StringEntry({ value, index, controller, disabled, change, remove, t }) {
6681
+ const id2 = (0, import_react5.useId)(), row = `${ENTRIES_PATH}.${index}`;
6682
+ const state = (0, import_react5.useSyncExternalStore)(controller.subscribe, controller.getSnapshot);
6683
+ const raw = state.raw[row];
6684
+ const text5 = raw?.text ?? value;
6685
+ const bad = raw?.invalid === true || raw === void 0 && !validNativeRule(value);
6686
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field dsmm-command-entry", children: [
6621
6687
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `${id2}-pattern`, children: t("pattern") }),
6622
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Input, { className: "dsmm-input", id: `${id2}-pattern`, value: text5, maxLength: 32768, disabled, required: true, "aria-invalid": bad, "aria-describedby": bad ? `${id2}-error` : void 0, spellCheck: false, autoComplete: "off", onChange: (event) => {
6623
- const next = event.currentTarget.value, valid = patternValid(next);
6624
- controller.setRaw(name2, next, !valid);
6625
- if (valid) onChange(next);
6626
- } }),
6627
- bad && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: `${id2}-error`, className: "dsmm-hint", children: t("invalidPattern") })
6628
- ] });
6629
- }
6630
- function Entry({ entry, index, controller, disabled, change, remove, t }) {
6631
- const id2 = (0, import_react5.useId)(), match = entry.match, row = `${ENTRIES_PATH}.${index}`;
6632
- const valid = validNativeEntries([entry]);
6633
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { "aria-describedby": !valid ? `${id2}-error` : void 0, children: [
6634
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("legend", { children: [
6635
- t("nativeCommands"),
6636
- " ",
6637
- index + 1
6638
- ] }),
6639
- !valid && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", id: `${id2}-error`, children: t("invalidEntry") }),
6640
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextField, { id: `${id2}-id`, label: t("entryId"), value: entry.id, disabled, onChange: (value) => change({ ...entry, id: value }) }),
6641
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field", children: [
6642
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `${id2}-tool`, children: t("tool") }),
6643
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("select", { id: `${id2}-tool`, disabled, value: match.tool, onChange: (event) => {
6644
- const tool = event.currentTarget.value;
6645
- if (tool === "bash" || tool === "pwsh") change({ ...entry, match: { ...match, tool } });
6646
- }, children: ["bash", "pwsh"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value, children: value }, value)) })
6647
- ] }),
6648
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6649
- Pattern,
6650
- {
6651
- value: match.commandPattern,
6652
- controller,
6653
- name: `${row}.commandPattern`,
6654
- disabled,
6655
- t,
6656
- onChange: (commandPattern) => change({ ...entry, match: { ...match, commandPattern } })
6657
- }
6658
- ),
6659
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextField, { id: `${id2}-workingDirectory`, label: t("cwd"), value: match.workingDirectory, disabled, onChange: (workingDirectory) => change({ ...entry, match: { ...match, workingDirectory } }) }),
6660
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field", children: [
6661
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `${id2}-sandbox`, children: t("sandboxMode") }),
6662
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { id: `${id2}-sandbox`, disabled, value: entry.sandboxMode, onChange: (event) => {
6663
- if (event.currentTarget.value === "workspace-write") change({ ...entry, sandboxMode: "workspace-write" });
6664
- }, children: [
6665
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "workspace-write", children: "workspace-write" }),
6666
- entry.sandboxMode === "danger-full-access" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "danger-full-access", disabled: true, children: t("restrictedFullAccess") })
6667
- ] })
6668
- ] }),
6669
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-field", children: [
6670
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `${id2}-mode`, children: t("mode") }),
6671
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("select", { id: `${id2}-mode`, disabled, value: entry.mode, onChange: (event) => {
6672
- const mode = event.currentTarget.value;
6673
- if (mode === "ask" || mode === "allow") change({ ...entry, mode });
6674
- }, children: [
6675
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "ask", children: t("action:ask") }),
6676
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "allow", children: t("action:allow") })
6688
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-actions", children: [
6689
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6690
+ import_dsh_client_ui_primitives5.Input,
6691
+ {
6692
+ className: "dsmm-input",
6693
+ id: `${id2}-pattern`,
6694
+ value: text5,
6695
+ maxLength: 32768,
6696
+ disabled,
6697
+ required: true,
6698
+ "aria-invalid": bad,
6699
+ "aria-describedby": bad ? `${id2}-error` : void 0,
6700
+ spellCheck: false,
6701
+ autoComplete: "off",
6702
+ onChange: (event) => {
6703
+ const next = event.currentTarget.value;
6704
+ const valid = validNativeRule(next);
6705
+ controller.setRaw(row, next, !valid);
6706
+ change(next);
6707
+ }
6708
+ }
6709
+ ),
6710
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled, onClick: remove, children: [
6711
+ t("removeEntry"),
6712
+ " ",
6713
+ index + 1
6677
6714
  ] })
6678
6715
  ] }),
6679
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled, onClick: remove, children: [
6680
- t("removeEntry"),
6681
- " ",
6682
- index + 1
6683
- ] })
6716
+ bad && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: `${id2}-error`, className: "dsmm-hint", children: t("invalidPattern") })
6684
6717
  ] });
6685
6718
  }
6686
6719
  function NativeCommandEntries({ value, inherited, controller, disabled, onChange, setInvalid, t }) {
6687
6720
  const entries = value ?? inherited, name2 = ENTRIES_PATH;
6688
6721
  const state = (0, import_react5.useSyncExternalStore)(controller.subscribe, controller.getSnapshot);
6689
- const invalidRows = state.invalidFields.filter((path) => path.startsWith(`${name2}.`) && path.endsWith(".commandPattern"));
6690
- const valid = validNativeEntries(entries);
6722
+ const invalidRows = state.invalidFields.filter((path) => path === name2 || path.startsWith(`${name2}.`));
6723
+ const valid = validNativeEntries(entries) && invalidRows.length === 0;
6691
6724
  const change = (next) => {
6692
6725
  setInvalid(name2, !validNativeEntries(next ?? inherited));
6693
6726
  onChange(next);
@@ -6695,15 +6728,25 @@ function NativeCommandEntries({ value, inherited, controller, disabled, onChange
6695
6728
  const remove = (index) => {
6696
6729
  const drafts = Object.entries(state.raw).flatMap(([path, draft2]) => {
6697
6730
  if (!path.startsWith(`${name2}.`)) return [];
6698
- const [row, ...field] = path.slice(name2.length + 1).split(".");
6731
+ const remainder = path.slice(name2.length + 1);
6732
+ const dotIndex = remainder.indexOf(".");
6733
+ const row = dotIndex === -1 ? remainder : remainder.slice(0, dotIndex);
6734
+ const subPath = dotIndex === -1 ? "" : remainder.slice(dotIndex);
6699
6735
  const position = Number(row);
6700
- if (!Number.isInteger(position) || field.length === 0 || position === index) return [];
6701
- return [{ path: `${name2}.${position > index ? position - 1 : position}.${field.join(".")}`, draft: draft2 }];
6736
+ if (!Number.isInteger(position) || position === index) return [];
6737
+ return [{ path: `${name2}.${position > index ? position - 1 : position}${subPath}`, draft: draft2 }];
6702
6738
  });
6703
6739
  controller.clearRaw(name2);
6704
6740
  for (const draft2 of drafts) controller.setRaw(draft2.path, draft2.draft.text, draft2.draft.invalid);
6705
6741
  change(entries.filter((_, position) => position !== index));
6706
6742
  };
6743
+ const add = () => {
6744
+ const nextIndex = entries.length;
6745
+ controller.setRaw(`${name2}.${nextIndex}`, "", true);
6746
+ change([...entries, ""]);
6747
+ };
6748
+ const isGlobal = controller.layer === "global";
6749
+ const unsetLabel = isGlobal ? t("useDefaults") || "Use defaults" : t("restoreInheritance") || "Restore inheritance";
6707
6750
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { className: "dsmm-deployment-group", children: [
6708
6751
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("summary", { children: [
6709
6752
  t("nativeCommands"),
@@ -6712,16 +6755,12 @@ function NativeCommandEntries({ value, inherited, controller, disabled, onChange
6712
6755
  ] }),
6713
6756
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-structured", children: [
6714
6757
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", children: t("nativeCommandsHint") }),
6715
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", children: t("patternHint") }),
6716
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", children: t("registrationUnresolved") }),
6717
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", children: t(value === void 0 ? "inheritedEntries" : "explicitEntries") }),
6718
6758
  !valid && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-issue", role: "alert", children: t("invalidEntry") }),
6719
- invalidRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dsmm-hint", children: t("invalidPatternHint") }),
6720
6759
  entries.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: t("noEntries") }),
6721
- entries.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6722
- Entry,
6760
+ entries.map((entry, index) => typeof entry === "string" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6761
+ StringEntry,
6723
6762
  {
6724
- entry,
6763
+ value: entry,
6725
6764
  index,
6726
6765
  controller,
6727
6766
  disabled,
@@ -6730,13 +6769,33 @@ function NativeCommandEntries({ value, inherited, controller, disabled, onChange
6730
6769
  remove: () => remove(index)
6731
6770
  },
6732
6771
  index
6772
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6773
+ LegacyEntry,
6774
+ {
6775
+ entry,
6776
+ index,
6777
+ disabled,
6778
+ t,
6779
+ remove: () => remove(index)
6780
+ },
6781
+ index
6733
6782
  )),
6734
6783
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "dsmm-actions", children: [
6735
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled: disabled || entries.length >= 1024, onClick: () => change([...entries, emptyNativeEntry()]), children: t("addEntry") }),
6736
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", "data-dsmm-unset": name2, disabled: disabled || value === void 0 && invalidRows.length === 0, onClick: () => {
6737
- controller.clearRaw(name2);
6738
- change(void 0);
6739
- }, children: t("unset") })
6784
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives5.Button, { type: "button", variant: "outline", disabled: disabled || entries.length >= 1024, onClick: add, children: t("addEntry") }),
6785
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
6786
+ import_dsh_client_ui_primitives5.Button,
6787
+ {
6788
+ type: "button",
6789
+ variant: "outline",
6790
+ "data-dsmm-unset": name2,
6791
+ disabled: disabled || value === void 0 && invalidRows.length === 0,
6792
+ onClick: () => {
6793
+ controller.clearRaw(name2);
6794
+ change(void 0);
6795
+ },
6796
+ children: unsetLabel
6797
+ }
6798
+ )
6740
6799
  ] })
6741
6800
  ] })
6742
6801
  ] });
@@ -6836,6 +6895,8 @@ function PermissionRuleEntries({ value, inherited, controller, disabled, onChang
6836
6895
  };
6837
6896
  const remove = (index) => change(entries.filter((_, position) => position !== index));
6838
6897
  const held = disabled || locked;
6898
+ const isGlobal = controller.layer === "global";
6899
+ const unsetLabel = isGlobal ? t("useDefaults") : t("restoreInheritance");
6839
6900
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("details", { className: "dsmm-deployment-group", "data-field": name, open: expanded, onToggle: (event) => onExpandedChange?.(event.currentTarget.open), children: [
6840
6901
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("summary", { children: [
6841
6902
  t("configRules"),
@@ -6844,7 +6905,6 @@ function PermissionRuleEntries({ value, inherited, controller, disabled, onChang
6844
6905
  ] }),
6845
6906
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dsmm-structured", children: [
6846
6907
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "dsmm-hint", children: t("configRulesHint") }),
6847
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "dsmm-hint", children: t(value === void 0 ? "inheritedRules" : "explicitRules") }),
6848
6908
  !valid && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "dsmm-issue", role: "alert", children: t("invalidRule") }),
6849
6909
  entries.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: t("configRulesEmpty") }),
6850
6910
  entries.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
@@ -6864,7 +6924,7 @@ function PermissionRuleEntries({ value, inherited, controller, disabled, onChang
6864
6924
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives6.Button, { type: "button", variant: "outline", "data-dsmm-unset": name, disabled: disabled || value === void 0 && raw === void 0, onClick: () => {
6865
6925
  controller.clearRaw(name);
6866
6926
  onChange(void 0);
6867
- }, children: t("unset") })
6927
+ }, children: unsetLabel })
6868
6928
  ] }),
6869
6929
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("details", { children: [
6870
6930
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("summary", { id: `${id2}-advanced-label`, children: t("advancedRules") }),
@@ -6922,6 +6982,7 @@ function displayValue(value, t) {
6922
6982
  function AdvancedField({ schema, path, controller, inherited, upper, expanded, onExpandedChange, t }) {
6923
6983
  const state = (0, import_react7.useSyncExternalStore)(controller.subscribe, controller.getSnapshot), id2 = (0, import_react7.useId)(), name2 = path.join(".");
6924
6984
  const value = at(state.draft, path), raw = state.raw[name2], text5 = raw?.text ?? (value === void 0 ? "" : JSON.stringify(value, null, 2)), invalid2 = raw?.invalid === true;
6985
+ const unsetLabel = controller.layer === "global" ? t("useDefaults") : t("restoreInheritance");
6925
6986
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "dsmm-deployment-group", "data-field": name2, open: expanded, onToggle: (event) => onExpandedChange?.(event.currentTarget.open), children: [
6926
6987
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { id: `${id2}-label`, children: [
6927
6988
  fieldLabel(path, t),
@@ -6931,12 +6992,6 @@ function AdvancedField({ schema, path, controller, inherited, upper, expanded, o
6931
6992
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "dsmm-field", children: [
6932
6993
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", id: `${id2}-hint`, children: t("advancedHint") }),
6933
6994
  path[0] === "permissionControl" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: permissionText(t)("configRulesHint") }),
6934
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: t(value === void 0 ? "inherit" : "explicit") }),
6935
- upper !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "dsmm-hint", children: [
6936
- t("profileSource"),
6937
- ": ",
6938
- displayValue(upper, t)
6939
- ] }),
6940
6995
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("textarea", { id: id2, rows: 6, maxLength: 32768, value: text5, disabled: !controller.canEdit(), "aria-labelledby": `${id2}-label`, "aria-invalid": invalid2, "aria-describedby": `${id2}-hint ${id2}-error`, onChange: (event) => {
6941
6996
  const next = event.currentTarget.value;
6942
6997
  let parsed, valid = true;
@@ -6954,7 +7009,7 @@ function AdvancedField({ schema, path, controller, inherited, upper, expanded, o
6954
7009
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dsh_client_ui_primitives7.Button, { type: "button", variant: "outline", "data-dsmm-unset": name2, disabled: !controller.canEdit() || value === void 0 && raw === void 0, onClick: () => {
6955
7010
  controller.clearRaw(name2);
6956
7011
  controller.edit(path, void 0);
6957
- }, children: t("unset") }),
7012
+ }, children: unsetLabel }),
6958
7013
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { children: [
6959
7014
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("summary", { children: t("inherit") }),
6960
7015
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { children: JSON.stringify(inherited, null, 2) })
@@ -6970,6 +7025,7 @@ function ScalarField({ schema, path, controller, inherited, t }) {
6970
7025
  const state = (0, import_react7.useSyncExternalStore)(controller.subscribe, controller.getSnapshot), id2 = (0, import_react7.useId)(), name2 = path.join(".");
6971
7026
  const value = at(state.draft, path), raw = state.raw[name2], bad = raw?.invalid === true;
6972
7027
  const units = name2 === "guards.toolOutputTruncation.maxInlineBytes" ? ` · ${permissionText(t)("unitBytes")}` : name2 === "guards.questionLabelHelper.maxLabelChars" ? ` · ${permissionText(t)("unitChars")}` : "";
7028
+ const unsetLabel = controller.layer === "global" ? t("useDefaults") : t("restoreInheritance");
6973
7029
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
6974
7030
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { htmlFor: id2, children: fieldLabel(path, t) }),
6975
7031
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "dsmm-actions", children: [
@@ -6982,7 +7038,7 @@ function ScalarField({ schema, path, controller, inherited, t }) {
6982
7038
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dsh_client_ui_primitives7.Button, { type: "button", variant: "outline", "data-dsmm-unset": name2, disabled: !controller.canEdit() || value === void 0 && raw === void 0, onClick: () => {
6983
7039
  controller.clearRaw(name2);
6984
7040
  controller.edit(path, void 0);
6985
- }, children: t("unset") })
7041
+ }, children: unsetLabel })
6986
7042
  ] }),
6987
7043
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { id: `${id2}-error`, className: "dsmm-hint", children: [
6988
7044
  bad ? t("invalid") : "",
@@ -6999,6 +7055,7 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
6999
7055
  disclosures?.set(name2, expanded);
7000
7056
  setOpen(expanded);
7001
7057
  };
7058
+ const unsetLabel = controller.layer === "global" ? t("useDefaults") : t("restoreInheritance");
7002
7059
  const unsetGroup = (event) => {
7003
7060
  event?.preventDefault();
7004
7061
  event?.stopPropagation();
@@ -7023,11 +7080,10 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
7023
7080
  if (schema.type === "object" && schema.fields !== void 0 && path[0] !== "roleRouting") return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "dsmm-deployment-group", "data-field": name2, open, onToggle: (event) => expand(event.currentTarget.open), children: [
7024
7081
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("summary", { className: "dsmm-group-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "dsmm-group-summary", children: [
7025
7082
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "dsmm-group-summary-label", children: fieldLabel(path, t) }),
7026
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dsh_client_ui_primitives7.Button, { type: "button", variant: "outline", className: "dsmm-group-summary-action", "data-dsmm-unset": name2, hidden: !open, disabled: disabled || explicit === void 0 && !Object.keys(state.raw).some((key) => key === name2 || key.startsWith(`${name2}.`)), onClick: unsetGroup, children: t("unsetGroup") })
7083
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dsh_client_ui_primitives7.Button, { type: "button", variant: "outline", className: "dsmm-group-summary-action", "data-dsmm-unset": name2, hidden: !open, disabled: disabled || explicit === void 0 && !Object.keys(state.raw).some((key) => key === name2 || key.startsWith(`${name2}.`)), onClick: unsetGroup, children: unsetLabel })
7027
7084
  ] }) }),
7028
7085
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
7029
7086
  name2 === "permissionControl" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: permissionText(t)("configPolicyHint") }),
7030
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: t(explicit === void 0 ? "inherit" : "explicit") }),
7031
7087
  Object.entries(schema.fields).map(([key, node]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Field, { schema: node, path: [...path, key], controller, disclosures, t }, key))
7032
7088
  ] })
7033
7089
  ] });
@@ -7036,21 +7092,12 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
7036
7092
  schema.type === "boolean" || choices !== null ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
7037
7093
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { htmlFor: id2, children: fieldLabel(path, t) }),
7038
7094
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { id: id2, disabled, value: explicit === void 0 ? "inherit" : JSON.stringify(explicit), onChange: (event) => controller.edit(path, event.currentTarget.value === "inherit" ? void 0 : JSON.parse(event.currentTarget.value)), children: [
7039
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "inherit", children: `${t("unset")} · ${displayValue(inherited, t)}` }),
7095
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "inherit", children: `${unsetLabel} · ${displayValue(inherited, t)}` }),
7040
7096
  (choices ?? [true, false]).map((choice2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: JSON.stringify(choice2), children: displayValue(choice2, t) }, String(choice2)))
7041
7097
  ] })
7042
7098
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScalarField, { schema, path, controller, inherited, t }),
7043
7099
  name2 === "modelParameters.passthrough" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: t("modelParametersHint") }),
7044
- name2 === "permissionControl.enabled" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") }),
7045
- explicit !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: t(equal(explicit, at(snapshot4.defaults, path)) ? "defaultPin" : "explicit") }),
7046
- controller.layer === "profile" && at(snapshot4.nativeForm?.base, path) !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: t("hostPin") }),
7047
- controller.layer === "global" && at(snapshot4.profile, path) !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "dsmm-hint", children: [
7048
- t("profileSource"),
7049
- ": ",
7050
- displayValue(at(snapshot4.profile, path), t),
7051
- " · ",
7052
- t("explicit")
7053
- ] })
7100
+ name2 === "permissionControl.enabled" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })
7054
7101
  ] });
7055
7102
  }
7056
7103
 
package/lib/guards.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { DsmmRolePolicy } from "./role-policy.js";
5
5
  export declare const DSMM_GUARD_PREFIX = "[dsmm safety]";
6
6
  export declare function truncateTextMiddle(text: string, maxBytes: number, toolName: string): string;
7
7
  export declare function isSafetyScopeActive(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController): boolean;
8
- export declare function decidePreToolExecution(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController, nativeFullAccess?: boolean): DshPreToolDecision | undefined;
8
+ export declare function decidePreToolExecution(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController, nativeFullAccess?: boolean, simple?: boolean): DshPreToolDecision | undefined;
9
9
  export declare function decidePostToolExecution(exec: DshToolExecution, result: Readonly<DshToolExecutionResult>, decision: DshPostToolDecision, settings: DsmmSettings, controller: DeepworkModeController): DshPostToolDecision;
10
10
  export declare function registerSafetyGuards(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, rolePolicy?: DsmmRolePolicy): void;
11
11
  //# sourceMappingURL=guards.d.ts.map