@alexeiled/pi-fusion 0.7.0 → 0.9.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/src/types.ts CHANGED
@@ -45,16 +45,44 @@ export interface JudgeConfig {
45
45
  thinking?: ThinkingLevel;
46
46
  }
47
47
 
48
+ export type MinimumSuccessfulPanelists = "majority" | "all" | number;
49
+
50
+ /** Per-run deadline overrides accepted by CLI, tool, and RPC starts. */
51
+ export interface FusionTimeoutOverrides {
52
+ panelistTimeoutMs?: number;
53
+ panelTimeoutMs?: number;
54
+ panelGraceMs?: number;
55
+ judgeTimeoutMs?: number;
56
+ }
57
+
58
+ export interface EffectiveFusionTimeouts {
59
+ panelistSoftTimeoutMs?: number;
60
+ panelistTimeoutMs: number;
61
+ panelTimeoutMs: number;
62
+ panelGraceMs: number;
63
+ judgeTimeoutMs: number;
64
+ /** True when the legacy shared timeout supplied one or more deadline values. */
65
+ usesLegacyTimeout: boolean;
66
+ }
67
+
48
68
  export interface FusionProfile {
49
69
  panel: PanelMemberConfig[];
50
70
  judge: JudgeConfig;
51
71
  concurrency?: number;
52
72
  /** Legacy shared wall-clock timeout used when a stage timeout is absent. */
53
73
  timeoutMs?: number;
74
+ /** Opt-in parent decision before the hard child deadline; reserves one minute to finalize. */
75
+ panelistSoftTimeoutMs?: number;
76
+ /** Per-child deadline. It is capped below the enclosing panel deadline. */
77
+ panelistTimeoutMs?: number;
54
78
  /** Wall-clock timeout for the complete panel workflow. */
55
79
  panelTimeoutMs?: number;
80
+ /** Time reserved between child and enclosing panel deadlines. */
81
+ panelGraceMs?: number;
56
82
  /** Wall-clock timeout for the synthesis workflow. */
57
83
  judgeTimeoutMs?: number;
84
+ /** Successful panel outputs required for synthesis. Defaults to a majority. */
85
+ minimumSuccessfulPanelists?: MinimumSuccessfulPanelists;
58
86
  context?: FusionContextMode;
59
87
  stopWhenPanelAgrees?: boolean;
60
88
  /**
@@ -172,6 +200,7 @@ export interface ParsedFusionArgs {
172
200
  outputContract?: CallerOutputContract;
173
201
  /** Inline panel entries from `--panel`: `<model>` or `<agent>:<model>`. */
174
202
  panel?: string[];
203
+ timeoutOverrides?: FusionTimeoutOverrides;
175
204
  }
176
205
 
177
206
  export interface PanelOutput {
@@ -210,6 +239,53 @@ export interface FailedPanelSummary {
210
239
  export type FusionPhase =
211
240
  "panel" | "chain" | "judge" | "done" | "failed" | "cancelled";
212
241
 
242
+ export type CompletionQuality = "complete" | "partial";
243
+
244
+ /**
245
+ * The start-time settings required after a process restart. This intentionally
246
+ * excludes panel execution-only values (concurrency, panel tool budget, and
247
+ * raw timeout fields): the panel is already running, while resolved deadlines
248
+ * are persisted separately in `effectiveTimeouts`.
249
+ */
250
+ export interface FusionProfileSnapshot {
251
+ panel: PanelMemberConfig[];
252
+ judge: JudgeConfig;
253
+ minimumSuccessfulPanelists: number;
254
+ context?: FusionContextMode;
255
+ stopWhenPanelAgrees?: boolean;
256
+ blindPanelLabels?: boolean;
257
+ judgeToolBudget?: ToolBudget;
258
+ synthesis?: FusionSynthesisMode;
259
+ }
260
+
261
+ /** Persisted recovery metadata for a terminal run. Failed-only retry is not
262
+ * yet exposed, so this records exactly which slots a future explicit retry may
263
+ * safely target without replaying verified completed work. */
264
+ export interface FusionRecoveryState {
265
+ retryDeferred: true;
266
+ failedPanelIndices: number[];
267
+ }
268
+
269
+ /**
270
+ * Durable record written before a public RPC spawn. The public API cannot
271
+ * query by this correlation token, so a restored intent without its returned
272
+ * run ID is deliberately failed instead of risking a duplicate remote run.
273
+ */
274
+ export interface FusionSpawnIntent {
275
+ stage: "panel" | "judge";
276
+ requestedAt: number;
277
+ }
278
+
279
+ export interface PanelDeadlineState {
280
+ index: number;
281
+ childRunId: string;
282
+ requestedAt: number;
283
+ finalizeAt: number;
284
+ hardDeadlineAt: number;
285
+ status: "pending" | "continued" | "finishing";
286
+ deliveryError?: string;
287
+ }
288
+
213
289
  export interface FusionRun {
214
290
  id: string;
215
291
  prompt: string;
@@ -224,6 +300,16 @@ export interface FusionRun {
224
300
  baseProfileName?: string;
225
301
  operationId?: string;
226
302
  outputContract?: CallerOutputContract;
303
+ /** Persisted start policy so recovery is not changed by later config edits. */
304
+ minimumSuccessfulPanelists?: MinimumSuccessfulPanelists;
305
+ /**
306
+ * Additive start-time profile snapshot. Old sessions omit it and retain the
307
+ * legacy config lookup fallback during restore.
308
+ */
309
+ profileSnapshot?: FusionProfileSnapshot;
310
+ timeoutOverrides?: FusionTimeoutOverrides;
311
+ effectiveTimeouts?: EffectiveFusionTimeouts;
312
+ completionQuality?: CompletionQuality;
227
313
  phase: FusionPhase;
228
314
  createdAt: number;
229
315
  updatedAt: number;
@@ -233,11 +319,14 @@ export interface FusionRun {
233
319
  panelAsyncDir?: string;
234
320
  panelStopReason?: "agreement";
235
321
  panelStoppedIndices?: number[];
322
+ panelDeadlines?: PanelDeadlineState[];
236
323
  judgeRunId?: string;
237
324
  judgeAsyncDir?: string;
238
325
  judgeObservation?: RunObservation;
239
326
  panelOutputs?: PanelOutput[];
240
327
  panelFailures?: FailedPanelSummary[];
328
+ recovery?: FusionRecoveryState;
329
+ spawnIntent?: FusionSpawnIntent;
241
330
  report?: string;
242
331
  error?: string;
243
332
  }