dsh-permission-rules 0.6.0 → 0.6.3
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 +42 -0
- package/README.es.md +35 -17
- package/README.hi.md +35 -17
- package/README.md +35 -17
- package/README.pt.md +35 -17
- package/README.zh.md +35 -17
- package/lib/index.js +38 -24
- package/lib/types/call-id.d.ts +10 -0
- package/lib/types/call-id.d.ts.map +1 -0
- package/lib/types/events.d.ts +1 -1
- package/lib/types/events.d.ts.map +1 -1
- package/lib/types/proxy.d.ts +1 -1
- package/lib/types/proxy.d.ts.map +1 -1
- package/lib/types/runtime.d.ts +28 -15
- package/lib/types/runtime.d.ts.map +1 -1
- package/package.json +29 -5
- package/scripts/repair-session-logs.mjs +38 -19
- package/src/call-id.ts +11 -0
- package/src/events.ts +1 -1
- package/src/prose.ts +5 -5
- package/src/proxy.ts +1 -1
- package/src/runtime.ts +34 -20
package/src/runtime.ts
CHANGED
|
@@ -18,10 +18,10 @@ import { dirname, isAbsolute, join, resolve } from 'node:path'
|
|
|
18
18
|
import chokidar from 'chokidar'
|
|
19
19
|
import type { Context } from '@deepseek-ai/cordis'
|
|
20
20
|
import type { CommandInvocation, CommandResult } from '@deepseek-ai/dsh-commands'
|
|
21
|
-
import type { CallId } from '@deepseek-ai/dsh-llm'
|
|
22
21
|
import type { PreToolDecision, ToolExecution } from '@deepseek-ai/dsh-tools'
|
|
23
22
|
import { resolveConfig } from './config.ts'
|
|
24
23
|
import type { Config, ResolvedConfig } from './config.ts'
|
|
24
|
+
import type { CallId } from './call-id.ts'
|
|
25
25
|
import { compileRules, compileSourceRules, describeRule, findUnreachableRules, isShellTool, matchRules, mergeCompiledRules, normalizeWorkspacePath, parseRulesDocument, PLATFORMS, RuleError } from './rules.ts'
|
|
26
26
|
import type { CompileOptions, CompiledRule, CompiledRuleset, MatchContext, NetworkTarget, RuleHit } from './rules.ts'
|
|
27
27
|
import { DESCRIBE_TOKENS, UI_PROSE } from './prose.ts'
|
|
@@ -407,8 +407,11 @@ export class PermissionRulesRuntime {
|
|
|
407
407
|
* runtime therefore detects such hosts BEFORE the first append (peer
|
|
408
408
|
* version) and re-checks after the first append (returned envelope), then
|
|
409
409
|
* degrades: session-log audit is disabled with a one-time warning unless
|
|
410
|
-
* `allowUnmarkedAudit: true` opts back in. `
|
|
411
|
-
*
|
|
410
|
+
* `allowUnmarkedAudit: true` opts back in. The `0.1.2-alpha` line refuses
|
|
411
|
+
* plugin event types on read even when marked, so its version gate
|
|
412
|
+
* disables audit the same way (see `isUnmarkedHostVersion`). `source`
|
|
413
|
+
* names the matched rule's file, or the nearest effective file on a
|
|
414
|
+
* passthrough; `cwd`
|
|
412
415
|
* names the workspace the rules were resolved for; `dryRun` marks
|
|
413
416
|
* would-be deny/ask hits under `enforce: false`; `modeDefault` records a
|
|
414
417
|
* network mode-default decision on a web tool (no rule fired).
|
|
@@ -772,7 +775,7 @@ export class PermissionRulesRuntime {
|
|
|
772
775
|
/** One-time warning that session-log audit was disabled to keep session logs loadable. */
|
|
773
776
|
private warnUnmarkedAuditHost(): void {
|
|
774
777
|
this.ctx.logger.warn(
|
|
775
|
-
'permission-rules: this host
|
|
778
|
+
'permission-rules: this host cannot safely persist ignorable-marked audit events (its Session.append predates the marker, or its read path refuses plugin events), which would make sessions unresumable on stricter harness builds — session-log audit is disabled; set allowUnmarkedAudit: true to opt back in, and repair existing logs with scripts/repair-session-logs.mjs (see https://github.com/PerryLink/dsh-permission-rules/issues/2)',
|
|
776
779
|
)
|
|
777
780
|
}
|
|
778
781
|
|
|
@@ -1245,25 +1248,36 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
1245
1248
|
}
|
|
1246
1249
|
|
|
1247
1250
|
/**
|
|
1248
|
-
* Whether a `@deepseek-ai/dsh-session` version line
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1251
|
+
* Whether a `@deepseek-ai/dsh-session` version line cannot safely persist
|
|
1252
|
+
* plugin audit events, either because it predates the `ignorable`
|
|
1253
|
+
* envelope-marker surface or because its read path refuses out-of-vocabulary
|
|
1254
|
+
* event types even when marked:
|
|
1255
|
+
* - The released `0.1.0-rc.1`–`0.1.0-rc.7` lines silently drop the marker
|
|
1256
|
+
* from `Session.append` options, so audit events written by those builds
|
|
1257
|
+
* land unmarked and break resume on stricter hosts. `0.1.0-rc.8` and
|
|
1258
|
+
* later stamp the marker. The `0.1.1-rc` line regressed the same way
|
|
1259
|
+
* (verified on `0.1.1-rc.2` — the stamping fix exists only on harness
|
|
1260
|
+
* master), so `0.1.1-rc.1`–`0.1.1-rc.7` are treated as unmarked too.
|
|
1261
|
+
* - The `0.1.2-alpha` line refuses to interpret logs containing plugin
|
|
1262
|
+
* event types even when the envelope carries `ignorable: true` (verified
|
|
1263
|
+
* on `0.1.2-alpha-1`, reported by @rgw87 in issue #15), so audit events
|
|
1264
|
+
* written there make the session unresumable on that host itself. The
|
|
1265
|
+
* whole alpha line is treated as unsafe; over-refusal is harmless because
|
|
1266
|
+
* `allowUnmarkedAudit: true` opts back in, and
|
|
1267
|
+
* `scripts/repair-session-logs.mjs strip` removes already-written audit
|
|
1268
|
+
* rows for hosts where the marker cannot help. Extend the bound if a
|
|
1269
|
+
* future alpha/rc line regresses. Non-matching (later rc, stable, or
|
|
1270
|
+
* unresolvable) versions are treated as possibly-marker-aware and
|
|
1271
|
+
* verified by the append probe.
|
|
1260
1272
|
* @param version - the installed peer version string.
|
|
1261
|
-
* @returns true for the known-
|
|
1273
|
+
* @returns true for the known-unsafe rc.1–rc.7 lines of `0.1.0` and
|
|
1274
|
+
* `0.1.1`, and the `0.1.2-alpha` line.
|
|
1262
1275
|
*/
|
|
1263
1276
|
export function isUnmarkedHostVersion(version: string): boolean {
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
return Number(
|
|
1277
|
+
const v = version.trim()
|
|
1278
|
+
const rc = /^0\.1\.[01]-rc\.(\d+)$/.exec(v)
|
|
1279
|
+
if (rc !== null) return Number(rc[1]) <= 7
|
|
1280
|
+
return /^0\.1\.2-alpha[.-]\d+$/.test(v)
|
|
1267
1281
|
}
|
|
1268
1282
|
|
|
1269
1283
|
/**
|