@dsmm/dsmm 0.3.20 → 0.3.21

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.
package/README.md CHANGED
@@ -4,12 +4,12 @@ DSMM 是 DeepSeek Harness(DSH)的插件。它让不同 Agent 分工处理任
4
4
 
5
5
  比如,让 Planner 拆解任务、Coding 写代码、Reviewer 检查结果,再由 Orchestrator 协调。各个角色可以用不同的模型,不必共用一套配置。
6
6
 
7
- 当前发布版本为 `@dsmm/dsmm@0.3.19`,支持 DSH `>=0.2.1-rc.2 <0.3.0`。安装前请确认客户端版本;范围外的 DSH 版本不受支持。Desktop 使用自带运行时,独立命令行环境需要 Node.js 22 或更高版本。
7
+ 当前发布版本为 `@dsmm/dsmm@0.3.21`,支持 DSH `>=0.2.1-rc.2 <0.3.0`。安装前请确认客户端版本;范围外的 DSH 版本不受支持。Desktop 使用自带运行时,独立命令行环境需要 Node.js 22 或更高版本。
8
8
 
9
9
  官方 DSH rc.3 以 `engines.dsh` 优先于 peer ranges 判定兼容性;DSH 依赖仍固定为 rc.2,作为开发基线。
10
10
 
11
11
  - 源码仓库:[hugefiver/dsmm](https://github.com/hugefiver/dsmm)
12
- - 安装来源:[npm (@dsmm/dsmm)](https://www.npmjs.com/package/@dsmm/dsmm);发布资产:[GitHub Releases (v0.3.19)](https://github.com/hugefiver/dsmm/releases/tag/v0.3.19)
12
+ - 安装来源:[npm (@dsmm/dsmm)](https://www.npmjs.com/package/@dsmm/dsmm);发布资产:[GitHub Releases (v0.3.21)](https://github.com/hugefiver/dsmm/releases/tag/v0.3.21)
13
13
 
14
14
  ---
15
15
 
@@ -20,7 +20,7 @@ DSMM 是 DeepSeek Harness(DSH)的插件。它让不同 Agent 分工处理任
20
20
  ### 初次安装
21
21
 
22
22
  1. 打开 DeepSeek Harness Desktop,进入 **插件(Plugins)** 页面。
23
- 2. 点击 **添加插件(Add plugin)**,输入 `@dsmm/dsmm@0.3.19` 并确认。
23
+ 2. 点击 **添加插件(Add plugin)**,输入 `@dsmm/dsmm@0.3.21` 并确认。
24
24
  3. 安装完成后,检查插件是否处于启用状态。如果界面提示需要重启,请按提示重启客户端。
25
25
 
26
26
  Desktop 的插件由客户端自己管理。全局 npm 安装和独立 npm 版 `dsh` 命令不能替代这一步。
@@ -32,7 +32,7 @@ DSH Desktop 当前不支持在界面中用同名版本原位覆盖更新插件
32
32
  1. 保存好正在进行的任务,**正常退出并完全关闭 DSH Desktop**。
33
33
  2. 使用 Desktop 安装自带的命令行工具更新配置。以下示例适用于 Windows 默认安装路径(`%LOCALAPPDATA%\Programs\DeepSeek Harness\`):
34
34
  ```powershell
35
- & "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add @dsmm/dsmm@0.3.19 --save-exact --ignore-scripts --registry=https://registry.npmjs.org
35
+ & "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add @dsmm/dsmm@0.3.21 --save-exact --ignore-scripts --registry=https://registry.npmjs.org
36
36
  ```
37
37
  *若安装在自定义路径,请替换为对应的实际位置;非 Windows 系统请参考 Desktop 自身菜单或官方指引,不要混用非 Desktop 的独立 CLI 命令。*
38
38
  3. 重新打开 DSH Desktop 即可加载新版本。
@@ -58,7 +58,17 @@ A trusted, writable native Root can manage Global rules without DSMM role admiss
58
58
 
59
59
  In the UI, new command entries are entered simply as command strings with Add and Remove actions. There are no ID, tool, cwd, sandbox or action selectors, and no repetitive override or explanation lines. Saved legacy structured entries display a compact read-only summary showing the command and identifiable constraints (tool, working directory, ask/sandbox differences viewable in collapsible details) plus a delete button.
60
60
 
61
- Simple command rules support literal command and subcommand prefixes (such as `git`, `git status`, `go test`) and optional alternatives (`go build|test`). A match takes priority over DSMM command ask/deny and legacy command entries, automatically approving native `danger-full-access` for that invocation. Unmatched commands follow the ordinary policy path. Shell chaining, pipes, redirects and complex shell syntax do not match. Current invocation identity, cancellation and role/tool eligibility remain required; the grant does not change the session's standing sandbox.
61
+ Simple command rules support literal command and subcommand prefixes (such as `git`, `git status`, `go test`) and optional alternatives (`go build|test`). An existing whole-command literal match takes priority over DSMM command ask/deny and legacy command entries, automatically approving native `danger-full-access` for that invocation. Ordinary unmatched single commands retain their existing policy path.
62
+
63
+ When `nativeCommands.enabled` is true, a completely recognized **linear script** also qualifies if every component either has no applicable existing DSMM constraint or matches a string entry. No whitelist hit is required: with empty entries, `echo one; echo two` qualifies when no existing rule constrains it. An unclassified program, alias, Git subcommand or static interpreter is not rejected merely for being unknown. This is a rule-based authorization policy, **not** proof that a command is safe or read-only, nor OS confinement.
64
+
65
+ The finite grammar supports unquoted `;`, LF/CRLF, `&&`, `||` and `|`, checks all branches and pipeline stages, and retains quoted separators as literal arguments. Leading/trailing blank lines, a trailing semicolon, and ordinary newlines after chain/pipe operators are supported. Unquoted POSIX backslash + LF continues a component, as does PowerShell backtick + LF/CRLF at a token boundary; POSIX backslash + CRLF falls back. PowerShell token-internal escaped newlines are not literal concatenation and fall back. Static quoting, Unicode and empty operands follow the existing literal matcher. The original script executes once without rewriting or splitting execution.
66
+
67
+ Control flow, functions, groups/blocks, expansion/substitution, globbing, comments, here-docs/strings, redirection, background `&`, PowerShell call/dot-sourcing operators, `--%`, smart quotes, unsupported escapes, unclosed quotes, `;;`, dangling operators and environment assignments are outside this grammar. `env ...`, `node -e '...'` and `bash -c '...'` may be ordinary literal components; interpreter code is not recursively evaluated for this authorization, and a wrapped command's whitelist does not match its wrapper. Existing Git `env` detection still applies. Unsupported syntax, incomplete evaluation or any uncovered constraint retains the original path, not a new script ask/deny.
68
+
69
+ Component constraints reuse the effective Agent's Git guard/scope, dialect-safety rules, managed exact-shell/outside-read rules and legacy object matching. Existing standing Full access semantics apply: guards contribute only applicable Git deny, native rules retain confirmed blacklists rather than unknown-read deny, and exact/legacy asks add no constraint. String matches can cover DSMM ask **or deny** for that component; legacy objects themselves are not string whitelist grants. Exact rules compare the original component text (only separator-adjacent spaces/tabs removed), actual executable and effective cwd; internal continuation text is retained. A rule matching the entire original script, including a whole-script outside-read constraint, covers **every** component and therefore requires every component to be string-whitelisted. Existing outside-read unknown/deny and trusted-read capability rules remain in effect; effect labels alone add no constraint. Stock tools do not gain a fictitious managed-rule identity.
70
+
71
+ Current invocation identity, cancellation and role/tool eligibility remain required. Native/third-party deny, native `approval.policy=never`, read-only ceilings and tool filters cannot be overridden. The grant changes neither the session's standing sandbox nor later calls, and is not saved as approval memory.
62
72
 
63
73
  An additional outer middleware may request approval after the pre-execution pipeline has returned. When that request has no exact execution association, it retains native approval handling; DSMM does not infer authorization from a shared call ID, signal or tool name.
64
74
 
@@ -57,6 +57,12 @@ Shell checks inspect the command argument for `bash`, `sh`, `zsh`, `pwsh`, and `
57
57
 
58
58
  For either scope, `ask` requires approval of the covered rules, `deny` rejects covered actions, and `off` contributes no automatic Git decision. `high-risk` only narrows automatic Git protection: explicit shell ask/deny and object-form native command asks still apply. Guard activation, shell dialect safety, readonly ceilings and existing standing Full access/simple-command priority are unchanged. This is not a general dangerous-command detector. Unrecognized aliases/wrappers receive no automatic Git decision; uncertain syntax cannot create a reusable broad approval. All command segments are considered, so an ordinary write before a high-risk action cannot hide the latter.
59
59
 
60
+ With `permissionControl.nativeCommands.enabled`, fully recognized linear scripts are eligible for one-call native `danger-full-access` when **each component has no applicable existing DSMM constraint or matches a string whitelist entry**. At least one whitelist hit is not required. For example, with `git commit` whitelisted, `echo before; git commit -m owned; echo after` qualifies under Git `ask` or `deny`, unless another uncovered constraint applies. Replacing commit with an uncovered controlled push retains the original policy path. With no applicable rules, even an unknown static program qualifies; this does not certify safety. Git scope `off`, inactive guard scope and writes outside `high-risk` contribute no Git constraint, while existing exact-shell, outside-read and legacy constraints still count.
61
+
62
+ The finite authorization grammar supports static literal components joined by `;`, LF/CRLF, `&&`, `||` or `|`, including all branches and pipeline stages, plus unquoted POSIX backslash + LF continuations and token-boundary PowerShell backtick + LF/CRLF continuations. POSIX backslash + CRLF and PowerShell token-internal escaped newlines are unsupported. Quoted separators stay literal. It does not parse full shell syntax: assignments, control flow, groups, expansion, globbing, comments, redirects, here-docs/strings, background execution and unsupported quoting/escapes fall back unchanged. Static interpreter code is not recursively parsed, and a wrapper needs its own string match when controlled. See [native permissions](native-permissions.md#configuration-drawer-and-command-rules) for the complete contract.
63
+
64
+ String matches override corresponding DSMM constraints, including deny, but never native/third-party deny, native `never`, read-only/tool ceilings or cancellation. A component exact rule uses its original raw text, actual shell executable and cwd; an exact or outside-read constraint on the original whole script requires **all components** to match string entries. Classification effects such as local write/destructive/unknown are not new risk rules. Successful qualification executes the original script once with existing invocation identity checks; it neither changes standing permissions nor creates cross-call approval memory. Unsupported or incompletely evaluated scripts receive no new grant or extra script-specific denial.
65
+
60
66
  The existing schema-driven **Plugins → DSMM bundle config → Permissions** fields expose both options in Global and current DSH profile scopes. Unset uses defaults in Global and restores inheritance in the profile; a named profile can also override `guards.gitWriteScope`. Sparse saves do not pin omitted values. Read-only configuration stays non-writable. Saved settings follow existing new-session admission; they do not apply a live overlay.
61
67
 
62
68
  ## Command-rule approval memory
@@ -2,8 +2,8 @@ import type { Context } from "@deepseek-ai/cordis";
2
2
  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
- import type { DsmmPermissionController } from "./permission-controller.js";
5
+ import type { DsmmPermissionController, PermissionControllerOptions } from "./permission-controller.js";
6
6
  import type { CommandApprovals } from "./command-approval.js";
7
7
  /** The native Core fiber owns one source backend, execution controller and RPC service. */
8
- export declare function installCorePermissions(ctx: Context, deployment: DsmmDeploymentConfig, authority: PermissionControlCollaborators, assertWritable: (root: Agent) => void, commandApprovals?: CommandApprovals): DsmmPermissionController;
8
+ export declare function installCorePermissions(ctx: Context, deployment: DsmmDeploymentConfig, authority: PermissionControlCollaborators, assertWritable: (root: Agent) => void, commandApprovals?: CommandApprovals, shellGuardConstraint?: PermissionControllerOptions["shellGuardConstraint"]): DsmmPermissionController;
9
9
  //# sourceMappingURL=core-permissions.d.ts.map
@@ -3,7 +3,7 @@ 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, commandApprovals) {
6
+ export function installCorePermissions(ctx, deployment, authority, assertWritable, commandApprovals, shellGuardConstraint) {
7
7
  let controller;
8
8
  const backend = installDeploymentPermissionRules(ctx, {
9
9
  deployment, assertWritable,
@@ -19,7 +19,7 @@ export function installCorePermissions(ctx, deployment, authority, assertWritabl
19
19
  },
20
20
  });
21
21
  controller = installPermissionController(ctx, {
22
- authority, rules: backend.runtime, commandApprovals,
22
+ authority, rules: backend.runtime, commandApprovals, shellGuardConstraint,
23
23
  // The public ShellExecutor has no executable/environment resolution proof.
24
24
  // This identity never grants read trust or filesystem colocation.
25
25
  shellIdentity: (_scope, kind) => Object.freeze({ executable: `unresolved-native-${kind}`,
package/lib/guards.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import type { DshContext, DshPostToolDecision, DshPreToolDecision, DshToolExecution, DshToolExecutionResult } from "./dsh-types.js";
2
2
  import type { DsmmSettings, DsmmSettingsGetter } from "./settings.js";
3
+ import type { ShellDialect } from "./shell-command.js";
3
4
  import type { DeepworkModeController } from "./state.js";
4
5
  import type { DsmmRolePolicy } from "./role-policy.js";
5
6
  import type { CommandApprovals } from "./command-approval.js";
6
7
  export declare const DSMM_GUARD_PREFIX = "[dsmm safety]";
7
8
  export declare function truncateTextMiddle(text: string, maxBytes: number, toolName: string): string;
8
9
  export declare function isSafetyScopeActive(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController): boolean;
10
+ /** Existing command constraints only; no tool execution or new risk classification. */
11
+ export declare function hasShellGuardConstraint(exec: DshToolExecution, command: string, dialect: ShellDialect, settings: DsmmSettings, controller: DeepworkModeController, nativeFullAccess?: boolean): boolean;
9
12
  export declare function decidePreToolExecution(exec: DshToolExecution, settings: DsmmSettings, controller: DeepworkModeController, nativeFullAccess?: boolean, simple?: boolean): DshPreToolDecision | undefined;
10
13
  export declare function decidePostToolExecution(exec: DshToolExecution, result: Readonly<DshToolExecutionResult>, decision: DshPostToolDecision, settings: DsmmSettings, controller: DeepworkModeController): DshPostToolDecision;
11
14
  export declare function registerSafetyGuards(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, rolePolicy?: DsmmRolePolicy, commandApprovals?: CommandApprovals): void;
package/lib/guards.js CHANGED
@@ -128,6 +128,14 @@ function gitActions(exec, settings) {
128
128
  return command === undefined || dialect === undefined ? [] : evaluateGitCommand(command, dialect)
129
129
  .filter(action => settings.guards.gitWriteScope !== "high-risk" || action.risk === "high-risk");
130
130
  }
131
+ /** Existing command constraints only; no tool execution or new risk classification. */
132
+ export function hasShellGuardConstraint(exec, command, dialect, settings, controller, nativeFullAccess = false) {
133
+ if (!isSafetyScopeActive(exec, settings, controller))
134
+ return false;
135
+ return !nativeFullAccess && settings.guards.shellCommandSafety && classifyShellDialectViolation(command, dialect) !== undefined
136
+ || (nativeFullAccess ? settings.guards.gitWriteGuard === "deny" : settings.guards.gitWriteGuard !== "off") && evaluateGitCommand(command, dialect)
137
+ .some(action => settings.guards.gitWriteScope !== "high-risk" || action.risk === "high-risk");
138
+ }
131
139
  function gitRuleReason(actions) {
132
140
  return actions.map(({ action, ruleId }) => `git ${action === "reset.hard" ? "reset --hard" : action.replaceAll(".", " ")} [${ruleId}]`).join(", ");
133
141
  }
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Context, symbols } from "@deepseek-ai/cordis";
2
2
  import { registerDsmmTuiAdapter } from "./tui-adapter.js";
3
- import { registerSafetyGuards } from "./guards.js";
3
+ import { hasShellGuardConstraint, registerSafetyGuards } from "./guards.js";
4
4
  import { registerDeepworkPrompt } from "./mode.js";
5
5
  import { registerAgentSkills } from "./preset-skills.js";
6
6
  import { registerModelRouting } from "./model-routing.js";
@@ -159,7 +159,7 @@ export async function apply(input, config = {}, startupOptions = {}) {
159
159
  ctx.inject(["typert"], scope => { registerConfigRpc(scope, deployment, startup.settings, () => profiles, startup.sources, mountedPermission); new DsmmProfilesHost(scope, profiles); registerRoleControlRpc(scope, nativeAdmission); });
160
160
  const permissions = createCorePermissionAuthority(ctx, { getSettings, rolePolicy: policy, signal: lifetime.signal });
161
161
  const installPermissions = () => ctx.inject(["tools", ...(ctx.fiber.entry === undefined ? [] : ["settings"])], scope => {
162
- const installed = installCorePermissions(scope, deployment, permissions.authority, permissions.assertWritable, commandApprovals);
162
+ const installed = installCorePermissions(scope, deployment, permissions.authority, permissions.assertWritable, commandApprovals, (exec, command, dialect) => hasShellGuardConstraint(exec, command, dialect, getSettings(exec.agent), controller, nativeStandingFullAccess(scope, exec.agent)));
163
163
  const identity = Reflect.get(installed, symbols.original) ?? installed;
164
164
  scopeLifetime(scope, "dsmm: release permission projection", () => { if (permissionOwner === identity)
165
165
  permissionOwner = undefined; }, () => { permissionOwner = identity; });
@@ -18,6 +18,8 @@ export interface PermissionControllerOptions {
18
18
  /** The existing live Core owner/admission/Root/realm/run facts, not serialized settings or a ready boolean. */
19
19
  readonly authority: PermissionControlCollaborators;
20
20
  readonly rules: PermissionRulesRuntimeSync;
21
+ /** Provided by the guard owner using this Agent's effective settings and live scope. */
22
+ shellGuardConstraint?(execution: Readonly<ToolExecution>, command: string, dialect: PermissionShellIdentity["dialect"]): boolean;
21
23
  /** Native registration identity; only an explicit capability proves Shell read semantics. */
22
24
  shellIdentity(scope: Context, kind: ManagedPermissionShell): PermissionShellIdentity;
23
25
  coLocated?(scope: Context, execution: Readonly<ToolExecution>, fs: NativePermissionFileSystem): boolean;
@@ -45,7 +47,8 @@ export declare class DsmmPermissionController extends Service {
45
47
  private readonly stockRegistrations;
46
48
  private readonly lifetime;
47
49
  constructor(ctx: Context, options: PermissionControllerOptions);
48
- /** Admit this exact simple match through the existing per-call native approval binding. */
50
+ private shellRuleIdentity;
51
+ /** Admit a whole literal match or completely covered linear script through the same per-call binding. */
49
52
  simpleCommandAllowed(exec: Readonly<ToolExecution>): Promise<boolean>;
50
53
  private stockRegistration;
51
54
  /** Public in-process facts for DSMM consumers; requested/configured modes never grant access. */
@@ -3,8 +3,9 @@ import { HarnessError } from "@deepseek-ai/dsh-llm";
3
3
  import { TOOL_ABORTED } from "@deepseek-ai/dsh-tools";
4
4
  import { isSandboxWidening, PermissionControl, PermissionRefusal, permissionApprovalAdapter, permissionOriginal } from "./permission-control.js";
5
5
  import { classifyPermissionShell } from "./permission-shell.js";
6
- import { nativeCommandMatches, simpleCommandMatch, simpleShellCommand, simpleShellDialect } from "./permission-native-command.js";
7
- import { NATIVE_PERMISSION_CAPABILITIES, registerNativePermissionRules } from "./permission-native-rules.js";
6
+ import { nativeCommandMatches, simpleCommandMatch, simpleCommandWordsMatch, simpleShellCommand, simpleShellDialect } from "./permission-native-command.js";
7
+ import { parseLinearScript } from "./permission-linear-script.js";
8
+ import { evaluateNativeShellRules, NATIVE_PERMISSION_CAPABILITIES, registerNativePermissionRules } from "./permission-native-rules.js";
8
9
  import { nativeStandingFullAccess } from "./permission-native-access.js";
9
10
  export const PERMISSION_CONTROLLER_INJECT = ["tools", "agents"];
10
11
  /** Bind methods to the original scoped receiver, preserving filters and registry layers. */
@@ -66,7 +67,7 @@ export class DsmmPermissionController extends Service {
66
67
  if (this.rules.status().mounted) {
67
68
  registerNativePermissionRules(ctx, {
68
69
  runtime: this.rules,
69
- simpleCommandAllowed: exec => this.permissions.isSimple(exec),
70
+ simpleCommandAllowed: exec => this.simpleCommandAllowed(exec),
70
71
  captureIntegrity: options.authority.captureIntegrity === undefined ? undefined : exec => options.authority.captureIntegrity(exec),
71
72
  identify: definition => {
72
73
  const managed = this.registrations.get(definition);
@@ -81,11 +82,7 @@ export class DsmmPermissionController extends Service {
81
82
  throw new PermissionRefusal("stale"); },
82
83
  coLocated: (exec, fs) => options.coLocated?.(tool.scope, exec, fs) === true };
83
84
  }
84
- return { kind: "shell", context: managed.scope, shell: managed.shell, signal: managed.registration.signal,
85
- assertIntegrity: () => { if (!managed.registration.active || !managed.registration.unchanged())
86
- throw new PermissionRefusal("stale"); },
87
- assertCurrent: exec => managed.registration.assertCurrent?.(exec),
88
- coLocated: (exec, fs) => options.coLocated?.(managed.scope, exec, fs) === true };
85
+ return this.shellRuleIdentity(managed);
89
86
  },
90
87
  captureAuthority: exec => {
91
88
  const current = options.authority.current(exec);
@@ -142,7 +139,14 @@ export class DsmmPermissionController extends Service {
142
139
  }
143
140
  ctx.effect(() => () => this.retire());
144
141
  }
145
- /** Admit this exact simple match through the existing per-call native approval binding. */
142
+ shellRuleIdentity(managed) {
143
+ return { kind: "shell", context: managed.scope, shell: managed.shell, signal: managed.registration.signal,
144
+ assertIntegrity: () => { if (!managed.registration.active || !managed.registration.unchanged())
145
+ throw new PermissionRefusal("stale"); },
146
+ assertCurrent: exec => managed.registration.assertCurrent?.(exec),
147
+ coLocated: (exec, fs) => this.options.coLocated?.(managed.scope, exec, fs) === true };
148
+ }
149
+ /** Admit a whole literal match or completely covered linear script through the same per-call binding. */
146
150
  async simpleCommandAllowed(exec) {
147
151
  if (this.permissions.isSimple(exec))
148
152
  return true;
@@ -158,7 +162,7 @@ export class DsmmPermissionController extends Service {
158
162
  const command = managed === undefined ? simpleShellCommand(exec.arguments) : Reflect.get(exec.arguments, managed.shell.commandField);
159
163
  if (dialect === undefined || typeof command !== "string")
160
164
  return false;
161
- const body = definition.execute, args = exec.arguments, name = exec.name, callId = exec.callId, signal = exec.signal;
165
+ const body = definition.execute, args = exec.arguments, name = exec.name, callId = exec.callId, signal = exec.signal, token = exec.token;
162
166
  const registry = agent.ctx.get("agents"), workspace = agent.session.header.cwd;
163
167
  const checkCall = () => {
164
168
  if (signal.aborted || exec.signal !== signal || this.lifetime.signal.aborted)
@@ -169,7 +173,7 @@ export class DsmmPermissionController extends Service {
169
173
  && definition.execute === stock.wrapper && stock.unchanged();
170
174
  if (exec.agent !== agent || agent.ctx !== realm || registry === undefined || liveRegistry === undefined
171
175
  || permissionOriginal(liveRegistry) !== permissionOriginal(registry) || liveRegistry.get(agent.id) !== agent
172
- || exec.arguments !== args || exec.name !== name || exec.callId !== callId || agent.session.header.cwd !== workspace
176
+ || exec.arguments !== args || exec.token !== token || exec.name !== name || exec.callId !== callId || agent.session.header.cwd !== workspace
173
177
  || liveTools === undefined || permissionOriginal(liveTools) !== permissionOriginal(tools)
174
178
  || tools.get(name, agent) !== definition || liveTools.get(name, agent) !== definition || !sameBody)
175
179
  throw new PermissionRefusal("stale");
@@ -190,7 +194,69 @@ export class DsmmPermissionController extends Service {
190
194
  catch {
191
195
  return false;
192
196
  }
193
- if (!simpleCommandMatch(snapshot.policy.nativeCommands, command, dialect))
197
+ const settings = snapshot.policy.nativeCommands;
198
+ let allowed = simpleCommandMatch(settings, command, dialect);
199
+ if (!allowed && settings.enabled && this.options.shellGuardConstraint !== undefined) {
200
+ const components = parseLinearScript(command, dialect);
201
+ if (components !== undefined) {
202
+ if (failure !== undefined || authority === undefined) {
203
+ checkCall();
204
+ return false;
205
+ }
206
+ const capturedAuthority = authority;
207
+ const identity = managed === undefined ? undefined : this.shellRuleIdentity(managed);
208
+ let coLocatedFs;
209
+ const check = () => {
210
+ checkCall();
211
+ this.options.authority.assertCurrent(capturedAuthority, exec);
212
+ identity?.assertIntegrity?.(exec);
213
+ identity?.assertCurrent(exec);
214
+ if (coLocatedFs !== undefined && identity?.coLocated?.(exec, coLocatedFs) !== true)
215
+ throw new PermissionRefusal("stale");
216
+ };
217
+ check();
218
+ const constrained = async (candidate, includeGuards) => {
219
+ if (includeGuards && this.options.shellGuardConstraint(exec, candidate, dialect))
220
+ return true;
221
+ // Stock tools have no managed native-rule identity; do not invent one from their name.
222
+ if (managed === undefined || identity === undefined)
223
+ return false;
224
+ const input = { ...args, [managed.shell.commandField]: candidate };
225
+ const nativeOnly = nativeStandingFullAccess(identity.context, exec.agent);
226
+ if (!nativeOnly) {
227
+ const entries = nativeCommandMatches(settings, managed.kind, managed.shell, input, workspace ?? "");
228
+ if (entries === "ambiguous" || entries.some(entry => entry.mode === "ask"))
229
+ return true;
230
+ }
231
+ const evaluation = { identity, snapshot, nativeOnly, workspaceRoot: workspace ?? "",
232
+ signal: AbortSignal.any([signal, ...identity.signal === undefined ? [] : [identity.signal]]),
233
+ fs: identity.context.get("fs"), asks: [] };
234
+ const action = await evaluateNativeShellRules(exec, evaluation, () => {
235
+ if (evaluation.provenCoLocation)
236
+ coLocatedFs = evaluation.fs;
237
+ check();
238
+ }, input);
239
+ return action === "ask" || action === "deny";
240
+ };
241
+ try {
242
+ const whole = await constrained(command, false);
243
+ allowed = true;
244
+ for (const component of components) {
245
+ if (!simpleCommandWordsMatch(settings, component.words, dialect) && (whole || await constrained(component.command, true))) {
246
+ allowed = false;
247
+ break;
248
+ }
249
+ }
250
+ }
251
+ catch {
252
+ allowed = false;
253
+ }
254
+ check();
255
+ if (this.rules.getPolicy() !== snapshot)
256
+ return false;
257
+ }
258
+ }
259
+ if (!allowed)
194
260
  return false;
195
261
  if (failure !== undefined)
196
262
  throw failure;
@@ -0,0 +1,10 @@
1
+ import type { PermissionShellIdentity } from "./permission-shell.js";
2
+ export interface LinearScriptComponent {
3
+ readonly start: number;
4
+ readonly end: number;
5
+ readonly command: string;
6
+ readonly words: readonly string[];
7
+ }
8
+ /** Complete finite recognition, not a shell AST. Original ranges are never rewritten for execution. */
9
+ export declare function parseLinearScript(command: string, dialect: PermissionShellIdentity["dialect"]): readonly LinearScriptComponent[] | undefined;
10
+ //# sourceMappingURL=permission-linear-script.d.ts.map
@@ -0,0 +1,91 @@
1
+ import { literalCommand } from "./permission-native-command.js";
2
+ /** Complete finite recognition, not a shell AST. Original ranges are never rewritten for execution. */
3
+ export function parseLinearScript(command, dialect) {
4
+ const components = [];
5
+ let start = 0, chunk = 0, quote = "", structured = false;
6
+ let pending;
7
+ let pieces = [];
8
+ const finish = (end) => {
9
+ const view = pieces.join("") + command.slice(chunk, end);
10
+ const words = literalCommand(view, dialect, "simple");
11
+ if (words === undefined)
12
+ return false;
13
+ let left = start, right = end;
14
+ while (command[left] === " " || command[left] === "\t")
15
+ left++;
16
+ while (right > left && (command[right - 1] === " " || command[right - 1] === "\t"))
17
+ right--;
18
+ components.push(Object.freeze({ start: left, end: right, command: command.slice(left, right), words }));
19
+ pieces = [];
20
+ return true;
21
+ };
22
+ for (let index = 0; index < command.length; index++) {
23
+ const char = command[index];
24
+ if (quote !== "") {
25
+ if (char === quote) {
26
+ if (dialect === "powershell" && quote === "'" && command[index + 1] === "'")
27
+ index++;
28
+ else
29
+ quote = "";
30
+ }
31
+ continue;
32
+ }
33
+ if (char === "'" || char === '"') {
34
+ quote = char;
35
+ continue;
36
+ }
37
+ if (char === (dialect === "posix" ? "\\" : "`")) {
38
+ const length = command[index + 1] === "\n" ? 2 : dialect === "powershell" && command.slice(index + 1, index + 3) === "\r\n" ? 3 : 0;
39
+ if (length !== 0) {
40
+ // Do not reinterpret token-internal PowerShell escaped newlines as POSIX concatenation.
41
+ if (dialect === "powershell" && index !== start && command[index - 1] !== " " && command[index - 1] !== "\t")
42
+ return undefined;
43
+ pieces.push(command.slice(chunk, index));
44
+ index += length - 1;
45
+ chunk = index + 1;
46
+ structured = true;
47
+ continue;
48
+ }
49
+ // Do not reinterpret CRLF as a POSIX continuation or split an escaped operator.
50
+ return undefined;
51
+ }
52
+ const newline = char === "\n" || char === "\r" && command[index + 1] === "\n";
53
+ if (!newline && char !== ";" && char !== "|" && char !== "&")
54
+ continue;
55
+ structured = true;
56
+ const chain = char === "|" || char === "&";
57
+ let length = newline && char === "\r" ? 2 : 1;
58
+ if (chain && command[index + 1] === char)
59
+ length = 2;
60
+ else if (char === "&")
61
+ return undefined;
62
+ const empty = /^[ \t]*$/u.test(pieces.join("") + command.slice(chunk, index));
63
+ if (empty) {
64
+ if (!newline)
65
+ return undefined;
66
+ }
67
+ else {
68
+ if (!finish(index))
69
+ return undefined;
70
+ pending = undefined;
71
+ }
72
+ if (chain)
73
+ pending = "chain";
74
+ else if (!newline)
75
+ pending = "separator";
76
+ index += length - 1;
77
+ start = chunk = index + 1;
78
+ pieces = [];
79
+ }
80
+ if (quote !== "" || !structured)
81
+ return undefined;
82
+ const empty = /^[ \t]*$/u.test(pieces.join("") + command.slice(chunk));
83
+ if (empty) {
84
+ if (pending === "chain")
85
+ return undefined;
86
+ }
87
+ else if (!finish(command.length))
88
+ return undefined;
89
+ return components.length === 0 ? undefined : Object.freeze(components);
90
+ }
91
+ //# sourceMappingURL=permission-linear-script.js.map
@@ -13,4 +13,5 @@ export declare function simpleShellDialect(name: string): PermissionShellIdentit
13
13
  export declare function simpleShellCommand(args: unknown): string | undefined;
14
14
  /** A simple hit carries no legacy entry, cwd grant, read trust or sandbox target. */
15
15
  export declare function simpleCommandMatch(settings: NativeCommandsSettings, command: string, dialect: PermissionShellIdentity["dialect"]): boolean;
16
+ export declare function simpleCommandWordsMatch(settings: NativeCommandsSettings, words: readonly string[], dialect: PermissionShellIdentity["dialect"]): boolean;
16
17
  //# sourceMappingURL=permission-native-command.d.ts.map
@@ -124,6 +124,11 @@ export function simpleCommandMatch(settings, command, dialect) {
124
124
  const words = literalCommand(command, dialect, "simple");
125
125
  if (words === undefined)
126
126
  return false;
127
+ return simpleCommandWordsMatch(settings, words, dialect);
128
+ }
129
+ export function simpleCommandWordsMatch(settings, words, dialect) {
130
+ if (!settings.enabled)
131
+ return false;
127
132
  const executable = (value) => dialect === "powershell" ? value.replace(/\.exe$/iu, "") : value;
128
133
  return settings.entries.some(entry => typeof entry === "string" && parseSimpleCommandPattern(entry).every((alternatives, index) => words[index] !== undefined && alternatives.some(value => index === 0 ? executable(value) === executable(words[0]) : value === words[index])));
129
134
  }
@@ -35,7 +35,7 @@ interface NativePermissionAuthority {
35
35
  }
36
36
  export interface NativePermissionRulesOptions {
37
37
  readonly runtime: PermissionRulesRuntimeSync;
38
- simpleCommandAllowed?(execution: Readonly<ToolExecution>): boolean;
38
+ simpleCommandAllowed?(execution: Readonly<ToolExecution>): boolean | Promise<boolean>;
39
39
  captureIntegrity?(execution: Readonly<ToolExecution>): PermissionExecutionIntegrity;
40
40
  /** Exact registration identity, never trust a matching tool name alone. */
41
41
  identify(definition: ToolDefinition, execution: Readonly<ToolExecution>): NativePermissionToolIdentity | undefined;
@@ -46,6 +46,18 @@ export interface NativePermissionRulesOptions {
46
46
  /** Compose this exact registration's native request; never creates an independent approval UI. */
47
47
  managedShellDecision?(execution: Readonly<ToolExecution>, action: Exclude<PermissionRuleAction, "deny">, downstream: () => Promise<PreToolDecision>, snapshot: PermissionRuleSnapshot | undefined, asks: readonly PermissionRule[]): Promise<PreToolDecision>;
48
48
  }
49
+ export interface NativeShellRuleEvaluation {
50
+ readonly identity: NativePermissionToolIdentity;
51
+ readonly snapshot: PermissionRuleSnapshot;
52
+ readonly nativeOnly: boolean;
53
+ readonly workspaceRoot: string;
54
+ readonly signal: AbortSignal;
55
+ readonly fs?: FileSystem;
56
+ readonly asks: PermissionRule[];
57
+ provenCoLocation?: boolean;
58
+ }
59
+ /** The same standing-full or restricted shell semantics used by the ordinary native-rule path. */
60
+ export declare function evaluateNativeShellRules(exec: Readonly<ToolExecution>, binding: NativeShellRuleEvaluation, check: () => void, input?: unknown, checkIntegrity?: () => void): Promise<PermissionRuleAction>;
49
61
  /** The public native search tools accept pattern/path/include only; no model-controlled rg flags. */
50
62
  export declare function parseNativePermissionReadPaths(kind: "read" | "glob" | "grep", input: unknown): readonly string[];
51
63
  /** Tool-call-boundary rules only. No body fence, scoped memory, socket isolation or final-inode guarantee. */
@@ -10,15 +10,112 @@ function unresolvedOutside(policy) {
10
10
  return "deny";
11
11
  return "inherit";
12
12
  }
13
+ async function outside(exec, binding, paths, cwd, direct, check, checkIntegrity, full = false) {
14
+ if (paths.length === 0)
15
+ return "inherit";
16
+ const fs = binding.fs;
17
+ const configured = binding.snapshot.policy.outsideReads;
18
+ // Trusted reads impose only the existing deny boundary, never an outside-read ask.
19
+ if (unresolvedOutside(binding.snapshot.policy) !== "deny")
20
+ return "inherit";
21
+ if (fs === undefined || !isAbsolute(binding.workspaceRoot) || !isAbsolute(cwd) || direct && binding.identity.coLocated?.(exec, fs) !== true) {
22
+ // Unknown backends cannot satisfy inside or a path-specific allow.
23
+ return full ? "inherit" : unresolvedOutside(binding.snapshot.policy);
24
+ }
25
+ if (direct)
26
+ binding.provenCoLocation = true;
27
+ const root = await fs.resolve(binding.workspaceRoot, { signal: binding.signal });
28
+ check();
29
+ const decisions = [];
30
+ for (const path of paths) {
31
+ let target, inside;
32
+ try {
33
+ target = await fs.resolve(path, { cwd, signal: binding.signal });
34
+ inside = fs.contains(root, target);
35
+ }
36
+ catch (error) {
37
+ if (!full)
38
+ throw error;
39
+ checkIntegrity();
40
+ continue;
41
+ }
42
+ check();
43
+ if (inside)
44
+ continue;
45
+ const matched = [];
46
+ for (const rule of binding.snapshot.policy.rules) {
47
+ if (rule.revoked || rule.match.kind !== "outside-read")
48
+ continue;
49
+ let matches;
50
+ try {
51
+ const ruleTarget = await fs.resolve(rule.match.path, { cwd: binding.workspaceRoot, signal: binding.signal });
52
+ matches = rule.match.scope === "tree" ? fs.contains(ruleTarget, target) : ruleTarget.targetKey === target.targetKey;
53
+ }
54
+ catch (error) {
55
+ if (!full)
56
+ throw error;
57
+ checkIntegrity();
58
+ continue;
59
+ }
60
+ check();
61
+ if (matches) {
62
+ if (full && rule.action === "deny")
63
+ return "deny";
64
+ matched.push(rule.action);
65
+ }
66
+ }
67
+ const action = matched.length === 0 ? configured : intersectPermissionActions(matched);
68
+ if (full && action === "deny")
69
+ return "deny";
70
+ decisions.push(action);
71
+ }
72
+ return intersectPermissionActions(decisions) === "deny" ? "deny" : "inherit";
73
+ }
74
+ /** The same standing-full or restricted shell semantics used by the ordinary native-rule path. */
75
+ export async function evaluateNativeShellRules(exec, binding, check, input = exec.arguments, checkIntegrity = check) {
76
+ const shell = binding.identity.shell, policy = binding.snapshot.policy, cwd = binding.workspaceRoot;
77
+ if (binding.nativeOnly) {
78
+ const row = args(exec, input), explicitCwd = shell?.cwdField === undefined ? undefined : row[shell.cwdField];
79
+ const workingDirectory = typeof explicitCwd !== "string" ? cwd : isAbsolute(explicitCwd) ? explicitCwd : resolve(cwd, explicitCwd);
80
+ if (shell !== undefined && policy.rules.some(rule => !rule.revoked && rule.action === "deny"
81
+ && rule.match.kind === "shell" && rule.match.executable === shell.executable && rule.match.command === row[shell.commandField]
82
+ && rule.match.workingDirectory === workingDirectory))
83
+ return "deny";
84
+ if (unresolvedOutside(policy) !== "deny")
85
+ return "inherit";
86
+ // Unavailable path facts are not an explicit blacklist match in full access.
87
+ const parsed = shell === undefined ? undefined : parsePermissionShellReadPaths(shell, input, cwd, exec);
88
+ if (parsed === undefined)
89
+ return "inherit";
90
+ const action = await outside(exec, binding, parsed.paths, parsed.workingDirectory, true, check, checkIntegrity, true);
91
+ return action === "deny" ? "deny" : "inherit";
92
+ }
93
+ if (shell === undefined)
94
+ return policy.rules.some(rule => !rule.revoked && rule.match.kind === "shell" && rule.action === "deny") ? "deny" : "inherit";
95
+ const operation = classifyPermissionShell(shell, input, cwd, exec);
96
+ shell.readCapability?.assertCurrent(exec);
97
+ const matched = policy.rules.filter(rule => !rule.revoked && rule.match.kind === "shell" && rule.match.executable === operation.executable
98
+ && rule.match.command === operation.command && rule.match.workingDirectory === operation.workingDirectory);
99
+ binding.asks.push(...matched.filter(rule => rule.action === "ask"));
100
+ const rules = matched.map(rule => rule.action);
101
+ if (operation.effect !== "read") {
102
+ const hardRead = operation.effect === "unknown" && unresolvedOutside(policy) === "deny";
103
+ return intersectPermissionActions([...rules, ...hardRead ? ["deny"] : []]);
104
+ }
105
+ const parsed = parsePermissionShellReadPaths(shell, input, cwd, exec);
106
+ const access = parsed === undefined ? unresolvedOutside(policy)
107
+ : await outside(exec, binding, parsed.paths, parsed.workingDirectory, true, check, check);
108
+ return intersectPermissionActions([access, ...rules]);
109
+ }
13
110
  function text(input) {
14
111
  if (typeof input !== "string" || input.trim().length === 0 || input.includes("\0"))
15
112
  throw new PermissionRefusal("validation");
16
113
  return input;
17
114
  }
18
- function args(exec) {
19
- if (exec.arguments === null || typeof exec.arguments !== "object" || Array.isArray(exec.arguments))
115
+ function args(exec, input = exec.arguments) {
116
+ if (input === null || typeof input !== "object" || Array.isArray(input))
20
117
  throw new PermissionRefusal("validation");
21
- return exec.arguments;
118
+ return input;
22
119
  }
23
120
  /** The public native search tools accept pattern/path/include only; no model-controlled rg flags. */
24
121
  export function parseNativePermissionReadPaths(kind, input) {
@@ -84,69 +181,8 @@ export function registerNativePermissionRules(ctx, options) {
84
181
  else
85
182
  binding.authority.assertCurrent();
86
183
  };
87
- const outside = async (exec, binding, paths, cwd, direct, full = false) => {
88
- if (paths.length === 0)
89
- return "inherit";
90
- const fs = binding.fs;
91
- const configured = binding.snapshot.policy.outsideReads;
92
- // Trusted reads impose only the existing deny boundary, never an outside-read ask.
93
- if (unresolvedOutside(binding.snapshot.policy) !== "deny")
94
- return "inherit";
95
- if (fs === undefined || !isAbsolute(binding.workspaceRoot) || !isAbsolute(cwd) || direct && binding.identity.coLocated?.(exec, fs) !== true) {
96
- // Unknown backends cannot satisfy inside or a path-specific allow.
97
- return full ? "inherit" : unresolvedOutside(binding.snapshot.policy);
98
- }
99
- if (direct)
100
- binding.provenCoLocation = true;
101
- const root = await fs.resolve(binding.workspaceRoot, { signal: binding.signal });
102
- check(exec, binding);
103
- const decisions = [];
104
- for (const path of paths) {
105
- let target, inside;
106
- try {
107
- target = await fs.resolve(path, { cwd, signal: binding.signal });
108
- inside = fs.contains(root, target);
109
- }
110
- catch (error) {
111
- if (!full)
112
- throw error;
113
- checkIntegrity(exec, binding);
114
- continue;
115
- }
116
- check(exec, binding);
117
- if (inside)
118
- continue;
119
- const matched = [];
120
- for (const rule of binding.snapshot.policy.rules) {
121
- if (rule.revoked || rule.match.kind !== "outside-read")
122
- continue;
123
- let matches;
124
- try {
125
- const ruleTarget = await fs.resolve(rule.match.path, { cwd: binding.workspaceRoot, signal: binding.signal });
126
- matches = rule.match.scope === "tree" ? fs.contains(ruleTarget, target) : ruleTarget.targetKey === target.targetKey;
127
- }
128
- catch (error) {
129
- if (!full)
130
- throw error;
131
- checkIntegrity(exec, binding);
132
- continue;
133
- }
134
- check(exec, binding);
135
- if (matches) {
136
- if (full && rule.action === "deny")
137
- return "deny";
138
- matched.push(rule.action);
139
- }
140
- }
141
- const action = matched.length === 0 ? configured : intersectPermissionActions(matched);
142
- if (full && action === "deny")
143
- return "deny";
144
- decisions.push(action);
145
- }
146
- return intersectPermissionActions(decisions) === "deny" ? "deny" : "inherit";
147
- };
148
184
  const evaluate = async (exec, binding) => {
149
- const { kind, shell } = binding.identity, policy = binding.snapshot.policy;
185
+ const { kind } = binding.identity, policy = binding.snapshot.policy;
150
186
  const full = binding.nativeOnly;
151
187
  if (kind === "webSearch" || kind === "webFetch") {
152
188
  if (!policy[kind].enabled)
@@ -156,44 +192,21 @@ export function registerNativePermissionRules(ctx, options) {
156
192
  }
157
193
  const cwd = binding.workspaceRoot;
158
194
  if (full) {
159
- const row = args(exec), explicitCwd = shell?.cwdField === undefined ? undefined : row[shell.cwdField];
160
- const workingDirectory = typeof explicitCwd !== "string" ? cwd : isAbsolute(explicitCwd) ? explicitCwd : resolve(cwd, explicitCwd);
161
- if (kind === "shell" && shell !== undefined && policy.rules.some(rule => !rule.revoked && rule.action === "deny"
162
- && rule.match.kind === "shell" && rule.match.executable === shell.executable && rule.match.command === row[shell.commandField]
163
- && rule.match.workingDirectory === workingDirectory))
164
- return "deny";
195
+ if (kind === "shell")
196
+ return evaluateNativeShellRules(exec, binding, () => check(exec, binding), exec.arguments, () => checkIntegrity(exec, binding));
197
+ args(exec);
165
198
  if (policy.outsideReads !== "deny" && !policy.rules.some(rule => !rule.revoked && rule.action === "deny" && rule.match.kind === "outside-read"))
166
199
  return "inherit";
167
- // Unavailable path facts are not an explicit blacklist match in full access.
168
- const parsed = kind === "shell" ? shell === undefined ? undefined : parsePermissionShellReadPaths(shell, exec.arguments, cwd, exec)
169
- : { paths: parseNativePermissionReadPaths(kind, exec.arguments), workingDirectory: cwd };
170
- if (parsed === undefined)
171
- return "inherit";
172
- const action = await outside(exec, binding, parsed.paths, parsed.workingDirectory, kind !== "read", true);
200
+ const parsed = { paths: parseNativePermissionReadPaths(kind, exec.arguments), workingDirectory: cwd };
201
+ const action = await outside(exec, binding, parsed.paths, parsed.workingDirectory, kind !== "read", () => check(exec, binding), () => checkIntegrity(exec, binding), true);
173
202
  return action === "deny" ? "deny" : "inherit";
174
203
  }
175
204
  if (kind !== "shell")
176
- return outside(exec, binding, parseNativePermissionReadPaths(kind, exec.arguments), cwd, kind !== "read");
177
- if (shell === undefined)
178
- return policy.rules.some(rule => !rule.revoked && rule.match.kind === "shell" && rule.action === "deny") ? "deny" : "inherit";
179
- const operation = classifyPermissionShell(shell, exec.arguments, cwd, exec);
180
- shell.readCapability?.assertCurrent(exec);
181
- const matched = policy.rules.filter(rule => !rule.revoked && rule.match.kind === "shell" && rule.match.executable === operation.executable
182
- && rule.match.command === operation.command && rule.match.workingDirectory === operation.workingDirectory);
183
- binding.asks.push(...matched.filter(rule => rule.action === "ask"));
184
- const rules = matched.map(rule => rule.action);
185
- if (operation.effect !== "read") {
186
- // Unknown reads cannot bypass a configured hard outside-read boundary.
187
- const hardRead = operation.effect === "unknown" && (policy.outsideReads === "deny" || policy.rules.some(rule => !rule.revoked && rule.match.kind === "outside-read" && rule.action === "deny"));
188
- return intersectPermissionActions([...rules, ...hardRead ? ["deny"] : []]);
189
- }
190
- const parsed = parsePermissionShellReadPaths(shell, exec.arguments, cwd, exec);
191
- const access = parsed === undefined ? unresolvedOutside(policy)
192
- : await outside(exec, binding, parsed.paths, parsed.workingDirectory, true);
193
- return intersectPermissionActions([access, ...rules]);
205
+ return outside(exec, binding, parseNativePermissionReadPaths(kind, exec.arguments), cwd, kind !== "read", () => check(exec, binding), () => checkIntegrity(exec, binding));
206
+ return evaluateNativeShellRules(exec, binding, () => check(exec, binding));
194
207
  };
195
208
  const unhook = ctx.on("tools/pre-execute", async (exec, next) => {
196
- if (options.simpleCommandAllowed?.(exec))
209
+ if (await options.simpleCommandAllowed?.(exec))
197
210
  return next();
198
211
  const definition = tools.get(exec.name, exec.agent);
199
212
  if (definition === undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsmm/dsmm",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
4
4
  "description": "Native Deepwork roles, routing, profiles, and permission controls for DeepSeek Harness.",
5
5
  "author": "Hugefiver",
6
6
  "license": "LicenseRef-AAAPL",