@circuit-nova/nova-core
v0.12.1
Published
Provider-neutral coding-agent core: a bounded tool-use runtime, local and sandboxed workspace backends, model adapters for Anthropic/OpenAI-compatible providers, and multi-currency cost accounting.
Downloads
2,472
Readme
@circuit-nova/nova-core
The provider-neutral coding-agent core behind @circuit-nova/nova-cli: a bounded tool-use runtime, local and sandboxed workspace backends, model adapters for Anthropic/OpenAI-compatible providers, and multi-currency cost accounting. Use this package directly if you're embedding an agent loop in your own tool rather than running Nova's CLI.
npm install @circuit-nova/nova-coreWhat's in it
BoundedAgentRuntime— a tool-use loop that turns a list ofAgentTools and anAgentTurnProviderinto a bounded, event-driven run. Emitsassistant_deltaevents as the model streams text, so a caller can render output live instead of waiting for a full turn.- Model adapters —
resolveProvider()/PROVIDERSgive you Anthropic, OpenAI and arbitrary OpenAI-compatible endpoints, CircuitNotion, and local Ollama behind one interface. CircuitNotion defaults tocircuit-2-turbo. NovaAgent— the higher-level agent Nova's CLI runs: wires the runtime to a workspace, a permission ledger, checkpoints, and a todo list.- Workspace backends —
LocalWorkspaceruns against a real directory;E2BWorkspaceandDockerWorkspacerun the same contracts in remote or local isolation (e2bis optional). PermissionLedger— per-tool approval state forplan,build,auto, anddefender, so callers do not reimplement the safety posture.CheckpointStore— snapshots a workspace into a private git index per turn, so a caller can offer real undo (reverts both edited and agent-created files).CostLedgerandmoney.ts— currency-aware token pricing (priceUsage,tokenPrices,convertTo,formatMoney) with explicit, dated FX rates rather than implicit conversion. An unpriced model reports "cost unknown" instead of showing zero.- Durable state — integrity-checked JSON snapshots and hash-chained journals remain canonical; the optional
nova-statesidecar provides rebuildable SQLite/FTS5 recall. scoreReliability— an evaluator for completion, verification, valid tools, token economy, estimate calibration, scope, and resumed state, with hard caps for false success and permission escalation.
Example
import { resolveProvider } from "@circuit-nova/nova-core";
const resolved = resolveProvider(process.env, {
provider: "openai",
model: "cohere/north-mini-code:free",
});
if ("error" in resolved) throw new Error(resolved.error);
// Supply resolved.provider to BoundedAgentRuntime or NovaAgent. OPENAI_BASE_URL may point at an
// OpenAI-compatible endpoint; provider-reported usage remains the accounting truth.Upgrading to 0.5.0
Additive except for one resolution-order change. ^0.4.0 does not match 0.5.0, so nothing picks this up by surprise.
resolveProvidernow honoursNOVA_PROVIDER. With no explicitprovideroption, a valid, configuredNOVA_PROVIDERin the environment wins over the previous "first configured provider in catalog order" rule. If you embed this package in a process where that variable is set for unrelated reasons, resolution changes; passproviderexplicitly to pin it. An unset, unrecognised, or unconfigured value falls back to the old behaviour rather than erroring, so a stale setting can never stop a session starting.CostLedger.setDisplay(display, rates?)is new. Re-reads a session in another currency, converting spending already recorded rather than leaving it in the old one. MirrorssetPricesfor the display side.
Upgrading to 0.4.0
Four changes need an edit if you embed this package. ^0.3.0 deliberately does not match 0.4.0, so nothing upgrades into these by surprise.
createNovaToolsis nowasync. It awaits externally-sourced tools (skills, MCP servers, plugins) before returning.const tools = createNovaTools(…)becomesconst tools = await createNovaTools(…).NovaWorkspacegained two required members. A custom implementation needslistConfigFiles(prefix)— files under a prefix, ignoring the ignored-directory list,[]when the directory is absent — andcommandPlatform, the platform whose shell rules apply to commands it runs (process.platformfor a local workspace,"linux"for anything containerised).- Discovery takes a workspace, not a root path.
discoverSkillManifests,discoverPlugins,discoverMcpServers,loadLocalExternalToolingandHookRegistry.localnow receive aNovaWorkspace, which is what lets a.novadirectory work in a sandbox rather than only on the host. - Stored approvals are void.
APPROVAL_POLICY_VERSIONmoved tonova-approval-v2because a tool's provenance now forms part of its action digest — a standing approval for a built-inrun_commandmust not silently cover a same-named tool an MCP server starts offering. Persistedallow_alwaysdecisions from v1 are ignored and will be asked again once.
Optional peer dependencies
Both are lazy-loaded — importing this package doesn't require either unless you actually use the adapter that needs it:
@anthropic-ai/sdk(>=0.30.0) — required only for the Anthropic provider.e2b(>=2.0.0) — required only forE2BWorkspace.
Requirements
Node 22.5 or newer.
MIT licensed.
