@giladbarnea/pi-simple-team 1.0.5 → 1.0.6

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.
Files changed (3) hide show
  1. package/index.ts +13 -12
  2. package/package.json +1 -1
  3. package/render.ts +52 -38
package/index.ts CHANGED
@@ -559,7 +559,8 @@ export default function (pi: ExtensionAPI) {
559
559
  }
560
560
 
561
561
  const owner = Symbol("pi-simple-team-owner");
562
- pi.registerMessageRenderer(teamMessageType, (message, _options, theme) => renderTeamMessage(message, theme, getMarkdownTheme()));
562
+ const sessionTeammateRoster: string[] = [];
563
+ pi.registerMessageRenderer(teamMessageType, (message, _options, theme) => renderTeamMessage(message, theme, getMarkdownTheme(), sessionTeammateRoster));
563
564
 
564
565
  pi.on("session_shutdown", async () => {
565
566
  for (const team of [...teams.values()]) {
@@ -576,8 +577,8 @@ export default function (pi: ExtensionAPI) {
576
577
  description: "Spawn a persistent team of RPC Pi teammates with fresh context windows. The main agent (you) is included automatically; do not specify it as a teammate.",
577
578
  promptSnippet: "Spawn persistent RPC Pi teammate processes. Currently, manually ‘starting’ the teammates is required after spawn. Unless required, don’t fill up your time by repeatedly busy-polling team information. Don’t bash sleep to wait for progress; instead, set your status to advertise that you are counting on teammates to send you a message updating important milestones or request for help, and that otherwise you are staying idle; Send this actively to the team; Then end your turn by sending a simple message to the user, and finally stay put.",
578
579
  renderShell: "self",
579
- renderCall: (args, theme, context) => renderTeamToolCall("team_spawn", args, theme, context),
580
- renderResult: (result, options, theme, context) => renderTeamToolResult("team_spawn", result, options, theme, context),
580
+ renderCall: (args, theme, context) => renderTeamToolCall("team_spawn", args, theme, context, sessionTeammateRoster),
581
+ renderResult: (result, options, theme, context) => renderTeamToolResult("team_spawn", result, options, theme, context, undefined, sessionTeammateRoster),
581
582
  parameters: Type.Object({
582
583
  team: Type.String({ description: "Team name" }),
583
584
  teamPrompt: Type.String({ description: "Common team system prompt" }),
@@ -594,6 +595,7 @@ export default function (pi: ExtensionAPI) {
594
595
  if (teammateNames.includes("main")) throw new Error('"main" is reserved');
595
596
 
596
597
  await validateTeammateModels(teammateSpecs);
598
+ sessionTeammateRoster.push(...teammateNames.filter((teammateName) => !sessionTeammateRoster.includes(teammateName)));
597
599
  await ensureCallbackServer();
598
600
 
599
601
  const team: TeamState = {
@@ -620,7 +622,6 @@ export default function (pi: ExtensionAPI) {
620
622
  closeCallbackServerIfUnused();
621
623
  throw error;
622
624
  }
623
-
624
625
  return toolResult({
625
626
  accepted: true,
626
627
  team: team.name,
@@ -638,8 +639,8 @@ export default function (pi: ExtensionAPI) {
638
639
  description: "Send a message from main to teammate(s). Fire-and-forget; does not wait for replies. Teammates will send you messages as they deem appropriate by way of push.",
639
640
  promptSnippet: "Send a message from main to teammate(s)",
640
641
  renderShell: "self",
641
- renderCall: (args, theme, context) => renderTeamToolCall("teamsend", args, theme, context),
642
- renderResult: (result, options, theme, context) => renderTeamToolResult("teamsend", result, options, theme, context, getMarkdownTheme()),
642
+ renderCall: (args, theme, context) => renderTeamToolCall("teamsend", args, theme, context, sessionTeammateRoster),
643
+ renderResult: (result, options, theme, context) => renderTeamToolResult("teamsend", result, options, theme, context, getMarkdownTheme(), sessionTeammateRoster),
643
644
  parameters: Type.Object({
644
645
  team: Type.Optional(Type.String({ description: "Team name; optional only when exactly one team exists" })),
645
646
  to: Type.Array(Type.String(), { description: "Recipient teammate names" }),
@@ -663,8 +664,8 @@ export default function (pi: ExtensionAPI) {
663
664
  description: "Set main's status for a team and/or read team statuses.",
664
665
  promptSnippet: "Set/read team status maps",
665
666
  renderShell: "self",
666
- renderCall: (args, theme, context) => renderTeamToolCall("teamstatus", args, theme, context),
667
- renderResult: (result, options, theme, context) => renderTeamToolResult("teamstatus", result, options, theme, context),
667
+ renderCall: (args, theme, context) => renderTeamToolCall("teamstatus", args, theme, context, sessionTeammateRoster),
668
+ renderResult: (result, options, theme, context) => renderTeamToolResult("teamstatus", result, options, theme, context, undefined, sessionTeammateRoster),
668
669
  parameters: Type.Object({
669
670
  team: Type.Optional(Type.String({ description: "Team name; optional for listing all statuses or when exactly one team exists" })),
670
671
  // TODO: make gerund and phrase optionality a XOR.
@@ -691,8 +692,8 @@ export default function (pi: ExtensionAPI) {
691
692
  description: "Inspect a compact, paged, filterable event log for a pi-simple-team team.",
692
693
  promptSnippet: "Inspect team event log",
693
694
  renderShell: "self",
694
- renderCall: (args, theme, context) => renderTeamToolCall("teamlog", args, theme, context),
695
- renderResult: (result, options, theme, context) => renderTeamToolResult("teamlog", result, options, theme, context),
695
+ renderCall: (args, theme, context) => renderTeamToolCall("teamlog", args, theme, context, sessionTeammateRoster),
696
+ renderResult: (result, options, theme, context) => renderTeamToolResult("teamlog", result, options, theme, context, undefined, sessionTeammateRoster),
696
697
  parameters: Type.Object({
697
698
  team: Type.Optional(Type.String({ description: "Team name; optional only when exactly one team exists" })),
698
699
  teammate: Type.Optional(Type.String({ description: "Filter to one teammate name" })),
@@ -743,8 +744,8 @@ export default function (pi: ExtensionAPI) {
743
744
  description: "Stop a team and kill its teammate processes.",
744
745
  promptSnippet: "Stop a team and kill its teammate processes",
745
746
  renderShell: "self",
746
- renderCall: (args, theme, context) => renderTeamToolCall("team_shutdown", args, theme, context),
747
- renderResult: (result, options, theme, context) => renderTeamToolResult("team_shutdown", result, options, theme, context),
747
+ renderCall: (args, theme, context) => renderTeamToolCall("team_shutdown", args, theme, context, sessionTeammateRoster),
748
+ renderResult: (result, options, theme, context) => renderTeamToolResult("team_shutdown", result, options, theme, context, undefined, sessionTeammateRoster),
748
749
  parameters: Type.Object({
749
750
  team: Type.Optional(Type.String({ description: "Team name; optional only when exactly one team exists" })),
750
751
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giladbarnea/pi-simple-team",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A flat, live team of Pi agents.",
5
5
  "keywords": [
6
6
  "pi-package",
package/render.ts CHANGED
@@ -151,7 +151,7 @@ export function statusWordToken(word: string): string {
151
151
  return STATUS_WORD_TOKENS[word.trim().toLowerCase()] ?? "accent";
152
152
  }
153
153
 
154
- function memberRows(theme: ThemeLike, statuses: Record<string, TeamStatusView>, indent = ""): string[] {
154
+ function memberRows(theme: ThemeLike, statuses: Record<string, TeamStatusView>, roster: string[], indent = ""): string[] {
155
155
  const names = Object.keys(statuses);
156
156
  const nameWidth = Math.max(...names.map((name) => name.length));
157
157
  const wordWidth = Math.max(...names.map((name) => statuses[name]!.word.length));
@@ -159,25 +159,25 @@ function memberRows(theme: ThemeLike, statuses: Record<string, TeamStatusView>,
159
159
  const entry = statuses[name]!;
160
160
  const branch = index === names.length - 1 ? "└" : "├";
161
161
  const tail = statLine(theme, [entry.phrase, theme.fg("dim", entry.updated)]);
162
- return `${indent}${treeConnector(theme, branch)}${theme.fg("accent", padVisible(name, nameWidth))} ${theme.fg(statusWordToken(entry.word), padVisible(entry.word, wordWidth))} ${tail}`;
162
+ return `${indent}${treeConnector(theme, branch)}${theme.fg(actorHueToken(name, roster), padVisible(name, nameWidth))} ${theme.fg(statusWordToken(entry.word), padVisible(entry.word, wordWidth))} ${tail}`;
163
163
  });
164
164
  }
165
165
 
166
- export function teamStatusLines(theme: ThemeLike, team: string, statuses: Record<string, TeamStatusView>): string[] {
166
+ export function teamStatusLines(theme: ThemeLike, team: string, statuses: Record<string, TeamStatusView>, roster: string[] = []): string[] {
167
167
  const members = Object.values(statuses);
168
168
  const workingCount = members.filter((member) => statusWordToken(member.word) === "success").length;
169
169
  const stats = [theme.fg("muted", plural(members.length, "member"))];
170
170
  if (workingCount > 0) stats.push(theme.fg("success", `${workingCount} working`));
171
- return [headerLine(theme, "Team Status", theme.fg("accent", team), stats), ...memberRows(theme, statuses)];
171
+ return [headerLine(theme, "Team Status", theme.fg("accent", team), stats), ...memberRows(theme, statuses, roster)];
172
172
  }
173
173
 
174
- export function allTeamsStatusLines(theme: ThemeLike, teams: Record<string, Record<string, TeamStatusView>>): string[] {
174
+ export function allTeamsStatusLines(theme: ThemeLike, teams: Record<string, Record<string, TeamStatusView>>, roster: string[] = []): string[] {
175
175
  const teamNames = Object.keys(teams);
176
176
  const lines = [headerLine(theme, "Team Status", theme.fg("muted", plural(teamNames.length, "team")))];
177
177
  teamNames.forEach((teamName, index) => {
178
178
  const branch = index === teamNames.length - 1 ? "└" : "├";
179
179
  lines.push(`${treeConnector(theme, branch)}${theme.fg("accent", teamName)}`);
180
- lines.push(...memberRows(theme, teams[teamName]!, treeStem(theme, branch)));
180
+ lines.push(...memberRows(theme, teams[teamName]!, roster, treeStem(theme, branch)));
181
181
  });
182
182
  return lines;
183
183
  }
@@ -188,13 +188,13 @@ interface TeammateSpecView {
188
188
  thinking?: string;
189
189
  }
190
190
 
191
- export function teamSpawnLines(theme: ThemeLike, team: string, teammates: TeammateSpecView[]): string[] {
191
+ export function teamSpawnLines(theme: ThemeLike, team: string, teammates: TeammateSpecView[], roster: string[] = []): string[] {
192
192
  const header = headerLine(theme, "Team Spawn", theme.fg("accent", team), [theme.fg("muted", plural(teammates.length, "teammate"))]);
193
193
  const nameWidth = Math.max(...teammates.map((teammate) => teammate.name.length));
194
194
  const rows = teammates.map((teammate, index) => {
195
195
  const branch = index === teammates.length - 1 ? "└" : "├";
196
196
  const spec = statLine(theme, [theme.fg("muted", teammate.model), theme.fg("dim", teammate.thinking ?? "")]);
197
- return `${treeConnector(theme, branch)}${theme.fg("accent", padVisible(teammate.name, nameWidth))} ${spec}`;
197
+ return `${treeConnector(theme, branch)}${theme.fg(actorHueToken(teammate.name, roster), padVisible(teammate.name, nameWidth))} ${spec}`;
198
198
  });
199
199
  return [header, ...rows];
200
200
  }
@@ -212,24 +212,29 @@ function quotedBody(theme: ThemeLike, message: string, options: { lineLimit: num
212
212
 
213
213
  const SEND_PREVIEW_LINES = 3;
214
214
 
215
- function sendTarget(theme: ThemeLike, to: string[]): string {
216
- return `${theme.fg("muted", `${glyphs().arrow} `)}${theme.fg("accent", to.join(", "))}`;
215
+ function actorList(theme: ThemeLike, names: string[], roster: string[], separator: string): string {
216
+ return names.map((name) => theme.fg(actorHueToken(name, roster), name)).join(theme.fg("muted", separator));
217
+ }
218
+
219
+ function sendTarget(theme: ThemeLike, to: string[], roster: string[] = []): string {
220
+ const recipients = actorList(theme, to, roster, ", ");
221
+ return `${theme.fg("muted", `${glyphs().arrow} `)}${recipients}`;
217
222
  }
218
223
 
219
224
  function sendStats(theme: ThemeLike, message: string, interrupt: boolean): string[] {
220
225
  return [interrupt ? theme.fg("warning", "interrupt") : "", theme.fg("muted", formatCharCount(message.length))];
221
226
  }
222
227
 
223
- export function teamSendLines(theme: ThemeLike, options: { to: string[]; message: string; interrupt: boolean; expanded: boolean }): TeamLine[] {
224
- const header = headerLine(theme, "Team Send", sendTarget(theme, options.to), sendStats(theme, options.message, options.interrupt));
228
+ export function teamSendLines(theme: ThemeLike, options: { to: string[]; message: string; interrupt: boolean; expanded: boolean }, roster: string[] = []): TeamLine[] {
229
+ const header = headerLine(theme, "Team Send", sendTarget(theme, options.to, roster), sendStats(theme, options.message, options.interrupt));
225
230
  const lineLimit = options.expanded ? Number.POSITIVE_INFINITY : SEND_PREVIEW_LINES;
226
231
  return [header, ...quotedBody(theme, options.message, { lineLimit, barToken: "muted" })];
227
232
  }
228
233
 
229
- export function teamShutdownLines(theme: ThemeLike, team: string, teammates: string[]): string[] {
234
+ export function teamShutdownLines(theme: ThemeLike, team: string, teammates: string[], roster: string[] = []): string[] {
230
235
  const header = headerLine(theme, "Team Shutdown", theme.fg("accent", team), [theme.fg("muted", `${plural(teammates.length, "teammate")} stopped`)]);
231
236
  if (teammates.length === 0) return [header];
232
- return [header, `${treeConnector(theme, "└")}${theme.fg("muted", teammates.join(glyphs().dot))}`];
237
+ return [header, `${treeConnector(theme, "└")}${actorList(theme, teammates, roster, glyphs().dot)}`];
233
238
  }
234
239
 
235
240
  const TEAMMATE_HUE_TOKENS = ["mdCode", "customMessageLabel", "mdHeading"] as const;
@@ -474,7 +479,7 @@ function actionRows(theme: ThemeLike, actions: LogAction[], roster: string[], ha
474
479
  });
475
480
  }
476
481
 
477
- function filterStats(theme: ThemeLike, filters: Record<string, unknown>): string[] {
482
+ function filterStats(theme: ThemeLike, filters: Record<string, unknown>, roster: string[]): string[] {
478
483
  const stats: string[] = [];
479
484
  for (const [key, value] of Object.entries(filters)) {
480
485
  if (typeof value !== "string" || !value) continue;
@@ -483,6 +488,10 @@ function filterStats(theme: ThemeLike, filters: Record<string, unknown>): string
483
488
  stats.push(theme.fg("borderMuted", `since ${Number.isFinite(parsed) ? timeOfDay(parsed) : value}`));
484
489
  continue;
485
490
  }
491
+ if (key === "teammate") {
492
+ stats.push(`${theme.fg("borderMuted", "teammate=")}${theme.fg(actorHueToken(value, roster), value)}`);
493
+ continue;
494
+ }
486
495
  stats.push(theme.fg("borderMuted", `${key}=${value}`));
487
496
  }
488
497
  return stats;
@@ -494,7 +503,7 @@ export function teamLogLines(theme: ThemeLike, view: TeamLogRenderView): string[
494
503
  const stats = [
495
504
  theme.fg("muted", plural(actions.length, "action")),
496
505
  theme.fg("muted", view.returned === view.totalMatched ? plural(view.returned, "event") : `${view.returned} of ${view.totalMatched} events`),
497
- ...filterStats(theme, view.filters ?? {}),
506
+ ...filterStats(theme, view.filters ?? {}, view.roster ?? []),
498
507
  ];
499
508
  const header = headerLine(theme, "Team Log", theme.fg("accent", view.team), stats);
500
509
  if (view.entries.length === 0) return [header, `${treeConnector(theme, "└")}${theme.fg("muted", "no matching events")}`];
@@ -506,22 +515,22 @@ export function teamLogLines(theme: ThemeLike, view: TeamLogRenderView): string[
506
515
  return [header, ...rows, ...(footer ? [footer] : [])];
507
516
  }
508
517
 
509
- export function teamMessageLines(theme: ThemeLike, details: TeamMessageDetails): TeamLine[] {
518
+ export function teamMessageLines(theme: ThemeLike, details: TeamMessageDetails, roster: string[] = []): TeamLine[] {
510
519
  const g = glyphs();
511
520
  const header = [
512
521
  theme.fg("accent", `${g.diamond} `),
513
- theme.fg("accent", theme.bold(details.from)),
522
+ theme.fg(actorHueToken(details.from, roster), theme.bold(details.from)),
514
523
  theme.fg("muted", ` ${g.arrow} main`),
515
524
  theme.fg("dim", `${g.dot}${details.team}${g.dot}${details.sentAt}`),
516
525
  ].join("");
517
526
  return [header, ...quotedBody(theme, details.message, { lineLimit: Number.POSITIVE_INFINITY, barToken: "accent" })];
518
527
  }
519
528
 
520
- function teamMessageHeader(theme: ThemeLike, details: TeamMessageDetails): string {
529
+ function teamMessageHeader(theme: ThemeLike, details: TeamMessageDetails, roster: string[]): string {
521
530
  const g = glyphs();
522
531
  return [
523
532
  theme.fg("accent", `${g.diamond} `),
524
- theme.fg("accent", theme.bold(details.from)),
533
+ theme.fg(actorHueToken(details.from, roster), theme.bold(details.from)),
525
534
  theme.fg("muted", ` ${g.arrow} main`),
526
535
  theme.fg("dim", `${g.dot}${details.team}${g.dot}${details.sentAt}`),
527
536
  ].join("");
@@ -592,14 +601,14 @@ function accentTeam(theme: ThemeLike, team: unknown): string {
592
601
  return typeof team === "string" && team ? theme.fg("accent", team) : "";
593
602
  }
594
603
 
595
- function callBodyFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>): string {
604
+ function callBodyFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>, roster: string[]): string {
596
605
  if (tool === "team_spawn") {
597
606
  const teammates = (args.teammates ?? []) as unknown[];
598
607
  return callBody(theme, "Team Spawn", accentTeam(theme, args.team), [theme.fg("muted", plural(teammates.length, "teammate"))]);
599
608
  }
600
609
  if (tool === "teamsend") {
601
610
  const message = String(args.message ?? "");
602
- return callBody(theme, "Team Send", sendTarget(theme, (args.to ?? []) as string[]), sendStats(theme, message, Boolean(args.interrupt)));
611
+ return callBody(theme, "Team Send", sendTarget(theme, (args.to ?? []) as string[], roster), sendStats(theme, message, Boolean(args.interrupt)));
603
612
  }
604
613
  if (tool === "teamstatus") {
605
614
  const target = accentTeam(theme, args.team) || theme.fg("muted", "all teams");
@@ -609,15 +618,19 @@ function callBodyFor(tool: TeamToolName, theme: ThemeLike, args: Record<string,
609
618
  if (tool === "teamlog") {
610
619
  const filterStats = ["teammate", "kind", "search", "since", "cursor"]
611
620
  .filter((key) => typeof args[key] === "string" && args[key])
612
- .map((key) => theme.fg("dim", `${key}=${String(args[key])}`));
621
+ .map((key) => {
622
+ const value = String(args[key]);
623
+ if (key === "teammate") return `${theme.fg("dim", "teammate=")}${theme.fg(actorHueToken(value, roster), value)}`;
624
+ return theme.fg("dim", `${key}=${value}`);
625
+ });
613
626
  return callBody(theme, "Team Log", accentTeam(theme, args.team), filterStats);
614
627
  }
615
628
  return callBody(theme, "Team Shutdown", accentTeam(theme, args.team));
616
629
  }
617
630
 
618
- function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>, details: Record<string, unknown>, expanded: boolean): TeamLine[] {
631
+ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>, details: Record<string, unknown>, expanded: boolean, roster: string[]): TeamLine[] {
619
632
  if (tool === "team_spawn") {
620
- return teamSpawnLines(theme, String(details.team), (args.teammates ?? []) as TeammateSpecView[]);
633
+ return teamSpawnLines(theme, String(details.team), (args.teammates ?? []) as TeammateSpecView[], roster);
621
634
  }
622
635
  if (tool === "teamsend") {
623
636
  return teamSendLines(theme, {
@@ -625,17 +638,17 @@ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<strin
625
638
  message: String(args.message ?? ""),
626
639
  interrupt: Boolean(details.interrupt),
627
640
  expanded,
628
- });
641
+ }, roster);
629
642
  }
630
643
  if (tool === "teamstatus") {
631
- if (details.teams) return allTeamsStatusLines(theme, details.teams as Record<string, Record<string, TeamStatusView>>);
632
- return teamStatusLines(theme, String(details.team), details.status as Record<string, TeamStatusView>);
644
+ if (details.teams) return allTeamsStatusLines(theme, details.teams as Record<string, Record<string, TeamStatusView>>, roster);
645
+ return teamStatusLines(theme, String(details.team), details.status as Record<string, TeamStatusView>, roster);
633
646
  }
634
647
  if (tool === "teamlog") {
635
648
  const filters = (details.filters ?? {}) as Record<string, unknown>;
636
649
  return teamLogLines(theme, {
637
650
  team: String(details.team),
638
- roster: (details.roster ?? []) as string[],
651
+ roster: roster.length > 0 ? roster : (details.roster ?? []) as string[],
639
652
  entries: (details.entries ?? []) as TeamLogEntry[],
640
653
  totalMatched: Number(details.totalMatched ?? 0),
641
654
  returned: Number(details.returned ?? 0),
@@ -643,11 +656,11 @@ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<strin
643
656
  filters: { teammate: filters.teammate, kind: filters.kind, search: filters.search, since: filters.since },
644
657
  });
645
658
  }
646
- return teamShutdownLines(theme, String(details.team), (details.teammates ?? []) as string[]);
659
+ return teamShutdownLines(theme, String(details.team), (details.teammates ?? []) as string[], roster);
647
660
  }
648
661
 
649
- export function renderTeamToolCall(tool: TeamToolName, args: Record<string, unknown>, theme: ThemeLike, context: ToolRenderContextLike) {
650
- return renderPendingCall(callBodyFor(tool, theme, args ?? {}), theme, context, context?.cwd);
662
+ export function renderTeamToolCall(tool: TeamToolName, args: Record<string, unknown>, theme: ThemeLike, context: ToolRenderContextLike, roster: string[] = []) {
663
+ return renderPendingCall(callBodyFor(tool, theme, args ?? {}, roster), theme, context, context?.cwd);
651
664
  }
652
665
 
653
666
  export function renderTeamToolResult(
@@ -657,28 +670,29 @@ export function renderTeamToolResult(
657
670
  theme: ThemeLike,
658
671
  context: ToolRenderContextLike,
659
672
  markdownTheme?: MarkdownTheme,
673
+ roster: string[] = [],
660
674
  ): TeamSendView | TeamLines {
661
675
  const args = context?.args ?? {};
662
676
  if (context?.isError || result?.isError) {
663
- return new TeamLines(errorLines(theme, callBodyFor(tool, theme, args), textContent(result)), options.expanded ? "wrap" : "clip");
677
+ return new TeamLines(errorLines(theme, callBodyFor(tool, theme, args, roster), textContent(result)), options.expanded ? "wrap" : "clip");
664
678
  }
665
679
  const details = (result?.details ?? {}) as Record<string, unknown>;
666
680
  if (markdownTheme && tool === "teamsend") {
667
681
  const message = String(args.message ?? "");
668
- const header = headerLine(theme, "Team Send", sendTarget(theme, (details.to ?? []) as string[]), sendStats(theme, message, Boolean(details.interrupt)));
682
+ const header = headerLine(theme, "Team Send", sendTarget(theme, (details.to ?? []) as string[], roster), sendStats(theme, message, Boolean(details.interrupt)));
669
683
  const bar = ` ${theme.fg("muted", glyphs().codeBar)} `;
670
684
  return new TeamSendView(header, message, bar, markdownTheme, options.expanded, theme);
671
685
  }
672
- return new TeamLines(resultLinesFor(tool, theme, args, details, options.expanded), options.expanded ? "wrap" : "clip");
686
+ return new TeamLines(resultLinesFor(tool, theme, args, details, options.expanded, roster), options.expanded ? "wrap" : "clip");
673
687
  }
674
688
 
675
- export function renderTeamMessage(message: { details?: unknown }, theme: ThemeLike, markdownTheme?: MarkdownTheme): TeamMessageView | TeamLines | undefined {
689
+ export function renderTeamMessage(message: { details?: unknown }, theme: ThemeLike, markdownTheme?: MarkdownTheme, roster: string[] = []): TeamMessageView | TeamLines | undefined {
676
690
  const details = message.details as TeamMessageDetails | undefined;
677
691
  if (!details?.from || !details?.team || typeof details.message !== "string") return undefined;
678
692
  if (markdownTheme) {
679
693
  const g = glyphs();
680
694
  const bar = ` ${theme.fg("accent", g.codeBar)} `;
681
- return new TeamMessageView(teamMessageHeader(theme, details), details.message, bar, markdownTheme);
695
+ return new TeamMessageView(teamMessageHeader(theme, details, roster), details.message, bar, markdownTheme);
682
696
  }
683
- return new TeamLines(teamMessageLines(theme, details), "wrap");
697
+ return new TeamLines(teamMessageLines(theme, details, roster), "wrap");
684
698
  }