@bastani/atomic 0.9.52 → 0.9.53-alpha.1

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 (32) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/package.json +1 -1
  5. package/dist/builtin/subagents/src/extension/index.bundle.mjs +13 -0
  6. package/dist/builtin/web-access/package.json +1 -1
  7. package/dist/builtin/workflows/package.json +1 -1
  8. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  9. package/dist/core/agent-session-extension-bindings.js +5 -0
  10. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  11. package/dist/core/agent-session-types.d.ts +6 -0
  12. package/dist/core/agent-session-types.d.ts.map +1 -1
  13. package/dist/core/agent-session-types.js.map +1 -1
  14. package/dist/core/extensions/runner.d.ts +6 -0
  15. package/dist/core/extensions/runner.d.ts.map +1 -1
  16. package/dist/core/extensions/runner.js +9 -0
  17. package/dist/core/extensions/runner.js.map +1 -1
  18. package/dist/core/tasks/supervisor.d.ts +8 -0
  19. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  20. package/dist/core/tasks/supervisor.js +49 -0
  21. package/dist/core/tasks/supervisor.js.map +1 -1
  22. package/dist/modes/interactive/components/footer.d.ts +5 -0
  23. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  24. package/dist/modes/interactive/components/footer.js +13 -4
  25. package/dist/modes/interactive/components/footer.js.map +1 -1
  26. package/dist/modes/interactive/components/task-inspector.d.ts +7 -0
  27. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  28. package/dist/modes/interactive/components/task-inspector.js +36 -4
  29. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  30. package/docs/background-tasks.md +2 -0
  31. package/npm-shrinkwrap.json +36 -36
  32. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"footer.d.ts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O,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;CACD;AAED;;;GAGG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAChD,QAAgB,OAAO,CAAe;IACtC,QAAgB,UAAU,CAA6B;IACvD,iBAAyB,WAAW,CAAoB;IACxD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAgB;IACjD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,QAAQ,CAAS;IAEzB,YACC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,0BAA0B,EACtC,WAAW,GAAE,iBAA4C,EACzD,gBAAgB,GAAE,MAAM,OAAqB,EAM7C;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAOtC;IAED,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE7C;IAED;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED,sFAAsF;IACtF,OAAO,IAAI,IAAI,CAId;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAuC9B;CACD"}
@@ -21,6 +21,16 @@ function sanitizeStatusText(text) {
21
21
  .replace(/ +/g, " ")
22
22
  .trim();
23
23
  }
24
+ /**
25
+ * The extension status row under the footer: statuses sorted by key, joined by a dim bullet and
26
+ * truncated to the width. Shared by the chat footer and a task page's footer.
27
+ */
28
+ export function renderExtensionStatusRow(statuses, width, style = defaultFooterRenderStyle) {
29
+ if (statuses.size === 0)
30
+ return undefined;
31
+ const sorted = [...statuses].sort(([a], [b]) => a.localeCompare(b));
32
+ return truncateToWidth(sorted.map(([, text]) => sanitizeStatusText(text)).join(` ${style.dim("•")} `), width, style.dim("..."));
33
+ }
24
34
  /**
25
35
  * Format token counts (similar to web-ui)
26
36
  */
@@ -254,10 +264,9 @@ export class FooterComponent {
254
264
  if (areExperimentalFeaturesEnabled())
255
265
  statusText += ` ${this.renderStyle.warning("xp")}`;
256
266
  const lines = [truncateToWidth(statusText, width, this.renderStyle.dim("..."))];
257
- const statuses = [...this.footerData.getExtensionStatuses()].sort(([a], [b]) => a.localeCompare(b));
258
- if (statuses.length > 0) {
259
- lines.push(truncateToWidth(statuses.map(([, text]) => sanitizeStatusText(text)).join(` ${this.renderStyle.dim("•")} `), width, this.renderStyle.dim("...")));
260
- }
267
+ const statusRow = renderExtensionStatusRow(this.footerData.getExtensionStatuses(), width, this.renderStyle);
268
+ if (statusRow !== undefined)
269
+ lines.push(statusRow);
261
270
  lines.push(...renderTaskFooter(getOwnerTaskStore(this.session)?.backgroundTasks ?? [], width));
262
271
  return lines;
263
272
  }
@@ -1 +1 @@
1
- {"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAoB,MAAM,+BAA+B,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQlD,MAAM,wBAAwB,GAAsB;IACnD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,I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GAAG,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CACT,eAAe,CACd,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAC3F,KAAK,EACL,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAC3B,CACD,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QAC/F,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport type { Usage } from \"@bastani/pi-ai/compat\";\nimport { type Component, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.js\";\nimport type { SessionStats } from \"../../../core/agent-session-types.js\";\nimport { areExperimentalFeaturesEnabled } from \"../../../core/experimental.ts\";\nimport type { ContextUsage } from \"../../../core/extensions/types.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { getOwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { addUsageToTotals, createUsageTotals, type UsageTotals } from \"../../../core/usage-totals.ts\";\nimport { getEngineSessionStats } from \"../../interactive-engine/engine-session-stats.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { renderTaskFooter } from \"./task-list.js\";\n\nexport interface FooterRenderStyle {\n\tdim(text: string): string;\n\tmuted(text: string): string;\n\twarning(text: string): string;\n}\n\nconst defaultFooterRenderStyle: FooterRenderStyle = {\n\tdim: (text) => theme.fg(\"dim\", text),\n\tmuted: (text) => theme.fg(\"muted\", text),\n\twarning: (text) => theme.fg(\"warning\", text),\n};\n\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse\n\t// multiple spaces (pi parity). ANSI/SGR sequences must survive intact:\n\t// extension statuses are frequently theme-colored, and stripping only the\n\t// ESC byte would leave the rest of the sequence as visible literal text.\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/**\n * Format token counts (similar to web-ui)\n */\nfunction formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\nfunction replaceHome(input: string): string {\n\treturn formatCwdForFooter(input, process.env.HOME || process.env.USERPROFILE);\n}\n\nfunction rightAlign(line: string, width: number): string {\n\tconst lineWidth = visibleWidth(line);\n\tif (lineWidth >= width) {\n\t\treturn truncateToWidth(line, width, theme.fg(\"dim\", \"...\"));\n\t}\n\treturn `${\" \".repeat(width - lineWidth)}${line}`;\n}\n\ntype UsageSummary = { totals: UsageTotals; latestCacheHitRate: number | undefined };\n\ninterface MirrorStats extends UsageSummary {\n\tsessionId: string;\n\tleafId: string | null;\n\tentryCount: number;\n\tlimitsModel: AgentSession[\"model\"];\n\tcontextUsage: ContextUsage | undefined;\n}\n\nconst mirrorStats = new WeakMap<AgentSession, MirrorStats>();\n\nfunction getCacheHitRate(usage: Usage): number | undefined {\n\tconst promptTokens = usage.input + usage.cacheRead + usage.cacheWrite;\n\treturn promptTokens > 0 ? (usage.cacheRead / promptTokens) * 100 : undefined;\n}\n\nfunction summarizeEngineUsage(stats: SessionStats): UsageSummary {\n\tconst { input, output, cacheRead, cacheWrite } = stats.tokens;\n\treturn {\n\t\ttotals: { input, output, cacheRead, cacheWrite, cost: stats.cost },\n\t\tlatestCacheHitRate: stats.latestAssistantUsage ? getCacheHitRate(stats.latestAssistantUsage) : undefined,\n\t};\n}\n\nfunction summarizeEntryUsage(session: AgentSession): UsageSummary {\n\t// Calculate cumulative usage from ALL session entries (not just post-compaction messages)\n\tconst totals = createUsageTotals();\n\tlet latestCacheHitRate: number | undefined;\n\n\tfor (const entry of session.sessionManager.getEntries()) {\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\taddUsageToTotals(totals, entry.message.usage);\n\t\t\tlatestCacheHitRate = getCacheHitRate(entry.message.usage);\n\t\t} else if (\n\t\t\t(entry.type === \"branch_summary\" || entry.type === \"session_summary\" || entry.type === \"compaction\") &&\n\t\t\tentry.usage\n\t\t) {\n\t\t\taddUsageToTotals(totals, entry.usage);\n\t\t} else if (\n\t\t\tentry.type === \"message\" &&\n\t\t\tentry.message.role === \"toolResult\" &&\n\t\t\t\"usage\" in entry.message &&\n\t\t\tentry.message.usage\n\t\t) {\n\t\t\taddUsageToTotals(totals, entry.message.usage);\n\t\t}\n\t}\n\treturn { totals, latestCacheHitRate };\n}\n\nfunction getMirrorStats(session: AgentSession): MirrorStats {\n\tconst manager = session.sessionManager;\n\tconst sessionId = manager.getSessionId();\n\tconst leafId = manager.getLeafId();\n\tconst entryCount = manager.getEntryCount();\n\tconst limitsModel = session.model;\n\tconst cached = mirrorStats.get(session);\n\tif (\n\t\tcached &&\n\t\tcached.sessionId === sessionId &&\n\t\tcached.leafId === leafId &&\n\t\tcached.entryCount === entryCount &&\n\t\tcached.limitsModel === limitsModel\n\t)\n\t\treturn cached;\n\n\tconst { totals, latestCacheHitRate } = summarizeEntryUsage(session);\n\tconst contextUsage = session.getContextUsage();\n\tconst stats = { sessionId, leafId, entryCount, limitsModel, totals, latestCacheHitRate, contextUsage };\n\tmirrorStats.set(session, stats);\n\treturn stats;\n}\n\nfunction getUsageLine(session: AgentSession, autoCompactEnabled: boolean, width: number): string {\n\tconst state = session.state;\n\t// An isolated engine owns the live session; its stats replace the host's mirror entries.\n\tconst engineStats = getEngineSessionStats(session);\n\tconst { totals, latestCacheHitRate, contextUsage } = engineStats\n\t\t? { ...summarizeEngineUsage(engineStats), contextUsage: engineStats.contextUsage }\n\t\t: getMirrorStats(session);\n\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\n\tconst usageParts = [];\n\tif (totals.input) usageParts.push(`${theme.fg(\"dim\", \"↑\")}${theme.fg(\"muted\", formatTokens(totals.input))}`);\n\tif (totals.output) usageParts.push(`${theme.fg(\"dim\", \"↓\")}${theme.fg(\"muted\", formatTokens(totals.output))}`);\n\tif (totals.cacheRead) usageParts.push(`${theme.fg(\"dim\", \"R\")}${theme.fg(\"muted\", formatTokens(totals.cacheRead))}`);\n\tif (totals.cacheWrite)\n\t\tusageParts.push(`${theme.fg(\"dim\", \"W\")}${theme.fg(\"muted\", formatTokens(totals.cacheWrite))}`);\n\tif ((totals.cacheRead > 0 || totals.cacheWrite > 0) && latestCacheHitRate !== undefined) {\n\t\tusageParts.push(`${theme.fg(\"dim\", \"CH\")}${theme.fg(\"muted\", `${latestCacheHitRate.toFixed(1)}%`)}`);\n\t}\n\n\t// Kimi Coding is subscription-backed despite using API-key authentication.\n\tconst usingSubscription = state.model\n\t\t? state.model.provider === \"kimi-coding\" || session.modelRuntime.isUsingOAuth(state.model.provider)\n\t\t: false;\n\tif (totals.cost || usingSubscription) {\n\t\tusageParts.push(\n\t\t\t`${theme.fg(\"muted\", `$${totals.cost.toFixed(3)}`)}${usingSubscription ? ` ${theme.fg(\"dim\", \"(sub)\")}` : \"\"}`,\n\t\t);\n\t}\n\n\tconst autoIndicator = autoCompactEnabled ? \" (auto)\" : \"\";\n\tconst contextPercentDisplay =\n\t\tcontextPercent === \"?\"\n\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t: `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;\n\tif (autoCompactEnabled && contextPercentValue > 70) {\n\t\tusageParts.push(theme.fg(\"warning\", contextPercentDisplay));\n\t} else if (contextPercentValue > 90) {\n\t\tusageParts.push(theme.fg(\"error\", contextPercentDisplay));\n\t} else if (contextPercentValue > 70) {\n\t\tusageParts.push(theme.fg(\"warning\", contextPercentDisplay));\n\t} else {\n\t\tusageParts.push(theme.fg(\"muted\", contextPercentDisplay));\n\t}\n\n\tconst separator = theme.fg(\"dim\", \" • \");\n\tconst usageText = usageParts.length > 0 ? usageParts.join(separator) : theme.fg(\"muted\", contextPercentDisplay);\n\treturn rightAlign(usageText, width);\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\n}\n\n/**\n * Right-aligned usage meter that sits above the composer, matching the approved\n * prototype's separate token/cost/context ribbon.\n */\nexport class UsageMeterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\n\tprivate declare session: AgentSession;\n\n\tconstructor(session: AgentSession) {\n\t\tthis.session = session;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\tinvalidate(): void {\n\t\t// Render pulls live session data.\n\t}\n\n\trender(width: number): string[] {\n\t\treturn [getUsageLine(this.session, this.autoCompactEnabled, width)];\n\t}\n}\n\n/**\n * Sparse statusline below the composer. It mirrors the preview: model + cwd\n * when idle, or one semantic dot with short recovery copy while work is live.\n */\nexport class FooterComponent implements Component {\n\tprivate declare session: AgentSession;\n\tprivate declare footerData: ReadonlyFooterDataProvider;\n\tprivate declare readonly renderStyle: FooterRenderStyle;\n\tprivate readonly navigationActive: () => boolean;\n\tprivate branchCwd: string | undefined;\n\tprivate releaseBranch: (() => void) | undefined;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tsession: AgentSession,\n\t\tfooterData: ReadonlyFooterDataProvider,\n\t\trenderStyle: FooterRenderStyle = defaultFooterRenderStyle,\n\t\tnavigationActive: () => boolean = () => false,\n\t) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\n\t\tthis.renderStyle = renderStyle;\n\t\tthis.navigationActive = navigationActive;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tif (this.session !== session) {\n\t\t\tthis.releaseBranch?.();\n\t\t\tthis.releaseBranch = undefined;\n\t\t\tthis.branchCwd = undefined;\n\t\t}\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(_enabled: boolean): void {\n\t\t// Usage state lives in UsageMeterComponent. Kept for compatibility with existing call sites.\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/** Release this viewer's branch subscription without disposing shared footer data. */\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.releaseBranch?.();\n\t\tthis.releaseBranch = undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.disposed) return [];\n\t\tconst state = this.session.state;\n\t\tconst cwd = this.session.sessionManager.getCwd();\n\t\tif (this.branchCwd !== cwd) {\n\t\t\tthis.releaseBranch?.();\n\t\t\t// Repaints are requested by the host's existing shared branch subscription.\n\t\t\tthis.releaseBranch = this.footerData.onBranchChange(() => {}, cwd);\n\t\t\tthis.branchCwd = cwd;\n\t\t}\n\t\tlet pwd = replaceHome(cwd);\n\t\tconst branch = this.footerData.getGitBranch(cwd);\n\t\tif (branch) pwd += ` (${branch})`;\n\t\tconst sessionName =\n\t\t\ttypeof this.session.sessionManager.getSessionName === \"function\"\n\t\t\t\t? this.session.sessionManager.getSessionName()\n\t\t\t\t: undefined;\n\t\tif (sessionName) pwd += ` • ${sessionName}`;\n\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tlet modelLabel = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\tmodelLabel = thinkingLevel === \"off\" ? modelLabel : `${modelLabel} ${thinkingLevel}`;\n\t\t}\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\tmodelLabel = `(${state.model.provider}) ${modelLabel}`;\n\t\t}\n\n\t\tconst liveState =\n\t\t\tthis.session.isStreaming && !this.navigationActive() ? this.renderStyle.muted(\"esc to interrupt\") : undefined;\n\t\tlet statusText =\n\t\t\tliveState ?? `${this.renderStyle.dim(modelLabel)} ${this.renderStyle.dim(\"•\")} ${this.renderStyle.muted(pwd)}`;\n\t\tif (areExperimentalFeaturesEnabled()) statusText += ` ${this.renderStyle.warning(\"xp\")}`;\n\t\tconst lines = [truncateToWidth(statusText, width, this.renderStyle.dim(\"...\"))];\n\t\tconst statuses = [...this.footerData.getExtensionStatuses()].sort(([a], [b]) => a.localeCompare(b));\n\t\tif (statuses.length > 0) {\n\t\t\tlines.push(\n\t\t\t\ttruncateToWidth(\n\t\t\t\t\tstatuses.map(([, text]) => sanitizeStatusText(text)).join(` ${this.renderStyle.dim(\"•\")} `),\n\t\t\t\t\twidth,\n\t\t\t\t\tthis.renderStyle.dim(\"...\"),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tlines.push(...renderTaskFooter(getOwnerTaskStore(this.session)?.backgroundTasks ?? [], width));\n\t\treturn lines;\n\t}\n}\n"]}
1
+ {"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[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AAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QAC/F,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport type { Usage } from \"@bastani/pi-ai/compat\";\nimport { type Component, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.js\";\nimport type { SessionStats } from \"../../../core/agent-session-types.js\";\nimport { areExperimentalFeaturesEnabled } from \"../../../core/experimental.ts\";\nimport type { ContextUsage } from \"../../../core/extensions/types.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { getOwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { addUsageToTotals, createUsageTotals, type UsageTotals } from \"../../../core/usage-totals.ts\";\nimport { getEngineSessionStats } from \"../../interactive-engine/engine-session-stats.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { renderTaskFooter } from \"./task-list.js\";\n\nexport interface FooterRenderStyle {\n\tdim(text: string): string;\n\tmuted(text: string): string;\n\twarning(text: string): string;\n}\n\nconst defaultFooterRenderStyle: FooterRenderStyle = {\n\tdim: (text) => theme.fg(\"dim\", text),\n\tmuted: (text) => theme.fg(\"muted\", text),\n\twarning: (text) => theme.fg(\"warning\", text),\n};\n\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse\n\t// multiple spaces (pi parity). ANSI/SGR sequences must survive intact:\n\t// extension statuses are frequently theme-colored, and stripping only the\n\t// ESC byte would leave the rest of the sequence as visible literal text.\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/**\n * The extension status row under the footer: statuses sorted by key, joined by a dim bullet and\n * truncated to the width. Shared by the chat footer and a task page's footer.\n */\nexport function renderExtensionStatusRow(\n\tstatuses: ReadonlyMap<string, string>,\n\twidth: number,\n\tstyle: Pick<FooterRenderStyle, \"dim\"> = defaultFooterRenderStyle,\n): string | undefined {\n\tif (statuses.size === 0) return undefined;\n\tconst sorted = [...statuses].sort(([a], [b]) => a.localeCompare(b));\n\treturn truncateToWidth(\n\t\tsorted.map(([, text]) => sanitizeStatusText(text)).join(` ${style.dim(\"•\")} `),\n\t\twidth,\n\t\tstyle.dim(\"...\"),\n\t);\n}\n\n/**\n * Format token counts (similar to web-ui)\n */\nfunction formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\nfunction replaceHome(input: string): string {\n\treturn formatCwdForFooter(input, process.env.HOME || process.env.USERPROFILE);\n}\n\nfunction rightAlign(line: string, width: number): string {\n\tconst lineWidth = visibleWidth(line);\n\tif (lineWidth >= width) {\n\t\treturn truncateToWidth(line, width, theme.fg(\"dim\", \"...\"));\n\t}\n\treturn `${\" \".repeat(width - lineWidth)}${line}`;\n}\n\ntype UsageSummary = { totals: UsageTotals; latestCacheHitRate: number | undefined };\n\ninterface MirrorStats extends UsageSummary {\n\tsessionId: string;\n\tleafId: string | null;\n\tentryCount: number;\n\tlimitsModel: AgentSession[\"model\"];\n\tcontextUsage: ContextUsage | undefined;\n}\n\nconst mirrorStats = new WeakMap<AgentSession, MirrorStats>();\n\nfunction getCacheHitRate(usage: Usage): number | undefined {\n\tconst promptTokens = usage.input + usage.cacheRead + usage.cacheWrite;\n\treturn promptTokens > 0 ? (usage.cacheRead / promptTokens) * 100 : undefined;\n}\n\nfunction summarizeEngineUsage(stats: SessionStats): UsageSummary {\n\tconst { input, output, cacheRead, cacheWrite } = stats.tokens;\n\treturn {\n\t\ttotals: { input, output, cacheRead, cacheWrite, cost: stats.cost },\n\t\tlatestCacheHitRate: stats.latestAssistantUsage ? getCacheHitRate(stats.latestAssistantUsage) : undefined,\n\t};\n}\n\nfunction summarizeEntryUsage(session: AgentSession): UsageSummary {\n\t// Calculate cumulative usage from ALL session entries (not just post-compaction messages)\n\tconst totals = createUsageTotals();\n\tlet latestCacheHitRate: number | undefined;\n\n\tfor (const entry of session.sessionManager.getEntries()) {\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\taddUsageToTotals(totals, entry.message.usage);\n\t\t\tlatestCacheHitRate = getCacheHitRate(entry.message.usage);\n\t\t} else if (\n\t\t\t(entry.type === \"branch_summary\" || entry.type === \"session_summary\" || entry.type === \"compaction\") &&\n\t\t\tentry.usage\n\t\t) {\n\t\t\taddUsageToTotals(totals, entry.usage);\n\t\t} else if (\n\t\t\tentry.type === \"message\" &&\n\t\t\tentry.message.role === \"toolResult\" &&\n\t\t\t\"usage\" in entry.message &&\n\t\t\tentry.message.usage\n\t\t) {\n\t\t\taddUsageToTotals(totals, entry.message.usage);\n\t\t}\n\t}\n\treturn { totals, latestCacheHitRate };\n}\n\nfunction getMirrorStats(session: AgentSession): MirrorStats {\n\tconst manager = session.sessionManager;\n\tconst sessionId = manager.getSessionId();\n\tconst leafId = manager.getLeafId();\n\tconst entryCount = manager.getEntryCount();\n\tconst limitsModel = session.model;\n\tconst cached = mirrorStats.get(session);\n\tif (\n\t\tcached &&\n\t\tcached.sessionId === sessionId &&\n\t\tcached.leafId === leafId &&\n\t\tcached.entryCount === entryCount &&\n\t\tcached.limitsModel === limitsModel\n\t)\n\t\treturn cached;\n\n\tconst { totals, latestCacheHitRate } = summarizeEntryUsage(session);\n\tconst contextUsage = session.getContextUsage();\n\tconst stats = { sessionId, leafId, entryCount, limitsModel, totals, latestCacheHitRate, contextUsage };\n\tmirrorStats.set(session, stats);\n\treturn stats;\n}\n\nfunction getUsageLine(session: AgentSession, autoCompactEnabled: boolean, width: number): string {\n\tconst state = session.state;\n\t// An isolated engine owns the live session; its stats replace the host's mirror entries.\n\tconst engineStats = getEngineSessionStats(session);\n\tconst { totals, latestCacheHitRate, contextUsage } = engineStats\n\t\t? { ...summarizeEngineUsage(engineStats), contextUsage: engineStats.contextUsage }\n\t\t: getMirrorStats(session);\n\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\n\tconst usageParts = [];\n\tif (totals.input) usageParts.push(`${theme.fg(\"dim\", \"↑\")}${theme.fg(\"muted\", formatTokens(totals.input))}`);\n\tif (totals.output) usageParts.push(`${theme.fg(\"dim\", \"↓\")}${theme.fg(\"muted\", formatTokens(totals.output))}`);\n\tif (totals.cacheRead) usageParts.push(`${theme.fg(\"dim\", \"R\")}${theme.fg(\"muted\", formatTokens(totals.cacheRead))}`);\n\tif (totals.cacheWrite)\n\t\tusageParts.push(`${theme.fg(\"dim\", \"W\")}${theme.fg(\"muted\", formatTokens(totals.cacheWrite))}`);\n\tif ((totals.cacheRead > 0 || totals.cacheWrite > 0) && latestCacheHitRate !== undefined) {\n\t\tusageParts.push(`${theme.fg(\"dim\", \"CH\")}${theme.fg(\"muted\", `${latestCacheHitRate.toFixed(1)}%`)}`);\n\t}\n\n\t// Kimi Coding is subscription-backed despite using API-key authentication.\n\tconst usingSubscription = state.model\n\t\t? state.model.provider === \"kimi-coding\" || session.modelRuntime.isUsingOAuth(state.model.provider)\n\t\t: false;\n\tif (totals.cost || usingSubscription) {\n\t\tusageParts.push(\n\t\t\t`${theme.fg(\"muted\", `$${totals.cost.toFixed(3)}`)}${usingSubscription ? ` ${theme.fg(\"dim\", \"(sub)\")}` : \"\"}`,\n\t\t);\n\t}\n\n\tconst autoIndicator = autoCompactEnabled ? \" (auto)\" : \"\";\n\tconst contextPercentDisplay =\n\t\tcontextPercent === \"?\"\n\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t: `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;\n\tif (autoCompactEnabled && contextPercentValue > 70) {\n\t\tusageParts.push(theme.fg(\"warning\", contextPercentDisplay));\n\t} else if (contextPercentValue > 90) {\n\t\tusageParts.push(theme.fg(\"error\", contextPercentDisplay));\n\t} else if (contextPercentValue > 70) {\n\t\tusageParts.push(theme.fg(\"warning\", contextPercentDisplay));\n\t} else {\n\t\tusageParts.push(theme.fg(\"muted\", contextPercentDisplay));\n\t}\n\n\tconst separator = theme.fg(\"dim\", \" • \");\n\tconst usageText = usageParts.length > 0 ? usageParts.join(separator) : theme.fg(\"muted\", contextPercentDisplay);\n\treturn rightAlign(usageText, width);\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\n}\n\n/**\n * Right-aligned usage meter that sits above the composer, matching the approved\n * prototype's separate token/cost/context ribbon.\n */\nexport class UsageMeterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\n\tprivate declare session: AgentSession;\n\n\tconstructor(session: AgentSession) {\n\t\tthis.session = session;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\tinvalidate(): void {\n\t\t// Render pulls live session data.\n\t}\n\n\trender(width: number): string[] {\n\t\treturn [getUsageLine(this.session, this.autoCompactEnabled, width)];\n\t}\n}\n\n/**\n * Sparse statusline below the composer. It mirrors the preview: model + cwd\n * when idle, or one semantic dot with short recovery copy while work is live.\n */\nexport class FooterComponent implements Component {\n\tprivate declare session: AgentSession;\n\tprivate declare footerData: ReadonlyFooterDataProvider;\n\tprivate declare readonly renderStyle: FooterRenderStyle;\n\tprivate readonly navigationActive: () => boolean;\n\tprivate branchCwd: string | undefined;\n\tprivate releaseBranch: (() => void) | undefined;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tsession: AgentSession,\n\t\tfooterData: ReadonlyFooterDataProvider,\n\t\trenderStyle: FooterRenderStyle = defaultFooterRenderStyle,\n\t\tnavigationActive: () => boolean = () => false,\n\t) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\n\t\tthis.renderStyle = renderStyle;\n\t\tthis.navigationActive = navigationActive;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tif (this.session !== session) {\n\t\t\tthis.releaseBranch?.();\n\t\t\tthis.releaseBranch = undefined;\n\t\t\tthis.branchCwd = undefined;\n\t\t}\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(_enabled: boolean): void {\n\t\t// Usage state lives in UsageMeterComponent. Kept for compatibility with existing call sites.\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/** Release this viewer's branch subscription without disposing shared footer data. */\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.releaseBranch?.();\n\t\tthis.releaseBranch = undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.disposed) return [];\n\t\tconst state = this.session.state;\n\t\tconst cwd = this.session.sessionManager.getCwd();\n\t\tif (this.branchCwd !== cwd) {\n\t\t\tthis.releaseBranch?.();\n\t\t\t// Repaints are requested by the host's existing shared branch subscription.\n\t\t\tthis.releaseBranch = this.footerData.onBranchChange(() => {}, cwd);\n\t\t\tthis.branchCwd = cwd;\n\t\t}\n\t\tlet pwd = replaceHome(cwd);\n\t\tconst branch = this.footerData.getGitBranch(cwd);\n\t\tif (branch) pwd += ` (${branch})`;\n\t\tconst sessionName =\n\t\t\ttypeof this.session.sessionManager.getSessionName === \"function\"\n\t\t\t\t? this.session.sessionManager.getSessionName()\n\t\t\t\t: undefined;\n\t\tif (sessionName) pwd += ` • ${sessionName}`;\n\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tlet modelLabel = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\tmodelLabel = thinkingLevel === \"off\" ? modelLabel : `${modelLabel} ${thinkingLevel}`;\n\t\t}\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\tmodelLabel = `(${state.model.provider}) ${modelLabel}`;\n\t\t}\n\n\t\tconst liveState =\n\t\t\tthis.session.isStreaming && !this.navigationActive() ? this.renderStyle.muted(\"esc to interrupt\") : undefined;\n\t\tlet statusText =\n\t\t\tliveState ?? `${this.renderStyle.dim(modelLabel)} ${this.renderStyle.dim(\"•\")} ${this.renderStyle.muted(pwd)}`;\n\t\tif (areExperimentalFeaturesEnabled()) statusText += ` ${this.renderStyle.warning(\"xp\")}`;\n\t\tconst lines = [truncateToWidth(statusText, width, this.renderStyle.dim(\"...\"))];\n\t\tconst statusRow = renderExtensionStatusRow(this.footerData.getExtensionStatuses(), width, this.renderStyle);\n\t\tif (statusRow !== undefined) lines.push(statusRow);\n\t\tlines.push(...renderTaskFooter(getOwnerTaskStore(this.session)?.backgroundTasks ?? [], width));\n\t\treturn lines;\n\t}\n}\n"]}
@@ -21,6 +21,7 @@ export declare class TaskInspector implements Component {
21
21
  private detailTaskId?;
22
22
  private detailGeneration;
23
23
  private disposed;
24
+ private statusWatch?;
24
25
  private readonly input;
25
26
  private readonly unsubscribe;
26
27
  constructor(privateStore: OwnerTaskStore, privateRender: () => void, privateClose: () => void, openQuestion?: (route: PromptRoute) => void);
@@ -34,6 +35,12 @@ export declare class TaskInspector implements Component {
34
35
  private selected;
35
36
  private stdinAvailable;
36
37
  private sendInput;
38
+ private releaseStatusWatch;
39
+ /**
40
+ * The selected task's own extension statuses, as the row under its fullscreen page's footer. The
41
+ * compact picker and confirmation page show none. A write repaints the page while it is shown.
42
+ */
43
+ private taskStatusRows;
37
44
  private releaseLiveTranscript;
38
45
  private refreshTranscript;
39
46
  private loadTranscript;
@@ -1 +1 @@
1
- {"version":3,"file":"task-inspector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,SAAS,EAOd,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAgBzE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,gFAAgF;AAChF,qBAAa,aAAc,YAAW,SAAS;IAC9C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,YAAY,CAAC,CAA4B;IACjD,OAAO,CAAC,UAAU,CAAC,CAAc;IACjC,OAAO,CAAC,cAAc,CAAC,CAAqB;IAC5C,OAAO,CAAC,wBAAwB,CAAS;IACzC,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,aAAa,CAAiD;IACtE,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;I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AAI,CAEtB;IACD,OAAO,CAAC,eAAe;IAGvB,OAAO,IAAI,IAAI,CAMd;IACD,UAAU,IAAI,IAAI,CAEjB;IACD,OAAO,CAAC,QAAQ;IAGhB,OAAO,CAAC,cAAc;YAMR,SAAS;IAkBvB,OAAO,CAAC,kBAAkB;IAI1B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,iBAAiB;YAWX,cAAc;YAyGd,UAAU;IA2DxB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAwFjC;IACD,OAAO,CAAC,iBAAiB;IAKzB,qFAAqF;IACrF,IAAI,UAAU,IAAI,OAAO,CAMxB;IACD,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAE3D;IACD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;IACD,OAAO,CAAC,wBAAwB;IAoChC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAwEtD;IACD,OAAO,CAAC,SAAS;CAsDjB"}
@@ -2,11 +2,12 @@ import { randomUUID } from "node:crypto";
2
2
  import { stripVTControlCharacters } from "node:util";
3
3
  import { getKeybindings, Input, matchesKey, Text, truncateToWidth, visibleWidth, } from "@earendil-works/pi-tui";
4
4
  import { taskOutputText } from "../../../core/tasks/command-output.js";
5
- import { taskOwnTranscriptEntries, taskTranscriptSource } from "../../../core/tasks/supervisor.js";
5
+ import { taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, watchTaskExtensionStatuses, } from "../../../core/tasks/supervisor.js";
6
6
  import { readTaskTranscriptSnapshot } from "../../../core/tasks/transcript.js";
7
7
  import { theme } from "../theme/theme.js";
8
8
  import { chatEntriesFromAgentMessages, renderChatMessageEntry } from "./chat-message-renderer.js";
9
9
  import { mouseWheelDeltaRows } from "./chat-transcript.js";
10
+ import { renderExtensionStatusRow } from "./footer.js";
10
11
  import { keyHintIfBound } from "./keybinding-hints.js";
11
12
  import { TaskDetail, taskDetailActions, taskDetailLabels, taskDetailSummary, } from "./task-detail.js";
12
13
  import { taskListSections } from "./task-list.js";
@@ -32,6 +33,7 @@ export class TaskInspector {
32
33
  detailTaskId;
33
34
  detailGeneration = 0;
34
35
  disposed = false;
36
+ statusWatch;
35
37
  input = new Input();
36
38
  unsubscribe;
37
39
  constructor(privateStore, privateRender, privateClose, openQuestion) {
@@ -113,6 +115,7 @@ export class TaskInspector {
113
115
  }
114
116
  dispose() {
115
117
  this.disposed = true;
118
+ this.releaseStatusWatch();
116
119
  this.releaseLiveTranscript();
117
120
  this.confirmation?.(false);
118
121
  this.unsubscribe();
@@ -151,6 +154,31 @@ export class TaskInspector {
151
154
  this.input.setValue("");
152
155
  this.requestRender();
153
156
  }
157
+ releaseStatusWatch() {
158
+ this.statusWatch?.release();
159
+ this.statusWatch = undefined;
160
+ }
161
+ /**
162
+ * The selected task's own extension statuses, as the row under its fullscreen page's footer. The
163
+ * compact picker and confirmation page show none. A write repaints the page while it is shown.
164
+ */
165
+ taskStatusRows(width) {
166
+ const task = this.navigation.focus.kind === "detail" && !this.confirmation ? this.selected() : undefined;
167
+ const lease = task?.kind === "agent" ? this.store.resolveTask(task.ref.taskId) : undefined;
168
+ if (!task || !lease?.ok) {
169
+ this.releaseStatusWatch();
170
+ return [];
171
+ }
172
+ if (this.statusWatch?.taskId !== task.ref.taskId) {
173
+ this.releaseStatusWatch();
174
+ this.statusWatch = {
175
+ taskId: task.ref.taskId,
176
+ release: watchTaskExtensionStatuses(lease.value, () => this.requestRender()),
177
+ };
178
+ }
179
+ const row = renderExtensionStatusRow(taskExtensionStatuses(lease.value), width);
180
+ return row === undefined ? [] : [row];
181
+ }
154
182
  releaseLiveTranscript() {
155
183
  this.liveTranscript?.dispose();
156
184
  this.liveTranscript = undefined;
@@ -463,7 +491,8 @@ export class TaskInspector {
463
491
  }
464
492
  renderTranscriptViewport(width, budget) {
465
493
  const task = this.selected();
466
- const room = Math.max(1, budget - 5);
494
+ const statusRows = this.taskStatusRows(width);
495
+ const room = Math.max(1, budget - 5 - statusRows.length);
467
496
  this.transcriptPageRows = room;
468
497
  const rows = this.transcript?.flatMap((component) => component.render(width)) ?? [
469
498
  this.transcriptLoading ? "Loading transcript…" : this.status,
@@ -485,6 +514,7 @@ export class TaskInspector {
485
514
  ...Array.from({ length: Math.max(0, room - visible.length) }, () => ""),
486
515
  theme.fg("dim", `Lines ${rows.length ? this.scroll + 1 : 0}–${Math.min(rows.length, this.scroll + room)} of ${rows.length}${this.cursor ? " · PgUp at top: earlier history" : ""}${this.status ? ` · ${this.status}` : ""}`),
487
516
  theme.fg("dim", "↑↓ scroll · PgUp/PgDn page · Home/End · ←/Esc back"),
517
+ ...statusRows,
488
518
  ]
489
519
  .map(fit)
490
520
  .slice(0, Math.max(1, budget));
@@ -505,7 +535,8 @@ export class TaskInspector {
505
535
  const actionRow = action ? [theme.fg("accent", `› ${taskDetailLabels[action]}`)] : [];
506
536
  const rows = this.renderAll(inner);
507
537
  const compactSummary = !framed && detail && current && budget >= 4 ? [taskDetailSummary(current)] : [];
508
- const height = Math.max(0, budget - (framed ? 4 : 1) - actionRow.length - compactSummary.length);
538
+ const statusRows = this.taskStatusRows(width);
539
+ const height = Math.max(0, budget - (framed ? 4 : 1) - actionRow.length - compactSummary.length - statusRows.length);
509
540
  const selected = detail ? -1 : rows.findIndex((row) => stripVTControlCharacters(row).startsWith("›"));
510
541
  this.scroll = Math.min(this.scroll, Math.max(0, rows.length - height));
511
542
  const selectionRows = Math.min(height, current?.kind === "agent" ? 3 : 2);
@@ -530,7 +561,7 @@ export class TaskInspector {
530
561
  .join(" · ");
531
562
  const footer = theme.fg("dim", truncateToWidth(`/tasks · ${hints}`, width));
532
563
  if (!framed)
533
- return [...compactSummary, ...view, ...actionRow, footer]
564
+ return [...compactSummary, ...view, ...actionRow, footer, ...statusRows]
534
565
  .map((line) => truncateToWidth(line, width))
535
566
  .slice(-Math.max(1, budget));
536
567
  const live = this.store.backgroundTasks.filter((task) => task.execution.kind !== "settled").length;
@@ -552,6 +583,7 @@ export class TaskInspector {
552
583
  ...actionRow.map(frameRow),
553
584
  border(`╰${"─".repeat(Math.max(0, width - 2))}╯`),
554
585
  footer,
586
+ ...statusRows,
555
587
  ].map((line) => truncateToWidth(line, width));
556
588
  }
557
589
  renderAll(width) {
@@ -1 +1 @@
1
- {"version":3,"file":"task-inspector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAEN,cAAc,EACd,KAAK,EACL,UAAU,EACV,IAAI,EACJ,eAAe,EACf,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACN,UAAU,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CA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AC,CAAC,CAAC,EAAE,CAAC;oBAC9B,SAAS,CAAC,IAAI,CAAC;oBACf,eAAe,CAAC,IAAI,CAAC;oBACrB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;iBACjF;qBACC,MAAM,CAAC,OAAO,CAAC;qBACf,IAAI,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;oBACN,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC;oBAC3B,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;iBAChG,CAAC;YACH,CAAC,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { stripVTControlCharacters } from \"node:util\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport {\n\ttype Component,\n\tgetKeybindings,\n\tInput,\n\tmatchesKey,\n\tText,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport { taskOutputText } from \"../../../core/tasks/command-output.js\";\nimport type { OperationId, PromptRoute, TaskId } from \"../../../core/tasks/contracts.js\";\nimport type { OwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { taskOwnTranscriptEntries, taskTranscriptSource } from \"../../../core/tasks/supervisor.js\";\nimport { readTaskTranscriptSnapshot } from \"../../../core/tasks/transcript.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { chatEntriesFromAgentMessages, renderChatMessageEntry } from \"./chat-message-renderer.ts\";\nimport { mouseWheelDeltaRows } from \"./chat-transcript.js\";\nimport { keyHintIfBound } from \"./keybinding-hints.js\";\nimport {\n\tTaskDetail,\n\ttype TaskDetailContent,\n\ttaskDetailActions,\n\ttaskDetailLabels,\n\ttaskDetailSummary,\n} from \"./task-detail.js\";\nimport { type TaskListSection, taskListSections } from \"./task-list.js\";\nimport { TaskLiveTranscript } from \"./task-live-transcript.js\";\nimport { TaskNavigation } from \"./task-navigation.js\";\nimport { taskDisplayText, taskLabel, taskMetricsText, taskModelText, taskStatusAppearance } from \"./task-row.js\";\n\n/** Focused view only. The store and original session remain the authorities. */\nexport class TaskInspector implements Component {\n\treadonly navigation: TaskNavigation;\n\tprivate actionIndex = 0;\n\tprivate confirmation?: (answer: boolean) => void;\n\tprivate transcript?: Component[];\n\tprivate liveTranscript?: TaskLiveTranscript;\n\tprivate transcriptRefreshPending = false;\n\tprivate transcriptRequested = false;\n\tprivate transcriptLoading = false;\n\tprivate transcriptHistorical = false;\n\tprivate transcriptPageRows = 5;\n\tprivate cursor?: string;\n\tprivate status = \"\";\n\tprivate scroll = 0;\n\tprivate detailContent: Omit<TaskDetailContent, \"stdinAvailable\"> = {};\n\tprivate detailTaskId?: TaskId;\n\tprivate detailGeneration = 0;\n\tprivate disposed = false;\n\tprivate readonly input = new Input();\n\tprivate readonly unsubscribe: () => void;\n\tconstructor(\n\t\tprivateStore: OwnerTaskStore,\n\t\tprivateRender: () => void,\n\t\tprivateClose: () => void,\n\t\topenQuestion?: (route: PromptRoute) => void,\n\t) {\n\t\tthis.store = privateStore;\n\t\tthis.requestRender = privateRender;\n\t\tthis.close = privateClose;\n\t\tthis.navigation = new TaskNavigation(getKeybindings() as KeybindingsManager, {\n\t\t\tinspect: () => {\n\t\t\t\tthis.releaseLiveTranscript();\n\t\t\t\tthis.actionIndex = 0;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tthis.transcript = undefined;\n\t\t\t\tthis.transcriptRequested = false;\n\t\t\t\tthis.transcriptLoading = false;\n\t\t\t\tthis.transcriptHistorical = false;\n\t\t\t\tvoid this.loadDetail();\n\t\t\t},\n\t\t\ttranscript: () => {\n\t\t\t\tthis.detailGeneration++;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tvoid this.loadTranscript();\n\t\t\t},\n\t\t\tforeground: (task) => {\n\t\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\t\tif (lease.ok)\n\t\t\t\t\tvoid this.store.supervisor.foregroundTask(lease.value).then((result) => {\n\t\t\t\t\t\tthis.status = result.ok ? result.value.kind : result.error.message;\n\t\t\t\t\t\tthis.requestRender();\n\t\t\t\t\t});\n\t\t\t},\n\t\t\tconfirmCancel: () =>\n\t\t\t\tnew Promise<boolean>((resolve) => {\n\t\t\t\t\tthis.confirmation = resolve;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t}),\n\t\t\tcancel: (task) => {\n\t\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\t\tif (lease.ok) void this.store.supervisor.cancelTask(lease.value, \"user\").then(() => this.requestRender());\n\t\t\t},\n\t\t\tstdinAvailable: (task) => {\n\t\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\t\treturn lease.ok && this.store.supervisor.taskStdin(lease.value).ok;\n\t\t\t},\n\t\t\tinput: () => {\n\t\t\t\tthis.input.setValue(\"\");\n\t\t\t},\n\t\t\topenQuestion: (route) => {\n\t\t\t\tif (openQuestion) {\n\t\t\t\t\tthis.close();\n\t\t\t\t\topenQuestion(route);\n\t\t\t\t} else this.status = \"Question is available in its owning session.\";\n\t\t\t},\n\t\t});\n\t\tthis.unsubscribe = this.store.subscribe(() => {\n\t\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\t\tif (this.transcriptRequested) {\n\t\t\t\tthis.refreshTranscript();\n\t\t\t} else if (this.navigation.focus.kind === \"detail\") void this.loadDetail();\n\t\t\tthis.requestRender();\n\t\t});\n\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\tthis.navigation.open();\n\t\tthis.input.onSubmit = (text) => {\n\t\t\tvoid this.sendInput(text);\n\t\t};\n\t}\n\tprivate readonly store: OwnerTaskStore;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly close: () => void;\n\topen(id?: TaskId): void {\n\t\tthis.navigation.open(id);\n\t}\n\tprivate orderedSections(): TaskListSection[] {\n\t\treturn taskListSections(this.store.backgroundTasks, this.store.settlementOrder);\n\t}\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.releaseLiveTranscript();\n\t\tthis.confirmation?.(false);\n\t\tthis.unsubscribe();\n\t}\n\tinvalidate(): void {\n\t\tfor (const component of this.transcript ?? []) component.invalidate();\n\t}\n\tprivate selected() {\n\t\treturn this.store.backgroundTasks.find((task) => task.ref.taskId === this.navigation.selectedTaskId);\n\t}\n\tprivate stdinAvailable(): boolean {\n\t\tconst task = this.selected();\n\t\tif (!task || task.execution.kind === \"settled\") return false;\n\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\treturn lease.ok && this.store.supervisor.taskStdin(lease.value).ok;\n\t}\n\tprivate async sendInput(text: string): Promise<void> {\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\tif (!lease.ok) return;\n\t\tconst stdin = this.store.supervisor.taskStdin(lease.value);\n\t\tif (!stdin.ok) {\n\t\t\tthis.status = stdin.error.message;\n\t\t\treturn;\n\t\t}\n\t\tconst result = await this.store.supervisor.writeTaskInput(stdin.value, randomUUID() as OperationId, {\n\t\t\tkind: \"bytes\",\n\t\t\tbytes: Buffer.from(`${text}\\n`),\n\t\t});\n\t\tthis.status = result.ok ? `Sent ${result.value.acceptedBytes} bytes` : result.error.message;\n\t\tthis.input.setValue(\"\");\n\t\tthis.requestRender();\n\t}\n\tprivate releaseLiveTranscript(): void {\n\t\tthis.liveTranscript?.dispose();\n\t\tthis.liveTranscript = undefined;\n\t\tthis.transcriptRefreshPending = false;\n\t}\n\tprivate refreshTranscript(): void {\n\t\tif (this.disposed || !this.transcriptRequested) return;\n\t\tconst task = this.selected();\n\t\tconst lease = task && this.store.resolveTask(task.ref.taskId);\n\t\tconst bound = lease?.ok ? taskTranscriptSource(lease.value) : undefined;\n\t\tif (bound?.ok && this.liveTranscript?.source === bound.value.session) return;\n\t\t// Legacy history-only sources have no live tail; keep their retained page anchored.\n\t\tif (bound?.ok && !bound.value.session.subscribe && this.transcriptHistorical) return;\n\t\tif (this.transcriptLoading) this.transcriptRefreshPending = true;\n\t\telse void this.loadTranscript();\n\t}\n\tprivate async loadTranscript(earlier = false): Promise<void> {\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst generation = ++this.detailGeneration;\n\t\tconst focus = this.navigation.focus;\n\t\tthis.transcriptRequested = true;\n\t\tthis.transcriptLoading = true;\n\t\tif (earlier) this.transcriptHistorical = true;\n\t\tthis.requestRender();\n\t\ttry {\n\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\tif (!lease.ok) {\n\t\t\t\tthis.status = lease.error.message;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (task.kind === \"command\") {\n\t\t\t\tconst count = BigInt(task.output.byteCount);\n\t\t\t\tconst page = await this.store.supervisor.readTaskOutput(lease.value, {\n\t\t\t\t\tstart: String(count > 8192n ? count - 8192n : 0n),\n\t\t\t\t\tmaximumBytes: 8192,\n\t\t\t\t});\n\t\t\t\tif (\n\t\t\t\t\tthis.disposed ||\n\t\t\t\t\tgeneration !== this.detailGeneration ||\n\t\t\t\t\tfocus !== this.navigation.focus ||\n\t\t\t\t\ttask.ref.taskId !== this.navigation.selectedTaskId\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tconst text = page.ok ? taskOutputText(page.value) : page.error.message;\n\t\t\t\tthis.transcript = [\n\t\t\t\t\tnew Text(text.split(\"\\n\").map(taskDisplayText).join(\"\\n\") || \"No output available\", 0, 0),\n\t\t\t\t];\n\t\t\t\tthis.cursor = undefined;\n\t\t\t\tthis.status =\n\t\t\t\t\tcount > 8192n ? \"Earlier output omitted · showing retained 8 KiB tail\" : \"Retained shell output\";\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst page = readTaskTranscriptSnapshot(lease.value, earlier ? this.cursor : undefined);\n\t\t\tif (\n\t\t\t\tthis.disposed ||\n\t\t\t\tgeneration !== this.detailGeneration ||\n\t\t\t\tfocus !== this.navigation.focus ||\n\t\t\t\ttask.ref.taskId !== this.navigation.selectedTaskId\n\t\t\t)\n\t\t\t\treturn;\n\t\t\tconst bound = taskTranscriptSource(lease.value);\n\t\t\tif (!bound.ok || (!page.ok && !bound.value.session.subscribe)) {\n\t\t\t\tthis.status = \"Transcript unavailable\";\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst ids = new Set(page.ok ? page.value.items.map((item) => item.source.entryId) : []);\n\t\t\tconst messages = bound.value.session.getEntries().flatMap<AgentMessage>((entry) => {\n\t\t\t\tif (entry.type !== \"message\" || !ids.has(entry.id)) return [];\n\t\t\t\tconst message = entry.message;\n\t\t\t\tif (message.role === \"assistant\")\n\t\t\t\t\treturn [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...message,\n\t\t\t\t\t\t\tcontent: message.content.filter(\n\t\t\t\t\t\t\t\t(block, index) =>\n\t\t\t\t\t\t\t\t\tblock.type !== \"thinking\" &&\n\t\t\t\t\t\t\t\t\tpage.ok &&\n\t\t\t\t\t\t\t\t\tpage.value.items.some(\n\t\t\t\t\t\t\t\t\t\t(item) => item.source.entryId === entry.id && item.source.contentIndex === index,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\treturn message.role === \"user\" || message.role === \"toolResult\" ? [message] : [];\n\t\t\t});\n\t\t\tconst components = chatEntriesFromAgentMessages(messages).map((entry) =>\n\t\t\t\trenderChatMessageEntry(entry, {\n\t\t\t\t\tui: { requestRender: this.requestRender },\n\t\t\t\t\tcwd: process.cwd(),\n\t\t\t\t\thideThinkingBlock: true,\n\t\t\t\t\ttoolOutputExpanded: true,\n\t\t\t\t\tshowImages: false,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (!earlier && bound.value.session.subscribe) {\n\t\t\t\tthis.releaseLiveTranscript();\n\t\t\t\tthis.liveTranscript = new TaskLiveTranscript(bound.value.session, messages, this.requestRender);\n\t\t\t\tthis.transcript = [this.liveTranscript];\n\t\t\t} else this.transcript = earlier ? [...components, ...(this.transcript ?? [])] : components;\n\t\t\tthis.cursor = page.ok ? page.value.nextCursor : undefined;\n\t\t\tthis.status = this.cursor ? \"PageUp: earlier retained messages\" : \"\";\n\t\t\tthis.requestRender();\n\t\t} catch {\n\t\t\tif (!this.disposed && generation === this.detailGeneration && focus === this.navigation.focus) {\n\t\t\t\tthis.transcript = [];\n\t\t\t\tthis.status = \"Task output unavailable\";\n\t\t\t\tthis.requestRender();\n\t\t\t}\n\t\t} finally {\n\t\t\tif (generation === this.detailGeneration) {\n\t\t\t\tthis.transcriptLoading = false;\n\t\t\t\tif (this.transcriptRefreshPending) {\n\t\t\t\t\tthis.transcriptRefreshPending = false;\n\t\t\t\t\tthis.refreshTranscript();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprivate async loadDetail(): Promise<void> {\n\t\tconst selectedId = this.selected()?.ref.taskId;\n\t\tif (selectedId !== this.detailTaskId) {\n\t\t\tthis.detailContent = {};\n\t\t\tthis.detailTaskId = selectedId;\n\t\t}\n\t\tthis.status = \"\";\n\t\tconst generation = ++this.detailGeneration;\n\t\tconst focus = this.navigation.focus;\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst current = () =>\n\t\t\t!this.disposed &&\n\t\t\tgeneration === this.detailGeneration &&\n\t\t\tthis.navigation.focus === focus &&\n\t\t\tfocus.kind === \"detail\" &&\n\t\t\tthis.navigation.selectedTaskId === task.ref.taskId;\n\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\tif (!lease.ok) return;\n\t\tconst ownEntries = taskOwnTranscriptEntries(lease.value);\n\t\tif (ownEntries) {\n\t\t\tconst prompt = ownEntries.find((entry) => entry.type === \"message\" && entry.message.role === \"user\");\n\t\t\tif (prompt?.type === \"message\" && prompt.message.role === \"user\")\n\t\t\t\tthis.detailContent.prompt =\n\t\t\t\t\ttypeof prompt.message.content === \"string\"\n\t\t\t\t\t\t? prompt.message.content\n\t\t\t\t\t\t: prompt.message.content\n\t\t\t\t\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t\t\t\t\t.map((block) => block.text)\n\t\t\t\t\t\t\t\t.join(\"\");\n\t\t\tconst response = ownEntries\n\t\t\t\t.slice()\n\t\t\t\t.reverse()\n\t\t\t\t.find((entry) => entry.type === \"message\" && entry.message.role === \"assistant\");\n\t\t\tif (response?.type === \"message\" && response.message.role === \"assistant\")\n\t\t\t\tthis.detailContent.output = response.message.content\n\t\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t\t.map((block) => block.text)\n\t\t\t\t\t.join(\"\");\n\t\t}\n\t\tif (task.kind === \"command\") {\n\t\t\ttry {\n\t\t\t\tconst count = BigInt(task.output.byteCount);\n\t\t\t\tconst output = await this.store.supervisor.readTaskOutput(lease.value, {\n\t\t\t\t\tstart: String(count > 8192n ? count - 8192n : 0n),\n\t\t\t\t\tmaximumBytes: 8192,\n\t\t\t\t});\n\t\t\t\tif (!current()) return;\n\t\t\t\tif (output.ok) {\n\t\t\t\t\tthis.detailContent.output = taskOutputText(output.value);\n\t\t\t\t\tthis.detailContent.outputOmitted = count > 8192n || output.value.omittedRanges.length > 0;\n\t\t\t\t} else this.status = output.error.message;\n\t\t\t} catch {\n\t\t\t\tif (!current()) return;\n\t\t\t\tthis.status = \"Command output unavailable\";\n\t\t\t}\n\t\t}\n\t\tif (current()) this.requestRender();\n\t}\n\thandleInput(data: string): boolean {\n\t\tif (this.confirmation) {\n\t\t\tif (data === \"y\" || data === \"n\" || matchesKey(data, \"escape\")) {\n\t\t\t\tconst answer = this.confirmation;\n\t\t\t\tthis.confirmation = undefined;\n\t\t\t\tanswer(data === \"y\");\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tconst wheel = mouseWheelDeltaRows(data);\n\t\tif (wheel !== 0) {\n\t\t\tif (this.navigation.focus.kind === \"tasks\") this.navigation.moveSelection(Math.sign(wheel));\n\t\t\telse if (this.navigation.focus.kind === \"detail\") {\n\t\t\t\tif (this.transcriptRequested && wheel < 0 && this.scroll === 0 && this.cursor && !this.transcriptLoading)\n\t\t\t\t\tvoid this.loadTranscript(true);\n\t\t\t\telse this.scroll = Math.max(0, this.scroll + wheel);\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\t// Mouse reports are never text input, including horizontal wheel/release.\n\t\tif (/^\\x1b\\[<\\d+;\\d+;\\d+[mM]$/.test(data) || data.startsWith(\"\\x1b[M\")) return true;\n\t\tif (\n\t\t\tmatchesKey(data, \"escape\") ||\n\t\t\t(matchesKey(data, \"left\") && this.navigation.focus.kind !== \"stdin\" && !this.configuredTaskKey(data))\n\t\t) {\n\t\t\tif (this.transcriptRequested) {\n\t\t\t\tthis.releaseLiveTranscript();\n\t\t\t\tthis.detailGeneration++;\n\t\t\t\tthis.transcript = undefined;\n\t\t\t\tthis.transcriptRequested = false;\n\t\t\t\tthis.transcriptLoading = false;\n\t\t\t\tthis.transcriptHistorical = false;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tvoid this.loadDetail();\n\t\t\t} else {\n\t\t\t\tthis.navigation.handleInput(\"\\x1b\", \"tasks\");\n\t\t\t\tif (this.navigation.focus.kind === \"composer\") this.close();\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.navigation.focus.kind === \"stdin\") {\n\t\t\tthis.input.handleInput(data);\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"x\" && !this.configuredTaskKey(data)) {\n\t\t\tvoid this.navigation.activate(\"cancel\");\n\t\t\treturn true;\n\t\t}\n\t\tif (this.transcriptRequested) {\n\t\t\tif (this.configuredTaskKey(data)) this.navigation.handleInput(data, \"tasks\");\n\t\t\telse if (matchesKey(data, \"up\")) this.scroll = Math.max(0, this.scroll - 1);\n\t\t\telse if (matchesKey(data, \"down\")) this.scroll++;\n\t\t\telse if (matchesKey(data, \"pageUp\")) {\n\t\t\t\tif (this.scroll === 0 && this.cursor && !this.transcriptLoading) void this.loadTranscript(true);\n\t\t\t\telse this.scroll = Math.max(0, this.scroll - this.transcriptPageRows);\n\t\t\t} else if (matchesKey(data, \"pageDown\")) this.scroll += this.transcriptPageRows;\n\t\t\telse if (matchesKey(data, \"home\")) this.scroll = 0;\n\t\t\telse if (matchesKey(data, \"end\")) this.scroll = Number.MAX_SAFE_INTEGER;\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tconst task = this.selected();\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\tconst actions = taskDetailActions(task.execution, task.attention, this.stdinAvailable());\n\t\t\tif (this.configuredTaskKey(data)) {\n\t\t\t\tif (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\t\telse this.navigation.handleInput(data, \"tasks\");\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"pageUp\") || matchesKey(data, \"pageDown\")) {\n\t\t\t\tthis.scroll = Math.max(0, this.scroll + (matchesKey(data, \"pageUp\") ? -5 : 5));\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"up\")) this.actionIndex = Math.max(0, this.actionIndex - 1);\n\t\t\telse if (matchesKey(data, \"down\")) this.actionIndex = Math.min(actions.length - 1, this.actionIndex + 1);\n\t\t\telse if (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\telse if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\t} else if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\tthis.requestRender();\n\t\treturn true;\n\t}\n\tprivate configuredTaskKey(data: string): boolean {\n\t\treturn ([\"app.tasks.inspect\", \"app.tasks.foreground\", \"app.tasks.cancel\", \"app.tasks.input\"] as const).some(\n\t\t\t(key) => getKeybindings().matches(data, key),\n\t\t);\n\t}\n\t/** Only the task picker stays inline; drill-down and confirmation own the screen. */\n\tget fullscreen(): boolean {\n\t\treturn (\n\t\t\tthis.confirmation !== undefined ||\n\t\t\tthis.navigation.focus.kind === \"detail\" ||\n\t\t\tthis.navigation.focus.kind === \"stdin\"\n\t\t);\n\t}\n\trenderPicker(width: number, availableRows: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(1, Math.min(12, availableRows)));\n\t}\n\trender(width: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(3, (process.stdout.rows || 24) - 5));\n\t}\n\tprivate renderTranscriptViewport(width: number, budget: number): string[] {\n\t\tconst task = this.selected();\n\t\tconst room = Math.max(1, budget - 5);\n\t\tthis.transcriptPageRows = room;\n\t\tconst rows = this.transcript?.flatMap((component) => component.render(width)) ?? [\n\t\t\tthis.transcriptLoading ? \"Loading transcript…\" : this.status,\n\t\t];\n\t\tthis.scroll = Math.min(this.scroll, Math.max(0, rows.length - room));\n\t\tconst visible = rows.slice(this.scroll, this.scroll + room);\n\t\t// Transcript tools own their backgrounds. Keep them out of a nested box,\n\t\t// strip terminal movement, and reset styles at every viewport row boundary.\n\t\tconst safeLine = (line: string) =>\n\t\t\tline\n\t\t\t\t.split(/(\\x1b\\[[0-9;:]*m)/g)\n\t\t\t\t.map((part, index) =>\n\t\t\t\t\tindex % 2 ? part : stripVTControlCharacters(part).replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \"),\n\t\t\t\t)\n\t\t\t\t.join(\"\");\n\t\tconst fit = (line: string) => truncateToWidth(safeLine(line), Math.max(1, width)) + \"\\x1b[0m\";\n\t\treturn [\n\t\t\ttheme.bold(`Transcript · ${task ? taskDisplayText(taskLabel(task)) : \"Task\"}`),\n\t\t\ttask ? taskDetailSummary(task) : \"\",\n\t\t\ttheme.fg(\"borderMuted\", \"─\".repeat(Math.max(0, width))),\n\t\t\t...visible,\n\t\t\t...Array.from({ length: Math.max(0, room - visible.length) }, () => \"\"),\n\t\t\ttheme.fg(\n\t\t\t\t\"dim\",\n\t\t\t\t`Lines ${rows.length ? this.scroll + 1 : 0}–${Math.min(rows.length, this.scroll + room)} of ${rows.length}${this.cursor ? \" · PgUp at top: earlier history\" : \"\"}${this.status ? ` · ${this.status}` : \"\"}`,\n\t\t\t),\n\t\t\ttheme.fg(\"dim\", \"↑↓ scroll · PgUp/PgDn page · Home/End · ←/Esc back\"),\n\t\t]\n\t\t\t.map(fit)\n\t\t\t.slice(0, Math.max(1, budget));\n\t}\n\trenderViewport(width: number, budget: number): string[] {\n\t\tif (this.transcriptRequested && !this.confirmation && this.navigation.focus.kind === \"detail\")\n\t\t\treturn this.renderTranscriptViewport(width, budget);\n\t\tconst framed = width >= 20 && budget >= 7;\n\t\tconst inner = Math.max(1, width - (framed ? 4 : 0));\n\t\tconst current = this.selected();\n\t\tconst detail = this.navigation.focus.kind === \"detail\";\n\t\tconst selectingAction = current && detail && !this.transcriptRequested && !this.confirmation;\n\t\tconst actions = selectingAction\n\t\t\t? taskDetailActions(current.execution, current.attention, this.stdinAvailable())\n\t\t\t: [];\n\t\tthis.actionIndex = Math.max(0, Math.min(this.actionIndex, actions.length - 1));\n\t\tconst action = actions[this.actionIndex];\n\t\tconst actionRow = action ? [theme.fg(\"accent\", `› ${taskDetailLabels[action]}`)] : [];\n\t\tconst rows = this.renderAll(inner);\n\t\tconst compactSummary = !framed && detail && current && budget >= 4 ? [taskDetailSummary(current)] : [];\n\t\tconst height = Math.max(0, budget - (framed ? 4 : 1) - actionRow.length - compactSummary.length);\n\t\tconst selected = detail ? -1 : rows.findIndex((row) => stripVTControlCharacters(row).startsWith(\"›\"));\n\t\tthis.scroll = Math.min(this.scroll, Math.max(0, rows.length - height));\n\t\tconst selectionRows = Math.min(height, current?.kind === \"agent\" ? 3 : 2);\n\t\tconst offset = detail ? this.scroll : Math.max(0, selected + selectionRows - height);\n\t\tconst view = rows.slice(offset, offset + height);\n\t\tconst inspect = keyHintIfBound(\"app.tasks.inspect\", detail ? \"select\" : \"view\");\n\t\tconst hints = this.confirmation\n\t\t\t? \"y confirm · n/Esc keep running\"\n\t\t\t: this.navigation.focus.kind === \"stdin\"\n\t\t\t\t? \"Enter send · Esc back\"\n\t\t\t\t: this.transcriptRequested\n\t\t\t\t\t? \"↑↓ scroll · PgUp/PgDn page · ←/Esc back\"\n\t\t\t\t\t: [\n\t\t\t\t\t\t\tdetail ? \"PgUp/PgDn scroll · ↑↓ actions\" : \"↑↓ select\",\n\t\t\t\t\t\t\tinspect,\n\t\t\t\t\t\t\tcurrent && current.execution.kind !== \"settled\"\n\t\t\t\t\t\t\t\t? keyHintIfBound(\"app.tasks.cancel\", \"stop\") || (!this.configuredTaskKey(\"x\") ? \"x stop\" : \"\")\n\t\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t\t\t\"Esc back\",\n\t\t\t\t\t\t]\n\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t.join(\" · \");\n\t\tconst footer = theme.fg(\"dim\", truncateToWidth(`/tasks · ${hints}`, width));\n\t\tif (!framed)\n\t\t\treturn [...compactSummary, ...view, ...actionRow, footer]\n\t\t\t\t.map((line) => truncateToWidth(line, width))\n\t\t\t\t.slice(-Math.max(1, budget));\n\t\tconst live = this.store.backgroundTasks.filter((task) => task.execution.kind !== \"settled\").length;\n\t\tconst title =\n\t\t\tdetail && current\n\t\t\t\t? `${taskDisplayText(taskLabel(current))} › ${taskDisplayText(current.title)}`\n\t\t\t\t: \"Background tasks\";\n\t\tconst heading = ` ${truncateToWidth(title, Math.max(1, width - 5))} `;\n\t\tconst border = (text: string) => theme.fg(\"borderMuted\", text);\n\t\tconst frameRow = (line: string) => {\n\t\t\tconst text = truncateToWidth(line, inner);\n\t\t\treturn border(\"│ \") + text + \" \".repeat(Math.max(0, inner - visibleWidth(text))) + border(\" │\");\n\t\t};\n\t\treturn [\n\t\t\tborder(\"╭─\") + theme.bold(heading) + border(`${\"─\".repeat(Math.max(0, width - visibleWidth(heading) - 3))}╮`),\n\t\t\tframeRow(\n\t\t\t\tdetail && current\n\t\t\t\t\t? taskDetailSummary(current)\n\t\t\t\t\t: theme.fg(\"muted\", `${live} active · ${this.store.backgroundTasks.length} total`),\n\t\t\t),\n\t\t\t...view.map(frameRow),\n\t\t\t...actionRow.map(frameRow),\n\t\t\tborder(`╰${\"─\".repeat(Math.max(0, width - 2))}╯`),\n\t\t\tfooter,\n\t\t].map((line) => truncateToWidth(line, width));\n\t}\n\tprivate renderAll(width: number): string[] {\n\t\tconst task = this.selected();\n\t\tif (this.confirmation)\n\t\t\treturn new Text(\n\t\t\t\t`Cancel ${task?.title}\\nTask ${task?.ref.taskId}\\ny: confirm · n/Escape: keep running`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t).render(width);\n\t\tif (this.navigation.focus.kind === \"stdin\")\n\t\t\treturn [`Input to ${task?.title} · Escape: tasks`, ...this.input.render(width), this.status];\n\t\tif (this.transcript) return [...this.transcript.flatMap((component) => component.render(width)), this.status];\n\t\tif (this.transcriptRequested)\n\t\t\treturn [this.transcriptLoading ? \"Loading transcript…\" : this.status || \"Transcript unavailable\"];\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\treturn [\n\t\t\t\t...new TaskDetail(task, {\n\t\t\t\t\t...this.detailContent,\n\t\t\t\t\tstdinAvailable: this.stdinAvailable(),\n\t\t\t\t\tactivity: this.store.recentActivity(task.ref.taskId),\n\t\t\t\t\tactivityOmitted: this.store.activityOmitted(task.ref.taskId),\n\t\t\t\t}).renderContent(width),\n\t\t\t\tthis.status,\n\t\t\t];\n\t\t}\n\t\tconst sections = this.orderedSections();\n\t\tif (!sections.length)\n\t\t\treturn new Text(\"No background tasks.\\nBackground agents and shells will appear here.\", 0, 0).render(width);\n\t\treturn sections.flatMap((section) => [\n\t\t\t\"\",\n\t\t\ttheme.fg(\"muted\", theme.bold(`${section.title} (${section.tasks.length})`)),\n\t\t\t...section.tasks.flatMap((item) => {\n\t\t\t\tconst selected = item.ref.taskId === this.navigation.selectedTaskId;\n\t\t\t\tconst { label: state, color, icon } = taskStatusAppearance(item);\n\t\t\t\tconst status = width < 32 ? ` ${icon}` : ` ${icon} ${state}`;\n\t\t\t\tconst name = taskDisplayText(item.title || taskLabel(item));\n\t\t\t\tconst marker = selected ? \"› \" : \" \";\n\t\t\t\tconst title = marker + truncateToWidth(name, Math.max(1, width - visibleWidth(status) - 3));\n\t\t\t\tconst row = `${selected ? theme.fg(\"accent\", theme.bold(title)) : title}${\" \".repeat(Math.max(1, width - visibleWidth(title) - visibleWidth(status)))}${theme.fg(color, status)}`;\n\t\t\t\tconst metadata = [\n\t\t\t\t\t...(width < 32 ? [state] : []),\n\t\t\t\t\ttaskLabel(item),\n\t\t\t\t\ttaskMetricsText(item),\n\t\t\t\t\titem.currentAction ? `${item.currentAction.tool} ${item.currentAction.text}` : \"\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\" · \");\n\t\t\t\treturn [\n\t\t\t\t\ttruncateToWidth(row, width),\n\t\t\t\t\t...(item.kind === \"agent\" ? [theme.fg(\"dim\", truncateToWidth(` ${taskModelText(item)}`, width))] : []),\n\t\t\t\t\t...(selected ? [theme.fg(\"dim\", truncateToWidth(` ${taskDisplayText(metadata)}`, width))] : []),\n\t\t\t\t];\n\t\t\t}),\n\t\t]);\n\t}\n}\n"]}
1
+ {"version":3,"file":"task-inspector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAEN,cAAc,EACd,KAAK,EACL,UAAU,EACV,IAAI,EACJ,eAAe,EACf,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGvE,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACN,UAAU,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,SAAS,EA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K,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;gBAClL,MAAM,QAAQ,GAAG;oBAChB,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC9B,SAAS,CAAC,IAAI,CAAC;oBACf,eAAe,CAAC,IAAI,CAAC;oBACrB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;iBACjF;qBACC,MAAM,CAAC,OAAO,CAAC;qBACf,IAAI,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;oBACN,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC;oBAC3B,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;iBAChG,CAAC;YACH,CAAC,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { stripVTControlCharacters } from \"node:util\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport {\n\ttype Component,\n\tgetKeybindings,\n\tInput,\n\tmatchesKey,\n\tText,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport { taskOutputText } from \"../../../core/tasks/command-output.js\";\nimport type { OperationId, PromptRoute, TaskId } from \"../../../core/tasks/contracts.js\";\nimport type { OwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport {\n\ttaskExtensionStatuses,\n\ttaskOwnTranscriptEntries,\n\ttaskTranscriptSource,\n\twatchTaskExtensionStatuses,\n} from \"../../../core/tasks/supervisor.js\";\nimport { readTaskTranscriptSnapshot } from \"../../../core/tasks/transcript.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { chatEntriesFromAgentMessages, renderChatMessageEntry } from \"./chat-message-renderer.ts\";\nimport { mouseWheelDeltaRows } from \"./chat-transcript.js\";\nimport { renderExtensionStatusRow } from \"./footer.ts\";\nimport { keyHintIfBound } from \"./keybinding-hints.js\";\nimport {\n\tTaskDetail,\n\ttype TaskDetailContent,\n\ttaskDetailActions,\n\ttaskDetailLabels,\n\ttaskDetailSummary,\n} from \"./task-detail.js\";\nimport { type TaskListSection, taskListSections } from \"./task-list.js\";\nimport { TaskLiveTranscript } from \"./task-live-transcript.js\";\nimport { TaskNavigation } from \"./task-navigation.js\";\nimport { taskDisplayText, taskLabel, taskMetricsText, taskModelText, taskStatusAppearance } from \"./task-row.js\";\n\n/** Focused view only. The store and original session remain the authorities. */\nexport class TaskInspector implements Component {\n\treadonly navigation: TaskNavigation;\n\tprivate actionIndex = 0;\n\tprivate confirmation?: (answer: boolean) => void;\n\tprivate transcript?: Component[];\n\tprivate liveTranscript?: TaskLiveTranscript;\n\tprivate transcriptRefreshPending = false;\n\tprivate transcriptRequested = false;\n\tprivate transcriptLoading = false;\n\tprivate transcriptHistorical = false;\n\tprivate transcriptPageRows = 5;\n\tprivate cursor?: string;\n\tprivate status = \"\";\n\tprivate scroll = 0;\n\tprivate detailContent: Omit<TaskDetailContent, \"stdinAvailable\"> = {};\n\tprivate detailTaskId?: TaskId;\n\tprivate detailGeneration = 0;\n\tprivate disposed = false;\n\tprivate statusWatch?: { taskId: TaskId; release: () => void };\n\tprivate readonly input = new Input();\n\tprivate readonly unsubscribe: () => void;\n\tconstructor(\n\t\tprivateStore: OwnerTaskStore,\n\t\tprivateRender: () => void,\n\t\tprivateClose: () => void,\n\t\topenQuestion?: (route: PromptRoute) => void,\n\t) {\n\t\tthis.store = privateStore;\n\t\tthis.requestRender = privateRender;\n\t\tthis.close = privateClose;\n\t\tthis.navigation = new TaskNavigation(getKeybindings() as KeybindingsManager, {\n\t\t\tinspect: () => {\n\t\t\t\tthis.releaseLiveTranscript();\n\t\t\t\tthis.actionIndex = 0;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tthis.transcript = undefined;\n\t\t\t\tthis.transcriptRequested = false;\n\t\t\t\tthis.transcriptLoading = false;\n\t\t\t\tthis.transcriptHistorical = false;\n\t\t\t\tvoid this.loadDetail();\n\t\t\t},\n\t\t\ttranscript: () => {\n\t\t\t\tthis.detailGeneration++;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tvoid this.loadTranscript();\n\t\t\t},\n\t\t\tforeground: (task) => {\n\t\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\t\tif (lease.ok)\n\t\t\t\t\tvoid this.store.supervisor.foregroundTask(lease.value).then((result) => {\n\t\t\t\t\t\tthis.status = result.ok ? result.value.kind : result.error.message;\n\t\t\t\t\t\tthis.requestRender();\n\t\t\t\t\t});\n\t\t\t},\n\t\t\tconfirmCancel: () =>\n\t\t\t\tnew Promise<boolean>((resolve) => {\n\t\t\t\t\tthis.confirmation = resolve;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t}),\n\t\t\tcancel: (task) => {\n\t\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\t\tif (lease.ok) void this.store.supervisor.cancelTask(lease.value, \"user\").then(() => this.requestRender());\n\t\t\t},\n\t\t\tstdinAvailable: (task) => {\n\t\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\t\treturn lease.ok && this.store.supervisor.taskStdin(lease.value).ok;\n\t\t\t},\n\t\t\tinput: () => {\n\t\t\t\tthis.input.setValue(\"\");\n\t\t\t},\n\t\t\topenQuestion: (route) => {\n\t\t\t\tif (openQuestion) {\n\t\t\t\t\tthis.close();\n\t\t\t\t\topenQuestion(route);\n\t\t\t\t} else this.status = \"Question is available in its owning session.\";\n\t\t\t},\n\t\t});\n\t\tthis.unsubscribe = this.store.subscribe(() => {\n\t\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\t\tif (this.transcriptRequested) {\n\t\t\t\tthis.refreshTranscript();\n\t\t\t} else if (this.navigation.focus.kind === \"detail\") void this.loadDetail();\n\t\t\tthis.requestRender();\n\t\t});\n\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\tthis.navigation.open();\n\t\tthis.input.onSubmit = (text) => {\n\t\t\tvoid this.sendInput(text);\n\t\t};\n\t}\n\tprivate readonly store: OwnerTaskStore;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly close: () => void;\n\topen(id?: TaskId): void {\n\t\tthis.navigation.open(id);\n\t}\n\tprivate orderedSections(): TaskListSection[] {\n\t\treturn taskListSections(this.store.backgroundTasks, this.store.settlementOrder);\n\t}\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.releaseStatusWatch();\n\t\tthis.releaseLiveTranscript();\n\t\tthis.confirmation?.(false);\n\t\tthis.unsubscribe();\n\t}\n\tinvalidate(): void {\n\t\tfor (const component of this.transcript ?? []) component.invalidate();\n\t}\n\tprivate selected() {\n\t\treturn this.store.backgroundTasks.find((task) => task.ref.taskId === this.navigation.selectedTaskId);\n\t}\n\tprivate stdinAvailable(): boolean {\n\t\tconst task = this.selected();\n\t\tif (!task || task.execution.kind === \"settled\") return false;\n\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\treturn lease.ok && this.store.supervisor.taskStdin(lease.value).ok;\n\t}\n\tprivate async sendInput(text: string): Promise<void> {\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\tif (!lease.ok) return;\n\t\tconst stdin = this.store.supervisor.taskStdin(lease.value);\n\t\tif (!stdin.ok) {\n\t\t\tthis.status = stdin.error.message;\n\t\t\treturn;\n\t\t}\n\t\tconst result = await this.store.supervisor.writeTaskInput(stdin.value, randomUUID() as OperationId, {\n\t\t\tkind: \"bytes\",\n\t\t\tbytes: Buffer.from(`${text}\\n`),\n\t\t});\n\t\tthis.status = result.ok ? `Sent ${result.value.acceptedBytes} bytes` : result.error.message;\n\t\tthis.input.setValue(\"\");\n\t\tthis.requestRender();\n\t}\n\tprivate releaseStatusWatch(): void {\n\t\tthis.statusWatch?.release();\n\t\tthis.statusWatch = undefined;\n\t}\n\t/**\n\t * The selected task's own extension statuses, as the row under its fullscreen page's footer. The\n\t * compact picker and confirmation page show none. A write repaints the page while it is shown.\n\t */\n\tprivate taskStatusRows(width: number): string[] {\n\t\tconst task = this.navigation.focus.kind === \"detail\" && !this.confirmation ? this.selected() : undefined;\n\t\tconst lease = task?.kind === \"agent\" ? this.store.resolveTask(task.ref.taskId) : undefined;\n\t\tif (!task || !lease?.ok) {\n\t\t\tthis.releaseStatusWatch();\n\t\t\treturn [];\n\t\t}\n\t\tif (this.statusWatch?.taskId !== task.ref.taskId) {\n\t\t\tthis.releaseStatusWatch();\n\t\t\tthis.statusWatch = {\n\t\t\t\ttaskId: task.ref.taskId,\n\t\t\t\trelease: watchTaskExtensionStatuses(lease.value, () => this.requestRender()),\n\t\t\t};\n\t\t}\n\t\tconst row = renderExtensionStatusRow(taskExtensionStatuses(lease.value), width);\n\t\treturn row === undefined ? [] : [row];\n\t}\n\tprivate releaseLiveTranscript(): void {\n\t\tthis.liveTranscript?.dispose();\n\t\tthis.liveTranscript = undefined;\n\t\tthis.transcriptRefreshPending = false;\n\t}\n\tprivate refreshTranscript(): void {\n\t\tif (this.disposed || !this.transcriptRequested) return;\n\t\tconst task = this.selected();\n\t\tconst lease = task && this.store.resolveTask(task.ref.taskId);\n\t\tconst bound = lease?.ok ? taskTranscriptSource(lease.value) : undefined;\n\t\tif (bound?.ok && this.liveTranscript?.source === bound.value.session) return;\n\t\t// Legacy history-only sources have no live tail; keep their retained page anchored.\n\t\tif (bound?.ok && !bound.value.session.subscribe && this.transcriptHistorical) return;\n\t\tif (this.transcriptLoading) this.transcriptRefreshPending = true;\n\t\telse void this.loadTranscript();\n\t}\n\tprivate async loadTranscript(earlier = false): Promise<void> {\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst generation = ++this.detailGeneration;\n\t\tconst focus = this.navigation.focus;\n\t\tthis.transcriptRequested = true;\n\t\tthis.transcriptLoading = true;\n\t\tif (earlier) this.transcriptHistorical = true;\n\t\tthis.requestRender();\n\t\ttry {\n\t\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\t\tif (!lease.ok) {\n\t\t\t\tthis.status = lease.error.message;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (task.kind === \"command\") {\n\t\t\t\tconst count = BigInt(task.output.byteCount);\n\t\t\t\tconst page = await this.store.supervisor.readTaskOutput(lease.value, {\n\t\t\t\t\tstart: String(count > 8192n ? count - 8192n : 0n),\n\t\t\t\t\tmaximumBytes: 8192,\n\t\t\t\t});\n\t\t\t\tif (\n\t\t\t\t\tthis.disposed ||\n\t\t\t\t\tgeneration !== this.detailGeneration ||\n\t\t\t\t\tfocus !== this.navigation.focus ||\n\t\t\t\t\ttask.ref.taskId !== this.navigation.selectedTaskId\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tconst text = page.ok ? taskOutputText(page.value) : page.error.message;\n\t\t\t\tthis.transcript = [\n\t\t\t\t\tnew Text(text.split(\"\\n\").map(taskDisplayText).join(\"\\n\") || \"No output available\", 0, 0),\n\t\t\t\t];\n\t\t\t\tthis.cursor = undefined;\n\t\t\t\tthis.status =\n\t\t\t\t\tcount > 8192n ? \"Earlier output omitted · showing retained 8 KiB tail\" : \"Retained shell output\";\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst page = readTaskTranscriptSnapshot(lease.value, earlier ? this.cursor : undefined);\n\t\t\tif (\n\t\t\t\tthis.disposed ||\n\t\t\t\tgeneration !== this.detailGeneration ||\n\t\t\t\tfocus !== this.navigation.focus ||\n\t\t\t\ttask.ref.taskId !== this.navigation.selectedTaskId\n\t\t\t)\n\t\t\t\treturn;\n\t\t\tconst bound = taskTranscriptSource(lease.value);\n\t\t\tif (!bound.ok || (!page.ok && !bound.value.session.subscribe)) {\n\t\t\t\tthis.status = \"Transcript unavailable\";\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst ids = new Set(page.ok ? page.value.items.map((item) => item.source.entryId) : []);\n\t\t\tconst messages = bound.value.session.getEntries().flatMap<AgentMessage>((entry) => {\n\t\t\t\tif (entry.type !== \"message\" || !ids.has(entry.id)) return [];\n\t\t\t\tconst message = entry.message;\n\t\t\t\tif (message.role === \"assistant\")\n\t\t\t\t\treturn [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...message,\n\t\t\t\t\t\t\tcontent: message.content.filter(\n\t\t\t\t\t\t\t\t(block, index) =>\n\t\t\t\t\t\t\t\t\tblock.type !== \"thinking\" &&\n\t\t\t\t\t\t\t\t\tpage.ok &&\n\t\t\t\t\t\t\t\t\tpage.value.items.some(\n\t\t\t\t\t\t\t\t\t\t(item) => item.source.entryId === entry.id && item.source.contentIndex === index,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\treturn message.role === \"user\" || message.role === \"toolResult\" ? [message] : [];\n\t\t\t});\n\t\t\tconst components = chatEntriesFromAgentMessages(messages).map((entry) =>\n\t\t\t\trenderChatMessageEntry(entry, {\n\t\t\t\t\tui: { requestRender: this.requestRender },\n\t\t\t\t\tcwd: process.cwd(),\n\t\t\t\t\thideThinkingBlock: true,\n\t\t\t\t\ttoolOutputExpanded: true,\n\t\t\t\t\tshowImages: false,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (!earlier && bound.value.session.subscribe) {\n\t\t\t\tthis.releaseLiveTranscript();\n\t\t\t\tthis.liveTranscript = new TaskLiveTranscript(bound.value.session, messages, this.requestRender);\n\t\t\t\tthis.transcript = [this.liveTranscript];\n\t\t\t} else this.transcript = earlier ? [...components, ...(this.transcript ?? [])] : components;\n\t\t\tthis.cursor = page.ok ? page.value.nextCursor : undefined;\n\t\t\tthis.status = this.cursor ? \"PageUp: earlier retained messages\" : \"\";\n\t\t\tthis.requestRender();\n\t\t} catch {\n\t\t\tif (!this.disposed && generation === this.detailGeneration && focus === this.navigation.focus) {\n\t\t\t\tthis.transcript = [];\n\t\t\t\tthis.status = \"Task output unavailable\";\n\t\t\t\tthis.requestRender();\n\t\t\t}\n\t\t} finally {\n\t\t\tif (generation === this.detailGeneration) {\n\t\t\t\tthis.transcriptLoading = false;\n\t\t\t\tif (this.transcriptRefreshPending) {\n\t\t\t\t\tthis.transcriptRefreshPending = false;\n\t\t\t\t\tthis.refreshTranscript();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprivate async loadDetail(): Promise<void> {\n\t\tconst selectedId = this.selected()?.ref.taskId;\n\t\tif (selectedId !== this.detailTaskId) {\n\t\t\tthis.detailContent = {};\n\t\t\tthis.detailTaskId = selectedId;\n\t\t}\n\t\tthis.status = \"\";\n\t\tconst generation = ++this.detailGeneration;\n\t\tconst focus = this.navigation.focus;\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst current = () =>\n\t\t\t!this.disposed &&\n\t\t\tgeneration === this.detailGeneration &&\n\t\t\tthis.navigation.focus === focus &&\n\t\t\tfocus.kind === \"detail\" &&\n\t\t\tthis.navigation.selectedTaskId === task.ref.taskId;\n\t\tconst lease = this.store.resolveTask(task.ref.taskId);\n\t\tif (!lease.ok) return;\n\t\tconst ownEntries = taskOwnTranscriptEntries(lease.value);\n\t\tif (ownEntries) {\n\t\t\tconst prompt = ownEntries.find((entry) => entry.type === \"message\" && entry.message.role === \"user\");\n\t\t\tif (prompt?.type === \"message\" && prompt.message.role === \"user\")\n\t\t\t\tthis.detailContent.prompt =\n\t\t\t\t\ttypeof prompt.message.content === \"string\"\n\t\t\t\t\t\t? prompt.message.content\n\t\t\t\t\t\t: prompt.message.content\n\t\t\t\t\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t\t\t\t\t.map((block) => block.text)\n\t\t\t\t\t\t\t\t.join(\"\");\n\t\t\tconst response = ownEntries\n\t\t\t\t.slice()\n\t\t\t\t.reverse()\n\t\t\t\t.find((entry) => entry.type === \"message\" && entry.message.role === \"assistant\");\n\t\t\tif (response?.type === \"message\" && response.message.role === \"assistant\")\n\t\t\t\tthis.detailContent.output = response.message.content\n\t\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t\t.map((block) => block.text)\n\t\t\t\t\t.join(\"\");\n\t\t}\n\t\tif (task.kind === \"command\") {\n\t\t\ttry {\n\t\t\t\tconst count = BigInt(task.output.byteCount);\n\t\t\t\tconst output = await this.store.supervisor.readTaskOutput(lease.value, {\n\t\t\t\t\tstart: String(count > 8192n ? count - 8192n : 0n),\n\t\t\t\t\tmaximumBytes: 8192,\n\t\t\t\t});\n\t\t\t\tif (!current()) return;\n\t\t\t\tif (output.ok) {\n\t\t\t\t\tthis.detailContent.output = taskOutputText(output.value);\n\t\t\t\t\tthis.detailContent.outputOmitted = count > 8192n || output.value.omittedRanges.length > 0;\n\t\t\t\t} else this.status = output.error.message;\n\t\t\t} catch {\n\t\t\t\tif (!current()) return;\n\t\t\t\tthis.status = \"Command output unavailable\";\n\t\t\t}\n\t\t}\n\t\tif (current()) this.requestRender();\n\t}\n\thandleInput(data: string): boolean {\n\t\tif (this.confirmation) {\n\t\t\tif (data === \"y\" || data === \"n\" || matchesKey(data, \"escape\")) {\n\t\t\t\tconst answer = this.confirmation;\n\t\t\t\tthis.confirmation = undefined;\n\t\t\t\tanswer(data === \"y\");\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tconst wheel = mouseWheelDeltaRows(data);\n\t\tif (wheel !== 0) {\n\t\t\tif (this.navigation.focus.kind === \"tasks\") this.navigation.moveSelection(Math.sign(wheel));\n\t\t\telse if (this.navigation.focus.kind === \"detail\") {\n\t\t\t\tif (this.transcriptRequested && wheel < 0 && this.scroll === 0 && this.cursor && !this.transcriptLoading)\n\t\t\t\t\tvoid this.loadTranscript(true);\n\t\t\t\telse this.scroll = Math.max(0, this.scroll + wheel);\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\t// Mouse reports are never text input, including horizontal wheel/release.\n\t\tif (/^\\x1b\\[<\\d+;\\d+;\\d+[mM]$/.test(data) || data.startsWith(\"\\x1b[M\")) return true;\n\t\tif (\n\t\t\tmatchesKey(data, \"escape\") ||\n\t\t\t(matchesKey(data, \"left\") && this.navigation.focus.kind !== \"stdin\" && !this.configuredTaskKey(data))\n\t\t) {\n\t\t\tif (this.transcriptRequested) {\n\t\t\t\tthis.releaseLiveTranscript();\n\t\t\t\tthis.detailGeneration++;\n\t\t\t\tthis.transcript = undefined;\n\t\t\t\tthis.transcriptRequested = false;\n\t\t\t\tthis.transcriptLoading = false;\n\t\t\t\tthis.transcriptHistorical = false;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tvoid this.loadDetail();\n\t\t\t} else {\n\t\t\t\tthis.navigation.handleInput(\"\\x1b\", \"tasks\");\n\t\t\t\tif (this.navigation.focus.kind === \"composer\") this.close();\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.navigation.focus.kind === \"stdin\") {\n\t\t\tthis.input.handleInput(data);\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"x\" && !this.configuredTaskKey(data)) {\n\t\t\tvoid this.navigation.activate(\"cancel\");\n\t\t\treturn true;\n\t\t}\n\t\tif (this.transcriptRequested) {\n\t\t\tif (this.configuredTaskKey(data)) this.navigation.handleInput(data, \"tasks\");\n\t\t\telse if (matchesKey(data, \"up\")) this.scroll = Math.max(0, this.scroll - 1);\n\t\t\telse if (matchesKey(data, \"down\")) this.scroll++;\n\t\t\telse if (matchesKey(data, \"pageUp\")) {\n\t\t\t\tif (this.scroll === 0 && this.cursor && !this.transcriptLoading) void this.loadTranscript(true);\n\t\t\t\telse this.scroll = Math.max(0, this.scroll - this.transcriptPageRows);\n\t\t\t} else if (matchesKey(data, \"pageDown\")) this.scroll += this.transcriptPageRows;\n\t\t\telse if (matchesKey(data, \"home\")) this.scroll = 0;\n\t\t\telse if (matchesKey(data, \"end\")) this.scroll = Number.MAX_SAFE_INTEGER;\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tconst task = this.selected();\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\tconst actions = taskDetailActions(task.execution, task.attention, this.stdinAvailable());\n\t\t\tif (this.configuredTaskKey(data)) {\n\t\t\t\tif (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\t\telse this.navigation.handleInput(data, \"tasks\");\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"pageUp\") || matchesKey(data, \"pageDown\")) {\n\t\t\t\tthis.scroll = Math.max(0, this.scroll + (matchesKey(data, \"pageUp\") ? -5 : 5));\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"up\")) this.actionIndex = Math.max(0, this.actionIndex - 1);\n\t\t\telse if (matchesKey(data, \"down\")) this.actionIndex = Math.min(actions.length - 1, this.actionIndex + 1);\n\t\t\telse if (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\telse if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\t} else if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\tthis.requestRender();\n\t\treturn true;\n\t}\n\tprivate configuredTaskKey(data: string): boolean {\n\t\treturn ([\"app.tasks.inspect\", \"app.tasks.foreground\", \"app.tasks.cancel\", \"app.tasks.input\"] as const).some(\n\t\t\t(key) => getKeybindings().matches(data, key),\n\t\t);\n\t}\n\t/** Only the task picker stays inline; drill-down and confirmation own the screen. */\n\tget fullscreen(): boolean {\n\t\treturn (\n\t\t\tthis.confirmation !== undefined ||\n\t\t\tthis.navigation.focus.kind === \"detail\" ||\n\t\t\tthis.navigation.focus.kind === \"stdin\"\n\t\t);\n\t}\n\trenderPicker(width: number, availableRows: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(1, Math.min(12, availableRows)));\n\t}\n\trender(width: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(3, (process.stdout.rows || 24) - 5));\n\t}\n\tprivate renderTranscriptViewport(width: number, budget: number): string[] {\n\t\tconst task = this.selected();\n\t\tconst statusRows = this.taskStatusRows(width);\n\t\tconst room = Math.max(1, budget - 5 - statusRows.length);\n\t\tthis.transcriptPageRows = room;\n\t\tconst rows = this.transcript?.flatMap((component) => component.render(width)) ?? [\n\t\t\tthis.transcriptLoading ? \"Loading transcript…\" : this.status,\n\t\t];\n\t\tthis.scroll = Math.min(this.scroll, Math.max(0, rows.length - room));\n\t\tconst visible = rows.slice(this.scroll, this.scroll + room);\n\t\t// Transcript tools own their backgrounds. Keep them out of a nested box,\n\t\t// strip terminal movement, and reset styles at every viewport row boundary.\n\t\tconst safeLine = (line: string) =>\n\t\t\tline\n\t\t\t\t.split(/(\\x1b\\[[0-9;:]*m)/g)\n\t\t\t\t.map((part, index) =>\n\t\t\t\t\tindex % 2 ? part : stripVTControlCharacters(part).replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, \" \"),\n\t\t\t\t)\n\t\t\t\t.join(\"\");\n\t\tconst fit = (line: string) => truncateToWidth(safeLine(line), Math.max(1, width)) + \"\\x1b[0m\";\n\t\treturn [\n\t\t\ttheme.bold(`Transcript · ${task ? taskDisplayText(taskLabel(task)) : \"Task\"}`),\n\t\t\ttask ? taskDetailSummary(task) : \"\",\n\t\t\ttheme.fg(\"borderMuted\", \"─\".repeat(Math.max(0, width))),\n\t\t\t...visible,\n\t\t\t...Array.from({ length: Math.max(0, room - visible.length) }, () => \"\"),\n\t\t\ttheme.fg(\n\t\t\t\t\"dim\",\n\t\t\t\t`Lines ${rows.length ? this.scroll + 1 : 0}–${Math.min(rows.length, this.scroll + room)} of ${rows.length}${this.cursor ? \" · PgUp at top: earlier history\" : \"\"}${this.status ? ` · ${this.status}` : \"\"}`,\n\t\t\t),\n\t\t\ttheme.fg(\"dim\", \"↑↓ scroll · PgUp/PgDn page · Home/End · ←/Esc back\"),\n\t\t\t...statusRows,\n\t\t]\n\t\t\t.map(fit)\n\t\t\t.slice(0, Math.max(1, budget));\n\t}\n\trenderViewport(width: number, budget: number): string[] {\n\t\tif (this.transcriptRequested && !this.confirmation && this.navigation.focus.kind === \"detail\")\n\t\t\treturn this.renderTranscriptViewport(width, budget);\n\t\tconst framed = width >= 20 && budget >= 7;\n\t\tconst inner = Math.max(1, width - (framed ? 4 : 0));\n\t\tconst current = this.selected();\n\t\tconst detail = this.navigation.focus.kind === \"detail\";\n\t\tconst selectingAction = current && detail && !this.transcriptRequested && !this.confirmation;\n\t\tconst actions = selectingAction\n\t\t\t? taskDetailActions(current.execution, current.attention, this.stdinAvailable())\n\t\t\t: [];\n\t\tthis.actionIndex = Math.max(0, Math.min(this.actionIndex, actions.length - 1));\n\t\tconst action = actions[this.actionIndex];\n\t\tconst actionRow = action ? [theme.fg(\"accent\", `› ${taskDetailLabels[action]}`)] : [];\n\t\tconst rows = this.renderAll(inner);\n\t\tconst compactSummary = !framed && detail && current && budget >= 4 ? [taskDetailSummary(current)] : [];\n\t\tconst statusRows = this.taskStatusRows(width);\n\t\tconst height = Math.max(\n\t\t\t0,\n\t\t\tbudget - (framed ? 4 : 1) - actionRow.length - compactSummary.length - statusRows.length,\n\t\t);\n\t\tconst selected = detail ? -1 : rows.findIndex((row) => stripVTControlCharacters(row).startsWith(\"›\"));\n\t\tthis.scroll = Math.min(this.scroll, Math.max(0, rows.length - height));\n\t\tconst selectionRows = Math.min(height, current?.kind === \"agent\" ? 3 : 2);\n\t\tconst offset = detail ? this.scroll : Math.max(0, selected + selectionRows - height);\n\t\tconst view = rows.slice(offset, offset + height);\n\t\tconst inspect = keyHintIfBound(\"app.tasks.inspect\", detail ? \"select\" : \"view\");\n\t\tconst hints = this.confirmation\n\t\t\t? \"y confirm · n/Esc keep running\"\n\t\t\t: this.navigation.focus.kind === \"stdin\"\n\t\t\t\t? \"Enter send · Esc back\"\n\t\t\t\t: this.transcriptRequested\n\t\t\t\t\t? \"↑↓ scroll · PgUp/PgDn page · ←/Esc back\"\n\t\t\t\t\t: [\n\t\t\t\t\t\t\tdetail ? \"PgUp/PgDn scroll · ↑↓ actions\" : \"↑↓ select\",\n\t\t\t\t\t\t\tinspect,\n\t\t\t\t\t\t\tcurrent && current.execution.kind !== \"settled\"\n\t\t\t\t\t\t\t\t? keyHintIfBound(\"app.tasks.cancel\", \"stop\") || (!this.configuredTaskKey(\"x\") ? \"x stop\" : \"\")\n\t\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t\t\t\"Esc back\",\n\t\t\t\t\t\t]\n\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t.join(\" · \");\n\t\tconst footer = theme.fg(\"dim\", truncateToWidth(`/tasks · ${hints}`, width));\n\t\tif (!framed)\n\t\t\treturn [...compactSummary, ...view, ...actionRow, footer, ...statusRows]\n\t\t\t\t.map((line) => truncateToWidth(line, width))\n\t\t\t\t.slice(-Math.max(1, budget));\n\t\tconst live = this.store.backgroundTasks.filter((task) => task.execution.kind !== \"settled\").length;\n\t\tconst title =\n\t\t\tdetail && current\n\t\t\t\t? `${taskDisplayText(taskLabel(current))} › ${taskDisplayText(current.title)}`\n\t\t\t\t: \"Background tasks\";\n\t\tconst heading = ` ${truncateToWidth(title, Math.max(1, width - 5))} `;\n\t\tconst border = (text: string) => theme.fg(\"borderMuted\", text);\n\t\tconst frameRow = (line: string) => {\n\t\t\tconst text = truncateToWidth(line, inner);\n\t\t\treturn border(\"│ \") + text + \" \".repeat(Math.max(0, inner - visibleWidth(text))) + border(\" │\");\n\t\t};\n\t\treturn [\n\t\t\tborder(\"╭─\") + theme.bold(heading) + border(`${\"─\".repeat(Math.max(0, width - visibleWidth(heading) - 3))}╮`),\n\t\t\tframeRow(\n\t\t\t\tdetail && current\n\t\t\t\t\t? taskDetailSummary(current)\n\t\t\t\t\t: theme.fg(\"muted\", `${live} active · ${this.store.backgroundTasks.length} total`),\n\t\t\t),\n\t\t\t...view.map(frameRow),\n\t\t\t...actionRow.map(frameRow),\n\t\t\tborder(`╰${\"─\".repeat(Math.max(0, width - 2))}╯`),\n\t\t\tfooter,\n\t\t\t...statusRows,\n\t\t].map((line) => truncateToWidth(line, width));\n\t}\n\tprivate renderAll(width: number): string[] {\n\t\tconst task = this.selected();\n\t\tif (this.confirmation)\n\t\t\treturn new Text(\n\t\t\t\t`Cancel ${task?.title}\\nTask ${task?.ref.taskId}\\ny: confirm · n/Escape: keep running`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t).render(width);\n\t\tif (this.navigation.focus.kind === \"stdin\")\n\t\t\treturn [`Input to ${task?.title} · Escape: tasks`, ...this.input.render(width), this.status];\n\t\tif (this.transcript) return [...this.transcript.flatMap((component) => component.render(width)), this.status];\n\t\tif (this.transcriptRequested)\n\t\t\treturn [this.transcriptLoading ? \"Loading transcript…\" : this.status || \"Transcript unavailable\"];\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\treturn [\n\t\t\t\t...new TaskDetail(task, {\n\t\t\t\t\t...this.detailContent,\n\t\t\t\t\tstdinAvailable: this.stdinAvailable(),\n\t\t\t\t\tactivity: this.store.recentActivity(task.ref.taskId),\n\t\t\t\t\tactivityOmitted: this.store.activityOmitted(task.ref.taskId),\n\t\t\t\t}).renderContent(width),\n\t\t\t\tthis.status,\n\t\t\t];\n\t\t}\n\t\tconst sections = this.orderedSections();\n\t\tif (!sections.length)\n\t\t\treturn new Text(\"No background tasks.\\nBackground agents and shells will appear here.\", 0, 0).render(width);\n\t\treturn sections.flatMap((section) => [\n\t\t\t\"\",\n\t\t\ttheme.fg(\"muted\", theme.bold(`${section.title} (${section.tasks.length})`)),\n\t\t\t...section.tasks.flatMap((item) => {\n\t\t\t\tconst selected = item.ref.taskId === this.navigation.selectedTaskId;\n\t\t\t\tconst { label: state, color, icon } = taskStatusAppearance(item);\n\t\t\t\tconst status = width < 32 ? ` ${icon}` : ` ${icon} ${state}`;\n\t\t\t\tconst name = taskDisplayText(item.title || taskLabel(item));\n\t\t\t\tconst marker = selected ? \"› \" : \" \";\n\t\t\t\tconst title = marker + truncateToWidth(name, Math.max(1, width - visibleWidth(status) - 3));\n\t\t\t\tconst row = `${selected ? theme.fg(\"accent\", theme.bold(title)) : title}${\" \".repeat(Math.max(1, width - visibleWidth(title) - visibleWidth(status)))}${theme.fg(color, status)}`;\n\t\t\t\tconst metadata = [\n\t\t\t\t\t...(width < 32 ? [state] : []),\n\t\t\t\t\ttaskLabel(item),\n\t\t\t\t\ttaskMetricsText(item),\n\t\t\t\t\titem.currentAction ? `${item.currentAction.tool} ${item.currentAction.text}` : \"\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\" · \");\n\t\t\t\treturn [\n\t\t\t\t\ttruncateToWidth(row, width),\n\t\t\t\t\t...(item.kind === \"agent\" ? [theme.fg(\"dim\", truncateToWidth(` ${taskModelText(item)}`, width))] : []),\n\t\t\t\t\t...(selected ? [theme.fg(\"dim\", truncateToWidth(` ${taskDisplayText(metadata)}`, width))] : []),\n\t\t\t\t];\n\t\t\t}),\n\t\t]);\n\t}\n}\n"]}
@@ -156,6 +156,8 @@ Agent rows and completion cards show the resolved model and reasoning setting, f
156
156
 
157
157
  Agent details include recent retained tool activity, the prompt, a latest-response preview, and error or attention information. Transcript inspection uses a dedicated scrolling view with a pinned title, line position, and controls, rather than nesting full chat components inside a detail box. It renders retained messages and tool results without hidden reasoning or inline images. Earlier pages do not jump back to the latest page when background activity arrives.
158
158
 
159
+ An agent's detail and transcript pages end with a status row for that task's own extension status lines, such as a tokens-per-second counter set by an extension the subagent loaded. It updates live, is separate from the chat's own status row, and disappears when the task ends. The compact picker and shell pages show none.
160
+
159
161
  An open live transcript updates directly from the child's session events, including streaming assistant text and partial/final tool results. Shell output refreshes on task state updates, including updates received during an earlier output read. You do not need to leave and reopen the transcript. Reading earlier retained pages keeps your position while the live tail continues updating.
160
162
 
161
163
  Shell details show the command, available exit information, and a bounded output tail. The preview shows up to ten wrapped lines from the retained 8 KiB tail. Output gaps and omitted earlier content are labelled. An empty output stream says **No output available**. Shell transcript inspection exposes the retained tail, not an invented agent conversation or an unlimited log viewer.