Scan your whole stack
From OX Research Newsroom
Are you using @oaiz/sdk?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.4312
@oaiz/sdk was last scanned on 23 Nov 2026 at version 0.1.4312. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.4312 LATEST | 23 Nov 2026 | No rules fired |
| 0.1.4310 | 23 Nov 2026 | No rules fired |
| 0.1.4307 | 23 Nov 2026 | No rules fired |
| 0.1.4295 | 23 Nov 2026 | Not shown |
| 0.1.4293 | 23 Nov 2026 | Not shown |
Findings for v0.1.4312. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.1.4312; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The TypeScript client for apps built on OAIZ. It reads and writes the rows of an OAIZ database, runs your integrations and OAIZ's built-in tools, starts workflows, publishes events, calls a model, creates embeddings, and chats with an OAIZ agent, in the browser as a signed-in member of your organisation or on your server with an API key.
npm install @oaiz/sdk
Give the client your app ID. It signs in a member of your organisation, and every request then runs as that member, with their access. Where the IDs come from, and where sign-in returns, is under Setup.
// src/oaiz.ts
import { createClient } from "@oaiz/sdk";
export const oaiz = createClient({
url: "https://api.oaiz.io",
database: "<database id>",
app: "<app id>",
});
export async function openTodos() {
// Every request needs a signed-in member; without one OAIZ answers 401.
const { data: session } = await oaiz.auth.getSession();
if (session === null) {
// The browser leaves for OAIZ here and comes back to this page, signed in.
const { error } = await oaiz.auth.signIn();
if (error) throw new Error(error.message);
return [];
}
const { data, error } = await oaiz.from("todos").select("id, title").eq("done", false);
if (error) throw new Error(error.message);
return data;
}
// src/session.ts
import { oaiz } from "./oaiz";
export async function whoIsSignedIn() {
const { data: session } = await oaiz.auth.getSession();
if (session === null) return null;
const { data: user } = await oaiz.auth.getUser();
return user?.name ?? user?.email ?? null;
}
export async function signOut() {
await oaiz.auth.signOut();
}
The session lives in the tab's sessionStorage, and the client renews it before it expires.
Give the client an API key instead of an app ID. Keep the key on the server; never ship it to a
browser. This client has no auth and no chat; everything else on this page works with both.
// server/oaiz.ts
import { createClient } from "@oaiz/sdk";
export const oaiz = createClient({
url: "https://api.oaiz.io",
database: "<database id>",
key: process.env.OAIZ_API_KEY ?? "",
});
// src/todos.ts
import { oaiz } from "./oaiz";
export async function addTodo(title: string) {
return oaiz.from("todos").insert({ title, done: false }).select("id, title").single();
}
export async function finishTodo(id: string) {
return oaiz.from("todos").update({ done: true }).eq("id", id);
}
export async function latestTodos() {
return oaiz.from("todos").select("id, title, done").order("created_at", { ascending: false }).limit(20);
}
upsert and delete work the same way. A database view only reads.
oaiz db types <database id> -o src/databases/<database id>.ts writes a Database type for your
tables. Pass it as createClient<Database>({ ... }) to check table names, columns and values as
you type.
rpc calls a function you created in the database with create function, with its arguments by
name. See queries.
// src/functions.ts
import { oaiz } from "./oaiz";
export async function openCount() {
const { data, error } = await oaiz.rpc("count_open_todos", { owner_id: "<member id>" });
return error ? 0 : data;
}
Ask for count to get the number of matching rows:
// server/report.ts
import { oaiz } from "./oaiz.js";
export async function doneCount() {
const { count, error } = await oaiz.from("todos").select("id", { count: "exact" }).eq("done", true);
return error ? null : count;
}
Every integration you connect in OAIZ (Gmail, Slack, HubSpot, ...) is a set of tools. tools.run
runs one by <integration id>:<action>, with the action's arguments. Reads and writes are separate
switches: executeIntegrationQuery lets the call read from the provider and
executeIntegrationCommand lets it write. A switch that is off makes the call return the
provider's sample output instead, so a script cannot write by accident.
On the server, read the latest unread emails, have a model write a reply, and save it as a draft. For a longer job, start a workflow instead (see Run a workflow).
// server/inbox.ts
import { oaiz } from "./oaiz.js";
const gmail = "<gmail integration id>";
export async function unreadEmails() {
const { data, error } = await oaiz.tools.run(`${gmail}:search_emails`, {
arguments: { query: "is:unread newer_than:1d", limit: 5 },
executeIntegrationQuery: true,
executeIntegrationCommand: false,
});
if (error) throw new Error(error.message);
return data.result?.emails;
}
export async function writeReply(email: unknown) {
const { data, error } = await oaiz.llm.call({
model: "openai/gpt-6-luna",
system: "You answer customer email for Acme. Write only the reply, brief and concrete.",
input: JSON.stringify(email),
});
if (error) throw new Error(error.message);
return data.text;
}
export async function saveDraft(to: string, subject: string, body: string) {
return oaiz.tools.run(`${gmail}:create_draft`, {
arguments: { to: [to], subject, body },
executeIntegrationQuery: true,
executeIntegrationCommand: true,
});
}
In the browser, give the agent the Gmail tools and let it read and draft itself. A tool with
requireApproval does not run until the member approves the call: the turn ends with a
tool.approvalRequired event, and chat.approve or chat.decline, with the same agent settings,
continues it. The app reaches only the integration actions shared with it (see Setup).
// src/inbox.ts
import { oaiz } from "./oaiz";
const gmail = "<gmail integration id>";
const agent = {
systemPrompt: "You answer customer email for Acme. Be brief and concrete.",
integrationTools: [
{ integrationUuid: gmail, actionType: "search_emails" },
{ integrationUuid: gmail, actionType: "create_draft", requireApproval: true },
],
};
// Returns the draft call that waits for the member, or null when the agent saved none.
export async function draftReplies() {
let waiting: { sessionId: string; toolCallId: string } | null = null;
for await (const { data: event, error } of oaiz.chat.send({ ...agent, content: "Draft replies to today's unread email." })) {
if (error) throw new Error(error.message);
if (event.type === "tool.approvalRequired") {
waiting = { sessionId: event.sessionId ?? "", toolCallId: event.toolApprovalInfo?.toolCallId ?? "" };
}
}
return waiting;
}
export async function decide(call: { sessionId: string; toolCallId: string }, approved: boolean) {
const turn = approved ? oaiz.chat.approve({ ...agent, ...call }) : oaiz.chat.decline({ ...agent, ...call });
for await (const { error } of turn) {
if (error) throw new Error(error.message);
}
}
Built-in OAIZ tools run the same way, by name. In the browser, a chat turn names them in
nativeTools, and chat.tools() lists the built-in tools and integration actions the app may use.
// server/places.ts
import { oaiz } from "./oaiz.js";
export async function coffeeNearby() {
const { data, error } = await oaiz.tools.run("google_maps_search", {
arguments: { query: "coffee near Stureplan, Stockholm", limit: 3 },
executeIntegrationQuery: true,
executeIntegrationCommand: false,
});
return error ? null : data.result;
}
runs.start takes a workflow ID and an event. The event's properties are the workflow's input.
Pass job to select a job explicitly. In the browser, the app starts only workflows shared with it.
Call result() for the last snapshot, or iterate the run handle first to read progress.
// server/runs.ts
import { oaiz } from "./oaiz.js";
export async function weeklyReport(week: number) {
const run = oaiz.runs.start({
workflow: "<workflow id>",
event: { eventType: { provider: "reports", name: "report-requested" }, properties: { week } },
});
const { data, error } = await run.result();
if (error) throw new Error(error.message);
return { status: data.status, events: data.events };
}
export async function readRun(runId: string, publishEvents = true) {
const { data, error } = await oaiz.runs.get(runId, { publishEvents });
return error ? null : data.status;
}
The root_start frame carries the run ID as actionExecutionLogUuid. Save it and the latest
after cursor. runs.follow(runId, { after }) reads on from that cursor without starting another
run. When reading by ID, pass the same publishEvents you used at start. It defaults to true.
runs.list({ triggeringEventUuid }) lists the runs a published event started.
An event's type is a provider and a name, each made of letters, digits and hyphens. Name the
provider after your app and the name after what happened, both lowercase with hyphens, for example
orders/order-created. storage, schedule, oaiz-internal and integration providers such as
gmail are reserved. Workflows that listen for the type start on it.
A publish names its owner. An app publishes as itself. On your server, set integrationUuid to a
custom integration whose Edit the key's person or service account holds, or use a key the
integration created, which names it without the field. Any other publish is refused with
event-owner-required, and OAIZ never picks an integration from the type's name. The first
integration or app to publish a type owns it. An integration's publish into a type another owner
holds is refused with a 409, and an app needs Edit on such a type.
// server/events.ts
import { oaiz } from "./oaiz.js";
export async function orderCreated(orderId: string, total: number) {
const { data, error } = await oaiz.events.publish({
eventType: { provider: "orders", name: "order-created" },
integrationUuid: "<integration id>",
properties: { orderId, total },
});
if (error) throw new Error(error.message);
return data.uuid;
}
llm.call asks a model for one answer to input, under an optional system instruction, and
returns the text, the model that answered and the usage in tokens. The call runs as the key's
or the signed-in member's organisation, within its budget, on a model the organisation permits in
both chat and workflows; a refusal is error.code budget-exceeded or llm-model-not-permitted.
An input longer than the model's context answers llm-call-context-length. The call waits up to
five minutes for the answer.
// server/summary.ts
import { oaiz } from "./oaiz.js";
export async function summarise(text: string) {
const { data, error } = await oaiz.llm.call({
model: "openai/gpt-6-luna",
system: "Summarise the text in one sentence.",
input: text,
});
if (error) throw new Error(error.message);
return data.text;
}
embeddings.create turns each text into a vector, with text-embedding-3-small or
text-embedding-3-large; dimensions asks for shorter vectors. Vectors from different models, or
from one model at different dimensions, are not comparable, so store the model beside each vector.
JSON.stringify(vector) is the text a pgvector column takes.
// server/embeddings.ts
import { oaiz } from "./oaiz.js";
export async function saveArticle(title: string, text: string) {
const { data, error } = await oaiz.embeddings.create({ model: "text-embedding-3-small", input: [text] });
if (error) throw new Error(error.message);
// data: { model, dimensions, embeddings, inputTokens }
return oaiz.from("articles").insert({ title, model: data.model, embedding: JSON.stringify(data.embeddings[0]) });
}
In the browser, as the signed-in member. chat.send streams the agent's answer as events.
message.delta events carry the text; session.created carries the ID of a new chat, which you
pass as sessionId to continue it.
// src/chat.ts
import { oaiz } from "./oaiz";
export async function ask(question: string, onText: (text: string) => void) {
let answer = "";
const turn = oaiz.chat.send({ content: question, systemPrompt: "You help the team plan their week." });
for await (const { data: event, error } of turn) {
if (error) throw new Error(error.message);
if (event.type === "message.delta") {
answer += event.delta?.content ?? "";
onText(answer);
}
}
return answer;
}
@oaiz/sdk/testTest mode runs your app against local copies of your databases, with no network. You need an OAIZ
account once, to write each database's schema file. The oaizTest Vite plugin serves sign-in, rows
and database functions from PGlite while the dev server runs as
vite --mode oaiz-test. It runs in Node only.
npm install --save-dev vite @electric-sql/pglite @electric-sql/pglite-pgvector
// vite.config.ts
import { oaizTest } from "@oaiz/sdk/test";
import { defineConfig } from "vite";
export default defineConfig({ plugins: [oaizTest()] });
The plugin reads your app's tests/ folder:
tests/databases/<database id>.sql, the database's schema. Write it with
oaiz db test-schema <database id> -o tests/databases/<database id>.sql; a hand-written
create table file does not work, because the file also sets up the roles test mode signs in
with.
tests/databases/<database id>.seed.sql (optional), SQL that inserts the starting rows.
tests/members.json, the people who can sign in:
{
"teams": [{ "id": "7e570000-0000-4000-8000-000000000101", "name": "Sales" }],
"members": [
{
"id": "7e570000-0000-4000-8000-000000000001",
"name": "Ada Lovelace",
"email": "ada@example.test",
"teams": ["7e570000-0000-4000-8000-000000000101"],
"role": "administrator"
}
],
"grants": { "<database id>": "view" }
}
Only members is required. Member and team IDs are UUIDs, as in OAIZ. A member's role is
member (the default) or administrator, and its teams lists IDs from the top-level teams.
grants sets the app's access per database; a database left out gets edit.
The plugin reads the folder on the first request, so after you change a file in tests/, restart
the dev server.
In test mode, set the client's url to `${window.location.origin}/__oaiz-test`. signIn()
then opens a local page where you pick a member. Chat, tools, model calls, embeddings, events
and workflow runs are not supported there and answer 501 with error.code test-mode-unsupported.
When a file in tests/ does not load, the request answers 500 with error.code
test-mode-setup and the reason in error.message, and the dev server prints the reason.
Each ID comes from the oaiz command-line tool or the OAIZ web app.
oaiz login (authentication).oaiz db create --name todos creates a database and prints its ID. See
databases for tables and migrations.oaiz view create "Todos" creates the app
and prints its ID; the CLI calls an app a view and saves the ID as viewId in
.oaiz/view.json. Give the app access to the database with
oaiz db access grant <database id> --subject-kind app --subject-id <app id> --capability edit
(or view for read only).What the app reaches. In the browser, the app reaches only what you share with it, and the member only what they may use:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.