pi-prompt-template-model-enhanced 0.11.0 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.2](https://github.com/Nabsku/pi-prompt-template-model-enhanced/compare/v0.11.1...v0.11.2) (2026-06-19)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * publish after release-please releases ([7949c6c](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/7949c6cb313f62f2dc8cc5ab707b90413e3095ac))
9
+
10
+ ## [0.11.1](https://github.com/Nabsku/pi-prompt-template-model-enhanced/compare/v0.11.0...v0.11.1) (2026-06-19)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * allow skills in delegated prompts ([d7c0e0e](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/d7c0e0e1c8a8e2b728aa2fa20c9e5037002b761e))
16
+
3
17
  ## [0.11.0](https://github.com/Nabsku/pi-prompt-template-model-enhanced/compare/v0.10.0...v0.11.0) (2026-06-19)
4
18
 
5
19
 
@@ -34,6 +48,7 @@
34
48
  - Added Release Please release automation and npm trusted publishing workflow.
35
49
 
36
50
  ### Fixed
51
+ - Delegated prompt templates can now combine `subagent:`/runtime `--subagent` with `skill` or `skills`; resolved skill content is prepended to delegated task text instead of rejecting the template.
37
52
  - Kept dry-run output out of LLM/session history by writing plain previews to stdout instead of custom session messages.
38
53
  - Aligned dry-run delegation metadata with runtime behavior for default agents, missing delegated `cwd`, loop prefixes, and parallel delegated task preambles.
39
54
 
package/README.md CHANGED
@@ -106,7 +106,7 @@ Use `/print-prompt` or `/dry-run-prompt` to preview what a prompt template would
106
106
  /dry-run-prompt review --model=gpt-5.2 src/server.ts
107
107
  ```
108
108
 
109
- In non-TUI contexts these commands print a Markdown report to stdout. By default, full skill content is hidden; add `--show-skills` when you explicitly want the preview to include loaded skill bodies.
109
+ In non-TUI contexts these commands print a Markdown report to stdout. By default, full skill content is hidden; add `--show-skills` when you explicitly want the preview to include loaded skill bodies. For delegated prompts, skill content is still reported in the report's skills section rather than inlined into the prompt body preview; at runtime the resolved skill block is prepended to the child task text before delegation.
110
110
 
111
111
  ```text
112
112
  /print-prompt review --show-skills src/server.ts
@@ -274,6 +274,8 @@ Resolution order:
274
274
  4. `~/.pi/agent/skills/<name>/SKILL.md` or `~/.pi/agent/skills/<name>.md`
275
275
  5. `~/.agents/skills/<name>/SKILL.md` or `~/.agents/skills/<name>.md`
276
276
 
277
+ Here `<cwd>` is the Pi session/project cwd used to register and execute the prompt command. Delegated prompts may also set frontmatter `cwd:` or receive runtime `--cwd`, but those values choose where the child agent runs; they do not change which skill library is searched. This keeps direct prompts, runtime `--subagent`, `--fork`, dry-run, and validation on one predictable skill lookup path.
278
+
277
279
  ### Skill wildcards
278
280
 
279
281
  `skill` and `skills:` entries may use one constrained wildcard form: a non-empty prefix followed by a final `*`. This means `skill: golang-*` is valid too; it can inject more than one matching skill while preserving the same ordering and de-dupe rules.
@@ -298,7 +300,7 @@ Skill-to-skill references are not recursive in v1. Loaded skills are treated as
298
300
 
299
301
  Chain wrapper templates ignore `skill` and `skills`; put skill frontmatter on the step templates instead. When a chain runs a step, that step uses its own skill configuration.
300
302
 
301
- Delegated prompts cannot combine `subagent:` with `skill` or `skills` in v1. Such prompts are rejected at registration time. Runtime delegation overrides such as `--subagent` and `--fork` also reject prompts or chain steps that declare skills, so they do not silently run without requested skill context.
303
+ Delegated prompts can combine `subagent:` with `skill` or `skills`. The resolved skill content is prepended to the delegated task before the prompt body, so the child agent receives the same resolved skill content instead of silently dropping it. Runtime `--subagent` uses the same behavior for direct prompts and chain steps; runtime `--fork` uses it for direct prompts, while chain steps use their own `inheritContext` frontmatter.
302
304
 
303
305
  Compare prompts (`bestOfN`) cannot combine with `skill` or `skills` in v1 because compare execution delegates worker/reviewer/final-applier tasks. Add required skill instructions to the compare prompt body instead.
304
306
 
package/index.ts CHANGED
@@ -51,7 +51,6 @@ import { formatPromptValidationReport, validatePromptTemplates, type RegisteredP
51
51
  import {
52
52
  DRY_RUN_CHAIN_UNSUPPORTED,
53
53
  DRY_RUN_COMPARE_UNSUPPORTED,
54
- DRY_RUN_DELEGATED_SKILLS_UNSUPPORTED,
55
54
  DRY_RUN_DETERMINISTIC_UNSUPPORTED,
56
55
  createPromptDryRun,
57
56
  parseDryRunCommand,
@@ -234,11 +233,6 @@ export default function promptModelExtension(pi: ExtensionAPI) {
234
233
  notify(ctx, skillResolution.error, "error");
235
234
  return "aborted";
236
235
  }
237
- if (requestedSkills.length > 0 && shouldDelegatePrompt(prompt, override)) {
238
- notify(ctx, "Prompts with skill or skills frontmatter cannot run as subagents in v1.", "error");
239
- return "aborted";
240
- }
241
-
242
236
  let deterministicPreamble: string | undefined;
243
237
  if (prompt.deterministic) {
244
238
  try {
@@ -1245,12 +1239,6 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1245
1239
  taskPreamble = `[Previous chain steps]\n\n${chainStepSummaries.join("\n\n")}`;
1246
1240
  }
1247
1241
 
1248
- if (stepTemplate.tasks.some((task) => getRequestedSkills(task.prompt).length > 0 && shouldDelegatePrompt(task.prompt, subagentOverride))) {
1249
- notify(ctx, "Prompts with skill or skills frontmatter cannot run as subagents in v1.", "error");
1250
- aborted = true;
1251
- break;
1252
- }
1253
-
1254
1242
  let delegated;
1255
1243
  try {
1256
1244
  delegated = await executeSubagentPromptStep({
@@ -1448,7 +1436,6 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1448
1436
  if (prompt.chain) return DRY_RUN_CHAIN_UNSUPPORTED;
1449
1437
  if (prompt.workers !== undefined || prompt.reviewers !== undefined || prompt.finalApplier !== undefined) return DRY_RUN_COMPARE_UNSUPPORTED;
1450
1438
  if (prompt.deterministic) return DRY_RUN_DETERMINISTIC_UNSUPPORTED;
1451
- if (getRequestedSkills(prompt).length > 0 && shouldDelegatePrompt(prompt)) return DRY_RUN_DELEGATED_SKILLS_UNSUPPORTED;
1452
1439
  return undefined;
1453
1440
  }
1454
1441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-prompt-template-model-enhanced",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "type": "module",
5
5
  "description": "Prompt template model selector extension for pi coding agent",
6
6
  "author": "Nico Bailon",
package/prompt-dry-run.ts CHANGED
@@ -19,8 +19,6 @@ export const DRY_RUN_CHAIN_UNSUPPORTED =
19
19
  export const DRY_RUN_COMPARE_UNSUPPORTED = "Dry-run for compare prompts is not supported in v1.";
20
20
  export const DRY_RUN_DETERMINISTIC_UNSUPPORTED =
21
21
  "Dry-run for deterministic prompts is not supported in v1 because it would require running configured commands/scripts.";
22
- export const DRY_RUN_DELEGATED_SKILLS_UNSUPPORTED =
23
- "Prompts with skill or skills frontmatter cannot run as subagents in v1.";
24
22
 
25
23
  export interface PromptDryRunSkillPreview {
26
24
  skillName: string;
@@ -346,10 +344,6 @@ export async function createPromptDryRun(
346
344
  }
347
345
  if (effectivePrompt.inheritContext) runtime.inheritContext = true;
348
346
 
349
- if (requestedSkills.length > 0 && delegated) {
350
- return errorResult(prompt, DRY_RUN_DELEGATED_SKILLS_UNSUPPORTED, warnings, runtime);
351
- }
352
-
353
347
  const loopRotation = applyRepresentativeLoopRotation(effectivePrompt, runtime);
354
348
  effectivePrompt = loopRotation.prompt;
355
349
 
package/prompt-loader.ts CHANGED
@@ -1845,17 +1845,6 @@ function loadPromptsWithModelFromDir(
1845
1845
  );
1846
1846
  continue;
1847
1847
  }
1848
- if (subagent !== undefined && (Object.hasOwn(frontmatter, "skill") || Object.hasOwn(frontmatter, "skills"))) {
1849
- diagnostics.push(
1850
- createDiagnostic(
1851
- "invalid-subagent-skills",
1852
- fullPath,
1853
- source,
1854
- `Skipping prompt template at ${fullPath}: frontmatter field "subagent" cannot be combined with "skill" or "skills" in v1.`,
1855
- ),
1856
- );
1857
- continue;
1858
- }
1859
1848
  const skillResult = chain ? { ok: true as const } : normalizePromptSkills(frontmatter, fullPath, source, diagnostics);
1860
1849
  if (!skillResult.ok) continue;
1861
1850
  const skill = skillResult.skill;
@@ -191,19 +191,7 @@ function validateParallelRuntimeSettings(cwd: string, result: PromptValidationRe
191
191
  .map((step) => ({ step, target: prompts.get(step.name) }))
192
192
  .filter((entry): entry is { step: ChainStep; target: LoadedPrompt } => entry.target !== undefined && !entry.target.chain);
193
193
 
194
- const runtimeDelegatableTargets = targets.filter((entry) => uniqueSkillNames(entry.target.skills).length === 0);
195
- for (const entry of targets) {
196
- const skillNames = uniqueSkillNames(entry.target.skills);
197
- if (skillNames.length === 0) continue;
198
- result.diagnostics.push(
199
- createValidationDiagnostic(
200
- "parallel-skill-subagent-incompatible",
201
- prompt.filePath,
202
- prompt.source,
203
- `Prompt template ${prompt.filePath} references parallel chain step template ${JSON.stringify(entry.step.name)}, but parallel() steps require delegated execution and skill frontmatter (${skillNames.join(", ")}) cannot run as a subagent in v1.`,
204
- ),
205
- );
206
- }
194
+ const runtimeDelegatableTargets = targets;
207
195
  if (targets.length < 2) return;
208
196
 
209
197
  if (runtimeDelegatableTargets.length >= 2) {
package/subagent-step.ts CHANGED
@@ -7,6 +7,7 @@ import { Key, matchesKey } from "@earendil-works/pi-tui";
7
7
  import { preparePromptExecution } from "./prompt-execution.js";
8
8
  import type { PromptWithModel } from "./prompt-loader.js";
9
9
  import { notify } from "./notifications.js";
10
+ import { buildSkillLoadedMessage, getRequestedSkills, resolvePromptSkills, type RuntimeSkillCommand } from "./prompt-skills.js";
10
11
  import {
11
12
  DEFAULT_SUBAGENT_NAME,
12
13
  appendDelegatedLiveOutput,
@@ -165,6 +166,7 @@ interface PreparedDelegatedTask {
165
166
  async function prepareDelegatedTask(
166
167
  task: DelegatedParallelTaskInput,
167
168
  ctx: ExtensionContext,
169
+ commands: RuntimeSkillCommand[],
168
170
  currentModel: Model<any> | undefined,
169
171
  override: SubagentOverride | undefined,
170
172
  inheritedModel: Model<any> | undefined,
@@ -196,10 +198,19 @@ async function prepareDelegatedTask(
196
198
  throw new Error(prepared.message);
197
199
  }
198
200
  if (prepared.warning) notify(ctx, prepared.warning, "warning");
201
+ const requestedSkills = getRequestedSkills(task.prompt);
202
+ const skillResolution = resolvePromptSkills(requestedSkills, ctx.cwd, commands);
203
+ if (skillResolution.kind === "error") {
204
+ throw new Error(skillResolution.error);
205
+ }
206
+ const skillPreamble = skillResolution.kind === "ready" ? buildSkillLoadedMessage(skillResolution.skills).content : undefined;
199
207
  let taskText = prepared.content;
200
208
  if (!task.prompt.inheritContext && taskPreamble) {
201
209
  taskText = `${taskPreamble}\n\n---\n\n${prepared.content}`;
202
210
  }
211
+ if (skillPreamble) {
212
+ taskText = `${skillPreamble}\n\n---\n\n${taskText}`;
213
+ }
203
214
  if (task.taskPrefix) {
204
215
  taskText = `${task.taskPrefix}\n\n${taskText}`;
205
216
  }
@@ -538,6 +549,7 @@ async function requestDelegatedRun(
538
549
 
539
550
  export async function executeSubagentPromptStep(options: DelegatedPromptOptions): Promise<DelegatedPromptOutcome | undefined> {
540
551
  const { pi, ctx, currentModel, override, signal, inheritedModel, taskPreamble, allowPartialFailures } = options;
552
+ const commands = typeof (pi as { getCommands?: () => RuntimeSkillCommand[] }).getCommands === "function" ? (pi as { getCommands: () => RuntimeSkillCommand[] }).getCommands() : [];
541
553
  const runtime = await ensureSubagentRuntime(ctx.cwd);
542
554
  const isParallelRequest = "parallel" in options;
543
555
 
@@ -548,7 +560,7 @@ export async function executeSubagentPromptStep(options: DelegatedPromptOptions)
548
560
 
549
561
  const preparedTasks: PreparedDelegatedTask[] = [];
550
562
  for (const task of tasks) {
551
- const preparedTask = await prepareDelegatedTask(task, ctx, currentModel, override, inheritedModel, taskPreamble, runtime);
563
+ const preparedTask = await prepareDelegatedTask(task, ctx, commands, currentModel, override, inheritedModel, taskPreamble, runtime);
552
564
  preparedTasks.push(preparedTask);
553
565
  }
554
566