API reference
This page is the reference for npm agent-passport-system 8.0.1. The package declares Node.js 18 or later (engines). Signature blocks are copied from the package’s declaration files under dist/src/ and are declarations, not runnable code. A check in the docs build compares every signature line on this page with the published declarations. The runnable programs that use these functions are in docs-src/examples/governed-action/, and the Quickstart walks through one.
Entry points
Section titled “Entry points”| Import | What it carries |
|---|---|
agent-passport-system |
The full surface, 2733 export names in 8.0.1, values and types together. Everything on this page except the /core list below comes from here. |
agent-passport-system/core |
A curated set of 34 names for the legacy formats: createPassport, verifyPassport, createDelegation, verifyDelegation, subDelegate, scopeAuthorizes, evaluateIntent, createActionIntent, computeActionRef, computeExternalActionRefV1, parseExternalActionRefV1Preimage, computeIdempotencyKey, attestFloor, loadFloor, generateKeyPair, rotateKey, recordSpend, getSpendSummary, checkTierForIntent, resolveAuthorityTier, requestHumanApproval, createCommerceDelegation, commercePreflight, revokeDelegation, cascadeRevoke, plus types. The last three throw in 8.0.1. |
/core is a packaging choice. It is not the draft’s Core conformance class, and it does not contain AuthorityDelegationV1, ReceiptV1 or the MCP profile. See Status and conformance.
The counts come from the TypeScript checker over dist/src/index.d.ts and dist/src/core-exports.d.ts. Not every export is a supported integration point. Many belong to optional or experimental modules.
How functions fail
Section titled “How functions fail”Issuers throw on bad input. Verifiers return a coded result and do not throw. Each line below is one call with bad input, from api-errors.mjs in the example directory, run against 8.0.1:
issueAuthorityDelegation, signed record as body threw Error: authority delegation body must carry neither delegation_id nor signature (SCHEMA_INVALID)issueAuthorityDelegation, bad nonce threw Error: authority delegation body invalid: nonce must be 32 lowercase hex characters (NONCANONICAL_VALUE)verifyAuthorityDelegationChain, not a chain returned {"state":"invalid","codes":["SCHEMA_INVALID"]}verifyAuthorityDelegationChain, wrong record returned {"state":"invalid","codes":["SCHEMA_INVALID"]}verifyAuthorityDelegationChain, key unreachable returned {"state":"indeterminate","codes":["KEY_UNREACHABLE"]}verifyAuthorityDelegationChain, root untrusted returned {"state":"invalid","codes":["ROOT_UNTRUSTED"]}verifyAuthorityDelegationChain, after not_after returned {"state":"invalid","codes":["EXPIRED"]}issueAuthorityRevocation, revoker not issuer threw Error: authority revocation revoker is not the target delegation issuer (REVOKER_NOT_ISSUER)recordAuthorityRevocation, junk candidate returned {"recorded":false,"state":"unsupported","codes":["UNSUPPORTED_RECORD_TYPE"]}ledger.reserve, wrong unit returned {"ok":false,"code":"UNIT_MISMATCH"}ledger.reserve, above per_action returned {"ok":false,"code":"PER_ACTION_EXCEEDED"}ledger.commit, unknown action returned {"ok":false,"code":"NOT_FOUND"}createReceiptV1, bad issued_at threw TypeError: ReceiptV1: issued_atverifyReceiptV1, key not found returned {"status":"indeterminate","signer_authority":"not_established","errors":1}verifyReceiptV1, resolver unreachable returned {"status":"indeterminate","signer_authority":"not_established"}verifyReceiptV1Serialized, duplicate member returned {"status":"invalid","errors":["parse_error"]}verifyApsMcpAuthorizationV1, junk returned {"state":"invalid","code":"MCP_AUTHORIZATION_MALFORMED"}proveContributions threw Error: Moved to @aeoess/gateway. See MIGRATION.md#attribution-reportscommercePreflight threw Error: commerce orchestration moved to @aeoess/gateway src/sdk-migrated/core/commerce-preflight.ts. Use the gate predA verifier result of valid is not permission to dispatch. The caller still owns replay, spend reservation, the time it checks against and the decision to call the resource.
generateKeyPair(): KeyPairpublicKeyFromPrivate(privateKeyHex: string): stringKeys are lowercase hex Ed25519. KeyPair is { publicKey, privateKey }. The SDK does not store keys. Where a key lives is the caller’s choice.
Authority: AuthorityDelegationV1
Section titled “Authority: AuthorityDelegationV1”The wire record is described on Authority and revocation.
issueAuthorityDelegation(body: AuthorityDelegationBodyV1, privateKey: string): AuthorityDelegationV1issueSubAuthorityDelegation(parent: AuthorityDelegationV1, body: AuthorityDelegationBodyV1, privateKey: string, options: SubAuthorityIssueOptions): AuthorityDelegationV1issueAuthorityDelegation signs a root record (parent_delegation_id: null) from an explicit body and computes delegation_id. The body carries no delegation_id and no signature, and every field must already be canonical, such as a 32 character lowercase hex nonce. issueSubAuthorityDelegation signs a child of parent and first checks the parent and the narrowing with options: now, resolveVerificationKey and resolveRevocation. Both throw an Error whose message ends with the failure code.
verifyAuthorityDelegationChain(rawChain: readonly unknown[], options: AuthorityChainVerificationOptions): AuthorityValidationResultverifyAuthorityDelegation(delegation: unknown, options: AuthorityChainVerificationOptions): AuthorityValidationResultAuthorityChainVerificationOptions has four required members:
now: string: the verification time, RFC 3339 UTC. The function never reads the system clock.resolveVerificationKey(issuer, verificationMethod, issuedAt): returns the public key hex,null, or{ outcome }withnot_found,ambiguous,malformed,unreachableorunsupported_scheme. The key is looked up at the record’s ownissued_at.trustRoot(root): returns whether this deployment accepts the root record.resolveRevocation(delegation): returnsactive,revokedorunknown.
AuthorityValidationResult is { state, valid, failures }. state is valid, invalid, indeterminate or unsupported, and valid is true only for valid. Each failure has a code, a message, and optionally the chain index and the facet. The codes are SCHEMA_INVALID, UNSUPPORTED_VERSION, UNSUPPORTED_RECORD_TYPE, UNSUPPORTED_PROFILE, RESOURCE_LIMIT, NONCANONICAL_VALUE, ID_MISMATCH, KEY_RESOLUTION_FAILED, KEY_SCHEME_UNSUPPORTED, KEY_NOT_FOUND, KEY_AMBIGUOUS, KEY_UNREACHABLE, KEY_MATERIAL_MALFORMED, SIGNATURE_INVALID, ROOT_UNTRUSTED, CHAIN_DUPLICATE_ID, PARENT_MISMATCH, CHAIN_CONTINUITY, ISSUED_AT_OUTSIDE_PARENT, SCOPE_WIDENING, SPEND_WIDENING, SPEND_UNIT_CHANGE, DEPTH_EXHAUSTED, DEPTH_WIDENING, TIME_WIDENING, REPUTATION_WIDENING, VALUES_WEAKENING, REVERSIBILITY_WIDENING, NOT_YET_VALID, EXPIRED, REVOKED and REVOCATION_UNKNOWN. An unknown revocation status gives indeterminate, never valid.
The chain verifier checks one chain. It does not check that the action’s scope is covered, and it does not combine chains.
scopeGrantCovers(parent: string, child: string): booleanScope coverage under aps-hierarchical-v1. An exact grant covers only itself. A grant ending in :* covers its prefix and every descendant.
InMemoryAuthorityBudgetLedger reserves spend against every bounded grant in a verified chain. Its methods are reserve(verifiedChain, actionRef, unit, amountString), markDispatched(actionRef), commit(actionRef), cancel(actionRef) and counter(delegationId), which returns { reserved, committed }. Each mutation returns { ok, code, state? }, with codes RESERVED, DISPATCHED, COMMITTED, CANCELLED, IDEMPOTENT, CONFLICT, UNIT_MISMATCH, PER_ACTION_EXCEEDED, CUMULATIVE_EXCEEDED, NOT_FOUND and INVALID_STATE. The ledger lives in one process’s memory. A deployment with more than one process needs its own atomic store.
Revocation: AuthorityRevocationV1
Section titled “Revocation: AuthorityRevocationV1”issueAuthorityRevocation(delegation: AuthorityDelegationV1, input: AuthorityRevocationIssueInput, privateKey: string): AuthorityRevocationV1verifyAuthorityRevocation(candidate: unknown, delegation: unknown, options: AuthorityRevocationVerificationOptions): AuthorityRevocationVerificationResultrecordAuthorityRevocation(store: AuthorityRevocationStore, delegation: AuthorityDelegationV1, candidate: unknown, options: AuthorityRevocationVerificationOptions): AuthorityRevocationRecordResultcreateAuthorityRevocationResolver(store: AuthorityRevocationStore, options: AuthorityRevocationVerificationOptions): (delegation: AuthorityDelegationV1) => RevocationResolutionAuthorityRevocationIssueInput is { now, revoker, verification_method, reason_code, detail?, nonce }. Only the delegation’s issuer may revoke it, and issueAuthorityRevocation throws REVOKER_NOT_ISSUER otherwise. verifyAuthorityRevocation returns { state, valid, failures } with the same four states. recordAuthorityRevocation verifies the candidate and only then offers it to the store. It returns recorded: false with the verification result when the candidate fails.
An AuthorityRevocationStore has tracks(delegationId), get(delegationId) and insertVerifiedRevocation(revocation). InMemoryAuthorityRevocationStore adds track(delegationId) and keeps everything in process memory. The resolver from createAuthorityRevocationResolver answers revoked for a recorded revocation, active for a tracked delegation with none, and unknown for a delegation the store does not track.
Action references
Section titled “Action references”createActionReferenceInputV2(input: { agent_id: string; action_type: string; target: string; payload_ref: string; scope_required: readonly string[]; issued_at: string; nonce: string; }): ActionReferenceInputV2computeActionRefV2(input: ActionReferenceInputV2, profileContext?: ActionReferenceProfileContextV2 | undefined): stringcomputePayloadRefV1(payload: unknown): stringcomputeActionRefV2 returns the 64 character hex action_ref that receipts and the boundary’s replay store key on. computePayloadRefV1 hashes the action’s arguments for the reference. See Signed bytes and references.
Receipts: ReceiptV1
Section titled “Receipts: ReceiptV1”createReceiptV1(fields: Omit<ReceiptV1, "receipt_id" | "signatures">, signers: ReceiptSignerV1[]): ReceiptV1verifyReceiptV1(receipt: ReceiptV1, resolveKey: (signer: string, keyId: string, issuedAt: string) => string | KeyResolutionFailure | undefined, stageOptions?: ReceiptStageOptionsV1 | undefined, requirements?: ReceiptSignatureRequirementsV1 | undefined): ReceiptVerificationV1verifyReceiptV1Serialized(raw: string, resolveKey: (signer: string, keyId: string, issuedAt: string) => string | KeyResolutionFailure | undefined, stageOptions?: ReceiptStageOptionsV1 | undefined, requirements?: ReceiptSignatureRequirementsV1 | undefined): ReceiptVerificationV1buildDecisionRefV1(input: { action_ref: string; authority_state: JsonValue; policy_input: JsonValue; decision_context: JsonValue; decision_output: CoreDecisionOutputV1; }): { input: DecisionRefInputV1; decision_ref: string; }verifyReceiptWithDecisionV1(receipt: ReceiptV1, decision: DecisionEvidenceV1, resolveKey: (signer: string, keyId: string, issuedAt: string) => string | undefined, options?: ReceiptWithDecisionOptionsV1 | undefined): ReceiptWithDecisionVerificationV1createReceiptV1 computes receipt_id, adds one Ed25519 signature per signer { signer, key_id, private_key }, and throws a TypeError naming the field when a field is invalid.
verifyReceiptV1 returns ReceiptVerificationV1: valid, status (valid, invalid, indeterminate, unsupported), receipt_id_valid, signer_authority (verified, not_established, invalid, not_checked), stage, signature_results, other_signatures and errors. A key the resolver cannot find gives indeterminate with signer_authority: not_established. stageOptions takes expectedReceiptType and boundaryIdentity. requirements.requiredSigners names signers whose signatures must be present.
verifyReceiptV1Serialized parses the raw JSON text first and refuses duplicate members with parse_error. Use it for bytes received from someone else.
verifyReceiptWithDecisionV1 also checks that the receipt’s decision_ref binds the supplied decision evidence and, with options.predecessor, that the receipt links to it. Its result keeps not_checked, not_applicable and not_established apart from true and false. See Receipt families and verification.
MCP authorization: aps-mcp-1
Section titled “MCP authorization: aps-mcp-1”issueApsMcpAuthorizationV1(input: { agent_id: string; verification_method: string; delegation_ref: string; mcp_server: string; tool_name: string; arguments: Record<string, unknown>; scope_required: readonly string[]; spend?: ApsMcpSpendV1 | undefined; nonce: string; issued_at: string; expires_at: string; private_key_hex: string; }): ApsMcpAuthorizationV1verifyApsMcpAuthorizationV1(candidate: unknown, expected: { mcp_server: string; tool_name: string; arguments: Record<string, unknown>; now?: string | undefined; resolve_key: HistoricalKeyResolver; }): Promise<{ state: "valid" | "invalid" | "indeterminate"; code: string; authorization?: ApsMcpAuthorizationV1 | undefined; }>createApsMcpToolCallMiddleware(options: { mcp_server: string; resolve_key: HistoricalKeyResolver; consume_action_ref: (actionRef: string, expiresAt: string) => boolean | Promise<boolean>; evaluate_authority: (authorization: ApsMcpAuthorizationV1, request: McpToolCallRequest) => ApsMcpAuthorityDecision | Promise<ApsMcpAuthorityDecision>; emit_receipt: (authorization: ApsMcpAuthorizationV1, authority: ApsMcpAuthorityDecision, result: McpToolCallResult) => unknown; }): (request: McpToolCallRequest, context: ApsMcpMiddlewareContext, dispatch: (request: McpToolCallRequest) => McpToolCallResult | Promise<McpToolCallResult>) => Promise<McpToolCallResult>computeMcpArgumentsHashV1(argumentsValue: Record<string, unknown>): stringAPS_MCP_AUTHORIZATION_META is org.agent-passport/authorization, the _meta key the authorization travels under. verifyApsMcpAuthorizationV1 takes an optional now. The middleware takes none and checks the window against the system clock. The middleware throws ApsMcpAuthorizationError with a code at the first failed step and calls dispatch only when every step passes. The steps and a tested host are on MCP server.
Canonicalization
Section titled “Canonicalization”canonicalize(obj: unknown, _ancestors?: WeakSet<object> | undefined): stringcanonicalizeJCS(value: unknown): stringcanonicalize is the legacy canonicalizer and drops object members whose value is null. canonicalizeJCS is RFC 8785 and keeps them. Which artifact uses which is on Signed bytes and references.
Evidence bundles
Section titled “Evidence bundles”createEvidenceBundle(opts: CreateEvidenceBundleOptions): EvidenceBundleverifyEvidenceBundle(bundle: EvidenceBundle): EvidenceBundleVerificationcomputeClaimBoundaryReport(bundle: EvidenceBundle, opts?: ClaimBoundaryReportOptions | undefined): ClaimBoundaryReportA bundle is a signed manifest of member digests and a Merkle root, with the member payloads and the signer’s public key beside it. The key is outside the signed manifest, so a valid signature shows integrity under that key, not who signed. computeClaimBoundaryReport reports one state per axis, authority, action, revocation and evidence. It does not verify delegation chains. The CLI’s verify-bundle uses it. See CLI reference.
Deprecated and throwing exports
Section titled “Deprecated and throwing exports”Deprecated in 8.0.1:
isIssuerVerified: tagged@deprecatedwith “Use verifyIssuerSignature() for security-critical checks.”TrustVerification.overall, returned byverifySocialContract: reading it prints aDeprecationWarning. ReadstructurallyValid,issuerCheckedandissuerTrusted.
These 29 exports throw a migration error when called or constructed. Their declarations are kept, so a typecheck passes and the call fails at run time:
| Export | Entry point | Message starts with |
|---|---|---|
cacheDIDResolution |
root | DID resolution cache moved to @aeoess/gateway … |
cancelCheckout |
root | commerce orchestration moved to @aeoess/gateway … |
cascadeRevoke |
root and /core |
This function has moved to DelegationStore in @aeoess/gateway |
clearDIDCache |
root | DID resolution cache moved to @aeoess/gateway … |
commercePreflight |
root and /core |
commerce orchestration moved to @aeoess/gateway … |
commitBatch |
root | commitBatch moved to @aeoess/gateway … |
completeCheckout |
root | commerce orchestration moved to @aeoess/gateway … |
computeConsistencyScore |
root | computeConsistencyScore: Moved to @aeoess/gateway … |
computeReputationDrift |
root | computeReputationDrift: Moved to @aeoess/gateway … |
createCheckout |
root | commerce orchestration moved to @aeoess/gateway … |
createInitialPosture |
root | governance-posture state machine moved to @aeoess/gateway … |
createPromotionReview |
root | createPromotionReview: Moved to @aeoess/gateway … |
DataEnforcementGate (class) |
root | DataEnforcementGate has moved to @aeoess/gateway |
DataGateway (class) |
root | DataGateway has moved to @aeoess/gateway |
getCachedDIDResolution |
root | DID resolution cache moved to @aeoess/gateway … |
getChainEntry |
root | This function has moved to DelegationStore in @aeoess/gateway |
getDescendants |
root | This function has moved to DelegationStore in @aeoess/gateway |
getReceipts |
root | This function has moved to DelegationStore in @aeoess/gateway |
getRevocation |
root | This function has moved to DelegationStore in @aeoess/gateway |
onRevocation |
root | This function has moved to DelegationStore in @aeoess/gateway |
proveContributions |
root | Moved to @aeoess/gateway |
recordBehavioralFailure |
root | governance-posture state machine moved to @aeoess/gateway … |
recordBehavioralSuccess |
root | governance-posture state machine moved to @aeoess/gateway … |
revokeByAgent |
root | This function has moved to DelegationStore in @aeoess/gateway |
revokeDelegation |
root and /core |
This function has moved to DelegationStore in @aeoess/gateway |
triggerDemotion |
root | triggerDemotion: Moved to @aeoess/gateway … |
updateCheckout |
root | commerce orchestration moved to @aeoess/gateway … |
upgradePosture |
root | governance-posture state machine moved to @aeoess/gateway … |
validateChain |
root | This function has moved to DelegationStore in @aeoess/gateway |
The list comes from calling each export whose body starts with throw new Error( once with no arguments and keeping those whose message names a move. The MCP server’s commerce_preflight tool is the same kind of stub.
Compatibility: social contract and intent functions
Section titled “Compatibility: social contract and intent functions”These functions produce the compatibility Delegation and camelCase ActionReceipt formats. Use them to read or extend an existing integration. New work uses the authority and receipt functions above. A tested tutorial is on Compatibility.
joinSocialContract(opts: JoinOptions): SocialContractAgentverifySocialContract(passport: SignedPassport, attestation?: FloorAttestation | null | undefined, opts?: VerifySocialContractOptions | undefined): TrustVerificationdelegate(opts: DelegateOptions): DelegationrecordWork(agent: SocialContractAgent, delegation: Delegation, delegationChain: string[], work: WorkOptions): ActionReceiptauditCompliance(agentId: string, receipts: ActionReceipt[], floor: ValuesFloor, delegations: Map<string, { scope: string[]; revoked: boolean; }>, verifierKeyPair: KeyPair): ComplianceReportcountersignPassport(signedPassport: SignedPassport, issuerPrivateKey: string, issuerId?: string | undefined): SignedPassportproveContributions(_agent: SocialContractAgent, _receipts: ActionReceipt[], _delegations: Delegation[], _beneficiary: string, _beneficiaryMap?: Map<string, BeneficiaryInfo> | undefined): ContributionProofproveContributions throws in 8.0.1.
joinSocialContract
Section titled “joinSocialContract”joinSocialContract(options) returns SocialContractAgent.
Creates a new agent identity with Ed25519 keypair, optional values attestation, and optional beneficiary registration.
Parameters:
name: string: agent display namemission: string: what this agent doesowner: string: human owner aliascapabilities: string[]: what the agent can do (for example'code_execution','web_search','email','file_access')platform: string: runtime platform (for example'node','python','browser')models: string[]: LLM models used (for example'claude-sonnet','gpt-4o')floor?: ValuesFloor | string: optional values floor to attest to (YAML string or parsed object)floorExtensions?: string[]: optional additional principles beyond the floorbeneficiary?: { id: string, relationship: 'creator' | 'employer' | 'delegator' | 'owner' }
Returns SocialContractAgent:
passport: SignedPassport: Ed25519 signed identity documentkeyPair: KeyPair:{ publicKey: string, privateKey: string }attestation: FloorAttestation | null: values attestation if floor was providedagentId: string: unique agent identifierpublicKey: string: Ed25519 public key (hex encoded)
verifySocialContract
Section titled “verifySocialContract”verifySocialContract(passport, attestation?, opts?) returns TrustVerification.
Checks a passport’s signature and validity window, an optional values attestation, and optionally an issuer countersignature.
Parameters:
passport: SignedPassport: the agent’s signed passportattestation?: FloorAttestation | null: optional values attestationopts?: { trustedIssuers?: string[] }: issuer public keys the caller trusts. Without it no issuer check runs
Returns TrustVerification:
structurallyValid: boolean: the passport signature, its validity window and the attestation (when supplied) check out. A self-signed passport passesissuerChecked: boolean: a usabletrustedIssuerslist was supplied, so an issuer check ranissuerTrusted: boolean: one of the supplied issuers countersigned the passport. Always false when no issuer check ranissuerErrors: string[]: why the issuer check failed, when one ranidentity: { valid: boolean, errors: string[], warnings: string[] }values: { attested: boolean, valid: boolean, errors: string[] } | nulloverall: boolean: deprecated, and reading it prints aDeprecationWarning. It equalsstructurallyValid && (!issuerChecked || issuerTrusted), so withouttrustedIssuersit only means the bytes check out
None of these fields authorizes an action. An issuer countersignature is added with countersignPassport(signedPassport, issuerPrivateKey, issuerId?).
delegate
Section titled “delegate”delegate(options) returns Delegation.
Creates a scoped delegation granting authority to another agent.
Parameters:
from: SocialContractAgent: the delegator, an object returned byjoinSocialContracttoPublicKey: string: public key of the delegatescope: string[]: what capabilities to delegatespendLimit?: number: maximum spend allowedmaxDepth?: number: how deep sub-delegation can go (default: 1)expiresInHours?: number: delegation lifetime (default: 24)
Returns Delegation:
delegationId: stringdelegatedTo,delegatedBy: string(public keys)scope: string[]spendLimit: number | undefinedmaxDepth: numberexpiresAt: string(ISO timestamp)signature: string(Ed25519)
recordWork
Section titled “recordWork”recordWork(agent, delegation, chain, work) returns ActionReceipt.
Records a unit of work under a delegation.
Parameters:
agent: SocialContractAgent: the agent doing the workdelegation: Delegation: the delegation authorizing this workdelegationChain: string[]: array of public keys in the delegation chainwork: { type: string, target: string, scope: string, spend?: number, currency?: string, result: 'success' | 'failure' | 'partial', summary: string }
Returns ActionReceipt:
receiptId: stringagentId,delegationId: stringaction: { type, target, scopeUsed, spend? }result: { status, summary }delegationChain: string[]timestamp,signature: string
proveContributions
Section titled “proveContributions”proveContributions(agent, receipts, delegations, beneficiary, beneficiaryMap?) is declared to return ContributionProof.
Throws in 8.0.1 with Moved to @aeoess/gateway. See MIGRATION.md#attribution-reports. The signature is kept, so a typecheck passes and the call fails at run time. The declared return type is:
attribution: AttributionReport: weighted attribution across scopesmerkleRoot: string: 32-byte SHA-256 commitment to all receiptsproofs: Map<string, MerkleProof>: per-receipt inclusion proofstraces: BeneficiaryTrace[]: delegation chain back to human for each receipt
auditCompliance
Section titled “auditCompliance”auditCompliance(agentId, receipts, floor, delegations, verifierKeyPair) returns ComplianceReport.
Audits an agent’s compliance against the Values Floor. The auditor signs the report.
Parameters:
agentId: stringreceipts: ActionReceipt[]floor: ValuesFloor: for exampleloadFloor(yamlText)delegations: Map<string, { scope: string[], revoked: boolean }>: keyed by delegation IDverifierKeyPair: KeyPair: the auditor’s keys, used to sign the report
Returns ComplianceReport with principle-by-principle enforcement status and overall compliance percentage.
Layer 5: intent architecture
Section titled “Layer 5: intent architecture”assignRole
Section titled “assignRole”assignRole(options) returns RoleAssignment.
Assigns a role to a passport-verified agent. Throws if passport verification fails, and it fails for a self-signed passport unless one of the two trust options below is set.
Parameters:
signedPassport: SignedPassport: agent’s verified passport (required)role: 'operator' | 'collaborator' | 'consultant' | 'observer'autonomyLevel: 1 to 5 (1 is fully supervised, 5 is fully autonomous)department?: string: organizational departmentscope: string[]: what the agent can do in this roleassignerPrivateKey: string: key of the human or agent assigning the role. For aSocialContractAgentthis iskeyPair.privateKeyassignerPublicKey: stringtrustedIssuers?: string[]: issuer keys whose countersignature authorizes the assignmentallowSelfSigned?: boolean: accept a passport nobody countersigned. Off by default. The role then rests on the agent’s own claim
Returns RoleAssignment with agentId, role, autonomyLevel, scope, and Ed25519 signature.
createTradeoffRule
Section titled “createTradeoffRule”createTradeoffRule(options) returns TradeoffRule.
Creates a quantified tradeoff rule for machine-readable organizational intent.
Parameters:
when: string: the conflict (for example"quality vs speed")prefer: string: default preference (for example"quality")until: string: threshold (for example"2x time cost")thenPrefer: string: preference after threshold (for example"speed")context?: string: optional context
Returns TradeoffRule with ruleId, when, prefer, until, thenPrefer.
evaluateTradeoff
Section titled “evaluateTradeoff”evaluateTradeoff(rule, thresholdExceeded) returns TradeoffEvaluation.
Evaluates a tradeoff rule at runtime given whether the threshold was exceeded.
Parameters:
rule: TradeoffRulethresholdExceeded: boolean
Returns TradeoffEvaluation: { ruleId, winner, thresholdExceeded, reasoning }
createIntentDocument
Section titled “createIntentDocument”createIntentDocument(options) returns IntentDocument.
Creates a signed machine-readable intent document. Throws if tradeoffHierarchy is empty.
Parameters:
title: stringauthorPublicKey: stringauthorPrivateKey: stringdepartment?: stringgoals: IntentGoal[]: array of{ goalId: string, description: string, priority: number, metrics?: string[], constraints?: string[] }. Priority 1 is highesttradeoffHierarchy: TradeoffRule[]: must be non-emptyexpiresAt?: string
Returns signed IntentDocument with intentId, goals, tradeoffHierarchy.
createDeliberation
Section titled “createDeliberation”createDeliberation(options) returns Deliberation.
Starts a new deliberation for multi-agent consensus.
Parameters:
subject: stringdescription: stringinitiatedBy: string: agentId of initiatorconvergenceThreshold?: number: standard deviation threshold (default: 8)maxRounds?: number: max rounds before escalation (default: 5)reversibilityScore: number: 0 to 1, how reversible is this decision
Returns Deliberation with deliberationId, status 'active', empty rounds array.
submitConsensusRound
Section titled “submitConsensusRound”submitConsensusRound(deliberation, options) returns { deliberation, round }.
Submits a scored assessment from one agent. Calculates weighted overall score and position delta from previous rounds.
Parameters:
deliberation: DeliberationagentId: stringpublicKey,privateKey: stringrole: AgentRoledepartment?: stringassessment: DomainAssessment[]: array of{ domain, score, confidence, weight }reasoning: string
Returns updated deliberation and the signed ConsensusRound.
evaluateConsensus
Section titled “evaluateConsensus”evaluateConsensus(deliberation) returns ConsensusEvaluation.
Checks if agents have converged on a decision. With fewer than two assessments in the latest round it returns converged: false and recommendation: 'continue'.
Returns: { converged: boolean, standardDeviation: number, roundNumber: number, agentCount: number, recommendation: 'continue' | 'converged' | 'escalate' }
resolveDeliberation
Section titled “resolveDeliberation”resolveDeliberation(deliberation, options) returns { deliberation, outcome, precedent }.
Resolves a deliberation, producing a signed outcome and a citable precedent.
Parameters:
deliberation: Deliberationdecision: stringvotesFor,votesAgainst,abstained: string[]: agent IDsescalatedTo?: stringresolverPrivateKey: stringresolverAgentId: string
Returns updated deliberation (status changed), signed DeliberationOutcome, and Precedent.
getPrecedentsByTopic
Section titled “getPrecedentsByTopic”getPrecedentsByTopic(precedents, topic) returns Precedent[].
Filters precedents by topic string match (subject, context, or decision). Sorted by citedCount descending.
citePrecedent
Section titled “citePrecedent”citePrecedent(precedent) returns Precedent.
Increments a precedent’s citedCount by 1.
createIntentPassportExtension
Section titled “createIntentPassportExtension”createIntentPassportExtension(options) returns IntentPassportExtension.
Creates the bridge between Layer 1 identity and Layer 5 governance.
Parameters:
role: AgentRoleautonomyLevel: AutonomyLeveldepartment?: stringactiveIntents: string[]: intent document IDstradeoffHierarchyHash: string
Returns IntentPassportExtension with role, autonomy, deliberation and precedent counters.
Further reading
Section titled “Further reading”llms-full.txt describes the wider module surface in prose. It is not a typed reference. The package’s declarations under dist/src/index.d.ts are the source of truth for signatures.