@gotgenes/pi-subagents 7.3.2 → 7.4.0

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
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [7.4.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v7.3.2...pi-subagents-v7.4.0) (2026-05-25)
9
+
10
+
11
+ ### Features
12
+
13
+ * add model attribution to formatAssistantMessage ([76f2ada](https://github.com/gotgenes/pi-packages/commit/76f2adaa6bad9d1a3b15a3ba208b3ab96e07ecd1))
14
+ * add model attribution to getAgentConversation ([c186c37](https://github.com/gotgenes/pi-packages/commit/c186c370b975e5ef6596d9a3d7719c720a580640))
15
+
16
+
17
+ ### Documentation
18
+
19
+ * **retro:** add retro notes for issue [#214](https://github.com/gotgenes/pi-packages/issues/214) ([7e39c96](https://github.com/gotgenes/pi-packages/commit/7e39c96563517661c1c8c7f250402115b232a097))
20
+
8
21
  ## [7.3.2](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v7.3.1...pi-subagents-v7.3.2) (2026-05-25)
9
22
 
10
23
 
@@ -38,3 +38,29 @@ Test count held at 913 (57 files) — no new tests needed, no tests removed.
38
38
  - Adding the `SpawnOptions` import to `service-adapter.ts` was required for the `spawn` method signature; the plan anticipated this correctly.
39
39
  - The `sed -i` command required the macOS `-i ''` form (no in-place backup extension) rather than the GNU `sed -i` form.
40
40
  - Dead-code gate (`pnpm fallow dead-code`) passed cleanly from the repo root — no suppression needed.
41
+
42
+ ## Stage: Final Retrospective (2026-05-25T22:00:00Z)
43
+
44
+ ### Session summary
45
+
46
+ Shipped `pi-subagents-v7.3.2` with 3 refactor commits converting all remaining closure factories to classes.
47
+ All 4 lifecycle stages (plan → TDD → ship → retro) completed in a single day with zero rework and zero deviations from the plan.
48
+
49
+ ### Observations
50
+
51
+ #### What went well
52
+
53
+ - Strong precedent from Phase 11 (#195, #196) made this issue zero-friction — the plan, implementation, and test updates all followed an established template.
54
+ - The plan's prediction of a `makeWizard(deps)` helper for `agent-creation-wizard.test.ts` kept the step-2 diff readable by centralizing 14 inline constructor calls.
55
+ - `SubagentsServiceAdapter implements SubagentsService` gave compile-time contract verification, catching any interface drift immediately via `pnpm run check`.
56
+ - The plan correctly anticipated the `SpawnOptions` import need in `service-adapter.ts`.
57
+
58
+ #### What caused friction (agent side)
59
+
60
+ - None.
61
+ This was a textbook mechanical refactoring with no behavioral changes, no edge cases, and no test rework.
62
+
63
+ #### What caused friction (user side)
64
+
65
+ - None.
66
+ The issue was well-scoped with explicit target files and a clear precedent to follow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotgenes/pi-subagents",
3
- "version": "7.3.2",
3
+ "version": "7.4.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/service.ts"
@@ -455,8 +455,9 @@ export function getAgentConversation(session: AgentSession): string {
455
455
  if (text.trim()) parts.push(`[User]: ${text.trim()}`);
456
456
  } else if (msg.role === "assistant") {
457
457
  const { textParts, toolNames } = extractAssistantContent(msg.content);
458
+ const attribution = formatAttribution(msg);
458
459
  if (textParts.length > 0)
459
- parts.push(`[Assistant]: ${textParts.join("\n")}`);
460
+ parts.push(`[Assistant${attribution}]: ${textParts.join("\n")}`);
460
461
  if (toolNames.length > 0)
461
462
  parts.push(`[Tool Calls]:\n${toolNames.map((n) => ` Tool: ${n}`).join("\n")}`);
462
463
  } else if (msg.role === "toolResult") {
@@ -468,3 +469,11 @@ export function getAgentConversation(session: AgentSession): string {
468
469
 
469
470
  return parts.join("\n\n");
470
471
  }
472
+
473
+ /** Build a `(provider/model)` attribution suffix for assistant messages. */
474
+ function formatAttribution(msg: { provider?: string; model?: string }): string {
475
+ const { provider, model } = msg;
476
+ if (!provider && !model) return "";
477
+ if (provider && model) return ` (${provider}/${model})`;
478
+ return ` (${provider ?? model})`;
479
+ }
@@ -116,20 +116,31 @@ export function formatToolResult(
116
116
  ];
117
117
  }
118
118
 
119
+ // ── Types ─────────────────────────────────────────────────────────────────────
120
+
121
+ /** Model/provider attribution for assistant messages. */
122
+ export interface MessageAttribution {
123
+ provider?: string;
124
+ model?: string;
125
+ }
126
+
119
127
  // ── formatAssistantMessage ───────────────────────────────────────────────────
120
128
 
121
129
  /**
122
130
  * Format an assistant message into display lines.
123
131
  * Always returns at least the [Assistant] header line.
132
+ * When attribution is provided, renders as `[Assistant (provider/model)]`.
124
133
  */
125
134
  export function formatAssistantMessage(
126
135
  content: { type: string; [key: string]: unknown }[],
127
136
  width: number,
128
137
  ctx: FormatterContext,
138
+ attribution?: MessageAttribution,
129
139
  ): string[] {
130
140
  const { theme, wrapText } = ctx;
131
141
  const { textParts, toolNames } = extractAssistantContent(content);
132
- const lines: string[] = [theme.bold("[Assistant]")];
142
+ const label = formatAttributionLabel(attribution);
143
+ const lines: string[] = [theme.bold(`[Assistant${label}]`)];
133
144
  if (textParts.length > 0) {
134
145
  lines.push(...wrapText(textParts.join("\n").trim(), width));
135
146
  }
@@ -154,10 +165,15 @@ export function formatMessage(
154
165
  return formatUserMessage(msg.content as string | unknown[], width, ctx);
155
166
  }
156
167
  if (msg.role === "assistant") {
168
+ const attribution: MessageAttribution = {
169
+ provider: msg.provider as string | undefined,
170
+ model: msg.model as string | undefined,
171
+ };
157
172
  return formatAssistantMessage(
158
173
  msg.content as { type: string; [key: string]: unknown }[],
159
174
  width,
160
175
  ctx,
176
+ attribution,
161
177
  );
162
178
  }
163
179
  if (msg.role === "toolResult") {
@@ -168,3 +184,12 @@ export function formatMessage(
168
184
  }
169
185
  return null;
170
186
  }
187
+
188
+ // ── Helpers ──────────────────────────────────────────────────────────────────
189
+
190
+ /** Build a `(provider/model)` attribution suffix, or empty string when absent. */
191
+ function formatAttributionLabel(attr?: MessageAttribution): string {
192
+ if (!attr?.provider && !attr?.model) return "";
193
+ if (attr.provider && attr.model) return ` (${attr.provider}/${attr.model})`;
194
+ return ` (${attr.provider ?? attr.model})`;
195
+ }