@parhelia/core 0.1.12934 → 0.1.12936

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 (31) hide show
  1. package/dist/agents-view/AgentCard.js +1 -1
  2. package/dist/agents-view/AgentCard.js.map +1 -1
  3. package/dist/agents-view/AgentProfileIcon.js +3 -3
  4. package/dist/agents-view/AgentProfileIcon.js.map +1 -1
  5. package/dist/agents-view/ProfileAgentsGroup.js +1 -1
  6. package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
  7. package/dist/config/config.js +2 -2
  8. package/dist/config/config.js.map +1 -1
  9. package/dist/editor/ImageEditor.js +1 -1
  10. package/dist/editor/PictureEditor.js +1 -1
  11. package/dist/editor/ai/terminal/components/AgentTerminalSummaryLayout.js +1 -1
  12. package/dist/editor/ai/terminal/components/AgentTerminalSummaryLayout.js.map +1 -1
  13. package/dist/editor/ai/terminal/components/ContextInfoBar.js +2 -2
  14. package/dist/editor/ai/terminal/components/ContextInfoBar.js.map +1 -1
  15. package/dist/editor/ai-image-editor/AiImageEditorDialog.js +1 -1
  16. package/dist/editor/client/EditorShell.js +27 -3
  17. package/dist/editor/client/EditorShell.js.map +1 -1
  18. package/dist/editor/client/agentTerminalFocus.d.ts +21 -0
  19. package/dist/editor/client/agentTerminalFocus.js +40 -0
  20. package/dist/editor/client/agentTerminalFocus.js.map +1 -0
  21. package/dist/editor/content-tree/IndicatorSettings.js +2 -1
  22. package/dist/editor/content-tree/IndicatorSettings.js.map +1 -1
  23. package/dist/editor/page-viewer/EditorForm.js +4 -3
  24. package/dist/editor/page-viewer/EditorForm.js.map +1 -1
  25. package/dist/editor/page-viewer/PageViewerFrame.js +16 -0
  26. package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
  27. package/dist/editor/tree-indicators/GutterColumns.js +2 -1
  28. package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
  29. package/dist/revision.d.ts +2 -2
  30. package/dist/revision.js +2 -2
  31. package/package.json +1 -1
@@ -12,6 +12,7 @@ import { getOperationsContext } from "./operations";
12
12
  import { handleErrorResult } from "./helpers";
13
13
  import { showExpandableErrorToast } from "./errorToast";
14
14
  import { isManualShowMeFocusTransfer, isManualShowMeTarget, } from "./manualShowMeFocus";
15
+ import { isAgentTerminalFocusTransfer, nextAgentTerminalInteractionAt, } from "./agentTerminalFocus";
15
16
  import { executeFieldAction as executeFieldServerAction, connectSocket, getEditHistory, getRunningOperations, reconnectSession, releaseFieldLocks, validateItems, } from "../services/editService";
16
17
  import { emitAgentDocumentsChanged } from "../services/agentService";
17
18
  import { onSocketReconnect as onAgentSocketReconnect } from "../services/agentSubscriptionRegistry";
@@ -509,6 +510,12 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
509
510
  // Used by the field-blur guard so clicking a field-gated Show me button keeps
510
511
  // the focused field (and thus the `.focused-field` anchor + field actions).
511
512
  const manualShowMePointerDownAtRef = useRef(0);
513
+ // Timestamp of the most recent pointer-down/focusin inside the agent
514
+ // terminal. Used by the field-blur guard so moving focus into the agent
515
+ // prompt keeps the focused field (and its live agent context chip). Reset to
516
+ // 0 by interactions outside the terminal so the grace window never shields a
517
+ // clear caused by a later click elsewhere.
518
+ const agentTerminalInteractionAtRef = useRef(0);
512
519
  const [currentItemDescriptor, setCurrentItemDescriptor] = useState();
513
520
  const currentItemDescriptorRef = useRef(undefined);
514
521
  const latestGlobalLoadKeyRef = useRef(null);
@@ -4099,7 +4106,13 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
4099
4106
  lastPointerDownAt: manualShowMePointerDownAtRef.current,
4100
4107
  now: Date.now(),
4101
4108
  });
4102
- if (!ignoreBlur && !focusMovedToShowMe) {
4109
+ // Likewise keep the field (and its agent context chip) when the blur
4110
+ // was caused by moving focus into the agent terminal.
4111
+ const focusMovedToAgentTerminal = isAgentTerminalFocusTransfer({
4112
+ lastAgentTerminalInteractionAt: agentTerminalInteractionAtRef.current,
4113
+ now: Date.now(),
4114
+ });
4115
+ if (!ignoreBlur && !focusMovedToShowMe && !focusMovedToAgentTerminal) {
4103
4116
  logFieldValueDiagnostic("focused-field", "clearing focused field", {
4104
4117
  previousFocusedField: summarizeFieldDescriptor(focusedFieldRef.current),
4105
4118
  lockedField: summarizeFieldDescriptor(lockedField),
@@ -4111,9 +4124,14 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
4111
4124
  }
4112
4125
  else {
4113
4126
  logFieldValueDiagnostic("focused-field", "clear skipped", {
4114
- reason: ignoreBlur ? "ignoreBlur" : "manual show-me focus transfer",
4127
+ reason: ignoreBlur
4128
+ ? "ignoreBlur"
4129
+ : focusMovedToShowMe
4130
+ ? "manual show-me focus transfer"
4131
+ : "agent terminal focus transfer",
4115
4132
  previousFocusedField: summarizeFieldDescriptor(focusedFieldRef.current),
4116
4133
  focusMovedToShowMe,
4134
+ focusMovedToAgentTerminal,
4117
4135
  });
4118
4136
  }
4119
4137
  }
@@ -4492,7 +4510,10 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
4492
4510
  }, [operations.onFieldBlur]);
4493
4511
  // Record pointer-downs on User Manual "Show me" controls before the field
4494
4512
  // blur fires, so the blur guard above can keep the focused field for
4495
- // field-gated reveals regardless of focus/activeElement timing.
4513
+ // field-gated reveals regardless of focus/activeElement timing. The same
4514
+ // listener tracks agent terminal interactions (focusin included, for Tab
4515
+ // into the prompt) for the agent-terminal blur guard; interactions outside
4516
+ // the terminal reset that timestamp.
4496
4517
  useEffect(() => {
4497
4518
  if (typeof document === "undefined")
4498
4519
  return;
@@ -4500,12 +4521,15 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
4500
4521
  if (isManualShowMeTarget(event.target)) {
4501
4522
  manualShowMePointerDownAtRef.current = Date.now();
4502
4523
  }
4524
+ agentTerminalInteractionAtRef.current = nextAgentTerminalInteractionAt(event.target, Date.now());
4503
4525
  };
4504
4526
  document.addEventListener("pointerdown", handlePointerDown, true);
4505
4527
  document.addEventListener("mousedown", handlePointerDown, true);
4528
+ document.addEventListener("focusin", handlePointerDown, true);
4506
4529
  return () => {
4507
4530
  document.removeEventListener("pointerdown", handlePointerDown, true);
4508
4531
  document.removeEventListener("mousedown", handlePointerDown, true);
4532
+ document.removeEventListener("focusin", handlePointerDown, true);
4509
4533
  };
4510
4534
  }, []);
4511
4535
  const isReadOnly = !item ||