@e4779/pi-fabric 0.131.0-fork.32 → 0.131.4-fork.33

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 (111) hide show
  1. package/README.md +1 -1
  2. package/dist/activity/store.d.ts.map +1 -1
  3. package/dist/actors/feedback.d.ts +5 -0
  4. package/dist/actors/feedback.d.ts.map +1 -0
  5. package/dist/actors/global-registry.d.ts.map +1 -1
  6. package/dist/actors/manager.d.ts.map +1 -1
  7. package/dist/agents/completion-inbox.d.ts.map +1 -1
  8. package/dist/agents/manager.d.ts.map +1 -1
  9. package/dist/agents/request.d.ts.map +1 -1
  10. package/dist/agents/transports/herdr-core-socket.d.ts +13 -0
  11. package/dist/agents/transports/herdr-core-socket.d.ts.map +1 -0
  12. package/dist/agents/transports/herdr-core-transport.d.ts +10 -0
  13. package/dist/agents/transports/herdr-core-transport.d.ts.map +1 -0
  14. package/dist/agents.js +1 -1
  15. package/dist/audit/details.d.ts +2 -0
  16. package/dist/audit/details.d.ts.map +1 -1
  17. package/dist/chunks/{chunk-3PKZSIRA.js → chunk-ASOJYFKU.js} +8 -4
  18. package/dist/chunks/chunk-ASOJYFKU.js.map +7 -0
  19. package/dist/chunks/{chunk-ZFWICFNJ.js → chunk-DGUXJSYA.js} +41 -17
  20. package/dist/chunks/chunk-DGUXJSYA.js.map +7 -0
  21. package/dist/chunks/{chunk-WGMCNCP6.js → chunk-G2DZJ5LK.js} +86 -49
  22. package/dist/chunks/chunk-G2DZJ5LK.js.map +7 -0
  23. package/dist/chunks/{chunk-7CIES6X2.js → chunk-HRVYXRWZ.js} +2 -2
  24. package/dist/chunks/chunk-HRVYXRWZ.js.map +7 -0
  25. package/dist/chunks/{chunk-36XQFTEN.js → chunk-L6H46CPY.js} +2 -2
  26. package/dist/chunks/{chunk-4KX6BIPL.js → chunk-LRSZFYUC.js} +2 -2
  27. package/dist/chunks/chunk-LRSZFYUC.js.map +7 -0
  28. package/dist/chunks/{chunk-5BOTHX47.js → chunk-LZ2ZXOCU.js} +4 -4
  29. package/dist/chunks/chunk-LZ2ZXOCU.js.map +7 -0
  30. package/dist/chunks/{chunk-UFMYN5TA.js → chunk-MX53BRAC.js} +2 -2
  31. package/dist/chunks/{chunk-WWTGWGH7.js → chunk-RKJPBTBB.js} +22 -6
  32. package/dist/chunks/chunk-RKJPBTBB.js.map +7 -0
  33. package/dist/chunks/{chunk-YHFWMAQ5.js → chunk-TEMKDJJY.js} +151 -52
  34. package/dist/chunks/chunk-TEMKDJJY.js.map +7 -0
  35. package/dist/chunks/{chunk-IOGDTIGN.js → chunk-U6Y6TKJL.js} +3 -3
  36. package/dist/chunks/{chunk-IOGDTIGN.js.map → chunk-U6Y6TKJL.js.map} +1 -1
  37. package/dist/chunks/{chunk-VNWQIGQL.js → chunk-VGRUWTMG.js} +415 -252
  38. package/dist/chunks/chunk-VGRUWTMG.js.map +7 -0
  39. package/dist/chunks/{chunk-X7QETPBC.js → chunk-ZHROHNEE.js} +1 -1
  40. package/dist/commands/fabric-handler.js +1 -1
  41. package/dist/compaction/claim-events.js +1 -1
  42. package/dist/components/configuration.js +2 -2
  43. package/dist/config.d.ts +1 -1
  44. package/dist/config.d.ts.map +1 -1
  45. package/dist/core/call-presentation.d.ts +14 -0
  46. package/dist/core/call-presentation.d.ts.map +1 -0
  47. package/dist/core/shell-inbox.d.ts.map +1 -1
  48. package/dist/durable/agent.d.ts.map +1 -1
  49. package/dist/durable/worker-host.js +1 -1
  50. package/dist/durable-extension.d.ts +1 -1
  51. package/dist/durable-extension.js +1 -1
  52. package/dist/durable-extension.js.map +1 -1
  53. package/dist/durable-host.js +1 -1
  54. package/dist/durable.d.ts.map +1 -1
  55. package/dist/durable.js +5 -4
  56. package/dist/durable.js.map +2 -2
  57. package/dist/extension-bootstrap.js +5 -5
  58. package/dist/fabric-exec-tool.d.ts.map +1 -1
  59. package/dist/fabric-runtime-state.d.ts.map +1 -1
  60. package/dist/fabric-runtime-state.js +87 -60
  61. package/dist/fabric-runtime-state.js.map +4 -4
  62. package/dist/feedback.d.ts +5 -0
  63. package/dist/feedback.d.ts.map +1 -0
  64. package/dist/index.js +5 -5
  65. package/dist/jev.js +1 -1
  66. package/dist/main-agent.d.ts +2 -1
  67. package/dist/main-agent.d.ts.map +1 -1
  68. package/dist/providers/agents-provider.d.ts.map +1 -1
  69. package/dist/providers/jev-provider.js +1 -1
  70. package/dist/residency/host.js +3 -3
  71. package/dist/residency/pi-entry.js +3 -3
  72. package/dist/runtime/core-override-guest-types.js +2 -2
  73. package/dist/runtime/guest-types.d.ts +1 -1
  74. package/dist/runtime/guest-types.d.ts.map +1 -1
  75. package/dist/runtime/guest-types.js +1 -1
  76. package/dist/runtime/monty-runtime.js +1 -1
  77. package/dist/runtime/typescript-kernel.js +2 -2
  78. package/dist/topology/participant-directory.d.ts.map +1 -1
  79. package/dist/type-error-guidance.js +1 -1
  80. package/dist/ui/dashboard-model.d.ts.map +1 -1
  81. package/dist/ui/dashboard.js +8 -5
  82. package/dist/ui/dashboard.js.map +2 -2
  83. package/dist/ui/fabric-render.d.ts +1 -0
  84. package/dist/ui/fabric-render.d.ts.map +1 -1
  85. package/dist/ui/settings-values.d.ts +1 -1
  86. package/dist/ui/settings-values.d.ts.map +1 -1
  87. package/dist/ui/settings.js +2 -2
  88. package/dist/ui/settings.js.map +2 -2
  89. package/dist/ui/widget.d.ts +8 -4
  90. package/dist/ui/widget.d.ts.map +1 -1
  91. package/docs/agents.md +9 -6
  92. package/docs/background-tasks.md +24 -12
  93. package/docs/configuration.md +2 -0
  94. package/docs/interface.md +3 -1
  95. package/docs/jev.md +1 -1
  96. package/package.json +9 -9
  97. package/skillsets/python/fabric-council/SKILL.md +9 -7
  98. package/skillsets/typescript/fabric-council/SKILL.md +4 -3
  99. package/skillsets/typescript/fabric-exec/references/agents.md +5 -5
  100. package/dist/chunks/chunk-3PKZSIRA.js.map +0 -7
  101. package/dist/chunks/chunk-4KX6BIPL.js.map +0 -7
  102. package/dist/chunks/chunk-5BOTHX47.js.map +0 -7
  103. package/dist/chunks/chunk-7CIES6X2.js.map +0 -7
  104. package/dist/chunks/chunk-VNWQIGQL.js.map +0 -7
  105. package/dist/chunks/chunk-WGMCNCP6.js.map +0 -7
  106. package/dist/chunks/chunk-WWTGWGH7.js.map +0 -7
  107. package/dist/chunks/chunk-YHFWMAQ5.js.map +0 -7
  108. package/dist/chunks/chunk-ZFWICFNJ.js.map +0 -7
  109. /package/dist/chunks/{chunk-36XQFTEN.js.map → chunk-L6H46CPY.js.map} +0 -0
  110. /package/dist/chunks/{chunk-UFMYN5TA.js.map → chunk-MX53BRAC.js.map} +0 -0
  111. /package/dist/chunks/{chunk-X7QETPBC.js.map → chunk-ZHROHNEE.js.map} +0 -0
@@ -28,7 +28,7 @@ import {
28
28
  safeTerminalText,
29
29
  shellBackgroundShortcut,
30
30
  singleCallProgressLine
31
- } from "./chunk-WWTGWGH7.js";
31
+ } from "./chunk-RKJPBTBB.js";
32
32
  import {
33
33
  configureHighlighting,
34
34
  highlightCode,
@@ -78,10 +78,11 @@ import {
78
78
  resolveFabricIdentity,
79
79
  setModelSafely,
80
80
  withTrajectoryRearmDirective
81
- } from "./chunk-ZFWICFNJ.js";
81
+ } from "./chunk-DGUXJSYA.js";
82
82
  import {
83
- AgentTranscriptReader
84
- } from "./chunk-YHFWMAQ5.js";
83
+ AgentTranscriptReader,
84
+ isRoutineInternalCall
85
+ } from "./chunk-TEMKDJJY.js";
85
86
  import {
86
87
  countNewlines,
87
88
  editDistance,
@@ -105,7 +106,7 @@ import {
105
106
  loadFabricConfig,
106
107
  loadFabricConfigForScope,
107
108
  resolveForegroundTools
108
- } from "./chunk-4KX6BIPL.js";
109
+ } from "./chunk-LRSZFYUC.js";
109
110
  import {
110
111
  defaultCodePreviewSettings
111
112
  } from "./chunk-OKOHRXGF.js";
@@ -229,6 +230,7 @@ var createFabricPersistedExecutionDetails = (input) => {
229
230
  details.omittedCalls = {
230
231
  count: omitted.count + 1,
231
232
  done: omitted.done + (dropped.success !== void 0 ? 1 : 0),
233
+ ...(omitted.internal ?? 0) + Number(isRoutineInternalCall(dropped)) > 0 ? { internal: (omitted.internal ?? 0) + Number(isRoutineInternalCall(dropped)) } : {},
232
234
  ...(omitted.failed ?? 0) + (dropped.success === false ? 1 : 0) > 0 ? { failed: (omitted.failed ?? 0) + (dropped.success === false ? 1 : 0) } : {}
233
235
  };
234
236
  }
@@ -302,11 +304,12 @@ var readFabricExecutionRenderDetails = (value) => {
302
304
  };
303
305
  var omittedCalls = (value) => {
304
306
  if (!isRecord(value)) return void 0;
305
- const { count, done, failed } = value;
307
+ const { count, done, failed, internal } = value;
306
308
  if (typeof count !== "number" || !Number.isInteger(count) || count <= 0) return void 0;
307
309
  const finished = typeof done === "number" && Number.isInteger(done) ? Math.min(Math.max(0, done), count) : 0;
308
310
  const failures = typeof failed === "number" && Number.isInteger(failed) ? Math.min(Math.max(0, failed), finished) : 0;
309
- return { omittedCalls: { count, done: finished, ...failures > 0 ? { failed: failures } : {} } };
311
+ const plumbing = typeof internal === "number" && Number.isInteger(internal) ? Math.min(Math.max(0, internal), finished - failures) : 0;
312
+ return { omittedCalls: { count, done: finished, ...failures > 0 ? { failed: failures } : {}, ...plumbing > 0 ? { internal: plumbing } : {} } };
310
313
  };
311
314
  var FABRIC_PARTIAL_AUDITS_MAX_BYTES = 128 * 1024;
312
315
  var FABRIC_PARTIAL_UPDATE_MAX_BYTES = 256 * 1024;
@@ -364,10 +367,12 @@ var createFabricPartialExecutionDetails = (input) => {
364
367
  const audits = [...kept.keys()].sort((left, right) => left - right).map((index) => kept.get(index));
365
368
  let omittedDone = 0;
366
369
  let omittedFailed = 0;
370
+ let omittedInternal = 0;
367
371
  for (let index = 0; index < total; index++) {
368
372
  if (!kept.has(index)) {
369
373
  if (input.audits[index].success !== void 0) omittedDone++;
370
374
  if (input.audits[index].success === false) omittedFailed++;
375
+ if (isRoutineInternalCall(input.audits[index])) omittedInternal++;
371
376
  }
372
377
  }
373
378
  const omitted = total - audits.length;
@@ -377,7 +382,7 @@ var createFabricPartialExecutionDetails = (input) => {
377
382
  ...input.deadlineAt !== void 0 ? { deadlineAt: input.deadlineAt } : {},
378
383
  phases: [],
379
384
  audits,
380
- ...omitted > 0 ? { omittedCalls: { count: omitted, done: omittedDone, ...omittedFailed > 0 ? { failed: omittedFailed } : {} } } : {}
385
+ ...omitted > 0 ? { omittedCalls: { count: omitted, done: omittedDone, ...omittedFailed > 0 ? { failed: omittedFailed } : {}, ...omittedInternal > 0 ? { internal: omittedInternal } : {} } } : {}
381
386
  };
382
387
  let bytes = serializedBytes({ content: [{ type: "text", text: progress ?? "" }], details });
383
388
  for (let index = input.phases.length - 1; index >= Math.max(0, input.phases.length - PARTIAL_PHASES); index--) {
@@ -2299,6 +2304,13 @@ ${preview}` : ""}${hiddenHint}`,
2299
2304
  audits = restoreFabricWritePreviews(audits, rendererState.fabricWritePreviews);
2300
2305
  }
2301
2306
  }
2307
+ audits = audits.filter((audit) => !isRoutineInternalCall(audit));
2308
+ const internal = details.omittedCalls?.internal ?? 0;
2309
+ if (details.omittedCalls && internal > 0) {
2310
+ const count = details.omittedCalls.count - internal;
2311
+ if (count > 0) details.omittedCalls = { ...details.omittedCalls, count, done: details.omittedCalls.done - internal, internal: 0 };
2312
+ else delete details.omittedCalls;
2313
+ }
2302
2314
  const phases = details.phases;
2303
2315
  const nl = "\n";
2304
2316
  const allRowIndexes = (lines, enabled) => enabled ? new Set(lines.map((_line, index) => index)) : void 0;
@@ -4182,7 +4194,7 @@ var colorStatus = (theme, status, value) => {
4182
4194
  var phaseProgress = (run, phaseId) => {
4183
4195
  const phase = run.phases.find((candidate) => candidate.id === phaseId);
4184
4196
  const statuses = [
4185
- ...run.calls.filter((call) => call.phaseId === phaseId).map((call) => call.status),
4197
+ ...run.calls.filter((call) => !isRoutineInternalCall(call) && call.phaseId === phaseId).map((call) => call.status),
4186
4198
  ...run.items.filter((item) => item.phaseId === phaseId).map((item) => item.status)
4187
4199
  ];
4188
4200
  const completed = statuses.filter((status) => status === "completed").length;
@@ -4223,17 +4235,20 @@ var treeOrder = (agents) => {
4223
4235
  }
4224
4236
  const ordered = [];
4225
4237
  const seen = /* @__PURE__ */ new Set();
4226
- const visit = (agent, depth) => {
4238
+ const visit = (agent, ancestors, last) => {
4227
4239
  if (seen.has(agent.id)) return;
4228
4240
  seen.add(agent.id);
4229
- ordered.push({ agent, depth });
4230
- for (const child of children.get(agent.id) ?? []) visit(child, depth + 1);
4241
+ const depth = ancestors.length;
4242
+ const prefix = depth === 0 ? "" : `${ancestors.slice(1).map((more) => more ? "\u2502 " : " ").join("")}${last ? "\u2514\u2500 " : "\u251C\u2500 "}`;
4243
+ ordered.push({ agent, depth, prefix });
4244
+ const descendants = (children.get(agent.id) ?? []).filter((child) => !seen.has(child.id));
4245
+ descendants.forEach((child, index) => visit(child, [...ancestors, !last], index === descendants.length - 1));
4231
4246
  };
4232
- for (const root of roots) visit(root, 0);
4233
- for (const agent of agents) visit(agent, 0);
4247
+ for (const root of roots) visit(root, [], true);
4248
+ for (const agent of agents) visit(agent, [], true);
4234
4249
  return ordered;
4235
4250
  };
4236
- var agentLine = (theme, agent, now, depth, selected, width) => {
4251
+ var agentLine = (theme, agent, now, prefix, selected, width) => {
4237
4252
  const status = colorStatus(theme, agent.status, circle(selected));
4238
4253
  const live = isActiveStatus(agent.status);
4239
4254
  const activity = live ? agent.milestone ?? agent.currentTool ?? (agent.status === "running" ? "thinking" : agent.status) : agent.error ? `error: ${safeText(agent.error)}` : agent.text ? `result: ${safeText(agent.text)}` : agent.status;
@@ -4244,7 +4259,9 @@ var agentLine = (theme, agent, now, depth, selected, width) => {
4244
4259
  agent.startedAt ? formatDuration((agent.finishedAt ?? now) - agent.startedAt) : void 0
4245
4260
  ].filter((value) => Boolean(value));
4246
4261
  const name = safeText(agent.name);
4247
- const lead = `${" ".repeat(depth)}${status} ${selected ? theme.bold(name) : theme.fg("muted", name)}`;
4262
+ const prefixBudget = Math.max(0, Math.floor(width / 3));
4263
+ const compactPrefix = prefix.length <= prefixBudget ? prefix : prefixBudget >= 4 ? `\u2026${prefix.slice(-(prefixBudget - 1))}` : "";
4264
+ const lead = `${theme.fg("dim", compactPrefix)}${status} ${selected ? theme.bold(name) : theme.fg("muted", name)}`;
4248
4265
  return fitLine(theme, width, lead, { text: safeText(activity).replace(/\s+/g, " ").trim(), gap: " ", color: "muted" }, metrics, []);
4249
4266
  };
4250
4267
  var shouldShowFabricWidget = (snapshot, mode, retention = new FabricWidgetRetention()) => {
@@ -4270,10 +4287,13 @@ var widgetRowLimit = (maxRows, terminalRows) => {
4270
4287
  const paneShare = Math.floor(terminalRows * WIDGET_TERMINAL_ROW_SHARE);
4271
4288
  return Math.max(1, Math.min(configured, paneShare));
4272
4289
  };
4273
- var widgetFocusedRowLimit = (maxRows, terminalRows) => {
4274
- const limit = widgetRowLimit(maxRows, terminalRows);
4275
- if (terminalRows === void 0 || !Number.isFinite(terminalRows) || terminalRows <= 0) return limit;
4276
- return Math.max(limit, Math.floor(terminalRows * WIDGET_TERMINAL_ROW_SHARE));
4290
+ var widgetFocusedRowLimit = (maxRows, terminalRows) => widgetRowLimit(maxRows, terminalRows);
4291
+ var widgetViewport = (contentRows, budget, offset) => {
4292
+ const available = Math.max(0, Math.floor(budget));
4293
+ const hasCue = contentRows > available && available > 1;
4294
+ const windowRows = Math.max(0, available - Number(hasCue));
4295
+ const maxOffset = windowRows > 0 ? Math.max(0, contentRows - windowRows) : 0;
4296
+ return { windowRows, hasCue, maxOffset, offset: Math.max(0, Math.min(maxOffset, Math.floor(offset))) };
4277
4297
  };
4278
4298
  var HEADER_ROW = "\0main";
4279
4299
  var FabricWidget = class {
@@ -4295,23 +4315,28 @@ var FabricWidget = class {
4295
4315
  /** Rows above the header in the last render: the spacer, or none on a one-row budget. */
4296
4316
  #spacerRows = 1;
4297
4317
  #renderedInteraction;
4318
+ #scrollOffset = 0;
4319
+ #maxScrollOffset = 0;
4320
+ #followSelection = false;
4298
4321
  /** Select the row on screen, or the first row; used when focus arrives from the keyboard. */
4299
4322
  selectDefault() {
4300
4323
  const rows = this.#selectableRows();
4301
4324
  if (rows.some((row) => row.id === this.#selectedId)) return;
4302
4325
  const viewing = this.interaction?.viewing?.();
4303
4326
  this.#selectedId = rows.find((row) => row.id === viewing)?.id ?? rows[0]?.id;
4327
+ this.#followSelection = true;
4304
4328
  }
4305
4329
  /** Select the top row; ↓ from the editor lands on the row next to it. */
4306
4330
  selectFirst() {
4307
4331
  this.#selectedId = this.#selectableRows()[0]?.id;
4332
+ this.#followSelection = true;
4308
4333
  }
4309
4334
  /** True while at least one row can take focus. */
4310
4335
  hasRows() {
4311
4336
  return this.#selectableRows().length > 0;
4312
4337
  }
4313
4338
  #interactionKey() {
4314
- return `${this.focused}|${this.#selectedId ?? ""}|${this.#hoveredId ?? ""}|${this.interaction?.viewing?.() ?? ""}|${this.interaction?.collapseIdle?.() ?? ""}`;
4339
+ return `${this.focused}|${this.#selectedId ?? ""}|${this.#hoveredId ?? ""}|${this.#scrollOffset}|${this.#followSelection}|${this.interaction?.viewing?.() ?? ""}|${this.interaction?.collapseIdle?.() ?? ""}`;
4315
4340
  }
4316
4341
  handleInput(data) {
4317
4342
  this.#hoveredId = void 0;
@@ -4319,7 +4344,10 @@ var FabricWidget = class {
4319
4344
  const index = Math.max(0, rows.findIndex((row) => row.id === this.#selectedId));
4320
4345
  const select = (next) => {
4321
4346
  const row = rows[Math.max(0, Math.min(rows.length - 1, next))];
4322
- if (row) this.#selectedId = row.id;
4347
+ if (row) {
4348
+ this.#selectedId = row.id;
4349
+ this.#followSelection = true;
4350
+ }
4323
4351
  };
4324
4352
  if (matchesKey(data, "escape") || matchesKey(data, FABRIC_WIDGET_FOCUS_SHORTCUT)) {
4325
4353
  this.interaction?.release();
@@ -4339,6 +4367,15 @@ var FabricWidget = class {
4339
4367
  }
4340
4368
  handleMouse(event) {
4341
4369
  if (!this.interaction) return void 0;
4370
+ if (event.type === "wheel") {
4371
+ if (event.x < 0 || event.x >= (this.#lastWidth ?? 0) || event.y < this.#spacerRows || event.y >= (this.#lastLines?.length ?? 0) || this.#maxScrollOffset === 0 || !Number.isFinite(event.wheelDelta) || !event.wheelDelta) return void 0;
4372
+ const offset = Math.max(0, Math.min(this.#maxScrollOffset, this.#scrollOffset + Math.trunc(event.wheelDelta)));
4373
+ const changed = offset !== this.#scrollOffset;
4374
+ this.#scrollOffset = offset;
4375
+ this.#followSelection = false;
4376
+ this.#hoveredId = void 0;
4377
+ return { handled: true, render: changed };
4378
+ }
4342
4379
  const row = this.#rows.find((candidate) => candidate.line === event.y - this.#spacerRows);
4343
4380
  if (event.type === "move") {
4344
4381
  const header = event.y === this.#spacerRows && (this.#lastLines?.length ?? 0) > this.#spacerRows;
@@ -4364,8 +4401,8 @@ var FabricWidget = class {
4364
4401
  if (budget === 0) return [];
4365
4402
  const { lines, rows } = this.#content(this.snapshot(), Number.MAX_SAFE_INTEGER);
4366
4403
  const body = Math.max(1, budget - (budget >= 2 ? 1 : 0));
4367
- const visible = body >= 3 && lines.length > body ? body - 1 : body;
4368
- return this.focused && body > 1 ? rows : rows.filter((row) => row.line < visible);
4404
+ const viewport = widgetViewport(lines.length - 1, body - 1, this.#scrollOffset);
4405
+ return this.focused && body > 1 ? rows : rows.filter((row) => row.line === 0 || row.line > viewport.offset && row.line <= viewport.offset + viewport.windowRows);
4369
4406
  }
4370
4407
  #rowLimit(width = this.#lastWidth) {
4371
4408
  const limit = this.focused ? widgetFocusedRowLimit(this.maxRows, this.terminalRows?.()) : widgetRowLimit(this.maxRows, this.terminalRows?.());
@@ -4429,30 +4466,30 @@ var FabricWidget = class {
4429
4466
  if (this.#hoveredId !== void 0 && this.#hoveredId !== HEADER_ROW && !rows.some((row) => row.id === this.#hoveredId)) {
4430
4467
  this.#hoveredId = void 0;
4431
4468
  }
4432
- const selectedLine = this.focused && body > 1 ? rows.find((row) => row.id === this.#selectedId)?.line ?? 0 : 0;
4433
- let capacity = body - 1;
4434
- let start = Math.max(1, selectedLine - capacity + 1);
4435
- let below = Math.max(0, lines.length - start - capacity);
4436
- if (below > 0 && body >= 3) {
4437
- capacity--;
4438
- start = Math.max(1, selectedLine - capacity + 1);
4439
- below = Math.max(0, lines.length - start - capacity);
4440
- }
4441
- const above = start - 1;
4442
- const upLabel = above > 0 ? `\u2191 ${above} more` : void 0;
4443
- const downLabel = body < 3 && below > 0 ? `\u2193 ${below} more` : void 0;
4444
- let label = upLabel ?? downLabel;
4445
- if (upLabel && downLabel) {
4446
- const identityWidth = 2 + visibleWidth2(safeText(snapshot.sessionLabel ?? "Fabric"));
4447
- const candidates = [`${upLabel} \xB7 ${downLabel}`, `\u2191 ${above} \xB7 \u2193 ${below}`, upLabel, `\u2191 ${above}`];
4448
- const fits = (candidate, identity) => visibleWidth2(candidate) + 1 + identity <= width;
4449
- label = candidates.find((candidate) => fits(candidate, identityWidth)) ?? candidates.find((candidate) => fits(candidate, Math.min(identityWidth, 8)));
4469
+ let viewport = widgetViewport(lines.length - 1, body - 1, this.#scrollOffset);
4470
+ if (this.focused && this.#followSelection && viewport.windowRows > 0) {
4471
+ const selected = (rows.find((row) => row.id === this.#selectedId)?.line ?? 0) - 1;
4472
+ let offset = viewport.offset;
4473
+ if (selected < offset) offset = Math.max(0, selected);
4474
+ else if (selected >= offset + viewport.windowRows) offset = selected - viewport.windowRows + 1;
4475
+ viewport = widgetViewport(lines.length - 1, body - 1, offset);
4450
4476
  }
4477
+ this.#followSelection = false;
4478
+ this.#scrollOffset = viewport.offset;
4479
+ this.#maxScrollOffset = viewport.maxOffset;
4480
+ const capacity = viewport.windowRows;
4481
+ const start = viewport.offset + 1;
4482
+ const below = Math.max(0, lines.length - start - capacity);
4483
+ const above = viewport.offset;
4484
+ const identityWidth = 2 + visibleWidth2(safeText(snapshot.sessionLabel ?? "Fabric"));
4485
+ const labels = above > 0 ? [`\u2191 ${above} more`, `\u2191 ${above}`] : [];
4486
+ const fits = (label2, identity) => visibleWidth2(label2) + 1 + identity <= width;
4487
+ const label = labels.find((label2) => fits(label2, identityWidth)) ?? labels.find((label2) => fits(label2, Math.min(identityWidth, 8)));
4451
4488
  const headerWidth = label && width >= visibleWidth2(label) + 2 ? width - visibleWidth2(label) - 1 : width;
4452
4489
  const header = headerWidth === width ? lines[0] ?? "" : this.#content(snapshot, width, headerWidth).lines[0] ?? "";
4453
4490
  const boundedHeader = label ? this.#withRightLabel(header, label, width) : truncateToWidth3(header, width);
4454
4491
  const visibleLines = [boundedHeader, ...lines.slice(start, start + capacity).map((line) => truncateToWidth3(line, width))];
4455
- if (below > 0 && body >= 3) visibleLines.push(truncateToWidth3(this.theme.fg("dim", `\u2193 ${below} more`), width));
4492
+ if (viewport.hasCue) visibleLines.push(below > 0 ? truncateToWidth3(this.theme.fg("dim", `\u2193 ${below} more`), width) : "");
4456
4493
  this.#rows = rows.filter((row) => row.line === 0 || row.line >= start && row.line < start + capacity).map((row) => ({ ...row, line: row.line === 0 ? 0 : row.line - start + 1 }));
4457
4494
  if (rows.length === 0 && this.interaction?.collapseIdle?.()) return [];
4458
4495
  this.#spacerRows = spacer;
@@ -4481,7 +4518,7 @@ var FabricWidget = class {
4481
4518
  const visibleActors = snapshot.actors.filter((actor) => actor.status !== "stopped");
4482
4519
  const activeActorWorkers = visibleActors.filter((actor) => actor.worker && isActiveStatus(actor.worker.status)).map((actor) => ({ ...actor.worker, name: actor.name, actorId: actor.id }));
4483
4520
  const terminalActorWorkers = visibleActors.filter((actor) => actor.worker && !isActiveStatus(actor.worker.status)).map((actor) => ({ ...actor.worker, name: actor.name, actorId: actor.id }));
4484
- const nestedCalls = run?.calls.filter((call) => call.kind !== "agent" && call.kind !== "actor") ?? [];
4521
+ const nestedCalls = run?.calls.filter((call) => !isRoutineInternalCall(call) && call.kind !== "agent" && call.kind !== "actor") ?? [];
4485
4522
  const shells = snapshot.shells ?? [];
4486
4523
  const liveShells = shells.filter((job) => job.finishedAt === void 0);
4487
4524
  const recentShells = shells.filter((job) => job.finishedAt !== void 0 && isRecentWidgetCompletion(job.finishedAt, snapshot.now));
@@ -4529,7 +4566,7 @@ var FabricWidget = class {
4529
4566
  parts,
4530
4567
  this.#hints(hasRows)
4531
4568
  ));
4532
- const pushParticipant = (agent, kind, depth = 0) => {
4569
+ const pushParticipant = (agent, kind, prefix = "") => {
4533
4570
  const id = kind === "actor" ? agent.actorId ?? agent.id : agent.id;
4534
4571
  rows.push({
4535
4572
  id,
@@ -4538,7 +4575,7 @@ var FabricWidget = class {
4538
4575
  ...agent.model ? { model: agent.model } : {},
4539
4576
  line: lines.length
4540
4577
  });
4541
- lines.push(agentLine(this.theme, agent, snapshot.now, depth, id === marked, width));
4578
+ lines.push(agentLine(this.theme, agent, snapshot.now, prefix, id === marked, width));
4542
4579
  };
4543
4580
  const liveTrees = [];
4544
4581
  const settledTrees = [];
@@ -4547,10 +4584,10 @@ var FabricWidget = class {
4547
4584
  if (entry.depth === 0) liveRoot = isActiveStatus(entry.agent.status);
4548
4585
  (liveRoot ? liveTrees : settledTrees).push(entry);
4549
4586
  }
4550
- for (const { agent, depth } of liveTrees) pushParticipant(agent, "agent", depth);
4587
+ for (const { agent, prefix } of liveTrees) pushParticipant(agent, "agent", prefix);
4551
4588
  for (const agent of activeActorWorkers) pushParticipant(agent, "actor");
4552
4589
  for (const agent of terminalActorWorkers) pushParticipant(agent, "actor");
4553
- for (const { agent, depth } of settledTrees) pushParticipant(agent, "agent", depth);
4590
+ for (const { agent, prefix } of settledTrees) pushParticipant(agent, "agent", prefix);
4554
4591
  const shellLine = (job, name, detail, id) => {
4555
4592
  const status = job.stopping ? "stopping" : job.status;
4556
4593
  const elapsed2 = formatDuration((job.finishedAt ?? snapshot.now) - job.startedAt) || "0s";
@@ -6905,4 +6942,4 @@ export {
6905
6942
  FABRIC_MANAGED_HOST_VERSION,
6906
6943
  createFabricExtension
6907
6944
  };
6908
- //# sourceMappingURL=chunk-WGMCNCP6.js.map
6945
+ //# sourceMappingURL=chunk-G2DZJ5LK.js.map