pi-fabric 0.131.0 → 0.131.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.
@@ -4223,17 +4223,20 @@ var treeOrder = (agents) => {
4223
4223
  }
4224
4224
  const ordered = [];
4225
4225
  const seen = /* @__PURE__ */ new Set();
4226
- const visit = (agent, depth) => {
4226
+ const visit = (agent, ancestors, last) => {
4227
4227
  if (seen.has(agent.id)) return;
4228
4228
  seen.add(agent.id);
4229
- ordered.push({ agent, depth });
4230
- for (const child of children.get(agent.id) ?? []) visit(child, depth + 1);
4229
+ const depth = ancestors.length;
4230
+ const prefix = depth === 0 ? "" : `${ancestors.slice(1).map((more) => more ? "\u2502 " : " ").join("")}${last ? "\u2514\u2500 " : "\u251C\u2500 "}`;
4231
+ ordered.push({ agent, depth, prefix });
4232
+ const descendants = (children.get(agent.id) ?? []).filter((child) => !seen.has(child.id));
4233
+ descendants.forEach((child, index) => visit(child, [...ancestors, !last], index === descendants.length - 1));
4231
4234
  };
4232
- for (const root of roots) visit(root, 0);
4233
- for (const agent of agents) visit(agent, 0);
4235
+ for (const root of roots) visit(root, [], true);
4236
+ for (const agent of agents) visit(agent, [], true);
4234
4237
  return ordered;
4235
4238
  };
4236
- var agentLine = (theme, agent, now, depth, selected, width) => {
4239
+ var agentLine = (theme, agent, now, prefix, selected, width) => {
4237
4240
  const status = colorStatus(theme, agent.status, circle(selected));
4238
4241
  const live = isActiveStatus(agent.status);
4239
4242
  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 +4247,9 @@ var agentLine = (theme, agent, now, depth, selected, width) => {
4244
4247
  agent.startedAt ? formatDuration((agent.finishedAt ?? now) - agent.startedAt) : void 0
4245
4248
  ].filter((value) => Boolean(value));
4246
4249
  const name = safeText(agent.name);
4247
- const lead = `${" ".repeat(depth)}${status} ${selected ? theme.bold(name) : theme.fg("muted", name)}`;
4250
+ const prefixBudget = Math.max(0, Math.floor(width / 3));
4251
+ const compactPrefix = prefix.length <= prefixBudget ? prefix : prefixBudget >= 4 ? `\u2026${prefix.slice(-(prefixBudget - 1))}` : "";
4252
+ const lead = `${theme.fg("dim", compactPrefix)}${status} ${selected ? theme.bold(name) : theme.fg("muted", name)}`;
4248
4253
  return fitLine(theme, width, lead, { text: safeText(activity).replace(/\s+/g, " ").trim(), gap: " ", color: "muted" }, metrics, []);
4249
4254
  };
4250
4255
  var shouldShowFabricWidget = (snapshot, mode, retention = new FabricWidgetRetention()) => {
@@ -4529,7 +4534,7 @@ var FabricWidget = class {
4529
4534
  parts,
4530
4535
  this.#hints(hasRows)
4531
4536
  ));
4532
- const pushParticipant = (agent, kind, depth = 0) => {
4537
+ const pushParticipant = (agent, kind, prefix = "") => {
4533
4538
  const id = kind === "actor" ? agent.actorId ?? agent.id : agent.id;
4534
4539
  rows.push({
4535
4540
  id,
@@ -4538,7 +4543,7 @@ var FabricWidget = class {
4538
4543
  ...agent.model ? { model: agent.model } : {},
4539
4544
  line: lines.length
4540
4545
  });
4541
- lines.push(agentLine(this.theme, agent, snapshot.now, depth, id === marked, width));
4546
+ lines.push(agentLine(this.theme, agent, snapshot.now, prefix, id === marked, width));
4542
4547
  };
4543
4548
  const liveTrees = [];
4544
4549
  const settledTrees = [];
@@ -4547,10 +4552,10 @@ var FabricWidget = class {
4547
4552
  if (entry.depth === 0) liveRoot = isActiveStatus(entry.agent.status);
4548
4553
  (liveRoot ? liveTrees : settledTrees).push(entry);
4549
4554
  }
4550
- for (const { agent, depth } of liveTrees) pushParticipant(agent, "agent", depth);
4555
+ for (const { agent, prefix } of liveTrees) pushParticipant(agent, "agent", prefix);
4551
4556
  for (const agent of activeActorWorkers) pushParticipant(agent, "actor");
4552
4557
  for (const agent of terminalActorWorkers) pushParticipant(agent, "actor");
4553
- for (const { agent, depth } of settledTrees) pushParticipant(agent, "agent", depth);
4558
+ for (const { agent, prefix } of settledTrees) pushParticipant(agent, "agent", prefix);
4554
4559
  const shellLine = (job, name, detail, id) => {
4555
4560
  const status = job.stopping ? "stopping" : job.status;
4556
4561
  const elapsed2 = formatDuration((job.finishedAt ?? snapshot.now) - job.startedAt) || "0s";
@@ -6905,4 +6910,4 @@ export {
6905
6910
  FABRIC_MANAGED_HOST_VERSION,
6906
6911
  createFabricExtension
6907
6912
  };
6908
- //# sourceMappingURL=chunk-WGMCNCP6.js.map
6913
+ //# sourceMappingURL=chunk-W3N72XYK.js.map