@alexeiled/pi-fusion 0.6.2 → 0.8.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/README.md +10 -7
- package/agents/fusion-composer.md +3 -0
- package/agents/fusion-judge.md +3 -0
- package/agents/fusion-panelist.md +3 -0
- package/docs/user-guide.md +32 -11
- package/package.json +1 -1
- package/skills/fusion-review/SKILL.md +2 -1
- package/src/caller-contract.ts +80 -0
- package/src/config.ts +58 -2
- package/src/fusion-args.ts +29 -2
- package/src/fusion-rpc.ts +88 -13
- package/src/index.ts +33 -5
- package/src/lifecycle-reconcile.ts +445 -0
- package/src/orchestrator.ts +562 -129
- package/src/panel-completion.ts +105 -7
- package/src/panel-quorum.ts +22 -0
- package/src/report.ts +105 -3
- package/src/result-extract.ts +84 -7
- package/src/run-builder.ts +141 -15
- package/src/run-store.ts +377 -11
- package/src/status.ts +1 -1
- package/src/types.ts +89 -0
package/src/types.ts
CHANGED
|
@@ -15,6 +15,7 @@ export const JUDGE_AGENT = "pi-fusion.fusion-judge";
|
|
|
15
15
|
export const COMPOSER_AGENT = "pi-fusion.fusion-composer";
|
|
16
16
|
|
|
17
17
|
export type FusionContextMode = "fresh" | "fork";
|
|
18
|
+
export type CallerOutputContract = "plan-review-v1";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* How panel answers become one report.
|
|
@@ -44,11 +45,41 @@ export interface JudgeConfig {
|
|
|
44
45
|
thinking?: ThinkingLevel;
|
|
45
46
|
}
|
|
46
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
|
+
panelistTimeoutMs: number;
|
|
60
|
+
panelTimeoutMs: number;
|
|
61
|
+
panelGraceMs: number;
|
|
62
|
+
judgeTimeoutMs: number;
|
|
63
|
+
/** True when the legacy shared timeout supplied one or more deadline values. */
|
|
64
|
+
usesLegacyTimeout: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
47
67
|
export interface FusionProfile {
|
|
48
68
|
panel: PanelMemberConfig[];
|
|
49
69
|
judge: JudgeConfig;
|
|
50
70
|
concurrency?: number;
|
|
71
|
+
/** Legacy shared wall-clock timeout used when a stage timeout is absent. */
|
|
51
72
|
timeoutMs?: number;
|
|
73
|
+
/** Per-child deadline. It is capped below the enclosing panel deadline. */
|
|
74
|
+
panelistTimeoutMs?: number;
|
|
75
|
+
/** Wall-clock timeout for the complete panel workflow. */
|
|
76
|
+
panelTimeoutMs?: number;
|
|
77
|
+
/** Time reserved between child and enclosing panel deadlines. */
|
|
78
|
+
panelGraceMs?: number;
|
|
79
|
+
/** Wall-clock timeout for the synthesis workflow. */
|
|
80
|
+
judgeTimeoutMs?: number;
|
|
81
|
+
/** Successful panel outputs required for synthesis. Defaults to a majority. */
|
|
82
|
+
minimumSuccessfulPanelists?: MinimumSuccessfulPanelists;
|
|
52
83
|
context?: FusionContextMode;
|
|
53
84
|
stopWhenPanelAgrees?: boolean;
|
|
54
85
|
/**
|
|
@@ -57,6 +88,11 @@ export interface FusionProfile {
|
|
|
57
88
|
* content is compared. The report always restores the real labels.
|
|
58
89
|
*/
|
|
59
90
|
blindPanelLabels?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Caps each panelist's tool calls. `soft` nudges; `hard` blocks further tool
|
|
93
|
+
* use so the panelist still finalises before the workflow timeout.
|
|
94
|
+
*/
|
|
95
|
+
panelToolBudget?: ToolBudget;
|
|
60
96
|
/**
|
|
61
97
|
* Caps the tool calls the judge may spend verifying contested claims.
|
|
62
98
|
* `soft` nudges, `hard` blocks further tool use so the judge still finalises.
|
|
@@ -110,6 +146,7 @@ export function resolveSynthesisMode(
|
|
|
110
146
|
export interface ToolBudget {
|
|
111
147
|
soft?: number;
|
|
112
148
|
hard?: number;
|
|
149
|
+
block?: "*" | string[];
|
|
113
150
|
}
|
|
114
151
|
|
|
115
152
|
export type PanelConfidence = "low" | "medium" | "high";
|
|
@@ -157,8 +194,10 @@ export interface ParsedFusionArgs {
|
|
|
157
194
|
prompt: string;
|
|
158
195
|
profile?: string;
|
|
159
196
|
operationId?: string;
|
|
197
|
+
outputContract?: CallerOutputContract;
|
|
160
198
|
/** Inline panel entries from `--panel`: `<model>` or `<agent>:<model>`. */
|
|
161
199
|
panel?: string[];
|
|
200
|
+
timeoutOverrides?: FusionTimeoutOverrides;
|
|
162
201
|
}
|
|
163
202
|
|
|
164
203
|
export interface PanelOutput {
|
|
@@ -197,6 +236,43 @@ export interface FailedPanelSummary {
|
|
|
197
236
|
export type FusionPhase =
|
|
198
237
|
"panel" | "chain" | "judge" | "done" | "failed" | "cancelled";
|
|
199
238
|
|
|
239
|
+
export type CompletionQuality = "complete" | "partial";
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The start-time settings required after a process restart. This intentionally
|
|
243
|
+
* excludes panel execution-only values (concurrency, panel tool budget, and
|
|
244
|
+
* raw timeout fields): the panel is already running, while resolved deadlines
|
|
245
|
+
* are persisted separately in `effectiveTimeouts`.
|
|
246
|
+
*/
|
|
247
|
+
export interface FusionProfileSnapshot {
|
|
248
|
+
panel: PanelMemberConfig[];
|
|
249
|
+
judge: JudgeConfig;
|
|
250
|
+
minimumSuccessfulPanelists: number;
|
|
251
|
+
context?: FusionContextMode;
|
|
252
|
+
stopWhenPanelAgrees?: boolean;
|
|
253
|
+
blindPanelLabels?: boolean;
|
|
254
|
+
judgeToolBudget?: ToolBudget;
|
|
255
|
+
synthesis?: FusionSynthesisMode;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** Persisted recovery metadata for a terminal run. Failed-only retry is not
|
|
259
|
+
* yet exposed, so this records exactly which slots a future explicit retry may
|
|
260
|
+
* safely target without replaying verified completed work. */
|
|
261
|
+
export interface FusionRecoveryState {
|
|
262
|
+
retryDeferred: true;
|
|
263
|
+
failedPanelIndices: number[];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Durable record written before a public RPC spawn. The public API cannot
|
|
268
|
+
* query by this correlation token, so a restored intent without its returned
|
|
269
|
+
* run ID is deliberately failed instead of risking a duplicate remote run.
|
|
270
|
+
*/
|
|
271
|
+
export interface FusionSpawnIntent {
|
|
272
|
+
stage: "panel" | "judge";
|
|
273
|
+
requestedAt: number;
|
|
274
|
+
}
|
|
275
|
+
|
|
200
276
|
export interface FusionRun {
|
|
201
277
|
id: string;
|
|
202
278
|
prompt: string;
|
|
@@ -210,6 +286,17 @@ export interface FusionRun {
|
|
|
210
286
|
/** Name of the config profile the inline panel was layered onto. */
|
|
211
287
|
baseProfileName?: string;
|
|
212
288
|
operationId?: string;
|
|
289
|
+
outputContract?: CallerOutputContract;
|
|
290
|
+
/** Persisted start policy so recovery is not changed by later config edits. */
|
|
291
|
+
minimumSuccessfulPanelists?: MinimumSuccessfulPanelists;
|
|
292
|
+
/**
|
|
293
|
+
* Additive start-time profile snapshot. Old sessions omit it and retain the
|
|
294
|
+
* legacy config lookup fallback during restore.
|
|
295
|
+
*/
|
|
296
|
+
profileSnapshot?: FusionProfileSnapshot;
|
|
297
|
+
timeoutOverrides?: FusionTimeoutOverrides;
|
|
298
|
+
effectiveTimeouts?: EffectiveFusionTimeouts;
|
|
299
|
+
completionQuality?: CompletionQuality;
|
|
213
300
|
phase: FusionPhase;
|
|
214
301
|
createdAt: number;
|
|
215
302
|
updatedAt: number;
|
|
@@ -224,6 +311,8 @@ export interface FusionRun {
|
|
|
224
311
|
judgeObservation?: RunObservation;
|
|
225
312
|
panelOutputs?: PanelOutput[];
|
|
226
313
|
panelFailures?: FailedPanelSummary[];
|
|
314
|
+
recovery?: FusionRecoveryState;
|
|
315
|
+
spawnIntent?: FusionSpawnIntent;
|
|
227
316
|
report?: string;
|
|
228
317
|
error?: string;
|
|
229
318
|
}
|