@alexeiled/pi-fusion 0.3.0 → 0.3.1
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/package.json +1 -1
- package/src/index.ts +27 -11
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
import { FusionRunStore } from "./run-store.js";
|
|
9
9
|
import { SubagentsRpcClient } from "./subagents-rpc.js";
|
|
10
10
|
|
|
11
|
-
function registerFusionTool(
|
|
11
|
+
function registerFusionTool(
|
|
12
|
+
pi: ExtensionAPI,
|
|
13
|
+
orchestrator: FusionOrchestrator,
|
|
14
|
+
): void {
|
|
12
15
|
pi.registerTool({
|
|
13
16
|
name: "start_fusion_review",
|
|
14
17
|
label: "Fusion Review",
|
|
@@ -24,15 +27,28 @@ function registerFusionTool(pi: ExtensionAPI): void {
|
|
|
24
27
|
Type.String({ description: "Fusion profile name (optional)" }),
|
|
25
28
|
),
|
|
26
29
|
}),
|
|
27
|
-
execute(_toolCallId, params) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
31
|
+
const result = await orchestrator.startRun(
|
|
32
|
+
{
|
|
33
|
+
prompt: params.prompt,
|
|
34
|
+
...(params.profile ? { profile: params.profile } : {}),
|
|
35
|
+
},
|
|
36
|
+
ctx,
|
|
37
|
+
);
|
|
38
|
+
const text =
|
|
39
|
+
result.status === "started"
|
|
40
|
+
? "Fusion panel review started. The report will be posted when the panel and judge finish."
|
|
41
|
+
: result.status === "conflict"
|
|
42
|
+
? `A fusion run is already active (${result.activeRunId}). Do not start another; wait for its report.`
|
|
43
|
+
: `Fusion review failed to start: ${result.status === "failed" ? result.error : result.status}`;
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text }],
|
|
46
|
+
details: {
|
|
47
|
+
prompt: params.prompt,
|
|
48
|
+
profile: params.profile,
|
|
49
|
+
status: result.status,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
36
52
|
},
|
|
37
53
|
});
|
|
38
54
|
}
|
|
@@ -45,7 +61,7 @@ export default function fusionExtension(pi: ExtensionAPI): void {
|
|
|
45
61
|
});
|
|
46
62
|
|
|
47
63
|
registerFusionCommands(pi, orchestrator);
|
|
48
|
-
registerFusionTool(pi);
|
|
64
|
+
registerFusionTool(pi, orchestrator);
|
|
49
65
|
|
|
50
66
|
const unsubscribeComplete = pi.events.on(
|
|
51
67
|
SUBAGENT_ASYNC_COMPLETE_EVENT,
|