@emiliosp/pi-maestro 0.9.1 → 0.9.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  This file summarizes meaningful changes to the codebase, including behavior, data formats, architecture, and development tools. Git tags identify version boundaries; GitHub Releases are not required. Version-only changes and routine maintenance are omitted.
4
4
 
5
+ ## 0.9.2
6
+
7
+ 1. Added code-quality review to `verifier` guidance for code affected by the approved change when applicable `AGENTS.md` directives exist. See [PR #34](https://github.com/emilioSp/pi-maestro/pull/34). All existing verification duties remain unchanged.
8
+ 2. Required instruction-violation `findings` to identify the instruction file, quote the rule, and explain the violating code through existing evidence fields.
9
+ 3. Skip only the added review when files or code-quality directives are absent. Missing directives and personal style preferences do not produce `findings`.
10
+
5
11
  ## 0.9.1
6
12
 
7
13
  1. Added a brief introduction and an invitation to ask how `Maestro` works to the successful activation notice. See [PR #33](https://github.com/emilioSp/pi-maestro/pull/33).
package/ROADMAP.md CHANGED
@@ -44,7 +44,7 @@ Applied glossary formatting across the documentation and recorded its exclusions
44
44
 
45
45
  ### R-14: Introduce Maestro at activation
46
46
 
47
- Implemented in `0.9.1`. npm publication is pending. Successful activation introduces `Maestro` and invites the `owner` to ask how it works. The UI-only notice retains the configured agent details and does not add session history or start a model request.
47
+ Implemented in `0.9.1`. Successful activation introduces `Maestro` and invites the `owner` to ask how it works. The UI-only notice retains the configured agent details and does not add session history or start a model request.
48
48
 
49
49
  Active instructions identify absolute paths to the installed README and documentation directory. `Maestro` reads relevant documentation on demand without automatically loading its contents.
50
50
 
@@ -62,8 +62,39 @@ Renamed `test/` to `tests/` at the owner's request. Updated imports, fixture pat
62
62
 
63
63
  [Test support](tests/support/), [fixtures](tests/fixtures/), [lint configuration](biome.json), and [project instructions](AGENTS.md#tests).
64
64
 
65
+ ### R-16: Verify code quality against AGENTS.md instructions
66
+
67
+ Implemented in `0.9.2`. `Verifier` guidance now requires code-quality review only for code affected by the approved change when applicable `AGENTS.md` directives exist. All existing duties remain unchanged, including independent verification of every `acceptance criterion`.
68
+
69
+ Instruction-violation `findings` identify the instruction file, quote the rule, and explain the violating code through existing evidence fields. Missing files or code-quality directives cause only the added review to be skipped. Personal style preferences are not requirements.
70
+
71
+ All 5 `acceptance criteria` passed through independent inspection of the written guidance, with no `verifier` `findings`. No additional model trials were performed. The saved workflow reached `candidate-ready`.
72
+
73
+ #### Evidence
74
+
75
+ [Specification](.specs/20261013-185941-verify-code-quality-against-agents-md-instructions/spec.md), [verifier report](.specs/20261013-185941-verify-code-quality-against-agents-md-instructions/handoffs/verifier/V1.json), and [merged PR #34](https://github.com/emilioSp/pi-maestro/pull/34).
76
+
65
77
  ## Now
66
78
 
79
+ ### R-06: Check subagent extensions at activation
80
+
81
+ #### Objective
82
+
83
+ Make `pi-subagents` availability problems visible before a `builder` or `verifier` `run` starts.
84
+
85
+ #### Implementation status
86
+
87
+ Activation now requires a successful version 1 `ping` reply from the parent `pi-subagents` extension within 2000 ms. The check does not start an agent. All 7 `acceptance criteria` passed with no `verifier` `findings`; the workflow reached `candidate-ready`.
88
+
89
+ A later integration test requested by the `owner` directly checks the environment check's failed-reply error. This test addition is outside the completed independent verification.
90
+
91
+ [Specification](.specs/20261013-194407-check-pi-subagents-availability-with-ping-at-activation/spec.md).
92
+
93
+ #### Completed when
94
+
95
+ Unavailable `pi-subagents` prevents activation. The error identifies the problem.
96
+
97
+
67
98
  ## Next
68
99
 
69
100
  ## Later
@@ -92,16 +123,6 @@ When criteria are removed during `spec` preparation or revision, renumber the re
92
123
 
93
124
  The `spec` and its current references use consistent numbering.
94
125
 
95
- ### R-06: Check subagent extensions at activation
96
-
97
- #### Objective
98
-
99
- Make extension availability problems visible before a `builder` or `verifier` `run` starts. Activation already checks agent launch requirements, so first identify any missing extension checks.
100
-
101
- #### Completed when
102
-
103
- Unavailable required subagent extensions prevent activation. The error identifies the problem.
104
-
105
126
  ### R-07: Guide initial configuration
106
127
 
107
128
  #### Objective
@@ -167,15 +188,3 @@ Show an activity indicator in Pi's status bar while progress does not require an
167
188
  #### Completed when
168
189
 
169
190
  The status clearly distinguishes work in progress from a request for `owner` action.
170
-
171
- ### R-16: Verify code quality against AGENTS.md instructions
172
-
173
- #### Objective
174
-
175
- Add code-quality review against applicable `AGENTS.md` instructions as another `verifier` responsibility. Keep all existing responsibilities unchanged, including independent verification of every `acceptance criterion` in the approved `spec`. Code-quality review supplements that verification. It does not replace or reduce it.
176
-
177
- Existing `verifier` instructions already require reading applicable `AGENTS.md` files and following technical rules. Extend that guidance to require explicit code-quality review and reporting of instruction violations. Do not introduce personal style preferences as requirements.
178
-
179
- #### Completed when
180
-
181
- The `verifier` performs both its existing verification duties and the additional code-quality review. Every `acceptance criterion` is still independently verified. Each code-quality `finding` about an instruction violation identifies the `AGENTS.md` file, quotes the violated instruction, and explains how the code violates it.
@@ -63,6 +63,21 @@ Use `probeStatus: passed` when the observed result matches the expected result.
63
63
  Use `failed` for an observed probe failure and `not-run` for an unexecuted probe.
64
64
  Include every spec criterion once. Never omit unrun criteria or fabricate evidence.
65
65
 
66
+ ## Review code quality
67
+
68
+ If applicable `AGENTS.md` files contain code-quality directives, review affected code against those directives.
69
+ Review only code affected by the approved change. Do not audit unrelated project code.
70
+ This review supplements all existing duties. Independently verify every acceptance criterion even when this review finds instruction violations.
71
+ Do not treat personal style preferences as requirements or report findings based only on those preferences.
72
+
73
+ For each instruction violation, use the existing finding evidence fields:
74
+
75
+ 1. Identify the applicable `AGENTS.md` file in `evidence.source` and quote the violated instruction exactly in `evidence.observation`.
76
+ 2. Identify the violating code in `evidence.source` and explain how it violates that instruction in `evidence.observation`.
77
+
78
+ If no applicable `AGENTS.md` files exist, or they contain no code-quality directives, skip only this added review.
79
+ Missing files or directives are not errors or findings. Do not invent directives or require those files to be created.
80
+
66
81
  ## Record findings, not decisions
67
82
 
68
83
  Record technical issues supported by fresh evidence. Do not add requirements, style preferences, or unrelated improvements.
@@ -83,7 +83,7 @@ export default (pi: ExtensionAPI): void => {
83
83
  }
84
84
 
85
85
  try {
86
- await assertEnvironment(context);
86
+ await assertEnvironment({ context, piEventsBus: pi.events });
87
87
  const config = await loadConfiguration(context.cwd);
88
88
 
89
89
  maestroSessionState.activate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emiliosp/pi-maestro",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "A spec-driven multiagent development workflow for Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -3,12 +3,26 @@
3
3
  * Used: When the owner activates Maestro mode.
4
4
  */
5
5
 
6
+ import { randomUUID } from 'node:crypto';
6
7
  import { realpath } from 'node:fs/promises';
7
- import type { ExtensionContext } from '@earendil-works/pi-coding-agent';
8
+ import type {
9
+ ExtensionAPI,
10
+ ExtensionContext,
11
+ } from '@earendil-works/pi-coding-agent';
8
12
  import { resolveSubagentLaunchContract } from 'pi-subagents/preflight';
9
13
  import { loadConfiguration } from '#config/loadConfiguration.ts';
10
14
  import { AGENTS } from '#config/schema.ts';
11
15
 
16
+ export const SUBAGENT_PING = {
17
+ REQUEST_EVENT: 'subagents:rpc:v1:request',
18
+ REPLY_EVENT_PREFIX: 'subagents:rpc:v1:reply:',
19
+ VERSION: 1,
20
+ METHOD: 'ping',
21
+ TIMEOUT_MS: 2000,
22
+ INSTALLATION_ERROR:
23
+ 'Maestro flow requires pi-subagents installed in the Pi environment.',
24
+ } as const;
25
+
12
26
  const getErrorMessage = (error: unknown): string =>
13
27
  error instanceof Error ? error.message : String(error);
14
28
 
@@ -76,9 +90,81 @@ async function assertAgentsAvailable(projectRoot: string): Promise<void> {
76
90
  }
77
91
  }
78
92
 
79
- export async function assertEnvironment(
80
- context: ExtensionContext,
93
+ const isRecord = (value: unknown): value is Record<string, unknown> =>
94
+ typeof value === 'object' && value !== null && !Array.isArray(value);
95
+
96
+ const isReplyWithRequestId = (
97
+ reply: unknown,
98
+ ): reply is Record<string, unknown> & { requestId: string } =>
99
+ isRecord(reply) && typeof reply.requestId === 'string';
100
+
101
+ type SuccessfulPingReply = {
102
+ version: typeof SUBAGENT_PING.VERSION;
103
+ requestId: string;
104
+ method: typeof SUBAGENT_PING.METHOD;
105
+ success: true;
106
+ data: { version: typeof SUBAGENT_PING.VERSION };
107
+ };
108
+
109
+ function assertSuccessfulPingReply(
110
+ reply: unknown,
111
+ ): asserts reply is SuccessfulPingReply {
112
+ if (
113
+ !isReplyWithRequestId(reply) ||
114
+ reply.version !== SUBAGENT_PING.VERSION ||
115
+ reply.method !== SUBAGENT_PING.METHOD ||
116
+ reply.success !== true ||
117
+ !isRecord(reply.data) ||
118
+ reply.data.version !== SUBAGENT_PING.VERSION
119
+ ) {
120
+ throw new Error('Unsuccessful or invalid pi-subagents ping reply.');
121
+ }
122
+ }
123
+
124
+ async function assertSubagentsRespond(
125
+ piEventsBus: ExtensionAPI['events'],
81
126
  ): Promise<void> {
127
+ const requestId = randomUUID();
128
+ const { promise, resolve, reject } = Promise.withResolvers<unknown>();
129
+
130
+ const unsubscribe = piEventsBus.on(
131
+ `${SUBAGENT_PING.REPLY_EVENT_PREFIX}${requestId}`,
132
+ (reply) => {
133
+ if (isReplyWithRequestId(reply) && reply.requestId !== requestId) {
134
+ return;
135
+ }
136
+
137
+ resolve(reply);
138
+ },
139
+ );
140
+
141
+ const timeout = setTimeout(
142
+ () => reject(new Error('Pi-subagents ping timed out after 2000 ms.')),
143
+ SUBAGENT_PING.TIMEOUT_MS,
144
+ );
145
+
146
+ try {
147
+ piEventsBus.emit(SUBAGENT_PING.REQUEST_EVENT, {
148
+ version: SUBAGENT_PING.VERSION,
149
+ requestId,
150
+ method: SUBAGENT_PING.METHOD,
151
+ });
152
+ assertSuccessfulPingReply(await promise);
153
+ } finally {
154
+ clearTimeout(timeout);
155
+ unsubscribe();
156
+ }
157
+ }
158
+
159
+ type AssertEnvironmentInput = {
160
+ context: ExtensionContext;
161
+ piEventsBus: ExtensionAPI['events'];
162
+ };
163
+
164
+ export async function assertEnvironment({
165
+ context,
166
+ piEventsBus,
167
+ }: AssertEnvironmentInput): Promise<void> {
82
168
  const projectRoot = await getProjectRoot(context);
83
169
 
84
170
  try {
@@ -92,4 +178,13 @@ export async function assertEnvironment(
92
178
  const config = await getActivationConfiguration(projectRoot);
93
179
 
94
180
  assertModelsAvailable({ context, config });
181
+
182
+ try {
183
+ await assertSubagentsRespond(piEventsBus);
184
+ } catch (error) {
185
+ throw new Error(
186
+ `${SUBAGENT_PING.INSTALLATION_ERROR} ${getErrorMessage(error)}`,
187
+ { cause: error },
188
+ );
189
+ }
95
190
  }