@fetch-hive/sdk 0.2.2 → 0.2.4
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 +47 -6
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -1
- package/dist/client.js.map +1 -1
- package/dist/generated/src/apis/AgentsApi.d.ts +1 -1
- package/dist/generated/src/apis/AgentsApi.js +1 -1
- package/dist/generated/src/apis/PromptsApi.d.ts +1 -1
- package/dist/generated/src/apis/PromptsApi.js +1 -1
- package/dist/generated/src/apis/WorkflowsApi.d.ts +1 -1
- package/dist/generated/src/apis/WorkflowsApi.js +1 -1
- package/dist/generated/src/models/AgentMessage.d.ts +1 -1
- package/dist/generated/src/models/AgentMessage.js +1 -1
- package/dist/generated/src/models/AsyncConfig.d.ts +1 -1
- package/dist/generated/src/models/AsyncConfig.js +1 -1
- package/dist/generated/src/models/ErrorResponse.d.ts +1 -1
- package/dist/generated/src/models/ErrorResponse.js +1 -1
- package/dist/generated/src/models/InvokeAgentRequest.d.ts +1 -1
- package/dist/generated/src/models/InvokeAgentRequest.js +1 -1
- package/dist/generated/src/models/InvokeAgentResponse.d.ts +1 -1
- package/dist/generated/src/models/InvokeAgentResponse.js +1 -1
- package/dist/generated/src/models/InvokePromptRequest.d.ts +1 -1
- package/dist/generated/src/models/InvokePromptRequest.js +1 -1
- package/dist/generated/src/models/InvokePromptResponse.d.ts +1 -1
- package/dist/generated/src/models/InvokePromptResponse.js +1 -1
- package/dist/generated/src/models/InvokeWorkflowAsyncResponse.d.ts +1 -1
- package/dist/generated/src/models/InvokeWorkflowAsyncResponse.js +1 -1
- package/dist/generated/src/models/InvokeWorkflowRequest.d.ts +1 -1
- package/dist/generated/src/models/InvokeWorkflowRequest.js +1 -1
- package/dist/generated/src/models/InvokeWorkflowResponse.d.ts +1 -1
- package/dist/generated/src/models/InvokeWorkflowResponse.js +1 -1
- package/dist/generated/src/models/SseChunk.d.ts +76 -14
- package/dist/generated/src/models/SseChunk.d.ts.map +1 -1
- package/dist/generated/src/models/SseChunk.js +21 -5
- package/dist/generated/src/models/SseChunk.js.map +1 -1
- package/dist/generated/src/models/TokenUsage.d.ts +1 -1
- package/dist/generated/src/models/TokenUsage.js +1 -1
- package/dist/generated/src/models/ToolInvocation.d.ts +1 -1
- package/dist/generated/src/models/ToolInvocation.js +1 -1
- package/dist/generated/src/runtime.d.ts +1 -1
- package/dist/generated/src/runtime.js +1 -1
- package/dist/streaming.d.ts +42 -17
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +2 -1
- package/dist/streaming.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,8 @@ for await (const chunk of client.invokePromptStream({
|
|
|
41
41
|
deployment: 'my-prompt',
|
|
42
42
|
inputs: { name: 'Alice' },
|
|
43
43
|
})) {
|
|
44
|
-
if (chunk.type === '
|
|
44
|
+
if (chunk.type === 'response') process.stdout.write(chunk.response ?? '');
|
|
45
|
+
if (chunk.type === 'usage') console.log('\nUsage:', chunk.usage);
|
|
45
46
|
}
|
|
46
47
|
```
|
|
47
48
|
|
|
@@ -55,6 +56,27 @@ const run = await client.invokeWorkflow({
|
|
|
55
56
|
console.log(run.status, run.output);
|
|
56
57
|
```
|
|
57
58
|
|
|
59
|
+
## Invoke a workflow (async)
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const run = await client.invokeWorkflow({
|
|
63
|
+
deployment: 'my-workflow',
|
|
64
|
+
inputs: { customer_id: '42' },
|
|
65
|
+
async: { enabled: true, callback_url: 'https://example.com/webhook' },
|
|
66
|
+
});
|
|
67
|
+
console.log('Queued:', run.run_id);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Invoke an agent
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const reply = await client.invokeAgent({
|
|
74
|
+
agent: 'my-agent',
|
|
75
|
+
message: 'What is the weather in London?',
|
|
76
|
+
});
|
|
77
|
+
console.log(reply.response);
|
|
78
|
+
```
|
|
79
|
+
|
|
58
80
|
## Invoke an agent (streaming)
|
|
59
81
|
|
|
60
82
|
```typescript
|
|
@@ -63,8 +85,9 @@ for await (const chunk of client.invokeAgentStream({
|
|
|
63
85
|
message: 'What is the weather in London?',
|
|
64
86
|
thread_id: 'session-abc123', // optional — persist conversation history
|
|
65
87
|
})) {
|
|
66
|
-
if (chunk.type === '
|
|
67
|
-
if (chunk.type === '
|
|
88
|
+
if (chunk.type === 'response') process.stdout.write(chunk.response ?? '');
|
|
89
|
+
if (chunk.type === 'tool') console.log(`\nCalling tool: ${chunk.tool}`);
|
|
90
|
+
if (chunk.type === 'usage') console.log('\nUsage:', chunk.usage);
|
|
68
91
|
}
|
|
69
92
|
```
|
|
70
93
|
|
|
@@ -76,21 +99,39 @@ const result = await client.invokeAgent({
|
|
|
76
99
|
message: 'Describe this image',
|
|
77
100
|
image_urls: ['https://example.com/photo.jpg'],
|
|
78
101
|
});
|
|
102
|
+
console.log(result.response);
|
|
79
103
|
```
|
|
80
104
|
|
|
81
105
|
## Authentication
|
|
82
106
|
|
|
83
|
-
|
|
107
|
+
Pass the API key to the constructor:
|
|
84
108
|
|
|
85
109
|
```typescript
|
|
86
110
|
const client = new FetchHive({ apiKey: 'fhk_...' });
|
|
87
111
|
```
|
|
88
112
|
|
|
89
|
-
Or set the
|
|
113
|
+
Or set the environment variable and omit the explicit key:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
export FETCH_HIVE_API_KEY=fhk_...
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
121
|
+
| Option | Default | Description |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| `apiKey` | `process.env.FETCH_HIVE_API_KEY` | Bearer token from the Fetch Hive dashboard |
|
|
124
|
+
| `baseURL` | `https://api.fetchhive.com/v1` | Override the API base URL |
|
|
125
|
+
|
|
126
|
+
## Links
|
|
127
|
+
|
|
128
|
+
- [Fetch Hive dashboard](https://app.fetchhive.com)
|
|
129
|
+
- [API documentation](https://docs.fetchhive.com)
|
|
130
|
+
- [GitHub](https://github.com/Fetch-Hive/nodejs-sdk)
|
|
90
131
|
|
|
91
132
|
## Version
|
|
92
133
|
|
|
93
|
-
0.2.
|
|
134
|
+
0.2.4
|
|
94
135
|
|
|
95
136
|
## License
|
|
96
137
|
|
package/dist/client.d.ts
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
*
|
|
13
13
|
* // Hand-written streaming helpers
|
|
14
14
|
* for await (const chunk of client.invokeAgentStream({ agent: 'my-agent', message: 'Hello' })) {
|
|
15
|
-
* if (chunk.type === '
|
|
15
|
+
* if (chunk.type === 'response') process.stdout.write(chunk.response ?? '');
|
|
16
|
+
* if (chunk.type === 'tool') console.log(`\nCalling tool: ${chunk.tool}`);
|
|
17
|
+
* if (chunk.type === 'usage') console.log('\nUsage:', chunk.usage);
|
|
16
18
|
* }
|
|
17
19
|
*/
|
|
18
20
|
import { type SseChunk } from './streaming.js';
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMzD,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OA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|
14
14
|
* // Hand-written streaming helpers
|
|
15
15
|
* for await (const chunk of client.invokeAgentStream({ agent: 'my-agent', message: 'Hello' })) {
|
|
16
|
-
* if (chunk.type === '
|
|
16
|
+
* if (chunk.type === 'response') process.stdout.write(chunk.response ?? '');
|
|
17
|
+
* if (chunk.type === 'tool') console.log(`\nCalling tool: ${chunk.tool}`);
|
|
18
|
+
* if (chunk.type === 'usage') console.log('\nUsage:', chunk.usage);
|
|
17
19
|
* }
|
|
18
20
|
*/
|
|
19
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,iDAAyD;AAqEzD,iFAAiF;AAEjF,MAAa,SAAS;IAIpB,qEAAqE;IACrE,mEAAmE;IACnE,8BAA8B;IAC9B,oCAAoC;IACpC,8CAA8C;IAE9C,YAAY,OAAyB,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC1D,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAC1G,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,8BAA8B,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEnF,qCAAqC;QACrC,uFAAuF;QACvF,oCAAoC;QACpC,0CAA0C;QAC1C,oDAAoD;IACtD,CAAC;IAED,IAAY,cAAc;QACxB,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;YACtC,cAAc,EAAE,k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C7E,KAAK,CAAC,CAAC,IAAA,uBAAQ,EAAW,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,+EAA+E;IAE/E,wEAAwE;IACxE,cAAc,CAAC,MAA6B;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,+EAA+E;IAE/E,+DAA+D;IAC/D,WAAW,CAAC,MAA0B;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,wDAAwD;IACxD,KAAK,CAAC,CAAC,iBAAiB,CAAC,MAA0B;QACjD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,KAAK,CAAC,CAAC,IAAA,uBAAQ,EAAW,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AAnFD,8BAmFC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -11,9 +11,18 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { TokenUsage } from './TokenUsage';
|
|
13
13
|
/**
|
|
14
|
-
* A single event in a Server-Sent Events stream. The type field is a
|
|
15
|
-
* runtime discriminator. Known values:
|
|
16
|
-
*
|
|
14
|
+
* A single event in a Server-Sent Events stream. The `type` field is a
|
|
15
|
+
* runtime discriminator. Known values:
|
|
16
|
+
* - `reasoning` — a reasoning / thinking chunk (prompt and agent streams)
|
|
17
|
+
* - `response` — a text chunk (prompt and agent streams)
|
|
18
|
+
* - `tool` — a tool invocation result (agent stream only)
|
|
19
|
+
* - `usage` — final token usage event; signals end of meaningful stream content
|
|
20
|
+
* - `summary` — auto-summarization event emitted before reasoning when a thread
|
|
21
|
+
* history was compressed (agent stream only)
|
|
22
|
+
* - `error` — server-side error during streaming
|
|
23
|
+
*
|
|
24
|
+
* The stream is terminated by `data: [DONE]`, which is handled by the SSE
|
|
25
|
+
* parser and never surfaced as a chunk.
|
|
17
26
|
*
|
|
18
27
|
* @export
|
|
19
28
|
* @interface SseChunk
|
|
@@ -26,43 +35,96 @@ export interface SseChunk {
|
|
|
26
35
|
*/
|
|
27
36
|
type?: string;
|
|
28
37
|
/**
|
|
29
|
-
* Text
|
|
38
|
+
* Text content of the chunk. Present for `reasoning` and `response` event types.
|
|
39
|
+
*
|
|
30
40
|
* @type {string}
|
|
31
41
|
* @memberof SseChunk
|
|
32
42
|
*/
|
|
33
|
-
|
|
43
|
+
response?: string;
|
|
34
44
|
/**
|
|
35
|
-
* Present on
|
|
45
|
+
* Unique request identifier. Present on most events; always present on `usage`.
|
|
36
46
|
* @type {string}
|
|
37
47
|
* @memberof SseChunk
|
|
38
48
|
*/
|
|
39
49
|
requestId?: string;
|
|
40
50
|
/**
|
|
41
|
-
* Present on
|
|
51
|
+
* Model identifier. Present on `response` and `reasoning` events (prompt stream).
|
|
42
52
|
* @type {string}
|
|
43
53
|
* @memberof SseChunk
|
|
44
54
|
*/
|
|
45
55
|
model?: string;
|
|
46
56
|
/**
|
|
47
|
-
*
|
|
57
|
+
* Per-chunk boolean flag on `response` and `reasoning` events (agent stream).
|
|
58
|
+
* Not a terminal event type — use the `usage` event to detect end of stream.
|
|
59
|
+
*
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
* @memberof SseChunk
|
|
62
|
+
*/
|
|
63
|
+
done?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Unique tool invocation identifier. Present for `tool` events.
|
|
66
|
+
* @type {string}
|
|
67
|
+
* @memberof SseChunk
|
|
68
|
+
*/
|
|
69
|
+
toolId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Tool name. Present for `tool` events (e.g. "google_search").
|
|
48
72
|
* @type {string}
|
|
49
73
|
* @memberof SseChunk
|
|
50
74
|
*/
|
|
51
|
-
|
|
75
|
+
tool?: string;
|
|
52
76
|
/**
|
|
53
|
-
*
|
|
77
|
+
* Internal tool type identifier. Present for `tool` events.
|
|
54
78
|
* @type {string}
|
|
55
79
|
* @memberof SseChunk
|
|
56
80
|
*/
|
|
57
|
-
|
|
81
|
+
toolType?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Parsed tool input arguments. Present for `tool` events.
|
|
84
|
+
* @type {{ [key: string]: any; }}
|
|
85
|
+
* @memberof SseChunk
|
|
86
|
+
*/
|
|
87
|
+
toolInput?: {
|
|
88
|
+
[key: string]: any;
|
|
89
|
+
};
|
|
58
90
|
/**
|
|
59
|
-
* Serialised JSON tool result
|
|
91
|
+
* Serialised JSON tool result. Present for `tool` events.
|
|
60
92
|
* @type {string}
|
|
61
93
|
* @memberof SseChunk
|
|
62
94
|
*/
|
|
63
95
|
observation?: string;
|
|
64
96
|
/**
|
|
65
|
-
*
|
|
97
|
+
* Reason the stream ended. Present on `usage` events (e.g. "completed").
|
|
98
|
+
* @type {string}
|
|
99
|
+
* @memberof SseChunk
|
|
100
|
+
*/
|
|
101
|
+
stopReason?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Compressed summary of the prior conversation. Present for `summary` events.
|
|
104
|
+
* @type {string}
|
|
105
|
+
* @memberof SseChunk
|
|
106
|
+
*/
|
|
107
|
+
summaryText?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Token count before summarization. Present for `summary` events.
|
|
110
|
+
* @type {number}
|
|
111
|
+
* @memberof SseChunk
|
|
112
|
+
*/
|
|
113
|
+
originalTokenCount?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Model context window size. Present for `summary` events.
|
|
116
|
+
* @type {number}
|
|
117
|
+
* @memberof SseChunk
|
|
118
|
+
*/
|
|
119
|
+
contextLimit?: number;
|
|
120
|
+
/**
|
|
121
|
+
* LLM provider used for summarization. Present for `summary` events.
|
|
122
|
+
* @type {string}
|
|
123
|
+
* @memberof SseChunk
|
|
124
|
+
*/
|
|
125
|
+
provider?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Error message. Present for `error` events.
|
|
66
128
|
* @type {string}
|
|
67
129
|
* @memberof SseChunk
|
|
68
130
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SseChunk.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/models/SseChunk.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C
|
|
1
|
+
{"version":3,"file":"SseChunk.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/models/SseChunk.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE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AO,GAAG,QAAQ,CAwBvF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,GAAG,QAAQ,CAElD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,EAAE,mBAAmB,GAAE,OAAe,GAAG,GAAG,CAyBtG"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -34,12 +34,20 @@ function SseChunkFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
'type': json['type'] == null ? undefined : json['type'],
|
|
37
|
-
'
|
|
37
|
+
'response': json['response'] == null ? undefined : json['response'],
|
|
38
38
|
'requestId': json['request_id'] == null ? undefined : json['request_id'],
|
|
39
39
|
'model': json['model'] == null ? undefined : json['model'],
|
|
40
|
-
'
|
|
40
|
+
'done': json['done'] == null ? undefined : json['done'],
|
|
41
|
+
'toolId': json['tool_id'] == null ? undefined : json['tool_id'],
|
|
42
|
+
'tool': json['tool'] == null ? undefined : json['tool'],
|
|
43
|
+
'toolType': json['tool_type'] == null ? undefined : json['tool_type'],
|
|
41
44
|
'toolInput': json['tool_input'] == null ? undefined : json['tool_input'],
|
|
42
45
|
'observation': json['observation'] == null ? undefined : json['observation'],
|
|
46
|
+
'stopReason': json['stop_reason'] == null ? undefined : json['stop_reason'],
|
|
47
|
+
'summaryText': json['summary_text'] == null ? undefined : json['summary_text'],
|
|
48
|
+
'originalTokenCount': json['original_token_count'] == null ? undefined : json['original_token_count'],
|
|
49
|
+
'contextLimit': json['context_limit'] == null ? undefined : json['context_limit'],
|
|
50
|
+
'provider': json['provider'] == null ? undefined : json['provider'],
|
|
43
51
|
'error': json['error'] == null ? undefined : json['error'],
|
|
44
52
|
'usage': json['usage'] == null ? undefined : (0, TokenUsage_1.TokenUsageFromJSON)(json['usage']),
|
|
45
53
|
};
|
|
@@ -53,12 +61,20 @@ function SseChunkToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
53
61
|
}
|
|
54
62
|
return {
|
|
55
63
|
'type': value['type'],
|
|
56
|
-
'
|
|
64
|
+
'response': value['response'],
|
|
57
65
|
'request_id': value['requestId'],
|
|
58
66
|
'model': value['model'],
|
|
59
|
-
'
|
|
67
|
+
'done': value['done'],
|
|
68
|
+
'tool_id': value['toolId'],
|
|
69
|
+
'tool': value['tool'],
|
|
70
|
+
'tool_type': value['toolType'],
|
|
60
71
|
'tool_input': value['toolInput'],
|
|
61
72
|
'observation': value['observation'],
|
|
73
|
+
'stop_reason': value['stopReason'],
|
|
74
|
+
'summary_text': value['summaryText'],
|
|
75
|
+
'original_token_count': value['originalTokenCount'],
|
|
76
|
+
'context_limit': value['contextLimit'],
|
|
77
|
+
'provider': value['provider'],
|
|
62
78
|
'error': value['error'],
|
|
63
79
|
'usage': (0, TokenUsage_1.TokenUsageToJSON)(value['usage']),
|
|
64
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SseChunk.js","sourceRoot":"","sources":["../../../../src/generated/src/models/SseChunk.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;
|
|
1
|
+
{"version":3,"file":"SseChunk.js","sourceRoot":"","sources":["../../../../src/generated/src/models/SseChunk.ts"],"names":[],"mappings":";AAAA,oBAAoB;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C,CAAC,CAAC,IAAA,+BAAkB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACjF,CAAC;AACN,CAAC;AAED,SAAgB,cAAc,CAAC,IAAS;IACpC,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAuB,EAAE,sBAA+B,KAAK;IAC7F,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO;QAEH,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;QACrB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC;QAChC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;QACvB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;QACrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC;QAC9B,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC;QAChC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC;QACnC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC;QAClC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;QACpC,sBAAsB,EAAE,KAAK,CAAC,oBAAoB,CAAC;QACnD,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC;QACtC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;QAC7B,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;QACvB,OAAO,EAAE,IAAA,6BAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5C,CAAC;AACN,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fetch Hive Public API
|
|
3
3
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document: 0.2.
|
|
5
|
+
* The version of the OpenAPI document: 0.2.4
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fetch Hive Public API
|
|
6
6
|
* The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document: 0.2.
|
|
8
|
+
* The version of the OpenAPI document: 0.2.4
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
package/dist/streaming.d.ts
CHANGED
|
@@ -10,31 +10,56 @@
|
|
|
10
10
|
* body: JSON.stringify({ agent: 'my-agent', message: 'Hello', streaming: true }),
|
|
11
11
|
* });
|
|
12
12
|
* for await (const chunk of parseSse<SseChunk>(res)) {
|
|
13
|
-
* if (chunk.type === '
|
|
13
|
+
* if (chunk.type === 'response') process.stdout.write(chunk.response ?? '');
|
|
14
|
+
* if (chunk.type === 'usage') console.log('\nUsage:', chunk.usage);
|
|
14
15
|
* }
|
|
15
16
|
*/
|
|
16
17
|
export interface SseChunk {
|
|
17
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Event type discriminator. Known values:
|
|
20
|
+
* - "reasoning" — thinking/reasoning chunk (prompt and agent streams)
|
|
21
|
+
* - "response" — text output chunk (prompt and agent streams)
|
|
22
|
+
* - "tool" — tool invocation and result (agent stream only)
|
|
23
|
+
* - "usage" — final token usage; signals end of meaningful stream content
|
|
24
|
+
* - "summary" — conversation history summarization (agent stream only)
|
|
25
|
+
* - "error" — server-side streaming error
|
|
26
|
+
*/
|
|
18
27
|
type: string;
|
|
19
|
-
/** Text
|
|
20
|
-
|
|
21
|
-
/** Present on
|
|
28
|
+
/** Text content of the chunk. Present for "response" and "reasoning" events. */
|
|
29
|
+
response?: string;
|
|
30
|
+
/** Unique request identifier. Present on most events; always present on "usage". */
|
|
22
31
|
request_id?: string;
|
|
23
|
-
/** Present on
|
|
32
|
+
/** Model identifier. Present on "response" and "reasoning" events (prompt stream). */
|
|
24
33
|
model?: string;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Per-chunk boolean flag on "response" and "reasoning" events (agent stream).
|
|
36
|
+
* Not a terminal event type — use the "usage" event to detect end of stream.
|
|
37
|
+
*/
|
|
38
|
+
done?: boolean;
|
|
39
|
+
/** Unique tool invocation identifier. Present for "tool" events. */
|
|
40
|
+
tool_id?: string;
|
|
41
|
+
/** Tool name. Present for "tool" events (e.g. "google_search"). */
|
|
42
|
+
tool?: string;
|
|
43
|
+
/** Internal tool type identifier. Present for "tool" events. */
|
|
44
|
+
tool_type?: string;
|
|
45
|
+
/** Parsed tool input arguments. Present for "tool" events. */
|
|
46
|
+
tool_input?: Record<string, unknown>;
|
|
47
|
+
/** Serialised JSON tool result. Present for "tool" events. */
|
|
30
48
|
observation?: string;
|
|
31
|
-
/**
|
|
49
|
+
/** Reason the stream ended. Present on "usage" events (e.g. "completed"). */
|
|
50
|
+
stop_reason?: string;
|
|
51
|
+
/** Compressed summary of the prior conversation. Present for "summary" events. */
|
|
52
|
+
summary_text?: string;
|
|
53
|
+
/** Token count before summarization. Present for "summary" events. */
|
|
54
|
+
original_token_count?: number;
|
|
55
|
+
/** Model context window size. Present for "summary" events. */
|
|
56
|
+
context_limit?: number;
|
|
57
|
+
/** LLM provider used for summarization. Present for "summary" events. */
|
|
58
|
+
provider?: string;
|
|
59
|
+
/** Error message. Present for "error" events. */
|
|
32
60
|
error?: string;
|
|
33
|
-
usage
|
|
34
|
-
|
|
35
|
-
completion_tokens?: number;
|
|
36
|
-
total_tokens?: number;
|
|
37
|
-
};
|
|
61
|
+
/** Token usage breakdown. Present on "usage" events. */
|
|
62
|
+
usage?: Record<string, unknown>;
|
|
38
63
|
}
|
|
39
64
|
/**
|
|
40
65
|
* Async generator that parses a `text/event-stream` HTTP response and
|
package/dist/streaming.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,QAAQ;IACvB;;;;;;;;OAQG;IACH,IAAI,EAAE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: 'Hello', streaming: true }),
|
|
12
12
|
* });
|
|
13
13
|
* for await (const chunk of parseSse<SseChunk>(res)) {
|
|
14
|
-
* if (chunk.type === '
|
|
14
|
+
* if (chunk.type === 'response') process.stdout.write(chunk.response ?? '');
|
|
15
|
+
* if (chunk.type === 'usage') console.log('\nUsage:', chunk.usage);
|
|
15
16
|
* }
|
|
16
17
|
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/streaming.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.js","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"streaming.js","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAwDH,4BAqCC;AAMD,gCAMC;AAvDD;;;;;GAKG;AACI,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAe,GAAa;IACzD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,SAAS,CAAC;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI;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