@giladbarnea/pi-simple-team 2.0.24 → 2.0.25
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/README.md +7 -1
- package/child-tools.ts +27 -0
- package/index.ts +146 -19
- package/package.json +1 -1
- package/render.ts +28 -11
- package/resume-message.ts +30 -0
- package/team-registry.ts +9 -1
- package/teammate-facts.ts +4 -4
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ Your main agent calls `team_status` and understands exactly what is going on. Ma
|
|
|
128
128
|
|
|
129
129
|
Teammates know how much free context they have left.
|
|
130
130
|
|
|
131
|
-
Main agent knows its own and everyone else's too.
|
|
131
|
+
Main agent knows its own and everyone else's too. You see it as well: team tool results show the last reported context use beside each teammate they involve, such as `Team Send → builder ▆72% context`.
|
|
132
132
|
|
|
133
133
|
They will hand off work autonomously when it's time to say goodbye.
|
|
134
134
|
|
|
@@ -171,6 +171,8 @@ Have a teammate do work, exit Pi entirely, come back tomorrow in a brand-new ses
|
|
|
171
171
|
|
|
172
172
|
You can even `/resume` a teammate session directly if you ever want a cozy one-on-one, or run `pi --session <teammate-session-id>`.
|
|
173
173
|
|
|
174
|
+
Every teammate session records which main session and team started it, in one `pi-simple-team-teammate` custom entry that the model and the TUI never see. Its `sessionId` is the session it was written in, so a later `pi --fork` of a teammate carries a copy you can tell is inherited.
|
|
175
|
+
|
|
174
176
|
## It’s teams all the way down (optionally)
|
|
175
177
|
|
|
176
178
|
Tell main you want to **have a teammate manage its own team(s).**
|
|
@@ -233,6 +235,8 @@ Kept minimal:
|
|
|
233
235
|
|
|
234
236
|
Startup delivers `commonPrompt` inside `<team-system-message>` and each teammate's `systemPrompt` inside `<your-specific-system-message>`. These are labels in the custom team message, not system-role overrides. The briefing also contains the teammate's identity and coordination guidance.
|
|
235
237
|
|
|
238
|
+
When main quits, reloads or crashes, its teams stop. When that main session starts again, Simple Team reattaches the teammates that were running, idle and in their own conversations, without sending them anything or making a model request. Main gets one message listing them and which were working, so it can tell those to continue. Teams stopped with `team_shutdown`, or left by switching main to another session, stay stopped. After a crash, a Herdr pane teammate may still be running in its pane, so it is listed instead of reattached.
|
|
239
|
+
|
|
236
240
|
Resume appends a custom briefing with the team identity, current time, and last recorded model activity. Optional `resumptionPrompt` instructions follow that briefing without changing saved definitions. With `startIdle: true`, the briefing waits in context for the next turn.
|
|
237
241
|
|
|
238
242
|
Existing teammates can be selected by name or Pi session ID in the same input field. Messages, logs, and context usage share a `targets` list. Select a team for all its teammates, or select individual teammates across your teams. Ambiguous names return IDs you can use instead.
|
|
@@ -241,6 +245,8 @@ Existing teammates can be selected by name or Pi session ID in the same input fi
|
|
|
241
245
|
|
|
242
246
|
`team_list` shows active teams as short rows, newest created first, 20 per page by default (`limit` up to 100, then `cursor`). Pass `includeDormantTeams: true` to include dormant teams, or `team` for one team's full records. Pages follow creation order, so a team that changes state or activity between pages is neither repeated nor skipped.
|
|
243
247
|
|
|
248
|
+
Reminders are recorded in the session, so they survive `/reload` and restarts of that session. One that fell due while Pi was not running fires on start and says how late it is.
|
|
249
|
+
|
|
244
250
|
`list_reminders` shows this session's pending reminders with their IDs, slugs and times. `cancel_reminders` cancels reminders by ID or slug, or every pending one with `all: true`; a call with neither cancels nothing.
|
|
245
251
|
|
|
246
252
|
Spawn, resume, and add return the complete roster. Results distinguish a live runtime from active work, including work that was already underway before the call.
|
package/child-tools.ts
CHANGED
|
@@ -37,6 +37,9 @@ export interface ChildRuntimeConfig {
|
|
|
37
37
|
processId?: string;
|
|
38
38
|
participants: string[];
|
|
39
39
|
canManageOwnTeams: boolean;
|
|
40
|
+
/** The main session that started this teammate. A simulated teammate without one records no breadcrumb. */
|
|
41
|
+
parentSessionId?: string;
|
|
42
|
+
parentSessionFile?: string;
|
|
40
43
|
interruptWaitTimeoutMilliseconds?: number;
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -66,9 +69,32 @@ function readRequiredChildRuntimeConfig(): ChildRuntimeConfig {
|
|
|
66
69
|
processId: process.env.PI_SIMPLE_TEAM_PROCESS,
|
|
67
70
|
participants: readParticipants(),
|
|
68
71
|
canManageOwnTeams: process.env.PI_SIMPLE_TEAM_CAN_MANAGE_OWN_TEAMS === "1",
|
|
72
|
+
parentSessionId: process.env.PI_SIMPLE_TEAM_PARENT_SESSION_ID,
|
|
73
|
+
parentSessionFile: process.env.PI_SIMPLE_TEAM_PARENT_SESSION_FILE,
|
|
69
74
|
};
|
|
70
75
|
}
|
|
71
76
|
|
|
77
|
+
const breadcrumbType = "pi-simple-team-teammate";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Names, once in this teammate's own session, the main session and team that started it. It is a custom entry, so it never
|
|
81
|
+
* reaches the model or the TUI. Its sessionId tells the teammate's own breadcrumb from a copy inherited through a later fork.
|
|
82
|
+
*/
|
|
83
|
+
function recordBreadcrumb(pi: ExtensionAPI, config: ChildRuntimeConfig, context: ExtensionContext): void {
|
|
84
|
+
if (!config.parentSessionId) return;
|
|
85
|
+
const sessionId = context.sessionManager.getSessionId();
|
|
86
|
+
if (context.sessionManager.getEntries().some((entry) => entry.type === "custom" && entry.customType === breadcrumbType && (entry.data as { sessionId?: unknown } | undefined)?.sessionId === sessionId)) return;
|
|
87
|
+
pi.appendEntry(breadcrumbType, {
|
|
88
|
+
sessionId,
|
|
89
|
+
parentSessionId: config.parentSessionId,
|
|
90
|
+
parentSessionFile: config.parentSessionFile,
|
|
91
|
+
teamId: config.teamId,
|
|
92
|
+
teamName: config.teamName,
|
|
93
|
+
teammate: config.teammateName,
|
|
94
|
+
createdAt: new Date().toISOString(),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
72
98
|
/**
|
|
73
99
|
* A teammate process inherits discovered extensions, so it can also discover an installed copy of this package at another path.
|
|
74
100
|
* Only the copy main passed as PI_SIMPLE_TEAM_RUNTIME_PATH registers; another copy stays inert so their tools cannot conflict.
|
|
@@ -266,6 +292,7 @@ function startChildRuntime(pi: ExtensionAPI, config: ChildRuntimeConfig): void {
|
|
|
266
292
|
});
|
|
267
293
|
pi.on("session_start", async (_event, context) => {
|
|
268
294
|
activateChildTools(pi);
|
|
295
|
+
recordBreadcrumb(pi, config, context);
|
|
269
296
|
server = http.createServer((request, response) => {
|
|
270
297
|
void (async () => {
|
|
271
298
|
try {
|
package/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { formatContextWindowReport, requireKnownContextUsage, type KnownContextU
|
|
|
11
11
|
import { useModelNames } from "./model-names.ts";
|
|
12
12
|
import { formatScopedModelGuidance, validateTeammateModels, type ModelReference } from "./model-preflight.ts";
|
|
13
13
|
import { composeTeamBriefing } from "./team-briefing.ts";
|
|
14
|
-
import { composeResumptionMessage, composeSettingsMessage } from "./resume-message.ts";
|
|
14
|
+
import { composeReattachmentMessage, composeResumptionMessage, composeSettingsMessage, type Reattachment } from "./resume-message.ts";
|
|
15
15
|
import { callParent, isInertTeamCopy, readChildRuntimeConfig, registerChildTools } from "./child-tools.ts";
|
|
16
16
|
import {
|
|
17
17
|
canonicalProjectDirectory,
|
|
@@ -105,6 +105,8 @@ interface TeamState {
|
|
|
105
105
|
showOnHerdrPanes: boolean;
|
|
106
106
|
teamPrompt: string;
|
|
107
107
|
mainSessionFile?: string;
|
|
108
|
+
/** The main session running this team. Every teammate it starts records it in its own session's breadcrumb. */
|
|
109
|
+
parentSession?: { id: string; file?: string };
|
|
108
110
|
members: Map<string, TeammateState>;
|
|
109
111
|
statuses: Map<string, TeamStatus>;
|
|
110
112
|
created: string;
|
|
@@ -123,6 +125,7 @@ const defaultRpcShutdownGraceMilliseconds = 1_000;
|
|
|
123
125
|
/** Time for main's own shutdown to mark its teams before an exit notice is sent, for signals that reach main and its teammates together. */
|
|
124
126
|
const exitNoticeGraceMilliseconds = 2_000;
|
|
125
127
|
const teamMessageType = "pi-simple-team";
|
|
128
|
+
const reattachedMessageType = "pi-simple-team-reattached";
|
|
126
129
|
const teams = new Map<string, TeamState>();
|
|
127
130
|
const callbackToken = crypto.randomBytes(24).toString("hex");
|
|
128
131
|
let callbackServer: http.Server | undefined;
|
|
@@ -180,15 +183,21 @@ function decodeTeamListCursor(cursor: string): TeamListCursor {
|
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
interface Reminder {
|
|
186
|
+
sessionId: string;
|
|
183
187
|
id: string;
|
|
184
188
|
slug: string;
|
|
185
189
|
message: string;
|
|
186
190
|
armedAt: Date;
|
|
187
191
|
wakeAt: Date;
|
|
188
|
-
timer
|
|
192
|
+
timer?: ReturnType<typeof setTimeout>;
|
|
189
193
|
state: "pending" | "delivered" | "cancelled";
|
|
190
194
|
}
|
|
191
195
|
|
|
196
|
+
/** A reminder as its session records it. A reminder's latest record holds its current state. */
|
|
197
|
+
type ReminderRecord = Omit<Reminder, "armedAt" | "wakeAt" | "timer"> & { armedAt: string; wakeAt: string };
|
|
198
|
+
|
|
199
|
+
const reminderType = "pi-simple-team-reminder";
|
|
200
|
+
|
|
192
201
|
const reminderSlugWords = {
|
|
193
202
|
adjectives: ["amber", "brisk", "calm", "clever", "dusty", "eager", "fuzzy", "gentle", "golden", "hollow", "jolly", "lively", "mellow", "misty", "nimble", "plucky", "quiet", "rapid", "rusty", "silver", "steady", "sunny", "swift", "witty"],
|
|
194
203
|
nouns: ["badger", "beacon", "cedar", "comet", "falcon", "fern", "harbor", "heron", "lantern", "maple", "meadow", "otter", "pebble", "pine", "quail", "raven", "river", "robin", "sparrow", "spruce", "thistle", "tulip", "walrus", "willow"],
|
|
@@ -593,6 +602,11 @@ function formatStatus(team: TeamState): Record<string, TeamStatus> {
|
|
|
593
602
|
return Object.fromEntries([...team.statuses.entries()].sort(([a], [b]) => a.localeCompare(b)));
|
|
594
603
|
}
|
|
595
604
|
|
|
605
|
+
/** A teammate a tool involves, with the context use it last reported, for that tool's renderer. */
|
|
606
|
+
function agentContext(teammate: TeammateState): { name: string; contextPercent?: number } {
|
|
607
|
+
return { name: teammate.name, contextPercent: teammate.contextPercent };
|
|
608
|
+
}
|
|
609
|
+
|
|
596
610
|
/** @example teammateViews(team).scout?.model // "openai-codex/gpt-6-luna" */
|
|
597
611
|
function teammateViews(team: TeamState): Record<string, TeammateView> {
|
|
598
612
|
return Object.fromEntries([...team.members.values()].map((teammate) => [teammate.name, {
|
|
@@ -690,9 +704,17 @@ function childEnvironmentOverrides(team: TeamState, teammate: TeammateState, par
|
|
|
690
704
|
PI_SIMPLE_TEAM_PROCESS: teammate.processRecord!.id,
|
|
691
705
|
PI_SIMPLE_TEAM_PARTICIPANTS: JSON.stringify(participants),
|
|
692
706
|
PI_SIMPLE_TEAM_CAN_MANAGE_OWN_TEAMS: teammate.canManageOwnTeams ? "1" : "0",
|
|
707
|
+
...(team.parentSession ? { PI_SIMPLE_TEAM_PARENT_SESSION_ID: team.parentSession.id } : {}),
|
|
708
|
+
...(team.parentSession?.file ? { PI_SIMPLE_TEAM_PARENT_SESSION_FILE: team.parentSession.file } : {}),
|
|
693
709
|
};
|
|
694
710
|
}
|
|
695
711
|
|
|
712
|
+
/** The main session a tool or event runs in, when it has one. */
|
|
713
|
+
function mainSession(context: ExtensionContext): TeamState["parentSession"] {
|
|
714
|
+
const id = context.sessionManager?.getSessionId?.();
|
|
715
|
+
return id ? { id, file: context.sessionManager?.getSessionFile?.() } : undefined;
|
|
716
|
+
}
|
|
717
|
+
|
|
696
718
|
function appendSpawnLog(team: TeamState, teammate: TeammateState): void {
|
|
697
719
|
appendTeamLog(team, {
|
|
698
720
|
team: team.name,
|
|
@@ -980,6 +1002,7 @@ function persistActiveTeamManifest(team: TeamState): void {
|
|
|
980
1002
|
updatedAt,
|
|
981
1003
|
shutdownAt: undefined,
|
|
982
1004
|
expiresAt: undefined,
|
|
1005
|
+
interrupted: undefined,
|
|
983
1006
|
};
|
|
984
1007
|
writeTeamManifest(team.manifest);
|
|
985
1008
|
}
|
|
@@ -1021,7 +1044,14 @@ async function stopRpcTeammate(teammate: TeammateState): Promise<void> {
|
|
|
1021
1044
|
teammate.process = undefined;
|
|
1022
1045
|
}
|
|
1023
1046
|
|
|
1024
|
-
|
|
1047
|
+
/** The teammates main's own stop interrupts, read before it stops them; undefined when none is running or the team has no saved record to keep them in. */
|
|
1048
|
+
function interruptedTeammates(team: TeamState): TeamManifest["interrupted"] {
|
|
1049
|
+
const running = [...team.members.values()].filter((teammate) => teammate.alive && teammate.sessionId);
|
|
1050
|
+
if (running.length === 0 || !team.lease) return undefined;
|
|
1051
|
+
return { mainSessionId: team.lease.mainSessionId, teammates: running.map((teammate) => teammate.name), working: running.filter((teammate) => teammateSummary(teammate).active).map((teammate) => teammate.name) };
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
async function shutdownTeam(team: TeamState, interrupted?: TeamManifest["interrupted"]): Promise<string[]> {
|
|
1025
1055
|
team.stopping = true;
|
|
1026
1056
|
const errors: string[] = [];
|
|
1027
1057
|
for (const teammate of team.members.values()) {
|
|
@@ -1046,6 +1076,7 @@ async function shutdownTeam(team: TeamState): Promise<string[]> {
|
|
|
1046
1076
|
updatedAt: shutdownAt,
|
|
1047
1077
|
shutdownAt,
|
|
1048
1078
|
expiresAt: new Date(Date.parse(shutdownAt) + dormantManifestRetentionMilliseconds).toISOString(),
|
|
1079
|
+
interrupted,
|
|
1049
1080
|
};
|
|
1050
1081
|
writeTeamManifest(team.manifest);
|
|
1051
1082
|
} catch (error) {
|
|
@@ -1401,9 +1432,31 @@ export default function (pi: ExtensionAPI) {
|
|
|
1401
1432
|
|
|
1402
1433
|
const parentPiCommand = piCommand(process.argv[1], process.execPath, getPackageDir());
|
|
1403
1434
|
const owner = Symbol("pi-simple-team-owner");
|
|
1404
|
-
/** This session's reminders by ID
|
|
1435
|
+
/** This session's reminders by ID, restored from the session's records on every session start. */
|
|
1405
1436
|
const reminders = new Map<string, Reminder>();
|
|
1406
1437
|
let reminderCount = 0;
|
|
1438
|
+
|
|
1439
|
+
function recordReminder(reminder: Reminder): void {
|
|
1440
|
+
const { timer: _timer, ...fields } = reminder;
|
|
1441
|
+
pi.appendEntry<ReminderRecord>(reminderType, { ...fields, armedAt: reminder.armedAt.toISOString(), wakeAt: reminder.wakeAt.toISOString() });
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
/** Arms a pending reminder's timer. One that is already due fires at once and says how late it is. */
|
|
1445
|
+
function armReminder(reminder: Reminder): void {
|
|
1446
|
+
const delayMilliseconds = reminder.wakeAt.getTime() - Date.now();
|
|
1447
|
+
reminder.timer = setTimeout(() => {
|
|
1448
|
+
const now = new Date();
|
|
1449
|
+
const lateness = delayMilliseconds < 0 ? ` It is ${humanDuration(Math.round((now.getTime() - reminder.wakeAt.getTime()) / 1000))} late: it was due at ${humanTime(reminder.wakeAt)}.` : "";
|
|
1450
|
+
reminder.state = "delivered";
|
|
1451
|
+
recordReminder(reminder);
|
|
1452
|
+
pi.sendMessage(
|
|
1453
|
+
{ customType: reminderType, content: `Reminder ${reminder.slug} wake up: it's ${humanTime(now)} now.${lateness}\n\n${reminder.message}`, display: false },
|
|
1454
|
+
{ deliverAs: "followUp", triggerTurn: true },
|
|
1455
|
+
);
|
|
1456
|
+
}, Math.max(0, delayMilliseconds));
|
|
1457
|
+
reminder.timer.unref();
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1407
1460
|
const sessionTeammateRoster = childRuntimeConfig?.participants ?? [];
|
|
1408
1461
|
|
|
1409
1462
|
/** Current-project manifests that team_resume can select: all for main, only its own for a managing teammate. */
|
|
@@ -1436,15 +1489,88 @@ export default function (pi: ExtensionAPI) {
|
|
|
1436
1489
|
},
|
|
1437
1490
|
});
|
|
1438
1491
|
|
|
1439
|
-
pi.on("session_shutdown", async () => {
|
|
1492
|
+
pi.on("session_shutdown", async (event) => {
|
|
1440
1493
|
for (const reminder of reminders.values()) clearTimeout(reminder.timer);
|
|
1441
1494
|
reminders.clear();
|
|
1442
1495
|
const ownedTeams = [...teams.values()].filter((team) => team.owner === owner);
|
|
1443
1496
|
for (const team of ownedTeams) team.stopping = true;
|
|
1444
|
-
for
|
|
1497
|
+
// Main's quit or reload keeps its running teammates for its next start. Switching to another session releases them.
|
|
1498
|
+
const keepsTeams = !childRuntimeConfig && (event.reason === "quit" || event.reason === "reload");
|
|
1499
|
+
for (const team of ownedTeams) await shutdownTeam(team, keepsTeams ? interruptedTeammates(team) : undefined);
|
|
1445
1500
|
closeCallbackServerIfUnused();
|
|
1446
1501
|
});
|
|
1447
1502
|
|
|
1503
|
+
/** Restarts a team's interrupted teammates idle, in their own conversations, without delivering anything. */
|
|
1504
|
+
async function reattachTeam(manifest: TeamManifest, interrupted: NonNullable<TeamManifest["interrupted"]>, inPanes: string[], parentSession: NonNullable<TeamState["parentSession"]>): Promise<Reattachment> {
|
|
1505
|
+
const reattachment: Reattachment = { teamName: manifest.name, teamId: manifest.id, reattached: [], working: [], inPanes };
|
|
1506
|
+
let team: TeamState | undefined;
|
|
1507
|
+
try {
|
|
1508
|
+
await ensureCallbackServer();
|
|
1509
|
+
team = restoreTeamState(owner, pi, parentPiCommand, manifest, claimTeamLease(manifest.id, parentSession.id));
|
|
1510
|
+
team.parentSession = parentSession;
|
|
1511
|
+
teams.set(team.id!, team);
|
|
1512
|
+
const participantNames = [...team.members.keys()];
|
|
1513
|
+
sessionTeammateRoster.push(...participantNames.filter((name) => !sessionTeammateRoster.includes(name)));
|
|
1514
|
+
const emptyRestarts: TeammateState[] = [];
|
|
1515
|
+
for (const name of interrupted.teammates) {
|
|
1516
|
+
const teammate = team.members.get(name)!;
|
|
1517
|
+
const sessionFile = sessionFileForResume(teammate);
|
|
1518
|
+
prepareTeammateStart(teammate, "rpc");
|
|
1519
|
+
await startTeammate(team, teammate, participantNames, undefined, { sessionFile, restartEmpty: sessionFile === undefined });
|
|
1520
|
+
if (!sessionFile) emptyRestarts.push(teammate);
|
|
1521
|
+
team.statuses.set(name, status("idle", interrupted.working.includes(name) ? "Reattached; was working when main stopped" : "Reattached"));
|
|
1522
|
+
}
|
|
1523
|
+
persistActiveTeamManifest(team);
|
|
1524
|
+
// A teammate whose conversation was never saved restarts empty, so it gets its briefing back, staged without a turn.
|
|
1525
|
+
await kickoffTeammates(team, emptyRestarts, true, { emptyRestarts });
|
|
1526
|
+
return { ...reattachment, reattached: interrupted.teammates, working: interrupted.working };
|
|
1527
|
+
} catch (error) {
|
|
1528
|
+
if (team) await shutdownTeam(team);
|
|
1529
|
+
closeCallbackServerIfUnused();
|
|
1530
|
+
return { ...reattachment, error: error instanceof Error ? error.message : String(error) };
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
// A main session that starts again reattaches the teammates its quit, reload or crash cut off. A crash leaves the team active under a dead lease.
|
|
1535
|
+
pi.on("session_start", async (event, context) => {
|
|
1536
|
+
const mainSessionId = context.sessionManager?.getSessionId?.();
|
|
1537
|
+
const projectDirectory = context.sessionManager?.getCwd?.() ?? context.cwd;
|
|
1538
|
+
if (childRuntimeConfig || (event.reason !== "startup" && event.reason !== "reload") || !mainSessionId || !projectDirectory) return;
|
|
1539
|
+
const reattachments: Reattachment[] = [];
|
|
1540
|
+
for (const manifest of listTeamManifests(projectDirectory).manifests) {
|
|
1541
|
+
const lease = manifest.state === "active" ? readTeamLeaseState(manifest.id) : undefined;
|
|
1542
|
+
const crashed = lease?.state === "stale" && lease.mainSessionId === mainSessionId;
|
|
1543
|
+
if (!crashed && manifest.interrupted?.mainSessionId !== mainSessionId) continue;
|
|
1544
|
+
const running = manifest.members.filter((member) => member.live);
|
|
1545
|
+
// A Herdr pane teammate is not main's child, so it can outlive main's crash; a second process on its session would corrupt it.
|
|
1546
|
+
const [inPanes, reattachable] = [running.filter((member) => member.showOnHerdrPane), running.filter((member) => !member.showOnHerdrPane)];
|
|
1547
|
+
const interrupted = crashed
|
|
1548
|
+
? { mainSessionId, teammates: reattachable.map((member) => member.name), working: reattachable.filter((member) => member.active).map((member) => member.name) }
|
|
1549
|
+
: manifest.interrupted;
|
|
1550
|
+
const inPaneNames = crashed ? inPanes.map((member) => member.name) : [];
|
|
1551
|
+
if (interrupted && interrupted.teammates.length > 0) reattachments.push(await reattachTeam(manifest, interrupted, inPaneNames, mainSession(context)!));
|
|
1552
|
+
else if (inPaneNames.length > 0) reattachments.push({ teamName: manifest.name, teamId: manifest.id, reattached: [], working: [], inPanes: inPaneNames });
|
|
1553
|
+
}
|
|
1554
|
+
if (reattachments.length > 0) pi.sendMessage({ customType: reattachedMessageType, content: composeReattachmentMessage(reattachments), display: true }, { deliverAs: "nextTurn" });
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1557
|
+
pi.on("session_start", (_event, context) => {
|
|
1558
|
+
// Pi's RPC session switches emit session_start twice on one instance, so a restore replaces any earlier one.
|
|
1559
|
+
for (const reminder of reminders.values()) clearTimeout(reminder.timer);
|
|
1560
|
+
reminders.clear();
|
|
1561
|
+
const sessionId = context.sessionManager?.getSessionId?.();
|
|
1562
|
+
// A forked session copies its origin's records, which stay that session's reminders.
|
|
1563
|
+
const records = new Map((context.sessionManager?.getEntries?.() ?? [])
|
|
1564
|
+
.flatMap((entry) => entry.type === "custom" && entry.customType === reminderType && (entry.data as ReminderRecord).sessionId === sessionId ? [entry.data as ReminderRecord] : [])
|
|
1565
|
+
.map((record) => [record.id, record]));
|
|
1566
|
+
reminderCount = records.size;
|
|
1567
|
+
for (const record of records.values()) {
|
|
1568
|
+
const reminder: Reminder = { ...record, armedAt: new Date(record.armedAt), wakeAt: new Date(record.wakeAt) };
|
|
1569
|
+
reminders.set(reminder.id, reminder);
|
|
1570
|
+
if (reminder.state === "pending") armReminder(reminder);
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
|
|
1448
1574
|
pi.on("session_start", (_event, context) => {
|
|
1449
1575
|
useModelNames(context.modelRegistry);
|
|
1450
1576
|
const scopedModels = (context as typeof context & { scopedModels?: ReadonlyArray<{ model: ModelReference }> }).scopedModels ?? [];
|
|
@@ -1513,6 +1639,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1513
1639
|
showOnHerdrPanes,
|
|
1514
1640
|
teamPrompt: params.commonPrompt,
|
|
1515
1641
|
mainSessionFile,
|
|
1642
|
+
parentSession: mainSession(context),
|
|
1516
1643
|
members: new Map(),
|
|
1517
1644
|
statuses: new Map([["main", status("available", "Main agent")]]),
|
|
1518
1645
|
created: new Date().toISOString(),
|
|
@@ -1573,7 +1700,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1573
1700
|
delayMinutes: Type.Number({ exclusiveMinimum: 0, maximum: 35_791, description: "Minutes until the reminder" }),
|
|
1574
1701
|
message: Type.String({ minLength: 1, description: "Custom message that wakes you" }),
|
|
1575
1702
|
}, { additionalProperties: false }),
|
|
1576
|
-
async execute(_toolCallId, params) {
|
|
1703
|
+
async execute(_toolCallId, params, _signal, _onUpdate, context) {
|
|
1577
1704
|
const delayMilliseconds = params.delayMinutes * 60_000;
|
|
1578
1705
|
const delaySeconds = Math.round(delayMilliseconds / 1000);
|
|
1579
1706
|
const armedAt = new Date();
|
|
@@ -1581,16 +1708,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
1581
1708
|
const pendingSlugs = new Set([...reminders.values()].filter((reminder) => reminder.state === "pending").map((reminder) => reminder.slug));
|
|
1582
1709
|
let slug = reminderSlug();
|
|
1583
1710
|
while (pendingSlugs.has(slug)) slug = reminderSlug();
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
{ customType: "pi-simple-team-reminder", content: `Reminder ${slug} wake up: it's ${humanTime(new Date())} now.\n\n${params.message}`, display: false },
|
|
1589
|
-
{ deliverAs: "followUp", triggerTurn: true },
|
|
1590
|
-
);
|
|
1591
|
-
}, delayMilliseconds);
|
|
1592
|
-
reminders.set(id, { id, slug, message: params.message, armedAt, wakeAt, timer, state: "pending" });
|
|
1593
|
-
timer.unref();
|
|
1711
|
+
const reminder: Reminder = { sessionId: context.sessionManager.getSessionId(), id: `reminder-${++reminderCount}`, slug, message: params.message, armedAt, wakeAt, state: "pending" };
|
|
1712
|
+
reminders.set(reminder.id, reminder);
|
|
1713
|
+
recordReminder(reminder);
|
|
1714
|
+
armReminder(reminder);
|
|
1594
1715
|
return {
|
|
1595
1716
|
content: [{ type: "text" as const, text: `Armed reminder ${slug}: It's ${humanTime(armedAt)} now. Reminder set in ${delaySeconds} seconds (${humanDuration(delaySeconds)}) for ${humanTime(wakeAt)}.` }],
|
|
1596
1717
|
details: { scheduledAt: wakeAt.toISOString(), message: params.message, slug },
|
|
@@ -1636,6 +1757,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1636
1757
|
if (reminder.state === "pending") {
|
|
1637
1758
|
clearTimeout(reminder.timer);
|
|
1638
1759
|
reminder.state = "cancelled";
|
|
1760
|
+
recordReminder(reminder);
|
|
1639
1761
|
}
|
|
1640
1762
|
return { id: reminder.id, slug: reminder.slug, result: reminder.state, ...(reminder.state === "cancelled" ? { message: reminder.message, wakeAt: humanTime(reminder.wakeAt) } : {}) };
|
|
1641
1763
|
};
|
|
@@ -1749,6 +1871,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1749
1871
|
try {
|
|
1750
1872
|
await ensureCallbackServer();
|
|
1751
1873
|
team = restoreTeamState(owner, pi, parentPiCommand, manifest, lease);
|
|
1874
|
+
team.parentSession = mainSession(context);
|
|
1752
1875
|
teams.set(team.id!, team);
|
|
1753
1876
|
} catch (error) {
|
|
1754
1877
|
releaseTeamLease(lease);
|
|
@@ -1967,6 +2090,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1967
2090
|
const selections = resolveTargets(candidates, params.targets);
|
|
1968
2091
|
const interrupted = interruptedTeammateIds(candidates, selections, params.interrupt);
|
|
1969
2092
|
const statuses: JsonRecord[] = [];
|
|
2093
|
+
const recipients: Array<{ name: string; contextPercent?: number }> = [];
|
|
1970
2094
|
for (const selection of selections) {
|
|
1971
2095
|
if (selection.team === parent) {
|
|
1972
2096
|
const result = await callParent(childRuntimeConfig!, "team_send_message", {
|
|
@@ -1974,13 +2098,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
1974
2098
|
interrupt: selection.teammates.filter((teammate) => interrupted.has(teammate.teammateId)).map((teammate) => teammate.teammateId),
|
|
1975
2099
|
}, signal);
|
|
1976
2100
|
statuses.push(...result.teams as JsonRecord[]);
|
|
2101
|
+
recipients.push(...selection.teammates.map((teammate) => ({ name: teammate.name })));
|
|
1977
2102
|
continue;
|
|
1978
2103
|
}
|
|
1979
2104
|
const team = teams.get(selection.team.teamId)!;
|
|
1980
2105
|
for (const recipient of selection.teammates) enqueueDelivery(team, "main", team.members.get(recipient.name)!, params.message, interrupted.has(recipient.teammateId));
|
|
1981
2106
|
statuses.push({ ...teamIdentity(team), status: formatStatus(team) });
|
|
2107
|
+
recipients.push(...selection.teammates.map((recipient) => agentContext(team.members.get(recipient.name)!)));
|
|
1982
2108
|
}
|
|
1983
|
-
return toolResult({ published: true, teams: statuses, instruction: "Do not wait for replies. Teammates will message you back." });
|
|
2109
|
+
return toolResult({ published: true, teams: statuses, instruction: "Do not wait for replies. Teammates will message you back." }, { agentContext: recipients });
|
|
1984
2110
|
},
|
|
1985
2111
|
}),
|
|
1986
2112
|
);
|
|
@@ -2125,6 +2251,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2125
2251
|
async execute(_toolCallId, params) {
|
|
2126
2252
|
const team = resolveTeam(owner, params.team);
|
|
2127
2253
|
const teammates = [...team.members.values()].map(teammateReference);
|
|
2254
|
+
const stoppedContext = [...team.members.values()].map(agentContext);
|
|
2128
2255
|
const droppedUpdates = [...team.members.values()].flatMap((teammate) => {
|
|
2129
2256
|
const heldUpdate = teammate.processRecord?.heldUpdate;
|
|
2130
2257
|
return heldUpdate ? [{ ...teammateReference(teammate), settings: describeSettings(heldUpdate) }] : [];
|
|
@@ -2135,7 +2262,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2135
2262
|
return toolResult({
|
|
2136
2263
|
...teamIdentity(team), stopped: true, teammates,
|
|
2137
2264
|
...(droppedUpdates.length > 0 ? { droppedUpdates, instruction: "These held settings updates were not applied. Pass them in teammateUpdates when you resume the team." } : {}),
|
|
2138
|
-
});
|
|
2265
|
+
}, { agentContext: stoppedContext });
|
|
2139
2266
|
},
|
|
2140
2267
|
}),
|
|
2141
2268
|
);
|
package/package.json
CHANGED
package/render.ts
CHANGED
|
@@ -33,6 +33,12 @@ export interface TeamStatusView {
|
|
|
33
33
|
updated: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/** An agent a tool involves, with the context use it last reported when the result carries it. */
|
|
37
|
+
export interface AgentContextView {
|
|
38
|
+
name: string;
|
|
39
|
+
contextPercent?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
export interface TeamMessageDetails {
|
|
37
43
|
team: string;
|
|
38
44
|
from: string;
|
|
@@ -316,7 +322,7 @@ export interface TeamListTeamView {
|
|
|
316
322
|
function teamListMemberName(theme: ThemeLike, teamView: TeamListTeamView, member: TeamListMemberView, roster: string[]): string {
|
|
317
323
|
const hued = theme.fg(actorHueToken(member.name, roster), member.name);
|
|
318
324
|
const name = teamView.state === "active" && !member.live ? `${DIM_SGR_OPEN}${hued}${DIM_SGR_CLOSE}` : hued;
|
|
319
|
-
return [name, inlineFact(theme, "manager", member)].filter((part) => part.length > 0).join(" ");
|
|
325
|
+
return [name, inlineFact(theme, "context", member), inlineFact(theme, "manager", member)].filter((part) => part.length > 0).join(" ");
|
|
320
326
|
}
|
|
321
327
|
|
|
322
328
|
function teamListTimestamp(teamView: TeamListTeamView): string {
|
|
@@ -367,8 +373,18 @@ function actorList(theme: ThemeLike, names: string[], roster: string[], separato
|
|
|
367
373
|
return names.map((name) => theme.fg(actorHueToken(name, roster), name)).join(theme.fg("muted", separator));
|
|
368
374
|
}
|
|
369
375
|
|
|
370
|
-
|
|
371
|
-
|
|
376
|
+
/** An agent's name in its roster hue, followed by its context reading in the teammate rows' full form when known. */
|
|
377
|
+
function agentWithContext(theme: ThemeLike, agent: AgentContextView, roster: string[]): string {
|
|
378
|
+
return [theme.fg(actorHueToken(agent.name, roster), agent.name), inlineFact(theme, "context", agent, "full")].filter((part) => part.length > 0).join(" ");
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function agentsWithContext(theme: ThemeLike, agents: AgentContextView[], roster: string[], separator: string): string {
|
|
382
|
+
return agents.map((agent) => agentWithContext(theme, agent, roster)).join(theme.fg("muted", separator));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** The pending call names the targets as given. A result names each recipient with its context use, which comes before the character count. */
|
|
386
|
+
function sendTarget(theme: ThemeLike, to: string[], roster: string[] = [], agentContext?: AgentContextView[]): string {
|
|
387
|
+
const recipients = agentContext ? agentsWithContext(theme, agentContext, roster, ", ") : actorList(theme, to, roster, ", ");
|
|
372
388
|
return `${theme.fg("muted", `${glyphs().arrow} `)}${recipients}`;
|
|
373
389
|
}
|
|
374
390
|
|
|
@@ -381,20 +397,20 @@ function hasInterruption(interrupt: unknown): boolean {
|
|
|
381
397
|
return interrupt === true || (Array.isArray(interrupt) && interrupt.length > 0);
|
|
382
398
|
}
|
|
383
399
|
|
|
384
|
-
function teamSendHeader(theme: ThemeLike, targets: string[], message: string, interrupt: boolean, roster: string[]): string {
|
|
385
|
-
return headerLine(theme, "Team Send", sendTarget(theme, targets, roster), sendStats(theme, message, interrupt));
|
|
400
|
+
function teamSendHeader(theme: ThemeLike, targets: string[], message: string, interrupt: boolean, roster: string[], agentContext?: AgentContextView[]): string {
|
|
401
|
+
return headerLine(theme, "Team Send", sendTarget(theme, targets, roster, agentContext), sendStats(theme, message, interrupt));
|
|
386
402
|
}
|
|
387
403
|
|
|
388
|
-
export function teamSendLines(theme: ThemeLike, options: { targets: string[]; message: string; interrupt: boolean; expanded: boolean }, roster: string[] = []): TeamLine[] {
|
|
389
|
-
const header = teamSendHeader(theme, options.targets, options.message, options.interrupt, roster);
|
|
404
|
+
export function teamSendLines(theme: ThemeLike, options: { targets: string[]; agentContext?: AgentContextView[]; message: string; interrupt: boolean; expanded: boolean }, roster: string[] = []): TeamLine[] {
|
|
405
|
+
const header = teamSendHeader(theme, options.targets, options.message, options.interrupt, roster, options.agentContext);
|
|
390
406
|
const lineLimit = options.expanded ? Number.POSITIVE_INFINITY : SEND_PREVIEW_LINES;
|
|
391
407
|
return [header, ...quotedBody(theme, options.message, { lineLimit, barToken: "muted" })];
|
|
392
408
|
}
|
|
393
409
|
|
|
394
|
-
export function teamShutdownLines(theme: ThemeLike, team: string, teammates:
|
|
410
|
+
export function teamShutdownLines(theme: ThemeLike, team: string, teammates: AgentContextView[], roster: string[] = []): string[] {
|
|
395
411
|
const header = headerLine(theme, "Team Shutdown", theme.fg("accent", team), [theme.fg("muted", `${plural(teammates.length, "teammate")} stopped`)]);
|
|
396
412
|
if (teammates.length === 0) return [header];
|
|
397
|
-
return [header, `${treeConnector(theme, "└")}${
|
|
413
|
+
return [header, `${treeConnector(theme, "└")}${agentsWithContext(theme, teammates, roster, glyphs().dot)}`];
|
|
398
414
|
}
|
|
399
415
|
|
|
400
416
|
function reminderCallBody(theme: ThemeLike, args: Record<string, unknown>): string {
|
|
@@ -829,6 +845,7 @@ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<strin
|
|
|
829
845
|
if (tool === "team_send_message") {
|
|
830
846
|
return teamSendLines(theme, {
|
|
831
847
|
targets: (args.targets ?? []) as string[],
|
|
848
|
+
agentContext: details.agentContext as AgentContextView[] | undefined,
|
|
832
849
|
message: String(args.message ?? ""),
|
|
833
850
|
interrupt: hasInterruption(args.interrupt),
|
|
834
851
|
expanded,
|
|
@@ -850,7 +867,7 @@ function resultLinesFor(tool: TeamToolName, theme: ThemeLike, args: Record<strin
|
|
|
850
867
|
if (details.nextCursor) lines.push(theme.fg("muted", ` Older events: cursor "${details.nextCursor}"`));
|
|
851
868
|
return lines;
|
|
852
869
|
}
|
|
853
|
-
return teamShutdownLines(theme, String(details.teamName), (details.
|
|
870
|
+
return teamShutdownLines(theme, String(details.teamName), (details.agentContext ?? details.teammates) as AgentContextView[], roster);
|
|
854
871
|
}
|
|
855
872
|
|
|
856
873
|
export function renderTeamToolCall(tool: TeamToolName, args: Record<string, unknown>, theme: ThemeLike, context: ToolRenderContextLike, roster: string[] = []) {
|
|
@@ -873,7 +890,7 @@ export function renderTeamToolResult(
|
|
|
873
890
|
const details = (result?.details ?? {}) as Record<string, unknown>;
|
|
874
891
|
if (markdownTheme && tool === "team_send_message") {
|
|
875
892
|
const message = String(args.message ?? "");
|
|
876
|
-
const header = teamSendHeader(theme, (args.targets ?? []) as string[], message, hasInterruption(args.interrupt), roster);
|
|
893
|
+
const header = teamSendHeader(theme, (args.targets ?? []) as string[], message, hasInterruption(args.interrupt), roster, details.agentContext as AgentContextView[] | undefined);
|
|
877
894
|
const bar = ` ${theme.fg("muted", glyphs().codeBar)} `;
|
|
878
895
|
return new QuotedMarkdownView(header, message, bar, markdownTheme, options.expanded, theme);
|
|
879
896
|
}
|
package/resume-message.ts
CHANGED
|
@@ -37,3 +37,33 @@ export function composeSettingsMessage(settings: string, stoppedTeams: ReadonlyA
|
|
|
37
37
|
stoppedTeams.length > 0 && `Your restart stopped the teams you manage: ${stopped}. Their teammates were idle, and their conversations are kept. Resume them with team_resume when you continue.`,
|
|
38
38
|
].filter(Boolean).join("\n\n");
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
/** What main's start did with one of its teams that its last stop interrupted. */
|
|
42
|
+
export interface Reattachment {
|
|
43
|
+
teamName: string;
|
|
44
|
+
teamId: string;
|
|
45
|
+
reattached: string[];
|
|
46
|
+
working: string[];
|
|
47
|
+
inPanes: string[];
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Tell main, in one message, which teammates its start reattached, which of them were working, and which it left alone.
|
|
53
|
+
* @example composeReattachmentMessage([{ teamName: "r", teamId: "m-r", reattached: ["a"], working: [], inPanes: [] }]).endsWith('Team "r" (team ID: m-r): a.') // true
|
|
54
|
+
*/
|
|
55
|
+
export function composeReattachmentMessage(reattachments: readonly Reattachment[]): string {
|
|
56
|
+
const listed = (pick: (reattachment: Reattachment) => string[]) => reattachments.flatMap((reattachment) => pick(reattachment).map((name) => `${name} (team "${reattachment.teamName}")`)).join(", ");
|
|
57
|
+
const reattached = reattachments.filter((reattachment) => reattachment.reattached.length > 0);
|
|
58
|
+
const working = listed((reattachment) => reattachment.working);
|
|
59
|
+
const inPanes = listed((reattachment) => reattachment.inPanes);
|
|
60
|
+
return [
|
|
61
|
+
reattached.length > 0 && [
|
|
62
|
+
"Simple Team reattached the teammates that were running when your session last stopped. They resumed idle, and nothing was sent to them.",
|
|
63
|
+
...reattached.map((reattachment) => `Team "${reattachment.teamName}" (team ID: ${reattachment.teamId}): ${reattachment.reattached.join(", ")}.`),
|
|
64
|
+
].join("\n"),
|
|
65
|
+
working && `These were working when your session stopped: ${working}. Message each one to continue.`,
|
|
66
|
+
inPanes && `Not reattached, because a Herdr pane teammate may still be running in its pane: ${inPanes}. Check its pane before you use team_resume.`,
|
|
67
|
+
...reattachments.filter((reattachment) => reattachment.error).map((reattachment) => `Could not reattach team "${reattachment.teamName}" (team ID: ${reattachment.teamId}): ${reattachment.error} Use team_resume to restart it.`),
|
|
68
|
+
].filter(Boolean).join("\n\n");
|
|
69
|
+
}
|
package/team-registry.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface TeamManifest {
|
|
|
23
23
|
updatedAt: string;
|
|
24
24
|
shutdownAt?: string;
|
|
25
25
|
expiresAt?: string;
|
|
26
|
+
/** The main session that was running this team when its quit or reload stopped it, and the teammates then running and working. That main's next start reattaches them. */
|
|
27
|
+
interrupted?: { mainSessionId: string; teammates: string[]; working: string[] };
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export interface TeamLease {
|
|
@@ -82,6 +84,11 @@ function isManifestMember(value: unknown): value is TeamManifestMember {
|
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
function isInterruption(value: unknown): value is TeamManifest["interrupted"] {
|
|
88
|
+
const names = (list: unknown) => Array.isArray(list) && list.every((name) => typeof name === "string");
|
|
89
|
+
return typeof value === "object" && value !== null && typeof (value as Record<string, unknown>).mainSessionId === "string" && names((value as Record<string, unknown>).teammates) && names((value as Record<string, unknown>).working);
|
|
90
|
+
}
|
|
91
|
+
|
|
85
92
|
function parseManifest(filePath: string): TeamManifest {
|
|
86
93
|
const parsed: unknown = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
87
94
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
@@ -104,7 +111,8 @@ function parseManifest(filePath: string): TeamManifest {
|
|
|
104
111
|
typeof manifest.createdAt !== "string" ||
|
|
105
112
|
typeof manifest.updatedAt !== "string" ||
|
|
106
113
|
(manifest.shutdownAt !== undefined && typeof manifest.shutdownAt !== "string") ||
|
|
107
|
-
(manifest.expiresAt !== undefined && typeof manifest.expiresAt !== "string")
|
|
114
|
+
(manifest.expiresAt !== undefined && typeof manifest.expiresAt !== "string") ||
|
|
115
|
+
(manifest.interrupted !== undefined && !isInterruption(manifest.interrupted))
|
|
108
116
|
) {
|
|
109
117
|
throw new Error(`Invalid team manifest: ${filePath}`);
|
|
110
118
|
}
|
package/teammate-facts.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface FactRow extends TeammateView {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export type FactKey = "name" | "status" | "model" | "context" | "fork" | "manager" | "thinking" | "herdr";
|
|
30
|
-
type Form = "full" | "short" | "bare" | "icon";
|
|
30
|
+
export type Form = "full" | "short" | "bare" | "icon";
|
|
31
31
|
type FormOrHidden = Form | "hidden";
|
|
32
32
|
|
|
33
33
|
interface Paint {
|
|
@@ -151,9 +151,9 @@ function cell(key: FactKey, form: FormOrHidden, row: FactRow, paint: Paint): str
|
|
|
151
151
|
return ladder[shown]!(row, paint);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/** One fact in its icon form, for views that list teammates inline. Empty when the row lacks the fact. */
|
|
155
|
-
export function inlineFact(theme: FactTheme, key: FactKey, row: FactRow): string {
|
|
156
|
-
return cell(key,
|
|
154
|
+
/** One fact, in its icon form unless another is given, for views that list teammates inline. Empty when the row lacks the fact. */
|
|
155
|
+
export function inlineFact(theme: FactTheme, key: FactKey, row: FactRow, form: Form = "icon"): string {
|
|
156
|
+
return cell(key, form, row, { theme, roster: [], nameWidth: 0 });
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/** The cells of every row at one state, padded into aligned columns. Empty columns drop out. */
|