OpenAgentIDDocumentation
API referencenpm packages@openagentid/arsenal-sdk
OpenAgentIDAPI reference

@openagentid/arsenal-sdk/policy

API contract shipped by @openagentid/arsenal-sdk 0.1.1. Exact exports, signatures, dependencies and availability.

All packages · Runnable examples · Start an agent

ContractValue
Package@openagentid/arsenal-sdk@0.1.1
Entry point@openagentid/arsenal-sdk/policy
AvailabilityPublished package
Reference sourcePublished TypeScript declarations
Package enginesnode >=20

This reference is generated from the integrity-verified npm archive for this exact version. Signatures describe the public contract; they are not standalone programs. Complete examples are checked separately.

Import conditions

Use the public entry point above. The package resolves it to these shipped files; do not import its internal files directly.

ConditionPublished file
types./dist/policy/index.d.ts
import./dist/policy/index.js
require./dist/policy/index.cjs

Exports

compareOperator

Compare two strings using a condition operator.

Signature
declare function compareOperator(operator: ConditionOperatorValue, actual: string, expected: string): boolean;

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy/index.d.ts:38.

denyWith

Build a deny decision with a reason string.

Signature
declare function denyWith(reason: string): PolicyDecision;

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy/index.d.ts:42.

evaluatePolicy

Evaluate a single policy against a request. Returns the first matching rule's decision or the policy's default effect.

Signature
declare function evaluatePolicy(policy: PolicyDocument, request: PolicyRequest): PolicyDecision;

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy/index.d.ts:36.

policyAllows

Convenience alias: true if the policy decision allows the request.

Signature
declare function policyAllows(decision: PolicyDecision): boolean;

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy/index.d.ts:40.

PolicyEngine

A policy engine evaluates multiple policies in priority order.

Policies are added via addPolicy and removed via removePolicy. On each evaluate(request) call, policies are sorted by descending priority and the first matching rule's decision is returned. When no rule matches, the default effect of the first policy (ordered by priority) is used, and if there are no policies the engine returns Deny.

Signature
declare class PolicyEngine {
    addPolicy(policy: PolicyDocument): void;
    removePolicy(policyId: string): PolicyDocument | undefined;
    getPolicy(policyId: string): PolicyDocument | undefined;
    policyIds(): readonly string[];
    size(): number;
    evaluate(request: PolicyRequest): PolicyDecision;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy/index.d.ts:22.

Supporting declarations

These package-owned declarations are referenced by the exports above. Their presence here does not make them importable from this entry point. Import only the names in Exports.

BindingType

Constraints that bind ACTs to specific contexts.

Tokens can be restricted to a specific device, session, origin, IP range, time window, or environment. Constraints are evaluated at the broker and at the proxy boundary.

Signature
declare const BindingType: {
    readonly Required: "required";
    readonly Preferred: "preferred";
};

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:8.

BindingTypeValue

Type-only declaration; it is not a runtime value.

Signature
type BindingTypeValue = (typeof BindingType)[keyof typeof BindingType];

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:12.

ConditionOperator

Signature
declare const ConditionOperator: {
    readonly Equals: "equals";
    readonly NotEquals: "not_equals";
    readonly Contains: "contains";
    readonly StartsWith: "starts_with";
    readonly EndsWith: "ends_with";
    readonly Matches: "matches";
    readonly In: "in";
    readonly NotIn: "not_in";
};

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:25.

ConditionOperatorValue

Type-only declaration; it is not a runtime value.

Signature
type ConditionOperatorValue = (typeof ConditionOperator)[keyof typeof ConditionOperator];

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:35.

Constraints

Type-only declaration; it is not a runtime value.

Signature
interface Constraints {
    device_binding?: DeviceBinding;
    session_binding?: SessionBinding;
    origin_binding?: OriginBinding;
    network_constraints?: NetworkConstraints;
    time_constraints?: TimeConstraints;
    environment_constraints?: EnvironmentConstraint;
    require_pop: boolean;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:41.

DeviceBinding

Type-only declaration; it is not a runtime value.

Signature
interface DeviceBinding {
    device_id: string;
    binding_type: BindingTypeValue;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:13.

EnvironmentConstraint

Type-only declaration; it is not a runtime value.

Signature
interface EnvironmentConstraint {
    required_environment?: string;
    required_tags?: ReadonlySet<string>;
    forbidden_tags?: ReadonlySet<string>;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:36.

NetworkConstraints

Type-only declaration; it is not a runtime value.

Signature
interface NetworkConstraints {
    allowed_ips?: ReadonlySet<string>;
    denied_ips?: ReadonlySet<string>;
    allowed_cidrs?: readonly string[];
    allowed_asns?: ReadonlySet<number>;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:24.

OriginBinding

Type-only declaration; it is not a runtime value.

Signature
interface OriginBinding {
    allowed_origins: ReadonlySet<string>;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:21.

PolicyCondition

Type-only declaration; it is not a runtime value.

Signature
type PolicyCondition = {
    type: "agent_id";
    operator: ConditionOperatorValue;
    value: string;
} | {
    type: "tenant_id";
    operator: ConditionOperatorValue;
    value: string;
} | {
    type: "scope";
    operator: ConditionOperatorValue;
    value: string;
} | {
    type: "environment";
    operator: ConditionOperatorValue;
    value: string;
} | {
    type: "time_of_day";
    allowed_hours: readonly number[];
} | {
    type: "day_of_week";
    allowed_days: readonly number[];
} | {
    type: "ip_address";
    allowed_cidrs: readonly string[];
} | {
    type: "attribute";
    key: string;
    operator: ConditionOperatorValue;
    value: string;
} | {
    type: "and";
    conditions: readonly PolicyCondition[];
} | {
    type: "or";
    conditions: readonly PolicyCondition[];
} | {
    type: "not";
    condition: PolicyCondition;
};

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:36.

PolicyDecision

Type-only declaration; it is not a runtime value.

Signature
interface PolicyDecision {
    effect: PolicyEffectValue;
    matched_rule?: string;
    reason?: string;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:124.

PolicyDocument

Type-only declaration; it is not a runtime value.

Signature
interface PolicyDocument {
    id: string;
    version: number;
    tenant_id: string;
    name: string;
    description?: string;
    rules: readonly PolicyRule[];
    default_effect: PolicyEffectValue;
    is_active: boolean;
    priority: number;
    created_at: string;
    updated_at: string;
    signature?: PolicySignature;
    labels: Readonly<Record<string, string>>;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:94.

PolicyEffect

Signature
declare const PolicyEffect: {
    readonly Allow: "allow";
    readonly Deny: "deny";
};

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:20.

PolicyEffectValue

Type-only declaration; it is not a runtime value.

Signature
type PolicyEffectValue = (typeof PolicyEffect)[keyof typeof PolicyEffect];

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:24.

PolicyRequest

Type-only declaration; it is not a runtime value.

Signature
interface PolicyRequest {
    agent_id: string;
    tenant_id: string;
    requested_scope: string;
    timestamp: Date;
    environment?: string;
    client_ip?: string;
    attributes: Readonly<Record<string, string>>;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:113.

PolicyRule

Type-only declaration; it is not a runtime value.

Signature
interface PolicyRule {
    id: string;
    description?: string;
    effect: PolicyEffectValue;
    conditions: readonly PolicyCondition[];
    scopes?: ScopeSet;
    constraints?: Constraints;
    rate_limits?: RateLimits;
    budget?: UsageBudget;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:76.

PolicySignature

Type-only declaration; it is not a runtime value.

Signature
interface PolicySignature {
    bytes: Uint8Array;
    algorithm: string;
    key_id: string;
    signed_at: string;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/policy-C-EX1HGX.d.ts:88.

RateLimits

Rate limits, usage budgets, and runtime tracking primitives.

Type-only declaration; it is not a runtime value.

Signature
interface RateLimits {
    requests_per_second?: number;
    requests_per_minute?: number;
    requests_per_hour?: number;
    max_concurrent?: number;
    max_request_size?: number;
    max_response_size?: number;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:86.

Scope

A single permission scope.

Signature
declare class Scope {
    static parse(scope: string): Scope;
    static wildcard(): Scope;
    static readOnly(service: string): Scope;
    static fullAccess(service: string): Scope;
    get service(): string;
    get resource(): string;
    get action(): string;
    isWildcard(): boolean;
    implies(other: Scope): boolean;
    asString(): string;
    toString(): string;
    toJSON(): string;
    equals(other: Scope): boolean;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:200.

ScopeSet

A set of scopes, maintained as a sorted list for deterministic encoding.

Signature
declare class ScopeSet {
    static empty(): ScopeSet;
    static single(scope: Scope): ScopeSet;
    static fromStrings(scopes: readonly string[]): ScopeSet;
    static fromScopes(scopes: readonly Scope[]): ScopeSet;
    add(scope: Scope): ScopeSet;
    remove(scope: Scope): ScopeSet;
    contains(scope: Scope): boolean;
    allows(requested: Scope): boolean;
    isSupersetOf(other: ScopeSet): boolean;
    intersection(other: ScopeSet): ScopeSet;
    union(other: ScopeSet): ScopeSet;
    get length(): number;
    isEmpty(): boolean;
    toArray(): readonly Scope[];
    toStrings(): readonly string[];
    [Symbol.iterator](): Iterator<Scope>;
    toJSON(): readonly string[];
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:228.

SessionBinding

Type-only declaration; it is not a runtime value.

Signature
interface SessionBinding {
    session_id: string;
    session_key_hash?: Uint8Array;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:17.

TimeConstraints

Type-only declaration; it is not a runtime value.

Signature
interface TimeConstraints {
    not_before?: string;
    not_after?: string;
    allowed_hours?: readonly number[];
    allowed_days?: readonly number[];
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:30.

UsageBudget

Type-only declaration; it is not a runtime value.

Signature
interface UsageBudget {
    max_requests?: number;
    max_bytes?: number;
    max_cost_units?: number;
    max_secret_unwraps?: number;
    max_delegation_depth?: number;
}

Source: @openagentid/arsenal-sdk@0.1.1, dist/scope-CP8MvpbA.d.ts:102.

Package requirements

Dependencies

PackagePublished range
uuid^11.0.3
zod^3.23.8

Peer dependencies

PackagePublished rangeOptional
@openagentid/crypto-wasm*Yes

Archive verification

Pinned integrity:

SHA-512 integrity
sha512-bqdIp1hFYeffqXDaTpq/JMJune81cNwrj23kaUl1OoXjp97Bf8kX47/EaOjCX7oLAbTk69SgD7q2p8nrMNeIeQ==

Machine-readable API manifest · Coverage

On this page