@agentforge/patterns 0.16.5 → 0.16.7
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 +17 -14
- package/dist/index.d.cts +188 -9
- package/dist/index.d.ts +188 -9
- package/dist/index.js +17 -14
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1953,6 +1953,20 @@ function createFinisherNode2() {
|
|
|
1953
1953
|
|
|
1954
1954
|
// src/reflection/agent.ts
|
|
1955
1955
|
var import_langgraph3 = require("@langchain/langgraph");
|
|
1956
|
+
var generatorRouteMap = {
|
|
1957
|
+
reflect: "reflector",
|
|
1958
|
+
error: import_langgraph3.END
|
|
1959
|
+
};
|
|
1960
|
+
var reflectorRouteMap = {
|
|
1961
|
+
revise: "reviser",
|
|
1962
|
+
finish: "finisher",
|
|
1963
|
+
error: import_langgraph3.END
|
|
1964
|
+
};
|
|
1965
|
+
var reviserRouteMap = {
|
|
1966
|
+
reflect: "reflector",
|
|
1967
|
+
finish: "finisher",
|
|
1968
|
+
error: import_langgraph3.END
|
|
1969
|
+
};
|
|
1956
1970
|
function createReflectionAgent(config) {
|
|
1957
1971
|
const {
|
|
1958
1972
|
generator,
|
|
@@ -1998,26 +2012,15 @@ function createReflectionAgent(config) {
|
|
|
1998
2012
|
workflow.addEdge("__start__", "generator").addConditionalEdges(
|
|
1999
2013
|
"generator",
|
|
2000
2014
|
routeAfterGenerator,
|
|
2001
|
-
|
|
2002
|
-
reflect: "reflector",
|
|
2003
|
-
error: import_langgraph3.END
|
|
2004
|
-
}
|
|
2015
|
+
generatorRouteMap
|
|
2005
2016
|
).addConditionalEdges(
|
|
2006
2017
|
"reflector",
|
|
2007
2018
|
routeAfterReflector,
|
|
2008
|
-
|
|
2009
|
-
revise: "reviser",
|
|
2010
|
-
finish: "finisher",
|
|
2011
|
-
error: import_langgraph3.END
|
|
2012
|
-
}
|
|
2019
|
+
reflectorRouteMap
|
|
2013
2020
|
).addConditionalEdges(
|
|
2014
2021
|
"reviser",
|
|
2015
2022
|
routeAfterReviser,
|
|
2016
|
-
|
|
2017
|
-
reflect: "reflector",
|
|
2018
|
-
finish: "finisher",
|
|
2019
|
-
error: import_langgraph3.END
|
|
2020
|
-
}
|
|
2023
|
+
reviserRouteMap
|
|
2021
2024
|
).addEdge("finisher", import_langgraph3.END);
|
|
2022
2025
|
return workflow.compile(checkpointer ? { checkpointer } : void 0);
|
|
2023
2026
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -2168,14 +2168,6 @@ declare function createReviserNode(config: ReviserConfig): (state: ReflectionSta
|
|
|
2168
2168
|
*/
|
|
2169
2169
|
declare function createFinisherNode(): (state: ReflectionStateType) => Promise<Partial<ReflectionStateType>>;
|
|
2170
2170
|
|
|
2171
|
-
/**
|
|
2172
|
-
* Reflection Agent Factory
|
|
2173
|
-
*
|
|
2174
|
-
* Creates a Reflection agent using LangGraph.
|
|
2175
|
-
*
|
|
2176
|
-
* @module patterns/reflection/agent
|
|
2177
|
-
*/
|
|
2178
|
-
|
|
2179
2171
|
/**
|
|
2180
2172
|
* Create a Reflection agent
|
|
2181
2173
|
*
|
|
@@ -2235,7 +2227,194 @@ declare function createFinisherNode(): (state: ReflectionStateType) => Promise<P
|
|
|
2235
2227
|
* );
|
|
2236
2228
|
* ```
|
|
2237
2229
|
*/
|
|
2238
|
-
declare function createReflectionAgent(config: ReflectionAgentConfig):
|
|
2230
|
+
declare function createReflectionAgent(config: ReflectionAgentConfig): _langchain_langgraph.CompiledStateGraph<{
|
|
2231
|
+
input: string;
|
|
2232
|
+
currentResponse: string | undefined;
|
|
2233
|
+
reflections: {
|
|
2234
|
+
issues: string[];
|
|
2235
|
+
critique: string;
|
|
2236
|
+
suggestions: string[];
|
|
2237
|
+
meetsStandards: boolean;
|
|
2238
|
+
timestamp?: Date | undefined;
|
|
2239
|
+
score?: number | undefined;
|
|
2240
|
+
}[];
|
|
2241
|
+
revisions: {
|
|
2242
|
+
content: string;
|
|
2243
|
+
iteration: number;
|
|
2244
|
+
timestamp?: Date | undefined;
|
|
2245
|
+
basedOn?: {
|
|
2246
|
+
issues: string[];
|
|
2247
|
+
critique: string;
|
|
2248
|
+
suggestions: string[];
|
|
2249
|
+
meetsStandards: boolean;
|
|
2250
|
+
timestamp?: Date | undefined;
|
|
2251
|
+
score?: number | undefined;
|
|
2252
|
+
} | undefined;
|
|
2253
|
+
}[];
|
|
2254
|
+
iteration: number;
|
|
2255
|
+
status: "failed" | "completed" | "generating" | "reflecting" | "revising";
|
|
2256
|
+
qualityCriteria: {
|
|
2257
|
+
minScore: number;
|
|
2258
|
+
requireAll: boolean;
|
|
2259
|
+
criteria?: string[] | undefined;
|
|
2260
|
+
} | undefined;
|
|
2261
|
+
maxIterations: number;
|
|
2262
|
+
response: string | undefined;
|
|
2263
|
+
error: string | undefined;
|
|
2264
|
+
}, {
|
|
2265
|
+
input?: string | undefined;
|
|
2266
|
+
currentResponse?: string | undefined;
|
|
2267
|
+
reflections?: {
|
|
2268
|
+
issues: string[];
|
|
2269
|
+
critique: string;
|
|
2270
|
+
suggestions: string[];
|
|
2271
|
+
meetsStandards: boolean;
|
|
2272
|
+
timestamp?: Date | undefined;
|
|
2273
|
+
score?: number | undefined;
|
|
2274
|
+
}[] | undefined;
|
|
2275
|
+
revisions?: {
|
|
2276
|
+
content: string;
|
|
2277
|
+
iteration: number;
|
|
2278
|
+
timestamp?: Date | undefined;
|
|
2279
|
+
basedOn?: {
|
|
2280
|
+
issues: string[];
|
|
2281
|
+
critique: string;
|
|
2282
|
+
suggestions: string[];
|
|
2283
|
+
meetsStandards: boolean;
|
|
2284
|
+
timestamp?: Date | undefined;
|
|
2285
|
+
score?: number | undefined;
|
|
2286
|
+
} | undefined;
|
|
2287
|
+
}[] | undefined;
|
|
2288
|
+
iteration?: number | undefined;
|
|
2289
|
+
status?: "failed" | "completed" | "generating" | "reflecting" | "revising" | undefined;
|
|
2290
|
+
qualityCriteria?: {
|
|
2291
|
+
minScore: number;
|
|
2292
|
+
requireAll: boolean;
|
|
2293
|
+
criteria?: string[] | undefined;
|
|
2294
|
+
} | undefined;
|
|
2295
|
+
maxIterations?: number | undefined;
|
|
2296
|
+
response?: string | undefined;
|
|
2297
|
+
error?: string | undefined;
|
|
2298
|
+
}, "__start__" | "finisher" | "generator" | "reflector" | "reviser", {
|
|
2299
|
+
input: _langchain_langgraph.BaseChannel<string, string, unknown>;
|
|
2300
|
+
currentResponse: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2301
|
+
reflections: _langchain_langgraph.BaseChannel<{
|
|
2302
|
+
issues: string[];
|
|
2303
|
+
critique: string;
|
|
2304
|
+
suggestions: string[];
|
|
2305
|
+
meetsStandards: boolean;
|
|
2306
|
+
timestamp?: Date | undefined;
|
|
2307
|
+
score?: number | undefined;
|
|
2308
|
+
}[], {
|
|
2309
|
+
issues: string[];
|
|
2310
|
+
critique: string;
|
|
2311
|
+
suggestions: string[];
|
|
2312
|
+
meetsStandards: boolean;
|
|
2313
|
+
timestamp?: Date | undefined;
|
|
2314
|
+
score?: number | undefined;
|
|
2315
|
+
}[], unknown>;
|
|
2316
|
+
revisions: _langchain_langgraph.BaseChannel<{
|
|
2317
|
+
content: string;
|
|
2318
|
+
iteration: number;
|
|
2319
|
+
timestamp?: Date | undefined;
|
|
2320
|
+
basedOn?: {
|
|
2321
|
+
issues: string[];
|
|
2322
|
+
critique: string;
|
|
2323
|
+
suggestions: string[];
|
|
2324
|
+
meetsStandards: boolean;
|
|
2325
|
+
timestamp?: Date | undefined;
|
|
2326
|
+
score?: number | undefined;
|
|
2327
|
+
} | undefined;
|
|
2328
|
+
}[], {
|
|
2329
|
+
content: string;
|
|
2330
|
+
iteration: number;
|
|
2331
|
+
timestamp?: Date | undefined;
|
|
2332
|
+
basedOn?: {
|
|
2333
|
+
issues: string[];
|
|
2334
|
+
critique: string;
|
|
2335
|
+
suggestions: string[];
|
|
2336
|
+
meetsStandards: boolean;
|
|
2337
|
+
timestamp?: Date | undefined;
|
|
2338
|
+
score?: number | undefined;
|
|
2339
|
+
} | undefined;
|
|
2340
|
+
}[], unknown>;
|
|
2341
|
+
iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2342
|
+
status: _langchain_langgraph.BaseChannel<"failed" | "completed" | "generating" | "reflecting" | "revising", "failed" | "completed" | "generating" | "reflecting" | "revising", unknown>;
|
|
2343
|
+
qualityCriteria: _langchain_langgraph.BaseChannel<{
|
|
2344
|
+
minScore: number;
|
|
2345
|
+
requireAll: boolean;
|
|
2346
|
+
criteria?: string[] | undefined;
|
|
2347
|
+
} | undefined, {
|
|
2348
|
+
minScore: number;
|
|
2349
|
+
requireAll: boolean;
|
|
2350
|
+
criteria?: string[] | undefined;
|
|
2351
|
+
} | undefined, unknown>;
|
|
2352
|
+
maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2353
|
+
response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2354
|
+
error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2355
|
+
}, {
|
|
2356
|
+
input: _langchain_langgraph.BaseChannel<string, string, unknown>;
|
|
2357
|
+
currentResponse: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2358
|
+
reflections: _langchain_langgraph.BaseChannel<{
|
|
2359
|
+
issues: string[];
|
|
2360
|
+
critique: string;
|
|
2361
|
+
suggestions: string[];
|
|
2362
|
+
meetsStandards: boolean;
|
|
2363
|
+
timestamp?: Date | undefined;
|
|
2364
|
+
score?: number | undefined;
|
|
2365
|
+
}[], {
|
|
2366
|
+
issues: string[];
|
|
2367
|
+
critique: string;
|
|
2368
|
+
suggestions: string[];
|
|
2369
|
+
meetsStandards: boolean;
|
|
2370
|
+
timestamp?: Date | undefined;
|
|
2371
|
+
score?: number | undefined;
|
|
2372
|
+
}[], unknown>;
|
|
2373
|
+
revisions: _langchain_langgraph.BaseChannel<{
|
|
2374
|
+
content: string;
|
|
2375
|
+
iteration: number;
|
|
2376
|
+
timestamp?: Date | undefined;
|
|
2377
|
+
basedOn?: {
|
|
2378
|
+
issues: string[];
|
|
2379
|
+
critique: string;
|
|
2380
|
+
suggestions: string[];
|
|
2381
|
+
meetsStandards: boolean;
|
|
2382
|
+
timestamp?: Date | undefined;
|
|
2383
|
+
score?: number | undefined;
|
|
2384
|
+
} | undefined;
|
|
2385
|
+
}[], {
|
|
2386
|
+
content: string;
|
|
2387
|
+
iteration: number;
|
|
2388
|
+
timestamp?: Date | undefined;
|
|
2389
|
+
basedOn?: {
|
|
2390
|
+
issues: string[];
|
|
2391
|
+
critique: string;
|
|
2392
|
+
suggestions: string[];
|
|
2393
|
+
meetsStandards: boolean;
|
|
2394
|
+
timestamp?: Date | undefined;
|
|
2395
|
+
score?: number | undefined;
|
|
2396
|
+
} | undefined;
|
|
2397
|
+
}[], unknown>;
|
|
2398
|
+
iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2399
|
+
status: _langchain_langgraph.BaseChannel<"failed" | "completed" | "generating" | "reflecting" | "revising", "failed" | "completed" | "generating" | "reflecting" | "revising", unknown>;
|
|
2400
|
+
qualityCriteria: _langchain_langgraph.BaseChannel<{
|
|
2401
|
+
minScore: number;
|
|
2402
|
+
requireAll: boolean;
|
|
2403
|
+
criteria?: string[] | undefined;
|
|
2404
|
+
} | undefined, {
|
|
2405
|
+
minScore: number;
|
|
2406
|
+
requireAll: boolean;
|
|
2407
|
+
criteria?: string[] | undefined;
|
|
2408
|
+
} | undefined, unknown>;
|
|
2409
|
+
maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2410
|
+
response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2411
|
+
error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2412
|
+
}, _langchain_langgraph.StateDefinition, {
|
|
2413
|
+
generator: Partial<ReflectionStateType>;
|
|
2414
|
+
reflector: Partial<ReflectionStateType>;
|
|
2415
|
+
reviser: Partial<ReflectionStateType>;
|
|
2416
|
+
finisher: Partial<ReflectionStateType>;
|
|
2417
|
+
}, unknown, unknown>;
|
|
2239
2418
|
|
|
2240
2419
|
/**
|
|
2241
2420
|
* Zod Schemas for Multi-Agent Coordination Pattern
|
package/dist/index.d.ts
CHANGED
|
@@ -2168,14 +2168,6 @@ declare function createReviserNode(config: ReviserConfig): (state: ReflectionSta
|
|
|
2168
2168
|
*/
|
|
2169
2169
|
declare function createFinisherNode(): (state: ReflectionStateType) => Promise<Partial<ReflectionStateType>>;
|
|
2170
2170
|
|
|
2171
|
-
/**
|
|
2172
|
-
* Reflection Agent Factory
|
|
2173
|
-
*
|
|
2174
|
-
* Creates a Reflection agent using LangGraph.
|
|
2175
|
-
*
|
|
2176
|
-
* @module patterns/reflection/agent
|
|
2177
|
-
*/
|
|
2178
|
-
|
|
2179
2171
|
/**
|
|
2180
2172
|
* Create a Reflection agent
|
|
2181
2173
|
*
|
|
@@ -2235,7 +2227,194 @@ declare function createFinisherNode(): (state: ReflectionStateType) => Promise<P
|
|
|
2235
2227
|
* );
|
|
2236
2228
|
* ```
|
|
2237
2229
|
*/
|
|
2238
|
-
declare function createReflectionAgent(config: ReflectionAgentConfig):
|
|
2230
|
+
declare function createReflectionAgent(config: ReflectionAgentConfig): _langchain_langgraph.CompiledStateGraph<{
|
|
2231
|
+
input: string;
|
|
2232
|
+
currentResponse: string | undefined;
|
|
2233
|
+
reflections: {
|
|
2234
|
+
issues: string[];
|
|
2235
|
+
critique: string;
|
|
2236
|
+
suggestions: string[];
|
|
2237
|
+
meetsStandards: boolean;
|
|
2238
|
+
timestamp?: Date | undefined;
|
|
2239
|
+
score?: number | undefined;
|
|
2240
|
+
}[];
|
|
2241
|
+
revisions: {
|
|
2242
|
+
content: string;
|
|
2243
|
+
iteration: number;
|
|
2244
|
+
timestamp?: Date | undefined;
|
|
2245
|
+
basedOn?: {
|
|
2246
|
+
issues: string[];
|
|
2247
|
+
critique: string;
|
|
2248
|
+
suggestions: string[];
|
|
2249
|
+
meetsStandards: boolean;
|
|
2250
|
+
timestamp?: Date | undefined;
|
|
2251
|
+
score?: number | undefined;
|
|
2252
|
+
} | undefined;
|
|
2253
|
+
}[];
|
|
2254
|
+
iteration: number;
|
|
2255
|
+
status: "failed" | "completed" | "generating" | "reflecting" | "revising";
|
|
2256
|
+
qualityCriteria: {
|
|
2257
|
+
minScore: number;
|
|
2258
|
+
requireAll: boolean;
|
|
2259
|
+
criteria?: string[] | undefined;
|
|
2260
|
+
} | undefined;
|
|
2261
|
+
maxIterations: number;
|
|
2262
|
+
response: string | undefined;
|
|
2263
|
+
error: string | undefined;
|
|
2264
|
+
}, {
|
|
2265
|
+
input?: string | undefined;
|
|
2266
|
+
currentResponse?: string | undefined;
|
|
2267
|
+
reflections?: {
|
|
2268
|
+
issues: string[];
|
|
2269
|
+
critique: string;
|
|
2270
|
+
suggestions: string[];
|
|
2271
|
+
meetsStandards: boolean;
|
|
2272
|
+
timestamp?: Date | undefined;
|
|
2273
|
+
score?: number | undefined;
|
|
2274
|
+
}[] | undefined;
|
|
2275
|
+
revisions?: {
|
|
2276
|
+
content: string;
|
|
2277
|
+
iteration: number;
|
|
2278
|
+
timestamp?: Date | undefined;
|
|
2279
|
+
basedOn?: {
|
|
2280
|
+
issues: string[];
|
|
2281
|
+
critique: string;
|
|
2282
|
+
suggestions: string[];
|
|
2283
|
+
meetsStandards: boolean;
|
|
2284
|
+
timestamp?: Date | undefined;
|
|
2285
|
+
score?: number | undefined;
|
|
2286
|
+
} | undefined;
|
|
2287
|
+
}[] | undefined;
|
|
2288
|
+
iteration?: number | undefined;
|
|
2289
|
+
status?: "failed" | "completed" | "generating" | "reflecting" | "revising" | undefined;
|
|
2290
|
+
qualityCriteria?: {
|
|
2291
|
+
minScore: number;
|
|
2292
|
+
requireAll: boolean;
|
|
2293
|
+
criteria?: string[] | undefined;
|
|
2294
|
+
} | undefined;
|
|
2295
|
+
maxIterations?: number | undefined;
|
|
2296
|
+
response?: string | undefined;
|
|
2297
|
+
error?: string | undefined;
|
|
2298
|
+
}, "__start__" | "finisher" | "generator" | "reflector" | "reviser", {
|
|
2299
|
+
input: _langchain_langgraph.BaseChannel<string, string, unknown>;
|
|
2300
|
+
currentResponse: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2301
|
+
reflections: _langchain_langgraph.BaseChannel<{
|
|
2302
|
+
issues: string[];
|
|
2303
|
+
critique: string;
|
|
2304
|
+
suggestions: string[];
|
|
2305
|
+
meetsStandards: boolean;
|
|
2306
|
+
timestamp?: Date | undefined;
|
|
2307
|
+
score?: number | undefined;
|
|
2308
|
+
}[], {
|
|
2309
|
+
issues: string[];
|
|
2310
|
+
critique: string;
|
|
2311
|
+
suggestions: string[];
|
|
2312
|
+
meetsStandards: boolean;
|
|
2313
|
+
timestamp?: Date | undefined;
|
|
2314
|
+
score?: number | undefined;
|
|
2315
|
+
}[], unknown>;
|
|
2316
|
+
revisions: _langchain_langgraph.BaseChannel<{
|
|
2317
|
+
content: string;
|
|
2318
|
+
iteration: number;
|
|
2319
|
+
timestamp?: Date | undefined;
|
|
2320
|
+
basedOn?: {
|
|
2321
|
+
issues: string[];
|
|
2322
|
+
critique: string;
|
|
2323
|
+
suggestions: string[];
|
|
2324
|
+
meetsStandards: boolean;
|
|
2325
|
+
timestamp?: Date | undefined;
|
|
2326
|
+
score?: number | undefined;
|
|
2327
|
+
} | undefined;
|
|
2328
|
+
}[], {
|
|
2329
|
+
content: string;
|
|
2330
|
+
iteration: number;
|
|
2331
|
+
timestamp?: Date | undefined;
|
|
2332
|
+
basedOn?: {
|
|
2333
|
+
issues: string[];
|
|
2334
|
+
critique: string;
|
|
2335
|
+
suggestions: string[];
|
|
2336
|
+
meetsStandards: boolean;
|
|
2337
|
+
timestamp?: Date | undefined;
|
|
2338
|
+
score?: number | undefined;
|
|
2339
|
+
} | undefined;
|
|
2340
|
+
}[], unknown>;
|
|
2341
|
+
iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2342
|
+
status: _langchain_langgraph.BaseChannel<"failed" | "completed" | "generating" | "reflecting" | "revising", "failed" | "completed" | "generating" | "reflecting" | "revising", unknown>;
|
|
2343
|
+
qualityCriteria: _langchain_langgraph.BaseChannel<{
|
|
2344
|
+
minScore: number;
|
|
2345
|
+
requireAll: boolean;
|
|
2346
|
+
criteria?: string[] | undefined;
|
|
2347
|
+
} | undefined, {
|
|
2348
|
+
minScore: number;
|
|
2349
|
+
requireAll: boolean;
|
|
2350
|
+
criteria?: string[] | undefined;
|
|
2351
|
+
} | undefined, unknown>;
|
|
2352
|
+
maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2353
|
+
response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2354
|
+
error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2355
|
+
}, {
|
|
2356
|
+
input: _langchain_langgraph.BaseChannel<string, string, unknown>;
|
|
2357
|
+
currentResponse: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2358
|
+
reflections: _langchain_langgraph.BaseChannel<{
|
|
2359
|
+
issues: string[];
|
|
2360
|
+
critique: string;
|
|
2361
|
+
suggestions: string[];
|
|
2362
|
+
meetsStandards: boolean;
|
|
2363
|
+
timestamp?: Date | undefined;
|
|
2364
|
+
score?: number | undefined;
|
|
2365
|
+
}[], {
|
|
2366
|
+
issues: string[];
|
|
2367
|
+
critique: string;
|
|
2368
|
+
suggestions: string[];
|
|
2369
|
+
meetsStandards: boolean;
|
|
2370
|
+
timestamp?: Date | undefined;
|
|
2371
|
+
score?: number | undefined;
|
|
2372
|
+
}[], unknown>;
|
|
2373
|
+
revisions: _langchain_langgraph.BaseChannel<{
|
|
2374
|
+
content: string;
|
|
2375
|
+
iteration: number;
|
|
2376
|
+
timestamp?: Date | undefined;
|
|
2377
|
+
basedOn?: {
|
|
2378
|
+
issues: string[];
|
|
2379
|
+
critique: string;
|
|
2380
|
+
suggestions: string[];
|
|
2381
|
+
meetsStandards: boolean;
|
|
2382
|
+
timestamp?: Date | undefined;
|
|
2383
|
+
score?: number | undefined;
|
|
2384
|
+
} | undefined;
|
|
2385
|
+
}[], {
|
|
2386
|
+
content: string;
|
|
2387
|
+
iteration: number;
|
|
2388
|
+
timestamp?: Date | undefined;
|
|
2389
|
+
basedOn?: {
|
|
2390
|
+
issues: string[];
|
|
2391
|
+
critique: string;
|
|
2392
|
+
suggestions: string[];
|
|
2393
|
+
meetsStandards: boolean;
|
|
2394
|
+
timestamp?: Date | undefined;
|
|
2395
|
+
score?: number | undefined;
|
|
2396
|
+
} | undefined;
|
|
2397
|
+
}[], unknown>;
|
|
2398
|
+
iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2399
|
+
status: _langchain_langgraph.BaseChannel<"failed" | "completed" | "generating" | "reflecting" | "revising", "failed" | "completed" | "generating" | "reflecting" | "revising", unknown>;
|
|
2400
|
+
qualityCriteria: _langchain_langgraph.BaseChannel<{
|
|
2401
|
+
minScore: number;
|
|
2402
|
+
requireAll: boolean;
|
|
2403
|
+
criteria?: string[] | undefined;
|
|
2404
|
+
} | undefined, {
|
|
2405
|
+
minScore: number;
|
|
2406
|
+
requireAll: boolean;
|
|
2407
|
+
criteria?: string[] | undefined;
|
|
2408
|
+
} | undefined, unknown>;
|
|
2409
|
+
maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
|
|
2410
|
+
response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2411
|
+
error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
|
|
2412
|
+
}, _langchain_langgraph.StateDefinition, {
|
|
2413
|
+
generator: Partial<ReflectionStateType>;
|
|
2414
|
+
reflector: Partial<ReflectionStateType>;
|
|
2415
|
+
reviser: Partial<ReflectionStateType>;
|
|
2416
|
+
finisher: Partial<ReflectionStateType>;
|
|
2417
|
+
}, unknown, unknown>;
|
|
2239
2418
|
|
|
2240
2419
|
/**
|
|
2241
2420
|
* Zod Schemas for Multi-Agent Coordination Pattern
|
package/dist/index.js
CHANGED
|
@@ -1855,6 +1855,20 @@ function createFinisherNode2() {
|
|
|
1855
1855
|
|
|
1856
1856
|
// src/reflection/agent.ts
|
|
1857
1857
|
import { StateGraph as StateGraph3, END as END3 } from "@langchain/langgraph";
|
|
1858
|
+
var generatorRouteMap = {
|
|
1859
|
+
reflect: "reflector",
|
|
1860
|
+
error: END3
|
|
1861
|
+
};
|
|
1862
|
+
var reflectorRouteMap = {
|
|
1863
|
+
revise: "reviser",
|
|
1864
|
+
finish: "finisher",
|
|
1865
|
+
error: END3
|
|
1866
|
+
};
|
|
1867
|
+
var reviserRouteMap = {
|
|
1868
|
+
reflect: "reflector",
|
|
1869
|
+
finish: "finisher",
|
|
1870
|
+
error: END3
|
|
1871
|
+
};
|
|
1858
1872
|
function createReflectionAgent(config) {
|
|
1859
1873
|
const {
|
|
1860
1874
|
generator,
|
|
@@ -1900,26 +1914,15 @@ function createReflectionAgent(config) {
|
|
|
1900
1914
|
workflow.addEdge("__start__", "generator").addConditionalEdges(
|
|
1901
1915
|
"generator",
|
|
1902
1916
|
routeAfterGenerator,
|
|
1903
|
-
|
|
1904
|
-
reflect: "reflector",
|
|
1905
|
-
error: END3
|
|
1906
|
-
}
|
|
1917
|
+
generatorRouteMap
|
|
1907
1918
|
).addConditionalEdges(
|
|
1908
1919
|
"reflector",
|
|
1909
1920
|
routeAfterReflector,
|
|
1910
|
-
|
|
1911
|
-
revise: "reviser",
|
|
1912
|
-
finish: "finisher",
|
|
1913
|
-
error: END3
|
|
1914
|
-
}
|
|
1921
|
+
reflectorRouteMap
|
|
1915
1922
|
).addConditionalEdges(
|
|
1916
1923
|
"reviser",
|
|
1917
1924
|
routeAfterReviser,
|
|
1918
|
-
|
|
1919
|
-
reflect: "reflector",
|
|
1920
|
-
finish: "finisher",
|
|
1921
|
-
error: END3
|
|
1922
|
-
}
|
|
1925
|
+
reviserRouteMap
|
|
1923
1926
|
).addEdge("finisher", END3);
|
|
1924
1927
|
return workflow.compile(checkpointer ? { checkpointer } : void 0);
|
|
1925
1928
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge/patterns",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.7",
|
|
4
4
|
"description": "Production-ready agent workflow patterns for TypeScript including ReAct and Planner-Executor, built on LangGraph.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"url": "https://github.com/TVScoundrel/agentforge/issues"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@agentforge/core": "0.16.
|
|
44
|
+
"@agentforge/core": "0.16.7",
|
|
45
45
|
"@langchain/core": "^1.1.17",
|
|
46
46
|
"@langchain/langgraph": "^1.1.2",
|
|
47
47
|
"zod": "^3.23.8"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@agentforge/testing": "0.16.
|
|
50
|
+
"@agentforge/testing": "0.16.7",
|
|
51
51
|
"@eslint/js": "^9.17.0",
|
|
52
52
|
"@types/node": "^22.10.2",
|
|
53
53
|
"eslint": "^9.17.0",
|