npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@parmanasystems/execution

v1.42.0

Published

Deterministic runtime execution and governance attestation infrastructure for parmanasystems.

Readme

@parmanasystems/execution

Deterministic runtime execution and governance attestation infrastructure for parmanasystems.

npm

Overview

@parmanasystems/execution is the core execution engine. It handles:

  • Execution tokens — single-use authorization tokens binding a decision to specific inputs
  • Deterministic execution — identical inputs always produce identical signed results
  • Replay protection — each execution_id is consumed exactly once
  • Cryptographic attestation — results are signed at execution time and independently verifiable
  • Invariant enforcement — 60+ registered invariants with structured violation reports
  • Audit trail — hash-chained JSONL log at ./runtime-audit/executions.jsonl

Installation

npm install @parmanasystems/execution

Quick start

import {
  executeFromSignals,
  LocalSigner,
  LocalVerifier,
  RedisReplayStore,
} from "@parmanasystems/execution";
import { createClient } from "redis";

const redis = createClient();
await redis.connect();

const privateKeyPem = process.env.Parmana_PRIVATE_KEY!;
const publicKeyPem  = process.env.Parmana_PUBLIC_KEY!;

const signer   = new LocalSigner(privateKeyPem);
const verifier = new LocalVerifier(publicKeyPem);
const store    = new RedisReplayStore(redis);

const result = await executeFromSignals(
  {
    policyId:      "claims-approval",
    policyVersion: "v1",
    signals: {
      insurance_active: true,
      risk_score: 42,
      claim_amount: 50000,
    },
  },
  signer,
  verifier,
  store
);

if (result.status === "success") {
  console.log(result.execution_state);  // "completed" | "blocked" | "pending_override"
  console.log(result.signature);        // base64 Ed25519 signature
}

API

executeFromSignals

The primary high-level entry point. Loads the policy from ./policies/{policyId}/{policyVersion}/policy.json, validates signals, evaluates rules, issues a token, and runs the full pipeline.

function executeFromSignals(
  input: {
    policyId: string;
    policyVersion: string;
    signals: Record<string, unknown>;
    metadata?: Record<string, unknown>;
  },
  signer: Signer,
  verifier: Verifier,
  replayStore: AsyncReplayStore & { get?; set?; del? }
): Promise<ExecuteFromSignalsResult>

Returns { status: "success", execution_id, decision, execution_state, signature? } or { status: "pending_override", execution_id, ... } or { status: "error", error }.

executeDecision

Lower-level synchronous execution. Takes an already-constructed ExecutionContext and runs verify → replay → execute → sign stages.

function executeDecision(
  context: ExecutionContext,
  replayStore: ReplayStore
): ExecutionAttestation

executeSimple

Convenience wrapper for the server route. Issues a token from { policyId, policyVersion, decisionType, signalsHash } without loading a policy file.

function executeSimple(
  input: { policyId: string; policyVersion: string; decisionType: string; signalsHash: string },
  signer: Signer,
  verifier: Verifier,
  store?: ReplayStore
): ExecutionAttestation

resolveOverride

Resolves a pending_override execution stored in Redis.

function resolveOverride(
  executionId: string,
  signer: Signer,
  replayStore: AsyncReplayStore & { get?; del? }
): Promise<{ success: boolean; signature: string }>

evaluatePolicy

Pure, deterministic policy rule evaluation.

function evaluatePolicy(
  policy: PolicyDefinition,
  signals: Record<string, unknown>
): DecisionResult

issueToken

function issueToken(input: {
  execution_id: string;
  policy_id: string;
  decision_payload: DecisionOutcome;
  schema_version: string;
  runtime_version: string;
}): ExecutionToken

getRuntimeManifest

function getRuntimeManifest(): RuntimeManifest

Types

ExecutionAttestation

interface ExecutionAttestation {
  execution_id: string;
  decision: {
    action: "approve" | "reject";
    requires_override: boolean;
    reason?: string;
  };
  execution_state: "completed" | "blocked" | "pending_override";
  signature: string;     // base64 Ed25519
  runtime_hash: string;  // SHA-256 of runtime manifest
}

ExecutionToken

interface ExecutionToken {
  execution_id: string;
  policy_id: string;
  decision_payload: DecisionOutcome;
  schema_version: string;
  runtime_version: string;
}

ExecutionContext

interface ExecutionContext {
  token: ExecutionToken;
  token_signature: string;
  signer: Signer;
  verifier: Verifier;
  runtime_manifest: RuntimeManifest;
  runtime_requirements: RuntimeRequirements;
  governed_time?: string;  // ISO 8601 — injected deterministic timestamp
}

RuntimeManifest

interface RuntimeManifest {
  runtime_version: "1.0.0";
  runtime_hash: string;
  supported_schema_versions: readonly ["1.0.0"];
  capabilities: readonly [
    "deterministic-evaluation",
    "attestation-signing",
    "replay-protection",
    "bundle-verification",
  ];
}

Signer / Verifier

interface Signer   { sign(payload: string): string; }
interface Verifier { verify(payload: string, signature: string): boolean; }

InvariantViolation

class InvariantViolation extends Error {
  readonly report: ViolationReport;
}

interface ViolationReport {
  invariant_id: string;   // e.g., "INV-013"
  boundary: string;       // e.g., "replay"
  reason: string;
  input_hash: string;     // SHA-256 of offending input
  timestamp_seq: number;  // monotonic counter
}

Signers

LocalSigner

const signer = new LocalSigner(privateKeyPem);
// privateKeyPem: PEM-encoded Ed25519 private key

LocalVerifier

const verifier = new LocalVerifier(publicKeyPem);

AwsKmsSigner

import { AwsKmsSigner } from "@parmanasystems/execution";
const signer = new AwsKmsSigner({ keyId: "arn:aws:kms:...", region: "us-east-1" });

Replay stores

MemoryReplayStore

In-process Set. Use for testing and single-process deployments.

const store = new MemoryReplayStore();

RedisReplayStore

Uses Redis SET NX for atomic distributed replay protection.

const store = new RedisReplayStore(redisClient);

Invariant registry

import { INVARIANT_REGISTRY, violate, InvariantViolation } from "@parmanasystems/execution";

// Access registry
console.log(INVARIANT_REGISTRY["INV-013"].description);

// Throw a violation
violate("INV-013", "replay", "execution_id already consumed", executionId);

All new invariant IDs must be registered in src/invariant-registry.ts. The CI gate enforces this.

Audit

import { appendAuditRecord, verifyAudit } from "@parmanasystems/execution";

await appendAuditRecord(attestation);  // appends to ./runtime-audit/executions.jsonl
await verifyAudit("./runtime-audit/executions.jsonl");  // verifies hash chain

Pipeline stages

import {
  stageCanonicalizeSignals,
  stageValidateSignals,
  stageVerify,
  stageCheckReplay,
  stageExecute,
  stageSign,
} from "@parmanasystems/execution";

License

Apache-2.0