@emiliosp/pi-maestro 0.6.0 โ 0.6.2
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/extensions/maestro.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
7
|
+
import { loadConfiguration } from '#config/loadConfiguration.ts';
|
|
7
8
|
import { assertEnvironment } from '#maestro/checks/assertEnvironment.ts';
|
|
8
9
|
import { getMaestroInstructions } from '#maestro/instructions/getMaestroInstructions.ts';
|
|
9
10
|
import maestroSessionState from '#maestro/session/MaestroSessionState.ts';
|
|
@@ -83,6 +84,27 @@ export default (pi: ExtensionAPI): void => {
|
|
|
83
84
|
|
|
84
85
|
try {
|
|
85
86
|
await assertEnvironment(context);
|
|
87
|
+
const config = await loadConfiguration(context.cwd);
|
|
88
|
+
|
|
89
|
+
maestroSessionState.activate();
|
|
90
|
+
syncMainTools();
|
|
91
|
+
await refreshMaestroStatus(context);
|
|
92
|
+
|
|
93
|
+
// show builder/verifier model on activation
|
|
94
|
+
context.ui.notify(
|
|
95
|
+
[
|
|
96
|
+
context.ui.theme.fg('muted', 'Maestro active'),
|
|
97
|
+
context.ui.theme.fg(
|
|
98
|
+
'accent',
|
|
99
|
+
`Builder (${config.builder.model} ${config.builder.thinking})`,
|
|
100
|
+
),
|
|
101
|
+
context.ui.theme.fg(
|
|
102
|
+
'accent',
|
|
103
|
+
`Verifier (${config.verifier.model} ${config.verifier.thinking})`,
|
|
104
|
+
),
|
|
105
|
+
].join('\n'),
|
|
106
|
+
'info',
|
|
107
|
+
);
|
|
86
108
|
} catch (error) {
|
|
87
109
|
context.ui.notify(
|
|
88
110
|
error instanceof Error ? error.message : String(error),
|
|
@@ -91,10 +113,6 @@ export default (pi: ExtensionAPI): void => {
|
|
|
91
113
|
|
|
92
114
|
return;
|
|
93
115
|
}
|
|
94
|
-
|
|
95
|
-
maestroSessionState.activate();
|
|
96
|
-
syncMainTools();
|
|
97
|
-
await refreshMaestroStatus(context);
|
|
98
116
|
},
|
|
99
117
|
});
|
|
100
118
|
|
package/package.json
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
* Used: When the main extension refreshes Maestro status.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type { Theme, ThemeColor } from '@earendil-works/pi-coding-agent';
|
|
7
|
+
import {
|
|
8
|
+
WORKFLOW_PHASES,
|
|
9
|
+
type WorkflowPhase,
|
|
10
|
+
type WorkflowState,
|
|
11
|
+
} from '#workflow/state/schema.ts';
|
|
7
12
|
|
|
8
|
-
const WORKFLOW_PHASE_LABELS = {
|
|
13
|
+
export const WORKFLOW_PHASE_LABELS = {
|
|
9
14
|
[WORKFLOW_PHASES.DRAFTING_SPEC]: 'Preparing specification',
|
|
10
15
|
[WORKFLOW_PHASES.READY_FOR_BUILDER]: 'Ready for builder',
|
|
11
16
|
[WORKFLOW_PHASES.BUILDER_RUNNING]: 'Builder running',
|
|
@@ -17,6 +22,40 @@ const WORKFLOW_PHASE_LABELS = {
|
|
|
17
22
|
[WORKFLOW_PHASES.CANDIDATE_READY]: 'Completed',
|
|
18
23
|
} as const;
|
|
19
24
|
|
|
25
|
+
export const WORKFLOW_PHASE_ICONS = {
|
|
26
|
+
[WORKFLOW_PHASES.DRAFTING_SPEC]: '๐',
|
|
27
|
+
[WORKFLOW_PHASES.READY_FOR_BUILDER]: '๐ง',
|
|
28
|
+
[WORKFLOW_PHASES.BUILDER_RUNNING]: '๐ ๏ธ',
|
|
29
|
+
[WORKFLOW_PHASES.ESCALATION_DECISION]: 'โ',
|
|
30
|
+
[WORKFLOW_PHASES.BUILDER_FAILED]: 'โ',
|
|
31
|
+
[WORKFLOW_PHASES.READY_FOR_VERIFIER]: '๐',
|
|
32
|
+
[WORKFLOW_PHASES.VERIFIER_RUNNING]: '๐',
|
|
33
|
+
[WORKFLOW_PHASES.FINDINGS_DECISION]: '๐ฌ',
|
|
34
|
+
[WORKFLOW_PHASES.CANDIDATE_READY]: 'โ
',
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export const WORKFLOW_PHASE_COLORS = {
|
|
38
|
+
[WORKFLOW_PHASES.DRAFTING_SPEC]: 'accent',
|
|
39
|
+
[WORKFLOW_PHASES.READY_FOR_BUILDER]: 'accent',
|
|
40
|
+
[WORKFLOW_PHASES.BUILDER_RUNNING]: 'accent',
|
|
41
|
+
[WORKFLOW_PHASES.ESCALATION_DECISION]: 'warning',
|
|
42
|
+
[WORKFLOW_PHASES.BUILDER_FAILED]: 'error',
|
|
43
|
+
[WORKFLOW_PHASES.READY_FOR_VERIFIER]: 'accent',
|
|
44
|
+
[WORKFLOW_PHASES.VERIFIER_RUNNING]: 'accent',
|
|
45
|
+
[WORKFLOW_PHASES.FINDINGS_DECISION]: 'warning',
|
|
46
|
+
[WORKFLOW_PHASES.CANDIDATE_READY]: 'success',
|
|
47
|
+
} as const satisfies Record<WorkflowPhase, ThemeColor>;
|
|
48
|
+
|
|
49
|
+
const shortenSpecId = (specId: string): string => {
|
|
50
|
+
const title = specId.slice(16);
|
|
51
|
+
|
|
52
|
+
if (title.length <= 10) {
|
|
53
|
+
return specId;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return `${specId.slice(0, 26)}...`;
|
|
57
|
+
};
|
|
58
|
+
|
|
20
59
|
type MaestroStatusWorkflow = {
|
|
21
60
|
state: WorkflowState;
|
|
22
61
|
};
|
|
@@ -24,21 +63,34 @@ type MaestroStatusWorkflow = {
|
|
|
24
63
|
type FormatMaestroStatusInput = {
|
|
25
64
|
active: boolean;
|
|
26
65
|
workflow: MaestroStatusWorkflow | null;
|
|
66
|
+
theme: Pick<Theme, 'fg'>; // foreground theme
|
|
27
67
|
};
|
|
28
68
|
|
|
29
69
|
export const formatMaestroStatus = ({
|
|
30
70
|
active,
|
|
31
71
|
workflow,
|
|
72
|
+
theme,
|
|
32
73
|
}: FormatMaestroStatusInput): string | undefined => {
|
|
33
74
|
if (!active) {
|
|
34
75
|
return undefined;
|
|
35
76
|
}
|
|
36
77
|
|
|
37
78
|
if (workflow === null) {
|
|
38
|
-
|
|
79
|
+
// muted is a theme color for less prominent text, usually a dim gray.
|
|
80
|
+
return `${theme.fg('muted', 'Maestro active ยท ')}${theme.fg('accent', 'No active spec')}`;
|
|
39
81
|
}
|
|
40
82
|
|
|
41
|
-
const phase =
|
|
83
|
+
const { phase, specId } = workflow.state;
|
|
84
|
+
|
|
85
|
+
const prefix = theme.fg(
|
|
86
|
+
'muted',
|
|
87
|
+
`Maestro active ยท ${shortenSpecId(specId)} ยท `,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const label = theme.fg(
|
|
91
|
+
WORKFLOW_PHASE_COLORS[phase],
|
|
92
|
+
WORKFLOW_PHASE_LABELS[phase],
|
|
93
|
+
);
|
|
42
94
|
|
|
43
|
-
return
|
|
95
|
+
return `${prefix}${WORKFLOW_PHASE_ICONS[phase]} ${label}`;
|
|
44
96
|
};
|
|
@@ -25,7 +25,11 @@ export const refreshMaestroStatus = async (
|
|
|
25
25
|
if (specId === null) {
|
|
26
26
|
context.ui.setStatus(
|
|
27
27
|
MAESTRO_STATUS_KEY,
|
|
28
|
-
formatMaestroStatus({
|
|
28
|
+
formatMaestroStatus({
|
|
29
|
+
active: true,
|
|
30
|
+
workflow: null,
|
|
31
|
+
theme: context.ui.theme,
|
|
32
|
+
}),
|
|
29
33
|
);
|
|
30
34
|
|
|
31
35
|
return;
|
|
@@ -38,7 +42,11 @@ export const refreshMaestroStatus = async (
|
|
|
38
42
|
|
|
39
43
|
context.ui.setStatus(
|
|
40
44
|
MAESTRO_STATUS_KEY,
|
|
41
|
-
formatMaestroStatus({
|
|
45
|
+
formatMaestroStatus({
|
|
46
|
+
active: true,
|
|
47
|
+
workflow: { state },
|
|
48
|
+
theme: context.ui.theme,
|
|
49
|
+
}),
|
|
42
50
|
);
|
|
43
51
|
} catch (error) {
|
|
44
52
|
context.ui.setStatus(MAESTRO_STATUS_KEY, undefined);
|