lynkr 9.7.3 → 9.9.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 (74) hide show
  1. package/README.md +29 -19
  2. package/bin/cli.js +11 -0
  3. package/bin/lynkr-init.js +14 -1
  4. package/bin/lynkr-usage.js +78 -0
  5. package/bin/wrap.js +60 -35
  6. package/config/difficulty-anchors.json +22 -0
  7. package/package.json +24 -3
  8. package/scripts/audit-log-reader.js +399 -0
  9. package/scripts/calibrate-thresholds.js +38 -157
  10. package/scripts/compact-dictionary.js +204 -0
  11. package/scripts/test-deduplication.js +448 -0
  12. package/scripts/ws7-anchor-replay.js +108 -0
  13. package/skills/lynkr/SKILL.md +195 -0
  14. package/src/api/middleware/loop-guard.js +87 -0
  15. package/src/api/middleware/request-logging.js +5 -64
  16. package/src/api/middleware/session.js +0 -0
  17. package/src/api/openai-router.js +120 -101
  18. package/src/api/providers-handler.js +27 -2
  19. package/src/api/router.js +450 -125
  20. package/src/budget/index.js +2 -19
  21. package/src/cache/semantic.js +9 -0
  22. package/src/clients/databricks.js +455 -142
  23. package/src/clients/gpt-utils.js +11 -105
  24. package/src/clients/openai-format.js +10 -3
  25. package/src/clients/openrouter-utils.js +49 -24
  26. package/src/clients/prompt-cache-injection.js +1 -0
  27. package/src/clients/provider-capabilities.js +1 -1
  28. package/src/clients/responses-format.js +34 -3
  29. package/src/clients/routing.js +15 -0
  30. package/src/config/index.js +36 -2
  31. package/src/context/gcf.js +275 -0
  32. package/src/context/tool-result-compressor.js +51 -9
  33. package/src/dashboard/api.js +1 -0
  34. package/src/logger/index.js +14 -1
  35. package/src/memory/search.js +12 -40
  36. package/src/memory/tools.js +3 -24
  37. package/src/orchestrator/bypass.js +4 -2
  38. package/src/orchestrator/index.js +120 -85
  39. package/src/routing/affinity-store.js +194 -0
  40. package/src/routing/agentic-detector.js +36 -6
  41. package/src/routing/bandit.js +25 -6
  42. package/src/routing/calibration.js +212 -0
  43. package/src/routing/client-profiles.js +292 -0
  44. package/src/routing/complexity-analyzer.js +48 -11
  45. package/src/routing/deescalator.js +148 -0
  46. package/src/routing/degradation.js +109 -0
  47. package/src/routing/feedback.js +157 -0
  48. package/src/routing/index.js +897 -87
  49. package/src/routing/intent-score.js +339 -0
  50. package/src/routing/interaction.js +3 -0
  51. package/src/routing/knn-router.js +70 -21
  52. package/src/routing/model-registry.js +28 -7
  53. package/src/routing/model-tiers.js +25 -2
  54. package/src/routing/reward-pipeline.js +68 -2
  55. package/src/routing/risk-analyzer.js +30 -1
  56. package/src/routing/risk-classifier.js +6 -2
  57. package/src/routing/session-affinity.js +162 -34
  58. package/src/routing/telemetry.js +286 -13
  59. package/src/routing/verifier.js +267 -0
  60. package/src/server.js +66 -21
  61. package/src/sessions/cleanup.js +17 -0
  62. package/src/tools/index.js +1 -15
  63. package/src/tools/smart-selection.js +10 -0
  64. package/src/tools/web-client.js +3 -3
  65. package/.eslintrc.cjs +0 -12
  66. package/benchmark-configs/litellm_config.yaml +0 -86
  67. package/benchmark-configs/lynkr.env +0 -48
  68. package/benchmark-configs/portkey-config.json +0 -60
  69. package/benchmark-configs/portkey-docker.sh +0 -23
  70. package/benchmark-tier-routing.js +0 -449
  71. package/funding.json +0 -110
  72. package/src/api/middleware/validation.js +0 -261
  73. package/src/routing/drift-monitor.js +0 -113
  74. package/src/workers/helpers.js +0 -185
@@ -124,6 +124,23 @@ function getConfiguredProviders() {
124
124
  });
125
125
  }
126
126
 
127
+ // Check Eden AI (OpenAI-compatible gateway, EU/GDPR)
128
+ if (config.edenai?.apiKey) {
129
+ providers.push({
130
+ name: "edenai",
131
+ type: "edenai",
132
+ baseUrl: "https://api.edenai.run/v3",
133
+ enabled: true,
134
+ models: [
135
+ { id: config.edenai.model || "openai/gpt-4o-mini", name: "Configured Model" },
136
+ { id: "anthropic/claude-sonnet-4-5", name: "Claude Sonnet 4.5" },
137
+ { id: "openai/gpt-4o", name: "GPT-4o" },
138
+ { id: "openai/gpt-4o-mini", name: "GPT-4o Mini" },
139
+ { id: "google/gemini-2.5-flash", name: "Gemini 2.5 Flash" }
140
+ ]
141
+ });
142
+ }
143
+
127
144
  // Check Ollama
128
145
  if (config.ollama?.endpoint) {
129
146
  providers.push({
@@ -496,8 +513,16 @@ router.get("/routing/stats", (req, res) => {
496
513
  const until = req.query.until ? Number(req.query.until) : undefined;
497
514
  const stats = telemetry.getStats({ since, until });
498
515
 
516
+ // Degradation counts are always available (in-memory), even when there's
517
+ // zero telemetry data yet — surface them regardless of the stats branch.
518
+ const degradation = require("../routing/degradation").getCounts();
519
+
499
520
  if (!stats) {
500
- return res.json({ object: "routing_stats", data: null, message: "No telemetry data available" });
521
+ return res.json({
522
+ object: "routing_stats",
523
+ data: { degradation },
524
+ message: "No telemetry data available",
525
+ });
501
526
  }
502
527
 
503
528
  // Merge latency tracker percentiles
@@ -509,7 +534,7 @@ router.get("/routing/stats", (req, res) => {
509
534
 
510
535
  res.json({
511
536
  object: "routing_stats",
512
- data: { ...stats, latencyPercentiles: latencyStats },
537
+ data: { ...stats, latencyPercentiles: latencyStats, degradation },
513
538
  timestamp: new Date().toISOString(),
514
539
  });
515
540
  } catch (error) {