@patternzones/koine-sdk 1.0.0 → 1.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/README.md +70 -0
- package/package.json +13 -3
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @patternzones/koine-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [Koine](../../../README.md) — the HTTP gateway for Claude Code CLI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @patternzones/koine-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { generateText, KoineConfig } from '@patternzones/koine-sdk';
|
|
15
|
+
|
|
16
|
+
const config: KoineConfig = {
|
|
17
|
+
baseUrl: 'http://localhost:3100',
|
|
18
|
+
authKey: 'your-api-key',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const result = await generateText(config, {
|
|
22
|
+
prompt: 'Hello, how are you?',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
console.log(result.text);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Text Generation** — `generateText()` for simple prompts
|
|
31
|
+
- **Streaming** — `streamText()` with async iterators
|
|
32
|
+
- **Structured Output** — `generateObject()` with Zod schema validation
|
|
33
|
+
- **Type Safety** — Full TypeScript types for all requests and responses
|
|
34
|
+
- **Error Handling** — `KoineError` class with status codes
|
|
35
|
+
|
|
36
|
+
## API
|
|
37
|
+
|
|
38
|
+
### Functions
|
|
39
|
+
|
|
40
|
+
| Function | Description |
|
|
41
|
+
|----------|-------------|
|
|
42
|
+
| `generateText(config, request)` | Generate text from a prompt |
|
|
43
|
+
| `streamText(config, request)` | Stream text via Server-Sent Events |
|
|
44
|
+
| `generateObject(config, request)` | Extract structured data using a Zod schema |
|
|
45
|
+
|
|
46
|
+
### Types
|
|
47
|
+
|
|
48
|
+
| Type | Description |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| `KoineConfig` | Client configuration (baseUrl, authKey, timeout, model) |
|
|
51
|
+
| `GenerateTextRequest` | Text generation request options |
|
|
52
|
+
| `GenerateTextResponse` | Text generation response with usage stats |
|
|
53
|
+
| `GenerateObjectRequest` | Object extraction request with Zod schema |
|
|
54
|
+
| `GenerateObjectResponse` | Object extraction response |
|
|
55
|
+
| `KoineStreamResult` | Streaming result with async iterators |
|
|
56
|
+
| `KoineError` | Error class with status and code |
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
See the [SDK Guide](../../../docs/sdk-guide.md) for:
|
|
61
|
+
|
|
62
|
+
- Configuration options
|
|
63
|
+
- Streaming examples
|
|
64
|
+
- Structured output with Zod
|
|
65
|
+
- Error handling
|
|
66
|
+
- Multi-turn conversations
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
[AGPL-3.0](../../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternzones/koine-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "TypeScript SDK for Koine gateway",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,7 +42,17 @@
|
|
|
42
42
|
"node": "22.21.1",
|
|
43
43
|
"bun": "1.3.3"
|
|
44
44
|
},
|
|
45
|
-
"keywords": [
|
|
45
|
+
"keywords": [
|
|
46
|
+
"claude",
|
|
47
|
+
"claude-code",
|
|
48
|
+
"anthropic",
|
|
49
|
+
"ai",
|
|
50
|
+
"sdk",
|
|
51
|
+
"gateway"
|
|
52
|
+
],
|
|
46
53
|
"license": "AGPL-3.0",
|
|
47
|
-
"files": [
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"README.md"
|
|
57
|
+
]
|
|
48
58
|
}
|