lynkr 9.7.2 → 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 (80) 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/agents/context-manager.js +18 -2
  15. package/src/agents/definitions/loader.js +90 -0
  16. package/src/agents/executor.js +24 -2
  17. package/src/agents/index.js +9 -1
  18. package/src/agents/parallel-coordinator.js +2 -2
  19. package/src/agents/reflector.js +11 -1
  20. package/src/api/middleware/loop-guard.js +87 -0
  21. package/src/api/middleware/request-logging.js +5 -64
  22. package/src/api/middleware/session.js +0 -0
  23. package/src/api/openai-router.js +120 -101
  24. package/src/api/providers-handler.js +27 -2
  25. package/src/api/router.js +450 -125
  26. package/src/budget/index.js +2 -19
  27. package/src/cache/semantic.js +9 -0
  28. package/src/clients/databricks.js +459 -146
  29. package/src/clients/gpt-utils.js +11 -105
  30. package/src/clients/openai-format.js +10 -3
  31. package/src/clients/openrouter-utils.js +49 -24
  32. package/src/clients/prompt-cache-injection.js +1 -0
  33. package/src/clients/provider-capabilities.js +1 -1
  34. package/src/clients/responses-format.js +34 -3
  35. package/src/clients/routing.js +15 -0
  36. package/src/config/index.js +36 -2
  37. package/src/context/gcf.js +275 -0
  38. package/src/context/tool-result-compressor.js +51 -9
  39. package/src/dashboard/api.js +1 -0
  40. package/src/logger/index.js +14 -1
  41. package/src/memory/search.js +12 -40
  42. package/src/memory/tools.js +3 -24
  43. package/src/orchestrator/bypass.js +4 -2
  44. package/src/orchestrator/index.js +144 -88
  45. package/src/routing/affinity-store.js +194 -0
  46. package/src/routing/agentic-detector.js +36 -6
  47. package/src/routing/bandit.js +25 -6
  48. package/src/routing/calibration.js +212 -0
  49. package/src/routing/client-profiles.js +292 -0
  50. package/src/routing/complexity-analyzer.js +48 -11
  51. package/src/routing/deescalator.js +148 -0
  52. package/src/routing/degradation.js +109 -0
  53. package/src/routing/feedback.js +157 -0
  54. package/src/routing/index.js +897 -87
  55. package/src/routing/intent-score.js +339 -0
  56. package/src/routing/interaction.js +3 -0
  57. package/src/routing/knn-router.js +70 -21
  58. package/src/routing/model-registry.js +28 -7
  59. package/src/routing/model-tiers.js +25 -2
  60. package/src/routing/reward-pipeline.js +68 -2
  61. package/src/routing/risk-analyzer.js +30 -1
  62. package/src/routing/risk-classifier.js +6 -2
  63. package/src/routing/session-affinity.js +162 -34
  64. package/src/routing/telemetry.js +298 -10
  65. package/src/routing/verifier.js +267 -0
  66. package/src/server.js +66 -21
  67. package/src/sessions/cleanup.js +17 -0
  68. package/src/tools/index.js +1 -15
  69. package/src/tools/smart-selection.js +10 -0
  70. package/src/tools/web-client.js +3 -3
  71. package/.eslintrc.cjs +0 -12
  72. package/benchmark-configs/litellm_config.yaml +0 -86
  73. package/benchmark-configs/lynkr.env +0 -48
  74. package/benchmark-configs/portkey-config.json +0 -60
  75. package/benchmark-configs/portkey-docker.sh +0 -23
  76. package/benchmark-tier-routing.js +0 -449
  77. package/funding.json +0 -110
  78. package/src/api/middleware/validation.js +0 -261
  79. package/src/routing/drift-monitor.js +0 -113
  80. 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) {