@design.estate/dees-catalog 21.40.0 → 21.41.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.
Files changed (40) hide show
  1. package/dist_bundle/bundle.js +258 -113
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5K6O7YAL.js → chunk-6S3PVK6Y.js} +6 -2
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5K6O7YAL.js.map → chunk-6S3PVK6Y.js.map} +1 -1
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-V55MXKAS.js → chunk-DGKFXX4X.js} +3 -3
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-GQD5HSUW.js → chunk-OUB3OAV2.js} +2 -2
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-6VMRGXCJ.js → de-2ALUFQHJ.js} +6 -2
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-6VMRGXCJ.js.map → de-2ALUFQHJ.js.map} +1 -1
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-QSZV6TA6.js → dees-modal-CDXSOKKD.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-FXF7TT4M.js → dees-workspace-terminal-46JECUZO.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +3 -1
  13. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +13 -2
  14. package/dist_ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.d.ts +16 -0
  15. package/dist_ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.js +59 -19
  16. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.d.ts +12 -2
  17. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.demo.js +36 -2
  18. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.js +95 -11
  19. package/dist_ts_web/elements/00group-harness/interfaces.d.ts +14 -1
  20. package/dist_ts_web/elements/00group-input/dees-input-dropdown/dees-input-dropdown-popup.d.ts +2 -0
  21. package/dist_ts_web/elements/00group-input/dees-input-dropdown/dees-input-dropdown-popup.js +12 -3
  22. package/dist_ts_web/i18n/de.d.ts +16 -0
  23. package/dist_ts_web/i18n/de.js +5 -1
  24. package/dist_ts_web/i18n/messages.d.ts +16 -0
  25. package/dist_ts_web/i18n/messages.js +5 -1
  26. package/package.json +1 -1
  27. package/readme.md +7 -5
  28. package/ts_web/00_commitinfo_data.ts +1 -1
  29. package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +7 -0
  30. package/ts_web/elements/00group-harness/dees-harness-session-list/dees-harness-session-list.ts +53 -17
  31. package/ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.demo.ts +38 -1
  32. package/ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.ts +104 -10
  33. package/ts_web/elements/00group-harness/interfaces.ts +16 -1
  34. package/ts_web/elements/00group-input/dees-input-dropdown/dees-input-dropdown-popup.ts +10 -2
  35. package/ts_web/i18n/de.ts +4 -0
  36. package/ts_web/i18n/messages.ts +4 -0
  37. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-V55MXKAS.js.map → chunk-DGKFXX4X.js.map} +0 -0
  38. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-GQD5HSUW.js.map → chunk-OUB3OAV2.js.map} +0 -0
  39. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-QSZV6TA6.js.map → dees-modal-CDXSOKKD.js.map} +0 -0
  40. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-FXF7TT4M.js.map → dees-workspace-terminal-46JECUZO.js.map} +0 -0
package/readme.md CHANGED
@@ -5650,13 +5650,13 @@ chat.refreshMessages();
5650
5650
  chat.refreshMessages([]);
5651
5651
  ```
5652
5652
 
5653
- Key props: `messages`, `permissions`, `questions`, `status`, `transcriptKey`, `hasEarlierMessages`/`loadingEarlier`, `usage`, `todos`/`todosAuthoritative`/`showTodosPanel`, `sessionMetrics`, `scratchpad`/`scratchpadBusy`/`scratchpadError`, `sessionIntelligenceEnabled`/`intelligenceExchanges`/`intelligenceBusy`/`intelligenceError`/`intelligenceAvailabilityStatus`/`intelligenceUnavailableReason`/`intelligenceAvailabilityAction`/`intelligenceHeading`, `showSessionSidebar`, `heading`, `subheading`, `toolbarActions`, `showToolbar`, `busy`, `busyDeliveryModes`, `queuedCount`, `disabled`, `inputLocked`, `abortEnabled`, `abortDisabledReason`, `commands`, `starterPrompts`, `account`/`accountOptions`/`accountNote`, `model`/`modelOptions`, `reasoningEffort`/`effortOptions`, `mode`/`modeOptions`, `menuActions`, `markdownWhileStreaming`, `toolRegistry`. `toolbarActions` accepts `IHarnessChatToolbarAction[]`; each action has `id`, human-readable `label`, `iconName`, `action`, and optional `tooltip`/`disabled`, and renders immediately before the session-details toggle. `disabled: true` makes only that toolbar action inert and prevents its callback without changing the chat-level `disabled` state. `markdownWhileStreaming` defaults to `true`; setting it to `false` keeps active outer and nested subtask markdown as plain text, then performs the final markdown parse when `message-end` arrives. `commands` is forwarded unchanged to the controlled composer. `starterPrompts` (`IHarnessStarterPrompt[]`, each `{ label, prompt? }`) shows as buttons under the empty transcript's text while the composer accepts input; choosing one puts its `prompt` (else its `label`) into the composer, focused and unsent, and emits `harness-input` as typing would. Account options use human-readable `label` values and opaque stable `value` identifiers. The status line renders inside the transcript column (it never pushes between the session panel and the composer), and both the toolbar and the docked composer cast a subtle shadow over the scrolling messages.
5653
+ Key props: `messages`, `permissions`, `questions`, `status`, `transcriptKey`, `hasEarlierMessages`/`loadingEarlier`, `usage`, `todos`/`todosAuthoritative`/`showTodosPanel`, `sessionMetrics`, `scratchpad`/`scratchpadBusy`/`scratchpadError`, `attachedResources`, `sessionIntelligenceEnabled`/`intelligenceExchanges`/`intelligenceBusy`/`intelligenceError`/`intelligenceAvailabilityStatus`/`intelligenceUnavailableReason`/`intelligenceAvailabilityAction`/`intelligenceHeading`, `showSessionSidebar`, `heading`, `subheading`, `toolbarActions`, `showToolbar`, `busy`, `busyDeliveryModes`, `queuedCount`, `disabled`, `inputLocked`, `abortEnabled`, `abortDisabledReason`, `commands`, `starterPrompts`, `account`/`accountOptions`/`accountNote`, `model`/`modelOptions`, `reasoningEffort`/`effortOptions`, `mode`/`modeOptions`, `menuActions`, `markdownWhileStreaming`, `toolRegistry`. `toolbarActions` accepts `IHarnessChatToolbarAction[]`; each action has `id`, human-readable `label`, `iconName`, `action`, and optional `tooltip`/`disabled`, and renders immediately before the session-details toggle. `disabled: true` makes only that toolbar action inert and prevents its callback without changing the chat-level `disabled` state. `markdownWhileStreaming` defaults to `true`; setting it to `false` keeps active outer and nested subtask markdown as plain text, then performs the final markdown parse when `message-end` arrives. `commands` is forwarded unchanged to the controlled composer. `starterPrompts` (`IHarnessStarterPrompt[]`, each `{ label, prompt? }`) shows as buttons under the empty transcript's text while the composer accepts input; choosing one puts its `prompt` (else its `label`) into the composer, focused and unsent, and emits `harness-input` as typing would. Account options use human-readable `label` values and opaque stable `value` identifiers. The status line renders inside the transcript column (it never pushes between the session panel and the composer), and both the toolbar and the docked composer cast a subtle shadow over the scrolling messages.
5654
5654
 
5655
5655
  Light-DOM content assigned to `slot="composer-status"` renders between the transcript and composer, outside the transcript scroller. `inputLocked` keeps the controlled draft readable, focusable, and copyable while blocking every mutation control and canceling queued or in-flight attachment ingestion. It does not disable Stop or the More options menu of `menuActions`. While busy, Stop remains visible; `abortEnabled=${false}` disables it, suppresses `harness-abort`, and exposes `abortDisabledReason` as its explanation.
5656
5656
 
5657
5657
  After mutating canonical message objects in place, call `refreshMessages(ids?)`. Pass IDs for targeted content corrections, omit them after structural mutations, and pass an empty array for a no-op. `DeesHarnessChat.refreshMessages(ids?)` uses the list semantics and, except for `[]`, also recomputes transcript-derived sidebar state. The list and individual message components expose the corresponding `refreshMessages(ids?)` and `refreshMessage()` methods.
5658
5658
 
5659
- A **session side panel** shows Tasks, Tools & Subagents, Tokens, Session Scratchpad, and Session Intelligence next to the transcript. Its sections form a single-open accordion: opening one collapses the others, clicking the open heading collapses all, and each expanded section owns its scrolling while every heading remains visible. Collapsed sections retain their region wrapper but omit the content subtree until expansion; sidebar-owned scratchpad and intelligence drafts survive that lazy remount. Tools & Subagents separates active calls from terminal history and derives both directly from top-level tool messages still present in the host's retained transcript window; evicted calls are not cached. Ordinary tool activity rows open `DeesHarnessToolFullscreen` over the canonical call and follow in-place updates through `refreshMessages()`; subagent rows first emit `harness-subtask-open`. The inspector closes when the call is evicted, the session changes, or the sidebar disconnects, then restores the row's focus. An unhandled subagent request opens the same fullscreen inspector. Long activity labels use an ellipsis while descriptions use the 40px right-edge fade and reveal behavior. Session Intelligence keeps its exchange history scrollable above a docked, chat-style question composer. Set `.todos` explicitly, or leave it empty and the chat derives tasks from the newest todo tool call in `messages`; `showTodosPanel={false}` hides only that section. Unknown token metrics remain absent. The toolbar controls the session panel; host-owned navigation controls belong outside the chat component. In narrow containers the session panel becomes an accessible overlay; when the toolbar is disabled, an inline Session details control keeps it reachable. `showSessionSidebar={false}` disables the complete panel. Methods: `applyDelta()`, `refreshMessages(ids?)`, `focusComposer()`, `clearComposer()`, `scrollToBottom()`, `openSessionSidebar(section?)`, `openModelSelector()`, `openAttachmentPicker()`, `focusPendingPermission()`, `showQuestionPersonResults(questionId, results)`, and `rejectQuestionResponse(questionId, rejection?)`. Section names use the exported `THarnessSessionSidebarSection` union. Capability launchers return false when their target is unavailable or locked, so command palettes can remain outside the shadow DOM. Events (also from children, all composed): `harness-send`, `harness-command`, `harness-starter-prompt`, `harness-abort`, `harness-held-resend`, `harness-held-discard`, `harness-input`, `harness-attachments-change`, `harness-attachment-error`, `harness-account-change`, `harness-model-change`, `harness-mode-change`, `harness-permission-response`, `harness-permission-link`, `harness-question-response`, `harness-question-link`, `harness-subtask-open`, `harness-scratchpad-save`, `harness-session-intelligence-ask`, `harness-session-intelligence-availability-action`.
5659
+ A **session side panel** shows Tasks, Tools & Subagents, Tokens, Session Scratchpad, Attached Resources, and Session Intelligence next to the transcript. Its sections form a single-open accordion: opening one collapses the others, clicking the open heading collapses all, and each expanded section owns its scrolling while every heading remains visible. Collapsed sections retain their region wrapper but omit the content subtree until expansion; sidebar-owned scratchpad and intelligence drafts survive that lazy remount. Tools & Subagents separates active calls from terminal history and derives both directly from top-level tool messages still present in the host's retained transcript window; evicted calls are not cached. Ordinary tool activity rows open `DeesHarnessToolFullscreen` over the canonical call and follow in-place updates through `refreshMessages()`; subagent rows first emit `harness-subtask-open`. The inspector closes when the call is evicted, the session changes, or the sidebar disconnects, then restores the row's focus. An unhandled subagent request opens the same fullscreen inspector. Long activity labels use an ellipsis while descriptions use the 40px right-edge fade and reveal behavior. Session Intelligence keeps its exchange history scrollable above a docked, chat-style question composer. Set `.todos` explicitly, or leave it empty and the chat derives tasks from the newest todo tool call in `messages`; `showTodosPanel={false}` hides only that section. Unknown token metrics remain absent. The toolbar controls the session panel; host-owned navigation controls belong outside the chat component. In narrow containers the session panel becomes an accessible overlay; when the toolbar is disabled, an inline Session details control keeps it reachable. `showSessionSidebar={false}` disables the complete panel. Methods: `applyDelta()`, `refreshMessages(ids?)`, `focusComposer()`, `clearComposer()`, `scrollToBottom()`, `openSessionSidebar(section?)`, `openModelSelector()`, `openAttachmentPicker()`, `focusPendingPermission()`, `showQuestionPersonResults(questionId, results)`, and `rejectQuestionResponse(questionId, rejection?)`. Section names use the exported `THarnessSessionSidebarSection` union. Capability launchers return false when their target is unavailable or locked, so command palettes can remain outside the shadow DOM. Events (also from children, all composed): `harness-send`, `harness-command`, `harness-starter-prompt`, `harness-abort`, `harness-held-resend`, `harness-held-discard`, `harness-input`, `harness-attachments-change`, `harness-attachment-error`, `harness-account-change`, `harness-model-change`, `harness-mode-change`, `harness-permission-response`, `harness-permission-link`, `harness-question-response`, `harness-question-link`, `harness-subtask-open`, `harness-scratchpad-input`, `harness-scratchpad-save`, `harness-attached-resource-open`, `harness-session-intelligence-ask`, `harness-session-intelligence-availability-action`.
5660
5660
 
5661
5661
  Set `.todosAuthoritative=${true}` when an empty host-owned task list must suppress transcript-derived fallback. A changed `transcriptKey` also clears the previous session's unsent Session Intelligence question while preserving the existing scratchpad revision handling.
5662
5662
 
@@ -5978,11 +5978,13 @@ in-flight reports and historical input.
5978
5978
 
5979
5979
  Tools & Subagents rows are buttons with a persistent inspect affordance. Selecting one opens the exported `DeesHarnessToolFullscreen` against that exact canonical call. `refreshCall()` updates an already open fullscreen renderer without replacing the call identity. The list moves rather than jumps: a new call makes its space — every row and group title it displaces glides there on `--dees-transition-default` — and then blends in, and a call that settles travels from its place in Active down into History, where it lands, because it keeps its key across the two groups. The first render, expanding the section, a new `sessionKey` and any update that moves nothing are all still, as is everything under `prefers-reduced-motion: reduce`.
5980
5980
 
5981
- Scratchpad edits emit `harness-scratchpad-save` with `{ text, expectedRevision }`. A newer incoming revision preserves a dirty local draft and offers explicit **Discard draft** and **Keep draft on latest** actions before saving can continue. Intelligence questions emit `harness-session-intelligence-ask` with `{ question }`; exchanges and busy/error states remain host-controlled. Direct sidebar hosts should update `sessionKey` when changing sessions; `DeesHarnessChat` forwards `transcriptKey` automatically.
5981
+ Scratchpad edits emit `harness-scratchpad-save` with `{ text, expectedRevision }`. Every keystroke in the editor also emits `harness-scratchpad-input` with the whole text as `{ text }` (`IHarnessScratchpadInputDetail`), so a host that holds the notes itself, such as a conversation that does not exist yet, can adopt them; saving still goes through `harness-scratchpad-save`. A newer incoming revision preserves a dirty local draft and offers explicit **Discard draft** and **Keep draft on latest** actions before saving can continue. Intelligence questions emit `harness-session-intelligence-ask` with `{ question }`; exchanges and busy/error states remain host-controlled. Direct sidebar hosts should update `sessionKey` when changing sessions; `DeesHarnessChat` forwards `transcriptKey` automatically.
5982
5982
 
5983
5983
  Direct sidebar hosts can set `intelligenceAvailabilityStatus`, `intelligenceUnavailableReason`, and `intelligenceHeading`; `intelligenceEnabled` still controls whether the section exists. The properties default to `available`, an empty reason, and `Session Intelligence`. A blank heading falls back to `Session Intelligence`, and unavailable state without a reason renders `<heading> is unavailable.` Only `available` permits `harness-session-intelligence-ask`; checking and unavailable states retain history and expose accessible status text. Set `intelligenceAvailabilityAction` to `{ label }` to offer a host-owned way out of the unavailable state; its button emits `harness-session-intelligence-availability-action` with `{ action }`, bubbling and composed, and is not rendered while checking or available. Like subagent navigation it stays usable while `disabled` is set, because it changes no session state. The availability union is exported as `THarnessIntelligenceAvailabilityStatus`.
5984
5984
 
5985
- `openSection(section)` expands and focuses an available section and returns false when that section has no current content. Its argument is the exported `THarnessSessionSidebarSection` union: `'tasks' | 'activity' | 'metrics' | 'scratchpad' | 'intelligence'`.
5985
+ Set `attachedResources` (`IHarnessResourceMeta[]`) to show the terminals, browsers and other host resources attached to the session, between Session Scratchpad and Session Intelligence. `undefined`, the default, leaves the section out; an empty array shows it with "No resources attached." Each row shows the resource's icon, title and state over its kind and preview, and is one button that emits `harness-attached-resource-open` with `{ resource }` (`IHarnessAttachedResourceOpenDetail`), bubbling and composed; the host opens the resource. `DeesHarnessChat` forwards `attachedResources`, and a defined value keeps its session panel available.
5986
+
5987
+ `openSection(section)` expands and focuses an available section and returns false when that section has no current content. Its argument is the exported `THarnessSessionSidebarSection` union: `'tasks' | 'activity' | 'metrics' | 'scratchpad' | 'resources' | 'intelligence'`.
5986
5988
 
5987
5989
  #### `DeesHarnessSidebar`
5988
5990
 
@@ -6050,7 +6052,7 @@ The compact **New group** button sits beside search whenever `enableGrouping` is
6050
6052
 
6051
6053
  The Sessions demo pairs the list with a selected-session workspace. Its controls step through starting, working, feedback, approval, completion and failure without timers or backend operations. Question and permission responses update the selected session; declining approval pauses it. The narrow layout switches between the preserved list and detail panes with an **All sessions** control that restores row focus.
6052
6054
 
6053
- Generic host resources use the exported `IHarnessResourceMeta` and `IHarnessResourceAssociation` contracts. Set `.resources`, `.resourceAssociations`, `.selectedResourceId`, and `.eligibleTargetsByResourceId`. Resource rows render as top-level rows in the ordered list, never as children of a session. Optional `projectLabel` renders on the resource metadata line after the kind and is searched like the title and preview. A resource can be attached to several items at once: `IHarnessResourceAssociation.targets` is a set of refs, de-duplicated on projection, and the row shows one marker per attachment — two by name, the rest as a `+N` count with every name in the row's title. `IHarnessResourceEventDetail.targets` carries the same set on select, open and context events. Resource metadata is presentation-only: the list never mounts a terminal, browser, file viewer, or other runtime.
6055
+ Generic host resources use the exported `IHarnessResourceMeta` and `IHarnessResourceAssociation` contracts. Set `.resources`, `.resourceAssociations`, `.selectedResourceId`, and `.eligibleTargetsByResourceId`. Resource rows render as top-level rows in the ordered list, never as children of a session. Optional `projectLabel` renders on the resource metadata line after the kind and is searched like the title and preview. Set `.attachableSessions` (`IHarnessSessionMeta[]`) to sessions that resources may attach to without rendering them: their titles name a resource's attachments, and association requests and `eligibleTargetsByResourceId` accept them as targets. A list with resources and no rendered sessions searches as "Search resources", so a host can show its resources alone, beside a conversation list that lives elsewhere. A resource can be attached to several items at once: `IHarnessResourceAssociation.targets` is a set of refs, de-duplicated on projection, and the row shows one marker per attachment — two by name, the rest as a `+N` count with every name in the row's title. `IHarnessResourceEventDetail.targets` carries the same set on select, open and context events. Resource metadata is presentation-only: the list never mounts a terminal, browser, file viewer, or other runtime.
6054
6056
 
6055
6057
  **Attaching is a deliberate gesture, never an accident of reordering.** An association is an access grant: it shows as a decorative marker on the resource row (a link icon plus each target's title, resolved from `sessions` or `resources` regardless of search or collapse) and never moves the row. A resource dropped on the **centre half of a row** attaches to it; the outer quarters of that same row, and every gap between rows, stay purely positional. The row being targeted shows a ring, a tint and a link badge, and no insertion gap opens while it does. A drag attaches an unattached resource and moves a singly attached one. A resource attached to several conversations is only repositioned by drag — it offers no attach affordance on any row, because a drag cannot say which of its attachments was meant; use **Move to…** for that. Keyboard moves stay positional; attaching by keyboard goes through the host's menu. The target is any other item, so a resource may be attached to a session **or** to another resource such as a terminal, and to several at once:
6056
6058
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '21.40.0',
6
+ version: '21.41.1',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -24,6 +24,7 @@ import type {
24
24
  IHarnessQuestionPersonResult,
25
25
  IHarnessQuestionRejection,
26
26
  IHarnessQuestionRequest,
27
+ IHarnessResourceMeta,
27
28
  IHarnessIntelligenceAvailabilityAction,
28
29
  IHarnessIntelligenceExchange,
29
30
  IHarnessScratchpad,
@@ -157,6 +158,10 @@ export class DeesHarnessChat extends DeesElement {
157
158
  @property({ reflect: true })
158
159
  accessor scratchpadError: string = '';
159
160
 
161
+ /** Resources attached to the session, forwarded to the session sidebar; `undefined` leaves the section out. */
162
+ @property({ attribute: false })
163
+ accessor attachedResources: IHarnessResourceMeta[] | undefined = undefined;
164
+
160
165
  @property({ type: Boolean, reflect: true })
161
166
  accessor sessionIntelligenceEnabled: boolean = false;
162
167
 
@@ -711,6 +716,7 @@ export class DeesHarnessChat extends DeesElement {
711
716
  || this.toolActivityMessages.length > 0
712
717
  || Object.values(this.sessionMetrics).some((value) => value !== undefined)
713
718
  || this.scratchpad !== undefined
719
+ || this.attachedResources !== undefined
714
720
  || this.sessionIntelligenceEnabled
715
721
  );
716
722
  }
@@ -857,6 +863,7 @@ export class DeesHarnessChat extends DeesElement {
857
863
  .scratchpad=${this.scratchpad}
858
864
  .scratchpadBusy=${this.scratchpadBusy}
859
865
  .scratchpadError=${this.scratchpadError}
866
+ .attachedResources=${this.attachedResources}
860
867
  .intelligenceEnabled=${this.sessionIntelligenceEnabled}
861
868
  .intelligenceAvailabilityStatus=${this.intelligenceAvailabilityStatus}
862
869
  .intelligenceUnavailableReason=${this.intelligenceUnavailableReason}
@@ -157,6 +157,10 @@ type TSectionRenderEntry =
157
157
  * `enableGrouping` the list additionally renders group chrome. While a search
158
158
  * query is active the list is one flat, non-sortable, recency-ordered section
159
159
  * in which sessions and resources match as peers.
160
+ *
161
+ * `attachableSessions` names sessions that resources may attach to without
162
+ * rendering them, so a list of resources alone still shows and validates
163
+ * attachments to conversations that live elsewhere.
160
164
  */
161
165
  @customElement('dees-harness-session-list')
162
166
  export class DeesHarnessSessionList extends DeesElement {
@@ -194,6 +198,14 @@ export class DeesHarnessSessionList extends DeesElement {
194
198
  @property({ attribute: false })
195
199
  accessor resourceAssociations: IHarnessResourceAssociation[] = [];
196
200
 
201
+ /**
202
+ * Sessions the list knows as association targets but does not render: their titles name a
203
+ * resource's attachments, and a request may attach to them. A session that is also in
204
+ * `sessions` renders as usual.
205
+ */
206
+ @property({ attribute: false })
207
+ accessor attachableSessions: IHarnessSessionMeta[] = [];
208
+
197
209
  @property({ reflect: true })
198
210
  accessor selectedResourceId = '';
199
211
 
@@ -1035,7 +1047,7 @@ export class DeesHarnessSessionList extends DeesElement {
1035
1047
  */
1036
1048
  private get acceptedResourceAssociations(): Map<string, IHarnessSessionListItemRef[]> {
1037
1049
  const resourcesById = this.resourcesById;
1038
- const itemsByKey = this.itemsByKey;
1050
+ const knownItemsByKey = this.knownItemsByKey;
1039
1051
  const result = new Map<string, IHarnessSessionListItemRef[]>();
1040
1052
  for (const association of this.resourceAssociations) {
1041
1053
  if (!association || !resourcesById.has(association.resourceId)) continue;
@@ -1043,7 +1055,7 @@ export class DeesHarnessSessionList extends DeesElement {
1043
1055
  for (const target of association.targets ?? []) {
1044
1056
  if (
1045
1057
  !target
1046
- || !itemsByKey.has(itemKey(target))
1058
+ || !knownItemsByKey.has(itemKey(target))
1047
1059
  || sameItem(target, { kind: 'resource', id: association.resourceId })
1048
1060
  || targets.some((candidate) => sameItem(candidate, target))
1049
1061
  ) continue;
@@ -1070,15 +1082,7 @@ export class DeesHarnessSessionList extends DeesElement {
1070
1082
  for (const session of this.sessions) {
1071
1083
  if (!session.id || seenSessionIds.has(session.id)) continue;
1072
1084
  seenSessionIds.add(session.id);
1073
- result.push({
1074
- kind: 'session',
1075
- key: `session:${session.id}`,
1076
- id: session.id,
1077
- title: session.title || session.id,
1078
- sortable: session.draggable !== false,
1079
- timestamp: session.updatedAt ?? session.createdAt ?? 0,
1080
- session,
1081
- });
1085
+ result.push(this.sessionItem(session));
1082
1086
  }
1083
1087
  for (const resource of this.resourcesById.values()) {
1084
1088
  result.push({
@@ -1094,10 +1098,34 @@ export class DeesHarnessSessionList extends DeesElement {
1094
1098
  return result;
1095
1099
  }
1096
1100
 
1101
+ private sessionItem(sessionArg: IHarnessSessionMeta): TListItem {
1102
+ return {
1103
+ kind: 'session',
1104
+ key: `session:${sessionArg.id}`,
1105
+ id: sessionArg.id,
1106
+ title: sessionArg.title || sessionArg.id,
1107
+ sortable: sessionArg.draggable !== false,
1108
+ timestamp: sessionArg.updatedAt ?? sessionArg.createdAt ?? 0,
1109
+ session: sessionArg,
1110
+ };
1111
+ }
1112
+
1113
+ /** The rendered items, by key. */
1097
1114
  private get itemsByKey(): Map<string, TListItem> {
1098
1115
  return new Map(this.acceptedItems.map((item) => [item.key, item]));
1099
1116
  }
1100
1117
 
1118
+ /** Every item a resource can attach to: the rendered ones and the attachable sessions. */
1119
+ private get knownItemsByKey(): Map<string, TListItem> {
1120
+ const result = this.itemsByKey;
1121
+ for (const session of this.attachableSessions) {
1122
+ if (!session.id || result.has(`session:${session.id}`)) continue;
1123
+ const item = this.sessionItem(session);
1124
+ result.set(item.key, item);
1125
+ }
1126
+ return result;
1127
+ }
1128
+
1101
1129
  /** Groups only organize the list while grouping is enabled. */
1102
1130
  private get effectiveGroups(): IHarnessSessionGroup[] {
1103
1131
  return this.enableGrouping ? this.groups : [];
@@ -1233,7 +1261,7 @@ export class DeesHarnessSessionList extends DeesElement {
1233
1261
  if (
1234
1262
  toTarget !== null
1235
1263
  && (
1236
- !this.itemsByKey.has(itemKey(toTarget))
1264
+ !this.knownItemsByKey.has(itemKey(toTarget))
1237
1265
  || sameItem(toTarget, { kind: 'resource', id: resourceIdArg })
1238
1266
  || !this.isResourceTargetEligible(resourceIdArg, toTarget)
1239
1267
  )
@@ -1356,14 +1384,22 @@ export class DeesHarnessSessionList extends DeesElement {
1356
1384
  await super.disconnectedCallback();
1357
1385
  }
1358
1386
 
1387
+ /** What the search field searches: conversations, resources, or both. */
1388
+ private get searchPlaceholderKey(): 'sessionlist.searchAll' | 'sessionlist.searchResources' | 'picker.search' {
1389
+ if (this.sessions.length) return this.acceptedResources.length ? 'sessionlist.searchAll' : 'picker.search';
1390
+ return this.acceptedResources.length || this.attachableSessions.length
1391
+ ? 'sessionlist.searchResources'
1392
+ : 'picker.search';
1393
+ }
1394
+
1359
1395
  public render(): TemplateResult {
1360
1396
  return html`
1361
1397
  <div class="searchRow">
1362
1398
  <div class="searchField">
1363
1399
  <dees-icon class="searchIcon" icon="lucide:Search" iconSize="13"></dees-icon>
1364
1400
  <input
1365
- placeholder=${this.t(this.acceptedResources.length ? 'sessionlist.searchAll' : 'picker.search')}
1366
- aria-label=${this.t(this.acceptedResources.length ? 'sessionlist.searchAll' : 'picker.search')}
1401
+ placeholder=${this.t(this.searchPlaceholderKey)}
1402
+ aria-label=${this.t(this.searchPlaceholderKey)}
1367
1403
  .value=${this.search}
1368
1404
  @input=${(event: Event) => {
1369
1405
  this.search = (event.currentTarget as HTMLInputElement).value;
@@ -2448,7 +2484,7 @@ export class DeesHarnessSessionList extends DeesElement {
2448
2484
  private eligibleTargets(resourceIdArg: string): IHarnessSessionListItemRef[] | undefined {
2449
2485
  const declared = this.eligibleTargetsByResourceId[resourceIdArg];
2450
2486
  if (!declared) return undefined;
2451
- const itemsByKey = this.itemsByKey;
2487
+ const knownItemsByKey = this.knownItemsByKey;
2452
2488
  const result: IHarnessSessionListItemRef[] = [];
2453
2489
  const seen = new Set<string>();
2454
2490
  for (const target of declared) {
@@ -2456,7 +2492,7 @@ export class DeesHarnessSessionList extends DeesElement {
2456
2492
  if (
2457
2493
  !key
2458
2494
  || seen.has(key)
2459
- || !itemsByKey.has(key)
2495
+ || !knownItemsByKey.has(key)
2460
2496
  || sameItem(target, { kind: 'resource', id: resourceIdArg })
2461
2497
  ) continue;
2462
2498
  seen.add(key);
@@ -2537,7 +2573,7 @@ export class DeesHarnessSessionList extends DeesElement {
2537
2573
  }
2538
2574
 
2539
2575
  private itemTitleFor(refArg: IHarnessSessionListItemRef): string {
2540
- return this.itemsByKey.get(itemKey(refArg))?.title ?? refArg.id;
2576
+ return this.knownItemsByKey.get(itemKey(refArg))?.title ?? refArg.id;
2541
2577
  }
2542
2578
 
2543
2579
  private emitSession(nameArg: string, sessionArg: IHarnessSessionMeta): void {
@@ -4,6 +4,7 @@ import { demoPage, demoOutput, showDemoResult } from '../../../demos/templates.j
4
4
  import type {
5
5
  IHarnessIntelligenceAvailabilityAction,
6
6
  IHarnessIntelligenceExchange,
7
+ IHarnessResourceMeta,
7
8
  IHarnessScratchpad,
8
9
  IHarnessSessionMetrics,
9
10
  IHarnessTodoItem,
@@ -42,6 +43,31 @@ const scratchpad: IHarnessScratchpad = {
42
43
  updatedBy: 'intelligence',
43
44
  };
44
45
 
46
+ const attachedResources: IHarnessResourceMeta[] = [
47
+ {
48
+ id: 'terminal-dev',
49
+ kind: 'terminal',
50
+ title: 'dev server',
51
+ icon: 'lucide:SquareTerminal',
52
+ state: 'running',
53
+ preview: '~/projects/storefront',
54
+ },
55
+ {
56
+ id: 'browser-preview',
57
+ kind: 'browser',
58
+ title: 'Storefront preview',
59
+ icon: 'lucide:Globe',
60
+ state: 'open',
61
+ preview: 'http://localhost:3000/checkout',
62
+ },
63
+ ];
64
+
65
+ const draftScratchpad: IHarnessScratchpad = {
66
+ id: 'draft',
67
+ text: '',
68
+ revision: 0,
69
+ };
70
+
45
71
  const exchanges: IHarnessIntelligenceExchange[] = [{
46
72
  id: 'intelligence-1',
47
73
  question: 'What remains before release?',
@@ -63,7 +89,7 @@ const showEvent = (event: CustomEvent) => {
63
89
  });
64
90
  };
65
91
 
66
- export const demoFunc = () => demoPage('Session details', 'Tasks, context usage, scratchpad and session intelligence alongside a conversation.', html`
92
+ export const demoFunc = () => demoPage('Session details', 'Tasks, context usage, scratchpad, attached resources and session intelligence alongside a conversation.', html`
67
93
  <style>
68
94
  .harnessSessionSidebarDemos {
69
95
  display: flex;
@@ -86,12 +112,23 @@ export const demoFunc = () => demoPage('Session details', 'Tasks, context usage,
86
112
  .todos=${todos}
87
113
  .metrics=${metrics}
88
114
  .scratchpad=${scratchpad}
115
+ .attachedResources=${attachedResources}
89
116
  .intelligenceEnabled=${true}
90
117
  .intelligenceExchanges=${exchanges}
91
118
  @harness-scratchpad-save=${showEvent}
119
+ @harness-attached-resource-open=${showEvent}
92
120
  @harness-session-intelligence-ask=${showEvent}
93
121
  ></dees-harness-session-sidebar>
94
122
  </div>
123
+ <div class="harnessSessionSidebarDemo">
124
+ <dees-harness-session-sidebar
125
+ .metrics=${{ lifetimeUsedTokens: 0 }}
126
+ .scratchpad=${draftScratchpad}
127
+ .attachedResources=${[]}
128
+ .intelligenceEnabled=${true}
129
+ @harness-scratchpad-input=${showEvent}
130
+ ></dees-harness-session-sidebar>
131
+ </div>
95
132
  <div class="harnessSessionSidebarDemo">
96
133
  <dees-harness-session-sidebar
97
134
  .showTasks=${false}
@@ -16,10 +16,13 @@ import { themeDefaultStyles } from '../../00theme.js';
16
16
  import { prefersReducedMotion } from '../../00motion.js';
17
17
  import { harnessControlStyles, harnessSidebarStyles } from '../harness.styles.js';
18
18
  import type {
19
+ IHarnessAttachedResourceOpenDetail,
19
20
  IHarnessIntelligenceAvailabilityAction,
20
21
  IHarnessIntelligenceExchange,
21
22
  IHarnessMessage,
23
+ IHarnessResourceMeta,
22
24
  IHarnessScratchpad,
25
+ IHarnessScratchpadInputDetail,
23
26
  IHarnessScratchpadSaveDetail,
24
27
  IHarnessSessionIntelligenceAskDetail,
25
28
  IHarnessSessionIntelligenceAvailabilityActionDetail,
@@ -45,7 +48,7 @@ import '../../00group-utility/dees-icon/dees-icon.js';
45
48
  const { repeat } = directives;
46
49
 
47
50
  export type THarnessSessionSidebarSection =
48
- 'tasks' | 'activity' | 'metrics' | 'scratchpad' | 'intelligence';
51
+ 'tasks' | 'activity' | 'metrics' | 'scratchpad' | 'resources' | 'intelligence';
49
52
 
50
53
  interface IToolActivityEntry {
51
54
  key: string;
@@ -97,6 +100,14 @@ export class DeesHarnessSessionSidebar extends DeesElement {
97
100
  @property({ reflect: true })
98
101
  accessor scratchpadError: string = '';
99
102
 
103
+ /**
104
+ * Resources attached to the session, such as terminals, browsers and workspaces, in the order
105
+ * the host wants them read. `undefined` leaves the section out; an empty list shows it with its
106
+ * empty state. A row emits `harness-attached-resource-open`; the host opens the resource.
107
+ */
108
+ @property({ attribute: false })
109
+ accessor attachedResources: IHarnessResourceMeta[] | undefined = undefined;
110
+
100
111
  @property({ type: Boolean, reflect: true })
101
112
  accessor intelligenceEnabled: boolean = false;
102
113
 
@@ -296,7 +307,8 @@ export class DeesHarnessSessionSidebar extends DeesElement {
296
307
  }
297
308
 
298
309
  .activityList,
299
- .activityGroup {
310
+ .activityGroup,
311
+ .resourceList {
300
312
  display: grid;
301
313
  gap: var(--dees-spacing-sm);
302
314
  }
@@ -346,7 +358,8 @@ export class DeesHarnessSessionSidebar extends DeesElement {
346
358
  }
347
359
  }
348
360
 
349
- .activityItem {
361
+ .activityItem,
362
+ .resourceItem {
350
363
  appearance: none;
351
364
  display: grid;
352
365
  grid-template-columns: 24px minmax(0, 1fr);
@@ -364,16 +377,19 @@ export class DeesHarnessSessionSidebar extends DeesElement {
364
377
  border-radius: var(--dees-radius-md);
365
378
  }
366
379
 
367
- .activityItem:hover {
380
+ .activityItem:hover,
381
+ .resourceItem:hover {
368
382
  background: var(--dees-color-fill-secondary);
369
383
  }
370
384
 
371
- .activityItem:focus-visible {
385
+ .activityItem:focus-visible,
386
+ .resourceItem:focus-visible {
372
387
  outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
373
388
  outline-offset: 2px;
374
389
  }
375
390
 
376
- .activityIcon {
391
+ .activityIcon,
392
+ .resourceIcon {
377
393
  display: grid;
378
394
  place-items: center;
379
395
  width: 24px;
@@ -397,19 +413,22 @@ export class DeesHarnessSessionSidebar extends DeesElement {
397
413
  color: var(--dees-color-accent-error);
398
414
  }
399
415
 
400
- .activityCopy {
416
+ .activityCopy,
417
+ .resourceCopy {
401
418
  min-width: 0;
402
419
  }
403
420
 
404
421
  .activityTitleRow,
405
- .activityMeta {
422
+ .activityMeta,
423
+ .resourceTitleRow {
406
424
  display: flex;
407
425
  align-items: center;
408
426
  gap: var(--dees-spacing-xs);
409
427
  min-width: 0;
410
428
  }
411
429
 
412
- .activityTitle {
430
+ .activityTitle,
431
+ .resourceTitle {
413
432
  min-width: 0;
414
433
  flex: 1;
415
434
  color: var(--dees-color-text-primary);
@@ -459,7 +478,8 @@ export class DeesHarnessSessionSidebar extends DeesElement {
459
478
  color: var(--dees-color-text-muted);
460
479
  }
461
480
 
462
- .activitySubtitle {
481
+ .activitySubtitle,
482
+ .resourceMeta {
463
483
  display: block;
464
484
  width: 100%;
465
485
  min-width: 0;
@@ -468,6 +488,13 @@ export class DeesHarnessSessionSidebar extends DeesElement {
468
488
  font-size: var(--dees-font-caption2-size, 10px);
469
489
  }
470
490
 
491
+ .resourceState {
492
+ flex: 0 0 auto;
493
+ color: var(--dees-color-text-muted);
494
+ font-size: var(--dees-font-caption2-size, 10px);
495
+ white-space: nowrap;
496
+ }
497
+
471
498
  .activityMeta {
472
499
  margin-top: var(--dees-spacing-2xs);
473
500
  color: var(--dees-color-text-muted);
@@ -802,6 +829,7 @@ export class DeesHarnessSessionSidebar extends DeesElement {
802
829
  ${this.toolActivityEntries.length ? this.renderToolActivity() : ''}
803
830
  ${this.hasMetrics ? this.renderMetrics() : ''}
804
831
  ${this.scratchpad ? this.renderScratchpad() : ''}
832
+ ${this.attachedResources ? this.renderAttachedResources() : ''}
805
833
  ${this.intelligenceEnabled ? this.renderIntelligence() : ''}
806
834
  </div>
807
835
  `;
@@ -830,6 +858,7 @@ export class DeesHarnessSessionSidebar extends DeesElement {
830
858
  ...(this.toolActivityEntries.length ? ['activity' as const] : []),
831
859
  ...(this.hasMetrics ? ['metrics' as const] : []),
832
860
  ...(this.scratchpad ? ['scratchpad' as const] : []),
861
+ ...(this.attachedResources ? ['resources' as const] : []),
833
862
  ...(this.intelligenceEnabled ? ['intelligence' as const] : []),
834
863
  ];
835
864
  }
@@ -839,6 +868,7 @@ export class DeesHarnessSessionSidebar extends DeesElement {
839
868
  if (this.toolActivityEntries.length) return 'activity';
840
869
  if (this.hasMetrics) return 'metrics';
841
870
  if (this.scratchpad) return 'scratchpad';
871
+ if (this.attachedResources?.length) return 'resources';
842
872
  if (this.intelligenceEnabled) return 'intelligence';
843
873
  return this.showTasks ? 'tasks' : undefined;
844
874
  }
@@ -1137,6 +1167,12 @@ export class DeesHarnessSessionSidebar extends DeesElement {
1137
1167
  @input=${(event: InputEvent) => {
1138
1168
  this.scratchpadDraft = (event.currentTarget as HTMLTextAreaElement).value;
1139
1169
  this.scratchpadDirty = this.scratchpadDraft !== scratchpad.text;
1170
+ const detail: IHarnessScratchpadInputDetail = { text: this.scratchpadDraft };
1171
+ this.dispatchEvent(new CustomEvent('harness-scratchpad-input', {
1172
+ detail,
1173
+ bubbles: true,
1174
+ composed: true,
1175
+ }));
1140
1176
  }}
1141
1177
  @keydown=${(event: KeyboardEvent) => {
1142
1178
  if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
@@ -1180,6 +1216,64 @@ export class DeesHarnessSessionSidebar extends DeesElement {
1180
1216
  );
1181
1217
  }
1182
1218
 
1219
+ private renderAttachedResources(): TemplateResult {
1220
+ const resources = this.attachedResources ?? [];
1221
+ return this.renderSection(
1222
+ 'resources',
1223
+ this.t('sidebar.attachedResources'),
1224
+ 'lucide:Link',
1225
+ resources.length
1226
+ ? html`
1227
+ <div class="resourceList">
1228
+ ${repeat(
1229
+ resources,
1230
+ (resource) => resource.id,
1231
+ (resource) => this.renderAttachedResource(resource),
1232
+ )}
1233
+ </div>
1234
+ `
1235
+ : html`<div class="empty">${this.t('sidebar.noAttachedResources')}</div>`,
1236
+ resources.length ? this.t.format.number(resources.length) : '',
1237
+ );
1238
+ }
1239
+
1240
+ /** One attached resource: what it is, its name and state, and where it points, as one button that opens it. */
1241
+ private renderAttachedResource(resourceArg: IHarnessResourceMeta): TemplateResult {
1242
+ const title = resourceArg.title || resourceArg.id;
1243
+ const meta = [resourceArg.kind, resourceArg.preview?.trim()].filter(Boolean).join(' · ');
1244
+ return html`
1245
+ <button
1246
+ class="resourceItem"
1247
+ type="button"
1248
+ data-resource-id=${resourceArg.id}
1249
+ aria-label=${this.t('sidebar.openResource', { title })}
1250
+ @click=${() => this.openAttachedResource(resourceArg)}
1251
+ >
1252
+ <span class="resourceIcon">
1253
+ <dees-icon icon=${resourceArg.icon || 'lucide:Box'} iconSize="13"></dees-icon>
1254
+ </span>
1255
+ <span class="resourceCopy">
1256
+ <span class="resourceTitleRow">
1257
+ <span class="resourceTitle" title=${title}>${title}</span>
1258
+ ${resourceArg.state ? html`<span class="resourceState">${resourceArg.state}</span>` : ''}
1259
+ </span>
1260
+ ${meta
1261
+ ? html`<dees-harness-overflow-text class="resourceMeta" title=${meta}>${meta}</dees-harness-overflow-text>`
1262
+ : ''}
1263
+ </span>
1264
+ </button>
1265
+ `;
1266
+ }
1267
+
1268
+ private openAttachedResource(resourceArg: IHarnessResourceMeta): void {
1269
+ const detail: IHarnessAttachedResourceOpenDetail = { resource: resourceArg };
1270
+ this.dispatchEvent(new CustomEvent('harness-attached-resource-open', {
1271
+ detail,
1272
+ bubbles: true,
1273
+ composed: true,
1274
+ }));
1275
+ }
1276
+
1183
1277
  private renderIntelligence(): TemplateResult {
1184
1278
  const heading = this.intelligenceHeading.trim() || this.t('sidebar.intelligence');
1185
1279
  const intelligenceAvailable = this.intelligenceAvailabilityStatus === 'available';
@@ -135,7 +135,8 @@ export interface IHarnessSessionMetrics {
135
135
  lastObservedInputTokensFreshness?: 'historical';
136
136
  }
137
137
 
138
- export type THarnessScratchpadUpdater = 'user' | 'intelligence';
138
+ /** Who last wrote a scratchpad: the owner, Session Intelligence, an agent of the session, or the host. */
139
+ export type THarnessScratchpadUpdater = 'user' | 'intelligence' | 'agent' | 'application';
139
140
 
140
141
  export interface IHarnessScratchpad {
141
142
  /** Stable session-scoped identity; a changed id resets local editor state. */
@@ -152,6 +153,15 @@ export interface IHarnessScratchpadSaveDetail {
152
153
  expectedRevision: number;
153
154
  }
154
155
 
156
+ /**
157
+ * Detail of `harness-scratchpad-input`, fired after every edit with the editor's whole text. A
158
+ * host that holds the notes itself until a session exists adopts the text from here; saving
159
+ * still goes through `harness-scratchpad-save`.
160
+ */
161
+ export interface IHarnessScratchpadInputDetail {
162
+ text: string;
163
+ }
164
+
155
165
  export type THarnessIntelligenceStatus = 'running' | 'completed' | 'error';
156
166
 
157
167
  export type THarnessIntelligenceAvailabilityStatus = 'checking' | 'available' | 'unavailable';
@@ -755,6 +765,11 @@ export interface IHarnessResourceEventDetail<TState extends string = string> {
755
765
  targets: IHarnessSessionListItemRef[];
756
766
  }
757
767
 
768
+ /** Detail of `harness-attached-resource-open`, fired by a row of the session sidebar's attached resources. */
769
+ export interface IHarnessAttachedResourceOpenDetail<TState extends string = string> {
770
+ resource: IHarnessResourceMeta<TState>;
771
+ }
772
+
758
773
  /**
759
774
  * Attaching is an explicit choice, never an accident of reordering: a drag only attaches when it
760
775
  * is released on the centre of a row, and the edges of that same row stay positional. Keyboard
@@ -94,6 +94,8 @@ export class DeesInputDropdownPopup extends DeesElement {
94
94
 
95
95
  private windowLayer: DeesWindowLayer | null = null;
96
96
  private isDestroying: boolean = false;
97
+ /** The list's openings so far: a close removes the list after its exit only if none came since. */
98
+ private openings = 0;
97
99
 
98
100
  public static styles = [
99
101
  themeDefaultStyles,
@@ -344,7 +346,9 @@ export class DeesInputDropdownPopup extends DeesElement {
344
346
  const selectedIndex = this.options.findIndex((option) => option.key === this.selectedKey && !option.disabled);
345
347
  this.highlightedIndex = selectedIndex >= 0 ? selectedIndex : firstUsableIndex(this.options);
346
348
  this.searchValue = '';
347
- // the field reuses its list: one closed before takes presses again
349
+ // the field reuses its list: one closed before, or still on its way out, takes presses again
350
+ this.openings++;
351
+ this.isDestroying = false;
348
352
  this.classList.remove('closing');
349
353
 
350
354
  // Create window layer (transparent click-catcher, no dim/blur)
@@ -355,10 +359,11 @@ export class DeesInputDropdownPopup extends DeesElement {
355
359
 
356
360
  // Set z-index above the window layer
357
361
  this.menuZIndex = zIndexRegistry.getNextZIndex();
358
- zIndexRegistry.register(this, this.menuZIndex);
359
362
  this.style.zIndex = this.menuZIndex.toString();
360
363
 
361
364
  this.windowLayer.parentElement!.appendChild(this);
365
+ // registered once in place: a list still there from its last opening is moved, and the move unregisters it
366
+ zIndexRegistry.register(this, this.menuZIndex);
362
367
 
363
368
  // Animate in on next frame
364
369
  await domtools.plugins.smartpromise.delayFor(0);
@@ -375,6 +380,7 @@ export class DeesInputDropdownPopup extends DeesElement {
375
380
  return;
376
381
  }
377
382
  this.isDestroying = true;
383
+ const opening = this.openings;
378
384
  this.classList.add('closing');
379
385
  this.searchAbort?.abort();
380
386
 
@@ -396,6 +402,8 @@ export class DeesInputDropdownPopup extends DeesElement {
396
402
  // Animate out via CSS transition
397
403
  this.visible = false;
398
404
  await domtools.plugins.smartpromise.delayFor(150);
405
+ // opened again during its exit: the list stays, and the close of that opening removes it
406
+ if (opening !== this.openings) return;
399
407
 
400
408
  if (this.parentElement) {
401
409
  this.parentElement.removeChild(this);