@alexeiled/pi-fusion 0.6.1 → 0.7.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 +8 -6
- 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 +23 -5
- package/package.json +1 -1
- package/src/caller-contract.ts +80 -0
- package/src/config.ts +32 -2
- package/src/fusion-rpc.ts +59 -13
- package/src/lifecycle-reconcile.ts +248 -0
- package/src/orchestrator.ts +78 -61
- package/src/panel-completion.ts +57 -7
- package/src/report.ts +20 -0
- package/src/result-extract.ts +18 -3
- package/src/run-builder.ts +84 -24
- package/src/run-store.ts +17 -0
- package/src/types.ts +14 -0
package/src/run-store.ts
CHANGED
|
@@ -24,6 +24,7 @@ export type FusionRunSummary = Omit<
|
|
|
24
24
|
| "prompt"
|
|
25
25
|
| "profileName"
|
|
26
26
|
| "operationId"
|
|
27
|
+
| "outputContract"
|
|
27
28
|
| "phase"
|
|
28
29
|
| "createdAt"
|
|
29
30
|
| "updatedAt"
|
|
@@ -43,6 +44,7 @@ export interface FusionRunStartInput {
|
|
|
43
44
|
inlinePanel?: string[];
|
|
44
45
|
baseProfileName?: string;
|
|
45
46
|
operationId?: string;
|
|
47
|
+
outputContract?: FusionRun["outputContract"];
|
|
46
48
|
phase?: Exclude<FusionPhase, FusionTerminalPhase>;
|
|
47
49
|
createdAt?: number;
|
|
48
50
|
}
|
|
@@ -162,6 +164,9 @@ export class FusionRunStore {
|
|
|
162
164
|
...(input.operationId !== undefined
|
|
163
165
|
? { operationId: input.operationId }
|
|
164
166
|
: {}),
|
|
167
|
+
...(input.outputContract !== undefined
|
|
168
|
+
? { outputContract: input.outputContract }
|
|
169
|
+
: {}),
|
|
165
170
|
phase: input.phase ?? "chain",
|
|
166
171
|
createdAt,
|
|
167
172
|
updatedAt: createdAt,
|
|
@@ -379,6 +384,9 @@ function toRunSummary(
|
|
|
379
384
|
prompt: run.prompt,
|
|
380
385
|
profileName: run.profileName,
|
|
381
386
|
...(run.operationId !== undefined ? { operationId: run.operationId } : {}),
|
|
387
|
+
...(run.outputContract !== undefined
|
|
388
|
+
? { outputContract: run.outputContract }
|
|
389
|
+
: {}),
|
|
382
390
|
phase: run.phase,
|
|
383
391
|
createdAt: run.createdAt,
|
|
384
392
|
updatedAt: run.updatedAt,
|
|
@@ -404,6 +412,9 @@ function cloneRun(run: FusionRun): FusionRun {
|
|
|
404
412
|
? { baseProfileName: run.baseProfileName }
|
|
405
413
|
: {}),
|
|
406
414
|
...(run.operationId !== undefined ? { operationId: run.operationId } : {}),
|
|
415
|
+
...(run.outputContract !== undefined
|
|
416
|
+
? { outputContract: run.outputContract }
|
|
417
|
+
: {}),
|
|
407
418
|
phase: run.phase,
|
|
408
419
|
createdAt: run.createdAt,
|
|
409
420
|
updatedAt: run.updatedAt,
|
|
@@ -462,6 +473,12 @@ function isFusionRunState(value: unknown): value is FusionRun {
|
|
|
462
473
|
if (value.operationId !== undefined && !isNonEmptyString(value.operationId)) {
|
|
463
474
|
return false;
|
|
464
475
|
}
|
|
476
|
+
if (
|
|
477
|
+
value.outputContract !== undefined &&
|
|
478
|
+
value.outputContract !== "plan-review-v1"
|
|
479
|
+
) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
465
482
|
if (
|
|
466
483
|
value.inlinePanel !== undefined &&
|
|
467
484
|
(!Array.isArray(value.inlinePanel) ||
|
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.
|
|
@@ -48,7 +49,12 @@ export interface FusionProfile {
|
|
|
48
49
|
panel: PanelMemberConfig[];
|
|
49
50
|
judge: JudgeConfig;
|
|
50
51
|
concurrency?: number;
|
|
52
|
+
/** Legacy shared wall-clock timeout used when a stage timeout is absent. */
|
|
51
53
|
timeoutMs?: number;
|
|
54
|
+
/** Wall-clock timeout for the complete panel workflow. */
|
|
55
|
+
panelTimeoutMs?: number;
|
|
56
|
+
/** Wall-clock timeout for the synthesis workflow. */
|
|
57
|
+
judgeTimeoutMs?: number;
|
|
52
58
|
context?: FusionContextMode;
|
|
53
59
|
stopWhenPanelAgrees?: boolean;
|
|
54
60
|
/**
|
|
@@ -57,6 +63,11 @@ export interface FusionProfile {
|
|
|
57
63
|
* content is compared. The report always restores the real labels.
|
|
58
64
|
*/
|
|
59
65
|
blindPanelLabels?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Caps each panelist's tool calls. `soft` nudges; `hard` blocks further tool
|
|
68
|
+
* use so the panelist still finalises before the workflow timeout.
|
|
69
|
+
*/
|
|
70
|
+
panelToolBudget?: ToolBudget;
|
|
60
71
|
/**
|
|
61
72
|
* Caps the tool calls the judge may spend verifying contested claims.
|
|
62
73
|
* `soft` nudges, `hard` blocks further tool use so the judge still finalises.
|
|
@@ -110,6 +121,7 @@ export function resolveSynthesisMode(
|
|
|
110
121
|
export interface ToolBudget {
|
|
111
122
|
soft?: number;
|
|
112
123
|
hard?: number;
|
|
124
|
+
block?: "*" | string[];
|
|
113
125
|
}
|
|
114
126
|
|
|
115
127
|
export type PanelConfidence = "low" | "medium" | "high";
|
|
@@ -157,6 +169,7 @@ export interface ParsedFusionArgs {
|
|
|
157
169
|
prompt: string;
|
|
158
170
|
profile?: string;
|
|
159
171
|
operationId?: string;
|
|
172
|
+
outputContract?: CallerOutputContract;
|
|
160
173
|
/** Inline panel entries from `--panel`: `<model>` or `<agent>:<model>`. */
|
|
161
174
|
panel?: string[];
|
|
162
175
|
}
|
|
@@ -210,6 +223,7 @@ export interface FusionRun {
|
|
|
210
223
|
/** Name of the config profile the inline panel was layered onto. */
|
|
211
224
|
baseProfileName?: string;
|
|
212
225
|
operationId?: string;
|
|
226
|
+
outputContract?: CallerOutputContract;
|
|
213
227
|
phase: FusionPhase;
|
|
214
228
|
createdAt: number;
|
|
215
229
|
updatedAt: number;
|