Files
deepseek-harness/website/zh-CN/api/harness/permission.md
lintianle 2cde2a9032 Merge origin/master into feat/website-docs
Conflict resolution notes:
- package.json/run-gates: both sides' new doc-sync gates kept (master's
  scoped-events/readme gates + this branch's website-api/website-yaml);
  js-yaml devDeps deduped (master added them independently).
- pnpm-workspace/knip: website AND python/sdk-runtime entries kept.
- doc-typecheck/verify-type-equiv: master's condensed headers kept, website
  glob retained in both scan scopes.
- vendor/cordis/src/fiber.ts: master's lifecycle-hardening code taken; this
  branch's richer FiberState JSDoc reapplied on top. vendor/README.md logs
  both local modifications (hardening = 6, JSDoc enrichment = 7).
- pnpm-lock: regenerated from master's side (pnpm install).

Post-merge sync the gates forced (the system working as designed):
- verify-website-yaml caught 4 stale plugin names from master's package
  reorg (dsh-stdio-agent -> dsh-stdio-demo, dsh-acp-agent -> dsh-acp-demo);
  8 references fixed across guide/ and develop/.
- gen-website-api picked up master's 6 new services automatically
  (ctx.approval/permission/sandbox/sessionQuery/skills/tasks -> 6 new pages
  + sidebar); api/index.md hub updated to list them.
- AGENTS.md budget ceiling 1370 -> 1400: the website rows (layout line + two
  command lines) and master's own growth collided with the old ceiling; all
  three website rows are load-bearing (new top-level dir, new CI command).
2026-07-16 21:36:43 +08:00

75 lines
2.4 KiB
Markdown

<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
# ctx.permission
`PermissionService` — provided by `@deepseek-ai/dsh-permission`.
Owns the deployment's permission presets and their write path. Requires a confining `ctx.bash` executor and `ctx.approval`; unmatched knob values are reported as CUSTOM_PRESET, not an error.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L94)
### ctx.permission.names
```ts website-api
get names(): readonly string[]
```
The advertised preset names, in the preset table's declaration order.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L134)
### ctx.permission.current(events)
```ts website-api
current(events: readonly SessionEvent[]): string
```
Resolve the preset matching the effective knob values. A still-matching last selection wins shared-bundle ties; otherwise the first table match wins, or CUSTOM_PRESET when no entry matches.
- `events` — the session's events in log order.
**Returns** the effective preset name, or `custom` when nothing matches.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L145)
### ctx.permission.resolve(name)
```ts website-api
resolve(name: string): PresetSpec
```
Resolve a preset's knob bundle.
- `name` — the preset name to resolve.
**Returns** the configured bundle.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L166)
### ctx.permission.optionOf(name)
```ts website-api
optionOf(name: string): PresetOption
```
Build the client option for a table entry or CUSTOM_PRESET. A missing label falls back to the table key.
- `name` — a table key, or `custom`.
**Returns** the option a client renders.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L181)
### ctx.permission.set(session, name)
```ts website-api
set(session: Session, name: string): void
```
Record a changed preset, then update each changed knob through its own setter. Selecting the effective preset again appends nothing.
- `session` — the session the switch belongs to.
- `name` — the preset to switch to; unknown names throw.
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/ui/permission/src/index.ts#L195)