@openagentid/skills-policy
API contract shipped by @openagentid/skills-policy 0.1.1. Exact exports, signatures, dependencies and availability.
All packages · Runnable examples · Start an agent
| Contract | Value |
|---|---|
| Package | @openagentid/skills-policy@0.1.1 |
| Entry point | @openagentid/skills-policy |
| Availability | Published package |
| Reference source | Published TypeScript declarations |
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.
| Condition | Published file |
|---|---|
| types | ./dist/index.d.ts |
| import | ./dist/index.js |
Exports
ArgumentConstraintErrorAuditChainAuditLevel— typeConsentRequiredErrorCURRENT_VERSIONDefaultRule— typeDidHASH_LENInvalidPolicyErrorInvalidSkillsMarkdownErrorInvocationContextMAX_SKILL_RULESNotAllowedErrorOutsideTimeWindowErrorRateLimit— typeRateLimitDecision— typeRateLimiterRateLimitExceededErrorReceipt— typeSkillEntry— typeSkillRule— typeSkillsManifestSkillsPolicySkillsPolicyDoc— typeSkillsPolicyErrorTimeWindow— type
ArgumentConstraintError
export declare class ArgumentConstraintError extends SkillsPolicyError {
readonly name = "ArgumentConstraintError";
readonly skill: string;
readonly details: string;
constructor(skill: string, details: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:33.
AuditChain
export declare class AuditChain {
get length(): number;
get isEmpty(): boolean;
head(): string;
get(sequence: number): Receipt | undefined;
all(): readonly Receipt[];
verify(): boolean;
append(skill: string, agent: string, session: string, invokedAt: Date, level: AuditLevel, args: unknown): Receipt;
}Source: @openagentid/skills-policy@0.1.1, dist/audit.d.ts:26.
AuditLevel
Type-only declaration; it is not a runtime value.
export type AuditLevel = z.infer<typeof AuditLevelSchema>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:12.
ConsentRequiredError
export declare class ConsentRequiredError extends SkillsPolicyError {
readonly name = "ConsentRequiredError";
readonly skill: string;
constructor(skill: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:44.
CURRENT_VERSION
declare const CURRENT_VERSION: 1;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:9.
DefaultRule
Type-only declaration; it is not a runtime value.
export type DefaultRule = z.infer<typeof DefaultRuleSchema>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:106.
Did
Minimal DID wrapper used for binding a policy to an agent.
Mirrors openagent_skills_policy::Did in Rust. A full W3C DID parser
lives in the OAS SDK; for this narrow use case we only need enough
validation to reject obviously malformed values.
export declare class Did {
static parse(input: string): Did;
toString(): string;
equals(other: Did): boolean;
asString(): string;
}Source: @openagentid/skills-policy@0.1.1, dist/did.d.ts:8.
HASH_LEN
declare const HASH_LEN = 32;Source: @openagentid/skills-policy@0.1.1, dist/audit.d.ts:13.
InvalidPolicyError
export declare class InvalidPolicyError extends SkillsPolicyError {
readonly name = "InvalidPolicyError";
constructor(message: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:11.
InvalidSkillsMarkdownError
export declare class InvalidSkillsMarkdownError extends SkillsPolicyError {
readonly name = "InvalidSkillsMarkdownError";
constructor(message: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:15.
InvocationContext
Context describing a single attempted skill invocation. Immutable; builder-style helpers return new instances.
export declare class InvocationContext {
readonly agentDid: Did;
readonly sessionId: string;
readonly arguments: unknown;
readonly invokedAt: Date;
readonly consentGranted: boolean;
constructor(init: InvocationContextInit);
withConsent(): InvocationContext;
withInvokedAt(invokedAt: Date): InvocationContext;
}Source: @openagentid/skills-policy@0.1.1, dist/engine.d.ts:25.
MAX_SKILL_RULES
declare const MAX_SKILL_RULES = 256;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:10.
NotAllowedError
export declare class NotAllowedError extends SkillsPolicyError {
readonly name = "NotAllowedError";
readonly skill: string;
readonly reason: string;
constructor(skill: string, reason: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:19.
OutsideTimeWindowError
export declare class OutsideTimeWindowError extends SkillsPolicyError {
readonly name = "OutsideTimeWindowError";
readonly skill: string;
constructor(skill: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:39.
RateLimit
Type-only declaration; it is not a runtime value.
export type RateLimit = z.infer<typeof RateLimitSchema>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:23.
RateLimitDecision
Type-only declaration; it is not a runtime value.
export type RateLimitDecision = {
kind: "allowed";
} | {
kind: "denied";
used: number;
};Source: @openagentid/skills-policy@0.1.1, dist/rate.d.ts:9.
RateLimiter
export declare class RateLimiter {
checkAndRecord(skill: string, limit: RateLimit, nowSecs: number): RateLimitDecision;
reset(skill: string): void;
snapshot(): Array<[
string,
number
]>;
}Source: @openagentid/skills-policy@0.1.1, dist/rate.d.ts:15.
RateLimitExceededError
export declare class RateLimitExceededError extends SkillsPolicyError {
readonly name = "RateLimitExceededError";
readonly skill: string;
readonly used: number;
readonly max: number;
readonly windowSecs: number;
constructor(skill: string, used: number, max: number, windowSecs: number);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:25.
Receipt
Type-only declaration; it is not a runtime value.
export interface Receipt {
sequence: number;
skill: string;
agent: string;
session: string;
invokedAt: string;
auditLevel: AuditLevel;
argumentsHash: string;
arguments?: unknown;
previousHash: string;
receiptHash: string;
}Source: @openagentid/skills-policy@0.1.1, dist/audit.d.ts:14.
SkillEntry
Parser for SKILLS.md files.
A SKILLS.md file is a simple Markdown document where each ##-level
heading names a skill and the paragraphs beneath describe it. We use a
line-based scanner — matching the Rust implementation exactly — to keep
both parsers auditable.
Type-only declaration; it is not a runtime value.
export interface SkillEntry {
readonly name: string;
readonly description: string;
}Source: @openagentid/skills-policy@0.1.1, dist/skillsMd.d.ts:9.
SkillRule
Type-only declaration; it is not a runtime value.
export type SkillRule = z.infer<typeof SkillRuleSchema>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:95.
SkillsManifest
export declare class SkillsManifest {
readonly skills: readonly SkillEntry[];
static fromMarkdown(input: string): SkillsManifest;
static fromFile(path: string): Promise<SkillsManifest>;
get length(): number;
get isEmpty(): boolean;
get(name: string): SkillEntry | undefined;
names(): string[];
}Source: @openagentid/skills-policy@0.1.1, dist/skillsMd.d.ts:13.
SkillsPolicy
export declare class SkillsPolicy {
static fromYaml(yaml: string): SkillsPolicy;
static fromFile(path: string): Promise<SkillsPolicy>;
agent(): Did;
hasRule(skill: string): boolean;
auditChain(): AuditChain;
resetRateLimit(skill: string): void;
canInvoke(skill: string, ctx: InvocationContext): void;
recordInvocation(skill: string, ctx: InvocationContext): Receipt;
}Source: @openagentid/skills-policy@0.1.1, dist/engine.d.ts:35.
SkillsPolicyDoc
Type-only declaration; it is not a runtime value.
export type SkillsPolicyDoc = z.infer<typeof SkillsPolicyDocSchema>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:271.
SkillsPolicyError
Typed error hierarchy for the skills policy engine.
Each failing dimension has its own subclass so callers can pattern-match
with instanceof rather than parsing error messages.
export declare class SkillsPolicyError extends Error {
readonly name: string;
constructor(message: string);
}Source: @openagentid/skills-policy@0.1.1, dist/errors.d.ts:7.
TimeWindow
Type-only declaration; it is not a runtime value.
export type TimeWindow = z.infer<typeof TimeWindowSchema>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:37.
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.
AuditLevelSchema
declare const AuditLevelSchema: z.ZodEnum<[
"none",
"hash",
"full"
]>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:11.
DefaultRuleSchema
declare const DefaultRuleSchema: z.ZodObject<{
allow: z.ZodDefault<z.ZodBoolean>;
audit_level: z.ZodDefault<z.ZodEnum<[
"none",
"hash",
"full"
]>>;
}, "strict", z.ZodTypeAny, {
allow: boolean;
audit_level: "none" | "hash" | "full";
}, {
allow?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
}>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:96.
InvocationContextInit
Type-only declaration; it is not a runtime value.
export interface InvocationContextInit {
agentDid: Did;
sessionId: string;
arguments: unknown;
invokedAt?: Date;
consentGranted?: boolean;
}Source: @openagentid/skills-policy@0.1.1, dist/engine.d.ts:14.
RateLimitSchema
declare const RateLimitSchema: z.ZodObject<{
window: z.ZodString;
max: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
window: string;
max: number;
}, {
window: string;
max: number;
}>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:13.
SkillRuleSchema
declare const SkillRuleSchema: z.ZodObject<{
allow: z.ZodDefault<z.ZodBoolean>;
rate_limit: z.ZodOptional<z.ZodObject<{
window: z.ZodString;
max: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
window: string;
max: number;
}, {
window: string;
max: number;
}>>;
arg_constraints: z.ZodOptional<z.ZodUnknown>;
time_windows: z.ZodDefault<z.ZodArray<z.ZodObject<{
start_hour: z.ZodNumber;
end_hour: z.ZodNumber;
weekdays: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
}, "strip", z.ZodTypeAny, {
start_hour: number;
end_hour: number;
weekdays: number[];
}, {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}>, "many">>;
require_consent: z.ZodDefault<z.ZodBoolean>;
audit_level: z.ZodDefault<z.ZodEnum<[
"none",
"hash",
"full"
]>>;
}, "strict", z.ZodTypeAny, {
allow: boolean;
time_windows: {
start_hour: number;
end_hour: number;
weekdays: number[];
}[];
require_consent: boolean;
audit_level: "none" | "hash" | "full";
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
}, {
allow?: boolean | undefined;
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
time_windows?: {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}[] | undefined;
require_consent?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
}>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:38.
SkillsPolicyDocSchema
declare const SkillsPolicyDocSchema: z.ZodEffects<z.ZodObject<{
version: z.ZodLiteral<1>;
agent: z.ZodString;
description: z.ZodOptional<z.ZodString>;
skills: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
allow: z.ZodDefault<z.ZodBoolean>;
rate_limit: z.ZodOptional<z.ZodObject<{
window: z.ZodString;
max: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
window: string;
max: number;
}, {
window: string;
max: number;
}>>;
arg_constraints: z.ZodOptional<z.ZodUnknown>;
time_windows: z.ZodDefault<z.ZodArray<z.ZodObject<{
start_hour: z.ZodNumber;
end_hour: z.ZodNumber;
weekdays: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
}, "strip", z.ZodTypeAny, {
start_hour: number;
end_hour: number;
weekdays: number[];
}, {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}>, "many">>;
require_consent: z.ZodDefault<z.ZodBoolean>;
audit_level: z.ZodDefault<z.ZodEnum<[
"none",
"hash",
"full"
]>>;
}, "strict", z.ZodTypeAny, {
allow: boolean;
time_windows: {
start_hour: number;
end_hour: number;
weekdays: number[];
}[];
require_consent: boolean;
audit_level: "none" | "hash" | "full";
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
}, {
allow?: boolean | undefined;
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
time_windows?: {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}[] | undefined;
require_consent?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
}>>>;
default: z.ZodDefault<z.ZodObject<{
allow: z.ZodDefault<z.ZodBoolean>;
audit_level: z.ZodDefault<z.ZodEnum<[
"none",
"hash",
"full"
]>>;
}, "strict", z.ZodTypeAny, {
allow: boolean;
audit_level: "none" | "hash" | "full";
}, {
allow?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
}>>;
}, "strict", z.ZodTypeAny, {
version: 1;
agent: string;
skills: Record<string, {
allow: boolean;
time_windows: {
start_hour: number;
end_hour: number;
weekdays: number[];
}[];
require_consent: boolean;
audit_level: "none" | "hash" | "full";
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
}>;
default: {
allow: boolean;
audit_level: "none" | "hash" | "full";
};
description?: string | undefined;
}, {
version: 1;
agent: string;
description?: string | undefined;
skills?: Record<string, {
allow?: boolean | undefined;
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
time_windows?: {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}[] | undefined;
require_consent?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
}> | undefined;
default?: {
allow?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
} | undefined;
}>, {
version: 1;
agent: string;
skills: Record<string, {
allow: boolean;
time_windows: {
start_hour: number;
end_hour: number;
weekdays: number[];
}[];
require_consent: boolean;
audit_level: "none" | "hash" | "full";
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
}>;
default: {
allow: boolean;
audit_level: "none" | "hash" | "full";
};
description?: string | undefined;
}, {
version: 1;
agent: string;
description?: string | undefined;
skills?: Record<string, {
allow?: boolean | undefined;
rate_limit?: {
window: string;
max: number;
} | undefined;
arg_constraints?: unknown;
time_windows?: {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}[] | undefined;
require_consent?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
}> | undefined;
default?: {
allow?: boolean | undefined;
audit_level?: "none" | "hash" | "full" | undefined;
} | undefined;
}>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:107.
TimeWindowSchema
declare const TimeWindowSchema: z.ZodObject<{
start_hour: z.ZodNumber;
end_hour: z.ZodNumber;
weekdays: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
}, "strip", z.ZodTypeAny, {
start_hour: number;
end_hour: number;
weekdays: number[];
}, {
start_hour: number;
end_hour: number;
weekdays?: number[] | undefined;
}>;Source: @openagentid/skills-policy@0.1.1, dist/schema.d.ts:24.
Package requirements
Dependencies
| Package | Published range |
|---|---|
| @noble/hashes | ^1.4.0 |
| ajv | ^8.17.1 |
| ajv-formats | ^3.0.1 |
| yaml | ^2.6.0 |
| zod | ^3.23.8 |
Peer dependencies
| Package | Published range | Optional |
|---|---|---|
| @openagentid/arsenal-sdk | ^0.1.0 | Yes |
Archive verification
Pinned integrity:
sha512-6coVAx4Mz4ajRXk1CXN58F9fcOoYTWYRzAeTIOSRwBNV2u4I9AQ4NiCy1Mvi98+7okNZ6nxg7C/6r8XVVf73uQ==