@plasius/ai-router
v0.1.13
Published
Cost-aware AI task routing, budget, confidence, and SLO policy for Plasius agentic AI workloads.
Downloads
774
Maintainers
Readme
@plasius/ai-router
Cost-aware AI task routing, budget, confidence, and SLO policy for Plasius agentic AI workloads.
Scope
This package is part of the layered @plasius/ai-* package family. It provides deterministic route selection with confidence, budget, escalation, and fallback policy controls.
Install
npm install @plasius/ai-routerUsage
import { packageDescriptor } from "@plasius/ai-router";
console.log(packageDescriptor.packageName);import {
selectAiProviderRoute,
type AiRoutingPolicy,
} from "@plasius/ai-router";
import type { AiProviderCandidate } from "@plasius/ai-providers";
declare const candidates: readonly AiProviderCandidate[];
declare const requestId: string;
declare const policy: AiRoutingPolicy;
const decision = selectAiProviderRoute(requestId, candidates, policy);
console.log(decision.mode, decision.selected?.providerId);Development
npm install
npm run build
npm run typecheck
npm run test
npm run test:coverage
npm run lint
npm run pack:checkRelease Workflow
Protected main releases use a two-step flow:
- Run
.github/workflows/cd.ymlwithbump=patch|minor|majorto open or refresh arelease/vX.Y.Zprep PR. - Merge that PR to
main. - Rerun
.github/workflows/cd.ymlonmainwithbump=noneto tag, draft the GitHub release, and publish to npm.
Governance
- Security policy: SECURITY.md
- Code of conduct: CODE_OF_CONDUCT.md
- ADRs: docs/adrs
- CLA and legal docs: legal
License
Apache-2.0
Release integrity
Production package publication runs only from .github/workflows/cd.yml on
protected main. The job verifies that the prepared commit is still the
current main commit and has an exact successful ci.yml push result before it
mutates release state. Public package CI runs on GitHub-hosted capacity so it
cannot execute on company-managed runners. npm publication runs on
GitHub-hosted Node.js 24 with pinned npm 11.6.2, uses the protected production environment and
short-lived npm OIDC with provenance, and has no long-lived npm write-token
fallback. Rollback disables CD; it never rewrites published package history.
