description: "Channel-neutral one-shot approval seam for users and maintainers composing answerers, setting policy, or debugging fail-closed permission decisions."
English | 中文
Use this package to require a one-shot decision before a sensitive tool action proceeds. The ask policy sends each request to the deployment's human or machine answerers; never rejects it without prompting. Missing or failed answerers return unavailable, so the action fails closed, and an approval applies only to that request. Every request and outcome is recorded in the requesting session's audit log. The model sees the resulting tool outcome and current policy, but not the human permission UI or audit events.
Compose this service when sensitive tool actions should pause for a human or machine decision instead of running unconditionally. The tools pipeline and the sandboxed bash tool route their ask decisions through this seam and fail closed when it is absent, so interactive deployments mount it with at least one answerer.
Answerers are approval/request waterfall listeners: return an outcome to answer for an owned agent, or call next() to delegate. Agent-scoped listeners receive only that agent's requests, and a deployment composes one terminal answerer — sibling listener order is not a policy-priority mechanism. Without a terminal answerer, requests resolve unavailable and fail closed; the service itself never prompts a human.
The effective policy is the one set for the session, falling back to the configured default. ask (the default) delegates to the composed answerers; never rejects every request deterministically before interactive dispatch — the strict headless stance for CI and unattended runs.
- name: '@deepseek-ai/dsh-user-approval'
config:
policy: ask
| Field | Default | Meaning |
|---|---|---|
policy |
ask |
Default for sessions without an approval/policy override |
The generated configuration catalog is the exhaustive source for every accepted field and its JSDoc. setPolicy(agent, policy) switches a live agent and queues a "changed by the user" message for its next model step; setApprovalPolicy(session, policy) is the direct durable write path used by session initialization.
request(req) names the agent, tool, optional call id and reason, and an abort signal. It requires an open turn: an idle or between-turn caller throws before auditing anything. Aborting withdraws the question — the request settles cancelled and a late answer is discarded. A failure that prevents either audit append from committing rejects instead of returning an unlogged decision.
The model sees only the asking consumer's eventual tool outcome — allowed, rejected, cancelled, or unavailable — plus the current policy in the runtime-context snapshot; the audit events and the human permission UI are not model context. A never switch is announced to the model by a sourced user message, and both policies contribute their complete current meaning to the snapshot.
Read these pages when the package-level contract is not enough. They move from the approval vocabulary to the consumers and the design rationale.
ctx.approval Cordis surface.The first request and each effective policy change append a full runtime-context snapshot after retained history. Under ask, the approval contribution states that configured answerers may be consulted and absence fails closed. Under never, it states the deterministic rejection and non-escalation consequence. Unchanged requests retain the earlier snapshot without adding another message.
Approval policy: ask. Operations that require approval may ask through the configured answerers; without an available answerer, the request fails closed.
Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).
One concise context message on the first request and on an effective change; unchanged requests add no duplicate policy tokens.
Append-only after retained history. An ask/never switch preserves the stable system and conversation prefix instead of rewriting the first wire message.
approval/asked and approval/decided are log-only. The model sees only the asking consumer's eventual allowed, rejected, cancelled, or unavailable tool outcome; the human permission UI is not context.
Zero duplicate audit tokens. A rejection may replace a normal tool result with a small retained error, while an allowance leaves the consumer's ordinary result.
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
These limits define when the seam is a poor fit or needs special composition care. They are current package constraints, not a general permission comparison.
allowed-once but no allow-always, remembered rule, revocation, or grant store; session policy is only ask / never.unavailable and fail closed; the service itself never prompts a human.