Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
889 changes: 433 additions & 456 deletions decisions.snapshot.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ declare function registerStrategy(strategy: RouterStrategy): void;
/** Candidate router used for Auto. Rules still set the capability tier; V3 ranks within it. */
declare class PortfolioStrategy implements RouterStrategy {
readonly name = "portfolio";
private readonly rules;
route(prompt: string, systemPrompt: string | undefined, maxOutputTokens: number, options: RouterOptions): RoutingDecision;
}

Expand All @@ -388,6 +389,17 @@ declare function classifyByRules(prompt: string, systemPrompt: string | undefine
*/
declare function inferToolRequirement(prompt: string, _systemPrompt?: string, toolChoice?: unknown): boolean;

/**
* Request-size helpers shared by the rules and portfolio strategies.
*
* The router never tokenizes — it is on the hot path and model-agnostic — so
* sizes are estimates. The estimate only has to be honest enough for the
* decisions that consume it: the long-context task type, the COMPLEX
* override and the per-model capacity filter.
*/
/** Approximate token count: one per CJK character, one per four of anything else. */
declare function estimateTokens(text: string): number;

/**
* Default Routing Config
*
Expand All @@ -412,4 +424,4 @@ declare const DEFAULT_ROUTING_CONFIG: RoutingConfig;
*/
declare function route(prompt: string, systemPrompt: string | undefined, maxOutputTokens: number, options: RouterOptions): RoutingDecision;

export { DEFAULT_MODEL_CAPABILITIES, DEFAULT_ROUTING_CONFIG, HISTORICAL_MODEL_PROFILES, LIVE_MODEL_PROFILES, type ModelCapabilities, type ModelPerformanceProfile, type ModelPricing, PortfolioStrategy, type RouterOptions, type RouterStrategy, type RoutingConfig, type RoutingDecision, RulesStrategy, type TaskType, type Tier, applyUnavailableModels, calculateModelCost, classifyByRules, filterByExcludeList, filterByToolCalling, filterByVision, filterCandidatesByCapacity, getFallbackChain, getFallbackChainFiltered, getStrategy, inferToolRequirement, registerStrategy, route };
export { DEFAULT_MODEL_CAPABILITIES, DEFAULT_ROUTING_CONFIG, HISTORICAL_MODEL_PROFILES, LIVE_MODEL_PROFILES, type ModelCapabilities, type ModelPerformanceProfile, type ModelPricing, PortfolioStrategy, type RouterOptions, type RouterStrategy, type RoutingConfig, type RoutingDecision, RulesStrategy, type TaskType, type Tier, applyUnavailableModels, calculateModelCost, classifyByRules, estimateTokens, filterByExcludeList, filterByToolCalling, filterByVision, filterCandidatesByCapacity, getFallbackChain, getFallbackChainFiltered, getStrategy, inferToolRequirement, registerStrategy, route };
153 changes: 112 additions & 41 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export { RulesStrategy } from "./strategy.js";
export { PortfolioStrategy } from "./portfolio.js";
export { classifyByRules } from "./rules.js";
export { inferToolRequirement } from "./tool-intent.js";
export { estimateTokens } from "./tokens.js";
export {
getFallbackChain,
getFallbackChainFiltered,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@blockrun/router-core",
"version": "0.2.0",
"version": "0.3.0",
"description": "Smart LLM router — deterministic, constraint-first automatic model selection shared by BlockRun products.",
"type": "module",
"main": "dist/index.js",
Expand Down
Loading
Loading