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

@methodts/methodts

v0.3.0

Published

Typed Methodology SDK -- makes the formal theory (F1-FTH) executable in TypeScript.

Readme

@methodts/methodts

Typed Methodology SDK -- makes the formal theory (F1-FTH) executable in TypeScript.

Overview

MethodTS encodes formal methodologies as composable, type-safe TypeScript values. It provides a complete pipeline from domain specification through method compilation to runtime execution: define predicates and prompts, compose them into steps and DAGs, compile methods through six verification gates, deploy agents via commissions, and run methodologies through a coalgebraic execution loop with safety bounds, suspension, and observability.

Install

npm install @methodts/methodts

Quick Example

Define a predicate:

import { check, and, evaluate } from "@methodts/methodts";

type TaskState = {
  tasks: string[];
  assigned: Record<string, string>;
  reviewed: boolean;
};

const hasTasks = check<TaskState>("has-tasks", (s) => s.tasks.length > 0);
const allAssigned = check<TaskState>(
  "all-assigned",
  (s) => s.tasks.every((t) => t in s.assigned),
);

const ready = and(hasTasks, allAssigned);

evaluate(ready, {
  tasks: ["build-api"],
  assigned: { "build-api": "alice" },
  reviewed: false,
}); // => true

Define a method:

import { type Method, type Step, type StepDAG, TRUE, check } from "@methodts/methodts";
import { Effect } from "effect";

const planStep: Step<TaskState> = {
  id: "plan",
  name: "Plan Tasks",
  role: "planner",
  precondition: TRUE,
  postcondition: hasTasks,
  execution: {
    tag: "script",
    execute: (s) => Effect.succeed({ ...s, tasks: ["build-api", "write-tests"] }),
  },
};

const assignStep: Step<TaskState> = {
  id: "assign",
  name: "Assign Tasks",
  role: "planner",
  precondition: hasTasks,
  postcondition: allAssigned,
  execution: {
    tag: "script",
    execute: (s) =>
      Effect.succeed({
        ...s,
        assigned: Object.fromEntries(s.tasks.map((t) => [t, "alice"])),
      }),
  },
};

const taskMethod: Method<TaskState> = {
  id: "M-TASK",
  name: "Task Planning",
  domain: taskDomain,
  roles: [{ id: "planner", description: "Plans tasks", observe: (s) => s, authorized: ["plan", "assign"], notAuthorized: [] }],
  dag: { steps: [planStep, assignStep], edges: [{ from: "plan", to: "assign" }], initial: "plan", terminal: "assign" },
  objective: ready,
  measures: [],
};

Compile it:

import { compileMethod } from "@methodts/methodts";

const report = compileMethod(taskMethod, [
  { tasks: ["x"], assigned: {}, reviewed: false },
  { tasks: ["x"], assigned: { x: "a" }, reviewed: true },
]);

console.log(report.overall); // => "compiled"
report.gates.forEach((g) => console.log(`${g.gate}: ${g.status}`));

API Surface

Prompt Algebra

Prompt<A>, constant, empty, sequence, cond, match, template

Predicate Logic

Predicate<A>, check, and, or, not, implies, forall, exists, TRUE, FALSE, evaluate, evaluateWithTrace

Domain Theory

DomainTheory<S>, SortDecl, FunctionDecl, validateAxioms, validateSignature

World State

WorldState<S>, Snapshot<S>, Diff<S>, Witness<S>, StateTrace<S>, diff

Roles

Role<S, V>, scopeToRole

Steps and DAG

Step<S>, StepExecution<S>, StepContext<S>, ContextSpec<S>, SuspensionPolicy<S>, StepDAG<S>, StepEdge, topologicalOrder, checkComposability

Method

Method<S>, Measure<S>, ProgressOrder<S>

Methodology

Methodology<S>, Arm<S>, SafetyBounds, TerminationCertificate<S>, asMethodology, evaluateTransition, simulateRun, checkSafety

Retraction

Retraction<P, C>, verifyRetraction

Gates

Gate<S>, GateSuite<S>, GateResult<S>, GateSuiteResult<S>, allPass, anyPass, withRetry, scriptGate, testRunner, httpChecker, checklistGate

Commission

Commission<A>, BridgeParams, commission, batchCommission, templates

Agent Provider

AgentProvider, AgentResult, AgentError, MockAgentProvider

Runtime

runStep, runMethod, runMethodology, runMethodologyToCompletion

Runtime Types

RuntimeEvent<S>, SuspendedMethodology<S>, SuspensionReason<S>, Resolution<S>, RuntimeConfig, ExecutionAccumulatorState, MethodologyResult<S>, MethodResult<S>, StepResult<S>

Observability

EventBus<S>, createEventBus, EventFilter<S>, EventHook<S>

Strategy

StrategyController<S>, StrategyDecision<S>, StrategyResult<S>, runStrategy, prebuilt strategies

Meta

compileMethod, assertCompiled, CompilationReport, instantiate, instantiateMethodology, ProjectCard, aggregateEvidence, diffDomainTheory, classifyDomainChanges

Standard Library (@methodts/methodts/stdlib)

MetaState, DesignState, EvolutionState, InstantiationState, D_META, predicates, prompts, M1_MDES, P0_META, compilationGates (G1-G6)

Architecture

@methodts/methodts
  |
  +-- prompt/         Prompt<A> algebra (contravariant functor, monoid)
  +-- predicate/      Predicate<A> ADT + evaluate engine
  +-- domain/         DomainTheory<S>, Role<S,V>
  +-- state/          WorldState<S>, Snapshot, Diff, Witness
  +-- method/         Step<S>, StepDAG<S>, Method<S>, Measure<S>
  +-- methodology/    Methodology<S>, Arm, transition, safety, retraction
  +-- gate/           Gate framework + runners (script, test, http, checklist)
  +-- commission/     Commission<A>, templates, render helpers
  +-- provider/       AgentProvider service + MockAgentProvider
  +-- runtime/        Execution engine (runStep, runMethod, runMethodology)
  |     +-- events    RuntimeEvent<S> (20 variants)
  |     +-- event-bus EventBus<S> with hooks and subscriptions
  |     +-- context   Step context assembly protocol
  |     +-- suspension SuspendedMethodology, Resolution
  |     +-- accumulator ExecutionAccumulatorState, results
  +-- strategy/       StrategyController, runStrategy, prebuilt strategies
  +-- meta/           compileMethod, instantiate, evolve, ProjectCard
  +-- extractor/      World fragment extraction (command, git)
  +-- stdlib/         P0-META, D_META, M1_MDES, reusable predicates/prompts/gates

Documentation

Development

npm run build            # TypeScript build
npm test                 # Run all tests
npm run test:watch       # Run tests in watch mode
npm run test:coverage    # Run tests with coverage report