@agentforge/core 0.16.28 → 0.16.29
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/dist/index.cjs +7 -11
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +7 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4290,28 +4290,24 @@ function createSSEFormatter(options = {}) {
|
|
|
4290
4290
|
yield formatSSEEvent({ data: "", retry: retry2 });
|
|
4291
4291
|
}
|
|
4292
4292
|
for await (const item of stream) {
|
|
4293
|
-
let
|
|
4294
|
-
|
|
4295
|
-
for (const [type, mapper] of Object.entries(eventTypes)) {
|
|
4293
|
+
let matchedEvent;
|
|
4294
|
+
for (const [, mapper] of Object.entries(eventTypes)) {
|
|
4296
4295
|
try {
|
|
4297
4296
|
const mapped = mapper(item);
|
|
4298
4297
|
if (mapped) {
|
|
4299
|
-
|
|
4298
|
+
matchedEvent = {
|
|
4300
4299
|
...mapped,
|
|
4301
4300
|
id: String(++lastEventId)
|
|
4302
4301
|
};
|
|
4303
|
-
matched = true;
|
|
4304
4302
|
break;
|
|
4305
4303
|
}
|
|
4306
4304
|
} catch {
|
|
4307
4305
|
}
|
|
4308
4306
|
}
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
};
|
|
4314
|
-
}
|
|
4307
|
+
const event = matchedEvent ?? {
|
|
4308
|
+
data: JSON.stringify(item),
|
|
4309
|
+
id: String(++lastEventId)
|
|
4310
|
+
};
|
|
4315
4311
|
yield formatSSEEvent(event);
|
|
4316
4312
|
if (heartbeatInterval) {
|
|
4317
4313
|
clearInterval(heartbeatInterval);
|
package/dist/index.d.cts
CHANGED
|
@@ -4587,9 +4587,10 @@ interface SSEEvent {
|
|
|
4587
4587
|
/**
|
|
4588
4588
|
* SSE formatter options
|
|
4589
4589
|
*/
|
|
4590
|
-
|
|
4590
|
+
type SSEEventMapper<TData = unknown> = (data: TData) => SSEEvent;
|
|
4591
|
+
interface SSEFormatterOptions<T = unknown> {
|
|
4591
4592
|
/** Event type mappers */
|
|
4592
|
-
eventTypes?: Record<string,
|
|
4593
|
+
eventTypes?: Record<string, SSEEventMapper<T>>;
|
|
4593
4594
|
/** Heartbeat interval (ms) */
|
|
4594
4595
|
heartbeat?: number;
|
|
4595
4596
|
/** Default retry interval (ms) */
|
|
@@ -4598,7 +4599,7 @@ interface SSEFormatterOptions<T = any> {
|
|
|
4598
4599
|
/**
|
|
4599
4600
|
* SSE formatter interface
|
|
4600
4601
|
*/
|
|
4601
|
-
interface SSEFormatter<T =
|
|
4602
|
+
interface SSEFormatter<T = unknown> {
|
|
4602
4603
|
/** Format stream as SSE events */
|
|
4603
4604
|
format(stream: AsyncIterable<T>): AsyncIterable<string>;
|
|
4604
4605
|
}
|
|
@@ -4862,7 +4863,7 @@ declare function createProgressTracker(options: ProgressTrackerOptions): Progres
|
|
|
4862
4863
|
* res.end();
|
|
4863
4864
|
* ```
|
|
4864
4865
|
*/
|
|
4865
|
-
declare function createSSEFormatter<T =
|
|
4866
|
+
declare function createSSEFormatter<T = unknown>(options?: SSEFormatterOptions<T>): SSEFormatter<T>;
|
|
4866
4867
|
/**
|
|
4867
4868
|
* Create a heartbeat comment for SSE
|
|
4868
4869
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4587,9 +4587,10 @@ interface SSEEvent {
|
|
|
4587
4587
|
/**
|
|
4588
4588
|
* SSE formatter options
|
|
4589
4589
|
*/
|
|
4590
|
-
|
|
4590
|
+
type SSEEventMapper<TData = unknown> = (data: TData) => SSEEvent;
|
|
4591
|
+
interface SSEFormatterOptions<T = unknown> {
|
|
4591
4592
|
/** Event type mappers */
|
|
4592
|
-
eventTypes?: Record<string,
|
|
4593
|
+
eventTypes?: Record<string, SSEEventMapper<T>>;
|
|
4593
4594
|
/** Heartbeat interval (ms) */
|
|
4594
4595
|
heartbeat?: number;
|
|
4595
4596
|
/** Default retry interval (ms) */
|
|
@@ -4598,7 +4599,7 @@ interface SSEFormatterOptions<T = any> {
|
|
|
4598
4599
|
/**
|
|
4599
4600
|
* SSE formatter interface
|
|
4600
4601
|
*/
|
|
4601
|
-
interface SSEFormatter<T =
|
|
4602
|
+
interface SSEFormatter<T = unknown> {
|
|
4602
4603
|
/** Format stream as SSE events */
|
|
4603
4604
|
format(stream: AsyncIterable<T>): AsyncIterable<string>;
|
|
4604
4605
|
}
|
|
@@ -4862,7 +4863,7 @@ declare function createProgressTracker(options: ProgressTrackerOptions): Progres
|
|
|
4862
4863
|
* res.end();
|
|
4863
4864
|
* ```
|
|
4864
4865
|
*/
|
|
4865
|
-
declare function createSSEFormatter<T =
|
|
4866
|
+
declare function createSSEFormatter<T = unknown>(options?: SSEFormatterOptions<T>): SSEFormatter<T>;
|
|
4866
4867
|
/**
|
|
4867
4868
|
* Create a heartbeat comment for SSE
|
|
4868
4869
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4115,28 +4115,24 @@ function createSSEFormatter(options = {}) {
|
|
|
4115
4115
|
yield formatSSEEvent({ data: "", retry: retry2 });
|
|
4116
4116
|
}
|
|
4117
4117
|
for await (const item of stream) {
|
|
4118
|
-
let
|
|
4119
|
-
|
|
4120
|
-
for (const [type, mapper] of Object.entries(eventTypes)) {
|
|
4118
|
+
let matchedEvent;
|
|
4119
|
+
for (const [, mapper] of Object.entries(eventTypes)) {
|
|
4121
4120
|
try {
|
|
4122
4121
|
const mapped = mapper(item);
|
|
4123
4122
|
if (mapped) {
|
|
4124
|
-
|
|
4123
|
+
matchedEvent = {
|
|
4125
4124
|
...mapped,
|
|
4126
4125
|
id: String(++lastEventId)
|
|
4127
4126
|
};
|
|
4128
|
-
matched = true;
|
|
4129
4127
|
break;
|
|
4130
4128
|
}
|
|
4131
4129
|
} catch {
|
|
4132
4130
|
}
|
|
4133
4131
|
}
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
};
|
|
4139
|
-
}
|
|
4132
|
+
const event = matchedEvent ?? {
|
|
4133
|
+
data: JSON.stringify(item),
|
|
4134
|
+
id: String(++lastEventId)
|
|
4135
|
+
};
|
|
4140
4136
|
yield formatSSEEvent(event);
|
|
4141
4137
|
if (heartbeatInterval) {
|
|
4142
4138
|
clearInterval(heartbeatInterval);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge/core",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.29",
|
|
4
4
|
"description": "Production-ready TypeScript agent framework built on LangGraph with orchestration, middleware, and typed abstractions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|