zidane-ui/ approvals/ testing
import { … } from 'zidane-ui/approvals/testing'ui/src/approvals/testing/index.ts
Functions#
createFixtureApprovalsHostFunction#
Creates an ApprovalsHost held in memory.
function createFixtureApprovalsHost(
options?: FixtureApprovalsOptions,
): FixtureApprovalsHostParameters
| Name | Type | Default | Description |
|---|---|---|---|
| options? | FixtureApprovalsOptions | {} | The pending approvals, the safelist, and whether decisions are offered. |
Returns
Constants#
DEMO_APPROVALSConstant#
The demo approvals, oldest first.
const DEMO_APPROVALS: readonly ApprovalRequest[]DEMO_EDIT_APPROVALConstant#
A one-hunk edit, with its resolved preview.
const DEMO_EDIT_APPROVAL: ApprovalRequestDEMO_MULTI_EDIT_APPROVALConstant#
A three-hunk multi_edit from a subagent: one hunk matched a close variant, one is not in the file.
const DEMO_MULTI_EDIT_APPROVAL: ApprovalRequestDEMO_SAFELISTConstant#
A demo safelist: two projects.
const DEMO_SAFELIST: readonly SafelistProject[]DEMO_SHELL_APPROVALConstant#
A shell command waiting for approval, with its working directory and timeout.
const DEMO_SHELL_APPROVAL: ApprovalRequestInterfaces#
FixtureApprovalsHostInterface#
The fixture host, plus a way to raise a request as a running agent would.
interface FixtureApprovalsHost extends ApprovalsHostProperties
| Name | Type | Description |
|---|---|---|
pendingfrom ApprovalsHost | Readable<readonly WireApprovalRequest[]> | The approvals waiting for a decision, oldest first. The host keeps it current: new requests, requests answered elsewhere (another window, a terminal), and a re-read after a reconnect. The host starts listening when the store gets its first subscriber. |
safelist?from ApprovalsHost | ApprovalsSafelist | The "Always allow" entries. Absent: no safelist panel. |
denyAll?from ApprovalsHost | (sessionId?: string) => Promise<void> | Denies every pending approval, or only those of |
| dismiss | (requestId: string) => void | Removes a request without a decision, as when another window answered it. |
| raise | (request: WireApprovalRequest) => void | Adds a request to the queue, as a tool call that needs approval does. |
resolve?from ApprovalsHost | (requestId: string, decision: ApprovalDecision) => Promise<void> | Answers a pending approval. The request leaves |
FixtureApprovalsOptionsInterface#
Options for createFixtureApprovalsHost.
interface FixtureApprovalsOptionsProperties
| Name | Type | Description |
|---|---|---|
| canResolve? | boolean |
|
| pending? | readonly WireApprovalRequest[] | The approvals pending at the start, oldest first. Default: none. |
| safelist? | false | readonly SafelistProject[] | The safelist's projects. Default: empty. |
| onDenyAll? | (sessionId: string | undefined) => void | Called with every bulk deny ( |
| onResolve? | (requestId: string, decision: ApprovalDecision) => void | Called with every decision, after the request left the queue. |