Scan your whole stack
From OX Research Newsroom
Are you using @sorbetai/durable?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.0-alpha.33
@sorbetai/durable was last scanned on 29 Nov 2026 at version 0.1.0-alpha.33. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.0-alpha.33 LATEST | 29 Nov 2026 | No rules fired |
| 0.1.0-alpha.32 | 28 Nov 2026 | No rules fired |
| 0.1.0-alpha.30 | 27 Nov 2026 | No rules fired |
| 0.1.0-alpha.29 | 27 Nov 2026 | Not shown |
| 0.1.0-alpha.28 | 26 Nov 2026 | Not shown |
Findings for v0.1.0-alpha.33. 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.0-alpha.33; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The Task executor used by Node Agent and its Server, ACP and TUI hosts. It keeps Run identity, queued input,
approvals, model retry deadlines and compaction progress across process loss.
ADR-0113 owns the package
boundary. The root SDK is host-neutral; /pi supplies Pi model transport and the
SorbetSession facade used by first-party hosts; /children supplies child agents
(the agent and Team Tools) for any host that composes a Unit. Runtime does not depend on this package.
| Behavior | Owner | Contract |
|---|---|---|
| Unit lifetime | unit.ts |
Shared writer, Session attachment, wake timer and resource cleanup |
| Host commands | session.ts, input.ts |
Durable admission, input placement, approval replies and cancellation |
| Execution | run.ts, generation.ts, tool.ts |
Task phases and atomic lifecycle boundaries |
| Compaction | compaction.ts |
Durable workflow progress; borrows Runtime's summary planner and algorithm |
| Plugins and resources | bindings.ts, resources.ts, yield.ts |
Request borrows, behavior constraints, Run resource drain and Goal continuation |
| Evidence | history.ts |
Incremental execution indexes and Runtime's shared conversation projection |
| Model transport | contracts.ts, transport.ts |
Neutral model requests; Pi authentication, Provider calls and stream parsing |
| Host facade | pi/session.ts |
Host Session controls, shared Runtime services and Sorbet live-event translation |
| Child agents | children/ |
Child Task admission, completion delivery, agent and Team Tools behind a host port |
| Persistence | @sorbetai/runtime |
UnitStore, commit line, Task kernel, Signals and fact validation |
The dependency direction is durable → runtime/context/plugins/model. Runtime
never imports Durable. The executor uses the existing Task scheduler and Journal.
Its root entry does not import Pi; /pi borrows configured Pi Models and never
owns credentials or a second Provider catalog.
import { JsonlUnitStore } from '@sorbetai/runtime/node';
import { DurableSession } from '@sorbetai/durable';
import { createPiTransport } from '@sorbetai/durable/pi';
const session = await DurableSession.open({
store: new JsonlUnitStore({ unitId: 'assistant', filePath: '/data/assistant.jsonl' }),
model: { provider: selected.provider, id: selected.id, api: selected.api },
transport: createPiTransport(models),
toolPermissionPolicy: {
fallback: { access: 'allow', approval: 'required' },
tools: {},
rules: [],
},
tools,
plugins: platform,
resourceProvider,
});
try {
const run = await session.start({ prompt: 'Inspect the project.', idempotencyKey: 'request-1' });
// The host handles pendingApprovals() while result() waits.
const answer = await run.result();
await run.drained();
} finally {
await session.close();
}
Use a dedicated C UnitStore. The executor rejects units owned by another executor.
Browser bundles can use the root SDK and createPiTransport without Node
polyfills or builtin-module externals. Inject the host's UnitStore and Tool
resources; browser packaging does not provide a Durable Object storage adapter
or alarm integration.
Hosts own Tool resources and sandbox policy. resourceProvider.acquire runs before
external work on each live Run attachment, including recovery. Release runs once
after Task settlement; a following Run waits for release. A release failure leaves
the committed Run outcome intact, rejects subsequent work, and is reported by close.
A behavior requiring a read-only workspace requires a resource that explicitly
attests to that constraint.
CodeMode is supplied by the @sorbetai/codemode Plugin.
Mount it on a Plugin Platform and pass that Platform to the Session. Node Agent
mounts it by default. Durable owns its nested tool permission, Effect and recovery
boundaries; the Plugin owns the interpreter, instructions and tool catalog state.
DurableSession.open owns a root Session and closes its Unit. For a tree, use
DurableUnit and attach each Session with its own model, permissions, plugins
and resource provider:
import { DurableUnit } from '@sorbetai/durable';
const unit = await DurableUnit.open({ store });
try {
const root = await unit.attach(unit.unitId, rootEnvironment);
await unit.createSession({
sessionId: 'researcher',
parentSessionId: unit.unitId,
creationKey: 'researcher',
});
const child = await unit.attach('researcher', childEnvironment);
const runs = await Promise.all([
root.start({ prompt: 'Review the implementation.', idempotencyKey: 'review' }),
child.start({ prompt: 'Check the references.', idempotencyKey: 'review' }),
]);
await Promise.all(runs.map((run) => run.result()));
} finally {
await unit.close();
}
createSession persists a child identity; it does not start work or inherit the
parent's authority. On reopen, use sessions() to discover existing identities
and attach the environments that are available. An unbound Session's unfinished Tasks
stay visible through unit.tasks() with definition_missing; attaching enables them
after its Journal projections are restored. Other attached Sessions can run.
Attach each identity once at a time. unit.detach(sessionId) drains that Session
and suspends its live Task reservations without ending its Run. Reattachment
restores the same Tasks and reacquires resources; sibling Sessions keep running.
Task kinds and stored ownership remain unchanged. Runtime selects process-local
Task handlers by the owning Session, following nested Task ownership. Each
Session owns its history, approvals, grants, inputs and Run resources. Run
idempotency keys are Session-local; Submission delivery IDs remain Unit-wide.
Session tasks, retryTask and Submission lookup stay within that Session.
waitForIdle joins runnable work across the Unit, including sibling Sessions;
approval and timer waits remain pending. unit.close drains every attached
Session before releasing resources; borrowed Session handles are released through unit.detach.
Node Agent composes its existing Agent/Team Tools and Reporter Tasks with these Session bindings. Spawn, initial input, replies and completion delivery keep their Unit transaction boundaries. Child Run permits and sandbox resources belong to the host; the executor acquires them before any external work.
To attach to an existing host-owned Unit, use
DurableSession.attach(unitRuntime, sessionId, environment). Closing that binding
does not close the Unit writer. The host retains wake and shutdown ownership.
start atomically records admission and creates its RunTask. Repeating the same
idempotency key returns that Run; conflicting content or a competing Run rejects.
submit({ prompt, deliveryId, whenBusy }) persists queued input. Steering enters
at the next Tool boundary; follow-up and remaining steering start a successor Run
at the final boundary. whenBusy: 'reject' refuses new input while a Run is active,
without accepting a Submission.
steeringMode: 'all' places all queued steering at a Tool boundary; the default
places one. followUpMode: 'all' places all pending steering and follow-up inputs
into one successor Run at the final boundary; the default selects one. Acceptance
order determines batch order. The prior terminal, successor Task and every batch
placement share one commit. The returned Submission supports durable status,
placement, settlement and withdrawal before placement.
Input content lives in submission.accepted; submission.placed records its
Run, message identity and boundary. Additional inputs and yield continuations do
not also write run.input.accepted. Runtime's shared projection joins these facts
and reads old dual-write journals without duplicating messages. Initial
run.accepted remains the Run's admission and authority record.
submitInput(input, { whenBusy }) accepts a user message, a context-event
with turn Context sources, or a write/reset control. Context events enter model
input without becoming user conversation messages. Each delivery has its own
compiled source namespace, so independent reports may reuse source names; the
accepted sources remain unchanged. Request evidence identifies which inputs kept
material after preparation. Recovery resends the committed request with the same
Context rather than preparing the event again.
pendingApprovals() includes unresolved requests restored from disk.
resolveApproval(id, { outcome: 'allowed-once' }) authorizes one attempt;
{ outcome: 'rejected', reason } denies it. Equivalent replies are idempotent;
conflicting replies reject. Adding remember: 'session' grants future calls with
that exact Tool name and complete prepared parameters. listPermissionGrants()
returns active grants; revokePermissionGrant(id) durably revokes future reuse.
Reopening restores grants and revocations. A base deny remains binding; existing
approval waits and already admitted Effects keep their decisions. Safe retries
recheck current grants and otherwise require a fresh approval. See
Session grant semantics.
Both admitted and current policies, binding identities and parameter schemas must
permit a Tool. Prepared approval parameters remain fixed across reopen. Plugin
contribution identity survives restart; execution borrows the current implementation
and records its actual lease/binding on the Effect. Historical process-local bindings
are never restored or treated as authority.
A lost model request is recorded as unknown, then sent under a new physical ID
with its original logical ID, context and dispatch settings. Transient failures
sleep durably before retrying; defaults are three retries, a two-second initial
delay and a sixty-second delay cap. modelRetry.maxRetries: Infinity removes the
attempt limit. The Pi adapter disables hidden Provider retries.
A lost Tool attempt becomes effect.unknown. An unsafe Tool returns uncertainty
to the model. If both its recorded and current declarations are safe,
safeToolRetries permits new attempts (default one). Every new attempt has a new
identity, reruns authorization and obtains a fresh one-time approval when required.
It never reuses or overwrites the abandoned attempt.
abort records cancellation, drains the Task subtree and external operations,
then commits the cancelled Run outcome. close drains I/O and releases the writer
while retaining unfinished work. A Tool that ignores cancellation can delay close.
Cancelling run.result(signal) only detaches that observer.
waitForIdle() joins currently runnable work; durable approvals and retry sleeps
may remain. tasks() lists those unfinished states and parked work; ended Tasks are
history in the Journal. taskRestartLimit
uses the existing consecutive unclean-recovery policy (default five, Infinity
disables parking). retryTask(id, commandId) explicitly resets parked work.
Each Generation borrows the current Plugin model port. Input transforms and their request evidence commit together. Preparation hooks, history selection, prefixes, Named State owners and declaration narrowing feed the shared ContextManager. Physical retries reuse committed input without rerunning those callbacks. Tool invocation and Named State reads can observe committed Tool results.
Tool Hooks use the shared prepare/feedback contract. Prepared arguments and
JSON state commit as a Journal fact before approval; Task checkpoints retain only
its identity, so large file arguments do not exhaust the checkpoint budget. The actual Effect commits before feedback;
reopening that phase reprocesses its result without dispatching the Tool again.
Preparation and feedback may repeat if their own result did not commit. See the
Hook contract for ordering and versioning.
write({ deliveryId, text, source }) adds display-only text. It normally applies
in its acceptance commit, but stays behind an earlier pending reset.
reset({ deliveryId, source }) waits until the current Run settles, then starts a
new effective-conversation epoch before later input. It preserves fixed prefix,
Named State revisions, history and usage. Neither control calls a model or starts
a Run. submission.applied is its terminal; await settled(), not placed().
displayEntries() interleaves conversation and controls by their applied order;
SorbetSession.conversation() retains its historical conversation contract;
model requests use the reset-aware effective projection.
requestContext() returns the latest settled request prefix plus the messages
committed after it, or undefined when a later compaction, reset or input rewrite
invalidated that prefix. Host features extend it with one instruction instead of
rebuilding the system prompt, Tool declarations and conversation themselves.
listBehaviors, commandBehavior and getUsage support the existing optional
Goal plugin. Yield decisions commit with either
continuation input or the Run terminal. Continuation retains the same Run and
resource attachment. Host state changes during an asynchronous hook invalidate
its pending decision. yieldUsageLimit limits committed Run token usage at yield
boundaries; omission and Infinity impose no limit. Goal owns its own cross-Run
budget and state.
Configure compaction with model capacity/pricing and optional settings to enable
threshold compaction. An overflow triggers a blocking CompactionTask, followed by
one retry after successful compaction. Summary calls use write-ahead facts and
checkpoints. Reopening reuses committed summary responses and resends only an
interrupted call under a new identity. Committing the summary starts a new Context
epoch while preserving Named State revisions. Compaction changes the effective
conversation, never the historical Journal.
SorbetSession reuses Runtime's public Journal handles, external model/Tool
operations, automatic reviewer, artifact archive and Object capabilities. It
provides live Tool/Plan/usage events, manual compaction and the Session controls
used by first-party hosts. Node Agent remains responsible for sandbox policy,
Plugin composition, credentials, attaching child Sessions and environment cleanup.
An interrupted A/B Run is adopted under its existing runId. Adoption settles
old model requests, Effects and approvals before creating its RunTask; external
work reacquires the host environment. The old Run's resume limit and explicit
resetAttempts still apply during adoption. Already-created C Tasks use Task
recovery instead. Cancellation receipts acknowledge committed intent; result()
and drained() wait for terminal outcome and resource cleanup respectively.
A RunTask that ends without writing its Run terminal (a faulted phase, an orphaned
abort) does not leave the Session busy: the attached Session, resume() and
abort() settle its open model requests, Effects and approvals as facts and commit
one run.failed (runtime_error) or, after a cancel request, run.cancelled.
A parked descendant Task makes the host Run view parked; it is not reported as
active execution. resumeInterruptedRun(runId, { resetAttempts: true }) resets its parked
Tasks under the same Run identity. The Unit recovery decision uses that same Task
graph, so it does not repeatedly reacquire an environment for parked work.
The facade also exposes tasks() and retryTask() for Session-owned work such as
manual compaction.
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.