@younndai/lyt-llm 0.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.
- package/LICENSE +200 -0
- package/NOTICE +23 -0
- package/README.md +104 -0
- package/dist/adapters/ai-relay.d.ts +34 -0
- package/dist/adapters/ai-relay.d.ts.map +1 -0
- package/dist/adapters/ai-relay.js +63 -0
- package/dist/adapters/ai-relay.js.map +1 -0
- package/dist/adapters/byok.d.ts +33 -0
- package/dist/adapters/byok.d.ts.map +1 -0
- package/dist/adapters/byok.js +67 -0
- package/dist/adapters/byok.js.map +1 -0
- package/dist/adapters/harness.d.ts +19 -0
- package/dist/adapters/harness.d.ts.map +1 -0
- package/dist/adapters/harness.js +56 -0
- package/dist/adapters/harness.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +24 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/ollama.d.ts +28 -0
- package/dist/adapters/ollama.d.ts.map +1 -0
- package/dist/adapters/ollama.js +148 -0
- package/dist/adapters/ollama.js.map +1 -0
- package/dist/cost-budget.d.ts +11 -0
- package/dist/cost-budget.d.ts.map +1 -0
- package/dist/cost-budget.js +71 -0
- package/dist/cost-budget.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/routing.d.ts +12 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/routing.js +149 -0
- package/dist/routing.js.map +1 -0
- package/dist/types.d.ts +93 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +63 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may accept and charge a
|
|
167
|
+
fee for, or grant additional liability obligations and/or rights
|
|
168
|
+
consistent with this License. However, in accepting such obligations,
|
|
169
|
+
You may act only on Your own behalf and on Your sole responsibility,
|
|
170
|
+
not on behalf of any other Contributor, and only if You agree to
|
|
171
|
+
indemnify, defend, and hold each Contributor harmless for any
|
|
172
|
+
liability incurred by, or claims asserted against, such Contributor
|
|
173
|
+
by reason of your accepting any such warranty or additional liability.
|
|
174
|
+
|
|
175
|
+
END OF TERMS AND CONDITIONS
|
|
176
|
+
|
|
177
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
178
|
+
|
|
179
|
+
To apply the Apache License to your work, attach the following
|
|
180
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
181
|
+
replaced with your own identifying information. (Don't include
|
|
182
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
183
|
+
comment syntax for the file format. We also recommend that a
|
|
184
|
+
file or class name and description of purpose be included on the
|
|
185
|
+
same "printed page" as the copyright notice for easier
|
|
186
|
+
identification within third-party archives.
|
|
187
|
+
|
|
188
|
+
Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@younndai/lyt-llm
|
|
2
|
+
Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
+
|
|
4
|
+
This product includes software developed by MARLINK TRADING SRL (YounndAI)
|
|
5
|
+
(https://younndai.com).
|
|
6
|
+
|
|
7
|
+
Created by: Alexandru Mareș (https://allemaar.com)
|
|
8
|
+
|
|
9
|
+
Licensed under the Apache License, Version 2.0. See LICENSE.
|
|
10
|
+
|
|
11
|
+
----------------------------------------------------------------------
|
|
12
|
+
Trademark notice
|
|
13
|
+
----------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
YounndAI™ and LYT™ are trademarks of MARLINK TRADING SRL.
|
|
16
|
+
|
|
17
|
+
The Apache License, Version 2.0 does not grant permission to use the
|
|
18
|
+
trade names, trademarks, service marks, or product names of
|
|
19
|
+
MARLINK TRADING SRL, except as required for describing the origin of
|
|
20
|
+
this work and reproducing the content of this NOTICE file.
|
|
21
|
+
|
|
22
|
+
See TRADEMARK.md for the trademark usage policy.
|
|
23
|
+
For trademark usage permissions, contact: office@younndai.com
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/YounndAI/lyt/main/assets/lyt-icon-ondark.png" />
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/YounndAI/lyt/main/assets/lyt-icon-onlight.png" />
|
|
5
|
+
<img alt="Lyt" src="https://raw.githubusercontent.com/YounndAI/lyt/main/assets/lyt-icon-onlight.png" width="80" />
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>@younndai/lyt-llm</strong><br />
|
|
11
|
+
The LLM gateway — multi-provider routing for AI-assisted vault operations, with hard cost budgets, on your terms.<br />
|
|
12
|
+
<em>Part of the Lyt™ toolchain — federated markdown vaults you own, made legible to AI.</em>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://linkyourthink.com">Website</a> · <a href="https://github.com/YounndAI/lyt">Repository</a> · <a href="./LICENSE">Apache 2.0</a> · <a href="https://github.com/YounndAI/lyt/blob/main/TRADEMARK.md">Trademark Policy</a> · <a href="https://github.com/YounndAI/lyt/blob/main/CONTRIBUTING.md">Contributing</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
[](https://www.npmjs.com/package/@younndai/lyt-llm)
|
|
20
|
+
[](./LICENSE)
|
|
21
|
+
[](https://github.com/YounndAI/lyt#status)
|
|
22
|
+
|
|
23
|
+
> ⚠️ **Public alpha — under active testing.** Lyt works and we use it daily, but surfaces change between releases and docs are still growing. Install only via the `alpha` dist-tag. Your vaults are plain markdown in plain git repos — your data is never locked in, and Lyt never phones home.
|
|
24
|
+
|
|
25
|
+
## What is this?
|
|
26
|
+
|
|
27
|
+
`@younndai/lyt-llm` is the **LLM gateway** of [Lyt™](https://github.com/YounndAI/lyt) — multi-source LLM routing for AI-assisted vault operations, designed around one principle: **you choose where intelligence runs.** Local model via Ollama, your own provider keys, your existing Claude Code / Codex subscription, or external providers through a relay — the gateway composes four adapters behind a single `createLlmGateway()` surface, and your knowledge only goes where you point it.
|
|
28
|
+
|
|
29
|
+
This keeps Lyt's **AI-first** posture honest on the model side too: automations that need an LLM step declare a *source preference*, not a hard-wired vendor, and a per-run **cost-budget hard-stop** guarantees a runaway automation can't burn through an API budget. No hidden defaults, no silent cloud calls — the gateway is configuration you can read.
|
|
30
|
+
|
|
31
|
+
You usually do not install this package directly — it is pulled in by [`@younndai/lyt`](https://www.npmjs.com/package/@younndai/lyt) and consumed by [`@younndai/lyt-runner`](https://www.npmjs.com/package/@younndai/lyt-runner).
|
|
32
|
+
|
|
33
|
+
## Install (standalone)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g @younndai/lyt-llm@alpha
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## The four adapters
|
|
40
|
+
|
|
41
|
+
| Adapter | Routes to | Use when |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| **harness** | Claude Code / Codex skill invocation | You already pay for an agent subscription — reuse it, no extra keys |
|
|
44
|
+
| **ollama** | OpenAI-compatible local HTTP at `localhost:11434` | Fully local inference — knowledge never leaves the machine |
|
|
45
|
+
| **byok** | Your own provider keys (Anthropic, OpenAI, …) | Direct provider access under your own account + billing |
|
|
46
|
+
| **ai-relay** | External providers via [`@younndai/ai-relay`](https://www.npmjs.com/package/@younndai/ai-relay) | Managed multi-provider routing |
|
|
47
|
+
|
|
48
|
+
Routing honours per-automator `source_preference` + `hard_constraints` — for example *"local only, never external"* is a declared, enforced constraint, not a hope.
|
|
49
|
+
|
|
50
|
+
## Cost control
|
|
51
|
+
|
|
52
|
+
- **Per-run hard-stop** — a run that exceeds its declared budget is stopped, not billed onward.
|
|
53
|
+
- **Monthly budget** — warn-level in v1.
|
|
54
|
+
|
|
55
|
+
## Programmatic use
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { createLlmGateway } from "@younndai/lyt-llm";
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The gateway registers `std:llm.generate@v1`, `std:llm.stream@v1`, `std:llm.generate_object@v1`, and `std:llm.embed@v1` ops with [`@younndai/lyt-runner`](https://www.npmjs.com/package/@younndai/lyt-runner), so YON automators can declare LLM steps like any other governed operation.
|
|
62
|
+
|
|
63
|
+
## The Lyt toolchain
|
|
64
|
+
|
|
65
|
+
| Package | Role |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| [`@younndai/lyt`](https://github.com/YounndAI/lyt/tree/main/packages/lyt) | The unified `lyt` CLI (meta package) |
|
|
68
|
+
| [`@younndai/lyt-vault`](https://github.com/YounndAI/lyt/tree/main/packages/lyt-vault) | The vault primitive |
|
|
69
|
+
| [`@younndai/lyt-mesh`](https://github.com/YounndAI/lyt/tree/main/packages/lyt-mesh) | The mesh layer — multi-vault operations |
|
|
70
|
+
| [`@younndai/lyt-skills`](https://github.com/YounndAI/lyt/tree/main/packages/lyt-skills) | Agent-harness skills (Claude Code, Codex, agents) |
|
|
71
|
+
| [`@younndai/lyt-mcp`](https://github.com/YounndAI/lyt/tree/main/packages/lyt-mcp) | The MCP server |
|
|
72
|
+
| [`@younndai/lyt-runner`](https://github.com/YounndAI/lyt/tree/main/packages/lyt-runner) | The YON automation runner |
|
|
73
|
+
| [`@younndai/lyt-llm`](https://github.com/YounndAI/lyt/tree/main/packages/lyt-llm) | **This package** — the LLM gateway |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## About YounndAI
|
|
78
|
+
|
|
79
|
+
**YounndAI™ — You and AI, unified.** (pronounced *"yoon-dye"*)
|
|
80
|
+
|
|
81
|
+
A philosophy of intelligence: building with intention, so humans and machines
|
|
82
|
+
think together without losing what makes either whole.
|
|
83
|
+
|
|
84
|
+
## License & Attribution
|
|
85
|
+
|
|
86
|
+
Apache-2.0. © 2026 MARLINK TRADING SRL (YounndAI). See [`LICENSE`](./LICENSE) and [`NOTICE`](./NOTICE).
|
|
87
|
+
|
|
88
|
+
"LYT", "Lyt", and "YounndAI" are trademarks of MARLINK TRADING SRL — see [`TRADEMARK.md`](https://github.com/YounndAI/lyt/blob/main/TRADEMARK.md).
|
|
89
|
+
|
|
90
|
+
Created by [Alexandru Mareș](https://allemaar.com).
|
|
91
|
+
|
|
92
|
+
Website: [linkyourthink.com](https://linkyourthink.com)
|
|
93
|
+
|
|
94
|
+
<p align="center"><em>Structure before scale. Harmony above all.</em></p>
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
| | |
|
|
99
|
+
| ------------- | ------------------------------------------------------- |
|
|
100
|
+
| **Project** | [Lyt — Link Your Think](https://linkyourthink.com) |
|
|
101
|
+
| **Author** | [Alexandru Mareș](https://allemaar.com) |
|
|
102
|
+
| **Company** | [MARLINK TRADING SRL](https://younndai.com) · YounndAI™ |
|
|
103
|
+
| **License** | [Apache 2.0](./LICENSE) — © 2026 MARLINK TRADING SRL |
|
|
104
|
+
| **Trademark** | [YounndAI™ Trademark Guidelines](https://github.com/YounndAI/lyt/blob/main/TRADEMARK.md) |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LlmAdapter } from "../types.js";
|
|
2
|
+
export interface AiRelayGenerateFn {
|
|
3
|
+
(args: {
|
|
4
|
+
prompt: string;
|
|
5
|
+
system?: string;
|
|
6
|
+
model?: string;
|
|
7
|
+
maxTokens?: number;
|
|
8
|
+
temperature?: number;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
text: string;
|
|
11
|
+
model: string;
|
|
12
|
+
tokensIn: number;
|
|
13
|
+
tokensOut: number;
|
|
14
|
+
costUsd: number;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export interface AiRelayEmbedFn {
|
|
18
|
+
(args: {
|
|
19
|
+
texts: string[];
|
|
20
|
+
model?: string;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
vectors: number[][];
|
|
23
|
+
model: string;
|
|
24
|
+
tokensIn: number;
|
|
25
|
+
costUsd: number;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface AiRelayAdapterConfig {
|
|
29
|
+
generate: AiRelayGenerateFn;
|
|
30
|
+
embed?: AiRelayEmbedFn;
|
|
31
|
+
defaultModel?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function createAiRelayAdapter(config: AiRelayAdapterConfig): LlmAdapter;
|
|
34
|
+
//# sourceMappingURL=ai-relay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-relay.d.ts","sourceRoot":"","sources":["../../src/adapters/ai-relay.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAKV,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC;QACV,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QACnD,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC;IAKvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CA+C7E"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export function createAiRelayAdapter(config) {
|
|
17
|
+
return {
|
|
18
|
+
source: "ai-relay",
|
|
19
|
+
supports(mode) {
|
|
20
|
+
if (mode === "embed")
|
|
21
|
+
return Boolean(config.embed);
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
async generate(req) {
|
|
25
|
+
const result = await config.generate({
|
|
26
|
+
prompt: req.prompt,
|
|
27
|
+
...(req.system !== undefined ? { system: req.system } : {}),
|
|
28
|
+
...(req.model !== undefined
|
|
29
|
+
? { model: req.model }
|
|
30
|
+
: config.defaultModel
|
|
31
|
+
? { model: config.defaultModel }
|
|
32
|
+
: {}),
|
|
33
|
+
...(req.maxTokens !== undefined ? { maxTokens: req.maxTokens } : {}),
|
|
34
|
+
...(req.temperature !== undefined ? { temperature: req.temperature } : {}),
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
text: result.text,
|
|
38
|
+
sourceUsed: "ai-relay",
|
|
39
|
+
modelUsed: result.model,
|
|
40
|
+
tokensIn: result.tokensIn,
|
|
41
|
+
tokensOut: result.tokensOut,
|
|
42
|
+
costUsd: result.costUsd,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
async embed(req) {
|
|
46
|
+
if (!config.embed) {
|
|
47
|
+
throw new Error("ai-relay adapter constructed without an embed handle; pass `embed` in AiRelayAdapterConfig");
|
|
48
|
+
}
|
|
49
|
+
const result = await config.embed({
|
|
50
|
+
texts: req.texts,
|
|
51
|
+
...(req.model !== undefined ? { model: req.model } : {}),
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
vectors: result.vectors,
|
|
55
|
+
sourceUsed: "ai-relay",
|
|
56
|
+
modelUsed: result.model,
|
|
57
|
+
tokensIn: result.tokensIn,
|
|
58
|
+
costUsd: result.costUsd,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=ai-relay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-relay.js","sourceRoot":"","sources":["../../src/adapters/ai-relay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0DH,MAAM,UAAU,oBAAoB,CAAC,MAA4B;IAC/D,OAAO;QACL,MAAM,EAAE,UAAU;QAClB,QAAQ,CAAC,IAAI;YACX,IAAI,IAAI,KAAK,OAAO;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,GAAoB;YACjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC;gBACnC,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3D,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS;oBACzB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;oBACtB,CAAC,CAAC,MAAM,CAAC,YAAY;wBACnB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE;wBAChC,CAAC,CAAC,EAAE,CAAC;gBACT,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpE,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3E,CAAC,CAAC;YACH,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,UAAU;gBACtB,SAAS,EAAE,MAAM,CAAC,KAAK;gBACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,GAAiB;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAChC,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzD,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,UAAU,EAAE,UAAU;gBACtB,SAAS,EAAE,MAAM,CAAC,KAAK;gBACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LlmAdapter } from "../types.js";
|
|
2
|
+
export interface ByokClient {
|
|
3
|
+
readonly provider: string;
|
|
4
|
+
generate(args: {
|
|
5
|
+
prompt: string;
|
|
6
|
+
system?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
maxTokens?: number;
|
|
9
|
+
temperature?: number;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
text: string;
|
|
12
|
+
model: string;
|
|
13
|
+
tokensIn: number;
|
|
14
|
+
tokensOut: number;
|
|
15
|
+
costUsd: number;
|
|
16
|
+
}>;
|
|
17
|
+
embed?(args: {
|
|
18
|
+
texts: string[];
|
|
19
|
+
model?: string;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
vectors: number[][];
|
|
22
|
+
model: string;
|
|
23
|
+
tokensIn: number;
|
|
24
|
+
costUsd: number;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export interface ByokAdapterConfig {
|
|
28
|
+
client: ByokClient;
|
|
29
|
+
defaultModel?: string;
|
|
30
|
+
defaultEmbedModel?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function createByokAdapter(config: ByokAdapterConfig): LlmAdapter;
|
|
33
|
+
//# sourceMappingURL=byok.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byok.d.ts","sourceRoot":"","sources":["../../src/adapters/byok.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAKV,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,UAAU;IAGzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC;QACV,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,KAAK,CAAC,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QACzD,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,CAmDvE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export function createByokAdapter(config) {
|
|
17
|
+
return {
|
|
18
|
+
source: "byok",
|
|
19
|
+
supports(mode) {
|
|
20
|
+
if (mode === "embed")
|
|
21
|
+
return typeof config.client.embed === "function";
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
async generate(req) {
|
|
25
|
+
const result = await config.client.generate({
|
|
26
|
+
prompt: req.prompt,
|
|
27
|
+
...(req.system !== undefined ? { system: req.system } : {}),
|
|
28
|
+
...(req.model !== undefined
|
|
29
|
+
? { model: req.model }
|
|
30
|
+
: config.defaultModel
|
|
31
|
+
? { model: config.defaultModel }
|
|
32
|
+
: {}),
|
|
33
|
+
...(req.maxTokens !== undefined ? { maxTokens: req.maxTokens } : {}),
|
|
34
|
+
...(req.temperature !== undefined ? { temperature: req.temperature } : {}),
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
text: result.text,
|
|
38
|
+
sourceUsed: "byok",
|
|
39
|
+
modelUsed: `${config.client.provider}:${result.model}`,
|
|
40
|
+
tokensIn: result.tokensIn,
|
|
41
|
+
tokensOut: result.tokensOut,
|
|
42
|
+
costUsd: result.costUsd,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
async embed(req) {
|
|
46
|
+
if (!config.client.embed) {
|
|
47
|
+
throw new Error(`byok client (provider=${config.client.provider}) does not implement embed; pass an embed-capable client`);
|
|
48
|
+
}
|
|
49
|
+
const result = await config.client.embed({
|
|
50
|
+
texts: req.texts,
|
|
51
|
+
...(req.model !== undefined
|
|
52
|
+
? { model: req.model }
|
|
53
|
+
: config.defaultEmbedModel
|
|
54
|
+
? { model: config.defaultEmbedModel }
|
|
55
|
+
: {}),
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
vectors: result.vectors,
|
|
59
|
+
sourceUsed: "byok",
|
|
60
|
+
modelUsed: `${config.client.provider}:${result.model}`,
|
|
61
|
+
tokensIn: result.tokensIn,
|
|
62
|
+
costUsd: result.costUsd,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=byok.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byok.js","sourceRoot":"","sources":["../../src/adapters/byok.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA2DH,MAAM,UAAU,iBAAiB,CAAC,MAAyB;IACzD,OAAO;QACL,MAAM,EAAE,MAAM;QACd,QAAQ,CAAC,IAAI;YACX,IAAI,IAAI,KAAK,OAAO;gBAAE,OAAO,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,UAAU,CAAC;YACvE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,GAAoB;YACjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC1C,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3D,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS;oBACzB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;oBACtB,CAAC,CAAC,MAAM,CAAC,YAAY;wBACnB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE;wBAChC,CAAC,CAAC,EAAE,CAAC;gBACT,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpE,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3E,CAAC,CAAC;YACH,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,MAAM;gBAClB,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE;gBACtD,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,GAAiB;YAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAC,MAAM,CAAC,QAAQ,0DAA0D,CAC1G,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;gBACvC,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS;oBACzB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;oBACtB,CAAC,CAAC,MAAM,CAAC,iBAAiB;wBACxB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,iBAAiB,EAAE;wBACrC,CAAC,CAAC,EAAE,CAAC;aACV,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,UAAU,EAAE,MAAM;gBAClB,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE;gBACtD,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LlmAdapter } from "../types.js";
|
|
2
|
+
export interface HarnessInvokeArgs {
|
|
3
|
+
prompt: string;
|
|
4
|
+
system?: string;
|
|
5
|
+
skill: string;
|
|
6
|
+
}
|
|
7
|
+
export interface HarnessInvokeResult {
|
|
8
|
+
text: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
tokensIn?: number;
|
|
11
|
+
tokensOut?: number;
|
|
12
|
+
}
|
|
13
|
+
export type HarnessInvokeFn = (args: HarnessInvokeArgs) => Promise<HarnessInvokeResult>;
|
|
14
|
+
export interface HarnessAdapterConfig {
|
|
15
|
+
invokeSkill: HarnessInvokeFn;
|
|
16
|
+
skillForCapability?: Partial<Record<"grunt" | "reasoning" | "structured", string>>;
|
|
17
|
+
}
|
|
18
|
+
export declare function createHarnessAdapter(config: HarnessAdapterConfig): LlmAdapter;
|
|
19
|
+
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/adapters/harness.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAKV,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IAIb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAExF,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,eAAe,CAAC;IAI7B,kBAAkB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,WAAW,GAAG,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;CACpF;AAQD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAsC7E"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 MARLINK TRADING SRL (YounndAI)
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_SKILLS = {
|
|
17
|
+
grunt: "lyt-llm-grunt",
|
|
18
|
+
reasoning: "lyt-llm-reason",
|
|
19
|
+
structured: "lyt-llm-structured",
|
|
20
|
+
};
|
|
21
|
+
export function createHarnessAdapter(config) {
|
|
22
|
+
const skills = { ...DEFAULT_SKILLS, ...config.skillForCapability };
|
|
23
|
+
return {
|
|
24
|
+
source: "harness",
|
|
25
|
+
supports(mode) {
|
|
26
|
+
// Embeddings are not exposed via CC/Codex skill APIs — embed routes to
|
|
27
|
+
// ai-relay / ollama instead. Generate is fully supported.
|
|
28
|
+
return mode === "generate";
|
|
29
|
+
},
|
|
30
|
+
async generate(req) {
|
|
31
|
+
const cap = req.capability === "reasoning" || req.capability === "structured"
|
|
32
|
+
? req.capability
|
|
33
|
+
: "grunt";
|
|
34
|
+
const skill = skills[cap];
|
|
35
|
+
const result = await config.invokeSkill({
|
|
36
|
+
prompt: req.prompt,
|
|
37
|
+
...(req.system !== undefined ? { system: req.system } : {}),
|
|
38
|
+
skill,
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
text: result.text,
|
|
42
|
+
sourceUsed: "harness",
|
|
43
|
+
modelUsed: result.model ?? `harness:${skill}`,
|
|
44
|
+
tokensIn: result.tokensIn ?? 0,
|
|
45
|
+
tokensOut: result.tokensOut ?? 0,
|
|
46
|
+
// Zero marginal $ cost — the user's CC/Codex subscription absorbs it.
|
|
47
|
+
// Per arc §6.7 cost-shape table this is the STRONGEST adoption lever.
|
|
48
|
+
costUsd: 0,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
async embed(_req) {
|
|
52
|
+
throw new Error("harness adapter does not support embeddings — route embed via ai-relay or ollama");
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=harness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"","sources":["../../src/adapters/harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAwDH,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,gBAAgB;IAC3B,UAAU,EAAE,oBAAoB;CACxB,CAAC;AAEX,MAAM,UAAU,oBAAoB,CAAC,MAA4B;IAC/D,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAEnE,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,QAAQ,CAAC,IAAI;YACX,uEAAuE;YACvE,0DAA0D;YAC1D,OAAO,IAAI,KAAK,UAAU,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,GAAoB;YACjC,MAAM,GAAG,GACP,GAAG,CAAC,UAAU,KAAK,WAAW,IAAI,GAAG,CAAC,UAAU,KAAK,YAAY;gBAC/D,CAAC,CAAC,GAAG,CAAC,UAAU;gBAChB,CAAC,CAAC,OAAO,CAAC;YACd,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3D,KAAK;aACN,CAAC,CAAC;YACH,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,SAAS;gBACrB,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI,WAAW,KAAK,EAAE;gBAC7C,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,CAAC;gBAC9B,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,CAAC;gBAChC,sEAAsE;gBACtE,sEAAsE;gBACtE,OAAO,EAAE,CAAC;aACX,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,IAAkB;YAC5B,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createAiRelayAdapter, type AiRelayAdapterConfig, type AiRelayGenerateFn, type AiRelayEmbedFn, } from "./ai-relay.js";
|
|
2
|
+
export { createOllamaAdapter, OllamaUnreachableError, OllamaHttpError, type OllamaAdapterConfig, type FetchLike, } from "./ollama.js";
|
|
3
|
+
export { createHarnessAdapter, type HarnessAdapterConfig, type HarnessInvokeArgs, type HarnessInvokeResult, type HarnessInvokeFn, } from "./harness.js";
|
|
4
|
+
export { createByokAdapter, type ByokAdapterConfig, type ByokClient } from "./byok.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC"}
|