Skip to content

JavaScript SDK

kadubon edited this page Jun 21, 2026 · 4 revisions

JavaScript SDK

The package can be used from JavaScript and TypeScript without running the CLI.

Root Import

import {
  buildPhaseAccelerationPlan,
  buildRuntimeStep,
  compileTrc,
  phaseAccelerationCompactPayload,
  runAgentCheck,
  runAgentIntake,
  schemaBundle,
  schemaByType,
  validateData,
  verifyPortabilityManifest,
} from "percolation-inversion-compiler-ts";

Compact Agent Check

import { runAgentCheck } from "percolation-inversion-compiler-ts";

const report = runAgentCheck(
  { agent_output: "Candidate packet: preserve residuals." },
  true,
);

console.log(report.accepted);
console.log(report.workflow_usable);
console.log(report.settled);

Do not treat accepted=true or workflow_usable=true as settlement. Read settled, missing_obligations, and residual fields.

Runtime Step

import { buildRuntimeStep } from "percolation-inversion-compiler-ts";

const report = buildRuntimeStep({
  state: { state_id: "local-runtime" },
  input: { step_id: "step-1" },
  agentOutput: "Candidate packet: preserve residuals.",
});

console.log(report.agent_output_digest);
console.log(report.settled);

In v0.4.5, the SDK runtime digest uses sha256:<64 hex characters>.

Schema Subpath

import { schemaByType } from "percolation-inversion-compiler-ts/schema";

const schema = schemaByType("PhaseAccelerationPlan");

Agent Message Subpath

import { createAgentMessage } from "percolation-inversion-compiler-ts/agent/messages";

const message = createAgentMessage({
  sender: "agent-a",
  text: "Candidate packet: preserve residuals.",
});

Agent messages are local JSON envelopes. They are not external message sending authority.

Packet Subpath

import { packetEnvelopeFromRuntimeReport } from "percolation-inversion-compiler-ts/packet";

const packet = packetEnvelopeFromRuntimeReport({
  accepted: true,
  report_id: "runtime-step:local",
  residual_ledger: { coordinates: {} },
  settled: false,
});

Packet APIs preserve candidate status. They do not promote packet content to settled truth.

Clone this wiki locally