@giladbarnea/pi-simple-team 1.0.5 → 1.0.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.
Files changed (4) hide show
  1. package/index.ts +19 -13
  2. package/package.json +1 -1
  3. package/render.ts +58 -43
  4. package/teamlog.ts +2 -2
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,12 +692,17 @@ 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" })),
699
- kind: Type.Optional(Type.String({ description: "Filter to one normalized event kind" })),
700
+ kind: Type.Optional(
701
+ Type.Array(Type.String({ minLength: 1 }), {
702
+ minItems: 1,
703
+ description: "Filter to any of these normalized event kinds",
704
+ }),
705
+ ),
700
706
  search: Type.Optional(Type.String({ description: "Case-insensitive substring search over summary, teammate, direction, kind, and details" })),
701
707
  since: Type.Optional(Type.String({ description: "ISO timestamp filter; only entries at or after this time" })),
702
708
  limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 100, description: "Max rows to return, default 20, maximum 100" })),
@@ -743,8 +749,8 @@ export default function (pi: ExtensionAPI) {
743
749
  description: "Stop a team and kill its teammate processes.",
744
750
  promptSnippet: "Stop a team and kill its teammate processes",
745
751
  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),
752
+ renderCall: (args, theme, context) => renderTeamToolCall("team_shutdown", args, theme, context, sessionTeammateRoster),
753
+ renderResult: (result, options, theme, context) => renderTeamToolResult("team_shutdown", result, options, theme, context, undefined, sessionTeammateRoster),
748
754
  parameters: Type.Object({
749
755
  team: Type.Optional(Type.String({ description: "Team name; optional only when exactly one team exists" })),
750
756
  }),
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.7",
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,16 +479,21 @@ 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
- if (typeof value !== "string" || !value) continue;
485
+ const displayValue = Array.isArray(value) ? value.join(",") : value;
486
+ if (typeof displayValue !== "string" || !displayValue) continue;
481
487
  if (key === "since") {
482
- const parsed = Date.parse(value);
483
- stats.push(theme.fg("borderMuted", `since ${Number.isFinite(parsed) ? timeOfDay(parsed) : value}`));
488
+ const parsed = Date.parse(displayValue);
489
+ stats.push(theme.fg("borderMuted", `since ${Number.isFinite(parsed) ? timeOfDay(parsed) : displayValue}`));
490
+ continue;
491
+ }
492
+ if (key === "teammate") {
493
+ stats.push(`${theme.fg("borderMuted", "teammate=")}${theme.fg(actorHueToken(displayValue, roster), displayValue)}`);
484
494
  continue;
485
495
  }
486
- stats.push(theme.fg("borderMuted", `${key}=${value}`));
496
+ stats.push(theme.fg("borderMuted", `${key}=${displayValue}`));
487
497
  }
488
498
  return stats;
489
499
  }
@@ -494,7 +504,7 @@ export function teamLogLines(theme: ThemeLike, view: TeamLogRenderView): string[
494
504
  const stats = [
495
505
  theme.fg("muted", plural(actions.length, "action")),
496
506
  theme.fg("muted", view.returned === view.totalMatched ? plural(view.returned, "event") : `${view.returned} of ${view.totalMatched} events`),
497
- ...filterStats(theme, view.filters ?? {}),
507
+ ...filterStats(theme, view.filters ?? {}, view.roster ?? []),
498
508
  ];
499
509
  const header = headerLine(theme, "Team Log", theme.fg("accent", view.team), stats);
500
510
  if (view.entries.length === 0) return [header, `${treeConnector(theme, "└")}${theme.fg("muted", "no matching events")}`];
@@ -506,22 +516,22 @@ export function teamLogLines(theme: ThemeLike, view: TeamLogRenderView): string[
506
516
  return [header, ...rows, ...(footer ? [footer] : [])];
507
517
  }
508
518
 
509
- export function teamMessageLines(theme: ThemeLike, details: TeamMessageDetails): TeamLine[] {
519
+ export function teamMessageLines(theme: ThemeLike, details: TeamMessageDetails, roster: string[] = []): TeamLine[] {
510
520
  const g = glyphs();
511
521
  const header = [
512
522
  theme.fg("accent", `${g.diamond} `),
513
- theme.fg("accent", theme.bold(details.from)),
523
+ theme.fg(actorHueToken(details.from, roster), theme.bold(details.from)),
514
524
  theme.fg("muted", ` ${g.arrow} main`),
515
525
  theme.fg("dim", `${g.dot}${details.team}${g.dot}${details.sentAt}`),
516
526
  ].join("");
517
527
  return [header, ...quotedBody(theme, details.message, { lineLimit: Number.POSITIVE_INFINITY, barToken: "accent" })];
518
528
  }
519
529
 
520
- function teamMessageHeader(theme: ThemeLike, details: TeamMessageDetails): string {
530
+ function teamMessageHeader(theme: ThemeLike, details: TeamMessageDetails, roster: string[]): string {
521
531
  const g = glyphs();
522
532
  return [
523
533
  theme.fg("accent", `${g.diamond} `),
524
- theme.fg("accent", theme.bold(details.from)),
534
+ theme.fg(actorHueToken(details.from, roster), theme.bold(details.from)),
525
535
  theme.fg("muted", ` ${g.arrow} main`),
526
536
  theme.fg("dim", `${g.dot}${details.team}${g.dot}${details.sentAt}`),
527
537
  ].join("");
@@ -592,14 +602,14 @@ function accentTeam(theme: ThemeLike, team: unknown): string {
592
602
  return typeof team === "string" && team ? theme.fg("accent", team) : "";
593
603
  }
594
604
 
595
- function callBodyFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>): string {
605
+ function callBodyFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>, roster: string[]): string {
596
606
  if (tool === "team_spawn") {
597
607
  const teammates = (args.teammates ?? []) as unknown[];
598
608
  return callBody(theme, "Team Spawn", accentTeam(theme, args.team), [theme.fg("muted", plural(teammates.length, "teammate"))]);
599
609
  }
600
610
  if (tool === "teamsend") {
601
611
  const message = String(args.message ?? "");
602
- return callBody(theme, "Team Send", sendTarget(theme, (args.to ?? []) as string[]), sendStats(theme, message, Boolean(args.interrupt)));
612
+ return callBody(theme, "Team Send", sendTarget(theme, (args.to ?? []) as string[], roster), sendStats(theme, message, Boolean(args.interrupt)));
603
613
  }
604
614
  if (tool === "teamstatus") {
605
615
  const target = accentTeam(theme, args.team) || theme.fg("muted", "all teams");
@@ -608,16 +618,20 @@ function callBodyFor(tool: TeamToolName, theme: ThemeLike, args: Record<string,
608
618
  }
609
619
  if (tool === "teamlog") {
610
620
  const filterStats = ["teammate", "kind", "search", "since", "cursor"]
611
- .filter((key) => typeof args[key] === "string" && args[key])
612
- .map((key) => theme.fg("dim", `${key}=${String(args[key])}`));
621
+ .filter((key) => (typeof args[key] === "string" && args[key]) || (Array.isArray(args[key]) && args[key].length > 0))
622
+ .map((key) => {
623
+ const value = String(args[key]);
624
+ if (key === "teammate") return `${theme.fg("dim", "teammate=")}${theme.fg(actorHueToken(value, roster), value)}`;
625
+ return theme.fg("dim", `${key}=${value}`);
626
+ });
613
627
  return callBody(theme, "Team Log", accentTeam(theme, args.team), filterStats);
614
628
  }
615
629
  return callBody(theme, "Team Shutdown", accentTeam(theme, args.team));
616
630
  }
617
631
 
618
- function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>, details: Record<string, unknown>, expanded: boolean): TeamLine[] {
632
+ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<string, unknown>, details: Record<string, unknown>, expanded: boolean, roster: string[]): TeamLine[] {
619
633
  if (tool === "team_spawn") {
620
- return teamSpawnLines(theme, String(details.team), (args.teammates ?? []) as TeammateSpecView[]);
634
+ return teamSpawnLines(theme, String(details.team), (args.teammates ?? []) as TeammateSpecView[], roster);
621
635
  }
622
636
  if (tool === "teamsend") {
623
637
  return teamSendLines(theme, {
@@ -625,17 +639,17 @@ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<strin
625
639
  message: String(args.message ?? ""),
626
640
  interrupt: Boolean(details.interrupt),
627
641
  expanded,
628
- });
642
+ }, roster);
629
643
  }
630
644
  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>);
645
+ if (details.teams) return allTeamsStatusLines(theme, details.teams as Record<string, Record<string, TeamStatusView>>, roster);
646
+ return teamStatusLines(theme, String(details.team), details.status as Record<string, TeamStatusView>, roster);
633
647
  }
634
648
  if (tool === "teamlog") {
635
649
  const filters = (details.filters ?? {}) as Record<string, unknown>;
636
650
  return teamLogLines(theme, {
637
651
  team: String(details.team),
638
- roster: (details.roster ?? []) as string[],
652
+ roster: roster.length > 0 ? roster : (details.roster ?? []) as string[],
639
653
  entries: (details.entries ?? []) as TeamLogEntry[],
640
654
  totalMatched: Number(details.totalMatched ?? 0),
641
655
  returned: Number(details.returned ?? 0),
@@ -643,11 +657,11 @@ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<strin
643
657
  filters: { teammate: filters.teammate, kind: filters.kind, search: filters.search, since: filters.since },
644
658
  });
645
659
  }
646
- return teamShutdownLines(theme, String(details.team), (details.teammates ?? []) as string[]);
660
+ return teamShutdownLines(theme, String(details.team), (details.teammates ?? []) as string[], roster);
647
661
  }
648
662
 
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);
663
+ export function renderTeamToolCall(tool: TeamToolName, args: Record<string, unknown>, theme: ThemeLike, context: ToolRenderContextLike, roster: string[] = []) {
664
+ return renderPendingCall(callBodyFor(tool, theme, args ?? {}, roster), theme, context, context?.cwd);
651
665
  }
652
666
 
653
667
  export function renderTeamToolResult(
@@ -657,28 +671,29 @@ export function renderTeamToolResult(
657
671
  theme: ThemeLike,
658
672
  context: ToolRenderContextLike,
659
673
  markdownTheme?: MarkdownTheme,
674
+ roster: string[] = [],
660
675
  ): TeamSendView | TeamLines {
661
676
  const args = context?.args ?? {};
662
677
  if (context?.isError || result?.isError) {
663
- return new TeamLines(errorLines(theme, callBodyFor(tool, theme, args), textContent(result)), options.expanded ? "wrap" : "clip");
678
+ return new TeamLines(errorLines(theme, callBodyFor(tool, theme, args, roster), textContent(result)), options.expanded ? "wrap" : "clip");
664
679
  }
665
680
  const details = (result?.details ?? {}) as Record<string, unknown>;
666
681
  if (markdownTheme && tool === "teamsend") {
667
682
  const message = String(args.message ?? "");
668
- const header = headerLine(theme, "Team Send", sendTarget(theme, (details.to ?? []) as string[]), sendStats(theme, message, Boolean(details.interrupt)));
683
+ const header = headerLine(theme, "Team Send", sendTarget(theme, (details.to ?? []) as string[], roster), sendStats(theme, message, Boolean(details.interrupt)));
669
684
  const bar = ` ${theme.fg("muted", glyphs().codeBar)} `;
670
685
  return new TeamSendView(header, message, bar, markdownTheme, options.expanded, theme);
671
686
  }
672
- return new TeamLines(resultLinesFor(tool, theme, args, details, options.expanded), options.expanded ? "wrap" : "clip");
687
+ return new TeamLines(resultLinesFor(tool, theme, args, details, options.expanded, roster), options.expanded ? "wrap" : "clip");
673
688
  }
674
689
 
675
- export function renderTeamMessage(message: { details?: unknown }, theme: ThemeLike, markdownTheme?: MarkdownTheme): TeamMessageView | TeamLines | undefined {
690
+ export function renderTeamMessage(message: { details?: unknown }, theme: ThemeLike, markdownTheme?: MarkdownTheme, roster: string[] = []): TeamMessageView | TeamLines | undefined {
676
691
  const details = message.details as TeamMessageDetails | undefined;
677
692
  if (!details?.from || !details?.team || typeof details.message !== "string") return undefined;
678
693
  if (markdownTheme) {
679
694
  const g = glyphs();
680
695
  const bar = ` ${theme.fg("accent", g.codeBar)} `;
681
- return new TeamMessageView(teamMessageHeader(theme, details), details.message, bar, markdownTheme);
696
+ return new TeamMessageView(teamMessageHeader(theme, details, roster), details.message, bar, markdownTheme);
682
697
  }
683
- return new TeamLines(teamMessageLines(theme, details), "wrap");
698
+ return new TeamLines(teamMessageLines(theme, details, roster), "wrap");
684
699
  }
package/teamlog.ts CHANGED
@@ -36,7 +36,7 @@ export type TeamLogEntryInput = Omit<TeamLogEntry, "sequence" | "timestamp" | "e
36
36
 
37
37
  export interface TeamLogFilterParams {
38
38
  teammate?: string;
39
- kind?: string;
39
+ kind?: string[];
40
40
  search?: string;
41
41
  since?: string;
42
42
  }
@@ -118,7 +118,7 @@ export function filterTeamLog(entries: TeamLogEntry[], params: TeamLogFilterPara
118
118
  const sinceThreshold = parseSince(params.since);
119
119
  return entries.filter((entry) => {
120
120
  if (params.teammate !== undefined && entry.teammate !== params.teammate) return false;
121
- if (params.kind !== undefined && entry.kind !== params.kind) return false;
121
+ if (params.kind !== undefined && !params.kind.includes(entry.kind)) return false;
122
122
  if (sinceThreshold !== undefined && entry.epochMilliseconds < sinceThreshold) return false;
123
123
  if (params.search !== undefined && !matchesSearch(entry, params.search)) return false;
124
124
  return true;