JavaScript / TypeScript SDK
The Siliqun Rotor JavaScript/TypeScript SDK provides typed request and response models and uses the Fetch API.
Complete customer application
The example below is a local typed-decision request. It does not load a saved Studio flow or execute a customer tool. To build a complete interaction, follow the Studio first-decision guide and the customer leave-assistant guide: create a free Studio project, import the leave tool declarations, prepare and Save & Activate a flow, create a project key in Customer Settings, then download the customer application from Ship. The application checks the customer's session and reads the authorized HR record through its own server-side handler, then returns a readable answer from that record. The project key goes to the engine; the customer's session goes to the application's identity/HR services, not the engine. Ask and refusal outcomes call no HR handler. The guide documents the integration contract and does not claim a connection to a live employer system.
Installation
Install the JavaScript SDK from the newest published release on GitHub. These links always point at that release, so the same commands keep working after every release. Download the tarball and the checksum manifest, then verify and install it from the directory containing both files:
curl -fL https://github.com/siliqun-rotor/releases/releases/latest/download/siliqun-rotor-sdk.tgz -o siliqun-rotor-sdk.tgz
curl -fL https://github.com/siliqun-rotor/releases/releases/latest/download/SHA256SUMS -o SHA256SUMS
On macOS, verify the tarball with grep 'siliqun-rotor-sdk.tgz$' SHA256SUMS | shasum -a 256 -c -; on Linux, use grep 'siliqun-rotor-sdk.tgz$' SHA256SUMS | sha256sum --check -. Install the tarball after its checksum passes:
npm install ./siliqun-rotor-sdk.tgz
Import SiliqunRotorClient from @siliqun-rotor/sdk. The client defaults to a local engine at http://127.0.0.1:8700; pass baseUrl to use another engine URL. The SDK constructor also accepts an apiKey, optional clientId, and custom headers; apiKey becomes a bearer authorization header and clientId becomes X-SQR-Client-ID. Client attribution is optional unless the project requires it. Keep these server-side for customer applications; do not put a project key in browser code.
Local typed-decision example
import { SiliqunRotorClient } from '@siliqun-rotor/sdk';
const client = new SiliqunRotorClient({
baseUrl: 'http://127.0.0.1:8700'
});
async function run() {
const { answers } = await client.systemone(
{ transaction: 'Transaction $4,500 from unknown IP in Lagos flagged by fraud firewall' },
{
action: {
type: 'choice',
instructions: { question: 'Choose the appropriate transaction handling.' },
criteria: {
block: 'High-risk unverified transaction',
review: 'Suspicious location requiring SMS challenge',
pass: 'Normal activity',
},
},
},
);
const decision = answers.action;
if (decision.outcome === 'decided' && decision.may_act) {
console.log(`Decision: ${decision.choice}`);
console.log('Evidence:', decision.evidence?.[0]?.snippet);
}
}
run();