@e4779/pi-fabric 0.116.0-fork.26 → 0.117.2-fork.29

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 (179) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -2
  2. package/dist/agents.js +3 -3
  3. package/dist/chunks/{chunk-HZGQ7XYM.js → chunk-3FJUP3GV.js} +2 -2
  4. package/dist/chunks/{chunk-U2UBUKNQ.js → chunk-3UGN25XS.js} +2 -2
  5. package/dist/chunks/{chunk-HITKWKYD.js → chunk-4EW7GVUR.js} +192 -326
  6. package/dist/chunks/chunk-4EW7GVUR.js.map +7 -0
  7. package/dist/chunks/{chunk-VR2LV4CA.js → chunk-53N2I4QA.js} +2 -2
  8. package/dist/chunks/{chunk-IQXNJNDI.js → chunk-5UBRGTVN.js} +8 -8
  9. package/dist/chunks/{chunk-4GNFBZPR.js → chunk-ASSLHWZS.js} +2 -2
  10. package/dist/chunks/{chunk-DLXPTBPL.js → chunk-AV36PBKH.js} +9 -1
  11. package/dist/chunks/chunk-AV36PBKH.js.map +7 -0
  12. package/dist/chunks/chunk-BN7F52EG.js +525 -0
  13. package/dist/chunks/chunk-BN7F52EG.js.map +7 -0
  14. package/dist/chunks/{chunk-QGP7AY2R.js → chunk-C7Z6F3SO.js} +2 -2
  15. package/dist/chunks/{chunk-56RFFBBO.js → chunk-CRRUW26I.js} +12 -12
  16. package/dist/chunks/{chunk-I2TK65VR.js → chunk-D5NYNIST.js} +5 -5
  17. package/dist/chunks/{chunk-KBYSGB7E.js → chunk-EFETPXU2.js} +69 -229
  18. package/dist/chunks/chunk-EFETPXU2.js.map +7 -0
  19. package/dist/chunks/{chunk-QQ7D6UAM.js → chunk-EHQQ4KCX.js} +2 -2
  20. package/dist/chunks/{chunk-7EYJE4TW.js → chunk-EKODKR6Y.js} +55 -6
  21. package/dist/chunks/chunk-EKODKR6Y.js.map +7 -0
  22. package/dist/chunks/{chunk-ODYU3IJU.js → chunk-FE6NOAO7.js} +5 -5
  23. package/dist/chunks/{chunk-ODYU3IJU.js.map → chunk-FE6NOAO7.js.map} +2 -2
  24. package/dist/chunks/{chunk-H3SGA7G7.js → chunk-FIDUHKMM.js} +5 -5
  25. package/dist/chunks/{chunk-4GGBND7V.js → chunk-FSYAGCGA.js} +2 -2
  26. package/dist/chunks/{chunk-ZPI4QTOX.js → chunk-FUY6XVRX.js} +2 -2
  27. package/dist/chunks/{chunk-A5XF3ZPJ.js → chunk-G4TLWHRS.js} +2 -2
  28. package/dist/chunks/{chunk-PTZ5DKAB.js → chunk-G54PEZ44.js} +4 -3
  29. package/dist/chunks/chunk-G54PEZ44.js.map +7 -0
  30. package/dist/chunks/{chunk-7C5IEIQK.js → chunk-GEQMQVNS.js} +2 -2
  31. package/dist/chunks/{chunk-DONS3EZH.js → chunk-GIK2WNAK.js} +2 -2
  32. package/dist/chunks/{chunk-MOJBW5X2.js → chunk-GO32KSEZ.js} +5 -3
  33. package/dist/chunks/chunk-GO32KSEZ.js.map +7 -0
  34. package/dist/chunks/{chunk-HQ5YW2OJ.js → chunk-HP5P7NBO.js} +2 -2
  35. package/dist/chunks/{chunk-R2MMPHR2.js → chunk-INRXG4J5.js} +2 -2
  36. package/dist/chunks/{chunk-BQWJ5ZR7.js → chunk-K7J2ABAZ.js} +3 -3
  37. package/dist/chunks/{chunk-OTHMEDN6.js → chunk-KVYNGDGC.js} +6 -6
  38. package/dist/chunks/{chunk-6EVAHJAR.js → chunk-LEU5CDSL.js} +3 -3
  39. package/dist/chunks/{chunk-V2IV4LYW.js → chunk-LNASO4VT.js} +3 -3
  40. package/dist/chunks/{chunk-HCNHKJDA.js → chunk-MLLYR3Y6.js} +2 -2
  41. package/dist/chunks/{chunk-D3W6CBJZ.js → chunk-MZUC6LLH.js} +4 -4
  42. package/dist/chunks/{chunk-D3IONBBJ.js → chunk-P7CBPPHY.js} +5 -5
  43. package/dist/chunks/{chunk-WQ6LC2KK.js → chunk-QT4W5YVB.js} +2 -2
  44. package/dist/chunks/{chunk-TNPZBMYC.js → chunk-ROTCDDOV.js} +4 -4
  45. package/dist/chunks/{chunk-PH4PT6R4.js → chunk-TIIIHPHF.js} +2 -2
  46. package/dist/chunks/{chunk-2YG4ZA2K.js → chunk-TIJ3YQXX.js} +2 -2
  47. package/dist/chunks/{chunk-QCCPR3U5.js → chunk-UOM37PE4.js} +4 -4
  48. package/dist/chunks/{chunk-EQYQICUY.js → chunk-UXIBKMUM.js} +3 -3
  49. package/dist/chunks/{chunk-O7IREHJI.js → chunk-XCEEQ5AB.js} +318 -39
  50. package/dist/chunks/chunk-XCEEQ5AB.js.map +7 -0
  51. package/dist/chunks/{chunk-JV4JR6TT.js → chunk-ZEXCKK4K.js} +3 -3
  52. package/dist/cli/decisions.js +1 -1
  53. package/dist/cli/mesh.js +2 -2
  54. package/dist/commands/fabric.d.ts.map +1 -1
  55. package/dist/compaction/hook.js +6 -6
  56. package/dist/compaction/owner.js +7 -7
  57. package/dist/components/configuration.js +4 -4
  58. package/dist/core/action-registry.js +6 -6
  59. package/dist/core/provider-operations.js +53 -154
  60. package/dist/core/provider-operations.js.map +2 -2
  61. package/dist/durable.js +2 -2
  62. package/dist/durable.js.map +1 -1
  63. package/dist/entropy/index.js +8 -8
  64. package/dist/extension-bootstrap.js +16 -16
  65. package/dist/fabric-runtime-state.js +42 -42
  66. package/dist/index.js +20 -20
  67. package/dist/jev/client.js +3 -3
  68. package/dist/jev/decision-types.d.ts +16 -0
  69. package/dist/jev/decision-types.d.ts.map +1 -1
  70. package/dist/jev/guest-types.d.ts +1 -1
  71. package/dist/jev/guest-types.d.ts.map +1 -1
  72. package/dist/jev/observation.js +7 -7
  73. package/dist/jev/routes.d.ts +1 -1
  74. package/dist/jev/routes.d.ts.map +1 -1
  75. package/dist/jev.js +12 -12
  76. package/dist/memory/digest.js +2 -2
  77. package/dist/memory/discovery.js +6 -6
  78. package/dist/memory/file-worker.js +9 -9
  79. package/dist/memory/normalize.js +5 -5
  80. package/dist/memory/search.js +7 -7
  81. package/dist/memory/worker-provider.js +10 -10
  82. package/dist/memory.js +10 -10
  83. package/dist/providers/jev-provider.js +12 -12
  84. package/dist/providers/memory-provider.js +9 -9
  85. package/dist/residency/host.js +12 -12
  86. package/dist/residency/pi-entry.js +12 -12
  87. package/dist/runtime/core-override-guest-types.js +2 -2
  88. package/dist/runtime/guest-types.d.ts +1 -1
  89. package/dist/runtime/guest-types.d.ts.map +1 -1
  90. package/dist/runtime/guest-types.js +1 -1
  91. package/dist/runtime/monty-runtime.js +3 -3
  92. package/dist/runtime/typescript-kernel.js +2 -2
  93. package/dist/type-error-guidance.js +1 -1
  94. package/dist/ui/controller.d.ts +2 -0
  95. package/dist/ui/controller.d.ts.map +1 -1
  96. package/dist/ui/conversation.js +1 -1
  97. package/dist/ui/dashboard-detail.d.ts.map +1 -1
  98. package/dist/ui/dashboard.js +6 -5
  99. package/dist/ui/dashboard.js.map +2 -2
  100. package/dist/ui/settings.js +3 -3
  101. package/dist/ui/transcript-parser.d.ts.map +1 -1
  102. package/dist/ui/transcript-reader.d.ts +1 -0
  103. package/dist/ui/transcript-reader.d.ts.map +1 -1
  104. package/dist/ui/transcript-sanitization.d.ts +2 -0
  105. package/dist/ui/transcript-sanitization.d.ts.map +1 -1
  106. package/dist/ui/transcript.d.ts +1 -1
  107. package/dist/ui/transcript.d.ts.map +1 -1
  108. package/dist/ui/widget-activity.d.ts +21 -0
  109. package/dist/ui/widget-activity.d.ts.map +1 -0
  110. package/dist/ui/widget.d.ts +40 -3
  111. package/dist/ui/widget.d.ts.map +1 -1
  112. package/dist/verified/generated/authority-kernel.d.ts +1 -1
  113. package/dist/verified/generated/authority-kernel.js +61 -157
  114. package/dist/verified/generated/kernel.d.ts +8 -8
  115. package/dist/verified/generated/kernel.js +205 -449
  116. package/dist/verified/generated/lifecycle-kernel.d.ts +1 -1
  117. package/dist/verified/generated/lifecycle-kernel.js +95 -133
  118. package/dist/verified/generated/manifest.json +18 -18
  119. package/dist/verified/generated/provider-kernel.d.ts +1 -1
  120. package/dist/verified/generated/provider-kernel.js +48 -149
  121. package/dist/verified/generated/storage-kernel.d.ts +2 -2
  122. package/dist/verified/generated/storage-kernel.js +59 -219
  123. package/dist/verified/nat.d.ts.map +1 -1
  124. package/dist/verified/policy.d.ts.map +1 -1
  125. package/docs/configuration.md +1 -1
  126. package/docs/durable-pi.md +2 -2
  127. package/docs/interface.md +4 -0
  128. package/docs/jev.md +2 -2
  129. package/docs/provider-capabilities.md +1 -1
  130. package/docs/verified-kernels.md +4 -3
  131. package/package.json +9 -9
  132. package/proofs/abi.json +11 -11
  133. package/proofs/authority-types.d.ts +1 -1
  134. package/proofs/lifecycle-types.d.ts +1 -1
  135. package/proofs/provider-types.d.ts +1 -1
  136. package/proofs/storage-types.d.ts +2 -2
  137. package/proofs/types.d.ts +4 -4
  138. package/scripts/test-verified-kernels.mjs +1 -1
  139. package/scripts/verified-kernels.mjs +1 -1
  140. package/dist/chunks/chunk-7EYJE4TW.js.map +0 -7
  141. package/dist/chunks/chunk-DLXPTBPL.js.map +0 -7
  142. package/dist/chunks/chunk-HITKWKYD.js.map +0 -7
  143. package/dist/chunks/chunk-KBYSGB7E.js.map +0 -7
  144. package/dist/chunks/chunk-MOJBW5X2.js.map +0 -7
  145. package/dist/chunks/chunk-O7IREHJI.js.map +0 -7
  146. package/dist/chunks/chunk-PTZ5DKAB.js.map +0 -7
  147. package/dist/chunks/chunk-WTLH5RY4.js +0 -760
  148. package/dist/chunks/chunk-WTLH5RY4.js.map +0 -7
  149. /package/dist/chunks/{chunk-HZGQ7XYM.js.map → chunk-3FJUP3GV.js.map} +0 -0
  150. /package/dist/chunks/{chunk-U2UBUKNQ.js.map → chunk-3UGN25XS.js.map} +0 -0
  151. /package/dist/chunks/{chunk-VR2LV4CA.js.map → chunk-53N2I4QA.js.map} +0 -0
  152. /package/dist/chunks/{chunk-IQXNJNDI.js.map → chunk-5UBRGTVN.js.map} +0 -0
  153. /package/dist/chunks/{chunk-4GNFBZPR.js.map → chunk-ASSLHWZS.js.map} +0 -0
  154. /package/dist/chunks/{chunk-QGP7AY2R.js.map → chunk-C7Z6F3SO.js.map} +0 -0
  155. /package/dist/chunks/{chunk-56RFFBBO.js.map → chunk-CRRUW26I.js.map} +0 -0
  156. /package/dist/chunks/{chunk-I2TK65VR.js.map → chunk-D5NYNIST.js.map} +0 -0
  157. /package/dist/chunks/{chunk-QQ7D6UAM.js.map → chunk-EHQQ4KCX.js.map} +0 -0
  158. /package/dist/chunks/{chunk-H3SGA7G7.js.map → chunk-FIDUHKMM.js.map} +0 -0
  159. /package/dist/chunks/{chunk-4GGBND7V.js.map → chunk-FSYAGCGA.js.map} +0 -0
  160. /package/dist/chunks/{chunk-ZPI4QTOX.js.map → chunk-FUY6XVRX.js.map} +0 -0
  161. /package/dist/chunks/{chunk-A5XF3ZPJ.js.map → chunk-G4TLWHRS.js.map} +0 -0
  162. /package/dist/chunks/{chunk-7C5IEIQK.js.map → chunk-GEQMQVNS.js.map} +0 -0
  163. /package/dist/chunks/{chunk-DONS3EZH.js.map → chunk-GIK2WNAK.js.map} +0 -0
  164. /package/dist/chunks/{chunk-HQ5YW2OJ.js.map → chunk-HP5P7NBO.js.map} +0 -0
  165. /package/dist/chunks/{chunk-R2MMPHR2.js.map → chunk-INRXG4J5.js.map} +0 -0
  166. /package/dist/chunks/{chunk-BQWJ5ZR7.js.map → chunk-K7J2ABAZ.js.map} +0 -0
  167. /package/dist/chunks/{chunk-OTHMEDN6.js.map → chunk-KVYNGDGC.js.map} +0 -0
  168. /package/dist/chunks/{chunk-6EVAHJAR.js.map → chunk-LEU5CDSL.js.map} +0 -0
  169. /package/dist/chunks/{chunk-V2IV4LYW.js.map → chunk-LNASO4VT.js.map} +0 -0
  170. /package/dist/chunks/{chunk-HCNHKJDA.js.map → chunk-MLLYR3Y6.js.map} +0 -0
  171. /package/dist/chunks/{chunk-D3W6CBJZ.js.map → chunk-MZUC6LLH.js.map} +0 -0
  172. /package/dist/chunks/{chunk-D3IONBBJ.js.map → chunk-P7CBPPHY.js.map} +0 -0
  173. /package/dist/chunks/{chunk-WQ6LC2KK.js.map → chunk-QT4W5YVB.js.map} +0 -0
  174. /package/dist/chunks/{chunk-TNPZBMYC.js.map → chunk-ROTCDDOV.js.map} +0 -0
  175. /package/dist/chunks/{chunk-PH4PT6R4.js.map → chunk-TIIIHPHF.js.map} +0 -0
  176. /package/dist/chunks/{chunk-2YG4ZA2K.js.map → chunk-TIJ3YQXX.js.map} +0 -0
  177. /package/dist/chunks/{chunk-QCCPR3U5.js.map → chunk-UOM37PE4.js.map} +0 -0
  178. /package/dist/chunks/{chunk-EQYQICUY.js.map → chunk-UXIBKMUM.js.map} +0 -0
  179. /package/dist/chunks/{chunk-JV4JR6TT.js.map → chunk-ZEXCKK4K.js.map} +0 -0
@@ -27,7 +27,7 @@ import {
27
27
  restoreLegacyBashCommands,
28
28
  safeTerminalText,
29
29
  singleCallProgressLine
30
- } from "./chunk-U2UBUKNQ.js";
30
+ } from "./chunk-3UGN25XS.js";
31
31
  import {
32
32
  FabricModelSelector
33
33
  } from "./chunk-J7ZQERKA.js";
@@ -83,12 +83,12 @@ import {
83
83
  resolveFabricIdentity,
84
84
  setModelSafely,
85
85
  withTrajectoryRearmDirective
86
- } from "./chunk-QGP7AY2R.js";
86
+ } from "./chunk-C7Z6F3SO.js";
87
87
  import {
88
88
  AgentTranscriptReader,
89
89
  countNewlines,
90
90
  truncateMiddle
91
- } from "./chunk-7EYJE4TW.js";
91
+ } from "./chunk-EKODKR6Y.js";
92
92
  import {
93
93
  FileLockTimeoutError
94
94
  } from "./chunk-DK35W6U7.js";
@@ -129,7 +129,7 @@ import {
129
129
  loadFabricConfigForScope,
130
130
  resolveForegroundTools,
131
131
  saveFabricConfig
132
- } from "./chunk-BQWJ5ZR7.js";
132
+ } from "./chunk-K7J2ABAZ.js";
133
133
  import {
134
134
  defaultCodePreviewSettings
135
135
  } from "./chunk-OKOHRXGF.js";
@@ -138,7 +138,7 @@ import {
138
138
  fabricExecTitleHintCached,
139
139
  normalizeRunDisplay,
140
140
  registerCompactionHook
141
- } from "./chunk-TNPZBMYC.js";
141
+ } from "./chunk-ROTCDDOV.js";
142
142
  import {
143
143
  fabricWriteBindings
144
144
  } from "./chunk-SZUXWOO7.js";
@@ -160,15 +160,15 @@ import {
160
160
  ApprovalController,
161
161
  FabricAutoApprovalClassifier,
162
162
  FabricSessionApprovals
163
- } from "./chunk-QCCPR3U5.js";
163
+ } from "./chunk-UOM37PE4.js";
164
164
  import {
165
165
  getActiveRepairCompiler,
166
166
  setActiveCompiledSurface
167
- } from "./chunk-VR2LV4CA.js";
167
+ } from "./chunk-53N2I4QA.js";
168
168
  import {
169
169
  isFabricExecutionTraceV1,
170
170
  readFabricExecutionTraceV1
171
- } from "./chunk-HCNHKJDA.js";
171
+ } from "./chunk-MLLYR3Y6.js";
172
172
  import {
173
173
  PI_CORE_TOOL_NAMES,
174
174
  PI_CORE_TOOL_NAME_SET
@@ -952,6 +952,61 @@ var settleInPlacePrewalk = async (controller, extension, context, options) => {
952
952
  var FABRIC_CONVERSATION_SHORTCUT = "ctrl+shift+a";
953
953
  var FABRIC_CONVERSATION_HINT = "ctrl+shift+a chat";
954
954
 
955
+ // src/ui/widget-activity.ts
956
+ import { truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2, wrapTextWithAnsi } from "@earendil-works/pi-tui";
957
+ var FABRIC_WIDGET_FOCUS_SHORTCUT = "ctrl+shift+e";
958
+ var FABRIC_WIDGET_FOCUS_HINT = "ctrl+shift+e expand";
959
+ var WIDGET_ACTIVITY_ROWS = 12;
960
+ var WIDGET_ACTIVITY_LOG_LINES = 600;
961
+ var ENTRY_TEXT_LINES = 4;
962
+ var toolGlyph = (theme, status) => status === "running" ? theme.fg("accent", "\u25D0") : status === "failed" ? theme.fg("error", "\u2717") : theme.fg("success", "\u2713");
963
+ var oneLine = (value) => safeText(value ?? "").replace(/\s+/g, " ").trim();
964
+ var tailLines = (text, width, count) => {
965
+ const wrapped = text.split("\n").flatMap((paragraph) => wrapTextWithAnsi(paragraph, Math.max(1, width))).filter((line) => line.trim().length > 0);
966
+ return wrapped.slice(-count);
967
+ };
968
+ var entryLines = (theme, entry, width, hideThinking) => {
969
+ const inner = Math.max(1, width - 4);
970
+ const body = (text, color) => text ? tailLines(safeText(text), inner, ENTRY_TEXT_LINES).map((line) => ` ${theme.fg(color, line)}`) : [];
971
+ switch (entry.kind) {
972
+ case "thinking":
973
+ return [
974
+ ` ${theme.fg("dim", entry.status === "running" ? "\u2234 thinking\u2026" : "\u2234 thinking")}`,
975
+ // Pi's hideThinkingBlock keeps the marker and drops the reasoning text, as in its own chat.
976
+ ...hideThinking ? [] : body(entry.text, "dim")
977
+ ];
978
+ case "tool": {
979
+ const args = oneLine(entry.text);
980
+ return [
981
+ ` ${toolGlyph(theme, entry.status)} ${theme.fg("toolTitle", theme.bold(safeText(entry.toolName ?? entry.label)))}${args ? theme.fg("dim", ` ${args}`) : ""}`
982
+ ];
983
+ }
984
+ case "assistant":
985
+ return [` ${theme.fg("accent", "\u25C6")} ${theme.fg("accent", safeText(entry.label))}`, ...body(entry.text, "muted")];
986
+ case "user":
987
+ return [` ${theme.fg("muted", "\u203A")} ${theme.fg("muted", oneLine(entry.text) || safeText(entry.label))}`];
988
+ case "error":
989
+ return [` ${theme.fg("error", "\u2717")} ${theme.fg("error", safeText(entry.label))}`, ...body(entry.text, "muted")];
990
+ default:
991
+ return [` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", `${safeText(entry.label)}${entry.text ? ` ${oneLine(entry.text)}` : ""}`)}`];
992
+ }
993
+ };
994
+ var widgetActivityLines = (theme, transcript, width, rows, scroll, hideThinking = false) => {
995
+ if (!transcript || transcript.entries.length === 0) {
996
+ return { lines: [` ${theme.fg("dim", "Waiting for activity\u2026")}`], maxScroll: 0 };
997
+ }
998
+ const all = transcript.entries.flatMap((entry) => entryLines(theme, entry, width, hideThinking));
999
+ const maxScroll = Math.max(0, all.length - rows);
1000
+ const offset = Math.max(0, Math.min(scroll, maxScroll));
1001
+ const end = all.length - offset;
1002
+ const lines = all.slice(Math.max(0, end - rows), end).map((line) => truncateToWidth2(line, width, "\u2026"));
1003
+ return { lines, maxScroll };
1004
+ };
1005
+ var widgetDivider = (theme, width, label = "") => {
1006
+ const text = label ? ` ${label} ` : "";
1007
+ return theme.fg("border", `\u2500\u2500${text}${"\u2500".repeat(Math.max(0, width - 2 - visibleWidth2(text)))}`);
1008
+ };
1009
+
955
1010
  // src/commands/fabric.ts
956
1011
  import fs from "node:fs";
957
1012
  import path2 from "node:path";
@@ -1164,6 +1219,13 @@ ${top}` : "fingerprints: (none this session)"
1164
1219
  }
1165
1220
  }
1166
1221
  });
1222
+ pi.registerShortcut?.(FABRIC_WIDGET_FOCUS_SHORTCUT, {
1223
+ description: "Focus the Fabric widget to expand an agent's live activity",
1224
+ handler: async (context) => {
1225
+ if (context.mode !== "tui") return;
1226
+ fabricUi.focusWidget(context);
1227
+ }
1228
+ });
1167
1229
  pi.registerShortcut?.("ctrl+alt+t", {
1168
1230
  description: "Inspect Fabric background shell tasks",
1169
1231
  handler: async (context) => {
@@ -1184,6 +1246,7 @@ ${top}` : "fingerprints: (none this session)"
1184
1246
  "dashboard",
1185
1247
  "tasks",
1186
1248
  "chat",
1249
+ "focus",
1187
1250
  "settings",
1188
1251
  "schema",
1189
1252
  "prewalk",
@@ -1444,6 +1507,10 @@ Task: ${status.task}` : ""}`,
1444
1507
  await fabricUi.openConversation(context, argumentsList.join(" ") || void 0);
1445
1508
  return;
1446
1509
  }
1510
+ if (command === "focus") {
1511
+ fabricUi.focusWidget(context);
1512
+ return;
1513
+ }
1447
1514
  if (command === "decisions") {
1448
1515
  const { openFabricDecisions } = await import("../decisions/command.js");
1449
1516
  await openFabricDecisions(state.mesh, context, argumentsList[0]);
@@ -1997,7 +2064,7 @@ Inspect LLM I/O: /fabric log ${shortId} \xB7 Export: /fabric export-log ${actor.
1997
2064
  }
1998
2065
  if (command !== "status") {
1999
2066
  context.ui.notify(
2000
- "Usage: /fabric [status|dashboard|chat [id-or-name]|prewalk [task]|prewalk --off|--disable|--enable|reload|providers|agents|actors|global|import <name> [as <new>]|export <id> [--overwrite]|messages <id>|clear-messages <id>|events <id> [event...]|log <id>|export-log <id>|attach <id>|stop <id>|remove <id>|kill <id>|repairs|entropy|decisions [id]|programs [promote|retire <ref>]|run <ref> [json]]",
2067
+ "Usage: /fabric [status|dashboard|chat [id-or-name]|focus|prewalk [task]|prewalk --off|--disable|--enable|reload|providers|agents|actors|global|import <name> [as <new>]|export <id> [--overwrite]|messages <id>|clear-messages <id>|events <id> [event...]|log <id>|export-log <id>|attach <id>|stop <id>|remove <id>|kill <id>|repairs|entropy|decisions [id]|programs [promote|retire <ref>]|run <ref> [json]]",
2001
2068
  "warning"
2002
2069
  );
2003
2070
  return;
@@ -2637,7 +2704,7 @@ var FabricRepeatGuard = class {
2637
2704
  };
2638
2705
 
2639
2706
  // src/ui/row-balance.ts
2640
- import { truncateToWidth as truncateToWidth2 } from "@earendil-works/pi-tui";
2707
+ import { truncateToWidth as truncateToWidth3 } from "@earendil-works/pi-tui";
2641
2708
  var HiddenRowBorrowingComponent = class {
2642
2709
  constructor(baseLimit, maxLimit, renderLimit, balance) {
2643
2710
  this.baseLimit = baseLimit;
@@ -2669,7 +2736,7 @@ var HiddenRowBorrowingComponent = class {
2669
2736
  }
2670
2737
  this.#cachedWidth = width;
2671
2738
  this.#cachedDeficit = deficit;
2672
- this.#cachedRows = best.map((row) => truncateToWidth2(row, Math.max(1, width)));
2739
+ this.#cachedRows = best.map((row) => truncateToWidth3(row, Math.max(1, width)));
2673
2740
  return this.#cachedRows;
2674
2741
  }
2675
2742
  invalidate() {
@@ -4608,7 +4675,7 @@ var createDashboardSnapshot = (state, events, context, activityRuns, cache, immu
4608
4675
  };
4609
4676
 
4610
4677
  // src/ui/widget.ts
4611
- import { truncateToWidth as truncateToWidth3, visibleWidth as visibleWidth2 } from "@earendil-works/pi-tui";
4678
+ import { matchesKey, truncateToWidth as truncateToWidth4, visibleWidth as visibleWidth3 } from "@earendil-works/pi-tui";
4612
4679
 
4613
4680
  // src/ui/retention.ts
4614
4681
  var WIDGET_FINISHED_RETENTION_MS = 3e4;
@@ -4697,7 +4764,7 @@ var totalTokens = (snapshot, run) => snapshot.agents.filter((agent) => run ? age
4697
4764
  var totalCost = (snapshot, run) => snapshot.agents.filter((agent) => run ? agent.runId === run.id : isActiveStatus(agent.status)).reduce((sum, agent) => sum + (agent.usage?.cost ?? 0), 0);
4698
4765
  var agentLines = (theme, agent, now) => {
4699
4766
  const status = colorStatus(theme, agent.status, statusGlyph(agent.status));
4700
- const activity = agent.currentTool ?? (agent.error ? `error: ${truncateToWidth3(safeText(agent.error), 48)}` : agent.text && !isActiveStatus(agent.status) ? `result: ${truncateToWidth3(safeText(agent.text), 48)}` : agent.status === "running" ? "thinking" : agent.status);
4767
+ const activity = agent.currentTool ?? (agent.error ? `error: ${truncateToWidth4(safeText(agent.error), 48)}` : agent.text && !isActiveStatus(agent.status) ? `result: ${truncateToWidth4(safeText(agent.text), 48)}` : agent.status === "running" ? "thinking" : agent.status);
4701
4768
  const metrics = [
4702
4769
  agent.toolCalls !== void 0 ? `${agent.toolCalls} calls` : void 0,
4703
4770
  agent.usage ? `${formatTokens(agent.usage.input + agent.usage.output)} tok` : void 0,
@@ -4730,13 +4797,112 @@ var widgetRowLimit = (maxRows, terminalRows) => {
4730
4797
  const paneShare = Math.floor(terminalRows * WIDGET_TERMINAL_ROW_SHARE);
4731
4798
  return Math.max(1, Math.min(configured, paneShare));
4732
4799
  };
4800
+ var widgetExpandedRowLimit = (maxRows, terminalRows) => {
4801
+ const limit = widgetRowLimit(maxRows, terminalRows);
4802
+ if (terminalRows === void 0 || !Number.isFinite(terminalRows) || terminalRows <= 0) {
4803
+ return limit + 2 + WIDGET_ACTIVITY_ROWS;
4804
+ }
4805
+ return Math.max(limit, Math.floor(terminalRows * WIDGET_TERMINAL_ROW_SHARE));
4806
+ };
4733
4807
  var FabricWidget = class {
4734
- constructor(theme, snapshot, maxRows, terminalRows, retention = new FabricWidgetRetention()) {
4808
+ constructor(theme, snapshot, maxRows, terminalRows, retention = new FabricWidgetRetention(), interaction) {
4735
4809
  this.theme = theme;
4736
4810
  this.snapshot = snapshot;
4737
4811
  this.maxRows = maxRows;
4738
4812
  this.terminalRows = terminalRows;
4739
4813
  this.retention = retention;
4814
+ this.interaction = interaction;
4815
+ }
4816
+ /** Set by the TUI when the widget gains or loses keyboard focus. */
4817
+ focused = false;
4818
+ #selectedId;
4819
+ #expandedId;
4820
+ #activityScroll = 0;
4821
+ #activityMaxScroll = 0;
4822
+ #paneRows = WIDGET_ACTIVITY_ROWS;
4823
+ /** Participant rows of the last render, with their line index in the output. */
4824
+ #rows = [];
4825
+ #renderedFocus = false;
4826
+ #renderedSelection;
4827
+ #renderedExpansion;
4828
+ /** Id of the row whose activity pane is open, if any. */
4829
+ get expandedId() {
4830
+ return this.#expandedId;
4831
+ }
4832
+ /** Select the first participant row; used when focus arrives from the keyboard. */
4833
+ selectDefault() {
4834
+ const rows = this.#selectableRows();
4835
+ if (!rows.some((row) => row.id === this.#selectedId)) this.#selectedId = this.#expandedId ?? rows[0]?.id;
4836
+ }
4837
+ #interactionKey() {
4838
+ return `${this.focused}|${this.#selectedId ?? ""}|${this.#expandedId ?? ""}|${this.#activityScroll}`;
4839
+ }
4840
+ handleInput(data) {
4841
+ const rows = this.#selectableRows();
4842
+ const index = Math.max(0, rows.findIndex((row) => row.id === this.#selectedId));
4843
+ const select = (next) => {
4844
+ const row = rows[Math.max(0, Math.min(rows.length - 1, next))];
4845
+ if (!row) return;
4846
+ this.#selectedId = row.id;
4847
+ if (this.#expandedId && this.#expandedId !== row.id) this.#expand(row.id);
4848
+ };
4849
+ if (matchesKey(data, "escape") || matchesKey(data, FABRIC_WIDGET_FOCUS_SHORTCUT)) {
4850
+ if (this.#expandedId && matchesKey(data, "escape")) this.#expandedId = void 0;
4851
+ else this.interaction?.release();
4852
+ } else if (matchesKey(data, "up") || data === "k") {
4853
+ select(index - 1);
4854
+ } else if (matchesKey(data, "down") || data === "j") {
4855
+ select(index + 1);
4856
+ } else if (matchesKey(data, "enter") || data === " ") {
4857
+ if (this.#selectedId) this.#toggle(this.#selectedId);
4858
+ } else if (this.#expandedId && (matchesKey(data, "pageUp") || data === "K")) {
4859
+ this.#activityScroll = Math.min(this.#activityMaxScroll, this.#activityScroll + Math.max(1, this.#paneRows - 1));
4860
+ } else if (this.#expandedId && (matchesKey(data, "pageDown") || data === "J")) {
4861
+ this.#activityScroll = Math.max(0, this.#activityScroll - Math.max(1, this.#paneRows - 1));
4862
+ } else if (this.#expandedId && (matchesKey(data, "end") || data === "G")) {
4863
+ this.#activityScroll = 0;
4864
+ } else {
4865
+ this.interaction?.release(data);
4866
+ return;
4867
+ }
4868
+ this.interaction?.requestRender();
4869
+ }
4870
+ handleMouse(event) {
4871
+ if (!this.interaction) return void 0;
4872
+ if (event.type === "wheel" && this.#expandedId) {
4873
+ const delta = Math.sign(event.wheelDelta ?? 0);
4874
+ this.#activityScroll = Math.max(0, Math.min(this.#activityMaxScroll, this.#activityScroll - delta * 3));
4875
+ return { handled: true, render: true };
4876
+ }
4877
+ if (event.type === "press") return { handled: true };
4878
+ if (event.type !== "click" || event.button !== "left") return void 0;
4879
+ const row = this.#rows.find((candidate) => candidate.line === event.y);
4880
+ if (!row) return void 0;
4881
+ this.#selectedId = row.id;
4882
+ this.#toggle(row.id);
4883
+ return { focus: true, render: true };
4884
+ }
4885
+ #toggle(id) {
4886
+ if (this.#expandedId === id) this.#expandedId = void 0;
4887
+ else this.#expand(id);
4888
+ }
4889
+ #expand(id) {
4890
+ this.#expandedId = id;
4891
+ this.#activityScroll = 0;
4892
+ }
4893
+ /** Rows a user can select: the participant rows the widget shows, in drawing order. */
4894
+ #selectableRows() {
4895
+ const { lines, rows } = this.#content(this.snapshot());
4896
+ const { listLimit } = this.#layout(lines.length, this.#expandedId !== void 0, this.#rowLimit());
4897
+ return rows.filter((row) => row.line < listLimit);
4898
+ }
4899
+ /** List and pane heights; the pane exists only while a row is expanded. */
4900
+ #layout(listLength, expanded, limit) {
4901
+ if (!expanded) return { listLimit: limit, paneRows: 0 };
4902
+ const budget = widgetExpandedRowLimit(this.maxRows, this.terminalRows?.());
4903
+ const listLimit = Math.max(2, Math.min(listLength, limit, budget - 5));
4904
+ const paneRows = Math.max(1, Math.min(WIDGET_ACTIVITY_ROWS, budget - Math.min(listLength, listLimit) - 2));
4905
+ return { listLimit, paneRows };
4740
4906
  }
4741
4907
  #rowLimit() {
4742
4908
  return widgetRowLimit(this.maxRows, this.terminalRows?.());
@@ -4750,8 +4916,13 @@ var FabricWidget = class {
4750
4916
  if (width <= 0) return [];
4751
4917
  const snapshot = this.snapshot();
4752
4918
  const limit = this.#rowLimit();
4753
- const lines = this.#pending?.width === width && this.#pending.limit === limit && this.#pending.snapshot === snapshot ? this.#pending.lines : this.#lastWidth === width && this.#lastLimit === limit && this.#lastSnapshot === snapshot && this.#lastLines ? this.#lastLines : this.#renderLines(snapshot, width, limit);
4919
+ const interactionChanged = this.#renderedFocus !== this.focused || this.#renderedSelection !== this.#selectedId || this.#renderedExpansion !== this.#interactionKey();
4920
+ if (interactionChanged) this.#pending = void 0;
4921
+ const lines = !interactionChanged && this.#pending?.width === width && this.#pending.limit === limit && this.#pending.snapshot === snapshot ? this.#pending.lines : !interactionChanged && !this.#expandedId && this.#lastWidth === width && this.#lastLimit === limit && this.#lastSnapshot === snapshot && this.#lastLines ? this.#lastLines : this.#renderLines(snapshot, width, limit);
4754
4922
  this.#pending = void 0;
4923
+ this.#renderedFocus = this.focused;
4924
+ this.#renderedSelection = this.#selectedId;
4925
+ this.#renderedExpansion = this.#interactionKey();
4755
4926
  this.#lastWidth = width;
4756
4927
  this.#lastLimit = limit;
4757
4928
  this.#lastSnapshot = snapshot;
@@ -4774,9 +4945,51 @@ var FabricWidget = class {
4774
4945
  this.#lastLines = void 0;
4775
4946
  }
4776
4947
  #renderLines(snapshot, width, limit) {
4777
- return this.#boundContent(this.#buildContent(snapshot), width, limit);
4778
- }
4779
- #buildContent(snapshot) {
4948
+ const { lines, rows } = this.#content(snapshot);
4949
+ if (this.#selectedId && !rows.some((row) => row.id === this.#selectedId)) this.#selectedId = rows[0]?.id;
4950
+ const expanded = rows.find((row) => row.id === this.#expandedId);
4951
+ if (this.#expandedId && !expanded) this.#expandedId = void 0;
4952
+ const marked = lines.map((line, index) => {
4953
+ const row = rows.find((candidate) => candidate.line === index);
4954
+ if (!row || !this.focused || row.id !== this.#selectedId) return line;
4955
+ return `${this.theme.fg("accent", "\u25B8")}${line.replace(/^ /, "")}`;
4956
+ });
4957
+ const { listLimit, paneRows } = this.#layout(lines.length, expanded !== void 0, limit);
4958
+ this.#rows = rows.filter((row) => row.line < listLimit);
4959
+ if (!expanded) return this.#boundContent(this.#withFocusHint(marked, rows.length > 0), width, limit);
4960
+ const list = this.#boundContent(this.#withFocusHint(marked, true), width, listLimit);
4961
+ this.#paneRows = paneRows;
4962
+ const activity = widgetActivityLines(
4963
+ this.theme,
4964
+ this.interaction?.activity(expanded),
4965
+ width,
4966
+ paneRows,
4967
+ this.#activityScroll,
4968
+ this.interaction?.hideThinking?.() ?? false
4969
+ );
4970
+ this.#activityMaxScroll = activity.maxScroll;
4971
+ this.#activityScroll = Math.min(this.#activityScroll, activity.maxScroll);
4972
+ const position = this.#activityScroll > 0 ? ` \xB7 \u2191${this.#activityScroll}` : " \xB7 live";
4973
+ const help = this.focused ? "\u2191\u2193 switch \xB7 PgUp/PgDn scroll \xB7 \u23CE/click collapse \xB7 esc close" : `click or ${FABRIC_WIDGET_FOCUS_SHORTCUT} to focus`;
4974
+ return [
4975
+ ...list,
4976
+ widgetDivider(this.theme, width, this.theme.fg("accent", `${safeText(expanded.name)} activity${position}`)),
4977
+ ...activity.lines,
4978
+ widgetDivider(this.theme, width, this.theme.fg("dim", help))
4979
+ ].map((line) => truncateToWidth4(line, width));
4980
+ }
4981
+ /** Advertise the expand shortcut on the header while participant rows exist. */
4982
+ #withFocusHint(lines, hasRows) {
4983
+ if (!this.interaction || lines.length === 0 || !hasRows) return lines;
4984
+ const hint = this.focused ? "\u2191\u2193 select \xB7 \u23CE expand \xB7 esc back" : FABRIC_WIDGET_FOCUS_HINT;
4985
+ return [`${lines[0]} \xB7 ${this.theme.fg("dim", hint)}`, ...lines.slice(1)];
4986
+ }
4987
+ #content(snapshot) {
4988
+ const rows = [];
4989
+ const lines = this.#buildContent(snapshot, rows);
4990
+ return { lines, rows };
4991
+ }
4992
+ #buildContent(snapshot, rows = []) {
4780
4993
  const candidateRun = snapshot.runs[0];
4781
4994
  const candidateFinishedAt = candidateRun?.finishedAt ?? candidateRun?.updatedAt ?? 0;
4782
4995
  const run = candidateRun && (candidateRun.status === "running" || candidateFinishedAt > (snapshot.widgetDismissedAt ?? 0)) ? candidateRun : void 0;
@@ -4786,8 +4999,8 @@ var FabricWidget = class {
4786
4999
  const activeAgentIds = new Set(activeAgents.map((agent) => agent.id));
4787
5000
  const terminalAgents = orderedAgents.filter((agent) => !activeAgentIds.has(agent.id) && !isActiveStatus(agent.status) && this.retention.visible(agent, snapshot)).sort((left, right) => this.retention.finishedAt(right, snapshot.now) - this.retention.finishedAt(left, snapshot.now));
4788
5001
  const visibleActors = snapshot.actors.filter((actor) => actor.status !== "stopped");
4789
- const activeActorWorkers = visibleActors.filter((actor) => actor.worker && isActiveStatus(actor.worker.status)).map((actor) => ({ ...actor.worker, name: actor.name }));
4790
- const terminalActorWorkers = visibleActors.filter((actor) => actor.worker && !isActiveStatus(actor.worker.status)).map((actor) => ({ ...actor.worker, name: actor.name }));
5002
+ const activeActorWorkers = visibleActors.filter((actor) => actor.worker && isActiveStatus(actor.worker.status)).map((actor) => ({ ...actor.worker, name: actor.name, actorId: actor.id }));
5003
+ const terminalActorWorkers = visibleActors.filter((actor) => actor.worker && !isActiveStatus(actor.worker.status)).map((actor) => ({ ...actor.worker, name: actor.name, actorId: actor.id }));
4791
5004
  const nestedCalls = run?.calls.filter((call) => call.kind !== "agent" && call.kind !== "actor") ?? [];
4792
5005
  const title = run?.name ?? "Fabric session";
4793
5006
  const shells = snapshot.shells ?? [];
@@ -4840,27 +5053,26 @@ var FabricWidget = class {
4840
5053
  );
4841
5054
  }
4842
5055
  if (liveShells.length + recentShells.length > 3) lines.push(this.theme.fg("dim", ` +${liveShells.length + recentShells.length - 3} more shell tasks`));
4843
- lines.push(
4844
- ...activeAgents.flatMap((agent) => agentLines(this.theme, agent, snapshot.now)),
4845
- ...activeActorWorkers.flatMap(
4846
- (agent) => agentLines(this.theme, agent, snapshot.now)
4847
- ),
4848
- ...terminalActorWorkers.flatMap(
4849
- (agent) => agentLines(this.theme, agent, snapshot.now)
4850
- ),
4851
- ...terminalAgents.flatMap((agent) => agentLines(this.theme, agent, snapshot.now))
4852
- );
5056
+ const pushParticipant = (agent, kind) => {
5057
+ const id = kind === "actor" ? agent.actorId ?? agent.id : agent.id;
5058
+ rows.push({ id, kind, name: agent.name, line: lines.length });
5059
+ lines.push(...agentLines(this.theme, agent, snapshot.now));
5060
+ };
5061
+ for (const agent of activeAgents) pushParticipant(agent, "agent");
5062
+ for (const agent of activeActorWorkers) pushParticipant(agent, "actor");
5063
+ for (const agent of terminalActorWorkers) pushParticipant(agent, "actor");
5064
+ for (const agent of terminalAgents) pushParticipant(agent, "agent");
4853
5065
  return lines;
4854
5066
  }
4855
5067
  #boundContent(content, width, limit) {
4856
5068
  const bounded = content.slice(0, limit);
4857
5069
  if (content.length > bounded.length && bounded.length > 0) {
4858
5070
  const marker = this.theme.fg("dim", `+${content.length - bounded.length}`);
4859
- const available = Math.max(0, width - visibleWidth2(marker) - 1);
4860
- const last = truncateToWidth3(bounded[bounded.length - 1] ?? "", available, "");
5071
+ const available = Math.max(0, width - visibleWidth3(marker) - 1);
5072
+ const last = truncateToWidth4(bounded[bounded.length - 1] ?? "", available, "");
4861
5073
  bounded[bounded.length - 1] = `${last} ${marker}`;
4862
5074
  }
4863
- return bounded.map((line) => truncateToWidth3(line, width));
5075
+ return bounded.map((line) => truncateToWidth4(line, width));
4864
5076
  }
4865
5077
  };
4866
5078
 
@@ -4917,6 +5129,11 @@ var FabricUiController = class {
4917
5129
  #dashboardTui;
4918
5130
  #widgetMounted = false;
4919
5131
  #widget;
5132
+ /** Component that had focus before the widget took it (normally the editor). */
5133
+ #widgetReturnFocus;
5134
+ /** Pi's hideThinkingBlock for the widget pane; read once, at the first expansion. */
5135
+ #widgetHideThinking;
5136
+ #widgetHideThinkingLoad;
4920
5137
  #lastRefreshErrorAt = 0;
4921
5138
  #lastRefreshAt = 0;
4922
5139
  #dashboardOpen = false;
@@ -4935,6 +5152,8 @@ var FabricUiController = class {
4935
5152
  #activityRuns = [];
4936
5153
  #activityView;
4937
5154
  #transcripts = new AgentTranscriptReader();
5155
+ /** Deeper pages for the widget's activity pane, so a turn's early thinking and tool calls stay visible. */
5156
+ #widgetTranscripts = new AgentTranscriptReader(WIDGET_ACTIVITY_LOG_LINES);
4938
5157
  #conversationReaders = /* @__PURE__ */ new Map();
4939
5158
  #activeConversationReader;
4940
5159
  #snapshotCache = new FabricDashboardSnapshotCache();
@@ -4976,6 +5195,10 @@ var FabricUiController = class {
4976
5195
  if (this.#scheduledRefresh) clearTimeout(this.#scheduledRefresh);
4977
5196
  this.#timer = void 0;
4978
5197
  this.#scheduledRefresh = void 0;
5198
+ this.#releaseWidget();
5199
+ this.#widgetReturnFocus = void 0;
5200
+ this.#widgetHideThinking = void 0;
5201
+ this.#widgetHideThinkingLoad = void 0;
4979
5202
  this.#widget = void 0;
4980
5203
  this.#activityUnsubscribe?.();
4981
5204
  this.#activityUnsubscribe = void 0;
@@ -5002,6 +5225,7 @@ var FabricUiController = class {
5002
5225
  this.#activityRuns = [];
5003
5226
  this.#activityView = void 0;
5004
5227
  this.#transcripts.clear();
5228
+ this.#widgetTranscripts.clear();
5005
5229
  for (const reader of this.#conversationReaders.values()) reader.clear();
5006
5230
  this.#conversationReaders.clear();
5007
5231
  this.#activeConversationReader = void 0;
@@ -5009,7 +5233,50 @@ var FabricUiController = class {
5009
5233
  }
5010
5234
  /** True while Fabric owns keyboard input, including asynchronous view setup. */
5011
5235
  get ownsInput() {
5012
- return this.#dashboardOpen || this.#conversationOpen || this.#tasksOpen;
5236
+ return this.#dashboardOpen || this.#conversationOpen || this.#tasksOpen || this.#widget?.focused === true;
5237
+ }
5238
+ /** Focus the bottom widget so its participant rows can be expanded in place. */
5239
+ focusWidget(context) {
5240
+ if (context.mode !== "tui") return;
5241
+ const tui = this.#widgetTui;
5242
+ const widget = this.#widget;
5243
+ if (!tui || !widget) {
5244
+ context.ui.notify("No Fabric activity to expand", "info");
5245
+ return;
5246
+ }
5247
+ if (widget.focused) return this.#releaseWidget();
5248
+ const current = tui.getFocusedComponent?.();
5249
+ if (current && current !== widget) this.#widgetReturnFocus = current;
5250
+ widget.selectDefault();
5251
+ tui.setFocus(widget);
5252
+ tui.requestRender();
5253
+ }
5254
+ /** Return focus to the editor; a `forward` key the widget did not use goes to the editor too. */
5255
+ #releaseWidget(forward) {
5256
+ const tui = this.#widgetTui;
5257
+ if (!tui || !this.#widget?.focused) return;
5258
+ const target = this.#widgetReturnFocus;
5259
+ tui.setFocus(target ?? null);
5260
+ if (forward !== void 0) target?.handleInput?.(forward);
5261
+ tui.requestRender();
5262
+ }
5263
+ /** Read Pi's hideThinkingBlock off the startup path, then redraw the pane. */
5264
+ #widgetHidesThinking(context, tui) {
5265
+ if (this.#widgetHideThinking !== void 0) return this.#widgetHideThinking;
5266
+ const epoch = this.#epoch;
5267
+ this.#widgetHideThinkingLoad ??= (async () => {
5268
+ let hidden = false;
5269
+ try {
5270
+ const { loadHostSdk } = await import("../core/host-sdk.js");
5271
+ const { SettingsManager } = await loadHostSdk();
5272
+ hidden = SettingsManager.create(context.cwd, resolveAgentDir(), { projectTrusted: context.isProjectTrusted?.() ?? false }).getHideThinkingBlock();
5273
+ } catch {
5274
+ }
5275
+ if (epoch !== this.#epoch) return;
5276
+ this.#widgetHideThinking = hidden;
5277
+ tui.requestRender();
5278
+ })();
5279
+ return true;
5013
5280
  }
5014
5281
  async openTasks(context, query) {
5015
5282
  if (this.ownsInput) return;
@@ -5567,12 +5834,23 @@ var FabricUiController = class {
5567
5834
  WIDGET_ID,
5568
5835
  (tui, theme) => {
5569
5836
  this.#widgetTui = tui;
5837
+ const focused = tui.getFocusedComponent?.();
5838
+ if (focused) this.#widgetReturnFocus = focused;
5570
5839
  this.#widget = new FabricWidget(
5571
5840
  theme,
5572
5841
  () => this.#snapshot,
5573
5842
  config.maxRows,
5574
5843
  () => tui.terminal?.rows ?? process.stdout.rows,
5575
- this.#widgetRetention
5844
+ this.#widgetRetention,
5845
+ {
5846
+ activity: (row) => {
5847
+ const target = row.kind === "actor" ? this.#snapshot.actors.find((actor) => actor.id === row.id) : this.#snapshot.agents.find((agent) => agent.id === row.id);
5848
+ return target ? this.#widgetTranscripts.read(this.#transcriptSource(target)) : void 0;
5849
+ },
5850
+ release: (forward) => this.#releaseWidget(forward),
5851
+ requestRender: () => tui.requestRender(),
5852
+ hideThinking: () => this.#widgetHidesThinking(context, tui)
5853
+ }
5576
5854
  );
5577
5855
  return this.#widget;
5578
5856
  },
@@ -5581,6 +5859,7 @@ var FabricUiController = class {
5581
5859
  return;
5582
5860
  }
5583
5861
  if (!this.#widgetMounted) return;
5862
+ this.#releaseWidget();
5584
5863
  context.ui.setWidget(WIDGET_ID, void 0);
5585
5864
  this.#widgetMounted = false;
5586
5865
  this.#widgetTui = void 0;
@@ -6408,7 +6687,7 @@ function createFabricExtension(entryUrl) {
6408
6687
  const { ExtractiveHistory } = await import("../memory/extractive-history.js");
6409
6688
  if (epoch !== extractiveEpoch || !extractiveConfig()?.enabled || context.signal?.aborted || context.sessionManager.getSessionId() !== sessionId || context.sessionManager.getLeafId() !== leaf) return;
6410
6689
  extractiveHistory ??= new ExtractiveHistory(extractiveConfig);
6411
- await extractiveHistory.prepare(context, event.prompt);
6690
+ await extractiveHistory.prepare(context, event.messageType !== "custom" ? event.prompt : "");
6412
6691
  });
6413
6692
  pi.on("context", async (event, context) => {
6414
6693
  const sessionId = context.sessionManager.getSessionId();
@@ -6466,7 +6745,7 @@ function createFabricExtension(entryUrl) {
6466
6745
  const skills = event.systemPromptOptions.skills ?? [];
6467
6746
  const captureSnapshot = state.bootstrapped ? capturePolicy() : void 0;
6468
6747
  const systemPrompt = restoreSkillsForFullCodePrompt(event.systemPrompt, skills, effectiveFullCodeMode);
6469
- const skillReferenceGuidance = effectiveFullCodeMode ? buildSkillReferenceGuidance(event.prompt, skills) : void 0;
6748
+ const skillReferenceGuidance = effectiveFullCodeMode ? buildSkillReferenceGuidance(event.messageType !== "custom" ? event.prompt : "", skills) : void 0;
6470
6749
  const currentModel = context.model ? `${context.model.provider}/${context.model.id}` : void 0;
6471
6750
  const resolvedGuidance = resolveFabricModelGuidance(state.modelGuidance(), {
6472
6751
  ...currentModel ? { model: currentModel } : {},
@@ -6514,7 +6793,7 @@ ${guidance}`,
6514
6793
  const names = rewritableHiddenCapturedToolNames(hiddenCapturedToolNames());
6515
6794
  if (names.length === 0) return;
6516
6795
  const mentioned = proxyContractMentionsInSkills(
6517
- event.prompt,
6796
+ event.messageType !== "custom" ? event.prompt : "",
6518
6797
  event.systemPrompt,
6519
6798
  names
6520
6799
  );
@@ -6623,4 +6902,4 @@ export {
6623
6902
  FABRIC_MANAGED_HOST_VERSION,
6624
6903
  createFabricExtension
6625
6904
  };
6626
- //# sourceMappingURL=chunk-O7IREHJI.js.map
6905
+ //# sourceMappingURL=chunk-XCEEQ5AB.js.map