@cogitator-ai/next 0.2.12 → 0.3.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 +40 -13
- package/dist/client/http-error.d.ts +6 -0
- package/dist/client/http-error.d.ts.map +1 -0
- package/dist/client/http-error.js +26 -0
- package/dist/client/http-error.js.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/retry.d.ts +2 -1
- package/dist/client/retry.d.ts.map +1 -1
- package/dist/client/retry.js +37 -11
- package/dist/client/retry.js.map +1 -1
- package/dist/client/sse-parser.d.ts.map +1 -1
- package/dist/client/sse-parser.js +29 -28
- package/dist/client/sse-parser.js.map +1 -1
- package/dist/client/use-agent.d.ts.map +1 -1
- package/dist/client/use-agent.js +29 -6
- package/dist/client/use-agent.js.map +1 -1
- package/dist/client/use-chat.d.ts.map +1 -1
- package/dist/client/use-chat.js +130 -96
- package/dist/client/use-chat.js.map +1 -1
- package/dist/handlers/agent.d.ts.map +1 -1
- package/dist/handlers/agent.js +33 -35
- package/dist/handlers/agent.js.map +1 -1
- package/dist/handlers/chat.d.ts.map +1 -1
- package/dist/handlers/chat.js +124 -70
- package/dist/handlers/chat.js.map +1 -1
- package/dist/handlers/http.d.ts +15 -0
- package/dist/handlers/http.d.ts.map +1 -0
- package/dist/handlers/http.js +66 -0
- package/dist/handlers/http.js.map +1 -0
- package/dist/streaming/protocol.d.ts +2 -1
- package/dist/streaming/protocol.d.ts.map +1 -1
- package/dist/streaming/protocol.js +2 -2
- package/dist/streaming/protocol.js.map +1 -1
- package/dist/streaming/stream-writer.d.ts +2 -1
- package/dist/streaming/stream-writer.d.ts.map +1 -1
- package/dist/streaming/stream-writer.js +12 -3
- package/dist/streaming/stream-writer.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @cogitator-ai/next
|
|
2
2
|
|
|
3
|
-
Next.js App Router integration for Cogitator AI runtime. Provides streaming chat handlers and React hooks
|
|
3
|
+
Next.js App Router integration for Cogitator AI runtime. Provides streaming chat handlers, a batch agent handler, and React hooks that speak a typed SSE protocol modeled on the Vercel AI SDK event stream.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -19,11 +19,15 @@ import { createChatHandler } from '@cogitator-ai/next';
|
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
|
|
21
21
|
const cogitator = new Cogitator({
|
|
22
|
-
|
|
22
|
+
llm: {
|
|
23
|
+
defaultModel: 'openai/gpt-4o-mini',
|
|
24
|
+
providers: { openai: { apiKey: process.env.OPENAI_API_KEY! } },
|
|
25
|
+
},
|
|
23
26
|
});
|
|
24
27
|
|
|
25
28
|
const agent = new Agent({
|
|
26
29
|
name: 'assistant',
|
|
30
|
+
model: 'openai/gpt-4o-mini',
|
|
27
31
|
instructions: 'You are a helpful assistant.',
|
|
28
32
|
tools: [
|
|
29
33
|
tool({
|
|
@@ -83,7 +87,13 @@ export function Chat() {
|
|
|
83
87
|
|
|
84
88
|
### `createChatHandler`
|
|
85
89
|
|
|
86
|
-
Creates a streaming chat handler
|
|
90
|
+
Creates a streaming chat handler. The handler:
|
|
91
|
+
|
|
92
|
+
- runs the agent with token streaming enabled and forwards `text-*`, `tool-*` and `finish` events as they happen
|
|
93
|
+
- uses the **last user message** as the run input; conversation history is carried by `threadId` (configure `memory` on the `Cogitator` instance) — the server returns the thread id in the `finish` event and `useCogitatorChat` adopts it automatically
|
|
94
|
+
- passes request `metadata` to the run as `context`
|
|
95
|
+
- aborts the run when the client disconnects (`req.signal`)
|
|
96
|
+
- validates the body (JSON object, `messages` array, string `threadId`, object `metadata`), limits it to 1 MB (413 otherwise) and returns `400` when there is no user message
|
|
87
97
|
|
|
88
98
|
```typescript
|
|
89
99
|
import { createChatHandler } from '@cogitator-ai/next';
|
|
@@ -99,13 +109,17 @@ export const POST = createChatHandler(cogitator, agent, {
|
|
|
99
109
|
};
|
|
100
110
|
},
|
|
101
111
|
|
|
102
|
-
// Pre-processing hook
|
|
112
|
+
// Pre-processing hook — the returned object is merged into the run options
|
|
113
|
+
// (e.g. userId, threadId, timeout). Streaming callbacks and the abort
|
|
114
|
+
// signal are always managed by the handler. Throw an error with a `status`
|
|
115
|
+
// property to reject the request with that status (default 401).
|
|
103
116
|
beforeRun: async (req, input) => {
|
|
104
117
|
console.log('Starting chat with', input.messages.length, 'messages');
|
|
105
|
-
return { userId: 'user-123' };
|
|
118
|
+
return { userId: 'user-123' };
|
|
106
119
|
},
|
|
107
120
|
|
|
108
|
-
// Post-processing hook
|
|
121
|
+
// Post-processing hook — runs before the `finish` event; if it throws,
|
|
122
|
+
// the client receives an `error` event instead of `finish`
|
|
109
123
|
afterRun: async (result) => {
|
|
110
124
|
console.log('Chat completed:', result.output);
|
|
111
125
|
},
|
|
@@ -114,7 +128,7 @@ export const POST = createChatHandler(cogitator, agent, {
|
|
|
114
128
|
|
|
115
129
|
### `createAgentHandler`
|
|
116
130
|
|
|
117
|
-
Creates a batch (non-streaming) handler for long-running tasks.
|
|
131
|
+
Creates a batch (non-streaming) handler for long-running tasks. The default parser requires a non-blank string `input`, an optional object `context` and an optional string `threadId` (400 otherwise). The run is aborted if the client disconnects.
|
|
118
132
|
|
|
119
133
|
```typescript
|
|
120
134
|
import { createAgentHandler } from '@cogitator-ai/next';
|
|
@@ -142,7 +156,8 @@ Response format:
|
|
|
142
156
|
"outputTokens": 500,
|
|
143
157
|
"totalTokens": 650
|
|
144
158
|
},
|
|
145
|
-
"toolCalls": [...]
|
|
159
|
+
"toolCalls": [...],
|
|
160
|
+
"trace": { "traceId": "trace-xyz", "spans": [...] }
|
|
146
161
|
}
|
|
147
162
|
```
|
|
148
163
|
|
|
@@ -199,7 +214,7 @@ const {
|
|
|
199
214
|
// Basic send
|
|
200
215
|
await send('Hello!');
|
|
201
216
|
|
|
202
|
-
// Send with metadata (passed to server)
|
|
217
|
+
// Send with metadata (passed to the run as `context` on the server)
|
|
203
218
|
await send('Analyze this', {
|
|
204
219
|
userId: 'user-123',
|
|
205
220
|
priority: 'high',
|
|
@@ -266,7 +281,7 @@ console.log(result?.toolCalls);
|
|
|
266
281
|
|
|
267
282
|
## Streaming Protocol
|
|
268
283
|
|
|
269
|
-
The
|
|
284
|
+
The chat handler streams Server-Sent Events. The event names follow the Vercel AI SDK event-stream style, but the payloads are Cogitator's own (`tool-call-*`, `message` on errors, `usage`/`threadId` on finish), so use `useCogitatorChat` (or your own parser) on the client rather than the AI SDK's `useChat`:
|
|
270
285
|
|
|
271
286
|
```
|
|
272
287
|
data: {"type":"start","messageId":"msg-1"}
|
|
@@ -287,11 +302,20 @@ data: {"type":"tool-call-end","id":"tool-1"}
|
|
|
287
302
|
|
|
288
303
|
data: {"type":"tool-result","id":"tr-1","toolCallId":"tool-1","result":"72°F"}
|
|
289
304
|
|
|
290
|
-
data: {"type":"finish","messageId":"msg-1","usage":{...}}
|
|
305
|
+
data: {"type":"finish","messageId":"msg-1","usage":{...},"threadId":"thread-abc"}
|
|
291
306
|
|
|
292
307
|
data: [DONE]
|
|
293
308
|
```
|
|
294
309
|
|
|
310
|
+
If the run fails, the open text block is closed and an `{"type":"error","message":"..."}` event is sent instead of `finish`.
|
|
311
|
+
|
|
312
|
+
The server-side building blocks are exported for custom handlers:
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
import { StreamWriter, encodeSSE, generateId } from '@cogitator-ai/next';
|
|
316
|
+
import type { StreamEvent, Usage } from '@cogitator-ai/next';
|
|
317
|
+
```
|
|
318
|
+
|
|
295
319
|
## Types
|
|
296
320
|
|
|
297
321
|
```typescript
|
|
@@ -319,6 +343,7 @@ interface AgentResponse {
|
|
|
319
343
|
totalTokens: number;
|
|
320
344
|
};
|
|
321
345
|
toolCalls: ToolCall[];
|
|
346
|
+
trace?: { traceId: string; spans: unknown[] };
|
|
322
347
|
}
|
|
323
348
|
|
|
324
349
|
interface RetryConfig {
|
|
@@ -345,7 +370,9 @@ if (error) {
|
|
|
345
370
|
}
|
|
346
371
|
```
|
|
347
372
|
|
|
348
|
-
|
|
373
|
+
HTTP failures are thrown as `HttpError` (exported from `@cogitator-ai/next/client`) with a `status` property and a message like `Request failed: 400 - No user message provided`. Stream-level `error` events call `onError` and skip `onFinish`.
|
|
374
|
+
|
|
375
|
+
With retry enabled, transient errors (network failures, 408/429/502/503/504) are automatically retried; the backoff wait is cancelled by `stop()`:
|
|
349
376
|
|
|
350
377
|
```typescript
|
|
351
378
|
useCogitatorChat({
|
|
@@ -360,7 +387,7 @@ useCogitatorChat({
|
|
|
360
387
|
|
|
361
388
|
## Cancellation
|
|
362
389
|
|
|
363
|
-
Stop ongoing requests with the `stop()` function
|
|
390
|
+
Stop ongoing requests with the `stop()` function. The partial assistant message is kept in `messages`, and the server aborts the agent run when the connection closes. Calling `send()` while a response is streaming interrupts it the same way. Pending requests are aborted when the component unmounts; `useCogitatorAgent` aborts a previous `run()` when a new one starts and on `reset()`.
|
|
364
391
|
|
|
365
392
|
```typescript
|
|
366
393
|
const { send, stop, isLoading } = useCogitatorChat({ api: '/api/chat' });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../src/client/http-error.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAaD,wBAAsB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAIxE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class HttpError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
constructor(status, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'HttpError';
|
|
6
|
+
this.status = status;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function extractErrorDetail(text) {
|
|
10
|
+
try {
|
|
11
|
+
const parsed = JSON.parse(text);
|
|
12
|
+
if (typeof parsed === 'object' && parsed !== null && 'error' in parsed) {
|
|
13
|
+
const { error } = parsed;
|
|
14
|
+
if (typeof error === 'string' && error)
|
|
15
|
+
return error;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch { }
|
|
19
|
+
return text;
|
|
20
|
+
}
|
|
21
|
+
export async function toHttpError(response) {
|
|
22
|
+
const text = await response.text().catch(() => '');
|
|
23
|
+
const detail = extractErrorDetail(text.trim()) || response.statusText || 'Unknown error';
|
|
24
|
+
return new HttpError(response.status, `Request failed: ${response.status} - ${detail}`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=http-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../src/client/http-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAS;IAExB,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACvE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;QACvD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IACV,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAkB;IAClD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,QAAQ,CAAC,UAAU,IAAI,eAAe,CAAC;IACzF,OAAO,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,QAAQ,CAAC,MAAM,MAAM,MAAM,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useCogitatorChat } from './use-chat.js';
|
|
2
2
|
export { useCogitatorAgent } from './use-agent.js';
|
|
3
|
+
export { HttpError } from './http-error.js';
|
|
3
4
|
export type { ChatMessage, ToolCall, UseChatOptions, UseChatReturn, AgentInput, AgentResponse, UseAgentOptions, UseAgentReturn, RetryConfig, ToolResultEvent, } from '../types.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,YAAY,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
package/dist/client/index.js
CHANGED
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/client/retry.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { RetryConfig } from '../types.js';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function isRetryableError(error: unknown): boolean;
|
|
3
|
+
export declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig, signal?: AbortSignal): Promise<T>;
|
|
3
4
|
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/client/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/client/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA6C/C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAexD;AAED,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,CAAC,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,CAAC,CAcZ"}
|
package/dist/client/retry.js
CHANGED
|
@@ -1,21 +1,50 @@
|
|
|
1
|
+
import { HttpError } from './http-error.js';
|
|
1
2
|
const DEFAULT_RETRY_CONFIG = {
|
|
2
3
|
maxRetries: 0,
|
|
3
4
|
delay: 1000,
|
|
4
5
|
backoff: 'exponential',
|
|
5
6
|
};
|
|
7
|
+
const RETRYABLE_STATUSES = new Set([408, 429, 502, 503, 504]);
|
|
6
8
|
function getDelay(attempt, config) {
|
|
7
9
|
if (config.backoff === 'linear') {
|
|
8
10
|
return config.delay * attempt;
|
|
9
11
|
}
|
|
10
12
|
return config.delay * Math.pow(2, attempt - 1);
|
|
11
13
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
+
function abortReason(signal) {
|
|
15
|
+
return signal.reason instanceof Error
|
|
16
|
+
? signal.reason
|
|
17
|
+
: new DOMException('The operation was aborted.', 'AbortError');
|
|
14
18
|
}
|
|
15
|
-
function
|
|
19
|
+
function sleep(ms, signal) {
|
|
20
|
+
if (!signal) {
|
|
21
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
22
|
+
}
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
if (signal.aborted) {
|
|
25
|
+
reject(abortReason(signal));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const onAbort = () => {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
reject(abortReason(signal));
|
|
31
|
+
};
|
|
32
|
+
const timer = setTimeout(() => {
|
|
33
|
+
signal.removeEventListener('abort', onAbort);
|
|
34
|
+
resolve();
|
|
35
|
+
}, ms);
|
|
36
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export function isRetryableError(error) {
|
|
40
|
+
if (error instanceof HttpError) {
|
|
41
|
+
return RETRYABLE_STATUSES.has(error.status);
|
|
42
|
+
}
|
|
16
43
|
if (error instanceof Error) {
|
|
17
44
|
if (error.name === 'AbortError')
|
|
18
45
|
return false;
|
|
46
|
+
if (error instanceof TypeError)
|
|
47
|
+
return true;
|
|
19
48
|
const message = error.message.toLowerCase();
|
|
20
49
|
if (message.includes('network') || message.includes('fetch'))
|
|
21
50
|
return true;
|
|
@@ -26,22 +55,19 @@ function isRetryableError(error) {
|
|
|
26
55
|
}
|
|
27
56
|
return false;
|
|
28
57
|
}
|
|
29
|
-
export async function withRetry(fn, config) {
|
|
58
|
+
export async function withRetry(fn, config, signal) {
|
|
30
59
|
const cfg = { ...DEFAULT_RETRY_CONFIG, ...config };
|
|
31
|
-
|
|
32
|
-
for (let attempt = 0
|
|
60
|
+
const maxRetries = Number.isFinite(cfg.maxRetries) ? Math.max(0, Math.floor(cfg.maxRetries)) : 0;
|
|
61
|
+
for (let attempt = 0;; attempt++) {
|
|
33
62
|
try {
|
|
34
63
|
return await fn();
|
|
35
64
|
}
|
|
36
65
|
catch (error) {
|
|
37
|
-
|
|
38
|
-
if (attempt === cfg.maxRetries || !isRetryableError(error)) {
|
|
66
|
+
if (attempt >= maxRetries || signal?.aborted || !isRetryableError(error)) {
|
|
39
67
|
throw error;
|
|
40
68
|
}
|
|
41
|
-
|
|
42
|
-
await sleep(delay);
|
|
69
|
+
await sleep(getDelay(attempt + 1, cfg), signal);
|
|
43
70
|
}
|
|
44
71
|
}
|
|
45
|
-
throw lastError;
|
|
46
72
|
}
|
|
47
73
|
//# sourceMappingURL=retry.js.map
|
package/dist/client/retry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/client/retry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/client/retry.ts"],"names":[],"mappings":"AACA,OAAO,EAA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EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjG,KAAK,IAAI,OAAO,GAAG,CAAC,GAAI,OAAO,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,OAAO,IAAI,UAAU,IAAI,MAAM,EAAE,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzE,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,KAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../src/client/sse-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../src/client/sse-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAqB5D,wBAAuB,cAAc,CACnC,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,GAC9C,cAAc,CAAC,WAAW,CAAC,CAyB7B"}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
function parseLine(line) {
|
|
2
|
+
const trimmed = line.trim();
|
|
3
|
+
if (!trimmed || trimmed.startsWith(':') || !trimmed.startsWith('data:')) {
|
|
4
|
+
return { done: false };
|
|
5
|
+
}
|
|
6
|
+
const data = trimmed.slice(5).trimStart();
|
|
7
|
+
if (data === '[DONE]')
|
|
8
|
+
return { done: true };
|
|
9
|
+
try {
|
|
10
|
+
return { done: false, event: JSON.parse(data) };
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
console.warn('[cogitator] Failed to parse SSE data:', data);
|
|
14
|
+
return { done: false };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
1
17
|
export async function* parseSSEStream(reader) {
|
|
2
18
|
const decoder = new TextDecoder();
|
|
3
19
|
let buffer = '';
|
|
4
|
-
|
|
20
|
+
for (;;) {
|
|
5
21
|
const { done, value } = await reader.read();
|
|
6
22
|
if (done)
|
|
7
23
|
break;
|
|
@@ -9,35 +25,20 @@ export async function* parseSSEStream(reader) {
|
|
|
9
25
|
const lines = buffer.split('\n');
|
|
10
26
|
buffer = lines.pop() ?? '';
|
|
11
27
|
for (const line of lines) {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
if (data === '[DONE]')
|
|
18
|
-
return;
|
|
19
|
-
try {
|
|
20
|
-
yield JSON.parse(data);
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
console.warn('[cogitator] Failed to parse SSE data:', data);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
28
|
+
const result = parseLine(line);
|
|
29
|
+
if (result.done)
|
|
30
|
+
return;
|
|
31
|
+
if (result.event)
|
|
32
|
+
yield result.event;
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
console.warn('[cogitator] Failed to parse SSE data:', data);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
35
|
+
buffer += decoder.decode();
|
|
36
|
+
for (const line of buffer.split('\n')) {
|
|
37
|
+
const result = parseLine(line);
|
|
38
|
+
if (result.done)
|
|
39
|
+
return;
|
|
40
|
+
if (result.event)
|
|
41
|
+
yield result.event;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
//# sourceMappingURL=sse-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse-parser.js","sourceRoot":"","sources":["../../src/client/sse-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sse-parser.js","sourceRoot":"","sources":["../../src/client/sse-parser.ts"],"names":[],"mappings":"AAIA,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC1C,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAE7C,IAAI,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB,EAAE,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,IAAI,CAAC,CAAC;QAC5D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,cAAc,CACnC,MAA+C;IAE/C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,SAAS,CAAC;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI;YAAE,MAAM;QAEhB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAE3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,MAAM,CAAC,IAAI;gBAAE,OAAO;YACxB,IAAI,MAAM,CAAC,KAAK;gBAAE,MAAM,MAAM,CAAC,KAAK,CAAC;QACvC,CAAC;IACH,CAAC;IAED,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,MAAM,CAAC,IAAI;YAAE,OAAO;QACxB,IAAI,MAAM,CAAC,KAAK;YAAE,MAAM,MAAM,CAAC,KAAK,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../src/client/use-agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA6B,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../src/client/use-agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA6B,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI9F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CA+E1E"}
|
package/dist/client/use-agent.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useState, useCallback } from 'react';
|
|
2
|
+
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { withRetry } from './retry.js';
|
|
4
|
+
import { toHttpError } from './http-error.js';
|
|
4
5
|
export function useCogitatorAgent(options) {
|
|
5
6
|
const { api, headers, onError, onSuccess, retry } = options;
|
|
6
7
|
const [result, setResult] = useState(null);
|
|
7
8
|
const [isLoading, setIsLoading] = useState(false);
|
|
8
9
|
const [error, setError] = useState(null);
|
|
10
|
+
const activeRequestRef = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
return () => {
|
|
13
|
+
activeRequestRef.current?.abort();
|
|
14
|
+
activeRequestRef.current = null;
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
9
17
|
const run = useCallback(async (input) => {
|
|
18
|
+
activeRequestRef.current?.abort();
|
|
19
|
+
const controller = new AbortController();
|
|
20
|
+
activeRequestRef.current = controller;
|
|
10
21
|
setIsLoading(true);
|
|
11
22
|
setError(null);
|
|
12
23
|
const executeRequest = async () => {
|
|
@@ -17,30 +28,42 @@ export function useCogitatorAgent(options) {
|
|
|
17
28
|
...headers,
|
|
18
29
|
},
|
|
19
30
|
body: JSON.stringify(input),
|
|
31
|
+
signal: controller.signal,
|
|
20
32
|
});
|
|
21
33
|
if (!response.ok) {
|
|
22
|
-
|
|
23
|
-
throw new Error(`Request failed: ${response.status} - ${errorText}`);
|
|
34
|
+
throw await toHttpError(response);
|
|
24
35
|
}
|
|
25
|
-
return response.json();
|
|
36
|
+
return (await response.json());
|
|
26
37
|
};
|
|
27
38
|
try {
|
|
28
|
-
const data = await withRetry(executeRequest, retry);
|
|
39
|
+
const data = await withRetry(executeRequest, retry, controller.signal);
|
|
40
|
+
if (activeRequestRef.current !== controller)
|
|
41
|
+
return;
|
|
29
42
|
setResult(data);
|
|
30
43
|
onSuccess?.(data);
|
|
31
44
|
}
|
|
32
45
|
catch (err) {
|
|
46
|
+
if (activeRequestRef.current !== controller)
|
|
47
|
+
return;
|
|
48
|
+
if (err instanceof Error && err.name === 'AbortError')
|
|
49
|
+
return;
|
|
33
50
|
const e = err instanceof Error ? err : new Error(String(err));
|
|
34
51
|
setError(e);
|
|
35
52
|
onError?.(e);
|
|
36
53
|
}
|
|
37
54
|
finally {
|
|
38
|
-
|
|
55
|
+
if (activeRequestRef.current === controller) {
|
|
56
|
+
activeRequestRef.current = null;
|
|
57
|
+
setIsLoading(false);
|
|
58
|
+
}
|
|
39
59
|
}
|
|
40
60
|
}, [api, headers, onError, onSuccess, retry]);
|
|
41
61
|
const reset = useCallback(() => {
|
|
62
|
+
activeRequestRef.current?.abort();
|
|
63
|
+
activeRequestRef.current = null;
|
|
42
64
|
setResult(null);
|
|
43
65
|
setError(null);
|
|
66
|
+
setIsLoading(false);
|
|
44
67
|
}, []);
|
|
45
68
|
return {
|
|
46
69
|
run,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent.js","sourceRoot":"","sources":["../../src/client/use-agent.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-agent.js","sourceRoot":"","sources":["../../src/client/use-agent.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,UAAU,iBAAiB,CAAC,OAAwB;IACxD,MAAM,EAAE,GAAG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AAC;QAChB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,GAAG;QACH,MAAM;QACN,SAAS;QACT,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../src/client/use-chat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAId,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../src/client/use-chat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAId,MAAM,aAAa,CAAC;AAyCrB,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,CAiSvE"}
|