pi-extended-teams 2.2.4 → 2.2.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.
- package/README.md +2 -0
- package/extensions/index.ts +15 -8
- package/extensions/ui/agent-follow-view.ts +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,6 +55,8 @@ This works well for multi-angle code review, root-cause investigation, parallel
|
|
|
55
55
|
|
|
56
56
|
With the editor empty, press Down to open agent navigation. Use Down/Up to move, `l` to expand large tool logs, `m` to message an agent, `i` to interrupt its currently running tool command, `x` to stop the whole agent, and Escape to return.
|
|
57
57
|
|
|
58
|
+
Scroll the transcript with Page Up/Page Down or the mouse wheel, including under Herdr. Press End or scroll back to the bottom to follow new output.
|
|
59
|
+
|
|
58
60
|
The lead can invoke the same command-only behavior with `interrupt_teammate({ agent_name: "agent" })`. It keeps the agent's session, task context, and file claims intact so you can send follow-up work. In-process cancellation is cooperative and may report that it is still pending; for tmux-backed agents, success means Pi's Escape key was delivered, not that command settlement was independently confirmed.
|
|
59
61
|
|
|
60
62
|
[](https://raw.githubusercontent.com/dantetekanem/pi-extended-teams/main/assets/pi-extended-teams-agent-navigation.png)
|
package/extensions/index.ts
CHANGED
|
@@ -64,9 +64,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
64
64
|
if (clearedTeamName === teamName) void drainReadHelperQueueOnce();
|
|
65
65
|
});
|
|
66
66
|
const runningReadAgents = new Map<string, RunningReadAgent>();
|
|
67
|
-
//
|
|
68
|
-
// maintains a lifecycle-fenced view of their
|
|
69
|
-
|
|
67
|
+
// Runtime-only members have no nested AgentSession in this process, but
|
|
68
|
+
// status rendering already maintains a lifecycle-fenced view of their
|
|
69
|
+
// active roster/runtime state that live navigation must share.
|
|
70
|
+
const navigationRuntimeAgents = new Map<string, RunningReadAgent>();
|
|
70
71
|
const completedAgentReports = new Map<string, CompletedAgentReport[]>();
|
|
71
72
|
const TEAM_ACTIVITY_RENDER_DEBOUNCE_MS = 75;
|
|
72
73
|
let readAgentStatusTimer: NodeJS.Timeout | null = null;
|
|
@@ -245,12 +246,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
245
246
|
&& runtimeHeartbeatIsRecent(runtimeStatus, now);
|
|
246
247
|
}
|
|
247
248
|
|
|
248
|
-
function
|
|
249
|
+
function navigationRuntimeAgent(teamName: string, member: Member, status: runtime.AgentRuntimeStatus): RunningReadAgent {
|
|
249
250
|
return {
|
|
250
251
|
runId: member.lifecycleRunId!, name: member.name, teamName,
|
|
251
252
|
startedAt: status.startedAt || member.joinedAt, tokensUsed: 0, contextUsage: status.contextUsage,
|
|
252
253
|
status: status.currentAction === "thinking" ? "thinking" : status.currentAction === "starting" ? "starting" : "working",
|
|
253
|
-
recentEvents: [], lastActivityAt: status.lastHeartbeatAt || member.joinedAt, role:
|
|
254
|
+
recentEvents: [], lastActivityAt: status.lastHeartbeatAt || member.joinedAt, role: memberActivityRole(member),
|
|
254
255
|
model: member.model, thinking: member.thinking, modelSlot: canonicalPersistedModelSlot(member.modelSlot),
|
|
255
256
|
latestProgress: status.latestProgress,
|
|
256
257
|
};
|
|
@@ -587,6 +588,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
587
588
|
runtimeStatus: await runtime.readRuntimeStatus(activityTeamName, member.name).catch(() => null),
|
|
588
589
|
}))))
|
|
589
590
|
.filter((entry): entry is { member: Member; runtimeStatus: runtime.AgentRuntimeStatus } => isVisibleRuntimeOnlyMember(entry.member, entry.runtimeStatus, now))
|
|
591
|
+
.filter(({ member, runtimeStatus }) => member.lifecycleRunId === runtimeStatus.lifecycleRunId)
|
|
590
592
|
: [];
|
|
591
593
|
const runtimeOnlyMemberNames = new Set(runtimeOnlyMembers.map(({ member }) => member.name));
|
|
592
594
|
const runtimeOnlyReadMembers = runtimeOnlyMembers.filter(({ member }) => memberActivityRole(member) === "read");
|
|
@@ -616,10 +618,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
616
618
|
.filter(member => member.name !== "team-lead" && member.isActive !== false && memberActivityRole(member) === "write")
|
|
617
619
|
.filter(member => !!(member.tmuxPaneId && terminal?.isAlive?.(member.tmuxPaneId)) && !runningReadAgents.has(readAgentKey(activityTeamName, member.name)) && !runtimeOnlyMemberNames.has(member.name)) ?? []
|
|
618
620
|
: [];
|
|
619
|
-
|
|
621
|
+
navigationRuntimeAgents.clear();
|
|
622
|
+
for (const { member, runtimeStatus } of runtimeOnlyReadMembers) {
|
|
623
|
+
if (member.lifecycleRunId === runtimeStatus.lifecycleRunId) {
|
|
624
|
+
navigationRuntimeAgents.set(member.name, navigationRuntimeAgent(activityTeamName!, member, runtimeStatus));
|
|
625
|
+
}
|
|
626
|
+
}
|
|
620
627
|
for (const { member, runtimeStatus } of runtimeOnlyWriteMembers) {
|
|
621
628
|
if (member.tmuxPaneId && member.lifecycleRunId === runtimeStatus.lifecycleRunId) {
|
|
622
|
-
|
|
629
|
+
navigationRuntimeAgents.set(member.name, navigationRuntimeAgent(activityTeamName!, member, runtimeStatus));
|
|
623
630
|
}
|
|
624
631
|
}
|
|
625
632
|
const unreadLeadMessages = activityTeamName ? await messaging.readInbox(activityTeamName, agentName, true, false).catch(() => []) : [];
|
|
@@ -1119,7 +1126,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1119
1126
|
getAgents: () => {
|
|
1120
1127
|
const readers = Array.from(runningReadAgents.values())
|
|
1121
1128
|
.filter(agent => !teamName || agent.teamName === teamName);
|
|
1122
|
-
return [...readers, ...Array.from(
|
|
1129
|
+
return [...readers, ...Array.from(navigationRuntimeAgents.values())
|
|
1123
1130
|
.filter(agent => !teamName || agent.teamName === teamName)]
|
|
1124
1131
|
.filter((agent, index, agents) => agents.findIndex(candidate => candidate.name === agent.name) === index);
|
|
1125
1132
|
},
|
|
@@ -466,6 +466,13 @@ export function createAgentFollowComponent(
|
|
|
466
466
|
|
|
467
467
|
const sortedAgents = () => options.getAgents().slice().sort((a, b) => a.name.localeCompare(b.name));
|
|
468
468
|
|
|
469
|
+
const scrollTranscript = (delta: number) => {
|
|
470
|
+
if (!Number.isFinite(delta)) return;
|
|
471
|
+
const maxOffset = Math.max(0, lastTranscriptRows - lastBodyHeight);
|
|
472
|
+
offsetFromBottom = Math.max(0, Math.min(maxOffset, offsetFromBottom - Math.trunc(delta)));
|
|
473
|
+
tui.requestRender();
|
|
474
|
+
};
|
|
475
|
+
|
|
469
476
|
const selectRelative = (delta: number) => {
|
|
470
477
|
const agents = sortedAgents();
|
|
471
478
|
if (agents.length === 0) return;
|
|
@@ -713,7 +720,22 @@ export function createAgentFollowComponent(
|
|
|
713
720
|
clearInterval(refreshTimer);
|
|
714
721
|
if (forwardHerdrPageKeys) tui.terminal.write("\x1b[?1000l");
|
|
715
722
|
},
|
|
723
|
+
handleMouse(event: { type: string; wheelDelta?: number }) {
|
|
724
|
+
if (event.type !== "wheel") return;
|
|
725
|
+
scrollTranscript(event.wheelDelta ?? 0);
|
|
726
|
+
return { handled: true };
|
|
727
|
+
},
|
|
716
728
|
handleInput(data: string) {
|
|
729
|
+
const sgrMouse = /^\x1b\[<(\d+);\d+;\d+([Mm])$/.exec(data);
|
|
730
|
+
const mouseButton = sgrMouse ? Number(sgrMouse[1])
|
|
731
|
+
: data.length === 6 && data.startsWith("\x1b[M") ? data.charCodeAt(3) - 32 : undefined;
|
|
732
|
+
if (mouseButton !== undefined) {
|
|
733
|
+
if (sgrMouse?.[2] !== "m" && mouseButton >= 64 && mouseButton <= 93) {
|
|
734
|
+
const wheelButton = mouseButton & ~28;
|
|
735
|
+
if (wheelButton === 64 || wheelButton === 65) scrollTranscript(wheelButton === 64 ? -3 : 3);
|
|
736
|
+
}
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
717
739
|
if (composingMessage) {
|
|
718
740
|
if (matchesKey(data, Key.ctrl("c"))) {
|
|
719
741
|
done();
|