pi-smart-router 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/.pi/extensions/smart-router/command-formatters.ts +167 -0
  2. package/.pi/extensions/smart-router/commands.ts +242 -0
  3. package/.pi/extensions/smart-router/dataset-export.ts +142 -0
  4. package/.pi/extensions/smart-router/delegate-stream.ts +105 -0
  5. package/.pi/extensions/smart-router/delegation-runtime.ts +355 -0
  6. package/.pi/extensions/smart-router/extension-setup.ts +115 -0
  7. package/.pi/extensions/smart-router/fleet-bootstrap.ts +244 -0
  8. package/.pi/extensions/smart-router/index.ts +115 -0
  9. package/.pi/extensions/smart-router/package.json +3 -0
  10. package/.pi/extensions/smart-router/pi-model-scope.ts +55 -0
  11. package/.pi/extensions/smart-router/pricing-lifecycle.ts +43 -0
  12. package/.pi/extensions/smart-router/route-and-delegate.ts +562 -0
  13. package/.pi/extensions/smart-router/routing-context.ts +171 -0
  14. package/.pi/extensions/smart-router/routing-outcomes.ts +44 -0
  15. package/.pi/extensions/smart-router/session-lifecycle.ts +140 -0
  16. package/.pi/extensions/smart-router/stream-delegation.ts +75 -0
  17. package/.pi/extensions/smart-router/types.ts +90 -0
  18. package/.pi/extensions/smart-router/utils.ts +58 -0
  19. package/README.md +593 -0
  20. package/bin/pi-smart-router.mjs +79 -0
  21. package/config/.gitkeep +0 -0
  22. package/config/hydra-projection-weights.json.example +1169 -0
  23. package/config/models.yaml.example +58 -0
  24. package/config/p-success-weights.json.example +19 -0
  25. package/config/routing-calibration.json.example +1605 -0
  26. package/config/routing-centroids.json.example +1570 -0
  27. package/config/routing-clusters.yaml.example +41 -0
  28. package/data/contrib/example.json +25 -0
  29. package/dist/api/explain/router-explain.d.ts +47 -0
  30. package/dist/api/explain/router-explain.d.ts.map +1 -0
  31. package/dist/api/explain/router-explain.js +101 -0
  32. package/dist/api/explain/router-explain.js.map +1 -0
  33. package/dist/api/middleware/pi-router-middleware.d.ts +86 -0
  34. package/dist/api/middleware/pi-router-middleware.d.ts.map +1 -0
  35. package/dist/api/middleware/pi-router-middleware.js +83 -0
  36. package/dist/api/middleware/pi-router-middleware.js.map +1 -0
  37. package/dist/cli/smart-router-cli.d.ts +85 -0
  38. package/dist/cli/smart-router-cli.d.ts.map +1 -0
  39. package/dist/cli/smart-router-cli.js +293 -0
  40. package/dist/cli/smart-router-cli.js.map +1 -0
  41. package/dist/config/defaults.d.ts +7 -0
  42. package/dist/config/defaults.d.ts.map +1 -0
  43. package/dist/config/defaults.js +33 -0
  44. package/dist/config/defaults.js.map +1 -0
  45. package/dist/config/models-loader.d.ts +22 -0
  46. package/dist/config/models-loader.d.ts.map +1 -0
  47. package/dist/config/models-loader.js +51 -0
  48. package/dist/config/models-loader.js.map +1 -0
  49. package/dist/config/pi-model-mapper.d.ts +40 -0
  50. package/dist/config/pi-model-mapper.d.ts.map +1 -0
  51. package/dist/config/pi-model-mapper.js +216 -0
  52. package/dist/config/pi-model-mapper.js.map +1 -0
  53. package/dist/config/routing-clusters-loader.d.ts +35 -0
  54. package/dist/config/routing-clusters-loader.d.ts.map +1 -0
  55. package/dist/config/routing-clusters-loader.js +100 -0
  56. package/dist/config/routing-clusters-loader.js.map +1 -0
  57. package/dist/domain/delegation/delegation-context.d.ts +23 -0
  58. package/dist/domain/delegation/delegation-context.d.ts.map +1 -0
  59. package/dist/domain/delegation/delegation-context.js +73 -0
  60. package/dist/domain/delegation/delegation-context.js.map +1 -0
  61. package/dist/domain/delegation/execution-ledger.d.ts +19 -0
  62. package/dist/domain/delegation/execution-ledger.d.ts.map +1 -0
  63. package/dist/domain/delegation/execution-ledger.js +23 -0
  64. package/dist/domain/delegation/execution-ledger.js.map +1 -0
  65. package/dist/domain/delegation/output-headroom.d.ts +39 -0
  66. package/dist/domain/delegation/output-headroom.d.ts.map +1 -0
  67. package/dist/domain/delegation/output-headroom.js +78 -0
  68. package/dist/domain/delegation/output-headroom.js.map +1 -0
  69. package/dist/domain/matching/cluster-matcher.d.ts +69 -0
  70. package/dist/domain/matching/cluster-matcher.d.ts.map +1 -0
  71. package/dist/domain/matching/cluster-matcher.js +294 -0
  72. package/dist/domain/matching/cluster-matcher.js.map +1 -0
  73. package/dist/domain/matching/embedding-provider.d.ts +21 -0
  74. package/dist/domain/matching/embedding-provider.d.ts.map +1 -0
  75. package/dist/domain/matching/embedding-provider.js +42 -0
  76. package/dist/domain/matching/embedding-provider.js.map +1 -0
  77. package/dist/domain/matching/hydra-input.d.ts +18 -0
  78. package/dist/domain/matching/hydra-input.d.ts.map +1 -0
  79. package/dist/domain/matching/hydra-input.js +40 -0
  80. package/dist/domain/matching/hydra-input.js.map +1 -0
  81. package/dist/domain/matching/hydra-matcher.d.ts +103 -0
  82. package/dist/domain/matching/hydra-matcher.d.ts.map +1 -0
  83. package/dist/domain/matching/hydra-matcher.js +275 -0
  84. package/dist/domain/matching/hydra-matcher.js.map +1 -0
  85. package/dist/domain/pinning/cache-economics.d.ts +53 -0
  86. package/dist/domain/pinning/cache-economics.d.ts.map +1 -0
  87. package/dist/domain/pinning/cache-economics.js +72 -0
  88. package/dist/domain/pinning/cache-economics.js.map +1 -0
  89. package/dist/domain/pinning/loop-escalation.d.ts +41 -0
  90. package/dist/domain/pinning/loop-escalation.d.ts.map +1 -0
  91. package/dist/domain/pinning/loop-escalation.js +137 -0
  92. package/dist/domain/pinning/loop-escalation.js.map +1 -0
  93. package/dist/domain/pinning/session-pinner.d.ts +81 -0
  94. package/dist/domain/pinning/session-pinner.d.ts.map +1 -0
  95. package/dist/domain/pinning/session-pinner.js +237 -0
  96. package/dist/domain/pinning/session-pinner.js.map +1 -0
  97. package/dist/domain/pinning/sub-route-policy.d.ts +41 -0
  98. package/dist/domain/pinning/sub-route-policy.d.ts.map +1 -0
  99. package/dist/domain/pinning/sub-route-policy.js +72 -0
  100. package/dist/domain/pinning/sub-route-policy.js.map +1 -0
  101. package/dist/domain/pipeline/router-pipeline.d.ts +180 -0
  102. package/dist/domain/pipeline/router-pipeline.d.ts.map +1 -0
  103. package/dist/domain/pipeline/router-pipeline.js +807 -0
  104. package/dist/domain/pipeline/router-pipeline.js.map +1 -0
  105. package/dist/domain/pipeline/safe-default.d.ts +25 -0
  106. package/dist/domain/pipeline/safe-default.d.ts.map +1 -0
  107. package/dist/domain/pipeline/safe-default.js +41 -0
  108. package/dist/domain/pipeline/safe-default.js.map +1 -0
  109. package/dist/domain/refactor-guardrails.d.ts +48 -0
  110. package/dist/domain/refactor-guardrails.d.ts.map +1 -0
  111. package/dist/domain/refactor-guardrails.js +129 -0
  112. package/dist/domain/refactor-guardrails.js.map +1 -0
  113. package/dist/domain/routing/context-fit.d.ts +53 -0
  114. package/dist/domain/routing/context-fit.d.ts.map +1 -0
  115. package/dist/domain/routing/context-fit.js +142 -0
  116. package/dist/domain/routing/context-fit.js.map +1 -0
  117. package/dist/domain/routing/expected-cost.d.ts +63 -0
  118. package/dist/domain/routing/expected-cost.d.ts.map +1 -0
  119. package/dist/domain/routing/expected-cost.js +177 -0
  120. package/dist/domain/routing/expected-cost.js.map +1 -0
  121. package/dist/domain/routing/p-success-classifier.d.ts +130 -0
  122. package/dist/domain/routing/p-success-classifier.d.ts.map +1 -0
  123. package/dist/domain/routing/p-success-classifier.js +350 -0
  124. package/dist/domain/routing/p-success-classifier.js.map +1 -0
  125. package/dist/domain/routing/tier-features.d.ts +70 -0
  126. package/dist/domain/routing/tier-features.d.ts.map +1 -0
  127. package/dist/domain/routing/tier-features.js +174 -0
  128. package/dist/domain/routing/tier-features.js.map +1 -0
  129. package/dist/domain/routing/tool-history-guard.d.ts +32 -0
  130. package/dist/domain/routing/tool-history-guard.d.ts.map +1 -0
  131. package/dist/domain/routing/tool-history-guard.js +110 -0
  132. package/dist/domain/routing/tool-history-guard.js.map +1 -0
  133. package/dist/domain/scoring/multi-objective.d.ts +48 -0
  134. package/dist/domain/scoring/multi-objective.d.ts.map +1 -0
  135. package/dist/domain/scoring/multi-objective.js +116 -0
  136. package/dist/domain/scoring/multi-objective.js.map +1 -0
  137. package/dist/domain/triage/triage-engine.d.ts +43 -0
  138. package/dist/domain/triage/triage-engine.d.ts.map +1 -0
  139. package/dist/domain/triage/triage-engine.js +317 -0
  140. package/dist/domain/triage/triage-engine.js.map +1 -0
  141. package/dist/domain/triage/turn-envelope.d.ts +17 -0
  142. package/dist/domain/triage/turn-envelope.d.ts.map +1 -0
  143. package/dist/domain/triage/turn-envelope.js +81 -0
  144. package/dist/domain/triage/turn-envelope.js.map +1 -0
  145. package/dist/domain/types/entities.d.ts +303 -0
  146. package/dist/domain/types/entities.d.ts.map +1 -0
  147. package/dist/domain/types/entities.js +6 -0
  148. package/dist/domain/types/entities.js.map +1 -0
  149. package/dist/domain/types/index.d.ts +4 -0
  150. package/dist/domain/types/index.d.ts.map +1 -0
  151. package/dist/domain/types/index.js +2 -0
  152. package/dist/domain/types/index.js.map +1 -0
  153. package/dist/domain/types/schemas.d.ts +346 -0
  154. package/dist/domain/types/schemas.d.ts.map +1 -0
  155. package/dist/domain/types/schemas.js +241 -0
  156. package/dist/domain/types/schemas.js.map +1 -0
  157. package/dist/domain/types/store-port.d.ts +44 -0
  158. package/dist/domain/types/store-port.d.ts.map +1 -0
  159. package/dist/domain/types/store-port.js +6 -0
  160. package/dist/domain/types/store-port.js.map +1 -0
  161. package/dist/index.d.ts +39 -0
  162. package/dist/index.d.ts.map +1 -0
  163. package/dist/index.js +36 -0
  164. package/dist/index.js.map +1 -0
  165. package/dist/infra/gemini-provider.d.ts +28 -0
  166. package/dist/infra/gemini-provider.d.ts.map +1 -0
  167. package/dist/infra/gemini-provider.js +112 -0
  168. package/dist/infra/gemini-provider.js.map +1 -0
  169. package/dist/infra/telemetry.d.ts +51 -0
  170. package/dist/infra/telemetry.d.ts.map +1 -0
  171. package/dist/infra/telemetry.js +100 -0
  172. package/dist/infra/telemetry.js.map +1 -0
  173. package/dist/infrastructure/delegation/provider-error.d.ts +44 -0
  174. package/dist/infrastructure/delegation/provider-error.d.ts.map +1 -0
  175. package/dist/infrastructure/delegation/provider-error.js +179 -0
  176. package/dist/infrastructure/delegation/provider-error.js.map +1 -0
  177. package/dist/infrastructure/gateway/circuit-breaker.d.ts +68 -0
  178. package/dist/infrastructure/gateway/circuit-breaker.d.ts.map +1 -0
  179. package/dist/infrastructure/gateway/circuit-breaker.js +150 -0
  180. package/dist/infrastructure/gateway/circuit-breaker.js.map +1 -0
  181. package/dist/infrastructure/gateway/gateway-dispatch.d.ts +138 -0
  182. package/dist/infrastructure/gateway/gateway-dispatch.d.ts.map +1 -0
  183. package/dist/infrastructure/gateway/gateway-dispatch.js +308 -0
  184. package/dist/infrastructure/gateway/gateway-dispatch.js.map +1 -0
  185. package/dist/infrastructure/hardware/hardware-probe.d.ts +32 -0
  186. package/dist/infrastructure/hardware/hardware-probe.d.ts.map +1 -0
  187. package/dist/infrastructure/hardware/hardware-probe.js +199 -0
  188. package/dist/infrastructure/hardware/hardware-probe.js.map +1 -0
  189. package/dist/infrastructure/local/local-zero-tier.d.ts +47 -0
  190. package/dist/infrastructure/local/local-zero-tier.d.ts.map +1 -0
  191. package/dist/infrastructure/local/local-zero-tier.js +92 -0
  192. package/dist/infrastructure/local/local-zero-tier.js.map +1 -0
  193. package/dist/infrastructure/persistence/memory-store.d.ts +31 -0
  194. package/dist/infrastructure/persistence/memory-store.d.ts.map +1 -0
  195. package/dist/infrastructure/persistence/memory-store.js +87 -0
  196. package/dist/infrastructure/persistence/memory-store.js.map +1 -0
  197. package/dist/infrastructure/persistence/sqlite-store.d.ts +81 -0
  198. package/dist/infrastructure/persistence/sqlite-store.d.ts.map +1 -0
  199. package/dist/infrastructure/persistence/sqlite-store.js +658 -0
  200. package/dist/infrastructure/persistence/sqlite-store.js.map +1 -0
  201. package/dist/infrastructure/pricing/litellm-fetch.d.ts +46 -0
  202. package/dist/infrastructure/pricing/litellm-fetch.d.ts.map +1 -0
  203. package/dist/infrastructure/pricing/litellm-fetch.js +145 -0
  204. package/dist/infrastructure/pricing/litellm-fetch.js.map +1 -0
  205. package/dist/infrastructure/pricing/price-broker.d.ts +56 -0
  206. package/dist/infrastructure/pricing/price-broker.d.ts.map +1 -0
  207. package/dist/infrastructure/pricing/price-broker.js +133 -0
  208. package/dist/infrastructure/pricing/price-broker.js.map +1 -0
  209. package/dist/infrastructure/pricing/pricing-monitor.d.ts +27 -0
  210. package/dist/infrastructure/pricing/pricing-monitor.d.ts.map +1 -0
  211. package/dist/infrastructure/pricing/pricing-monitor.js +46 -0
  212. package/dist/infrastructure/pricing/pricing-monitor.js.map +1 -0
  213. package/dist/infrastructure/telemetry/dataset-limits.d.ts +13 -0
  214. package/dist/infrastructure/telemetry/dataset-limits.d.ts.map +1 -0
  215. package/dist/infrastructure/telemetry/dataset-limits.js +28 -0
  216. package/dist/infrastructure/telemetry/dataset-limits.js.map +1 -0
  217. package/dist/infrastructure/telemetry/dataset-recorder.d.ts +48 -0
  218. package/dist/infrastructure/telemetry/dataset-recorder.d.ts.map +1 -0
  219. package/dist/infrastructure/telemetry/dataset-recorder.js +154 -0
  220. package/dist/infrastructure/telemetry/dataset-recorder.js.map +1 -0
  221. package/dist/infrastructure/telemetry/outcome-limits.d.ts +12 -0
  222. package/dist/infrastructure/telemetry/outcome-limits.d.ts.map +1 -0
  223. package/dist/infrastructure/telemetry/outcome-limits.js +28 -0
  224. package/dist/infrastructure/telemetry/outcome-limits.js.map +1 -0
  225. package/dist/infrastructure/telemetry/outcome-recorder.d.ts +29 -0
  226. package/dist/infrastructure/telemetry/outcome-recorder.d.ts.map +1 -0
  227. package/dist/infrastructure/telemetry/outcome-recorder.js +49 -0
  228. package/dist/infrastructure/telemetry/outcome-recorder.js.map +1 -0
  229. package/dist/infrastructure/telemetry/routing-telemetry.d.ts +115 -0
  230. package/dist/infrastructure/telemetry/routing-telemetry.d.ts.map +1 -0
  231. package/dist/infrastructure/telemetry/routing-telemetry.js +529 -0
  232. package/dist/infrastructure/telemetry/routing-telemetry.js.map +1 -0
  233. package/dist/infrastructure/telemetry/telemetry-limits.d.ts +16 -0
  234. package/dist/infrastructure/telemetry/telemetry-limits.d.ts.map +1 -0
  235. package/dist/infrastructure/telemetry/telemetry-limits.js +35 -0
  236. package/dist/infrastructure/telemetry/telemetry-limits.js.map +1 -0
  237. package/package.json +110 -0
  238. package/skills/router-backlog-orchestrator/SKILL.md +183 -0
  239. package/skills/router-backlog-orchestrator/references/github-router-issue-template.md +78 -0
  240. package/skills/router-backlog-orchestrator/references/packet-from-issue.md +99 -0
  241. package/skills/router-backlog-orchestrator/references/prioritization-rubric.md +65 -0
  242. package/skills/router-backlog-orchestrator/scripts/collect-backlog.sh +44 -0
  243. package/specs/001-build-smart-router/contracts/telemetry-contrib.schema.json +151 -0
  244. package/src/api/explain/.gitkeep +0 -0
  245. package/src/api/explain/router-explain.ts +146 -0
  246. package/src/api/middleware/.gitkeep +0 -0
  247. package/src/api/middleware/pi-router-middleware.ts +169 -0
  248. package/src/cli/smart-router-cli.ts +436 -0
  249. package/src/config/.gitkeep +0 -0
  250. package/src/config/defaults.ts +35 -0
  251. package/src/config/models-loader.ts +68 -0
  252. package/src/config/pi-model-mapper.ts +285 -0
  253. package/src/config/routing-clusters-loader.ts +148 -0
  254. package/src/domain/delegation/delegation-context.ts +111 -0
  255. package/src/domain/delegation/execution-ledger.ts +34 -0
  256. package/src/domain/delegation/output-headroom.ts +131 -0
  257. package/src/domain/matching/.gitkeep +0 -0
  258. package/src/domain/matching/cluster-matcher.ts +474 -0
  259. package/src/domain/matching/embedding-provider.ts +79 -0
  260. package/src/domain/matching/hydra-input.ts +53 -0
  261. package/src/domain/matching/hydra-matcher.ts +454 -0
  262. package/src/domain/pinning/.gitkeep +0 -0
  263. package/src/domain/pinning/cache-economics.ts +128 -0
  264. package/src/domain/pinning/loop-escalation.ts +181 -0
  265. package/src/domain/pinning/session-pinner.ts +388 -0
  266. package/src/domain/pinning/sub-route-policy.ts +119 -0
  267. package/src/domain/pipeline/.gitkeep +0 -0
  268. package/src/domain/pipeline/router-pipeline.ts +1139 -0
  269. package/src/domain/pipeline/safe-default.ts +70 -0
  270. package/src/domain/refactor-guardrails.ts +202 -0
  271. package/src/domain/routing/context-fit.ts +221 -0
  272. package/src/domain/routing/expected-cost.ts +320 -0
  273. package/src/domain/routing/p-success-classifier.ts +511 -0
  274. package/src/domain/routing/tier-features.ts +290 -0
  275. package/src/domain/routing/tool-history-guard.ts +159 -0
  276. package/src/domain/scoring/.gitkeep +0 -0
  277. package/src/domain/scoring/multi-objective.ts +175 -0
  278. package/src/domain/triage/.gitkeep +0 -0
  279. package/src/domain/triage/triage-engine.ts +373 -0
  280. package/src/domain/triage/turn-envelope.ts +104 -0
  281. package/src/domain/types/.gitkeep +0 -0
  282. package/src/domain/types/entities.ts +384 -0
  283. package/src/domain/types/index.ts +41 -0
  284. package/src/domain/types/schemas.ts +289 -0
  285. package/src/domain/types/store-port.ts +59 -0
  286. package/src/index.ts +103 -0
  287. package/src/infra/gemini-provider.ts +142 -0
  288. package/src/infra/telemetry.ts +169 -0
  289. package/src/infrastructure/delegation/provider-error.ts +251 -0
  290. package/src/infrastructure/gateway/.gitkeep +0 -0
  291. package/src/infrastructure/gateway/circuit-breaker.ts +196 -0
  292. package/src/infrastructure/gateway/gateway-dispatch.ts +444 -0
  293. package/src/infrastructure/hardware/.gitkeep +0 -0
  294. package/src/infrastructure/hardware/hardware-probe.ts +276 -0
  295. package/src/infrastructure/local/.gitkeep +0 -0
  296. package/src/infrastructure/local/local-zero-tier.ts +151 -0
  297. package/src/infrastructure/persistence/.gitkeep +0 -0
  298. package/src/infrastructure/persistence/memory-store.ts +122 -0
  299. package/src/infrastructure/persistence/sqlite-store.ts +900 -0
  300. package/src/infrastructure/pricing/.gitkeep +0 -0
  301. package/src/infrastructure/pricing/litellm-fetch.ts +215 -0
  302. package/src/infrastructure/pricing/price-broker.ts +183 -0
  303. package/src/infrastructure/pricing/pricing-monitor.ts +65 -0
  304. package/src/infrastructure/telemetry/.gitkeep +0 -0
  305. package/src/infrastructure/telemetry/dataset-limits.ts +39 -0
  306. package/src/infrastructure/telemetry/dataset-recorder.ts +215 -0
  307. package/src/infrastructure/telemetry/outcome-limits.ts +42 -0
  308. package/src/infrastructure/telemetry/outcome-recorder.ts +118 -0
  309. package/src/infrastructure/telemetry/routing-telemetry.ts +824 -0
  310. package/src/infrastructure/telemetry/telemetry-limits.ts +50 -0
@@ -0,0 +1,303 @@
1
+ /**
2
+ * Domain entity types for the pi-smart-router routing pipeline.
3
+ * Derived from specs/001-build-smart-router/data-model.md
4
+ */
5
+ export type TurnType = 'planning' | 'tool_result' | 'subagent' | 'main_loop' | 'unknown';
6
+ export type PinReason = 'initial' | 'user_forced' | 'loop_escalation' | 'compaction' | 'cache_economics' | 'context_overflow';
7
+ export type Tier = 'zero-tier' | 'economical-cloud' | 'frontier-cloud';
8
+ export type RoutingStage = 'triage' | 'turn_envelope' | 'session_pin' | 'local_zero' | 'hydra_match' | 'fallback';
9
+ export type PriceSource = 'override' | 'registry' | 'yaml_fallback';
10
+ export interface Message {
11
+ readonly role: string;
12
+ readonly content: string;
13
+ readonly tool_blocks?: readonly unknown[];
14
+ }
15
+ export interface RoutingRequest {
16
+ readonly request_id: string;
17
+ readonly session_id: string;
18
+ readonly prompt_text: string;
19
+ readonly messages?: readonly Message[];
20
+ readonly turn_type?: TurnType;
21
+ readonly compaction_flag?: boolean;
22
+ readonly force_model_id?: string;
23
+ readonly candidate_model_id?: string;
24
+ readonly estimated_input_tokens?: number;
25
+ }
26
+ export interface SessionPin {
27
+ readonly session_id: string;
28
+ readonly pinned_model_id: string;
29
+ readonly pin_reason: PinReason;
30
+ readonly has_ever_switched: boolean;
31
+ readonly consecutive_upstream_errors: number;
32
+ readonly consecutive_tool_failures: number;
33
+ readonly last_tool_failure_signature: string | null;
34
+ readonly created_at: string;
35
+ readonly updated_at: string;
36
+ }
37
+ export interface ModelCapabilities {
38
+ readonly reasoning: number;
39
+ readonly code_gen: number;
40
+ readonly tool_use: number;
41
+ }
42
+ export interface ModelPerformance {
43
+ readonly latency_p50_ms?: number | undefined;
44
+ readonly verbosity_factor?: number | undefined;
45
+ readonly cache_friendly?: boolean | undefined;
46
+ }
47
+ export interface ModelPricing {
48
+ readonly registry_key?: string | undefined;
49
+ /** Per-token API/catalog fallback USD per 1M tokens. */
50
+ readonly fallback_cost_per_1m: number;
51
+ /**
52
+ * Virtual subscription-quota cost USD per 1M tokens (SP-096).
53
+ * Used for frugality scoring and telemetry when set; does not replace API billing rates.
54
+ */
55
+ readonly quota_cost_per_1m?: number | undefined;
56
+ }
57
+ export interface ModelLimits {
58
+ readonly max_input_tokens?: number | undefined;
59
+ readonly max_output_tokens?: number | undefined;
60
+ }
61
+ export interface ModelProfile {
62
+ readonly id: string;
63
+ readonly tier: Tier;
64
+ readonly provider: string;
65
+ readonly endpoint?: string | undefined;
66
+ readonly capabilities: ModelCapabilities;
67
+ readonly performance?: ModelPerformance | undefined;
68
+ readonly pricing: ModelPricing;
69
+ readonly limits?: ModelLimits | undefined;
70
+ readonly healthy?: boolean | undefined;
71
+ }
72
+ export interface CandidateScore {
73
+ readonly model_id: string;
74
+ readonly score: number;
75
+ readonly shortfall: number;
76
+ readonly rejected_reason: string | null;
77
+ }
78
+ /** Privacy-safe context-fit rejection entry for telemetry and explain (SP-110). */
79
+ export interface ContextFitRejectedEntry {
80
+ readonly model_id: string;
81
+ readonly max_input_tokens: number | null;
82
+ readonly reason: string;
83
+ }
84
+ /** Context-fit observability metadata (SP-110, #53). */
85
+ export interface ContextFitObservability {
86
+ readonly estimated_input_tokens: number | null;
87
+ readonly context_fit_viable_count: number | null;
88
+ readonly context_fit_rejected_json: string | null;
89
+ readonly context_overflow_pin_break: boolean;
90
+ readonly selected_model_max_input_tokens: number | null;
91
+ readonly context_fit_reason_code: string | null;
92
+ }
93
+ /** Per-cluster cosine score row for explain output (SP-113, #62). */
94
+ export interface ClusterMatchTableEntry {
95
+ readonly cluster_id: string;
96
+ readonly tier_bias: Tier;
97
+ readonly similarity: number;
98
+ readonly margin: number | null;
99
+ readonly confidence: 'high' | 'none';
100
+ readonly selected: boolean;
101
+ }
102
+ /** Privacy-safe tier feature summary for explain (SP-113). */
103
+ export interface TierFeatureSummary {
104
+ readonly triage_verdict: string | null;
105
+ readonly triage_reason_code: string | null;
106
+ readonly cyclomatic_score: number | null;
107
+ readonly requirement_reasoning: number | null;
108
+ readonly requirement_code_gen: number | null;
109
+ readonly requirement_tool_use: number | null;
110
+ }
111
+ /** Expected-cost tier candidate rejected in favor of the winner (SP-113). */
112
+ export interface RejectedTierEntry {
113
+ readonly tier: string;
114
+ readonly expected_cost_usd: number;
115
+ readonly adjusted_expected_cost_usd: number;
116
+ readonly reason: string;
117
+ }
118
+ /** Low-intensity gate breakdown for explain (SP-113). */
119
+ export interface LowIntensityBreakdown {
120
+ readonly score: number | null;
121
+ readonly tier_hint: Tier | null;
122
+ readonly tier_hint_reason_code: string | null;
123
+ readonly tier_selection_reason_code: string | null;
124
+ readonly p_success_cheap: number | null;
125
+ readonly p_success_alpha: number | null;
126
+ readonly rejected_tiers: readonly RejectedTierEntry[];
127
+ }
128
+ /** Tier/cluster selection observability (SP-113, #62). */
129
+ export interface TierSelectionObservability {
130
+ readonly cluster_id: string | null;
131
+ readonly cluster_similarity: number | null;
132
+ readonly cluster_margin: number | null;
133
+ readonly low_intensity_score: number | null;
134
+ readonly tier_hint: Tier | null;
135
+ readonly p_success_cheap: number | null;
136
+ readonly local_eligible_reason: string | null;
137
+ readonly tier_selection_reason_code: string | null;
138
+ readonly cluster_match_table: readonly ClusterMatchTableEntry[] | null;
139
+ readonly tier_feature_summary: TierFeatureSummary | null;
140
+ readonly low_intensity_breakdown: LowIntensityBreakdown | null;
141
+ readonly local_zero_skip_reasons: readonly string[];
142
+ }
143
+ export interface TriageFeatureSummary {
144
+ readonly verdict: 'trivial' | 'complex' | 'ambiguous';
145
+ readonly reason_code: string;
146
+ readonly cyclomatic_score: number;
147
+ }
148
+ /** HyDRA requirement vector projected from prompt embedding (SP-057). */
149
+ export interface RequirementVector {
150
+ readonly reasoning: number;
151
+ readonly code_gen: number;
152
+ readonly tool_use: number;
153
+ }
154
+ /**
155
+ * Privacy-safe routing feature sidecar for dataset capture (SP-057).
156
+ * Metadata and routing signals only — no prompt text, messages, or tool arguments.
157
+ */
158
+ export interface RoutingFeatureSidecar {
159
+ readonly triage: TriageFeatureSummary | null;
160
+ readonly requirements: RequirementVector | null;
161
+ readonly candidates: readonly CandidateScore[] | null;
162
+ /** Tier gate hint from low_intensity stage (SP-103, #62 explain). */
163
+ readonly tier_hint: Tier | null;
164
+ readonly tier_hint_reason_code: string | null;
165
+ readonly low_intensity_score: number | null;
166
+ /** P(success) cheap-tier probability from low_intensity gate (SP-105). */
167
+ readonly p_success_cheap: number | null;
168
+ /** Operator alpha threshold used for P(success) routing (SP-105). */
169
+ readonly p_success_alpha: number | null;
170
+ /** Context-fit gate observability (SP-110). */
171
+ readonly context_fit?: ContextFitObservability;
172
+ /** Tier/cluster selection observability (SP-113, #62). */
173
+ readonly tier_selection?: TierSelectionObservability;
174
+ /** Why local_zero eligibility passed (SP-111, #59). */
175
+ readonly local_eligible_reason: string | null;
176
+ }
177
+ export interface RoutingDecision {
178
+ readonly request_id: string;
179
+ readonly selected_model_id: string;
180
+ readonly tier: Tier;
181
+ readonly stage: RoutingStage;
182
+ readonly reason_code: string;
183
+ readonly candidates?: readonly CandidateScore[];
184
+ readonly estimated_cost_usd?: number;
185
+ readonly routing_latency_ms: number;
186
+ readonly pin_reason: string | null;
187
+ /** Optional dataset feature sidecar; omitted on legacy call paths. */
188
+ readonly features?: RoutingFeatureSidecar;
189
+ }
190
+ export interface PriceCatalog {
191
+ readonly registry_snapshot: Readonly<Record<string, number>>;
192
+ /** LiteLLM context limits keyed by model id and provider/model aliases. */
193
+ readonly registry_limits_snapshot?: Readonly<Record<string, ModelLimits>> | undefined;
194
+ readonly user_overrides: Readonly<Record<string, number>>;
195
+ readonly last_updated: string;
196
+ readonly source: PriceSource;
197
+ }
198
+ /**
199
+ * Privacy-safe routing dataset record (Tier 1).
200
+ * Metadata and routing features only — no prompt text, messages, or tool arguments.
201
+ */
202
+ export interface RoutingDatasetRecord {
203
+ readonly request_id: string;
204
+ readonly timestamp: string;
205
+ readonly turn_type: string;
206
+ readonly stage: string;
207
+ readonly reason_code: string;
208
+ readonly selected_model_id: string;
209
+ readonly tier: Tier;
210
+ readonly candidates_json: string | null;
211
+ readonly prompt_length_chars: number;
212
+ readonly estimated_input_tokens: number | null;
213
+ readonly message_count: number;
214
+ readonly has_tool_context: boolean;
215
+ readonly compaction_flag: boolean;
216
+ readonly triage_verdict: string | null;
217
+ readonly triage_reason_code: string | null;
218
+ readonly triage_cyclomatic_score: number | null;
219
+ readonly triage_trivial_hits: number | null;
220
+ readonly triage_complex_hits: number | null;
221
+ readonly triage_sanitized_length_delta: number | null;
222
+ readonly requirement_reasoning: number | null;
223
+ readonly requirement_code_gen: number | null;
224
+ readonly requirement_tool_use: number | null;
225
+ readonly routing_latency_ms: number;
226
+ readonly estimated_cost_usd: number | null;
227
+ /** HMAC-SHA256 fingerprint for dedup when SMART_ROUTER_DATASET_FINGERPRINT=1. */
228
+ readonly prompt_fingerprint: string | null;
229
+ readonly estimated_input_tokens_gate: number | null;
230
+ readonly context_fit_viable_count: number | null;
231
+ readonly context_fit_rejected_json: string | null;
232
+ readonly context_overflow_pin_break: boolean;
233
+ readonly selected_model_max_input_tokens: number | null;
234
+ readonly context_fit_reason_code: string | null;
235
+ readonly cluster_id: string | null;
236
+ readonly cluster_similarity: number | null;
237
+ readonly cluster_margin: number | null;
238
+ readonly low_intensity_score: number | null;
239
+ readonly tier_hint: Tier | null;
240
+ readonly p_success_cheap: number | null;
241
+ readonly local_eligible_reason: string | null;
242
+ readonly tier_selection_reason_code: string | null;
243
+ }
244
+ /** Behavioral outcome signal for policy learning (SP-062). No prompt text. */
245
+ export type OutcomeSignalType = 'model_override' | 'compaction_pin_break' | 'feedback_good' | 'feedback_bad';
246
+ /**
247
+ * Privacy-safe routing outcome label keyed by request_id.
248
+ * Links to a dataset record; never stores prompt text or messages.
249
+ */
250
+ export interface RoutingOutcomeRecord {
251
+ readonly request_id: string;
252
+ readonly session_id: string;
253
+ readonly timestamp: string;
254
+ readonly signal_type: OutcomeSignalType;
255
+ /** Model selected by the router for the linked request. */
256
+ readonly routed_model_id: string | null;
257
+ /** User-chosen model after override; only for model_override. */
258
+ readonly override_model_id: string | null;
259
+ }
260
+ /** Stable cluster identifier used as reason-code suffix (`cluster_${id}`). */
261
+ export type RoutingClusterId = 'low_stakes_general' | 'mechanical_edit' | 'deep_debug' | 'architecture' | (string & {});
262
+ /** Reference-prompt cluster definition from routing-clusters.yaml. */
263
+ export interface RoutingCluster {
264
+ readonly id: RoutingClusterId;
265
+ readonly tier_bias: Tier;
266
+ readonly reference_prompts: readonly string[];
267
+ readonly min_similarity: number;
268
+ readonly min_margin: number;
269
+ }
270
+ /** Cluster with precomputed centroid embedding (mean of reference prompts). */
271
+ export interface LoadedRoutingCluster extends RoutingCluster {
272
+ readonly centroid: Float32Array;
273
+ }
274
+ export interface RoutingClusterCatalog {
275
+ readonly clusters: readonly LoadedRoutingCluster[];
276
+ }
277
+ export interface RoutingTelemetry {
278
+ readonly timestamp: string;
279
+ readonly session_id: string;
280
+ readonly request_id: string;
281
+ readonly turn_type: string;
282
+ readonly stage: string;
283
+ readonly reason_code: string;
284
+ readonly selected_model_id: string;
285
+ readonly estimated_cost_usd: number;
286
+ readonly routing_latency_ms: number;
287
+ readonly pin_reason: string | null;
288
+ readonly estimated_input_tokens: number | null;
289
+ readonly context_fit_viable_count: number | null;
290
+ readonly context_fit_rejected_json: string | null;
291
+ readonly context_overflow_pin_break: boolean;
292
+ readonly selected_model_max_input_tokens: number | null;
293
+ readonly context_fit_reason_code: string | null;
294
+ readonly cluster_id: string | null;
295
+ readonly cluster_similarity: number | null;
296
+ readonly cluster_margin: number | null;
297
+ readonly low_intensity_score: number | null;
298
+ readonly tier_hint: Tier | null;
299
+ readonly p_success_cheap: number | null;
300
+ readonly local_eligible_reason: string | null;
301
+ readonly tier_selection_reason_code: string | null;
302
+ }
303
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/domain/types/entities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,aAAa,GACb,UAAU,GACV,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB,MAAM,MAAM,IAAI,GAAG,WAAW,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAEvE,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,eAAe,GACf,aAAa,GACb,YAAY,GACZ,aAAa,GACb,UAAU,CAAC;AAEf,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,eAAe,CAAC;AAIpE,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC3C;AAID,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,C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ACvC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;CACpD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Domain entity types for the pi-smart-router routing pipeline.
3
+ * Derived from specs/001-build-smart-router/data-model.md
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/domain/types/entities.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,4 @@
1
+ export type { CandidateScore, ClusterMatchTableEntry, ContextFitObservability, ContextFitRejectedEntry, LoadedRoutingCluster, LowIntensityBreakdown, Message, ModelCapabilities, ModelLimits, ModelPerformance, ModelPricing, ModelProfile, PriceCatalog, RejectedTierEntry, RequirementVector, RoutingCluster, RoutingClusterCatalog, RoutingClusterId, RoutingDatasetRecord, RoutingDecision, RoutingFeatureSidecar, RoutingOutcomeRecord, RoutingRequest, RoutingTelemetry, SessionPin, TierFeatureSummary, TierSelectionObservability, TriageFeatureSummary, } from './entities.js';
2
+ export type { PinReason, PriceSource, OutcomeSignalType, RoutingStage, Tier, TurnType, } from './entities.js';
3
+ export type { StorePort } from './store-port.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACJ,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/types/index.ts"],"names":[],"mappings":""}