@caupulican/pi-adaptative 0.80.14 → 0.80.16

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.
@@ -62,7 +62,7 @@ import { SettingsSelectorComponent } from "./components/settings-selector.js";
62
62
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
63
63
  import { ToolExecutionComponent } from "./components/tool-execution.js";
64
64
  import { ToolGroupComponent } from "./components/tool-group.js";
65
- import { getToolPanelActionKey, ToolPanelRegistry } from "./components/tool-panel-registry.js";
65
+ import { getToolPanelActionKey, shouldReuseToolPanelInPlace, ToolPanelRegistry, } from "./components/tool-panel-registry.js";
66
66
  import { TreeSelectorComponent } from "./components/tree-selector.js";
67
67
  import { TrustSelectorComponent } from "./components/trust-selector.js";
68
68
  import { UserMessageComponent } from "./components/user-message.js";
@@ -1567,8 +1567,16 @@ export class InteractiveMode {
1567
1567
  attachToolExecutionComponent(toolName, toolCallId, args) {
1568
1568
  const actionKey = getToolPanelActionKey(this.getToolPanelScope(), toolName, args);
1569
1569
  const toolDefinition = this.getRegisteredToolDefinition(toolName);
1570
- const existing = this.toolPanels.getReusable(actionKey);
1570
+ const reuseInPlace = shouldReuseToolPanelInPlace(toolName, args);
1571
+ const existing = this.toolPanels.getReusable(actionKey, { allowActive: reuseInPlace });
1571
1572
  if (existing) {
1573
+ if (reuseInPlace && actionKey) {
1574
+ existing.resetInvocation(toolName, toolCallId, args, toolDefinition);
1575
+ existing.setExpanded(this.toolOutputExpanded);
1576
+ this.toolPanels.replaceActiveForAction(toolCallId, existing, actionKey);
1577
+ this.ui.requestRender();
1578
+ return existing;
1579
+ }
1572
1580
  this.detachToolExecutionComponent(existing);
1573
1581
  existing.resetInvocation(toolName, toolCallId, args, toolDefinition);
1574
1582
  existing.setExpanded(this.toolOutputExpanded);
@@ -3538,8 +3546,13 @@ export class InteractiveMode {
3538
3546
  for (const message of preCommands) {
3539
3547
  await this.session.prompt(message.text);
3540
3548
  }
3541
- // Send first prompt (starts streaming)
3542
- const promptPromise = this.session.prompt(firstPrompt.text, { images: firstPrompt.images }).catch((error) => {
3549
+ // Send first prompt (starts streaming). Auto-compaction can finish while the
3550
+ // agent is still processing; in that case, queue the message with the same
3551
+ // steering/follow-up mode instead of surfacing an internal streamingBehavior error.
3552
+ const promptOptions = this.session.isStreaming
3553
+ ? { images: firstPrompt.images, streamingBehavior: firstPrompt.mode }
3554
+ : { images: firstPrompt.images };
3555
+ const promptPromise = this.session.prompt(firstPrompt.text, promptOptions).catch((error) => {
3543
3556
  restoreQueue(error);
3544
3557
  });
3545
3558
  // Queue remaining messages