@agentforge/core 0.16.28 → 0.16.30
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 +15 -16
- package/dist/index.d.cts +27 -9
- package/dist/index.d.ts +27 -9
- package/dist/index.js +15 -16
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3894,11 +3894,7 @@ var AgentError = class _AgentError extends Error {
|
|
|
3894
3894
|
metadata: this.metadata,
|
|
3895
3895
|
timestamp: this.timestamp,
|
|
3896
3896
|
stack: this.stack,
|
|
3897
|
-
cause: this.cause ?
|
|
3898
|
-
name: this.cause.name,
|
|
3899
|
-
message: this.cause.message,
|
|
3900
|
-
stack: this.cause.stack
|
|
3901
|
-
} : void 0
|
|
3897
|
+
cause: this.cause ? toSerializedErrorCause(this.cause) : void 0
|
|
3902
3898
|
};
|
|
3903
3899
|
}
|
|
3904
3900
|
/**
|
|
@@ -3918,6 +3914,13 @@ var AgentError = class _AgentError extends Error {
|
|
|
3918
3914
|
return parts.join("\n");
|
|
3919
3915
|
}
|
|
3920
3916
|
};
|
|
3917
|
+
function toSerializedErrorCause(cause) {
|
|
3918
|
+
return {
|
|
3919
|
+
name: cause.name,
|
|
3920
|
+
message: cause.message,
|
|
3921
|
+
stack: cause.stack
|
|
3922
|
+
};
|
|
3923
|
+
}
|
|
3921
3924
|
var ErrorReporterImpl = class {
|
|
3922
3925
|
options;
|
|
3923
3926
|
constructor(options) {
|
|
@@ -4290,28 +4293,24 @@ function createSSEFormatter(options = {}) {
|
|
|
4290
4293
|
yield formatSSEEvent({ data: "", retry: retry2 });
|
|
4291
4294
|
}
|
|
4292
4295
|
for await (const item of stream) {
|
|
4293
|
-
let
|
|
4294
|
-
|
|
4295
|
-
for (const [type, mapper] of Object.entries(eventTypes)) {
|
|
4296
|
+
let matchedEvent;
|
|
4297
|
+
for (const [, mapper] of Object.entries(eventTypes)) {
|
|
4296
4298
|
try {
|
|
4297
4299
|
const mapped = mapper(item);
|
|
4298
4300
|
if (mapped) {
|
|
4299
|
-
|
|
4301
|
+
matchedEvent = {
|
|
4300
4302
|
...mapped,
|
|
4301
4303
|
id: String(++lastEventId)
|
|
4302
4304
|
};
|
|
4303
|
-
matched = true;
|
|
4304
4305
|
break;
|
|
4305
4306
|
}
|
|
4306
4307
|
} catch {
|
|
4307
4308
|
}
|
|
4308
4309
|
}
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
};
|
|
4314
|
-
}
|
|
4310
|
+
const event = matchedEvent ?? {
|
|
4311
|
+
data: JSON.stringify(item),
|
|
4312
|
+
id: String(++lastEventId)
|
|
4313
|
+
};
|
|
4315
4314
|
yield formatSSEEvent(event);
|
|
4316
4315
|
if (heartbeatInterval) {
|
|
4317
4316
|
clearInterval(heartbeatInterval);
|
package/dist/index.d.cts
CHANGED
|
@@ -4095,6 +4095,23 @@ declare function clearThread(checkpointer: BaseCheckpointSaver, options: {
|
|
|
4095
4095
|
*
|
|
4096
4096
|
* Provides enhanced error classes and error reporting for better debugging.
|
|
4097
4097
|
*/
|
|
4098
|
+
|
|
4099
|
+
type SerializedErrorCause = {
|
|
4100
|
+
name: string;
|
|
4101
|
+
message: string;
|
|
4102
|
+
stack?: string;
|
|
4103
|
+
};
|
|
4104
|
+
type SerializedAgentError = {
|
|
4105
|
+
name: string;
|
|
4106
|
+
message: string;
|
|
4107
|
+
code?: string;
|
|
4108
|
+
node?: string;
|
|
4109
|
+
state?: unknown;
|
|
4110
|
+
metadata?: JsonObject;
|
|
4111
|
+
timestamp: number;
|
|
4112
|
+
stack?: string;
|
|
4113
|
+
cause?: SerializedErrorCause;
|
|
4114
|
+
};
|
|
4098
4115
|
/**
|
|
4099
4116
|
* Error context information
|
|
4100
4117
|
*/
|
|
@@ -4110,11 +4127,11 @@ interface ErrorContext {
|
|
|
4110
4127
|
/**
|
|
4111
4128
|
* Current state when the error occurred
|
|
4112
4129
|
*/
|
|
4113
|
-
state?:
|
|
4130
|
+
state?: unknown;
|
|
4114
4131
|
/**
|
|
4115
4132
|
* Additional metadata
|
|
4116
4133
|
*/
|
|
4117
|
-
metadata?:
|
|
4134
|
+
metadata?: JsonObject;
|
|
4118
4135
|
/**
|
|
4119
4136
|
* Original error that caused this error
|
|
4120
4137
|
*/
|
|
@@ -4126,15 +4143,15 @@ interface ErrorContext {
|
|
|
4126
4143
|
declare class AgentError extends Error {
|
|
4127
4144
|
readonly code?: string;
|
|
4128
4145
|
readonly node?: string;
|
|
4129
|
-
readonly state?:
|
|
4130
|
-
readonly metadata?:
|
|
4146
|
+
readonly state?: unknown;
|
|
4147
|
+
readonly metadata?: JsonObject;
|
|
4131
4148
|
readonly cause?: Error;
|
|
4132
4149
|
readonly timestamp: number;
|
|
4133
4150
|
constructor(message: string, context?: ErrorContext);
|
|
4134
4151
|
/**
|
|
4135
4152
|
* Convert error to JSON for logging/reporting
|
|
4136
4153
|
*/
|
|
4137
|
-
toJSON():
|
|
4154
|
+
toJSON(): SerializedAgentError;
|
|
4138
4155
|
/**
|
|
4139
4156
|
* Get a human-readable string representation
|
|
4140
4157
|
*/
|
|
@@ -4587,9 +4604,10 @@ interface SSEEvent {
|
|
|
4587
4604
|
/**
|
|
4588
4605
|
* SSE formatter options
|
|
4589
4606
|
*/
|
|
4590
|
-
|
|
4607
|
+
type SSEEventMapper<TData = unknown> = (data: TData) => SSEEvent;
|
|
4608
|
+
interface SSEFormatterOptions<T = unknown> {
|
|
4591
4609
|
/** Event type mappers */
|
|
4592
|
-
eventTypes?: Record<string,
|
|
4610
|
+
eventTypes?: Record<string, SSEEventMapper<T>>;
|
|
4593
4611
|
/** Heartbeat interval (ms) */
|
|
4594
4612
|
heartbeat?: number;
|
|
4595
4613
|
/** Default retry interval (ms) */
|
|
@@ -4598,7 +4616,7 @@ interface SSEFormatterOptions<T = any> {
|
|
|
4598
4616
|
/**
|
|
4599
4617
|
* SSE formatter interface
|
|
4600
4618
|
*/
|
|
4601
|
-
interface SSEFormatter<T =
|
|
4619
|
+
interface SSEFormatter<T = unknown> {
|
|
4602
4620
|
/** Format stream as SSE events */
|
|
4603
4621
|
format(stream: AsyncIterable<T>): AsyncIterable<string>;
|
|
4604
4622
|
}
|
|
@@ -4862,7 +4880,7 @@ declare function createProgressTracker(options: ProgressTrackerOptions): Progres
|
|
|
4862
4880
|
* res.end();
|
|
4863
4881
|
* ```
|
|
4864
4882
|
*/
|
|
4865
|
-
declare function createSSEFormatter<T =
|
|
4883
|
+
declare function createSSEFormatter<T = unknown>(options?: SSEFormatterOptions<T>): SSEFormatter<T>;
|
|
4866
4884
|
/**
|
|
4867
4885
|
* Create a heartbeat comment for SSE
|
|
4868
4886
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4095,6 +4095,23 @@ declare function clearThread(checkpointer: BaseCheckpointSaver, options: {
|
|
|
4095
4095
|
*
|
|
4096
4096
|
* Provides enhanced error classes and error reporting for better debugging.
|
|
4097
4097
|
*/
|
|
4098
|
+
|
|
4099
|
+
type SerializedErrorCause = {
|
|
4100
|
+
name: string;
|
|
4101
|
+
message: string;
|
|
4102
|
+
stack?: string;
|
|
4103
|
+
};
|
|
4104
|
+
type SerializedAgentError = {
|
|
4105
|
+
name: string;
|
|
4106
|
+
message: string;
|
|
4107
|
+
code?: string;
|
|
4108
|
+
node?: string;
|
|
4109
|
+
state?: unknown;
|
|
4110
|
+
metadata?: JsonObject;
|
|
4111
|
+
timestamp: number;
|
|
4112
|
+
stack?: string;
|
|
4113
|
+
cause?: SerializedErrorCause;
|
|
4114
|
+
};
|
|
4098
4115
|
/**
|
|
4099
4116
|
* Error context information
|
|
4100
4117
|
*/
|
|
@@ -4110,11 +4127,11 @@ interface ErrorContext {
|
|
|
4110
4127
|
/**
|
|
4111
4128
|
* Current state when the error occurred
|
|
4112
4129
|
*/
|
|
4113
|
-
state?:
|
|
4130
|
+
state?: unknown;
|
|
4114
4131
|
/**
|
|
4115
4132
|
* Additional metadata
|
|
4116
4133
|
*/
|
|
4117
|
-
metadata?:
|
|
4134
|
+
metadata?: JsonObject;
|
|
4118
4135
|
/**
|
|
4119
4136
|
* Original error that caused this error
|
|
4120
4137
|
*/
|
|
@@ -4126,15 +4143,15 @@ interface ErrorContext {
|
|
|
4126
4143
|
declare class AgentError extends Error {
|
|
4127
4144
|
readonly code?: string;
|
|
4128
4145
|
readonly node?: string;
|
|
4129
|
-
readonly state?:
|
|
4130
|
-
readonly metadata?:
|
|
4146
|
+
readonly state?: unknown;
|
|
4147
|
+
readonly metadata?: JsonObject;
|
|
4131
4148
|
readonly cause?: Error;
|
|
4132
4149
|
readonly timestamp: number;
|
|
4133
4150
|
constructor(message: string, context?: ErrorContext);
|
|
4134
4151
|
/**
|
|
4135
4152
|
* Convert error to JSON for logging/reporting
|
|
4136
4153
|
*/
|
|
4137
|
-
toJSON():
|
|
4154
|
+
toJSON(): SerializedAgentError;
|
|
4138
4155
|
/**
|
|
4139
4156
|
* Get a human-readable string representation
|
|
4140
4157
|
*/
|
|
@@ -4587,9 +4604,10 @@ interface SSEEvent {
|
|
|
4587
4604
|
/**
|
|
4588
4605
|
* SSE formatter options
|
|
4589
4606
|
*/
|
|
4590
|
-
|
|
4607
|
+
type SSEEventMapper<TData = unknown> = (data: TData) => SSEEvent;
|
|
4608
|
+
interface SSEFormatterOptions<T = unknown> {
|
|
4591
4609
|
/** Event type mappers */
|
|
4592
|
-
eventTypes?: Record<string,
|
|
4610
|
+
eventTypes?: Record<string, SSEEventMapper<T>>;
|
|
4593
4611
|
/** Heartbeat interval (ms) */
|
|
4594
4612
|
heartbeat?: number;
|
|
4595
4613
|
/** Default retry interval (ms) */
|
|
@@ -4598,7 +4616,7 @@ interface SSEFormatterOptions<T = any> {
|
|
|
4598
4616
|
/**
|
|
4599
4617
|
* SSE formatter interface
|
|
4600
4618
|
*/
|
|
4601
|
-
interface SSEFormatter<T =
|
|
4619
|
+
interface SSEFormatter<T = unknown> {
|
|
4602
4620
|
/** Format stream as SSE events */
|
|
4603
4621
|
format(stream: AsyncIterable<T>): AsyncIterable<string>;
|
|
4604
4622
|
}
|
|
@@ -4862,7 +4880,7 @@ declare function createProgressTracker(options: ProgressTrackerOptions): Progres
|
|
|
4862
4880
|
* res.end();
|
|
4863
4881
|
* ```
|
|
4864
4882
|
*/
|
|
4865
|
-
declare function createSSEFormatter<T =
|
|
4883
|
+
declare function createSSEFormatter<T = unknown>(options?: SSEFormatterOptions<T>): SSEFormatter<T>;
|
|
4866
4884
|
/**
|
|
4867
4885
|
* Create a heartbeat comment for SSE
|
|
4868
4886
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3719,11 +3719,7 @@ var AgentError = class _AgentError extends Error {
|
|
|
3719
3719
|
metadata: this.metadata,
|
|
3720
3720
|
timestamp: this.timestamp,
|
|
3721
3721
|
stack: this.stack,
|
|
3722
|
-
cause: this.cause ?
|
|
3723
|
-
name: this.cause.name,
|
|
3724
|
-
message: this.cause.message,
|
|
3725
|
-
stack: this.cause.stack
|
|
3726
|
-
} : void 0
|
|
3722
|
+
cause: this.cause ? toSerializedErrorCause(this.cause) : void 0
|
|
3727
3723
|
};
|
|
3728
3724
|
}
|
|
3729
3725
|
/**
|
|
@@ -3743,6 +3739,13 @@ var AgentError = class _AgentError extends Error {
|
|
|
3743
3739
|
return parts.join("\n");
|
|
3744
3740
|
}
|
|
3745
3741
|
};
|
|
3742
|
+
function toSerializedErrorCause(cause) {
|
|
3743
|
+
return {
|
|
3744
|
+
name: cause.name,
|
|
3745
|
+
message: cause.message,
|
|
3746
|
+
stack: cause.stack
|
|
3747
|
+
};
|
|
3748
|
+
}
|
|
3746
3749
|
var ErrorReporterImpl = class {
|
|
3747
3750
|
options;
|
|
3748
3751
|
constructor(options) {
|
|
@@ -4115,28 +4118,24 @@ function createSSEFormatter(options = {}) {
|
|
|
4115
4118
|
yield formatSSEEvent({ data: "", retry: retry2 });
|
|
4116
4119
|
}
|
|
4117
4120
|
for await (const item of stream) {
|
|
4118
|
-
let
|
|
4119
|
-
|
|
4120
|
-
for (const [type, mapper] of Object.entries(eventTypes)) {
|
|
4121
|
+
let matchedEvent;
|
|
4122
|
+
for (const [, mapper] of Object.entries(eventTypes)) {
|
|
4121
4123
|
try {
|
|
4122
4124
|
const mapped = mapper(item);
|
|
4123
4125
|
if (mapped) {
|
|
4124
|
-
|
|
4126
|
+
matchedEvent = {
|
|
4125
4127
|
...mapped,
|
|
4126
4128
|
id: String(++lastEventId)
|
|
4127
4129
|
};
|
|
4128
|
-
matched = true;
|
|
4129
4130
|
break;
|
|
4130
4131
|
}
|
|
4131
4132
|
} catch {
|
|
4132
4133
|
}
|
|
4133
4134
|
}
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
};
|
|
4139
|
-
}
|
|
4135
|
+
const event = matchedEvent ?? {
|
|
4136
|
+
data: JSON.stringify(item),
|
|
4137
|
+
id: String(++lastEventId)
|
|
4138
|
+
};
|
|
4140
4139
|
yield formatSSEEvent(event);
|
|
4141
4140
|
if (heartbeatInterval) {
|
|
4142
4141
|
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.30",
|
|
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",
|