@taskcast/server-sdk 0.1.1 → 0.2.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/README.md +49 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @taskcast/server-sdk
|
|
2
|
+
|
|
3
|
+
HTTP client SDK for [Taskcast](https://github.com/weightwave/taskcast) remote server mode. Use this to interact with a standalone Taskcast server from your backend.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @taskcast/server-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { TaskcastServerClient } from '@taskcast/server-sdk'
|
|
15
|
+
|
|
16
|
+
const client = new TaskcastServerClient({
|
|
17
|
+
baseUrl: 'http://localhost:3721',
|
|
18
|
+
token: 'your-jwt-token', // optional
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// Create a task
|
|
22
|
+
const task = await client.createTask({
|
|
23
|
+
type: 'llm.chat',
|
|
24
|
+
params: { prompt: 'Hello' },
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Transition status
|
|
28
|
+
await client.transitionTask(task.id, 'running')
|
|
29
|
+
|
|
30
|
+
// Publish events
|
|
31
|
+
await client.publishEvent(task.id, {
|
|
32
|
+
type: 'llm.delta',
|
|
33
|
+
level: 'info',
|
|
34
|
+
data: { text: 'response chunk' },
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
// Complete
|
|
38
|
+
await client.transitionTask(task.id, 'completed', {
|
|
39
|
+
result: { output: 'done' },
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Part of Taskcast
|
|
44
|
+
|
|
45
|
+
This is the server-side HTTP client. See the [Taskcast monorepo](https://github.com/weightwave/taskcast) for the full project.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
[MIT](https://github.com/weightwave/taskcast/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taskcast/server-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "HTTP client SDK for Taskcast remote server mode.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"provenance": true
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@taskcast/core": "0.
|
|
31
|
+
"@taskcast/core": "0.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^5.7.0",
|