Members
| Name | Kind | Type | Description |
|---|---|---|---|
inEffect | Method | (capability: string) => Promise<PolicyInEffect> | The policy a request for capability must declare right now, and what the request must carry: every fact the rules read, their types, the signals bound to the Intent, and the signals that need a signed approval. Maps to GET /policies/in-effect. Call it before every request: an approved new version replaces the old one at once. Throws AuthorizationError (403, code CAPABILITY_NOT_ALLOWED) when the key may not invoke the capability, NotFoundError (404, code CAPABILITY_NOT_BOUND) when no policy governs it, and ConflictError (409, NO_APPROVED_POLICY_VERSION) or InternalServerError (503, POLICY_VERSION_UNAVAILABLE) when every request for it is refused right now. Do not send a request in any of those cases. |
validate | Method | (policyId: string, policyVersion: string) => Promise<PolicyValidationResult> | Confirms that a policy (name + version) is loadable by the Runtime. POST /policies/validate does not accept or check a policy document body — it only checks that policyRepository.load(policyId, policyVersion) succeeds (packages/api/src/routes/policies.ts). POST /policies/validate does not use the shared \{error, code?\} envelope for 400 or 404: both are \{valid, errors\}, its own shape, the caller’s answer, not an SDK-level failure — so those two statuses are exempted from the default throw-on-error behavior. 401 is not exempted: it is generated by caller-auth middleware before this route’s own handler ever runs, and does use the shared envelope, identically to every other route. See /api-reference/error-handling. |
proposeChange | Method | (name: string, version: string, input: ProposePolicyChangeInput) => Promise<ProposedPolicyChange> | Proposes a policy change. Maps to POST /policies/{name}/{version}/pending-changes. The API key must belong to a verified human (credential holder type USER). proposedContent.policyId must equal name. Only one open proposal per name and version is allowed; a second one fails with ConflictError. |
listChanges | Method | (status?: PendingPolicyChangeStatus | undefined) => Promise<PolicyChangeForReview[]> | Lists policy changes for review, with the content in effect now next to the proposed content. Maps to GET /policies/pending-changes. The API key must belong to a verified human. |
approveChange | Method | (pendingPolicyChangeId: string, stepUpAuthorization: PolicyChangeStepUpAuthorization) => Promise<PendingPolicyChange> | Approves a policy change, which then takes effect. Maps to POST /policies/pending-changes/{id}/approve. The API key must belong to a verified human with a registered step up key, who is not the proposer. Make stepUpAuthorization with signPolicyChangeStepUp() and action “approve”; it is valid once, for 120 seconds by default. |
rejectChange | Method | (pendingPolicyChangeId: string, rejectionReason: string, stepUpAuthorization: PolicyChangeStepUpAuthorization) => Promise<PendingPolicyChange> | Rejects a policy change. Maps to POST /policies/pending-changes/{id}/reject. Same caller rules as approveChange(); sign with action “reject”. A reason is required. |