Sign In

@absolutejs/agent-runtime

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@absolutejs/agent-runtime - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+19
-0
dist/index.js

@@ -53,2 +53,3 @@ // @bun

getRun: async (id) => clone(runs.get(id)),
listRuns: async ({ limit = 50, status, tenantId, userId } = {}) => [...runs.values()].filter((run) => (!status || run.status === status) && (!tenantId || run.actor.tenantId === tenantId) && (!userId || run.actor.userId === userId)).sort((left, right) => right.createdAt.localeCompare(left.createdAt)).slice(0, Math.max(1, Math.min(limit, 200))).map(clone),
listSteps: async (runId) => clone(steps.get(runId) ?? []),

@@ -392,2 +393,3 @@ claimDue: async ({ workerId, now, leaseExpiresAt }) => {

cancel: (runId) => store.requestCancel({ runId, now: new Date(now()).toISOString() }),
list: (input) => store.listRuns(input),
inspect: async (runId) => {

@@ -521,2 +523,19 @@ const run = await store.getRun(runId);

getRun: async (id) => (await client.query(`SELECT document FROM ${ns}.runs WHERE id=$1`, [id])).rows[0]?.document,
listRuns: async ({ limit = 50, status, tenantId, userId } = {}) => {
const params = [];
const filters = [];
const add = (condition, value) => {
params.push(value);
filters.push(condition.replace("?", `$${params.length}`));
};
if (status)
add("status=?", status);
if (tenantId)
add("document->'actor'->>'tenantId'=?", tenantId);
if (userId)
add("document->'actor'->>'userId'=?", userId);
params.push(Math.max(1, Math.min(limit, 200)));
const where = filters.length ? ` WHERE ${filters.join(" AND ")}` : "";
return (await client.query(`SELECT document FROM ${ns}.runs${where} ORDER BY created_at DESC, id DESC LIMIT $${params.length}`, params)).rows.map((row) => row.document);
},
listSteps: async (runId) => (await client.query(`SELECT document FROM ${ns}.steps WHERE run_id=$1 ORDER BY sequence`, [runId])).rows.map((row) => row.document),

@@ -523,0 +542,0 @@ claimDue: async ({ workerId, now, leaseExpiresAt }) => client.transaction(async (tx) => {

@@ -78,2 +78,8 @@ export type AgentRunStatus = "queued" | "running" | "waiting" | "suspended" | "handed_off" | "completed" | "failed" | "cancelled";

getRun(id: string): Promise<AgentRun | undefined>;
listRuns(input?: {
limit?: number;
status?: AgentRunStatus;
tenantId?: string;
userId?: string;
}): Promise<readonly AgentRun[]>;
listSteps(runId: string): Promise<readonly AgentStep[]>;

@@ -179,2 +185,8 @@ claimDue(input: {

cancel(runId: string): Promise<AgentRun | undefined>;
list(input?: {
limit?: number;
status?: AgentRunStatus;
tenantId?: string;
userId?: string;
}): Promise<readonly AgentRun[]>;
inspect(runId: string): Promise<{

@@ -181,0 +193,0 @@ run: AgentRun;

+1
-1
{
"name": "@absolutejs/agent-runtime",
"version": "0.1.1",
"version": "0.1.2",
"description": "Durable provider-neutral AI agent runs, steps, checkpoints, budgets, leases, timers, effects, and handoffs.",

@@ -5,0 +5,0 @@ "type": "module",