@esso0428/pi-subagents 0.15.16 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/agent-history-list.d.ts.map +1 -1
- package/dist/agent-history-list.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/dist/output-file.js +3 -3
- package/dist/output-file.js.map +1 -1
- package/dist/ui/agent-widget.d.ts +11 -4
- package/dist/ui/agent-widget.d.ts.map +1 -1
- package/dist/ui/agent-widget.js +85 -19
- package/dist/ui/agent-widget.js.map +1 -1
- package/dist/ui/ccstyle/diff/ansi-utils.js +2 -2
- package/dist/ui/ccstyle/diff/ansi-utils.js.map +1 -1
- package/dist/ui/ccstyle/diff/diff-presentation.d.ts.map +1 -1
- package/dist/ui/ccstyle/diff/diff-presentation.js +0 -1
- package/dist/ui/ccstyle/diff/diff-presentation.js.map +1 -1
- package/dist/ui/ccstyle/diff/diff-renderer.d.ts +1 -1
- package/dist/ui/ccstyle/diff/diff-renderer.d.ts.map +1 -1
- package/dist/ui/ccstyle/diff/diff-renderer.js +15 -10
- package/dist/ui/ccstyle/diff/diff-renderer.js.map +1 -1
- package/dist/ui/ccstyle/diff/line-width-safety.d.ts.map +1 -1
- package/dist/ui/ccstyle/diff/line-width-safety.js +1 -2
- package/dist/ui/ccstyle/diff/line-width-safety.js.map +1 -1
- package/dist/ui/ccstyle/diff/shiki-highlight.d.ts +19 -0
- package/dist/ui/ccstyle/diff/shiki-highlight.d.ts.map +1 -0
- package/dist/ui/ccstyle/diff/shiki-highlight.js +85 -0
- package/dist/ui/ccstyle/diff/shiki-highlight.js.map +1 -0
- package/dist/ui/ccstyle/tool-renderer.d.ts +1 -1
- package/dist/ui/ccstyle/tool-renderer.d.ts.map +1 -1
- package/dist/ui/ccstyle/tool-renderer.js +1 -1
- package/dist/ui/ccstyle/tool-renderer.js.map +1 -1
- package/dist/ui/ccstyle/tool-result.d.ts +9 -1
- package/dist/ui/ccstyle/tool-result.d.ts.map +1 -1
- package/dist/ui/ccstyle/tool-result.js +137 -5
- package/dist/ui/ccstyle/tool-result.js.map +1 -1
- package/dist/ui/conversation-blocks.d.ts.map +1 -1
- package/dist/ui/conversation-blocks.js +14 -13
- package/dist/ui/conversation-blocks.js.map +1 -1
- package/dist/ui/conversation-role.d.ts +1 -1
- package/dist/ui/conversation-role.d.ts.map +1 -1
- package/dist/ui/conversation-search.js +4 -4
- package/dist/ui/conversation-search.js.map +1 -1
- package/dist/ui/conversation-timeline.d.ts +17 -1
- package/dist/ui/conversation-timeline.d.ts.map +1 -1
- package/dist/ui/conversation-timeline.js +116 -43
- package/dist/ui/conversation-timeline.js.map +1 -1
- package/dist/ui/conversation-viewer.d.ts +5 -1
- package/dist/ui/conversation-viewer.d.ts.map +1 -1
- package/dist/ui/conversation-viewer.js +67 -26
- package/dist/ui/conversation-viewer.js.map +1 -1
- package/dist/ui/deferred-ui-refresh.d.ts +15 -0
- package/dist/ui/deferred-ui-refresh.d.ts.map +1 -0
- package/dist/ui/deferred-ui-refresh.js +50 -0
- package/dist/ui/deferred-ui-refresh.js.map +1 -0
- package/dist/ui/fleet-list.d.ts +55 -14
- package/dist/ui/fleet-list.d.ts.map +1 -1
- package/dist/ui/fleet-list.js +178 -44
- package/dist/ui/fleet-list.js.map +1 -1
- package/dist/write-execution.d.ts.map +1 -1
- package/dist/write-execution.js +1 -1
- package/dist/write-execution.js.map +1 -1
- package/package.json +6 -5
- package/src/agent-history-list.ts +1 -1
- package/src/index.ts +49 -7
- package/src/output-file.ts +3 -3
- package/src/ui/agent-widget.ts +18 -10
- package/src/ui/ccstyle/diff/ansi-utils.ts +2 -2
- package/src/ui/ccstyle/diff/diff-presentation.ts +0 -1
- package/src/ui/ccstyle/diff/diff-renderer.ts +22 -21
- package/src/ui/ccstyle/diff/line-width-safety.ts +1 -2
- package/src/ui/ccstyle/diff/shiki-highlight.ts +97 -0
- package/src/ui/ccstyle/tool-renderer.ts +3 -3
- package/src/ui/ccstyle/tool-result.ts +175 -7
- package/src/ui/conversation-role.ts +1 -1
- package/src/ui/conversation-search.ts +4 -4
- package/src/ui/conversation-timeline.ts +7 -7
- package/src/ui/conversation-viewer.ts +16 -7
- package/src/ui/deferred-ui-refresh.ts +72 -0
- package/src/ui/fleet-list.ts +185 -50
- package/src/write-execution.ts +2 -2
- package/test/agent-history-list.test.ts +0 -121
- package/test/agent-manager-history.test.ts +0 -88
- package/test/agent-menu-history-navigation.test.ts +0 -86
- package/test/output-file-history.test.ts +0 -50
- package/test/ui/agent-widget.test.ts +0 -161
- package/test/ui/conversation-blocks.test.ts +0 -103
- package/test/ui/conversation-diff.test.ts +0 -91
- package/test/ui/conversation-search.test.ts +0 -55
- package/test/ui/conversation-viewer.test.ts +0 -438
- package/test/ui/fleet-list.test.ts +0 -135
- package/test/write-execution.test.ts +0 -83
- package/tsconfig.json +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.16.0] - 2026-09-15
|
|
11
|
+
|
|
12
|
+
> **⚠️ Breaking: pi 0.80.8 is now the minimum supported host version.** The package peer dependencies require `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, and `@earendil-works/pi-tui` `>=0.80.8`; upgrade pi before installing this release. This floor matches the `ModelRuntime` API used by the runner and avoids installing a release against the pre-0.80.8 session-creation contract.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Conversation tool output now receives bounded syntax highlighting.** Expanded tool cards infer a language only from an explicit file path or fenced-code language, render with pi's synchronous highlighter on the first paint, and enhance eligible output asynchronously with Shiki. The viewer keeps a local cache and falls back safely when Shiki is unavailable or the output is too large.
|
|
16
|
+
- **Project-local durable history mirrors subagent transcripts.** When output transcripts are enabled, each agent's JSONL stream is also written under `.pi-subagents/agent-transcripts/` (with the directory ignored by Git), and the parent session stores a project-relative locator. Terminal agent records can therefore be reopened in the read-only history viewer after their temporary live handles and output files have been cleaned up or after the session is reloaded.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Pi compatibility now starts at `>=0.80.8`.** The runner forwards the parent `ModelRuntime` to child sessions on hosts exposing the new API, preserving extension-registered providers and authentication for isolated agents; the legacy session option remains as a compatibility fallback in the implementation, but older pi versions are outside this release's supported peer range.
|
|
20
|
+
- **Shiki is a runtime dependency.** `@shikijs/cli` is now shipped in `dependencies` because the conversation viewer loads it lazily at runtime for asynchronous tool-output highlighting; pi's highlighter remains the synchronous fallback.
|
|
21
|
+
|
|
22
|
+
## [0.15.17] - 2026-09-14
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- **FleetView preserves the selected row while navigating** by maintaining a bounded viewport over the full roster; `j`/`k`, arrow keys, and normalized wheel input share one directional transition and consume handled wheel events without stealing input from other focused components.
|
|
26
|
+
- **Structural Fleet/widget changes refresh the text-input viewport after a short defer** instead of requiring a manual redraw; refreshes coalesce, respect a maximum wait, cancel on session switch, and dispose before shutdown cleanup.
|
|
27
|
+
|
|
10
28
|
## [0.15.16] - 2026-09-13
|
|
11
29
|
|
|
12
30
|
### Added
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ https://github.com/user-attachments/assets/8685261b-9338-4fea-8dfe-1c590d5df543
|
|
|
15
15
|
- **Claude Code look & feel** — same tool names, calling conventions, and UI patterns (`Agent`, `get_subagent_result`, `steer_subagent`) — feels native
|
|
16
16
|
- **Parallel background agents** — spawn multiple agents that run concurrently with automatic queuing (configurable concurrency limit, default 4) and smart group join (consolidated notifications)
|
|
17
17
|
- **Live widget UI** — persistent above-editor widget with animated spinners, live tool activity, token counts, and colored status icons. Configurable via `/agents → Settings → Widget`: `all` (every agent), `background` (default — hides foreground runs, which already render inline as the `Agent` tool result), or `off`
|
|
18
|
-
- **FleetView** — Claude Code-style navigable list of `main` + every running subagent rendered below the editor (earliest-launched first). Press `↓` (or `←`) at an empty prompt to jump in,
|
|
18
|
+
- **FleetView** — Claude Code-style navigable list of `main` + every running subagent rendered below the editor (earliest-launched first). Press `↓` (or `←`) at an empty prompt to jump in, `↑`/`↓`/wheel to move the selection, `Enter` to open the selected agent's live, auto-updating conversation, `Esc` to return. The selected row stays visible while the bounded list window moves through the full roster. Finished agents linger briefly before dropping out, and a viewer stays open through completion so you can read the final output. Toggle via `/agents → Settings → Fleet view`
|
|
19
19
|
- **Conversation viewer** — select any agent in `/agents` to open a live-scrolling overlay of its full conversation (auto-follows new content, scroll up to pause). Steer a running agent inline by pressing `Enter` to open a composer, typing, then `Enter` to send (`Esc` or an empty submit returns) — the message appears as a user message and redirects the agent after its current tool. Stop a still-running agent by pressing `x` (then `x` again to confirm) — both work for background agents too
|
|
20
20
|
- **Custom agent types** — define agents in `.pi/agents/<name>.md` or `.agents/agents/<name>.md` (project) or globally, with YAML frontmatter: custom system prompts, model selection, thinking levels, tool restrictions
|
|
21
21
|
- **Mid-run steering** — inject messages into running agents to redirect their work without restarting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-history-list.d.ts","sourceRoot":"","sources":["../src/agent-history-list.ts"],"names":[],"mappings":"AAAA,2EAA2E;
|
|
1
|
+
{"version":3,"file":"agent-history-list.d.ts","sourceRoot":"","sources":["../src/agent-history-list.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAI3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAUZ,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,kBAAkB,CAElF;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAG/D;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAIzF;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,CAanD;AAWD,yDAAyD;AACzD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CASjF;AAED,mEAAmE;AACnE,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,EAAE,CAMV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-history-list.js","sourceRoot":"","sources":["../src/agent-history-list.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-history-list.js","sourceRoot":"","sources":["../src/agent-history-list.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAStE,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAqB;IACzE,WAAW;IACX,SAAS;IACT,SAAS;IACT,SAAS;IACT,OAAO;CACR,CAAC,CAAC;AAEH,sEAAsE;AACtE,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC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mBAAmB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAc,KAAK,YAAY,EAA0F,MAAM,iCAAiC,CAAC;AACxK,OAAO,EAAE,SAAS,EAAiE,MAAM,wBAAwB,CAAC;AAmBlH,OAAO,EAcL,KAAK,KAAK,EAEX,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAc,KAAK,YAAY,EAA0F,MAAM,iCAAiC,CAAC;AACxK,OAAO,EAAE,SAAS,EAAiE,MAAM,wBAAwB,CAAC;AAmBlH,OAAO,EAcL,KAAK,KAAK,EAEX,MAAM,sBAAsB,CAAC;AA8C9B,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GACvB,SAAS,CAKX;AAkKD,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QAqtExC"}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,8 @@ import { join } from "node:path";
|
|
|
14
14
|
import { defineTool, getAgentDir, getSettingsListTheme } from "@earendil-works/pi-coding-agent";
|
|
15
15
|
import { Container, Key, matchesKey, SettingsList, Spacer, Text } from "@earendil-works/pi-tui";
|
|
16
16
|
import { Type } from "@sinclair/typebox";
|
|
17
|
+
import { agentHistoryLocator, createAgentHistoryPath, readAgentHistory } from "./agent-history.js";
|
|
18
|
+
import { buildAgentStatusMenuEntries, canOpenActiveAgent, canOpenAgentHistory, formatAgentHistoryOption, splitAgentRecords } from "./agent-history-list.js";
|
|
17
19
|
import { AgentManager } from "./agent-manager.js";
|
|
18
20
|
import { getAgentConversation, getDefaultMaxTurns, getGraceTurns, normalizeMaxTurns, SUBAGENT_TOOL_NAMES, setDefaultMaxTurns, setGraceTurns, steerAgent } from "./agent-runner.js";
|
|
19
21
|
import { applyNicoOverrides, BUILTIN_TOOL_NAMES, getAgentConfig, getAllTypes, getAvailableTypes, isDefaultsDisabled, registerAgents, resolveType, setDefaultsDisabled } from "./agent-types.js";
|
|
@@ -23,14 +25,13 @@ import { isModelInScope, readEnabledModels, resolveEnabledModels } from "./enabl
|
|
|
23
25
|
import { GroupJoinManager } from "./group-join.js";
|
|
24
26
|
import { resolveAgentInvocationConfig, resolveJoinMode } from "./invocation-config.js";
|
|
25
27
|
import { resolveModel } from "./model-resolver.js";
|
|
26
|
-
import { agentHistoryLocator, createAgentHistoryPath, readAgentHistory } from "./agent-history.js";
|
|
27
|
-
import { buildAgentStatusMenuEntries, canOpenActiveAgent, canOpenAgentHistory, formatAgentHistoryOption, splitAgentRecords } from "./agent-history-list.js";
|
|
28
28
|
import { createOutputFilePath, streamToOutputFile, writeInitialEntry } from "./output-file.js";
|
|
29
29
|
import { SubagentScheduler } from "./schedule.js";
|
|
30
30
|
import { resolveStorePath, ScheduleStore } from "./schedule-store.js";
|
|
31
31
|
import { applyAndEmitLoaded, saveAndEmitChanged } from "./settings.js";
|
|
32
32
|
import { getStatusNote } from "./status-note.js";
|
|
33
33
|
import { AgentWidget, buildInvocationTags, describeActivity, fgPreservingNestedStyles, formatDuration, formatMs, formatTokens, formatTurns, getDisplayName, getPromptModeLabel, SPINNER, } from "./ui/agent-widget.js";
|
|
34
|
+
import { createDeferredUiRefresh } from "./ui/deferred-ui-refresh.js";
|
|
34
35
|
import { FleetList } from "./ui/fleet-list.js";
|
|
35
36
|
import { showSchedulesMenu } from "./ui/schedule-menu.js";
|
|
36
37
|
import { addUsage, getLifetimeTotal, getSessionContextPercent } from "./usage.js";
|
|
@@ -322,6 +323,7 @@ export default function (pi) {
|
|
|
322
323
|
fleet.onAgentFinished(record.id);
|
|
323
324
|
scheduleNudge(record.id, () => emitIndividualNudge(record));
|
|
324
325
|
widget.update();
|
|
326
|
+
scheduleUiRefresh();
|
|
325
327
|
}
|
|
326
328
|
// ---- Group join manager ----
|
|
327
329
|
const groupJoin = new GroupJoinManager((records, partial) => {
|
|
@@ -336,6 +338,7 @@ export default function (pi) {
|
|
|
336
338
|
const unconsumed = records.filter(r => !r.resultConsumed);
|
|
337
339
|
if (unconsumed.length === 0) {
|
|
338
340
|
widget.update();
|
|
341
|
+
scheduleUiRefresh();
|
|
339
342
|
return;
|
|
340
343
|
}
|
|
341
344
|
const notifications = unconsumed.map(r => formatTaskNotification(r, 300)).join('\n\n');
|
|
@@ -355,6 +358,7 @@ export default function (pi) {
|
|
|
355
358
|
}, { deliverAs: "followUp", triggerTurn: true });
|
|
356
359
|
});
|
|
357
360
|
widget.update();
|
|
361
|
+
scheduleUiRefresh();
|
|
358
362
|
}, 30_000);
|
|
359
363
|
/** Helper: build event data for lifecycle events from an AgentRecord. */
|
|
360
364
|
function buildEventData(record) {
|
|
@@ -407,12 +411,14 @@ export default function (pi) {
|
|
|
407
411
|
widget.markFinished(record.id);
|
|
408
412
|
fleet.onAgentFinished(record.id);
|
|
409
413
|
widget.update();
|
|
414
|
+
scheduleUiRefresh();
|
|
410
415
|
return;
|
|
411
416
|
}
|
|
412
417
|
// If this agent is pending batch finalization (debounce window still open),
|
|
413
418
|
// don't send an individual nudge — finalizeBatch will pick it up retroactively.
|
|
414
419
|
if (currentBatchAgents.some(a => a.id === record.id)) {
|
|
415
420
|
widget.update();
|
|
421
|
+
scheduleUiRefresh();
|
|
416
422
|
return;
|
|
417
423
|
}
|
|
418
424
|
const result = groupJoin.onAgentComplete(record);
|
|
@@ -422,6 +428,7 @@ export default function (pi) {
|
|
|
422
428
|
// 'held' → do nothing, group will fire later
|
|
423
429
|
// 'delivered' → group callback already fired
|
|
424
430
|
widget.update();
|
|
431
|
+
scheduleUiRefresh();
|
|
425
432
|
}, undefined, (record) => {
|
|
426
433
|
// Emit started event when agent transitions to running (including from queue)
|
|
427
434
|
pi.events.emit("subagents:started", {
|
|
@@ -429,6 +436,11 @@ export default function (pi) {
|
|
|
429
436
|
type: record.type,
|
|
430
437
|
description: record.description,
|
|
431
438
|
});
|
|
439
|
+
widget.ensureTimer();
|
|
440
|
+
widget.update();
|
|
441
|
+
fleet.ensureTimer();
|
|
442
|
+
fleet.update();
|
|
443
|
+
scheduleUiRefresh();
|
|
432
444
|
}, (record, info) => {
|
|
433
445
|
// Emit compacted event when agent's session compacts (preserves count on record).
|
|
434
446
|
pi.events.emit("subagents:compacted", {
|
|
@@ -519,6 +531,7 @@ export default function (pi) {
|
|
|
519
531
|
startScheduler(ctx);
|
|
520
532
|
});
|
|
521
533
|
pi.on("session_before_switch", () => {
|
|
534
|
+
deferredUiRefresh.cancel();
|
|
522
535
|
manager.clearCompleted(true);
|
|
523
536
|
scheduler.stop();
|
|
524
537
|
});
|
|
@@ -540,6 +553,7 @@ export default function (pi) {
|
|
|
540
553
|
for (const timer of pendingNudges.values())
|
|
541
554
|
clearTimeout(timer);
|
|
542
555
|
pendingNudges.clear();
|
|
556
|
+
deferredUiRefresh.dispose();
|
|
543
557
|
fleet.dispose();
|
|
544
558
|
manager.dispose();
|
|
545
559
|
});
|
|
@@ -551,12 +565,34 @@ export default function (pi) {
|
|
|
551
565
|
let widgetMode = "background";
|
|
552
566
|
function getWidgetMode() { return widgetMode; }
|
|
553
567
|
const widget = new AgentWidget(manager, agentActivity, getWidgetMode);
|
|
554
|
-
function setWidgetMode(m) {
|
|
568
|
+
function setWidgetMode(m) {
|
|
569
|
+
const changed = widgetMode !== m;
|
|
570
|
+
widgetMode = m;
|
|
571
|
+
widget.update();
|
|
572
|
+
if (changed)
|
|
573
|
+
scheduleUiRefresh();
|
|
574
|
+
}
|
|
555
575
|
// Claude Code-style FleetView: navigable list of main + subagents below the editor.
|
|
556
576
|
const fleet = new FleetList(manager, agentActivity, () => currentCtx?.cwd, pi, () => currentCtx);
|
|
577
|
+
// One render-only scheduler is shared by both widgets. The callback resolves
|
|
578
|
+
// the live TUI target at fire time because session switches invalidate the
|
|
579
|
+
// previous widget context; both widgets use the same TUI, so one successful
|
|
580
|
+
// request is sufficient.
|
|
581
|
+
const deferredUiRefresh = createDeferredUiRefresh(() => {
|
|
582
|
+
if (widget.requestUiRefresh(true))
|
|
583
|
+
return;
|
|
584
|
+
fleet.requestUiRefresh(true);
|
|
585
|
+
});
|
|
586
|
+
const scheduleUiRefresh = () => deferredUiRefresh.schedule();
|
|
557
587
|
let fleetViewEnabled = true;
|
|
558
588
|
function isFleetViewEnabled() { return fleetViewEnabled; }
|
|
559
|
-
function setFleetViewEnabled(b) {
|
|
589
|
+
function setFleetViewEnabled(b) {
|
|
590
|
+
const changed = fleetViewEnabled !== b;
|
|
591
|
+
fleetViewEnabled = b;
|
|
592
|
+
fleet.setEnabled(b);
|
|
593
|
+
if (changed)
|
|
594
|
+
scheduleUiRefresh();
|
|
595
|
+
}
|
|
560
596
|
// Project/global default for writing the subagent .output transcript. A custom
|
|
561
597
|
// agent's `output_transcript` frontmatter overrides this per spawn; when the
|
|
562
598
|
// frontmatter is silent, this default applies. Read live at spawn time.
|
|
@@ -648,8 +684,10 @@ export default function (pi) {
|
|
|
648
684
|
}
|
|
649
685
|
// Grab UI context from first tool execution + clear lingering widget on new turn
|
|
650
686
|
pi.on("tool_execution_start", async (_event, ctx) => {
|
|
651
|
-
widget.setUICtx(ctx.ui);
|
|
652
|
-
fleet.setUICtx(ctx.ui);
|
|
687
|
+
const widgetContextChanged = widget.setUICtx(ctx.ui);
|
|
688
|
+
const fleetContextChanged = fleet.setUICtx(ctx.ui);
|
|
689
|
+
if (widgetContextChanged || fleetContextChanged)
|
|
690
|
+
scheduleUiRefresh();
|
|
653
691
|
widget.onTurnStart();
|
|
654
692
|
});
|
|
655
693
|
/** Format an agent's tool scope: "*" when it has all built-ins, else a comma-separated list. */
|
|
@@ -1181,6 +1219,7 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
1181
1219
|
widget.update();
|
|
1182
1220
|
fleet.ensureTimer();
|
|
1183
1221
|
fleet.update();
|
|
1222
|
+
scheduleUiRefresh();
|
|
1184
1223
|
// Emit created event
|
|
1185
1224
|
pi.events.emit("subagents:created", {
|
|
1186
1225
|
id,
|
|
@@ -1232,8 +1271,10 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
1232
1271
|
fgId = a.id;
|
|
1233
1272
|
agentActivity.set(a.id, fgState);
|
|
1234
1273
|
widget.ensureTimer();
|
|
1274
|
+
widget.update();
|
|
1235
1275
|
fleet.ensureTimer();
|
|
1236
1276
|
fleet.update();
|
|
1277
|
+
scheduleUiRefresh();
|
|
1237
1278
|
break;
|
|
1238
1279
|
}
|
|
1239
1280
|
}
|