@things-factory/ai-assistant 10.1.110 → 10.1.112

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.
@@ -2435,11 +2435,24 @@ export class OxAssistantChat extends LitElement {
2435
2435
  .composer-size {
2436
2436
  margin-left: auto;
2437
2437
  }
2438
+ /* Named above the send button, out of the row - it takes no width from the box. */
2439
+ .composer.wide .input-row {
2440
+ position: relative;
2441
+ }
2438
2442
  .send-shortcut {
2443
+ position: absolute;
2444
+ right: 14px;
2445
+ bottom: 48px;
2439
2446
  font-size: 10px;
2440
2447
  color: var(--md-sys-color-outline, #64748b);
2441
2448
  white-space: nowrap;
2442
- padding-bottom: 10px;
2449
+ pointer-events: none;
2450
+ }
2451
+ /* A finger has no Ctrl or ⌘ - the send button is the way. */
2452
+ @media (pointer: coarse) {
2453
+ .send-shortcut {
2454
+ display: none;
2455
+ }
2443
2456
  }
2444
2457
  .table-preview {
2445
2458
  flex: 1;
@@ -2889,6 +2902,15 @@ export class OxAssistantChat extends LitElement {
2889
2902
  /* 모드가 이미 붙어 있으면 무엇을 주는지 먼저 묻는다 — 바뀔 때는 updated 가 다시 묻는다. */
2890
2903
  if (this.mode?.kind) this.loadModeView()
2891
2904
  if (this.subject) this.onSubjectChanged()
2905
+ /*
2906
+ * Put back after the dock was closed: what is being written stays, the conversation is read again and its
2907
+ * broadcast and presence start again - they were stopped when it was taken out.
2908
+ */
2909
+ if (this.hasUpdated && this.sessionId) {
2910
+ this.loadHistory()
2911
+ this._startPresence()
2912
+ this._startMessageSubscription()
2913
+ }
2892
2914
  }
2893
2915
 
2894
2916
  /**
@@ -3544,7 +3566,16 @@ export class OxAssistantChat extends LitElement {
3544
3566
  if (!att?.table) return nothing
3545
3567
  const { rows, columns } = att.table
3546
3568
  return html`
3547
- <div class="table-preview" role="region" aria-label=${att.name}>
3569
+ <div
3570
+ class="table-preview"
3571
+ role="region"
3572
+ aria-label=${att.name}
3573
+ @keydown=${(e: KeyboardEvent) => {
3574
+ if (e.key === 'Escape') {
3575
+ e.stopPropagation()
3576
+ this.previewAttachmentId = null
3577
+ }
3578
+ }}>
3548
3579
  <div class="table-preview-head">
3549
3580
  <md-icon>table_chart</md-icon>
3550
3581
  <span class="table-preview-name">${att.name}</span>
@@ -3616,7 +3647,9 @@ export class OxAssistantChat extends LitElement {
3616
3647
  }
3617
3648
  const action = composerKeyAction(e, this.composerWide)
3618
3649
  if (action === 'narrow') {
3650
+ /* The Escape that narrows the box is spent here - the floating dock closes on the next one. */
3619
3651
  e.preventDefault()
3652
+ e.stopPropagation()
3620
3653
  this.setComposerWide(false)
3621
3654
  } else if (action === 'send') {
3622
3655
  e.preventDefault()
@@ -360,16 +360,21 @@ export class AssistantDock extends localize(i18next)(LitElement) {
360
360
  if (activity.kind === 'meta' && isAnchor(this.anchor) && activity.anchorId === this.anchor.anchorId) void this.reloadSessions()
361
361
  })
362
362
  )
363
- this.follow(true)
363
+ if (!this.openedIdentity) return this.follow(true)
364
+ /*
365
+ * The same dock opened again - the aside bar takes it out while it is closed. The conversation and what was
366
+ * being written in it are still here; only what moved while it was closed (the screen, the person) is followed.
367
+ */
368
+ setOpenSession(this.sessionId)
369
+ this.follow()
364
370
  }
365
371
 
372
+ /* Closing keeps the conversation: the dock comes back as it was left (design/ai/shared-dock.md §2-1, §2-7). */
366
373
  disconnectedCallback() {
367
- this.revision++
368
374
  this.removeEventListener('assistant-start-new-session', this.onStartNewSession)
369
375
  this.removeEventListener('assistant-open-page', this.onOpenPage as EventListener)
370
376
  this.unsubscribers.splice(0).forEach(unsubscribe => unsubscribe())
371
377
  setOpenSession('')
372
- this.controller.clear()
373
378
  super.disconnectedCallback()
374
379
  }
375
380
 
@@ -124,6 +124,14 @@ export function setupAssistantDock(options: { viewpart?: string } = {}): void {
124
124
 
125
125
  startSessionActivityFeed()
126
126
 
127
+ /*
128
+ * One dock for the application's life. The aside bar drops a closed viewpart's template, so a template that
129
+ * makes the element would make a new dock on every opening - and a new composer, the text being written gone
130
+ * (design/ai/shared-dock.md §2-1, §2-7). The same element is put back instead, as the entity360 dock is.
131
+ */
132
+ const dock = document.createElement('ox-assistant-dock') as HTMLElement & { viewpart: string }
133
+ dock.viewpart = viewpart
134
+
127
135
  appendViewpart({
128
136
  name: viewpart,
129
137
  /*
@@ -134,7 +142,7 @@ export function setupAssistantDock(options: { viewpart?: string } = {}): void {
134
142
  show: false,
135
143
  persistent: true,
136
144
  level: VIEWPART_LEVEL.TOPMOST,
137
- template: html`<ox-assistant-dock .viewpart=${viewpart}></ox-assistant-dock>`
145
+ template: html`${dock}`
138
146
  },
139
147
  position: VIEWPART_POSITION.ASIDEBAR
140
148
  })
@@ -2082,11 +2082,24 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
2082
2082
  .composer-size {
2083
2083
  margin-left: auto;
2084
2084
  }
2085
+ /* Named above the send button, out of the row - it takes no width from the box. */
2086
+ .composer.wide .input-row {
2087
+ position: relative;
2088
+ }
2085
2089
  .send-shortcut {
2090
+ position: absolute;
2091
+ right: 14px;
2092
+ bottom: 48px;
2086
2093
  font-size: 10px;
2087
2094
  color: var(--md-sys-color-outline, #64748b);
2088
2095
  white-space: nowrap;
2089
- padding-bottom: 10px;
2096
+ pointer-events: none;
2097
+ }
2098
+ /* A finger has no Ctrl or ⌘ - the send button is the way. */
2099
+ @media (pointer: coarse) {
2100
+ .send-shortcut {
2101
+ display: none;
2102
+ }
2090
2103
  }
2091
2104
  .table-preview {
2092
2105
  flex: 1;
@@ -2537,6 +2550,15 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
2537
2550
  this.loadModeView();
2538
2551
  if (this.subject)
2539
2552
  this.onSubjectChanged();
2553
+ /*
2554
+ * Put back after the dock was closed: what is being written stays, the conversation is read again and its
2555
+ * broadcast and presence start again - they were stopped when it was taken out.
2556
+ */
2557
+ if (this.hasUpdated && this.sessionId) {
2558
+ this.loadHistory();
2559
+ this._startPresence();
2560
+ this._startMessageSubscription();
2561
+ }
2540
2562
  }
2541
2563
  /**
2542
2564
  * 화면이 보여 주는 것의 종류가 바뀌었다 — 설 수 있는 대화를 다시 묻고, 지난번 고른 것을 되살린다.
@@ -3184,7 +3206,16 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
3184
3206
  return nothing;
3185
3207
  const { rows, columns } = att.table;
3186
3208
  return html `
3187
- <div class="table-preview" role="region" aria-label=${att.name}>
3209
+ <div
3210
+ class="table-preview"
3211
+ role="region"
3212
+ aria-label=${att.name}
3213
+ @keydown=${(e) => {
3214
+ if (e.key === 'Escape') {
3215
+ e.stopPropagation();
3216
+ this.previewAttachmentId = null;
3217
+ }
3218
+ }}>
3188
3219
  <div class="table-preview-head">
3189
3220
  <md-icon>table_chart</md-icon>
3190
3221
  <span class="table-preview-name">${att.name}</span>
@@ -3254,7 +3285,9 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
3254
3285
  }
3255
3286
  const action = composerKeyAction(e, this.composerWide);
3256
3287
  if (action === 'narrow') {
3288
+ /* The Escape that narrows the box is spent here - the floating dock closes on the next one. */
3257
3289
  e.preventDefault();
3290
+ e.stopPropagation();
3258
3291
  this.setComposerWide(false);
3259
3292
  }
3260
3293
  else if (action === 'send') {