@emiliosp/pi-maestro 0.18.6 → 0.18.7

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/ADR.md CHANGED
@@ -280,7 +280,8 @@ Approval can finish at `candidate-ready` without agent execution. Agent and mode
280
280
 
281
281
  ### Status
282
282
 
283
- Design decisions confirmed by the `owner`. Implemented.
283
+ Design decisions confirmed by the `owner`. Implemented. Main-extension pre-load exclusion is superseded by
284
+ [ADR-012](#adr-012-filter-main-maestro-registrations-after-native-discovery).
284
285
 
285
286
  ### Context
286
287
 
@@ -434,3 +435,23 @@ requirements or phase rules. Initial setup is limited to interactive terminal mo
434
435
 
435
436
  [Approved design](.specs/20261108-141712-maestro-19-guide-initial-configuration-with-pi-selectors/design.md) and
436
437
  [configuration guidance](docs/configuration.md#initial-setup).
438
+
439
+ ## ADR-012: Filter main Maestro registrations after native discovery
440
+
441
+ ### Status
442
+
443
+ Accepted in the approved [design](.specs/20261108-222326-simplify-child-extension-loading-with-the-native-pi-filter/design.md). Implemented for review. Supersedes only
444
+ the pre-load exclusion constraint in [ADR-010](#adr-010-use-the-pi-sdk-for-sequential-agent-delegation).
445
+
446
+ ### Context
447
+
448
+ Child preparation duplicated Pi's package discovery to exclude the main `Maestro` extension before initialization.
449
+
450
+ ### Decision
451
+
452
+ Use Pi's native discovery and configured selection. Filter the loaded main `Maestro` extension through `extensionsOverride` before constructing the child session.
453
+
454
+ ### Consequences
455
+
456
+ Main-extension initialization may register tools, commands, and handlers, but must not mutate parent state or start resources before filtering. SDK sessions share a
457
+ process; filtering removes registrations from the child runtime, not initialization side effects.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  This file summarizes meaningful changes to the codebase, including behavior, data formats, architecture, and development tools. Git tags identify version boundaries;
4
4
  GitHub Releases are not required.
5
5
 
6
+ ## 0.18.7
7
+
8
+ - fix: Simplified child agent setup by using Pi's native extension discovery and tool registration.
9
+
6
10
  ## 0.18.6
7
11
 
8
12
  - Added guided initial configuration through `/maestro`: the `owner` selects models and thinking levels for `builder`, `verifier`, and `simplifier`, then saves the
package/ROADMAP.md CHANGED
@@ -289,6 +289,9 @@ The `pi-subagents` integration then in use still received a fixed deadline of 9,
289
289
 
290
290
  ### Implementation and evidence
291
291
 
292
+ Registration follow-up: caller-supplied tools use an inline `extensionFactories` entry instead of SDK `customTools`. This `owner`-requested change is implemented for
293
+ review, with role-specific registration checked by the [workflow integration test](extensions/maestro.integration.test.ts).
294
+
292
295
  The standalone executor is implemented under `src/delegation/` against the [approved specification](.specs/20261105-212231-implement-internal-pi-sdk-delegation/spec.md).
293
296
  Review follow-up consolidated execution orchestration and session lifecycle in `executeTask`; pure reply interpretation remains in `readTaskResult`. Manual verification
294
297
  on Pi 1.5.0 exercised fresh context, native and additional tools, MCP through tool search and codemode, sequential waiting, failure, cancellation, cleanup, and native
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emiliosp/pi-maestro",
3
- "version": "0.18.6",
3
+ "version": "0.18.7",
4
4
  "description": "A spec-driven multiagent development workflow for Pi.",
5
5
  "keywords": [
6
6
  "orchestration",
@@ -88,7 +88,7 @@ export const executeTask = async ({
88
88
  try {
89
89
  try {
90
90
  const cwd = await realpath(workingDirectory);
91
- const services = await prepareSubagentEnvironment({ cwd, roleGuidance });
91
+ const services = await prepareSubagentEnvironment({ cwd, roleGuidance, additionalTools });
92
92
 
93
93
  const model = (await services.modelRuntime.getAvailable()).find(
94
94
  (entry) => `${entry.provider}/${entry.id}` === modelId,
@@ -106,7 +106,6 @@ export const executeTask = async ({
106
106
  sessionManager,
107
107
  model,
108
108
  thinkingLevel,
109
- customTools: additionalTools,
110
109
  }));
111
110
 
112
111
  if (onEvent) unsubscribe = session.subscribe(onEvent);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Objective: Discover native Pi resources without loading the main Maestro extension.
2
+ * Objective: Discover native Pi resources and exclude main Maestro registrations from children.
3
3
  * Used: During preparation of each standalone child execution.
4
4
  */
5
5
 
@@ -12,9 +12,10 @@ import {
12
12
  createCodemodeExtension,
13
13
  createMcpExtension,
14
14
  createToolSearchExtension,
15
- DefaultPackageManager,
16
15
  getAgentDir,
16
+ type InlineExtension,
17
17
  SettingsManager,
18
+ type ToolDefinition,
18
19
  } from '@earendil-works/pi-coding-agent';
19
20
 
20
21
  const MAIN_EXTENSION = fileURLToPath(new URL('../../extensions/maestro.ts', import.meta.url));
@@ -27,8 +28,8 @@ const isMaestroPackage = (value: unknown): value is MaestroPackage =>
27
28
  'name' in value &&
28
29
  value.name === '@emiliosp/pi-maestro';
29
30
 
30
- const isMainExtension = (path: string): boolean => {
31
- if (path.startsWith('builtin:')) return false;
31
+ const isMainMaestroExtension = (path: string): boolean => {
32
+ if (path.startsWith('builtin:') || path.startsWith('<inline:')) return false;
32
33
 
33
34
  const canonicalPath = realpathSync(path);
34
35
 
@@ -54,52 +55,39 @@ const isMainExtension = (path: string): boolean => {
54
55
  type PrepareSubagentEnvironmentInput = {
55
56
  cwd: string;
56
57
  roleGuidance: string;
58
+ additionalTools: ToolDefinition[];
57
59
  };
58
60
 
59
61
  export const prepareSubagentEnvironment = async ({
60
62
  cwd,
61
63
  roleGuidance,
64
+ additionalTools,
62
65
  }: PrepareSubagentEnvironmentInput) => {
63
66
  const agentDir = getAgentDir();
64
67
  const settingsManager = SettingsManager.create(cwd, agentDir);
65
68
 
66
- const extensionFactories = [
69
+ // SDK sessions need these CLI built-ins supplied explicitly.
70
+ // The inline factory registers the child's additional tools with pi.registerTool.
71
+ const extensionFactories: InlineExtension[] = [
67
72
  { name: 'codemode', factory: createCodemodeExtension(), builtin: true, replaceable: true },
68
73
  { name: 'tool-search', factory: createToolSearchExtension(), builtin: true, replaceable: true },
69
74
  { name: 'mcp', factory: createMcpExtension(), builtin: true, replaceable: true },
75
+ (pi) => {
76
+ for (const tool of additionalTools) pi.registerTool(tool);
77
+ },
70
78
  ];
71
79
 
72
- const packages = new DefaultPackageManager({
73
- cwd,
74
- agentDir,
75
- settingsManager,
76
- builtinExtensions: extensionFactories.map(({ name }) => name),
77
- });
78
-
79
- const resources = await packages.resolve(async () => 'error');
80
-
81
- if (resources.installFailures?.length) {
82
- throw new Error(resources.installFailures.map(({ message }) => message).join('\n'));
83
- }
84
-
85
- // extensionsOverride filters extensions after Pi has loaded and initialized them.
86
- // It would exclude Maestro's event handlers, but its initialization code would still run.
87
- // Use additionalExtensionPaths instead to exclude Maestro before loading it,
88
- // so none of its code executes in the child session.
89
- const additionalExtensionPaths = resources.extensions
90
- .filter(({ enabled, path }) => enabled && !isMainExtension(path))
91
- .map(({ path }) => path);
92
-
93
80
  const services = await createAgentSessionServices({
94
81
  cwd,
95
82
  agentDir,
96
83
  settingsManager,
97
84
  resourceLoaderOptions: {
98
- // Disable automatic extension discovery; load only the filtered paths below
99
- // and the built-in factories, so discovery cannot add Maestro back.
100
- noExtensions: true,
101
- additionalExtensionPaths,
102
85
  extensionFactories,
86
+ // Exclude the main Maestro extension from the child session.
87
+ extensionsOverride: (base) => ({
88
+ ...base,
89
+ extensions: base.extensions.filter(({ path }) => !isMainMaestroExtension(path)),
90
+ }),
103
91
  appendSystemPromptOverride: (base) => [...base, roleGuidance],
104
92
  },
105
93
  });