JavaScript and TypeScript
Import the library into your application and call Session methods directly. TypeScript adds declarations that help an editor check the shapes of requests and results.
Build and use the library →The SDK, or software development kit, is a JavaScript and TypeScript library for creating, inspecting and running Quineling programs. Each program contains a calculation and instructions for drawing its body. Your application supplies the data when it runs the calculation.
Import Session from @quinelings/agent-sdk/v1. It uses QDL 1, the project’s stable program format. QDL describes a calculation’s steps, accepted inputs, declared purpose and body. A Session holds your programs and their execution records in memory.
The package is available as a downloadable archive or a local build; it is not published to npm. The setup guide explains how to build the package and run its example with Node.js 22 or later.
A named input, also called a port, specifies what kind of value the program accepts. For example, a water calculation can accept a list of numbers measured in liters. Supplying new readings leaves the program’s source unchanged. Editing its calculation, constants or body creates different source.
This example adds water readings to a reserve. The intent object is the structured task description: thought declares its purpose, inputs lists the accepted data, and steps connects the calculations. Each step has an ID so later steps can use its result.
import { Session } from '@quinelings/agent-sdk/v1';
const session = new Session();
const liter = {kind: 'number', unit: 'L', min: 0};
const intent = {
format: 'qdl-intent', version: 1, name: 'Supplied water total',
thought: {
observations: [
{id: 'observedReadings', text: 'Explicitly supplied liter readings.', input: 'readings', path: [], basis: 'open'},
{id: 'observedReserve', text: 'Explicitly supplied reserve liters; no ambient stored balance.', input: 'reserve', path: [], basis: 'open'}
],
evidence: [], goals: [], decisions: [],
plans: [{id: 'plan', text: 'Sum the readings, then add the supplied reserve.', tasks: ['task']}],
tasks: [{id: 'task', text: 'Compute the bounded total from this snapshot.', nodes: ['readings', 'reserve', 'subtotal', 'total'], outputs: ['total']}]
},
inputs: [
{id: 'readings', name: 'readings', type: {kind: 'array', element: liter}},
{id: 'reserve', name: 'reserve', type: liter}
],
steps: [
{id: 'subtotal', op: 'sum', inputs: ['readings'], params: {}},
{id: 'total', op: 'arithmetic', inputs: ['subtotal', 'reserve'], params: {kind: 'add'}}
],
outputs: ['total']
};
const artifact = session.compile(intent);
const first = session.run({
artifactId: artifact.id, requestId: 'water-a',
inputs: { readings: [2, 3], reserve: 4 }
}); // outputs: [9]
const second = session.run({
artifactId: artifact.id, requestId: 'water-b',
inputs: { readings: [4, 5], reserve: 2 }
}); // outputs: [11]
console.log(first.result.occurrences[0].outputs); // [9]
console.log(second.result.occurrences[0].outputs); // [11]
console.log(session.inspect(artifact.id).source === artifact.source); // true
session.verify(artifact.id); // source-only; no task evaluation
compile validates the description and returns an artifact: the stored program and its source. It does not run the task. The two explicit run calls return totals of 9 and 11 from different supplied inputs.
artifactId identifies the program. requestId identifies a particular invocation. Use a new request ID for a new run. If a response is lost, repeat the exact request with its original ID to retrieve the saved record. Reusing an ID with changed inputs is an error.
| Method | Purpose | Runs the task? |
|---|---|---|
describe | Read the supported program version and storage limits. | No |
compile | Check a structured task description and store its program. | No |
inspect | Read a stored program’s source and declared inputs. | No |
verify | Check that the program reconstructs its exact source. | No |
recover | Validate and store a program from source or an exact source encoding. | No |
frame | Sample body coordinates for display. | No |
run | Calculate with supplied inputs and save an execution record. | Yes |
reproduce | Run a fresh copy using a saved record’s inputs and compare the result. | Yes, for a new request ID |
An execution record contains results and a trace of the calculation steps. Read its result status: a delivered record can report a failed calculation. Drawing or animating the body does not run the task, and reproducing a run does not collect new observations from the outside world.
Session storage is in memory. exportSnapshot() returns data that your application can save; Session.fromSnapshot() restores it. Imported historical results are labeled asserted. They become fresh local computation evidence only when evaluated again; importing a result does not establish that it happened.
See the Session reference for method arguments, errors, storage limits and snapshot handling.
Import the library into your application and call Session methods directly. TypeScript adds declarations that help an editor check the shapes of requests and results.
Build and use the library →Model Context Protocol lets a compatible AI assistant call named tools. The QDL 1 adapter exposes eight tools matching the Session methods above. A tool request supplies explicit arguments; the adapter returns a structured result.
Use the /v1-mcp package entry point.
Agent2Agent is a protocol for requesting work from an agent service. The local adapter accepts structured requests over HTTP and returns results. Its discovery document, called an agent card, lists the service’s interfaces.
Use /v1-a2a. The local server defaults to 127.0.0.1:8050.
These adapters use the same QDL 1 request rules. The supplied server is for local use. Shared hosting requires authentication and a separate Session ownership boundary for each owner.
Programs calculate with data you supply. Actions such as walking a route or allocating supplies produce local simulated results. They do not move a character, send a message or change another service. An observation’s declared unit and real-world accuracy remain the caller’s responsibility.
Lean is a proof assistant that checks proofs about mathematical models. This project uses it for source reconstruction and selected properties of geometry, color and state changes. Quint explores possible sequences of actions in bounded models to search for broken rules.
JavaScript and browser tests check the implementation. The Lean and Quint models do not prove every part of the JavaScript implementation correct, establish the truth of supplied observations or guarantee how a shape will look.
The default package import exposes the earlier Runtime API. Experimental body construction uses VisualCapsule from /experimental. These have different interfaces from stable Session.
The original Runtime import from @quinelings/agent-sdk remains available for legacy programs. Its literal overrides and experimental ranch APIs are separate from stable QDL 1 Session inputs. Use the stable Session API above for new QDL 1 programs. A genome is an exact encoding of program source as harmonic numbers or RGB byte records; a screenshot is not a source export.
| Operation | Result | Executes task? |
|---|---|---|
| parse / create | Supported plan or explicit diagnostics; optional artifact | No |
| compile | Task, body, source and genomes | No |
| inspect / frame | Source details / deterministic geometry | No |
| recover | Validated source from JSON or either genome | No |
| run | Task outputs, trace and emitted source | Yes |
| reproduce | Fresh source-verified execution linked to its parent | Yes |
| offspringPreview / offspringFrame | Stateless candidate / exact candidate geometry | No |
| offspringAdmit | Explicit source and lineage admission; keyed birth receipt | No |
| lineage / annotate | Session derivations / exact graph-matching interpretation | No |
| worldCreate / worldInspect | One bounded world / detached snapshot | No |
| worldCommand | Explicit imports, participation, invitations, retirement and ticks | No |
The local grammar accepts explicit data and bounded operations. Supply a structured task description directly, or connect a model through the ProposalProvider interface, which returns a proposed task for validation. Generated proposals pass the same compiler. Arbitrary English interpretation requires inspection and clarification.
A child is a new program constructed from parent programs. You can connect one parent’s output to another’s input, merge their results or inherit an appearance while keeping a task. Preview the child and inspect its connections before admitting it, meaning validating and storing it in the library. Running its task requires a separate request.
The ranch adds a local simulation of residents, invitations and births. Participation starts off. Lineage is the session’s record of how a child was constructed. Construction and collaboration policies remain experimental, including those exposed through /v1-ranch.
VisualCapsule wraps an existing task source with an experimental body description. Changing that body changes the capsule’s complete source. Its API is separate from Session; sampling a body and executing its task remain separate operations.
The nursery includes examples built from attractor paths, fractal iteration, ribbons, interwoven loops and spiral whorls. The field guide explains the body controls and mathematical terms.