dsh-permission-rules 0.4.0 → 0.4.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to dsh-permission-rules are recorded here, newest first.
4
4
 
5
+ ## v0.4.2 — 2026-08-15
6
+
7
+ ### Ecosystem intake
8
+
9
+ - Declares the DSH Hub Workshop intake manifest in `package.json#dshWorkshop` (`omdsh-workshop-package/v1`): `harness-profile` integration via the bundle patch, transactional install with generation rollback, restart-profile activation with supported dispose, structured permissions (`files:read`, `files:watch`, `session:append`, `network:none`), RC.6 compatibility, and a named `/rules` command capability. Runtime evidence paths stay `null` — author-declared only until Harness-produced lifecycle evidence exists.
10
+
11
+ ## v0.4.1 — 2026-08-15
12
+
13
+ ### Audit safety on every host (fixes [#2](https://github.com/PerryLink/dsh-permission-rules/issues/2))
14
+
15
+ - Hosts whose `Session.append` predates the `ignorable` envelope marker (the `0.1.0-rc.6` line) silently drop the marker, writing audit events that make sessions unresumable on stricter harness builds (`SessionFormatUnsupportedError`). The runtime now detects such hosts BEFORE the first append (peer-version pre-check) and re-checks after the first append (probe of the returned envelope), then degrades gracefully: session-log audit is disabled with a one-time warning so session logs stay loadable everywhere.
16
+ - New `allowUnmarkedAudit` config (default `false`): set `true` to opt back into the in-session audit trail on pre-marker hosts (accepting that those sessions may need `scripts/repair-session-logs.mjs` before loading on a newer harness). `/rules decisions` explains the disabled audit on degraded hosts.
17
+ - `events.ts` no longer claims rc.6 hosts are harmless ("no failure either way") — the failure mode is documented accurately, and `isMarkedAuditEvent`/`isUnmarkedHostVersion` ship as exported capability helpers.
18
+ - Thanks to [@22xuan](https://github.com/22xuan) for the detailed report and the upstream harness discussion; credited in the README Acknowledgments.
19
+
20
+ ### Engineering
21
+
22
+ - 139 tests across 9 suites: new `audit-support.spec.ts` covers the version-line classification, the envelope probe, the pre-append degradation, the opt-in, and the `/rules decisions` notice. Five-language READMEs (config table, Known limitations, Acknowledgments), AGENTS.md, CHANGELOG, and VERIFICATION updated.
23
+
5
24
  ## v0.4.0 — 2026-08-15
6
25
 
7
26
  ### Hot reload and workspace identity
@@ -18,6 +37,7 @@ All notable changes to dsh-permission-rules are recorded here, newest first.
18
37
  ### Engineering
19
38
 
20
39
  - 133 tests across 8 suites (new coverage: creation-adoption watch paths, fallback recreation, cache-key dedup, `--platform`, `list`, source attribution); coverage gate held. Five-language READMEs, both rules-format references, AGENTS.md, and the `/rules` command hint updated.
40
+ - The test harness now mounts with `watch: false` by default (only the chokidar-mocked watch suite opts in): real watchers on temp workspaces tripped a Node 24 + Windows libuv assertion (`src\win\fs-event.c`) when dirs were removed mid-test — the pre-existing cause of the red windows-latest/Node 24 matrix cells since v0.3.0.
21
41
 
22
42
  ## v0.3.0 — 2026-08-14
23
43
 
package/README.es.md CHANGED
@@ -11,6 +11,8 @@
11
11
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-permission-rules/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-permission-rules/actions)
13
13
  [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-permission-rules?label=version)](https://github.com/PerryLink/dsh-permission-rules/releases)
14
+ [![npm version](https://img.shields.io/npm/v/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
15
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
14
16
 
15
17
  [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
16
18
 
@@ -53,7 +55,7 @@ Un segundo modelo responde *"¿es segura ESTA llamada?"* con criterio, pero cues
53
55
  - ✅ **Metadatos de reglas** — `enabled: false`, `description`, `tags`; `/rules` advierte sobre reglas eclipsadas por un catch-all anterior
54
56
  - ✅ **Seguro para el waterfall** — `allow`/paso siempre llaman a `next()`; solo `deny`/`ask` cortocircuitan
55
57
  - ✅ **Seam de aprobación oficial** — `ask` fluye por `ctx.approval`; nunca reimplementado, nunca eludido
56
- - ✅ **Auditoría completa** — los eventos `permissionRules/decision` llevan la acción de la regla, el cwd del workspace Y el resultado final de cada llamada; `/rules decisions` reproduce el rastro en la sesión
58
+ - ✅ **Auditoría completa** — los eventos `permissionRules/decision` llevan la acción de la regla, el cwd del workspace Y el resultado final de cada llamada; `/rules decisions` reproduce el rastro en la sesión; los hosts anteriores al marcador de envoltura de auditoría degradan a auditoría desactivada con un aviso único en lugar de escribir registros irrecuperables (`allowUnmarkedAudit` la reactiva)
57
59
  - ✅ **Despliegue en simulación** — `enforce: false` audita lo que la política *haría* (acción hipotética + resultado real posterior, marcado `dryRun`) mientras deja pasar todas las llamadas; prueba segura de políticas en producción
58
60
  - ✅ **Prueba en seco** — `/rules test <tool> <json-args>` evalúa las reglas activas sin ejecutar nada, con sobrescrituras `--cwd`, `--env`, `--agent` y `--platform` para cada dimensión
59
61
  - ✅ **Recarga en caliente** — vigilancia Chokidar con debounce; una edición rota conserva las reglas previas, nunca falla; un archivo de reglas creado a mitad de sesión (el del proyecto o el fallback) se adopta automáticamente, sin recarga manual
@@ -68,7 +70,7 @@ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"
68
70
 
69
71
  # o desde un tarball empaquetado (artefactos compilados, sin permiso de build)
70
72
  pnpm pack
71
- dsh plugin --profile web add ./dsh-permission-rules-0.4.0.tgz
73
+ dsh plugin --profile web add ./dsh-permission-rules-0.4.1.tgz
72
74
 
73
75
  # 2. reinicia
74
76
  dsh --profile web
@@ -114,6 +116,7 @@ Todos los ajustes son campos `Config` de Schemastery (modificables desde cordis.
114
116
  | `searchUp` | `false` | Recorre los directorios padre desde el cwd de la sesión y combina cada archivo de reglas encontrado, el más cercano primero |
115
117
  | `maxGlobStars` | `2` | Límite duro de cuantificadores `*`/`**` sin límite por patrón glob (cota del grado de backtracking) |
116
118
  | `enforce` | `true` | `false` = modo simulación: los aciertos deny/ask solo se registran en auditoría con un marcador `dryRun` (acción hipotética + resultado real posterior) y todas las llamadas pasan — prueba una política antes de aplicarla |
119
+ | `allowUnmarkedAudit` | `false` | Los hosts cuyo `Session.append` es anterior al marcador `ignorable` (la línea `0.1.0-rc.6`) escriben eventos de auditoría sin marcar, haciendo las sesiones irrecuperables en builds más estrictos: el plugin los detecta y desactiva la auditoría del registro de sesión con un aviso único. Ponlo en `true` para reactivar el rastro en la sesión (repara los registros existentes con `scripts/repair-session-logs.mjs`) |
117
120
 
118
121
  ### Comandos de sesión
119
122
 
@@ -151,7 +154,7 @@ La salida de los comandos es solo UI: el modelo aprende las reglas únicamente a
151
154
 
152
155
  ## Limitaciones conocidas
153
156
 
154
- - `permissionRules/decision` se añade con el marcador de envoltura `ignorable: true`, de modo que cualquier build del harness carga el registro: los lectores que no conocen el tipo fuera del repositorio simplemente omiten el registro de auditoría en lugar de rechazar la sesión. (Los hosts rc.6 aceptan e ignoran el marcador, conservando exactamente el comportamiento anterior; las sesiones escritas en hosts rc.6 carecen del marcador y pueden necesitar `scripts/repair-session-logs.mjs` antes de cargarse en hosts con semántica required-on-read.)
157
+ - `permissionRules/decision` se añade con el marcador de envoltura `ignorable: true`, de modo que cualquier build del harness carga el registro: los lectores que no conocen el tipo fuera del repositorio simplemente omiten el registro de auditoría en lugar de rechazar la sesión. Los hosts cuyo `Session.append` es anterior al marcador (la línea `0.1.0-rc.6`) lo DESCARTAN silenciosamente: el plugin los detecta en tiempo de ejecución (verificación previa de la versión del peer + una sonda del sobre añadido) y desactiva la auditoría del registro de sesión con un aviso único, para que los registros sigan siendo cargables en cualquier parte. Pon `allowUnmarkedAudit: true` para reactivar el rastro en la sesión; los registros ya escritos sin marcador pueden repararse con `scripts/repair-session-logs.mjs` antes de cargarlos en hosts con semántica required-on-read.
155
158
  - Los candidatos de `paths` son heurísticos: solo las claves de argumentos documentadas alimentan la coincidencia de rutas, y la coincidencia relativa al workspace ignora las mayúsculas ASCII solo cuando `caseInsensitivePaths` está activo.
156
159
  - Los globs son un subconjunto conservador (sin expansión de llaves): escribe dos patrones o usa el modo regex.
157
160
  - El guard de backtracking de regex es estructural, no exhaustivo: los casos de ambigüedad por alternancia sin prefijos literales (p. ej. lookarounds elaborados) son responsabilidad del autor; prefiere el modo glob para archivos no confiables.
@@ -173,7 +176,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
173
176
  pnpm install # node ^22.19 || >=24
174
177
  pnpm run typecheck # tsc, src + tests
175
178
  pnpm run lint # eslint, src + tests + scripts
176
- pnpm test # vitest: 133 tests, 8 suites
179
+ pnpm test # vitest: 139 tests, 9 suites
177
180
  pnpm run test:coverage # puerta de cobertura (90/80/90/90)
178
181
  pnpm run build # declaraciones tsc + bundles tsdown (lib/)
179
182
  pnpm run pack:check # build + pack (el artefacto publicado)
@@ -182,6 +185,11 @@ node scripts/check-readme-sync.mjs # puerta de sincronización de READMEs en ci
182
185
 
183
186
  Consulta [VERIFICATION.md](VERIFICATION.md) para el registro de verificación headless de extremo a extremo (deny bloqueando una herramienta de shell, ask enrutado por el seam de aprobación, `--dump-config`).
184
187
 
188
+ ## Colaboradores
189
+
190
+ - [@PerryLink](https://github.com/PerryLink) — creador y mantenedor: vocabulario y evaluación de reglas, runtime, vigilancia HMR, auditoría del registro de sesión y documentación en cinco idiomas.
191
+ - [@22xuan](https://github.com/22xuan) — el detallado informe sobre los hosts rc.6 que descartan silenciosamente el marcador `ignorable` de los eventos de auditoría ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) y la discusión en el harness upstream; la detección de capacidades del host de v0.4.1 y la corrección de la documentación derivan directamente de ese análisis.
192
+
185
193
  ## Licencia
186
194
 
187
195
  [Apache License 2.0](LICENSE) © 2026 dsh-permission-rules contributors
package/README.hi.md CHANGED
@@ -11,6 +11,8 @@
11
11
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-permission-rules/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-permission-rules/actions)
13
13
  [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-permission-rules?label=version)](https://github.com/PerryLink/dsh-permission-rules/releases)
14
+ [![npm version](https://img.shields.io/npm/v/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
15
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
14
16
 
15
17
  [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
16
18
 
@@ -53,7 +55,7 @@ tools/pre-execute waterfall approval/request waterfall (answ
53
55
  - ✅ **नियम मेटाडेटा** — `enabled: false`, `description`, `tags`; `/rules` पहले किसी catch-all से छिपे नियमों की चेतावनी देता है
54
56
  - ✅ **waterfall-सुरक्षित** — `allow`/पास-थ्रू हमेशा `next()` बुलाते हैं; केवल `deny`/`ask` शॉर्ट-सर्किट करते हैं
55
57
  - ✅ **आधिकारिक approval seam** — `ask` `ctx.approval` से होकर जाता है; कभी पुनः-कार्यान्वित नहीं, कभी बायपास नहीं
56
- - ✅ **पूर्ण ऑडिट** — `permissionRules/decision` इवेंट हर कॉल के लिए नियम क्रिया, workspace cwd और अंतिम परिणाम रखते हैं; `/rules decisions` सत्र में रास्ता फिर चलाता है
58
+ - ✅ **पूर्ण ऑडिट** — `permissionRules/decision` इवेंट हर कॉल के लिए नियम क्रिया, workspace cwd और अंतिम परिणाम रखते हैं; `/rules decisions` सत्र में रास्ता फिर चलाता है; ऑडिट एन्वेलप मार्कर से पुराने होस्ट अप्राप्य लॉग लिखने के बजाय एक-बार चेतावनी के साथ ऑडिट-बंद हो जाते हैं (`allowUnmarkedAudit` पुनः चालू करता है)
57
59
  - ✅ **dry-run रोलआउट** — `enforce: false` केवल ऑडिट करता है कि नीति *क्या करती* (काल्पनिक क्रिया + वास्तविक डाउनस्ट्रीम परिणाम, `dryRun` चिह्नित) और हर कॉल को पास करता है; उत्पादन में नई नीति का सुरक्षित परीक्षण
58
60
  - ✅ **dry-run परीक्षण** — `/rules test <tool> <json-args>` कुछ भी निष्पादित किए बिना सक्रिय नियमों का मूल्यांकन करता है, हर मिलान आयाम के लिए `--cwd`, `--env`, `--agent` और `--platform` ओवरराइड के साथ
59
61
  - ✅ **हॉट रीलोड** — debounce सहित Chokidar निगरानी; टूटा हुआ संपादन पिछले नियम रखता है, कभी क्रैश नहीं करता; सत्र के बीच बनाई गई नियम फ़ाइल (प्रोजेक्ट की या fallback) स्वतः अपनाई जाती है, मैनुअल रीलोड की आवश्यकता नहीं
@@ -68,7 +70,7 @@ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"
68
70
 
69
71
  # या पैक किए गए tarball से (बिल्ट आर्टिफ़ैक्ट, build अनुमति की ज़रूरत नहीं)
70
72
  pnpm pack
71
- dsh plugin --profile web add ./dsh-permission-rules-0.4.0.tgz
73
+ dsh plugin --profile web add ./dsh-permission-rules-0.4.1.tgz
72
74
 
73
75
  # 2. पुनः आरंभ करें
74
76
  dsh --profile web
@@ -114,6 +116,7 @@ dsh --profile web --dump-config | grep -A4 'id: permission-rules' # पंक
114
116
  | `searchUp` | `false` | सत्र cwd से पैरेंट निर्देशिकाओं पर चलकर हर मिली नियम फ़ाइल मिलाता है, निकटतम पहले |
115
117
  | `maxGlobStars` | `2` | प्रति glob पैटर्न असीमित `*`/`**` क्वांटिफ़ायर की कठोर सीमा (बैकट्रैकिंग-डिग्री सीमा) |
116
118
  | `enforce` | `true` | `false` = dry-run मोड: deny/ask मिलान केवल ऑडिट में `dryRun` चिह्न के साथ दर्ज होते हैं (काल्पनिक क्रिया + वास्तविक डाउनस्ट्रीम परिणाम) और हर कॉल पास होती है — लागू करने से पहले नीति का परीक्षण करें |
119
+ | `allowUnmarkedAudit` | `false` | जिन होस्ट का `Session.append` `ignorable` मार्कर से पुराना है (`0.1.0-rc.6` शृंखला) वे बिना-चिह्न ऑडिट इवेंट लिखते हैं, जिससे सत्र कठोर बिल्ड पर अप्राप्य हो जाते हैं: प्लगइन ऐसे होस्ट का पता लगाकर एक-बार चेतावनी के साथ सत्र-लॉग ऑडिट बंद कर देता है। सत्र में रास्ता वापस चाहिए तो `true` सेट करें (मौजूदा लॉग `scripts/repair-session-logs.mjs` से मरम्मत करें) |
117
120
 
118
121
  ### सेशन कमांड
119
122
 
@@ -151,7 +154,7 @@ dsh --profile web --dump-config | grep -A4 'id: permission-rules' # पंक
151
154
 
152
155
  ## ज्ञात सीमाएँ
153
156
 
154
- - `permissionRules/decision` एन्वेलप के `ignorable: true` मार्कर के साथ जोड़ा जाता है, इसलिए कोई भी harness बिल्ड लॉग लोड कर लेता है — जो पाठक इस आउट-ऑफ-रेपो प्रकार को नहीं जानते वे सत्र अस्वीकार करने के बजाय केवल ऑडिट रिकॉर्ड छोड़ देते हैं। (rc.6 होस्ट मार्कर को स्वीकार कर अनदेखा करते हैं, पहले जैसा ही व्यवहार बना रहता है; rc.6 होस्ट पर लिखे सत्रों में मार्कर नहीं होता और required-on-read शब्दार्थ वाले होस्ट पर लोड से पहले `scripts/repair-session-logs.mjs` की ज़रूरत पड़ सकती है।)
157
+ - `permissionRules/decision` एन्वेलप के `ignorable: true` मार्कर के साथ जोड़ा जाता है, इसलिए कोई भी harness बिल्ड लॉग लोड कर लेता है — जो पाठक इस आउट-ऑफ-रेपो प्रकार को नहीं जानते वे सत्र अस्वीकार करने के बजाय केवल ऑडिट रिकॉर्ड छोड़ देते हैं। मार्कर से पुराने होस्ट (`0.1.0-rc.6` शृंखला) इसे चुपचाप गिरा देते हैं: प्लगइन रनटाइम पर उन्हें पहचानता है (peer संस्करण पूर्व-जाँच + जोड़े गए एन्वेलप की जाँच) और एक-बार चेतावनी के साथ सत्र-लॉग ऑडिट बंद कर देता है, ताकि लॉग हर जगह लोड होते रहें। सत्र में रास्ता वापस चाहिए तो `allowUnmarkedAudit: true` सेट करें; बिना-चिह्न लिखे गए लॉग required-on-read शब्दार्थ वाले होस्ट पर लोड से पहले `scripts/repair-session-logs.mjs` से मरम्मत किए जा सकते हैं।
155
158
  - `paths` उम्मीदवार ह्यूरिस्टिक हैं: केवल दस्तावेज़ित आर्गुमेंट-कुंजियाँ पथ मिलान में आती हैं, और workspace-सापेक्ष मिलान केवल तभी ASCII-केस-असंवेदनशील होता है जब `caseInsensitivePaths` चालू हो।
156
159
  - globs एक रूढ़िवादी उपसमुच्चय हैं (brace विस्तार नहीं) — दो पैटर्न लिखें या regex मोड इस्तेमाल करें।
157
160
  - regex बैकट्रैकिंग गार्ड संरचनात्मक है, संपूर्ण नहीं: शाब्दिक उपसर्ग के बिना विकल्प-अस्पष्टता के मामले (जैसे कृत्रिम lookarounds) लेखक की ज़िम्मेदारी हैं; अविश्वसनीय फ़ाइलों के लिए glob मोड पसंद करें।
@@ -173,7 +176,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
173
176
  pnpm install # node ^22.19 || >=24
174
177
  pnpm run typecheck # tsc, src + tests
175
178
  pnpm run lint # eslint, src + tests + scripts
176
- pnpm test # vitest: 133 tests, 8 suites
179
+ pnpm test # vitest: 139 tests, 9 suites
177
180
  pnpm run test:coverage # कवरेज द्वार (90/80/90/90)
178
181
  pnpm run build # tsc डिक्लेरेशन + tsdown bundles (lib/)
179
182
  pnpm run pack:check # build + pack (प्रकाशित आर्टिफ़ैक्ट)
@@ -182,6 +185,11 @@ node scripts/check-readme-sync.mjs # पाँच-भाषा README सिं
182
185
 
183
186
  headless एंड-टू-एंड सत्यापन रिकॉर्ड (deny द्वारा shell टूल रोकना, ask का approval seam से गुज़रना, `--dump-config`) [VERIFICATION.md](VERIFICATION.md) में देखें।
184
187
 
188
+ ## योगदानकर्ता
189
+
190
+ - [@PerryLink](https://github.com/PerryLink) — निर्माता और अनुरक्षक: नियम शब्दावली व मूल्यांकन, runtime, HMR निगरानी, सत्र-लॉग ऑडिट और पाँच-भाषा दस्तावेज़।
191
+ - [@22xuan](https://github.com/22xuan) — rc.6 होस्ट द्वारा ऑडिट इवेंट के `ignorable` मार्कर को चुपचाप गिराने की विस्तृत रिपोर्ट ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) और अपस्ट्रीम harness चर्चा; v0.4.1 की रनटाइम होस्ट-क्षमता पहचान और दस्तावेज़ सुधार सीधे उसी विश्लेषण से निकले हैं।
192
+
185
193
  ## लाइसेंस
186
194
 
187
195
  [Apache License 2.0](LICENSE) © 2026 dsh-permission-rules contributors
package/README.md CHANGED
@@ -11,6 +11,8 @@
11
11
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-permission-rules/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-permission-rules/actions)
13
13
  [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-permission-rules?label=version)](https://github.com/PerryLink/dsh-permission-rules/releases)
14
+ [![npm version](https://img.shields.io/npm/v/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
15
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
14
16
 
15
17
  [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
16
18
 
@@ -53,7 +55,7 @@ A second model answers *"is THIS call okay?"* with judgment, but costs a round-t
53
55
  - ✅ **Rule metadata** — `enabled: false`, `description`, `tags`; `/rules` warns about rules shadowed by an earlier catch-all
54
56
  - ✅ **Waterfall-safe** — `allow`/passthrough always call `next()`; only `deny`/`ask` short-circuit
55
57
  - ✅ **Official approval seam** — `ask` flows through `ctx.approval`; never re-implemented, never bypassed
56
- - ✅ **Full audit** — `permissionRules/decision` events carry the rule action, the workspace cwd, AND the final outcome for every call; `/rules decisions` replays the trail in-session
58
+ - ✅ **Full audit** — `permissionRules/decision` events carry the rule action, the workspace cwd, AND the final outcome for every call; `/rules decisions` replays the trail in-session; hosts that predate the audit envelope marker degrade to audit-off with a one-time warning instead of writing unresumable logs (`allowUnmarkedAudit` opts back in)
57
59
  - ✅ **Dry-run rollout** — `enforce: false` audits what the policy *would* do (would-be action + real downstream outcome, `dryRun`-marked) while passing every call through; safe policy trialing in production
58
60
  - ✅ **Dry-run testing** — `/rules test <tool> <json-args>` evaluates the active rules without executing anything, with `--cwd`, `--env`, `--agent`, and `--platform` overrides for every match dimension
59
61
  - ✅ **Hot reload** — Chokidar watch with debounce; a broken edit keeps the previous rules, never crashes; a rule file created mid-session (the project file or the fallback) is adopted automatically, no manual reload
@@ -68,7 +70,7 @@ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"
68
70
 
69
71
  # or from a packed tarball (built artifacts, no build permission needed)
70
72
  pnpm pack
71
- dsh plugin --profile web add ./dsh-permission-rules-0.4.0.tgz
73
+ dsh plugin --profile web add ./dsh-permission-rules-0.4.1.tgz
72
74
 
73
75
  # 2. restart
74
76
  dsh --profile web
@@ -114,6 +116,7 @@ All tunables are Schemastery `Config` fields (changeable from cordis.yml). An id
114
116
  | `searchUp` | `false` | Walk parent directories from the session cwd and merge every found rule file, nearest first |
115
117
  | `maxGlobStars` | `2` | Hard cap on unbounded `*`/`**` quantifiers per glob pattern (backtracking-degree bound) |
116
118
  | `enforce` | `true` | `false` = dry-run mode: deny/ask hits are audit-logged with a `dryRun` marker (would-be action + real downstream outcome) and every call passes through — trial a policy before enforcing it |
119
+ | `allowUnmarkedAudit` | `false` | Hosts whose `Session.append` predates the `ignorable` marker (the `0.1.0-rc.6` line) write audit events unmarked, making sessions unresumable on stricter builds: the plugin detects them and disables session-log audit with a one-time warning. Set `true` to opt back into the in-session trail (repair existing logs with `scripts/repair-session-logs.mjs`) |
117
120
 
118
121
  ### Session commands
119
122
 
@@ -151,7 +154,7 @@ Command output is UI-only — the model learns the rules only through the tool r
151
154
 
152
155
  ## Known limitations
153
156
 
154
- - `permissionRules/decision` is appended with the envelope's `ignorable: true` marker, so any harness build loads the log — readers that do not know the out-of-repo type simply skip the audit record instead of refusing the session. (rc.6 hosts accept and ignore the marker, keeping the exact pre-marker behavior; sessions written on rc.6 hosts lack the marker and may need `scripts/repair-session-logs.mjs` before loading on hosts with required-on-read semantics.)
157
+ - `permissionRules/decision` is appended with the envelope's `ignorable: true` marker, so any harness build loads the log — readers that do not know the out-of-repo type simply skip the audit record instead of refusing the session. Hosts whose `Session.append` predates the marker (the `0.1.0-rc.6` line) silently DROP it: the plugin detects them at runtime (peer-version pre-check + a probe of the appended envelope) and disables session-log audit with a one-time warning, so session logs stay loadable everywhere. Set `allowUnmarkedAudit: true` to opt back into the in-session trail; logs already written without the marker can be repaired with `scripts/repair-session-logs.mjs` before loading on hosts with required-on-read semantics.
155
158
  - `paths` candidates are heuristic: only the documented argument keys feed path matching, and workspace-relative matching is ASCII-case-insensitive only when `caseInsensitivePaths` is on.
156
159
  - Globs are a conservative subset (no brace expansion) — write two patterns, or use regex mode.
157
160
  - The regex backtracking guard is structural, not exhaustive: alternation-ambiguity cases without literal prefixes (e.g. crafted lookarounds) are the author's responsibility; prefer glob mode for untrusted files.
@@ -173,7 +176,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
173
176
  pnpm install # node ^22.19 || >=24
174
177
  pnpm run typecheck # tsc, src + tests
175
178
  pnpm run lint # eslint, src + tests + scripts
176
- pnpm test # vitest: 133 tests, 8 suites
179
+ pnpm test # vitest: 139 tests, 9 suites
177
180
  pnpm run test:coverage # coverage gate (90/80/90/90)
178
181
  pnpm run build # tsc declarations + tsdown bundles (lib/)
179
182
  pnpm run pack:check # build + pack (the published artifact)
@@ -182,6 +185,11 @@ node scripts/check-readme-sync.mjs # five-language README sync gate (also in CI
182
185
 
183
186
  See [VERIFICATION.md](VERIFICATION.md) for the headless end-to-end verification record (deny blocking a shell tool, ask routing through the approval seam, `--dump-config`).
184
187
 
188
+ ## Contributors
189
+
190
+ - [@PerryLink](https://github.com/PerryLink) — creator and maintainer: rule vocabulary and evaluation, runtime, HMR watch, session-log audit, and the five-language docs.
191
+ - [@22xuan](https://github.com/22xuan) — the detailed report on rc.6 hosts silently dropping the audit event's `ignorable` marker ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) and the upstream harness discussion; the v0.4.1 runtime host-capability detection and the documentation correction drew directly from that analysis.
192
+
185
193
  ## License
186
194
 
187
195
  [Apache License 2.0](LICENSE) © 2026 dsh-permission-rules contributors
package/README.pt.md CHANGED
@@ -11,6 +11,8 @@
11
11
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-permission-rules/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-permission-rules/actions)
13
13
  [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-permission-rules?label=version)](https://github.com/PerryLink/dsh-permission-rules/releases)
14
+ [![npm version](https://img.shields.io/npm/v/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
15
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
14
16
 
15
17
  [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
16
18
 
@@ -53,7 +55,7 @@ Um segundo modelo responde *"ESTA chamada é segura?"* com julgamento, mas custa
53
55
  - ✅ **Metadados de regras** — `enabled: false`, `description`, `tags`; `/rules` avisa sobre regras encobertas por um catch-all anterior
54
56
  - ✅ **Seguro para o waterfall** — `allow`/passagem sempre chamam `next()`; somente `deny`/`ask` curto-circuitam
55
57
  - ✅ **Seam de aprovação oficial** — `ask` flui por `ctx.approval`; nunca reimplementado, nunca contornado
56
- - ✅ **Auditoria completa** — os eventos `permissionRules/decision` carregam a ação da regra, o cwd do workspace E o resultado final de cada chamada; `/rules decisions` reproduz o rastro na sessão
58
+ - ✅ **Auditoria completa** — os eventos `permissionRules/decision` carregam a ação da regra, o cwd do workspace E o resultado final de cada chamada; `/rules decisions` reproduz o rastro na sessão; hosts anteriores ao marcador de envelope de auditoria degradam para auditoria desativada com um aviso único em vez de gravar registros irrecuperáveis (`allowUnmarkedAudit` reativa)
57
59
  - ✅ **Implantação em simulação** — `enforce: false` audita o que a política *faria* (ação hipotética + resultado real posterior, marcado com `dryRun`) enquanto deixa todas as chamadas passarem; teste seguro de políticas em produção
58
60
  - ✅ **Teste em seco** — `/rules test <tool> <json-args>` avalia as regras ativas sem executar nada, com sobrescritas `--cwd`, `--env`, `--agent` e `--platform` para cada dimensão
59
61
  - ✅ **Recarga a quente** — vigilância Chokidar com debounce; uma edição quebrada mantém as regras anteriores, nunca quebra; um arquivo de regras criado no meio da sessão (o do projeto ou o fallback) é adotado automaticamente, sem recarga manual
@@ -68,7 +70,7 @@ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"
68
70
 
69
71
  # ou a partir de um tarball empacotado (artefatos compilados, sem permissão de build)
70
72
  pnpm pack
71
- dsh plugin --profile web add ./dsh-permission-rules-0.4.0.tgz
73
+ dsh plugin --profile web add ./dsh-permission-rules-0.4.1.tgz
72
74
 
73
75
  # 2. reinicie
74
76
  dsh --profile web
@@ -114,6 +116,7 @@ Todos os ajustes são campos `Config` do Schemastery (alteráveis no cordis.yml)
114
116
  | `searchUp` | `false` | Percorre os diretórios pais a partir do cwd da sessão e combina cada arquivo de regras encontrado, o mais próximo primeiro |
115
117
  | `maxGlobStars` | `2` | Limite rígido de quantificadores `*`/`**` ilimitados por padrão glob (cota do grau de backtracking) |
116
118
  | `enforce` | `true` | `false` = modo simulação: acertos deny/ask são apenas registrados na auditoria com um marcador `dryRun` (ação hipotética + resultado real posterior) e todas as chamadas passam — teste uma política antes de aplicá-la |
119
+ | `allowUnmarkedAudit` | `false` | Hosts cujo `Session.append` é anterior ao marcador `ignorable` (a linha `0.1.0-rc.6`) gravam eventos de auditoria sem marcação, tornando as sessões irrecuperáveis em builds mais rígidos: o plugin os detecta e desativa a auditoria do registro da sessão com um aviso único. Defina `true` para reativar o rastro na sessão (repare registros existentes com `scripts/repair-session-logs.mjs`) |
117
120
 
118
121
  ### Comandos de sessão
119
122
 
@@ -151,7 +154,7 @@ A saída dos comandos é somente UI — o modelo aprende as regras apenas pelos
151
154
 
152
155
  ## Limitações conhecidas
153
156
 
154
- - `permissionRules/decision` é anexado com o marcador de envelope `ignorable: true`, então qualquer build do harness carrega o log — leitores que não conhecem o tipo fora do repositório simplesmente pulam o registro de auditoria em vez de recusar a sessão. (Hosts rc.6 aceitam e ignoram o marcador, mantendo exatamente o comportamento anterior; sessões gravadas em hosts rc.6 não têm o marcador e podem precisar de `scripts/repair-session-logs.mjs` antes de carregar em hosts com semântica required-on-read.)
157
+ - `permissionRules/decision` é anexado com o marcador de envelope `ignorable: true`, então qualquer build do harness carrega o log — leitores que não conhecem o tipo fora do repositório simplesmente pulam o registro de auditoria em vez de recusar a sessão. Hosts cujo `Session.append` é anterior ao marcador (a linha `0.1.0-rc.6`) o DESCARTAM silenciosamente: o plugin os detecta em tempo de execução (verificação prévia da versão do peer + sonda do envelope anexado) e desativa a auditoria do registro da sessão com um aviso único, mantendo os registros carregáveis em qualquer lugar. Defina `allowUnmarkedAudit: true` para reativar o rastro na sessão; registros já gravados sem o marcador podem ser reparados com `scripts/repair-session-logs.mjs` antes de carregar em hosts com semântica required-on-read.
155
158
  - Os candidatos de `paths` são heurísticos: apenas as chaves de argumentos documentadas alimentam a correspondência de caminhos, e a correspondência relativa ao workspace ignora maiúsculas ASCII somente quando `caseInsensitivePaths` está ativo.
156
159
  - Os globs são um subconjunto conservador (sem expansão de chaves) — escreva dois padrões ou use o modo regex.
157
160
  - O guard de backtracking de regex é estrutural, não exaustivo: casos de ambiguidade por alternância sem prefixos literais (ex.: lookarounds elaborados) são responsabilidade do autor; prefira o modo glob para arquivos não confiáveis.
@@ -173,7 +176,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
173
176
  pnpm install # node ^22.19 || >=24
174
177
  pnpm run typecheck # tsc, src + tests
175
178
  pnpm run lint # eslint, src + tests + scripts
176
- pnpm test # vitest: 133 tests, 8 suites
179
+ pnpm test # vitest: 139 tests, 9 suites
177
180
  pnpm run test:coverage # portão de cobertura (90/80/90/90)
178
181
  pnpm run build # declarações tsc + bundles tsdown (lib/)
179
182
  pnpm run pack:check # build + pack (o artefato publicado)
@@ -182,6 +185,11 @@ node scripts/check-readme-sync.mjs # portão de sincronização dos READMEs em
182
185
 
183
186
  Veja [VERIFICATION.md](VERIFICATION.md) para o registro de verificação headless de ponta a ponta (deny bloqueando uma ferramenta de shell, ask roteado pelo seam de aprovação, `--dump-config`).
184
187
 
188
+ ## Contribuidores
189
+
190
+ - [@PerryLink](https://github.com/PerryLink) — criador e mantenedor: vocabulário e avaliação de regras, runtime, vigilância HMR, auditoria do registro da sessão e documentação em cinco idiomas.
191
+ - [@22xuan](https://github.com/22xuan) — o relatório detalhado sobre hosts rc.6 descartando silenciosamente o marcador `ignorable` dos eventos de auditoria ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) e a discussão no harness upstream; a detecção de capacidade do host da v0.4.1 e a correção da documentação derivam diretamente dessa análise.
192
+
185
193
  ## Licença
186
194
 
187
195
  [Apache License 2.0](LICENSE) © 2026 dsh-permission-rules contributors
package/README.zh.md CHANGED
@@ -11,6 +11,8 @@
11
11
  [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
12
  [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-permission-rules/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-permission-rules/actions)
13
13
  [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-permission-rules?label=version)](https://github.com/PerryLink/dsh-permission-rules/releases)
14
+ [![npm version](https://img.shields.io/npm/v/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
15
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-permission-rules)](https://www.npmjs.com/package/dsh-permission-rules)
14
16
 
15
17
  [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
16
18
 
@@ -53,7 +55,7 @@ tools/pre-execute waterfall approval/request waterfall(ans
53
55
  - ✅ **规则元数据** — `enabled: false`、`description`、`tags`;`/rules` 会告警被前面通配规则遮蔽的规则
54
56
  - ✅ **waterfall 安全** — `allow`/透传一律 `next()`;只有 `deny`/`ask` 短路
55
57
  - ✅ **官方审批 seam** — `ask` 走 `ctx.approval`;不重复实现、绝不绕过
56
- - ✅ **完整审计** — `permissionRules/decision` 事件记录规则动作、工作区 cwd 与最终裁决;`/rules decisions` 可在会话内回放审计轨迹
58
+ - ✅ **完整审计** — `permissionRules/decision` 事件记录规则动作、工作区 cwd 与最终裁决;`/rules decisions` 可在会话内回放审计轨迹;早于审计信封标记的宿主自动降级为关闭审计并一次性警告,绝不写出无法恢复的日志(`allowUnmarkedAudit` 可重新开启)
57
59
  - ✅ **干跑上线** — `enforce: false` 只审计策略「本会做什么」(记录本会动作 + 下游真实结果,带 `dryRun` 标记),所有调用照常透传;可在生产环境安全试跑新策略
58
60
  - ✅ **干跑测试** — `/rules test <工具> <json-参数>` 不执行任何东西地评估规则命中,支持 `--cwd`、`--env`、`--agent`、`--platform` 覆盖每个匹配维度
59
61
  - ✅ **热更新** — Chokidar 监视 + 去抖;改坏了保留旧规则,绝不崩溃;会话中途创建的规则文件(项目文件或 fallback)自动生效,无需手动重载
@@ -68,7 +70,7 @@ dsh plugin --profile web add "github:PerryLink/dsh-permission-rules#main"
68
70
 
69
71
  # 或从打包好的 tarball 安装(预构建产物,无需构建许可)
70
72
  pnpm pack
71
- dsh plugin --profile web add ./dsh-permission-rules-0.4.0.tgz
73
+ dsh plugin --profile web add ./dsh-permission-rules-0.4.1.tgz
72
74
 
73
75
  # 2. 重启
74
76
  dsh --profile web
@@ -114,6 +116,7 @@ dsh --profile web --dump-config | grep -A4 'id: permission-rules' # 验证挂
114
116
  | `searchUp` | `false` | 从会话 cwd 向上逐级查找并合并规则文件,最近的优先 |
115
117
  | `maxGlobStars` | `2` | 每个 glob 模式的无界 `*`/`**` 量词数硬上界(回溯度封顶) |
116
118
  | `enforce` | `true` | `false` = 干跑模式:deny/ask 命中只写审计(带 `dryRun` 标记,记录本会动作与下游真实结果),所有调用照常透传——先试跑策略再强制执行 |
119
+ | `allowUnmarkedAudit` | `false` | 早于 `ignorable` 信封标记的宿主(`0.1.0-rc.6` 系列)会写出无标记审计事件,使会话在更严格构建上无法恢复:插件会探测到此类宿主并停用会话日志审计(一次性警告)。设 `true` 重新开启会话内轨迹(已有日志用 `scripts/repair-session-logs.mjs` 修复) |
117
120
 
118
121
  ### 会话命令
119
122
 
@@ -151,7 +154,7 @@ dsh --profile web --dump-config | grep -A4 'id: permission-rules' # 验证挂
151
154
 
152
155
  ## 已知局限
153
156
 
154
- - `permissionRules/decision` 以信封 `ignorable: true` 标记写入,任何 harness 构建都能加载日志——不认识该仓库外类型的第一方读取器会跳过这条审计记录而不是拒绝整个会话。(rc.6 宿主会接受并忽略该标记,行为与打标前完全一致;rc.6 宿主写出的日志没有该标记,在 required-on-read 语义的宿主上加载前可能需要 `scripts/repair-session-logs.mjs`。)
157
+ - `permissionRules/decision` 以信封 `ignorable: true` 标记写入,任何 harness 构建都能加载日志——不认识该仓库外类型的第一方读取器会跳过这条审计记录而不是拒绝整个会话。早于该标记的宿主(`0.1.0-rc.6` 系列)会静默丢弃它:插件在运行时探测(peer 版本预检 + 已写事件信封探针),探测到即停用会话日志审计并一次性警告,确保会话日志在任何构建上都能加载。设 `allowUnmarkedAudit: true` 重新开启会话内轨迹;已写出且缺标记的日志可在 required-on-read 语义的宿主上加载前用 `scripts/repair-session-logs.mjs` 修复。
155
158
  - `paths` 候选是启发式的:只有文档化的参数键进入路径匹配;工作区相对匹配仅在 `caseInsensitivePaths` 开启时忽略 ASCII 大小写。
156
159
  - glob 是保守子集(不支持花括号展开)——写两条模式,或用 regex 模式。
157
160
  - regex 回溯守卫是结构性的而非穷尽的:不含字面量前缀的交替歧义(如精心构造的环视)由作者自负其责;不可信文件请优先用 glob 模式。
@@ -173,7 +176,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
173
176
  pnpm install # node ^22.19 || >=24
174
177
  pnpm run typecheck # tsc,src + tests
175
178
  pnpm run lint # eslint,src + tests + scripts
176
- pnpm test # vitest:133 测试 / 8 套件
179
+ pnpm test # vitest:139 测试 / 9 套件
177
180
  pnpm run test:coverage # 覆盖率门禁(90/80/90/90)
178
181
  pnpm run build # tsc 声明 + tsdown 打包(lib/)
179
182
  pnpm run pack:check # 构建 + pack(发布产物)
@@ -182,6 +185,11 @@ node scripts/check-readme-sync.mjs # 五语 README 同步门禁(CI 同步执
182
185
 
183
186
  headless 端到端验证记录(deny 阻止 shell 工具、ask 走审批 seam、`--dump-config`)见 [VERIFICATION.md](VERIFICATION.md)。
184
187
 
188
+ ## 贡献者
189
+
190
+ - [@PerryLink](https://github.com/PerryLink) — 创建者与维护者:规则词汇与求值、运行时、HMR 监听、会话日志审计及五语文档。
191
+ - [@22xuan](https://github.com/22xuan) — 关于 rc.6 宿主静默丢弃审计事件 `ignorable` 标记的详尽报告([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2))及其向上游 harness 提交的讨论;v0.4.1 的运行时宿主能力探测与文档修正均直接源自该分析。
192
+
185
193
  ## License
186
194
 
187
195
  [Apache License 2.0](LICENSE) © 2026 dsh-permission-rules contributors
package/cordis.patch.yml CHANGED
@@ -14,3 +14,6 @@
14
14
  maxRules: 256
15
15
  patternMode: glob
16
16
  watch: true
17
+ # allowUnmarkedAudit: false # hosts that predate the ignorable marker
18
+ # # degrade to audit-off by default (safe);
19
+ # # set true to keep the in-session trail