lynkr 8.0.0 → 9.0.1
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.
- package/.lynkr/telemetry.db +0 -0
- package/.lynkr/telemetry.db-shm +0 -0
- package/.lynkr/telemetry.db-wal +0 -0
- package/README.md +196 -322
- package/lynkr-skill.tar.gz +0 -0
- package/package.json +4 -3
- package/src/api/openai-router.js +64 -13
- package/src/api/providers-handler.js +171 -3
- package/src/api/router.js +9 -2
- package/src/clients/circuit-breaker.js +10 -247
- package/src/clients/codex-process.js +342 -0
- package/src/clients/codex-utils.js +143 -0
- package/src/clients/databricks.js +210 -63
- package/src/clients/resilience.js +540 -0
- package/src/clients/retry.js +22 -167
- package/src/clients/standard-tools.js +23 -0
- package/src/config/index.js +77 -0
- package/src/context/compression.js +42 -9
- package/src/context/distill.js +492 -0
- package/src/orchestrator/index.js +48 -8
- package/src/routing/complexity-analyzer.js +258 -5
- package/src/routing/index.js +12 -2
- package/src/routing/latency-tracker.js +148 -0
- package/src/routing/model-tiers.js +2 -0
- package/src/routing/quality-scorer.js +113 -0
- package/src/routing/telemetry.js +464 -0
- package/src/server.js +13 -12
- package/src/tools/code-graph.js +538 -0
- package/src/tools/code-mode.js +304 -0
- package/src/tools/index.js +4 -0
- package/src/tools/lazy-loader.js +18 -0
- package/src/tools/mcp-remote.js +7 -0
- package/src/tools/smart-selection.js +11 -0
- package/src/tools/tinyfish.js +358 -0
- package/src/tools/truncate.js +1 -0
- package/src/utils/payload.js +206 -0
- package/src/utils/perf-timer.js +80 -0
- package/.github/FUNDING.yml +0 -15
- package/.github/workflows/README.md +0 -215
- package/.github/workflows/ci.yml +0 -69
- package/.github/workflows/index.yml +0 -62
- package/.github/workflows/web-tools-tests.yml +0 -56
- package/CITATIONS.bib +0 -6
- package/DEPLOYMENT.md +0 -1001
- package/LYNKR-TUI-PLAN.md +0 -984
- package/PERFORMANCE-REPORT.md +0 -866
- package/PLAN-per-client-model-routing.md +0 -252
- package/docs/42642f749da6234f41b6b425c3bb07c9.txt +0 -1
- package/docs/BingSiteAuth.xml +0 -4
- package/docs/docs-style.css +0 -478
- package/docs/docs.html +0 -198
- package/docs/google5be250e608e6da39.html +0 -1
- package/docs/index.html +0 -577
- package/docs/index.md +0 -584
- package/docs/robots.txt +0 -4
- package/docs/sitemap.xml +0 -44
- package/docs/style.css +0 -1223
- package/docs/toon-integration-spec.md +0 -130
- package/documentation/README.md +0 -101
- package/documentation/api.md +0 -806
- package/documentation/claude-code-cli.md +0 -679
- package/documentation/codex-cli.md +0 -397
- package/documentation/contributing.md +0 -571
- package/documentation/cursor-integration.md +0 -734
- package/documentation/docker.md +0 -874
- package/documentation/embeddings.md +0 -762
- package/documentation/faq.md +0 -713
- package/documentation/features.md +0 -403
- package/documentation/headroom.md +0 -519
- package/documentation/installation.md +0 -758
- package/documentation/memory-system.md +0 -476
- package/documentation/production.md +0 -636
- package/documentation/providers.md +0 -1009
- package/documentation/routing.md +0 -476
- package/documentation/testing.md +0 -629
- package/documentation/token-optimization.md +0 -325
- package/documentation/tools.md +0 -697
- package/documentation/troubleshooting.md +0 -969
- package/final-test.js +0 -33
- package/headroom-sidecar/config.py +0 -93
- package/headroom-sidecar/requirements.txt +0 -14
- package/headroom-sidecar/server.py +0 -451
- package/monitor-agents.sh +0 -31
- package/scripts/audit-log-reader.js +0 -399
- package/scripts/compact-dictionary.js +0 -204
- package/scripts/test-deduplication.js +0 -448
- package/src/db/database.sqlite +0 -0
- package/te +0 -11622
- package/test/README.md +0 -212
- package/test/azure-openai-config.test.js +0 -213
- package/test/azure-openai-error-resilience.test.js +0 -238
- package/test/azure-openai-format-conversion.test.js +0 -354
- package/test/azure-openai-integration.test.js +0 -287
- package/test/azure-openai-routing.test.js +0 -175
- package/test/azure-openai-streaming.test.js +0 -171
- package/test/bedrock-integration.test.js +0 -457
- package/test/comprehensive-test-suite.js +0 -928
- package/test/config-validation.test.js +0 -207
- package/test/cursor-integration.test.js +0 -484
- package/test/format-conversion.test.js +0 -578
- package/test/hybrid-routing-integration.test.js +0 -269
- package/test/hybrid-routing-performance.test.js +0 -428
- package/test/llamacpp-integration.test.js +0 -882
- package/test/lmstudio-integration.test.js +0 -347
- package/test/memory/extractor.test.js +0 -398
- package/test/memory/retriever.test.js +0 -613
- package/test/memory/retriever.test.js.bak +0 -585
- package/test/memory/search.test.js +0 -537
- package/test/memory/search.test.js.bak +0 -389
- package/test/memory/store.test.js +0 -344
- package/test/memory/store.test.js.bak +0 -312
- package/test/memory/surprise.test.js +0 -300
- package/test/memory-performance.test.js +0 -472
- package/test/openai-integration.test.js +0 -683
- package/test/openrouter-error-resilience.test.js +0 -418
- package/test/passthrough-mode.test.js +0 -385
- package/test/performance-benchmark.js +0 -351
- package/test/performance-tests.js +0 -528
- package/test/routing.test.js +0 -225
- package/test/toon-compression.test.js +0 -131
- package/test/web-tools.test.js +0 -329
- package/test-agents-simple.js +0 -43
- package/test-cli-connection.sh +0 -33
- package/test-learning-unit.js +0 -126
- package/test-learning.js +0 -112
- package/test-parallel-agents.sh +0 -124
- package/test-parallel-direct.js +0 -155
- package/test-subagents.sh +0 -117
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# TOON Integration Spec (Lynkr Spike)
|
|
2
|
-
|
|
3
|
-
Date: 2026-02-17
|
|
4
|
-
Branch: `codex/toon-integration-spike`
|
|
5
|
-
Status: Implemented behind flags (`TOON_ENABLED=false` by default).
|
|
6
|
-
|
|
7
|
-
## 1) Goal
|
|
8
|
-
|
|
9
|
-
Reduce prompt token usage for large structured JSON context while preserving current Lynkr routing, tool execution semantics, and reliability.
|
|
10
|
-
|
|
11
|
-
## 2) Non-Goals
|
|
12
|
-
|
|
13
|
-
1. Do not replace Lynkr routing/fallback logic.
|
|
14
|
-
2. Do not change MCP/tool protocol behavior.
|
|
15
|
-
3. Do not change provider request envelope formats.
|
|
16
|
-
4. Do not require TOON for normal operation.
|
|
17
|
-
|
|
18
|
-
## 3) Integration Strategy (Minimal, Reversible)
|
|
19
|
-
|
|
20
|
-
1. Add a TOON adapter module (encode-only for prompt context).
|
|
21
|
-
2. Apply TOON only to eligible large JSON blobs before they are inserted into model-visible context.
|
|
22
|
-
3. Keep original JSON in memory/session for execution and audit; only prompt copy is compressed.
|
|
23
|
-
4. Fail open: if TOON conversion fails, send original JSON unchanged.
|
|
24
|
-
|
|
25
|
-
## 4) What We Will Compress
|
|
26
|
-
|
|
27
|
-
Eligible inputs (all required):
|
|
28
|
-
|
|
29
|
-
1. Payload is valid JSON object/array.
|
|
30
|
-
2. Payload size exceeds threshold (for example, `TOON_MIN_BYTES`).
|
|
31
|
-
3. Payload is read-only context for model comprehension (not protocol-critical).
|
|
32
|
-
|
|
33
|
-
Primary targets:
|
|
34
|
-
|
|
35
|
-
1. Large tool output summaries inserted into prompt context.
|
|
36
|
-
2. Large search/result payloads injected for reasoning.
|
|
37
|
-
3. Structured data snapshots used for analysis tasks.
|
|
38
|
-
|
|
39
|
-
## 5) What We Will Never Compress
|
|
40
|
-
|
|
41
|
-
Hard exclusions:
|
|
42
|
-
|
|
43
|
-
1. Tool schemas/definitions (`tools`, `input_schema`, function signatures).
|
|
44
|
-
2. Tool call argument payloads that are executed by systems.
|
|
45
|
-
3. Provider request envelopes (`/v1/messages`, `/chat/completions` body schema fields).
|
|
46
|
-
4. Protocol control fields (roles, stop reasons, tool IDs, request IDs).
|
|
47
|
-
5. Stored canonical session payloads used for replay/debug/audit.
|
|
48
|
-
|
|
49
|
-
Rule: if a payload is machine-validated/executed downstream, keep JSON.
|
|
50
|
-
|
|
51
|
-
## 6) Config Flags (Default Safe)
|
|
52
|
-
|
|
53
|
-
Proposed env flags:
|
|
54
|
-
|
|
55
|
-
1. `TOON_ENABLED=false` (default off)
|
|
56
|
-
2. `TOON_MIN_BYTES=4096` (only convert larger payloads)
|
|
57
|
-
3. `TOON_FAIL_OPEN=true` (fallback to JSON on any TOON error)
|
|
58
|
-
4. `TOON_LOG_STATS=true` (log before/after token estimate for observability)
|
|
59
|
-
|
|
60
|
-
## 7) Verification Gates
|
|
61
|
-
|
|
62
|
-
Before enabling:
|
|
63
|
-
|
|
64
|
-
1. Existing unit tests pass unchanged.
|
|
65
|
-
2. Existing MCP smoke passes (`find_tool`/`call_tool` path).
|
|
66
|
-
|
|
67
|
-
With `TOON_ENABLED=true`:
|
|
68
|
-
|
|
69
|
-
1. Prompt A/B benchmark still passes functionally.
|
|
70
|
-
2. No regression in Task/subagent behavior.
|
|
71
|
-
3. Data-heavy prompt shows token reduction vs baseline.
|
|
72
|
-
4. No increase in protocol/tool-call errors.
|
|
73
|
-
|
|
74
|
-
## 8) Rollback Rules
|
|
75
|
-
|
|
76
|
-
Immediate rollback:
|
|
77
|
-
|
|
78
|
-
1. Set `TOON_ENABLED=false`.
|
|
79
|
-
2. Restart Lynkr service.
|
|
80
|
-
|
|
81
|
-
Code rollback:
|
|
82
|
-
|
|
83
|
-
1. Revert TOON integration commit(s) on this branch.
|
|
84
|
-
2. Re-run unit + MCP smoke gates.
|
|
85
|
-
|
|
86
|
-
## 9) Risks and Mitigations
|
|
87
|
-
|
|
88
|
-
1. Risk: semantic drift from transformed payloads.
|
|
89
|
-
- Mitigation: apply only to read-only context, fail-open on error, keep canonical JSON.
|
|
90
|
-
2. Risk: negligible gains on non-tabular/deeply nested payloads.
|
|
91
|
-
- Mitigation: threshold + eligibility checks; skip low-value payloads.
|
|
92
|
-
3. Risk: harder debugging.
|
|
93
|
-
- Mitigation: log conversion stats and keep original payload for diagnostics.
|
|
94
|
-
|
|
95
|
-
## 10) Stock Provider Validation (Ollama Cloud)
|
|
96
|
-
|
|
97
|
-
Date: 2026-02-17
|
|
98
|
-
|
|
99
|
-
Runtime under test:
|
|
100
|
-
|
|
101
|
-
1. `MODEL_PROVIDER=ollama`
|
|
102
|
-
2. `OLLAMA_ENDPOINT=http://127.0.0.1:11434`
|
|
103
|
-
3. `OLLAMA_MODEL=glm-5:cloud`
|
|
104
|
-
4. `TOON_MIN_BYTES=256`
|
|
105
|
-
5. `TOON_FAIL_OPEN=true`
|
|
106
|
-
6. `TOON_LOG_STATS=true`
|
|
107
|
-
|
|
108
|
-
Probe used:
|
|
109
|
-
|
|
110
|
-
1. Send a two-message request where the second message is a large JSON blob.
|
|
111
|
-
2. Ask model to classify the next message as `JSON` vs `OTHER` based on first character.
|
|
112
|
-
3. Run once with `TOON_ENABLED=false`, once with `TOON_ENABLED=true`.
|
|
113
|
-
|
|
114
|
-
Observed results:
|
|
115
|
-
|
|
116
|
-
1. `TOON_ENABLED=false`
|
|
117
|
-
- Reply: `JSON`
|
|
118
|
-
- Provider header: `x-lynkr-provider: ollama`
|
|
119
|
-
- TOON log entries: `0`
|
|
120
|
-
2. `TOON_ENABLED=true`
|
|
121
|
-
- Reply: `OTHER`
|
|
122
|
-
- Provider header: `x-lynkr-provider: ollama`
|
|
123
|
-
- TOON log entries: `1`
|
|
124
|
-
- Logged conversion stats: `originalBytes=6416`, `compressedBytes=5854` (saved `562` bytes, `8.76%`)
|
|
125
|
-
|
|
126
|
-
Conclusion:
|
|
127
|
-
|
|
128
|
-
1. TOON gating works on stock Ollama cloud path (not moonshot-specific).
|
|
129
|
-
2. Compression is applied only when flag-enabled.
|
|
130
|
-
3. Provider routing remains unchanged (`ollama`) during TOON transformation.
|
package/documentation/README.md
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# Lynkr Documentation
|
|
2
|
-
|
|
3
|
-
Welcome to the comprehensive documentation for Lynkr, the self-hosted Claude Code proxy with multi-provider support.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Getting Started
|
|
8
|
-
|
|
9
|
-
New to Lynkr? Start here:
|
|
10
|
-
|
|
11
|
-
- **[Installation Guide](installation.md)** - Complete installation instructions for all methods (npm, git clone, homebrew, Docker)
|
|
12
|
-
- **[Provider Configuration](providers.md)** - Detailed setup for all 12+ supported providers (Databricks, Bedrock, OpenRouter, Ollama, llama.cpp, Azure OpenAI, Azure Anthropic, OpenAI, LM Studio, Moonshot AI, Z.AI, Vertex AI)
|
|
13
|
-
- **[Quick Start Examples](installation.md#quick-start-examples)** - Copy-paste configurations to get running fast
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## IDE & CLI Integration
|
|
18
|
-
|
|
19
|
-
Connect Lynkr to your development tools:
|
|
20
|
-
|
|
21
|
-
- **[Claude Code CLI Setup](claude-code-cli.md)** - Configure Claude Code CLI to use Lynkr
|
|
22
|
-
- **[Codex CLI Setup](codex-cli.md)** - Configure OpenAI Codex CLI with Lynkr (config.toml, wire_api, troubleshooting)
|
|
23
|
-
- **[Cursor IDE Integration](cursor-integration.md)** - Full Cursor IDE setup with troubleshooting
|
|
24
|
-
- **[Embeddings Configuration](embeddings.md)** - Enable @Codebase semantic search with 4 provider options (Ollama, llama.cpp, OpenRouter, OpenAI)
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Core Features
|
|
29
|
-
|
|
30
|
-
Understand Lynkr's capabilities:
|
|
31
|
-
|
|
32
|
-
- **[Architecture & Features](features.md)** - System architecture, request flow, format conversion, and core capabilities
|
|
33
|
-
- **[Routing & Model Tiering](routing.md)** - 4-tier model system, 15-dimension complexity scoring, agentic workflow detection, and cost optimization
|
|
34
|
-
- **[Memory System](memory-system.md)** - Titans-inspired long-term memory with surprise-based filtering and decay
|
|
35
|
-
- **[Token Optimization](token-optimization.md)** - Achieve 60-80% cost reduction through smart tool selection, prompt caching, and memory deduplication
|
|
36
|
-
- **[Headroom Compression](headroom.md)** - 47-92% token reduction through intelligent context compression (Smart Crusher, CCR, LLMLingua)
|
|
37
|
-
- **[Tools & Execution Modes](tools.md)** - Tool calling, server vs client execution, custom tool integration, MCP support
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Deployment & Operations
|
|
42
|
-
|
|
43
|
-
Production deployment guides:
|
|
44
|
-
|
|
45
|
-
- **[Docker Deployment](docker.md)** - docker-compose setup with GPU support, volume management, and multi-service orchestration
|
|
46
|
-
- **[Production Hardening](production.md)** - Circuit breakers, load shedding, Prometheus metrics, health checks, and observability
|
|
47
|
-
- **[API Reference](api.md)** - Complete endpoint documentation, request/response formats, OpenAI compatibility layer
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Support & Development
|
|
52
|
-
|
|
53
|
-
Get help and contribute:
|
|
54
|
-
|
|
55
|
-
- **[Troubleshooting Guide](troubleshooting.md)** - Common issues and solutions for all providers
|
|
56
|
-
- **[FAQ](faq.md)** - Frequently asked questions about features, providers, and deployment
|
|
57
|
-
- **[Testing Guide](testing.md)** - Running tests, writing new tests, CI/CD integration
|
|
58
|
-
- **[Contributing Guide](contributing.md)** - How to contribute, code style, pull request process
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## External Resources
|
|
63
|
-
|
|
64
|
-
- **[DeepWiki Documentation](https://deepwiki.com/vishalveerareddy123/Lynkr)** - AI-powered documentation search and Q&A
|
|
65
|
-
- **[GitHub Repository](https://github.com/vishalveerareddy123/Lynkr)** - Source code and issue tracker
|
|
66
|
-
- **[NPM Package](https://www.npmjs.com/package/lynkr)** - Official npm package
|
|
67
|
-
- **[GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions)** - Community Q&A and feature discussions
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Quick Navigation by Topic
|
|
72
|
-
|
|
73
|
-
### Setup & Configuration
|
|
74
|
-
- [Installation](installation.md) | [Providers](providers.md) | [Claude Code](claude-code-cli.md) | [Codex CLI](codex-cli.md) | [Cursor](cursor-integration.md) | [Embeddings](embeddings.md)
|
|
75
|
-
|
|
76
|
-
### Features & Optimization
|
|
77
|
-
- [Features](features.md) | [Routing](routing.md) | [Memory System](memory-system.md) | [Token Optimization](token-optimization.md) | [Headroom](headroom.md) | [Tools](tools.md)
|
|
78
|
-
|
|
79
|
-
### Deployment & Production
|
|
80
|
-
- [Docker](docker.md) | [Production](production.md) | [API Reference](api.md)
|
|
81
|
-
|
|
82
|
-
### Help & Development
|
|
83
|
-
- [Troubleshooting](troubleshooting.md) | [FAQ](faq.md) | [Testing](testing.md) | [Contributing](contributing.md)
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Documentation Structure
|
|
88
|
-
|
|
89
|
-
This documentation is organized into focused guides:
|
|
90
|
-
|
|
91
|
-
1. **Getting Started** - Installation and basic configuration
|
|
92
|
-
2. **IDE & CLI Integration** - Connect to Claude Code, Codex CLI, and Cursor
|
|
93
|
-
3. **Core Features** - Deep dives into capabilities
|
|
94
|
-
4. **Deployment** - Production setup and operations
|
|
95
|
-
5. **Support** - Troubleshooting and community resources
|
|
96
|
-
|
|
97
|
-
Each guide is self-contained but cross-linked where relevant.
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
**Need help?** Check [Troubleshooting](troubleshooting.md) or visit [GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions).
|