@heossi/bee 0.1.3
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 +190 -0
- package/README.md +140 -0
- package/dist/client.d.ts +67 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +202 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +20 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +86 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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 Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 HEOSSI (Pte.) Ltd.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
189
|
+
implied. See the License for the specific language governing
|
|
190
|
+
permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# @heossi/bee
|
|
2
|
+
|
|
3
|
+
Official TypeScript / JavaScript SDK for the **Bee Intelligence Engine** by [HEOSSI](https://www.heossi.com).
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@heossi/bee)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
Bee exposes an **OpenAI-compatible** `/chat/completions` surface backed by a domain-specialised LoRA-routed model ladder — Cell, Brood, Comb, Buzz, Hive, Swarm, Enclave. This SDK is the typed entry point.
|
|
9
|
+
|
|
10
|
+
- ✅ Pure ESM, zero runtime dependencies
|
|
11
|
+
- ✅ Native `fetch` (Node 18+, Deno, Bun, every browser)
|
|
12
|
+
- ✅ Streaming via async iterator
|
|
13
|
+
- ✅ Multimodal content (text + image_url) on Hive / Swarm / Enclave
|
|
14
|
+
- ✅ Structured errors (`BeeAuthError`, `BeeRateLimitError`, `BeeTimeoutError`)
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @heossi/bee
|
|
20
|
+
# or pnpm add @heossi/bee
|
|
21
|
+
# or yarn add @heossi/bee
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quickstart
|
|
25
|
+
|
|
26
|
+
Get an API key from [bee.heossi.com/app/account/api-keys](https://bee.heossi.com/app/account/api-keys).
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { BeeClient } from "@heossi/bee";
|
|
30
|
+
|
|
31
|
+
const bee = new BeeClient({ apiKey: process.env.BEE_API_KEY! });
|
|
32
|
+
|
|
33
|
+
const out = await bee.chat.completions.create({
|
|
34
|
+
model: "bee-cell",
|
|
35
|
+
messages: [
|
|
36
|
+
{ role: "system", content: "You are a precise assistant." },
|
|
37
|
+
{ role: "user", content: "Summarise the SOLID principles in 2 lines." },
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
console.log(out.choices[0].message.content);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Streaming
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const stream = await bee.chat.completions.create({
|
|
48
|
+
model: "bee-cell",
|
|
49
|
+
messages: [{ role: "user", content: "Write a short haiku about bees." }],
|
|
50
|
+
stream: true,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
for await (const chunk of stream) {
|
|
54
|
+
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Vision (Hive / Swarm / Enclave tiers)
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const out = await bee.chat.completions.create({
|
|
62
|
+
model: "bee-hive",
|
|
63
|
+
messages: [
|
|
64
|
+
{
|
|
65
|
+
role: "user",
|
|
66
|
+
content: [
|
|
67
|
+
{ type: "text", text: "What is in this image?" },
|
|
68
|
+
{
|
|
69
|
+
type: "image_url",
|
|
70
|
+
image_url: { url: "https://example.com/photo.jpg" },
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## List models
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const { data } = await bee.models.list();
|
|
82
|
+
for (const m of data) console.log(m.id);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Self-hosted Bee Enclave
|
|
86
|
+
|
|
87
|
+
Override `baseURL` to point at your on-prem deployment:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const bee = new BeeClient({
|
|
91
|
+
apiKey: process.env.BEE_API_KEY!,
|
|
92
|
+
baseURL: "https://bee.your-company.example/bee",
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Error handling
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { BeeAuthError, BeeRateLimitError, BeeTimeoutError } from "@heossi/bee";
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
await bee.chat.completions.create({ messages: [{ role: "user", content: "Hi" }] });
|
|
103
|
+
} catch (err) {
|
|
104
|
+
if (err instanceof BeeRateLimitError) {
|
|
105
|
+
console.warn(`Rate-limited. Retry after ${err.retryAfterSeconds}s`);
|
|
106
|
+
} else if (err instanceof BeeAuthError) {
|
|
107
|
+
console.error("Bad API key or plan does not grant this tier");
|
|
108
|
+
} else if (err instanceof BeeTimeoutError) {
|
|
109
|
+
console.error("Request timed out");
|
|
110
|
+
} else {
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## OpenAI SDK compatibility
|
|
117
|
+
|
|
118
|
+
Because Bee speaks the OpenAI Chat Completions wire format, you can also point the official `openai` package at Bee directly — useful for migration:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import OpenAI from "openai";
|
|
122
|
+
|
|
123
|
+
const bee = new OpenAI({
|
|
124
|
+
apiKey: process.env.BEE_API_KEY,
|
|
125
|
+
baseURL: "https://bee.heossi.com/bee",
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`@heossi/bee` is the lighter, dependency-free option when you don't need the full OpenAI SDK surface.
|
|
130
|
+
|
|
131
|
+
## Other surfaces
|
|
132
|
+
|
|
133
|
+
- **MCP server** for Claude Desktop / Cursor / VS Code → see [bee.heossi.com/docs/mcp](https://bee.heossi.com/docs/mcp)
|
|
134
|
+
- **Python SDK** → `pip install bee-sdk`
|
|
135
|
+
- **REST reference** → [bee.heossi.com/docs](https://bee.heossi.com/docs)
|
|
136
|
+
- **Status & roadmap** → [bee.heossi.com/status](https://bee.heossi.com/status), [bee.heossi.com/roadmap](https://bee.heossi.com/roadmap)
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
[Apache-2.0](./LICENSE) — © HEOSSI (Pte.) Ltd.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BeeClient — dependency-free TypeScript SDK for the Bee Intelligence Engine.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
*
|
|
6
|
+
* import { BeeClient } from "@heossi/bee";
|
|
7
|
+
*
|
|
8
|
+
* const bee = new BeeClient({ apiKey: process.env.BEE_API_KEY! });
|
|
9
|
+
*
|
|
10
|
+
* const out = await bee.chat.completions.create({
|
|
11
|
+
* model: "bee-cell",
|
|
12
|
+
* messages: [{ role: "user", content: "Hello." }],
|
|
13
|
+
* });
|
|
14
|
+
* console.log(out.choices[0].message.content);
|
|
15
|
+
*
|
|
16
|
+
* The SDK targets bee.heossi.com/bee/* (the public OpenAI-compatible
|
|
17
|
+
* proxy). Override `baseURL` to point at a self-hosted Bee Enclave or
|
|
18
|
+
* a staging environment.
|
|
19
|
+
*/
|
|
20
|
+
import type { ChatCompletion, ChatCompletionChunk, ChatCompletionCreateParams, ModelsListResponse } from "./types.js";
|
|
21
|
+
export interface BeeClientOptions {
|
|
22
|
+
/** Bee API key. Issue from https://bee.heossi.com/app/account/api-keys. */
|
|
23
|
+
apiKey: string;
|
|
24
|
+
/** Override the default base URL. Useful for staging or self-hosted Enclave. */
|
|
25
|
+
baseURL?: string;
|
|
26
|
+
/** Per-request timeout in ms. Default 60_000. */
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
/** Extra headers to send on every request. */
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
/** Inject a custom fetch (for tests / Node <18 polyfills). Defaults to globalThis.fetch. */
|
|
31
|
+
fetch?: typeof fetch;
|
|
32
|
+
}
|
|
33
|
+
export declare class BeeClient {
|
|
34
|
+
private readonly apiKey;
|
|
35
|
+
private readonly baseURL;
|
|
36
|
+
private readonly timeoutMs;
|
|
37
|
+
private readonly extraHeaders;
|
|
38
|
+
private readonly fetchImpl;
|
|
39
|
+
readonly chat: ChatNamespace;
|
|
40
|
+
readonly models: ModelsNamespace;
|
|
41
|
+
constructor(opts: BeeClientOptions);
|
|
42
|
+
/** Internal — request wrapper with timeout, auth header, and structured error mapping. */
|
|
43
|
+
_request(method: "GET" | "POST", path: string, body: unknown, accept: "application/json" | "text/event-stream"): Promise<Response>;
|
|
44
|
+
}
|
|
45
|
+
declare class ChatNamespace {
|
|
46
|
+
readonly completions: ChatCompletionsResource;
|
|
47
|
+
constructor(client: BeeClient);
|
|
48
|
+
}
|
|
49
|
+
declare class ChatCompletionsResource {
|
|
50
|
+
private readonly client;
|
|
51
|
+
constructor(client: BeeClient);
|
|
52
|
+
/** Non-streaming chat completion. */
|
|
53
|
+
create(params: ChatCompletionCreateParams & {
|
|
54
|
+
stream?: false | undefined;
|
|
55
|
+
}): Promise<ChatCompletion>;
|
|
56
|
+
/** Streaming chat completion — returns an async iterator over OpenAI SSE chunks. */
|
|
57
|
+
create(params: ChatCompletionCreateParams & {
|
|
58
|
+
stream: true;
|
|
59
|
+
}): Promise<AsyncIterable<ChatCompletionChunk>>;
|
|
60
|
+
}
|
|
61
|
+
declare class ModelsNamespace {
|
|
62
|
+
private readonly client;
|
|
63
|
+
constructor(client: BeeClient);
|
|
64
|
+
list(): Promise<ModelsList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BAClC,MAAM,EAAE,SAAS;CAG9B;AAED,cAAM,uBAAuB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAE9C,qCAAqC;IAC/B,MAAM,CACV,MAAM,EAAE,0BAA0B,GAAG;QAAE,MAAM,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;KAAE,GAClE,OAAO,CAAC,cAAc,CAAC;IAC1B,oFAAoF;IAC9E,MAAM,CACV,MAAM,EAAE,0BAA0B,GAAG;QAAE,MAAM,EAAE,IAAI,CAAA;KAAE,GACpD,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;CA+B/C;AAED,cAAM,eAAe;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IACxC,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAI1C"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BeeClient — dependency-free TypeScript SDK for the Bee Intelligence Engine.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
*
|
|
6
|
+
* import { BeeClient } from "@heossi/bee";
|
|
7
|
+
*
|
|
8
|
+
* const bee = new BeeClient({ apiKey: process.env.BEE_API_KEY! });
|
|
9
|
+
*
|
|
10
|
+
* const out = await bee.chat.completions.create({
|
|
11
|
+
* model: "bee-cell",
|
|
12
|
+
* messages: [{ role: "user", content: "Hello." }],
|
|
13
|
+
* });
|
|
14
|
+
* console.log(out.choices[0].message.content);
|
|
15
|
+
*
|
|
16
|
+
* The SDK targets bee.heossi.com/bee/* (the public OpenAI-compatible
|
|
17
|
+
* proxy). Override `baseURL` to point at a self-hosted Bee Enclave or
|
|
18
|
+
* a staging environment.
|
|
19
|
+
*/
|
|
20
|
+
import { BeeAuthError, BeeError, BeeRateLimitError, BeeTimeoutError } from "./errors.js";
|
|
21
|
+
const DEFAULT_BASE_URL = "https://bee.heossi.com/bee";
|
|
22
|
+
const DEFAULT_TIMEOUT_MS = 60_000;
|
|
23
|
+
export class BeeClient {
|
|
24
|
+
apiKey;
|
|
25
|
+
baseURL;
|
|
26
|
+
timeoutMs;
|
|
27
|
+
extraHeaders;
|
|
28
|
+
fetchImpl;
|
|
29
|
+
chat;
|
|
30
|
+
models;
|
|
31
|
+
constructor(opts) {
|
|
32
|
+
if (!opts.apiKey || typeof opts.apiKey !== "string") {
|
|
33
|
+
throw new Error("BeeClient: apiKey is required");
|
|
34
|
+
}
|
|
35
|
+
this.apiKey = opts.apiKey;
|
|
36
|
+
this.baseURL = (opts.baseURL ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
37
|
+
this.timeoutMs = typeof opts.timeoutMs === "number" ? opts.timeoutMs : DEFAULT_TIMEOUT_MS;
|
|
38
|
+
this.extraHeaders = { ...(opts.headers ?? {}) };
|
|
39
|
+
const f = opts.fetch ?? globalThis.fetch;
|
|
40
|
+
if (typeof f !== "function") {
|
|
41
|
+
throw new Error("BeeClient: no fetch implementation found. On Node <18, pass `fetch` explicitly.");
|
|
42
|
+
}
|
|
43
|
+
this.fetchImpl = f;
|
|
44
|
+
this.chat = new ChatNamespace(this);
|
|
45
|
+
this.models = new ModelsNamespace(this);
|
|
46
|
+
}
|
|
47
|
+
/** Internal — request wrapper with timeout, auth header, and structured error mapping. */
|
|
48
|
+
async _request(method, path, body, accept) {
|
|
49
|
+
const url = `${this.baseURL}${path}`;
|
|
50
|
+
const controller = new AbortController();
|
|
51
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
52
|
+
const headers = {
|
|
53
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
54
|
+
Accept: accept,
|
|
55
|
+
...this.extraHeaders,
|
|
56
|
+
};
|
|
57
|
+
if (body !== undefined)
|
|
58
|
+
headers["Content-Type"] = "application/json";
|
|
59
|
+
let resp;
|
|
60
|
+
try {
|
|
61
|
+
resp = await this.fetchImpl(url, {
|
|
62
|
+
method,
|
|
63
|
+
headers,
|
|
64
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
65
|
+
signal: controller.signal,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
71
|
+
throw new BeeTimeoutError(`Request to ${url} timed out`, this.timeoutMs);
|
|
72
|
+
}
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
if (!resp.ok) {
|
|
77
|
+
const errorBody = await safeReadJson(resp);
|
|
78
|
+
const message = `Bee request to ${path} failed: HTTP ${resp.status}`;
|
|
79
|
+
if (resp.status === 401 || resp.status === 403) {
|
|
80
|
+
throw new BeeAuthError(message, resp.status, errorBody);
|
|
81
|
+
}
|
|
82
|
+
if (resp.status === 429) {
|
|
83
|
+
const ra = resp.headers.get("retry-after");
|
|
84
|
+
const retryAfter = ra && /^\d+$/.test(ra) ? Number.parseInt(ra, 10) : null;
|
|
85
|
+
throw new BeeRateLimitError(message, errorBody, retryAfter);
|
|
86
|
+
}
|
|
87
|
+
throw new BeeError(message, resp.status, errorBody);
|
|
88
|
+
}
|
|
89
|
+
return resp;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class ChatNamespace {
|
|
93
|
+
completions;
|
|
94
|
+
constructor(client) {
|
|
95
|
+
this.completions = new ChatCompletionsResource(client);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
class ChatCompletionsResource {
|
|
99
|
+
client;
|
|
100
|
+
constructor(client) {
|
|
101
|
+
this.client = client;
|
|
102
|
+
}
|
|
103
|
+
async create(params) {
|
|
104
|
+
validateMessages(params.messages);
|
|
105
|
+
const body = {
|
|
106
|
+
model: params.model ?? "bee-cell",
|
|
107
|
+
messages: params.messages,
|
|
108
|
+
...(typeof params.temperature === "number" ? { temperature: params.temperature } : {}),
|
|
109
|
+
...(typeof params.max_tokens === "number" ? { max_tokens: params.max_tokens } : {}),
|
|
110
|
+
...(typeof params.seed === "number" ? { seed: params.seed } : {}),
|
|
111
|
+
...(params.stream ? { stream: true } : {}),
|
|
112
|
+
};
|
|
113
|
+
if (params.stream) {
|
|
114
|
+
const resp = await this.client._request("POST", "/chat/completions", body, "text/event-stream");
|
|
115
|
+
return iterateSse(resp);
|
|
116
|
+
}
|
|
117
|
+
const resp = await this.client._request("POST", "/chat/completions", body, "application/json");
|
|
118
|
+
return (await resp.json());
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
class ModelsNamespace {
|
|
122
|
+
client;
|
|
123
|
+
constructor(client) {
|
|
124
|
+
this.client = client;
|
|
125
|
+
}
|
|
126
|
+
async list() {
|
|
127
|
+
const resp = await this.client._request("GET", "/models", undefined, "application/json");
|
|
128
|
+
return (await resp.json());
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ── Helpers ──────────────────────────────────────────────────────────────
|
|
132
|
+
function validateMessages(messages) {
|
|
133
|
+
if (!Array.isArray(messages) || messages.length === 0) {
|
|
134
|
+
throw new Error("BeeClient: messages must be a non-empty array");
|
|
135
|
+
}
|
|
136
|
+
for (const m of messages) {
|
|
137
|
+
if (!m || typeof m.role !== "string") {
|
|
138
|
+
throw new Error("BeeClient: each message must have a string `role`");
|
|
139
|
+
}
|
|
140
|
+
if (typeof m.content !== "string" && !Array.isArray(m.content)) {
|
|
141
|
+
throw new Error("BeeClient: each message `content` must be a string or array of parts");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function safeReadJson(resp) {
|
|
146
|
+
try {
|
|
147
|
+
return await resp.json();
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
try {
|
|
151
|
+
return await resp.text();
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Yield OpenAI-style SSE chunks. The server emits `data: {...}\n\n`
|
|
160
|
+
* lines terminated by `data: [DONE]\n\n`. Lines we can't parse as JSON
|
|
161
|
+
* are skipped silently — same behaviour as the OpenAI SDK.
|
|
162
|
+
*/
|
|
163
|
+
async function* iterateSse(resp) {
|
|
164
|
+
if (!resp.body) {
|
|
165
|
+
throw new BeeError("Streaming response had no body", resp.status, null);
|
|
166
|
+
}
|
|
167
|
+
const reader = resp.body.getReader();
|
|
168
|
+
const decoder = new TextDecoder();
|
|
169
|
+
let buffer = "";
|
|
170
|
+
try {
|
|
171
|
+
while (true) {
|
|
172
|
+
const { value, done } = await reader.read();
|
|
173
|
+
if (done)
|
|
174
|
+
break;
|
|
175
|
+
buffer += decoder.decode(value, { stream: true });
|
|
176
|
+
let eventEnd;
|
|
177
|
+
while ((eventEnd = buffer.indexOf("\n\n")) !== -1) {
|
|
178
|
+
const event = buffer.slice(0, eventEnd);
|
|
179
|
+
buffer = buffer.slice(eventEnd + 2);
|
|
180
|
+
const dataLine = event
|
|
181
|
+
.split("\n")
|
|
182
|
+
.find((line) => line.startsWith("data:"))
|
|
183
|
+
?.slice(5)
|
|
184
|
+
.trim();
|
|
185
|
+
if (!dataLine)
|
|
186
|
+
continue;
|
|
187
|
+
if (dataLine === "[DONE]")
|
|
188
|
+
return;
|
|
189
|
+
try {
|
|
190
|
+
yield JSON.parse(dataLine);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
// Malformed line — skip and continue.
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
reader.releaseLock();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,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.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Base error type — every BeeError carries the HTTP status and (when present) the upstream JSON body. */
|
|
2
|
+
export declare class BeeError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly body: unknown;
|
|
5
|
+
constructor(message: string, status: number, body: unknown);
|
|
6
|
+
}
|
|
7
|
+
/** 401 / 403 — bad or missing API key, or the key's plan does not grant the requested tier. */
|
|
8
|
+
export declare class BeeAuthError extends BeeError {
|
|
9
|
+
constructor(message: string, status: number, body: unknown);
|
|
10
|
+
}
|
|
11
|
+
/** 429 — rate-limited. The `retryAfterSeconds` field reflects the Retry-After header when the server set it. */
|
|
12
|
+
export declare class BeeRateLimitError extends BeeError {
|
|
13
|
+
readonly retryAfterSeconds: number | null;
|
|
14
|
+
constructor(message: string, body: unknown, retryAfterSeconds: number | null);
|
|
15
|
+
}
|
|
16
|
+
/** AbortController fired before the response landed. */
|
|
17
|
+
export declare class BeeTimeoutError extends BeeError {
|
|
18
|
+
constructor(message: string, timeoutMs: number);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAED,+FAA+F;AAC/F,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAI3D;AAED,gHAAgH;AAChH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;gBAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,IAAI;CAK7E;AAED,wDAAwD;AACxD,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAI/C"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Base error type — every BeeError carries the HTTP status and (when present) the upstream JSON body. */
|
|
2
|
+
export class BeeError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(message, status, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "BeeError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** 401 / 403 — bad or missing API key, or the key's plan does not grant the requested tier. */
|
|
13
|
+
export class BeeAuthError extends BeeError {
|
|
14
|
+
constructor(message, status, body) {
|
|
15
|
+
super(message, status, body);
|
|
16
|
+
this.name = "BeeAuthError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** 429 — rate-limited. The `retryAfterSeconds` field reflects the Retry-After header when the server set it. */
|
|
20
|
+
export class BeeRateLimitError extends BeeError {
|
|
21
|
+
retryAfterSeconds;
|
|
22
|
+
constructor(message, body, retryAfterSeconds) {
|
|
23
|
+
super(message, 429, body);
|
|
24
|
+
this.name = "BeeRateLimitError";
|
|
25
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** AbortController fired before the response landed. */
|
|
29
|
+
export class BeeTimeoutError extends BeeError {
|
|
30
|
+
constructor(message, timeoutMs) {
|
|
31
|
+
super(message, 0, { timeoutMs });
|
|
32
|
+
this.name = "BeeTimeoutError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,MAAM,CAAS;IACf,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,+FAA+F;AAC/F,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,gHAAgH;AAChH,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IACpC,iBAAiB,CAAgB;IAC1C,YAAY,OAAe,EAAE,IAAa,EAAE,iBAAgC;QAC1E,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;CACF;AAED,wDAAwD;AACxD,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,OAAe,EAAE,SAAiB;QAC5C,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @heossi/bee — Official TypeScript / JavaScript SDK for the Bee
|
|
3
|
+
* Intelligence Engine.
|
|
4
|
+
*
|
|
5
|
+
* Bee exposes an OpenAI-compatible /chat/completions surface backed by a
|
|
6
|
+
* domain-specialised LoRA-routed model ladder (Cell, Brood, Comb, Buzz,
|
|
7
|
+
* Hive, Swarm, Enclave). This SDK is the typed entry point — pure
|
|
8
|
+
* ESM, zero runtime dependencies, native fetch.
|
|
9
|
+
*
|
|
10
|
+
* See https://bee.heossi.com/docs for the full API reference.
|
|
11
|
+
*/
|
|
12
|
+
export { BeeClient } from "./client.js";
|
|
13
|
+
export type { BeeClientOptions } from "./client.js";
|
|
14
|
+
export { BeeError, BeeAuthError, BeeRateLimitError, BeeTimeoutError } from "./errors.js";
|
|
15
|
+
export type { ChatMessage, Role, ContentPart, TextPart, ImageUrlPart, ChatCompletionCreateParams, ChatCompletion, ChatCompletionChoice, ChatCompletionChunk, ChatCompletionChunkChoice, ChatCompletionUsage, ModelInfo, ModelsListResponse, } from "./types.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzF,YAAY,EACV,WAAW,EACX,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,SAAS,EACT,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @heossi/bee — Official TypeScript / JavaScript SDK for the Bee
|
|
3
|
+
* Intelligence Engine.
|
|
4
|
+
*
|
|
5
|
+
* Bee exposes an OpenAI-compatible /chat/completions surface backed by a
|
|
6
|
+
* domain-specialised LoRA-routed model ladder (Cell, Brood, Comb, Buzz,
|
|
7
|
+
* Hive, Swarm, Enclave). This SDK is the typed entry point — pure
|
|
8
|
+
* ESM, zero runtime dependencies, native fetch.
|
|
9
|
+
*
|
|
10
|
+
* See https://bee.heossi.com/docs for the full API reference.
|
|
11
|
+
*/
|
|
12
|
+
export { BeeClient } from "./client.js";
|
|
13
|
+
export { BeeError, BeeAuthError, BeeRateLimitError, BeeTimeoutError } from "./errors.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI-compatible request / response types for Bee.
|
|
3
|
+
*
|
|
4
|
+
* Bee exposes a strict subset of the OpenAI Chat Completions surface
|
|
5
|
+
* at https://bee.heossi.com/bee/chat/completions — same JSON shapes,
|
|
6
|
+
* same streaming format. Anything unsupported (function calling,
|
|
7
|
+
* logprobs, n>1, etc.) silently 400s upstream rather than surfacing
|
|
8
|
+
* a misleading "ok" response. This SDK exposes only what's verified
|
|
9
|
+
* to work end-to-end so callers don't ship dead options.
|
|
10
|
+
*/
|
|
11
|
+
export type Role = "system" | "user" | "assistant";
|
|
12
|
+
export type TextPart = {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
export type ImageUrlPart = {
|
|
17
|
+
type: "image_url";
|
|
18
|
+
image_url: {
|
|
19
|
+
url: string;
|
|
20
|
+
detail?: "auto" | "low" | "high";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type ContentPart = TextPart | ImageUrlPart;
|
|
24
|
+
export interface ChatMessage {
|
|
25
|
+
role: Role;
|
|
26
|
+
/** A plain string OR an OpenAI-style multimodal content array. */
|
|
27
|
+
content: string | ContentPart[];
|
|
28
|
+
}
|
|
29
|
+
export interface ChatCompletionCreateParams {
|
|
30
|
+
/** Bee tier id — `bee-cell`, `bee-brood`, `bee-comb`, `bee-buzz`, `bee-hive`, `bee-swarm`, `bee-enclave`. Default `bee-cell`. */
|
|
31
|
+
model?: string;
|
|
32
|
+
messages: ChatMessage[];
|
|
33
|
+
temperature?: number;
|
|
34
|
+
max_tokens?: number;
|
|
35
|
+
/** Optional deterministic seed (forwarded to the backend; honoured by some tiers). */
|
|
36
|
+
seed?: number;
|
|
37
|
+
/** When true, returns an async iterator of OpenAI SSE chunks. */
|
|
38
|
+
stream?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ChatCompletionChoice {
|
|
41
|
+
index: number;
|
|
42
|
+
message: {
|
|
43
|
+
role: "assistant";
|
|
44
|
+
content: string;
|
|
45
|
+
};
|
|
46
|
+
finish_reason: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ChatCompletionUsage {
|
|
49
|
+
prompt_tokens: number;
|
|
50
|
+
completion_tokens: number;
|
|
51
|
+
total_tokens: number;
|
|
52
|
+
}
|
|
53
|
+
export interface ChatCompletion {
|
|
54
|
+
id: string;
|
|
55
|
+
object: "chat.completion";
|
|
56
|
+
created: number;
|
|
57
|
+
model: string;
|
|
58
|
+
choices: ChatCompletionChoice[];
|
|
59
|
+
usage: ChatCompletionUsage;
|
|
60
|
+
}
|
|
61
|
+
export interface ChatCompletionChunkChoice {
|
|
62
|
+
index: number;
|
|
63
|
+
delta: {
|
|
64
|
+
role?: "assistant";
|
|
65
|
+
content?: string;
|
|
66
|
+
};
|
|
67
|
+
finish_reason: string | null;
|
|
68
|
+
}
|
|
69
|
+
export interface ChatCompletionChunk {
|
|
70
|
+
id: string;
|
|
71
|
+
object: "chat.completion.chunk";
|
|
72
|
+
created: number;
|
|
73
|
+
model: string;
|
|
74
|
+
choices: ChatCompletionChunkChoice[];
|
|
75
|
+
}
|
|
76
|
+
export interface ModelInfo {
|
|
77
|
+
id: string;
|
|
78
|
+
object: "model";
|
|
79
|
+
created?: number;
|
|
80
|
+
owned_by?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ModelsListResponse {
|
|
83
|
+
object: "list";
|
|
84
|
+
data: ModelInfo[];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEnD,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9D,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,kEAAkE;IAClE,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,0BAA0B;IACzC,iIAAiI;IACjI,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,C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QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI-compatible request / response types for Bee.
|
|
3
|
+
*
|
|
4
|
+
* Bee exposes a strict subset of the OpenAI Chat Completions surface
|
|
5
|
+
* at https://bee.heossi.com/bee/chat/completions — same JSON shapes,
|
|
6
|
+
* same streaming format. Anything unsupported (function calling,
|
|
7
|
+
* logprobs, n>1, etc.) silently 400s upstream rather than surfacing
|
|
8
|
+
* a misleading "ok" response. This SDK exposes only what's verified
|
|
9
|
+
* to work end-to-end so callers don't ship dead options.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@heossi/bee",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Official TypeScript / JavaScript client for the Bee Intelligence Engine — domain-specialized LoRA-routed LLM by HEOSSI. OpenAI-compatible chat completions over a clean, dependency-free SDK.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "HEOSSI (Pte.) Ltd. <bee-support@heossi.com>",
|
|
7
|
+
"homepage": "https://bee.heossi.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/heossi-hq/bee-community.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/heossi-hq/bee-community/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"bee",
|
|
17
|
+
"heossi",
|
|
18
|
+
"llm",
|
|
19
|
+
"ai",
|
|
20
|
+
"openai-compatible",
|
|
21
|
+
"chat-completions",
|
|
22
|
+
"lora",
|
|
23
|
+
"domain-experts",
|
|
24
|
+
"quantum",
|
|
25
|
+
"cybersecurity",
|
|
26
|
+
"blockchain",
|
|
27
|
+
"mcp"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"prepublishOnly": "npm run build"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"typescript": "^6.0.3"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
}
|
|
57
|
+
}
|