@deftai/directive-runtime 0.129.5 → 0.129.6

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 (154) hide show
  1. package/Taskfile.yml +235 -0
  2. package/UPGRADING.md +1 -0
  3. package/contracts/design-critique.md +1 -1
  4. package/contracts/path-write-fence.md +6 -0
  5. package/dist/applying-host-release.d.ts +16 -0
  6. package/dist/applying-host-release.js +98 -0
  7. package/dist/authz.d.ts +1 -1
  8. package/dist/authz.js +1 -1
  9. package/dist/check.d.ts +1 -0
  10. package/dist/check.js +27 -4
  11. package/dist/design-critique-ensure-arc-dest.d.ts +16 -0
  12. package/dist/design-critique-ensure-arc-dest.js +168 -0
  13. package/dist/dispatch.d.ts +1 -1
  14. package/dist/dispatch.js +8 -0
  15. package/dist/hook-dispatch.js +3 -2
  16. package/dist/human-presence-mint.d.ts +6 -1
  17. package/dist/human-presence-mint.js +20 -6
  18. package/dist/session-start.js +40 -6
  19. package/dist/setup-wiring.d.ts +36 -0
  20. package/dist/setup-wiring.js +169 -14
  21. package/dist/verify-source-cli/verify-deposit-closure.js +5 -5
  22. package/dist/windows-bin-ps1.d.ts +2 -2
  23. package/dist/windows-bin-ps1.js +5 -11
  24. package/docs/deft-directive-disable.md +3 -3
  25. package/package.json +2 -3
  26. package/packs/lessons/lessons-pack-0.1.json +15 -0
  27. package/packs/skills/skills-pack-0.1.json +2 -2
  28. package/skills/deft-directive-design-critique/SKILL.md +1 -1
  29. package/skills/deft-directive-release/SKILL.md +31 -1
  30. package/vendor/directive-content/Taskfile.yml +235 -0
  31. package/vendor/directive-content/UPGRADING.md +1 -0
  32. package/vendor/directive-content/contracts/design-critique.md +1 -1
  33. package/vendor/directive-content/contracts/path-write-fence.md +6 -0
  34. package/vendor/directive-content/docs/deft-directive-disable.md +3 -3
  35. package/vendor/directive-content/packs/lessons/lessons-pack-0.1.json +15 -0
  36. package/vendor/directive-content/packs/skills/skills-pack-0.1.json +2 -2
  37. package/vendor/directive-content/skills/deft-directive-design-critique/SKILL.md +1 -1
  38. package/vendor/directive-content/skills/deft-directive-release/SKILL.md +31 -1
  39. package/vendor/directive-core/dist/.tsbuildinfo +1 -1
  40. package/vendor/directive-core/dist/authz/classify.d.ts +12 -0
  41. package/vendor/directive-core/dist/authz/classify.d.ts.map +1 -1
  42. package/vendor/directive-core/dist/authz/classify.js +40 -12
  43. package/vendor/directive-core/dist/authz/classify.js.map +1 -1
  44. package/vendor/directive-core/dist/authz/templates.d.ts +2 -2
  45. package/vendor/directive-core/dist/authz/templates.d.ts.map +1 -1
  46. package/vendor/directive-core/dist/authz/templates.js +1 -0
  47. package/vendor/directive-core/dist/authz/templates.js.map +1 -1
  48. package/vendor/directive-core/dist/authz/types.d.ts +1 -1
  49. package/vendor/directive-core/dist/authz/types.d.ts.map +1 -1
  50. package/vendor/directive-core/dist/authz/types.js +2 -0
  51. package/vendor/directive-core/dist/authz/types.js.map +1 -1
  52. package/vendor/directive-core/dist/authz/verb-classification.d.ts.map +1 -1
  53. package/vendor/directive-core/dist/authz/verb-classification.js +30 -3
  54. package/vendor/directive-core/dist/authz/verb-classification.js.map +1 -1
  55. package/vendor/directive-core/dist/cache/fetch.d.ts.map +1 -1
  56. package/vendor/directive-core/dist/cache/fetch.js +50 -4
  57. package/vendor/directive-core/dist/cache/fetch.js.map +1 -1
  58. package/vendor/directive-core/dist/design-critique/arc-dest.d.ts +22 -5
  59. package/vendor/directive-core/dist/design-critique/arc-dest.d.ts.map +1 -1
  60. package/vendor/directive-core/dist/design-critique/arc-dest.js +61 -0
  61. package/vendor/directive-core/dist/design-critique/arc-dest.js.map +1 -1
  62. package/vendor/directive-core/dist/design-critique/run-posture.d.ts +7 -2
  63. package/vendor/directive-core/dist/design-critique/run-posture.d.ts.map +1 -1
  64. package/vendor/directive-core/dist/design-critique/run-posture.js +6 -1
  65. package/vendor/directive-core/dist/design-critique/run-posture.js.map +1 -1
  66. package/vendor/directive-core/dist/hooks/dispatcher.d.ts.map +1 -1
  67. package/vendor/directive-core/dist/hooks/dispatcher.js +174 -12
  68. package/vendor/directive-core/dist/hooks/dispatcher.js.map +1 -1
  69. package/vendor/directive-core/dist/hooks/shell-write-targets.d.ts +5 -0
  70. package/vendor/directive-core/dist/hooks/shell-write-targets.d.ts.map +1 -1
  71. package/vendor/directive-core/dist/hooks/shell-write-targets.js +18 -1
  72. package/vendor/directive-core/dist/hooks/shell-write-targets.js.map +1 -1
  73. package/vendor/directive-core/dist/init-deposit/host-hook-outer.d.ts +5 -0
  74. package/vendor/directive-core/dist/init-deposit/host-hook-outer.d.ts.map +1 -1
  75. package/vendor/directive-core/dist/init-deposit/host-hook-outer.js +22 -9
  76. package/vendor/directive-core/dist/init-deposit/host-hook-outer.js.map +1 -1
  77. package/vendor/directive-core/dist/init-deposit/scaffold.d.ts +8 -1
  78. package/vendor/directive-core/dist/init-deposit/scaffold.d.ts.map +1 -1
  79. package/vendor/directive-core/dist/init-deposit/scaffold.js +38 -4
  80. package/vendor/directive-core/dist/init-deposit/scaffold.js.map +1 -1
  81. package/vendor/directive-core/dist/install-health/cheap.d.ts +2 -1
  82. package/vendor/directive-core/dist/install-health/cheap.d.ts.map +1 -1
  83. package/vendor/directive-core/dist/install-health/cheap.js +4 -3
  84. package/vendor/directive-core/dist/install-health/cheap.js.map +1 -1
  85. package/vendor/directive-core/dist/install-health/constants.d.ts +18 -2
  86. package/vendor/directive-core/dist/install-health/constants.d.ts.map +1 -1
  87. package/vendor/directive-core/dist/install-health/constants.js +18 -2
  88. package/vendor/directive-core/dist/install-health/constants.js.map +1 -1
  89. package/vendor/directive-core/dist/policy/deft-directive-disable.d.ts +42 -5
  90. package/vendor/directive-core/dist/policy/deft-directive-disable.d.ts.map +1 -1
  91. package/vendor/directive-core/dist/policy/deft-directive-disable.js +71 -41
  92. package/vendor/directive-core/dist/policy/deft-directive-disable.js.map +1 -1
  93. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.d.ts +6 -1
  94. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.d.ts.map +1 -1
  95. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.js +24 -12
  96. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.js.map +1 -1
  97. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.d.ts +68 -14
  98. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.d.ts.map +1 -1
  99. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.js +278 -47
  100. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.js.map +1 -1
  101. package/vendor/directive-core/dist/release/gh.d.ts.map +1 -1
  102. package/vendor/directive-core/dist/release/gh.js +2 -1
  103. package/vendor/directive-core/dist/release/gh.js.map +1 -1
  104. package/vendor/directive-core/dist/release/version.d.ts +4 -2
  105. package/vendor/directive-core/dist/release/version.d.ts.map +1 -1
  106. package/vendor/directive-core/dist/release/version.js +4 -2
  107. package/vendor/directive-core/dist/release/version.js.map +1 -1
  108. package/vendor/directive-core/dist/release-publish/gh-api.d.ts.map +1 -1
  109. package/vendor/directive-core/dist/release-publish/gh-api.js +4 -2
  110. package/vendor/directive-core/dist/release-publish/gh-api.js.map +1 -1
  111. package/vendor/directive-core/dist/release-publish/main.d.ts.map +1 -1
  112. package/vendor/directive-core/dist/release-publish/main.js +15 -4
  113. package/vendor/directive-core/dist/release-publish/main.js.map +1 -1
  114. package/vendor/directive-core/dist/release-publish/pipeline.d.ts +11 -0
  115. package/vendor/directive-core/dist/release-publish/pipeline.d.ts.map +1 -1
  116. package/vendor/directive-core/dist/release-publish/pipeline.js +143 -2
  117. package/vendor/directive-core/dist/release-publish/pipeline.js.map +1 -1
  118. package/vendor/directive-core/dist/release-rollback/gh.d.ts.map +1 -1
  119. package/vendor/directive-core/dist/release-rollback/gh.js +2 -1
  120. package/vendor/directive-core/dist/release-rollback/gh.js.map +1 -1
  121. package/vendor/directive-core/dist/session/git.d.ts +21 -2
  122. package/vendor/directive-core/dist/session/git.d.ts.map +1 -1
  123. package/vendor/directive-core/dist/session/git.js +21 -4
  124. package/vendor/directive-core/dist/session/git.js.map +1 -1
  125. package/vendor/directive-core/dist/session/occupancy.d.ts +93 -6
  126. package/vendor/directive-core/dist/session/occupancy.d.ts.map +1 -1
  127. package/vendor/directive-core/dist/session/occupancy.js +215 -52
  128. package/vendor/directive-core/dist/session/occupancy.js.map +1 -1
  129. package/vendor/directive-core/dist/session/session-start.d.ts.map +1 -1
  130. package/vendor/directive-core/dist/session/session-start.js +5 -2
  131. package/vendor/directive-core/dist/session/session-start.js.map +1 -1
  132. package/vendor/directive-core/dist/swarm/dest-place.d.ts +1 -1
  133. package/vendor/directive-core/dist/swarm/dest-place.d.ts.map +1 -1
  134. package/vendor/directive-core/dist/swarm/dest-place.js +36 -41
  135. package/vendor/directive-core/dist/swarm/dest-place.js.map +1 -1
  136. package/vendor/directive-core/dist/swarm/finalize-owed.d.ts +14 -0
  137. package/vendor/directive-core/dist/swarm/finalize-owed.d.ts.map +1 -1
  138. package/vendor/directive-core/dist/swarm/finalize-owed.js +214 -48
  139. package/vendor/directive-core/dist/swarm/finalize-owed.js.map +1 -1
  140. package/vendor/directive-core/dist/swarm/launch.d.ts.map +1 -1
  141. package/vendor/directive-core/dist/swarm/launch.js +15 -4
  142. package/vendor/directive-core/dist/swarm/launch.js.map +1 -1
  143. package/vendor/directive-core/dist/swarm/worktree-pm-install.d.ts +49 -2
  144. package/vendor/directive-core/dist/swarm/worktree-pm-install.d.ts.map +1 -1
  145. package/vendor/directive-core/dist/swarm/worktree-pm-install.js +207 -12
  146. package/vendor/directive-core/dist/swarm/worktree-pm-install.js.map +1 -1
  147. package/vendor/directive-core/dist/swarm/worktrees-cli.d.ts +6 -0
  148. package/vendor/directive-core/dist/swarm/worktrees-cli.d.ts.map +1 -1
  149. package/vendor/directive-core/dist/swarm/worktrees-cli.js +79 -2
  150. package/vendor/directive-core/dist/swarm/worktrees-cli.js.map +1 -1
  151. package/vendor/directive-core/dist/swarm/worktrees.d.ts +12 -1
  152. package/vendor/directive-core/dist/swarm/worktrees.d.ts.map +1 -1
  153. package/vendor/directive-core/dist/swarm/worktrees.js +34 -26
  154. package/vendor/directive-core/dist/swarm/worktrees.js.map +1 -1
@@ -14,6 +14,10 @@
14
14
  import { classifyMcpTool, classifyShellCommand, listShellOps } from "../policy/runtime-authority.js";
15
15
  import type { AuthzOperation } from "./types.js";
16
16
  export type AuthzClassifiedOp = AuthzOperation | "test" | "evidence" | "unknown" | "protected_store";
17
+ /** Kill-switch / permanent opt-out basenames agents must not plant (#3186 / #3039 / #6136). */
18
+ export declare const KILL_SWITCH_BASENAMES: readonly [".deft-directive-disable", ".no-deft-directive"];
19
+ /** True when a path basename is a kill-switch / permanent opt-out plant target (#6136). */
20
+ export declare function isKillSwitchPlantPath(pathish: string): boolean;
17
21
  /** True when a recovered dest literal is a payload-relative protected path. */
18
22
  export declare function destLiteralIsRelativeProtected(dest: string): boolean;
19
23
  /**
@@ -23,6 +27,12 @@ export declare function destLiteralIsRelativeProtected(dest: string): boolean;
23
27
  * symlink dest can still be realpath-resolved.
24
28
  */
25
29
  export declare function harvestDestsOfWriteForRealpath(command: string): string[];
30
+ /**
31
+ * Shell write targeting `.deft-directive-disable` / `.no-deft-directive` (#3186 / #3039 / #3213 / #6136).
32
+ * Always-on grant-gated plant deny (not UAT-only). Includes symlink plant bins
33
+ * (`ln`/`link`/`mklink`) and quote-split-resistant basename checks.
34
+ */
35
+ export declare function hasKillSwitchShellWrite(command: string, tokens?: readonly string[]): boolean;
26
36
  /** Best-effort shell classification for UAT-sensitive ops beyond push/merge. */
27
37
  export declare function classifyShellAuthzOps(command: string): AuthzClassifiedOp[];
28
38
  /** Map a PreToolUse tool name + optional shell command to authz ops. */
@@ -33,6 +43,8 @@ export declare function classifyHookAuthzOps(input: {
33
43
  readonly mcpArgsText?: string | null;
34
44
  /** Payload root for #4188 harvest realpath. Blank/omitted skips harvest. */
35
45
  readonly projectRoot?: string | null;
46
+ /** Direct Write/Edit target path for always-on kill-switch plant classify (#6136). */
47
+ readonly writePath?: string | null;
36
48
  }): AuthzClassifiedOp[];
37
49
  /**
38
50
  * Public pin for #4709: Shell write targeting `.deft/authz/` or `.deft/approved-scope/`.
@@ -1 +1 @@
1
- {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/authz/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,YAAY,EAEb,MAAM,gCAAgC,CAAC;AAKxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,MAAM,GACN,UAAU,GACV,SAAS,GACT,iBAAiB,CAAC;AA2gGtB,+EAA+E;AAC/E,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpE;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA4BxE;AA+5CD,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAgH1E;AA+OD,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC,GAAG,iBAAiB,EAAE,CAkDtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAYvE;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,GAAG,IAAI,CAkEf;AAED,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/authz/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,YAAY,EAEb,MAAM,gCAAgC,CAAC;AAKxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,MAAM,GACN,UAAU,GACV,SAAS,GACT,iBAAiB,CAAC;AA6KtB,+FAA+F;AAC/F,eAAO,MAAM,qBAAqB,4DAA6D,CAAC;AAEhG,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQ9D;AA61FD,+EAA+E;AAC/E,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpE;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA4BxE;AAuaD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAK5F;AAo/BD,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAiH1E;AA+OD,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,sFAAsF;IACtF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,GAAG,iBAAiB,EAAE,CA2DtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAYvE;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,GAAG,IAAI,CAkEf;AAED,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC"}
@@ -185,8 +185,20 @@ const POLICY_AUTHORITY_MUTATORS = new Set([
185
185
  "disable-directive",
186
186
  "enable-directive",
187
187
  ]);
188
- /** Kill-switch / permanent opt-out basenames agents must not plant under UAT (#3186 / #3039). */
189
- const KILL_SWITCH_BASENAMES = [".deft-directive-disable", ".no-deft-directive"];
188
+ /** Kill-switch / permanent opt-out basenames agents must not plant (#3186 / #3039 / #6136). */
189
+ export const KILL_SWITCH_BASENAMES = [".deft-directive-disable", ".no-deft-directive"];
190
+ /** True when a path basename is a kill-switch / permanent opt-out plant target (#6136). */
191
+ export function isKillSwitchPlantPath(pathish) {
192
+ // Lowercase so Windows / case-insensitive plants (`.DEFT-DIRECTIVE-DISABLE`) match.
193
+ const p = canonicalizePathish(pathish).toLowerCase();
194
+ if (p.length === 0)
195
+ return false;
196
+ for (const name of KILL_SWITCH_BASENAMES) {
197
+ if (p === name || p.endsWith(`/${name}`))
198
+ return true;
199
+ }
200
+ return false;
201
+ }
190
202
  /**
191
203
  * Dest-form writers #3529 harvest missed (#3545). Shared across downloader,
192
204
  * archive-alt, positional, and indirect-write membership so a named-peer
@@ -3522,7 +3534,7 @@ function sqlite3MetaDest(raw, next) {
3522
3534
  return null;
3523
3535
  }
3524
3536
  function pathishMentionsKillSwitch(pathish) {
3525
- const p = canonicalizePathish(pathish);
3537
+ const p = canonicalizePathish(pathish).toLowerCase();
3526
3538
  for (const name of KILL_SWITCH_BASENAMES) {
3527
3539
  if (p === name || p.endsWith(`/${name}`) || p.includes(name)) {
3528
3540
  return true;
@@ -3531,11 +3543,18 @@ function pathishMentionsKillSwitch(pathish) {
3531
3543
  return false;
3532
3544
  }
3533
3545
  /**
3534
- * Shell write targeting `.deft-directive-disable` / `.no-deft-directive` (#3186 / #3039 / #3213).
3535
- * Planting the kill-switch under UAT would full-bypass subsequent gates without operator recovery.
3536
- * Includes symlink plant bins (`ln`/`link`/`mklink`) and quote-split-resistant basename checks.
3546
+ * Shell write targeting `.deft-directive-disable` / `.no-deft-directive` (#3186 / #3039 / #3213 / #6136).
3547
+ * Always-on grant-gated plant deny (not UAT-only). Includes symlink plant bins
3548
+ * (`ln`/`link`/`mklink`) and quote-split-resistant basename checks.
3537
3549
  */
3538
- function hasKillSwitchShellWrite(command, tokens) {
3550
+ export function hasKillSwitchShellWrite(command, tokens) {
3551
+ const cmd = command.trim();
3552
+ if (cmd.length === 0)
3553
+ return false;
3554
+ const resolvedTokens = tokens ?? shellTokens(cmd);
3555
+ return hasKillSwitchShellWriteInner(cmd, resolvedTokens);
3556
+ }
3557
+ function hasKillSwitchShellWriteInner(command, tokens) {
3539
3558
  const lower = command.toLowerCase().replace(/\\/g, "/");
3540
3559
  // Quote-stripped form so `'.deft'-directive-disable`-class splits still match (#3213).
3541
3560
  const stripped = lower.replace(/['"]/g, "");
@@ -3575,6 +3594,8 @@ function hasKillSwitchShellWrite(command, tokens) {
3575
3594
  }
3576
3595
  // Write/destructive + symlink plant + archive/alt-write bins with a kill-switch path
3577
3596
  // argument (#3213 ln/link/mklink; #3245 tar/axel/rclone/socat residual).
3597
+ // echo/printf/type are stdout-only without a redirect; redirect dests are handled
3598
+ // above so bare `echo .deft-directive-disable` stays non-plant (#6136 Greptile P2).
3578
3599
  const killWriteBins = new Set([
3579
3600
  ...INDIRECT_WRITE_BINS,
3580
3601
  ...SYMLINK_PLANT_BINS,
@@ -3582,9 +3603,6 @@ function hasKillSwitchShellWrite(command, tokens) {
3582
3603
  "touch",
3583
3604
  "new-item",
3584
3605
  "ni",
3585
- "echo",
3586
- "printf",
3587
- "type",
3588
3606
  ]);
3589
3607
  for (let ti = 0; ti < tokens.length; ti++) {
3590
3608
  const binTok = normalizeToken(tokens[ti]);
@@ -4582,7 +4600,8 @@ export function classifyShellAuthzOps(command) {
4582
4600
  found.add("settings");
4583
4601
  if (commandHasAuthzDirShellWrite(cmd, tokens))
4584
4602
  found.add("settings");
4585
- // #3186: kill-switch plant + policy authority mutators → settings (UAT fail-closed).
4603
+ // #3186 / #6136: kill-switch plant + policy authority mutators → settings
4604
+ // (always-on grant-gated via dispatcher; not UAT-only).
4586
4605
  if (hasKillSwitchShellWrite(cmd, tokens))
4587
4606
  found.add("settings");
4588
4607
  if (hasPolicyAuthorityMutator(tokens))
@@ -4887,8 +4906,17 @@ function hasWriteShapedProtectedSettingsDest(command, tokens) {
4887
4906
  /** Map a PreToolUse tool name + optional shell command to authz ops. */
4888
4907
  export function classifyHookAuthzOps(input) {
4889
4908
  const { toolName, shellCommand, isDirectWrite } = input;
4890
- if (isDirectWrite)
4909
+ if (isDirectWrite) {
4910
+ // Prefer-A Bound #6136: kill-switch Write/Edit is `settings` (always-on grant
4911
+ // gate). Keep off bare `edit` — isProtectedStoreEditDest treats the flag
4912
+ // basenames themselves as protected and would deny before the grant check.
4913
+ // Symlink plants into `.deft/authz/` are denied in dispatcher via realpath
4914
+ // (not this op class alone).
4915
+ const writePath = (input.writePath ?? "").trim();
4916
+ if (writePath.length > 0 && isKillSwitchPlantPath(writePath))
4917
+ return ["settings"];
4891
4918
  return ["edit"];
4919
+ }
4892
4920
  const lower = toolName.toLowerCase();
4893
4921
  // Shared catalog (#4041 / #3987). A second name list missed Grok monitor.
4894
4922
  if (isShellTool(toolName)) {