@graphrefly/graphrefly 0.14.0 → 0.15.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/dist/compat/nestjs/index.js +2 -2
- package/dist/index.cjs +78 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +88 -50
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -2105,12 +2105,16 @@ interface StrategyEntry {
|
|
|
2105
2105
|
/** Key format: `${rootCause}→${intervention}`. */
|
|
2106
2106
|
type StrategyKey = `${RootCause}→${Intervention}`;
|
|
2107
2107
|
declare function strategyKey(rootCause: RootCause, intervention: Intervention): StrategyKey;
|
|
2108
|
-
/**
|
|
2108
|
+
/** LLM output shape from the EXECUTE stage (partial — lacks `item`). */
|
|
2109
|
+
type ExecuteOutput = {
|
|
2110
|
+
outcome: "success" | "failure" | "partial";
|
|
2111
|
+
detail: string;
|
|
2112
|
+
};
|
|
2113
|
+
/** Full execution result assembled downstream (LLM output + context). */
|
|
2109
2114
|
interface ExecutionResult {
|
|
2110
2115
|
item: TriagedItem;
|
|
2111
2116
|
outcome: "success" | "failure" | "partial";
|
|
2112
2117
|
detail: string;
|
|
2113
|
-
retryCount: number;
|
|
2114
2118
|
}
|
|
2115
2119
|
/** Whether an error is self-correctable (fast-retry) or structural (full loop). */
|
|
2116
2120
|
type ErrorClass = "self-correctable" | "structural";
|
|
@@ -2442,7 +2446,11 @@ declare class HarnessGraph extends Graph {
|
|
|
2442
2446
|
readonly strategy: StrategyModelBundle;
|
|
2443
2447
|
/** Verify results topic — subscribe to see verification outcomes. */
|
|
2444
2448
|
readonly verifyResults: TopicGraph<VerifyResult>;
|
|
2445
|
-
|
|
2449
|
+
/** Per-item fast-retry counts (keyed by base summary). */
|
|
2450
|
+
readonly retryTracker: ReadonlyMap<string, number>;
|
|
2451
|
+
/** Per-item reingestion counts (keyed by base summary). */
|
|
2452
|
+
readonly reingestionTracker: ReadonlyMap<string, number>;
|
|
2453
|
+
constructor(name: string, intake: TopicGraph<IntakeItem>, queues: Map<QueueRoute, TopicGraph<TriagedItem>>, gates: Map<QueueRoute, GateController<TriagedItem>>, strategy: StrategyModelBundle, verifyResults: TopicGraph<VerifyResult>, retryTracker: Map<string, number>, reingestionTracker: Map<string, number>);
|
|
2446
2454
|
}
|
|
2447
2455
|
/**
|
|
2448
2456
|
* Wire the reactive collaboration loop as a static-topology graph.
|
|
@@ -2481,6 +2489,7 @@ type index$1_EvalIntakeBridgeOptions = EvalIntakeBridgeOptions;
|
|
|
2481
2489
|
type index$1_EvalJudgeScore = EvalJudgeScore;
|
|
2482
2490
|
type index$1_EvalResult = EvalResult;
|
|
2483
2491
|
type index$1_EvalTaskResult = EvalTaskResult;
|
|
2492
|
+
type index$1_ExecuteOutput = ExecuteOutput;
|
|
2484
2493
|
type index$1_ExecutionResult = ExecutionResult;
|
|
2485
2494
|
type index$1_HarnessGraph = HarnessGraph;
|
|
2486
2495
|
declare const index$1_HarnessGraph: typeof HarnessGraph;
|
|
@@ -2506,7 +2515,7 @@ declare const index$1_priorityScore: typeof priorityScore;
|
|
|
2506
2515
|
declare const index$1_strategyKey: typeof strategyKey;
|
|
2507
2516
|
declare const index$1_strategyModel: typeof strategyModel;
|
|
2508
2517
|
declare namespace index$1 {
|
|
2509
|
-
export { index$1_DEFAULT_DECAY_RATE as DEFAULT_DECAY_RATE, index$1_DEFAULT_QUEUE_CONFIGS as DEFAULT_QUEUE_CONFIGS, index$1_DEFAULT_SEVERITY_WEIGHTS as DEFAULT_SEVERITY_WEIGHTS, type index$1_ErrorClass as ErrorClass, type index$1_ErrorClassifier as ErrorClassifier, type index$1_EvalIntakeBridgeOptions as EvalIntakeBridgeOptions, type index$1_EvalJudgeScore as EvalJudgeScore, type index$1_EvalResult as EvalResult, type index$1_EvalTaskResult as EvalTaskResult, type index$1_ExecutionResult as ExecutionResult, index$1_HarnessGraph as HarnessGraph, type index$1_HarnessLoopOptions as HarnessLoopOptions, type index$1_IntakeItem as IntakeItem, type index$1_IntakeSource as IntakeSource, type index$1_Intervention as Intervention, type index$1_PrioritySignals as PrioritySignals, type index$1_QueueConfig as QueueConfig, type index$1_QueueRoute as QueueRoute, type index$1_RootCause as RootCause, type index$1_Severity as Severity, type index$1_StrategyEntry as StrategyEntry, type index$1_StrategyKey as StrategyKey, type index$1_StrategyModelBundle as StrategyModelBundle, type index$1_StrategySnapshot as StrategySnapshot, type index$1_TriagedItem as TriagedItem, type index$1_VerifyResult as VerifyResult, index$1_defaultErrorClassifier as defaultErrorClassifier, index$1_evalIntakeBridge as evalIntakeBridge, index$1_harnessLoop as harnessLoop, index$1_priorityScore as priorityScore, index$1_strategyKey as strategyKey, index$1_strategyModel as strategyModel };
|
|
2518
|
+
export { index$1_DEFAULT_DECAY_RATE as DEFAULT_DECAY_RATE, index$1_DEFAULT_QUEUE_CONFIGS as DEFAULT_QUEUE_CONFIGS, index$1_DEFAULT_SEVERITY_WEIGHTS as DEFAULT_SEVERITY_WEIGHTS, type index$1_ErrorClass as ErrorClass, type index$1_ErrorClassifier as ErrorClassifier, type index$1_EvalIntakeBridgeOptions as EvalIntakeBridgeOptions, type index$1_EvalJudgeScore as EvalJudgeScore, type index$1_EvalResult as EvalResult, type index$1_EvalTaskResult as EvalTaskResult, type index$1_ExecuteOutput as ExecuteOutput, type index$1_ExecutionResult as ExecutionResult, index$1_HarnessGraph as HarnessGraph, type index$1_HarnessLoopOptions as HarnessLoopOptions, type index$1_IntakeItem as IntakeItem, type index$1_IntakeSource as IntakeSource, type index$1_Intervention as Intervention, type index$1_PrioritySignals as PrioritySignals, type index$1_QueueConfig as QueueConfig, type index$1_QueueRoute as QueueRoute, type index$1_RootCause as RootCause, type index$1_Severity as Severity, type index$1_StrategyEntry as StrategyEntry, type index$1_StrategyKey as StrategyKey, type index$1_StrategyModelBundle as StrategyModelBundle, type index$1_StrategySnapshot as StrategySnapshot, type index$1_TriagedItem as TriagedItem, type index$1_VerifyResult as VerifyResult, index$1_defaultErrorClassifier as defaultErrorClassifier, index$1_evalIntakeBridge as evalIntakeBridge, index$1_harnessLoop as harnessLoop, index$1_priorityScore as priorityScore, index$1_strategyKey as strategyKey, index$1_strategyModel as strategyModel };
|
|
2510
2519
|
}
|
|
2511
2520
|
|
|
2512
2521
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2105,12 +2105,16 @@ interface StrategyEntry {
|
|
|
2105
2105
|
/** Key format: `${rootCause}→${intervention}`. */
|
|
2106
2106
|
type StrategyKey = `${RootCause}→${Intervention}`;
|
|
2107
2107
|
declare function strategyKey(rootCause: RootCause, intervention: Intervention): StrategyKey;
|
|
2108
|
-
/**
|
|
2108
|
+
/** LLM output shape from the EXECUTE stage (partial — lacks `item`). */
|
|
2109
|
+
type ExecuteOutput = {
|
|
2110
|
+
outcome: "success" | "failure" | "partial";
|
|
2111
|
+
detail: string;
|
|
2112
|
+
};
|
|
2113
|
+
/** Full execution result assembled downstream (LLM output + context). */
|
|
2109
2114
|
interface ExecutionResult {
|
|
2110
2115
|
item: TriagedItem;
|
|
2111
2116
|
outcome: "success" | "failure" | "partial";
|
|
2112
2117
|
detail: string;
|
|
2113
|
-
retryCount: number;
|
|
2114
2118
|
}
|
|
2115
2119
|
/** Whether an error is self-correctable (fast-retry) or structural (full loop). */
|
|
2116
2120
|
type ErrorClass = "self-correctable" | "structural";
|
|
@@ -2442,7 +2446,11 @@ declare class HarnessGraph extends Graph {
|
|
|
2442
2446
|
readonly strategy: StrategyModelBundle;
|
|
2443
2447
|
/** Verify results topic — subscribe to see verification outcomes. */
|
|
2444
2448
|
readonly verifyResults: TopicGraph<VerifyResult>;
|
|
2445
|
-
|
|
2449
|
+
/** Per-item fast-retry counts (keyed by base summary). */
|
|
2450
|
+
readonly retryTracker: ReadonlyMap<string, number>;
|
|
2451
|
+
/** Per-item reingestion counts (keyed by base summary). */
|
|
2452
|
+
readonly reingestionTracker: ReadonlyMap<string, number>;
|
|
2453
|
+
constructor(name: string, intake: TopicGraph<IntakeItem>, queues: Map<QueueRoute, TopicGraph<TriagedItem>>, gates: Map<QueueRoute, GateController<TriagedItem>>, strategy: StrategyModelBundle, verifyResults: TopicGraph<VerifyResult>, retryTracker: Map<string, number>, reingestionTracker: Map<string, number>);
|
|
2446
2454
|
}
|
|
2447
2455
|
/**
|
|
2448
2456
|
* Wire the reactive collaboration loop as a static-topology graph.
|
|
@@ -2481,6 +2489,7 @@ type index$1_EvalIntakeBridgeOptions = EvalIntakeBridgeOptions;
|
|
|
2481
2489
|
type index$1_EvalJudgeScore = EvalJudgeScore;
|
|
2482
2490
|
type index$1_EvalResult = EvalResult;
|
|
2483
2491
|
type index$1_EvalTaskResult = EvalTaskResult;
|
|
2492
|
+
type index$1_ExecuteOutput = ExecuteOutput;
|
|
2484
2493
|
type index$1_ExecutionResult = ExecutionResult;
|
|
2485
2494
|
type index$1_HarnessGraph = HarnessGraph;
|
|
2486
2495
|
declare const index$1_HarnessGraph: typeof HarnessGraph;
|
|
@@ -2506,7 +2515,7 @@ declare const index$1_priorityScore: typeof priorityScore;
|
|
|
2506
2515
|
declare const index$1_strategyKey: typeof strategyKey;
|
|
2507
2516
|
declare const index$1_strategyModel: typeof strategyModel;
|
|
2508
2517
|
declare namespace index$1 {
|
|
2509
|
-
export { index$1_DEFAULT_DECAY_RATE as DEFAULT_DECAY_RATE, index$1_DEFAULT_QUEUE_CONFIGS as DEFAULT_QUEUE_CONFIGS, index$1_DEFAULT_SEVERITY_WEIGHTS as DEFAULT_SEVERITY_WEIGHTS, type index$1_ErrorClass as ErrorClass, type index$1_ErrorClassifier as ErrorClassifier, type index$1_EvalIntakeBridgeOptions as EvalIntakeBridgeOptions, type index$1_EvalJudgeScore as EvalJudgeScore, type index$1_EvalResult as EvalResult, type index$1_EvalTaskResult as EvalTaskResult, type index$1_ExecutionResult as ExecutionResult, index$1_HarnessGraph as HarnessGraph, type index$1_HarnessLoopOptions as HarnessLoopOptions, type index$1_IntakeItem as IntakeItem, type index$1_IntakeSource as IntakeSource, type index$1_Intervention as Intervention, type index$1_PrioritySignals as PrioritySignals, type index$1_QueueConfig as QueueConfig, type index$1_QueueRoute as QueueRoute, type index$1_RootCause as RootCause, type index$1_Severity as Severity, type index$1_StrategyEntry as StrategyEntry, type index$1_StrategyKey as StrategyKey, type index$1_StrategyModelBundle as StrategyModelBundle, type index$1_StrategySnapshot as StrategySnapshot, type index$1_TriagedItem as TriagedItem, type index$1_VerifyResult as VerifyResult, index$1_defaultErrorClassifier as defaultErrorClassifier, index$1_evalIntakeBridge as evalIntakeBridge, index$1_harnessLoop as harnessLoop, index$1_priorityScore as priorityScore, index$1_strategyKey as strategyKey, index$1_strategyModel as strategyModel };
|
|
2518
|
+
export { index$1_DEFAULT_DECAY_RATE as DEFAULT_DECAY_RATE, index$1_DEFAULT_QUEUE_CONFIGS as DEFAULT_QUEUE_CONFIGS, index$1_DEFAULT_SEVERITY_WEIGHTS as DEFAULT_SEVERITY_WEIGHTS, type index$1_ErrorClass as ErrorClass, type index$1_ErrorClassifier as ErrorClassifier, type index$1_EvalIntakeBridgeOptions as EvalIntakeBridgeOptions, type index$1_EvalJudgeScore as EvalJudgeScore, type index$1_EvalResult as EvalResult, type index$1_EvalTaskResult as EvalTaskResult, type index$1_ExecuteOutput as ExecuteOutput, type index$1_ExecutionResult as ExecutionResult, index$1_HarnessGraph as HarnessGraph, type index$1_HarnessLoopOptions as HarnessLoopOptions, type index$1_IntakeItem as IntakeItem, type index$1_IntakeSource as IntakeSource, type index$1_Intervention as Intervention, type index$1_PrioritySignals as PrioritySignals, type index$1_QueueConfig as QueueConfig, type index$1_QueueRoute as QueueRoute, type index$1_RootCause as RootCause, type index$1_Severity as Severity, type index$1_StrategyEntry as StrategyEntry, type index$1_StrategyKey as StrategyKey, type index$1_StrategyModelBundle as StrategyModelBundle, type index$1_StrategySnapshot as StrategySnapshot, type index$1_TriagedItem as TriagedItem, type index$1_VerifyResult as VerifyResult, index$1_defaultErrorClassifier as defaultErrorClassifier, index$1_evalIntakeBridge as evalIntakeBridge, index$1_harnessLoop as harnessLoop, index$1_priorityScore as priorityScore, index$1_strategyKey as strategyKey, index$1_strategyModel as strategyModel };
|
|
2510
2519
|
}
|
|
2511
2520
|
|
|
2512
2521
|
/**
|
package/dist/index.js
CHANGED
|
@@ -142,6 +142,19 @@ import {
|
|
|
142
142
|
cqrs_exports,
|
|
143
143
|
nestjs_exports
|
|
144
144
|
} from "./chunk-2ZICUAUJ.js";
|
|
145
|
+
import {
|
|
146
|
+
JsonCodec,
|
|
147
|
+
createDagCborCodec,
|
|
148
|
+
createDagCborZstdCodec,
|
|
149
|
+
graph_exports,
|
|
150
|
+
negotiateCodec,
|
|
151
|
+
replayWAL
|
|
152
|
+
} from "./chunk-ZHTHUX5D.js";
|
|
153
|
+
import {
|
|
154
|
+
DEFAULT_DOWN,
|
|
155
|
+
bridge,
|
|
156
|
+
core_exports
|
|
157
|
+
} from "./chunk-YW6LFCFS.js";
|
|
145
158
|
import {
|
|
146
159
|
cached,
|
|
147
160
|
createWatermarkController,
|
|
@@ -175,19 +188,6 @@ import {
|
|
|
175
188
|
toMessages$,
|
|
176
189
|
toObservable
|
|
177
190
|
} from "./chunk-QVYZD65U.js";
|
|
178
|
-
import {
|
|
179
|
-
JsonCodec,
|
|
180
|
-
createDagCborCodec,
|
|
181
|
-
createDagCborZstdCodec,
|
|
182
|
-
graph_exports,
|
|
183
|
-
negotiateCodec,
|
|
184
|
-
replayWAL
|
|
185
|
-
} from "./chunk-ZHTHUX5D.js";
|
|
186
|
-
import {
|
|
187
|
-
DEFAULT_DOWN,
|
|
188
|
-
bridge,
|
|
189
|
-
core_exports
|
|
190
|
-
} from "./chunk-YW6LFCFS.js";
|
|
191
191
|
import {
|
|
192
192
|
ResettableTimer
|
|
193
193
|
} from "./chunk-WZ2Z2CRV.js";
|
|
@@ -1607,7 +1607,9 @@ function promptNode(adapter, deps, prompt, opts) {
|
|
|
1607
1607
|
const messagesNode = derived(
|
|
1608
1608
|
deps,
|
|
1609
1609
|
(values) => {
|
|
1610
|
+
if (values.some((v) => v == null)) return [];
|
|
1610
1611
|
const text = typeof prompt === "string" ? prompt : prompt(...values);
|
|
1612
|
+
if (!text) return [];
|
|
1611
1613
|
const msgs = [];
|
|
1612
1614
|
if (opts?.systemPrompt) msgs.push({ role: "system", content: opts.systemPrompt });
|
|
1613
1615
|
msgs.push({ role: "user", content: text });
|
|
@@ -5936,6 +5938,9 @@ function priorityScore(item, strategy, lastInteractionNs, urgency, signals) {
|
|
|
5936
5938
|
}
|
|
5937
5939
|
|
|
5938
5940
|
// src/patterns/harness/loop.ts
|
|
5941
|
+
function baseSummary(summary) {
|
|
5942
|
+
return summary.replace(/^\[RETRY \d+\/\d+\]\s*/, "");
|
|
5943
|
+
}
|
|
5939
5944
|
var DEFAULT_TRIAGE_PROMPT = `You are a triage classifier for a reactive collaboration harness.
|
|
5940
5945
|
|
|
5941
5946
|
Given an intake item, classify it and output JSON:
|
|
@@ -5997,13 +6002,19 @@ var HarnessGraph = class extends Graph {
|
|
|
5997
6002
|
strategy;
|
|
5998
6003
|
/** Verify results topic — subscribe to see verification outcomes. */
|
|
5999
6004
|
verifyResults;
|
|
6000
|
-
|
|
6005
|
+
/** Per-item fast-retry counts (keyed by base summary). */
|
|
6006
|
+
retryTracker;
|
|
6007
|
+
/** Per-item reingestion counts (keyed by base summary). */
|
|
6008
|
+
reingestionTracker;
|
|
6009
|
+
constructor(name, intake, queues, gates, strategy, verifyResults, retryTracker, reingestionTracker) {
|
|
6001
6010
|
super(name);
|
|
6002
6011
|
this.intake = intake;
|
|
6003
6012
|
this.queues = queues;
|
|
6004
6013
|
this.gates = gates;
|
|
6005
6014
|
this.strategy = strategy;
|
|
6006
6015
|
this.verifyResults = verifyResults;
|
|
6016
|
+
this.retryTracker = retryTracker;
|
|
6017
|
+
this.reingestionTracker = reingestionTracker;
|
|
6007
6018
|
}
|
|
6008
6019
|
};
|
|
6009
6020
|
function harnessLoop(name, opts) {
|
|
@@ -6020,14 +6031,20 @@ function harnessLoop(name, opts) {
|
|
|
6020
6031
|
}
|
|
6021
6032
|
const intake = new TopicGraph("intake", { retainedLimit });
|
|
6022
6033
|
const strategy = strategyModel();
|
|
6034
|
+
const triageInput = withLatestFrom(
|
|
6035
|
+
intake.latest,
|
|
6036
|
+
strategy.node
|
|
6037
|
+
);
|
|
6023
6038
|
const triageNode = promptNode(
|
|
6024
6039
|
adapter,
|
|
6025
|
-
[
|
|
6026
|
-
opts.triagePrompt ?? ((
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6040
|
+
[triageInput],
|
|
6041
|
+
opts.triagePrompt ?? ((pair) => {
|
|
6042
|
+
const [item, strat] = pair;
|
|
6043
|
+
if (!item) return "";
|
|
6044
|
+
return DEFAULT_TRIAGE_PROMPT.replace(
|
|
6045
|
+
"{{strategy}}",
|
|
6046
|
+
JSON.stringify(Array.from(strat.entries()))
|
|
6047
|
+
).replace("{{item}}", JSON.stringify(item));
|
|
6031
6048
|
}),
|
|
6032
6049
|
{
|
|
6033
6050
|
name: "triage",
|
|
@@ -6039,12 +6056,14 @@ function harnessLoop(name, opts) {
|
|
|
6039
6056
|
for (const route of QUEUE_NAMES) {
|
|
6040
6057
|
queueTopics.set(route, new TopicGraph(`queue/${route}`, { retainedLimit }));
|
|
6041
6058
|
}
|
|
6042
|
-
const
|
|
6059
|
+
const router = effect([triageNode], ([triaged]) => {
|
|
6043
6060
|
const item = triaged;
|
|
6044
6061
|
if (!item || !item.route) return;
|
|
6045
6062
|
const topic2 = queueTopics.get(item.route);
|
|
6046
6063
|
if (topic2) topic2.publish(item);
|
|
6047
6064
|
});
|
|
6065
|
+
router.subscribe(() => {
|
|
6066
|
+
});
|
|
6048
6067
|
const gateGraph = new Graph("gates");
|
|
6049
6068
|
const gateControllers = /* @__PURE__ */ new Map();
|
|
6050
6069
|
for (const route of QUEUE_NAMES) {
|
|
@@ -6074,9 +6093,7 @@ function harnessLoop(name, opts) {
|
|
|
6074
6093
|
const executeNode = promptNode(
|
|
6075
6094
|
adapter,
|
|
6076
6095
|
[executeInput],
|
|
6077
|
-
opts.executePrompt ?? ((item) => {
|
|
6078
|
-
return DEFAULT_EXECUTE_PROMPT.replace("{{item}}", JSON.stringify(item));
|
|
6079
|
-
}),
|
|
6096
|
+
opts.executePrompt ?? ((item) => DEFAULT_EXECUTE_PROMPT.replace("{{item}}", JSON.stringify(item))),
|
|
6080
6097
|
{
|
|
6081
6098
|
name: "execute",
|
|
6082
6099
|
format: "json",
|
|
@@ -6087,66 +6104,87 @@ function harnessLoop(name, opts) {
|
|
|
6087
6104
|
const verifyNode = promptNode(
|
|
6088
6105
|
adapter,
|
|
6089
6106
|
[executeNode, executeInput],
|
|
6090
|
-
opts.verifyPrompt ?? ((execution, item) => {
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
);
|
|
6095
|
-
}),
|
|
6107
|
+
opts.verifyPrompt ?? ((execution, item) => DEFAULT_VERIFY_PROMPT.replace("{{execution}}", JSON.stringify(execution)).replace(
|
|
6108
|
+
"{{item}}",
|
|
6109
|
+
JSON.stringify(item)
|
|
6110
|
+
)),
|
|
6096
6111
|
{
|
|
6097
6112
|
name: "verify",
|
|
6098
6113
|
format: "json",
|
|
6099
6114
|
retries: 1
|
|
6100
6115
|
}
|
|
6101
6116
|
);
|
|
6117
|
+
const verifyWithExec = withLatestFrom(verifyNode, executeNode);
|
|
6118
|
+
const verifyContext = withLatestFrom(
|
|
6119
|
+
verifyWithExec,
|
|
6120
|
+
executeInput
|
|
6121
|
+
);
|
|
6102
6122
|
const maxReingestions = opts.maxReingestions ?? 1;
|
|
6103
|
-
|
|
6104
|
-
const
|
|
6105
|
-
|
|
6106
|
-
|
|
6123
|
+
const retryTracker = /* @__PURE__ */ new Map();
|
|
6124
|
+
const reingestionTracker = /* @__PURE__ */ new Map();
|
|
6125
|
+
const fastRetry = effect([verifyContext], ([ctx]) => {
|
|
6126
|
+
const [[vo, execRaw], item] = ctx;
|
|
6127
|
+
if (!vo || !item) return;
|
|
6128
|
+
const exec = {
|
|
6129
|
+
item,
|
|
6130
|
+
outcome: execRaw?.outcome ?? "failure",
|
|
6131
|
+
detail: execRaw?.detail ?? "unknown"
|
|
6132
|
+
};
|
|
6133
|
+
const vr = {
|
|
6134
|
+
item,
|
|
6135
|
+
execution: exec,
|
|
6136
|
+
verified: vo.verified,
|
|
6137
|
+
findings: vo.findings ?? [],
|
|
6138
|
+
errorClass: vo.errorClass
|
|
6139
|
+
};
|
|
6107
6140
|
if (vr.verified) {
|
|
6108
|
-
strategy.record(
|
|
6141
|
+
strategy.record(item.rootCause, item.intervention, true);
|
|
6109
6142
|
verifyResults.publish(vr);
|
|
6110
6143
|
return;
|
|
6111
6144
|
}
|
|
6112
6145
|
const errClass = vr.errorClass ?? errorClassifier({
|
|
6113
|
-
item
|
|
6146
|
+
item,
|
|
6114
6147
|
outcome: "failure",
|
|
6115
|
-
detail: vr.findings.join("; ")
|
|
6116
|
-
retryCount: 0
|
|
6148
|
+
detail: vr.findings.join("; ")
|
|
6117
6149
|
});
|
|
6118
|
-
const
|
|
6119
|
-
const retryCount =
|
|
6150
|
+
const key = baseSummary(item.summary);
|
|
6151
|
+
const retryCount = retryTracker.get(key) ?? 0;
|
|
6120
6152
|
if (errClass === "self-correctable" && retryCount < maxRetries) {
|
|
6153
|
+
retryTracker.set(key, retryCount + 1);
|
|
6121
6154
|
const retryItem = {
|
|
6122
|
-
...
|
|
6123
|
-
summary: `[RETRY ${retryCount + 1}/${maxRetries}] ${
|
|
6155
|
+
...item,
|
|
6156
|
+
summary: `[RETRY ${retryCount + 1}/${maxRetries}] ${baseSummary(item.summary)} \u2014 Previous attempt failed: ${vr.findings.join("; ")}`
|
|
6124
6157
|
};
|
|
6125
6158
|
retryTopic.publish(retryItem);
|
|
6126
6159
|
} else {
|
|
6127
|
-
strategy.record(
|
|
6160
|
+
strategy.record(item.rootCause, item.intervention, false);
|
|
6128
6161
|
verifyResults.publish(vr);
|
|
6129
|
-
|
|
6130
|
-
|
|
6162
|
+
const itemReingestions = reingestionTracker.get(key) ?? 0;
|
|
6163
|
+
if (itemReingestions < maxReingestions) {
|
|
6164
|
+
reingestionTracker.set(key, itemReingestions + 1);
|
|
6131
6165
|
intake.publish({
|
|
6132
6166
|
source: "eval",
|
|
6133
|
-
summary: `Verification failed for: ${
|
|
6167
|
+
summary: `Verification failed for: ${baseSummary(item.summary)}`,
|
|
6134
6168
|
evidence: vr.findings.join("\n"),
|
|
6135
|
-
affectsAreas:
|
|
6136
|
-
affectsEvalTasks:
|
|
6169
|
+
affectsAreas: item.affectsAreas,
|
|
6170
|
+
affectsEvalTasks: item.affectsEvalTasks,
|
|
6137
6171
|
severity: "high",
|
|
6138
|
-
relatedTo: [
|
|
6172
|
+
relatedTo: [baseSummary(item.summary)]
|
|
6139
6173
|
});
|
|
6140
6174
|
}
|
|
6141
6175
|
}
|
|
6142
6176
|
});
|
|
6177
|
+
fastRetry.subscribe(() => {
|
|
6178
|
+
});
|
|
6143
6179
|
const harness = new HarnessGraph(
|
|
6144
6180
|
name,
|
|
6145
6181
|
intake,
|
|
6146
6182
|
queueTopics,
|
|
6147
6183
|
gateControllers,
|
|
6148
6184
|
strategy,
|
|
6149
|
-
verifyResults
|
|
6185
|
+
verifyResults,
|
|
6186
|
+
retryTracker,
|
|
6187
|
+
reingestionTracker
|
|
6150
6188
|
);
|
|
6151
6189
|
harness.mount("intake", intake);
|
|
6152
6190
|
for (const [route, topic2] of queueTopics) {
|