@things-factory/ai-assistant 10.1.53 → 10.1.58
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.
- package/client/components/assistant-dock.ts +44 -5
- package/client/setup-assistant-dock.ts +54 -19
- package/client/utils/assistant-ask.ts +8 -0
- package/dist-client/components/assistant-dock.d.ts +1 -0
- package/dist-client/components/assistant-dock.js +47 -5
- package/dist-client/components/assistant-dock.js.map +1 -1
- package/dist-client/setup-assistant-dock.js +54 -19
- package/dist-client/setup-assistant-dock.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/assistant-ask.d.ts +5 -0
- package/dist-client/utils/assistant-ask.js +7 -0
- package/dist-client/utils/assistant-ask.js.map +1 -1
- package/package.json +2 -2
- package/test/assistant-dock.test.ts +20 -0
- package/translations/en.json +2 -1
- package/translations/ja.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +2 -1
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
type AssistantSurface
|
|
31
31
|
} from '../utils/assistant-surface.js'
|
|
32
32
|
import { runProposal, type ProposalContext, type ProposalOutcome } from '../utils/assistant-proposals.js'
|
|
33
|
-
import { subscribeAssistantAsk, takeAssistantAsk, type AssistantAsk } from '../utils/assistant-ask.js'
|
|
33
|
+
import { holdAssistantAsk, subscribeAssistantAsk, takeAssistantAsk, type AssistantAsk } from '../utils/assistant-ask.js'
|
|
34
34
|
|
|
35
35
|
export const ASSISTANT_DOCK_VIEWPART = 'assistant-dock'
|
|
36
36
|
|
|
@@ -267,7 +267,11 @@ export class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
267
267
|
/** The screen changed - a different surface or domain is a different conversation. */
|
|
268
268
|
private follow(force = false) {
|
|
269
269
|
const next = currentAssistantSurface()
|
|
270
|
-
if (!force && next === this.surface && this.scopeKey(next) === this.openedFor)
|
|
270
|
+
if (!force && next === this.surface && this.scopeKey(next) === this.openedFor) {
|
|
271
|
+
/* The same conversation, told that its words changed - a name loaded, a board renamed on save. */
|
|
272
|
+
this.requestUpdate()
|
|
273
|
+
return
|
|
274
|
+
}
|
|
271
275
|
if (next?.key !== this.surface?.key) this.chosenKind = ''
|
|
272
276
|
this.surface = next
|
|
273
277
|
void this.open()
|
|
@@ -317,7 +321,11 @@ export class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
317
321
|
} catch (error) {
|
|
318
322
|
if (ticket === this.revision) this.failure = (error as Error).message
|
|
319
323
|
} finally {
|
|
320
|
-
if (ticket === this.revision)
|
|
324
|
+
if (ticket === this.revision) {
|
|
325
|
+
this.loading = false
|
|
326
|
+
/* No conversation can stand here - an ask waiting for one is answered now, not sent later somewhere else. */
|
|
327
|
+
if (this.anchor && !isAnchor(this.anchor)) void this.takeAsk()
|
|
328
|
+
}
|
|
321
329
|
}
|
|
322
330
|
}
|
|
323
331
|
|
|
@@ -362,12 +370,26 @@ export class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
362
370
|
/* ── asks from other screens ────────────────────────────────────────────────────── */
|
|
363
371
|
|
|
364
372
|
private async takeAsk() {
|
|
365
|
-
if (
|
|
373
|
+
if (this.loading || !this.anchor) return
|
|
374
|
+
if (!isAnchor(this.anchor)) {
|
|
375
|
+
/*
|
|
376
|
+
A question is not sent later on its own, once some conversation happens to stand - by then the person is looking
|
|
377
|
+
at something else. It is said now why it was not sent. A draft only fills the input, so it waits.
|
|
378
|
+
*/
|
|
379
|
+
const waiting = takeAssistantAsk()
|
|
380
|
+
if (!waiting) return
|
|
381
|
+
if (waiting.ask) notify({ level: 'info', message: `${t('ask-needs-conversation', 'the question was not sent.')} ${this.anchor.message}` })
|
|
382
|
+
else holdAssistantAsk(waiting)
|
|
383
|
+
return
|
|
384
|
+
}
|
|
366
385
|
const ask: AssistantAsk | undefined = takeAssistantAsk()
|
|
367
386
|
if (!ask) return
|
|
368
387
|
|
|
369
388
|
if (!ask.continueCurrent && (ask.name || ask.context || ask.transcript?.length)) {
|
|
370
|
-
const id = await this.startCarried(ask)
|
|
389
|
+
const id = await this.startCarried(ask).catch(error => {
|
|
390
|
+
notify({ level: 'error', message: (error as Error).message })
|
|
391
|
+
return undefined
|
|
392
|
+
})
|
|
371
393
|
if (id) {
|
|
372
394
|
await this.reloadSessions()
|
|
373
395
|
this.controller.select(id)
|
|
@@ -459,6 +481,23 @@ export class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
459
481
|
notify({ level: 'error', message: t('proposal-not-runnable', 'this proposal cannot be run on this screen.') })
|
|
460
482
|
}
|
|
461
483
|
await this.report(sessionId, proposalKey, outcome)
|
|
484
|
+
/* What the handler did, in the person's words, stays in the conversation - what was created, why it did not run. */
|
|
485
|
+
if (outcome.note && sessionId) await this.appendNote(sessionId, outcome.note)
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
private async appendNote(sessionId: string, note: string) {
|
|
489
|
+
try {
|
|
490
|
+
await client.mutate({
|
|
491
|
+
mutation: gql`
|
|
492
|
+
mutation ($id: String!, $c: String!) {
|
|
493
|
+
appendSessionNote(sessionId: $id, content: $c)
|
|
494
|
+
}
|
|
495
|
+
`,
|
|
496
|
+
variables: { id: sessionId, c: note }
|
|
497
|
+
})
|
|
498
|
+
} catch {
|
|
499
|
+
/* the outcome is already reported; a lost note is not a lost outcome */
|
|
500
|
+
}
|
|
462
501
|
}
|
|
463
502
|
|
|
464
503
|
/* ── board surfaces: the chat's scene edits land on the open board ───────────────── */
|
|
@@ -24,26 +24,62 @@ import { startSessionActivityFeed, subscribeSessionActivity, unreadSessionCount
|
|
|
24
24
|
|
|
25
25
|
@customElement('ox-assistant-dock-button')
|
|
26
26
|
export class AssistantDockButton extends LitElement {
|
|
27
|
+
/*
|
|
28
|
+
* The band's pill, as its bell draws it (apptool-ui app-header-band `.ctl`): 28px, a 1px edge, a 7px radius, an 18px
|
|
29
|
+
* outlined icon in the muted colour, the count inside the pill. The band shapes bare md-icon tools itself but cannot
|
|
30
|
+
* reach into this element, so the button draws the same shape - a filled 24px mark at full ink stood out on the row
|
|
31
|
+
* (user, 2026-09-25).
|
|
32
|
+
*/
|
|
27
33
|
static styles = css`
|
|
28
34
|
:host {
|
|
29
|
-
position: relative;
|
|
30
35
|
display: inline-flex;
|
|
31
|
-
cursor: pointer;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
height:
|
|
40
|
-
|
|
38
|
+
button {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
gap: 6px;
|
|
43
|
+
height: 28px;
|
|
44
|
+
min-width: 28px;
|
|
45
|
+
padding: 0 8px;
|
|
41
46
|
box-sizing: border-box;
|
|
47
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
42
48
|
border-radius: 7px;
|
|
43
|
-
background: var(--md-sys-color-
|
|
44
|
-
color: var(--md-sys-color-on-
|
|
45
|
-
font
|
|
46
|
-
|
|
49
|
+
background-color: var(--header-band-control-surface, var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface)));
|
|
50
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
51
|
+
font: inherit;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
button:hover {
|
|
56
|
+
border-color: var(--md-sys-color-primary);
|
|
57
|
+
color: var(--md-sys-color-primary);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
button:focus-visible {
|
|
61
|
+
outline: 2px solid var(--md-sys-color-primary);
|
|
62
|
+
outline-offset: 2px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
md-icon {
|
|
66
|
+
--md-icon-size: 18px;
|
|
67
|
+
font-size: 18px;
|
|
68
|
+
font-variation-settings: 'FILL' 0;
|
|
69
|
+
color: inherit;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.count {
|
|
73
|
+
min-width: 15px;
|
|
74
|
+
height: 15px;
|
|
75
|
+
padding: 0 4px;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
border-radius: 8px;
|
|
78
|
+
background-color: var(--header-band-count-background, var(--md-sys-color-error));
|
|
79
|
+
color: var(--header-band-count-color, var(--md-sys-color-on-error));
|
|
80
|
+
font-size: 10px;
|
|
81
|
+
font-weight: 700;
|
|
82
|
+
line-height: 15px;
|
|
47
83
|
text-align: center;
|
|
48
84
|
}
|
|
49
85
|
`
|
|
@@ -69,13 +105,12 @@ export class AssistantDockButton extends LitElement {
|
|
|
69
105
|
* then closed it - the first press did nothing (found on :3700, 2026-09-25). The dock's own ✕ closes it.
|
|
70
106
|
*/
|
|
71
107
|
render() {
|
|
108
|
+
const label = i18next.t('ai-assistant.dock.open', { defaultValue: 'Ask AI' })
|
|
72
109
|
return html`
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
>
|
|
78
|
-
${this.unread ? html`<span class="badge">${this.unread}</span>` : nothing}
|
|
110
|
+
<button title=${label} aria-label=${label} @click=${() => openOverlay(this.viewpart, { backdrop: false })}>
|
|
111
|
+
<md-icon aria-hidden="true">forum</md-icon>
|
|
112
|
+
${this.unread ? html`<span class="count">${this.unread > 99 ? '99+' : this.unread}</span>` : nothing}
|
|
113
|
+
</button>
|
|
79
114
|
`
|
|
80
115
|
}
|
|
81
116
|
}
|
|
@@ -31,6 +31,14 @@ export function askAssistant(ask: AssistantAsk): void {
|
|
|
31
31
|
window.dispatchEvent(new CustomEvent('assistant-dock-open'))
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The dock could not take it yet and keeps it for when a conversation stands - a draft only. Nothing is announced:
|
|
36
|
+
* it was already asked for, and announcing would make the dock take it again at once.
|
|
37
|
+
*/
|
|
38
|
+
export function holdAssistantAsk(ask: AssistantAsk): void {
|
|
39
|
+
pending = ask
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
/** The dock takes the request once. */
|
|
35
43
|
export function takeAssistantAsk(): AssistantAsk | undefined {
|
|
36
44
|
const ask = pending
|
|
@@ -62,6 +62,7 @@ export declare class AssistantDock extends AssistantDock_base {
|
|
|
62
62
|
private report;
|
|
63
63
|
/** Every proposal ends in exactly one reported outcome - a kind nobody handles is `unavailable`. */
|
|
64
64
|
private onProposal;
|
|
65
|
+
private appendNote;
|
|
65
66
|
private onScenePatch;
|
|
66
67
|
private onBoardRevert;
|
|
67
68
|
private onSceneAction;
|
|
@@ -20,7 +20,7 @@ import { readAiCapability } from '../utils/assistant-capability-read.js';
|
|
|
20
20
|
import { setOpenSession, subscribeSessionActivity } from '../utils/assistant-activity.js';
|
|
21
21
|
import { assistantHomeSurface, currentAssistantSurface, isAnchor, subscribeAssistantSurface } from '../utils/assistant-surface.js';
|
|
22
22
|
import { runProposal } from '../utils/assistant-proposals.js';
|
|
23
|
-
import { subscribeAssistantAsk, takeAssistantAsk } from '../utils/assistant-ask.js';
|
|
23
|
+
import { holdAssistantAsk, subscribeAssistantAsk, takeAssistantAsk } from '../utils/assistant-ask.js';
|
|
24
24
|
export const ASSISTANT_DOCK_VIEWPART = 'assistant-dock';
|
|
25
25
|
const t = (key, defaultValue, options = {}) => i18next.t(`ai-assistant.dock.${key}`, { defaultValue, ...options });
|
|
26
26
|
const MODES_QUERY = gql `
|
|
@@ -99,6 +99,9 @@ let AssistantDock = class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
99
99
|
notify({ level: 'error', message: t('proposal-not-runnable', 'this proposal cannot be run on this screen.') });
|
|
100
100
|
}
|
|
101
101
|
await this.report(sessionId, proposalKey, outcome);
|
|
102
|
+
/* What the handler did, in the person's words, stays in the conversation - what was created, why it did not run. */
|
|
103
|
+
if (outcome.note && sessionId)
|
|
104
|
+
await this.appendNote(sessionId, outcome.note);
|
|
102
105
|
};
|
|
103
106
|
/* ── board surfaces: the chat's scene edits land on the open board ───────────────── */
|
|
104
107
|
this.onScenePatch = async (event) => {
|
|
@@ -262,8 +265,11 @@ let AssistantDock = class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
262
265
|
/** The screen changed - a different surface or domain is a different conversation. */
|
|
263
266
|
follow(force = false) {
|
|
264
267
|
const next = currentAssistantSurface();
|
|
265
|
-
if (!force && next === this.surface && this.scopeKey(next) === this.openedFor)
|
|
268
|
+
if (!force && next === this.surface && this.scopeKey(next) === this.openedFor) {
|
|
269
|
+
/* The same conversation, told that its words changed - a name loaded, a board renamed on save. */
|
|
270
|
+
this.requestUpdate();
|
|
266
271
|
return;
|
|
272
|
+
}
|
|
267
273
|
if (next?.key !== this.surface?.key)
|
|
268
274
|
this.chosenKind = '';
|
|
269
275
|
this.surface = next;
|
|
@@ -316,8 +322,12 @@ let AssistantDock = class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
316
322
|
this.failure = error.message;
|
|
317
323
|
}
|
|
318
324
|
finally {
|
|
319
|
-
if (ticket === this.revision)
|
|
325
|
+
if (ticket === this.revision) {
|
|
320
326
|
this.loading = false;
|
|
327
|
+
/* No conversation can stand here - an ask waiting for one is answered now, not sent later somewhere else. */
|
|
328
|
+
if (this.anchor && !isAnchor(this.anchor))
|
|
329
|
+
void this.takeAsk();
|
|
330
|
+
}
|
|
321
331
|
}
|
|
322
332
|
}
|
|
323
333
|
target(userId, anchor) {
|
|
@@ -353,13 +363,30 @@ let AssistantDock = class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
353
363
|
}
|
|
354
364
|
/* ── asks from other screens ────────────────────────────────────────────────────── */
|
|
355
365
|
async takeAsk() {
|
|
356
|
-
if (
|
|
366
|
+
if (this.loading || !this.anchor)
|
|
367
|
+
return;
|
|
368
|
+
if (!isAnchor(this.anchor)) {
|
|
369
|
+
/*
|
|
370
|
+
A question is not sent later on its own, once some conversation happens to stand - by then the person is looking
|
|
371
|
+
at something else. It is said now why it was not sent. A draft only fills the input, so it waits.
|
|
372
|
+
*/
|
|
373
|
+
const waiting = takeAssistantAsk();
|
|
374
|
+
if (!waiting)
|
|
375
|
+
return;
|
|
376
|
+
if (waiting.ask)
|
|
377
|
+
notify({ level: 'info', message: `${t('ask-needs-conversation', 'the question was not sent.')} ${this.anchor.message}` });
|
|
378
|
+
else
|
|
379
|
+
holdAssistantAsk(waiting);
|
|
357
380
|
return;
|
|
381
|
+
}
|
|
358
382
|
const ask = takeAssistantAsk();
|
|
359
383
|
if (!ask)
|
|
360
384
|
return;
|
|
361
385
|
if (!ask.continueCurrent && (ask.name || ask.context || ask.transcript?.length)) {
|
|
362
|
-
const id = await this.startCarried(ask)
|
|
386
|
+
const id = await this.startCarried(ask).catch(error => {
|
|
387
|
+
notify({ level: 'error', message: error.message });
|
|
388
|
+
return undefined;
|
|
389
|
+
});
|
|
363
390
|
if (id) {
|
|
364
391
|
await this.reloadSessions();
|
|
365
392
|
this.controller.select(id);
|
|
@@ -441,6 +468,21 @@ let AssistantDock = class AssistantDock extends localize(i18next)(LitElement) {
|
|
|
441
468
|
/* the card then says it heard nothing - never "done" */
|
|
442
469
|
}
|
|
443
470
|
}
|
|
471
|
+
async appendNote(sessionId, note) {
|
|
472
|
+
try {
|
|
473
|
+
await client.mutate({
|
|
474
|
+
mutation: gql `
|
|
475
|
+
mutation ($id: String!, $c: String!) {
|
|
476
|
+
appendSessionNote(sessionId: $id, content: $c)
|
|
477
|
+
}
|
|
478
|
+
`,
|
|
479
|
+
variables: { id: sessionId, c: note }
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
catch {
|
|
483
|
+
/* the outcome is already reported; a lost note is not a lost outcome */
|
|
484
|
+
}
|
|
485
|
+
}
|
|
444
486
|
/* ── drawing ─────────────────────────────────────────────────────────────────────── */
|
|
445
487
|
stuckLine() {
|
|
446
488
|
if (this.capability === 'not-configured')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-dock.js","sourceRoot":"","sources":["../../client/components/assistant-dock.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC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hB,KAAK,EAAE;;8CAAmC;AAC1B;IAAhB,KAAK,EAAE;;6CAA8B;AACrB;IAAhB,KAAK,EAAE;;2CAAkB;AAET;IAAhB,KAAK,EAAE;;iDAAgD;AACvC;IAAhB,KAAK,EAAE;;+CAA0C;AACjC;IAAhB,KAAK,EAAE;;gDAAuB;AACd;IAAhB,KAAK,EAAE;;8CAAwB;AACf;IAAhB,KAAK,EAAE;;8CAAqB;AACZ;IAAhB,KAAK,EAAE;;qDAA+B;AACtB;IAAhB,KAAK,EAAE;;uDAA6B;AACpB;IAAhB,KAAK,EAAE;;6CAAqE;AAhJlE,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAoiBzB","sourcesContent":["import '@material/web/icon/icon.js'\nimport './assistant-chat.js'\nimport './assistant-session-toolbar.js'\nimport './assistant-session-manager.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, css, html, nothing, type TemplateResult } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { closeOverlay, notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { AppController, store } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { followPickedConversation, type AssistantMode } from './assistant-mode.js'\nimport { AssistantSessionController, type AssistantSession, type AssistantSessionTarget } from '../utils/assistant-session-controller.js'\nimport { assistantSessionTransport } from '../utils/assistant-session-transport.js'\nimport { readAiCapability } from '../utils/assistant-capability-read.js'\nimport type { AiCapability } from '../utils/assistant-capability.js'\nimport { setOpenSession, subscribeSessionActivity } from '../utils/assistant-activity.js'\nimport {\n assistantHomeSurface,\n currentAssistantSurface,\n isAnchor,\n subscribeAssistantSurface,\n type AnchorResult,\n type AssistantSurface\n} from '../utils/assistant-surface.js'\nimport { runProposal, type ProposalContext, type ProposalOutcome } from '../utils/assistant-proposals.js'\nimport { subscribeAssistantAsk, takeAssistantAsk, type AssistantAsk } from '../utils/assistant-ask.js'\n\nexport const ASSISTANT_DOCK_VIEWPART = 'assistant-dock'\n\nconst t = (key: string, defaultValue: string, options: Record<string, unknown> = {}) =>\n i18next.t(`ai-assistant.dock.${key}`, { defaultValue, ...options })\n\nconst MODES_QUERY = gql`\n query ($subject: String!) {\n assistantModes(subject: $subject) {\n kind\n label\n isDefault\n }\n }\n`\n\nasync function modesFor(subject: string): Promise<{ kind: string; label?: string; isDefault?: boolean }[]> {\n const response = await client.query({ query: MODES_QUERY, variables: { subject }, fetchPolicy: 'network-only' })\n if (response.errors?.length) throw new Error(response.errors[0].message)\n return response.data?.assistantModes ?? []\n}\n\n/**\n * The AI dock - the same in every operato application (design/ai/shared-dock.md).\n *\n * ── What is here and what is not ────────────────────────────────────────────────\n * here where it stands, whether an AI answers, which surface and anchor, which conversation (mode),\n * sessions and their management, unread, proposals and their outcome, asks from other screens\n * the app what its screens show (surfaces, assistant-surface.ts), how its proposal kinds apply\n * (assistant-proposals.ts), and on the server its modes and tools\n *\n * Nothing in this file names an application or a proposal kind. A behaviour one app needs and another does\n * not is a surface field or a handler, never a branch here.\n */\n@customElement('ox-assistant-dock')\nexport class AssistantDock extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n width: 420px;\n max-width: 100vw;\n box-sizing: border-box;\n height: 100%;\n min-height: 0;\n background: var(--md-sys-color-surface-container-lowest);\n border-left: 1px solid var(--md-sys-color-outline-variant);\n color: var(--md-sys-color-on-surface);\n font-size: 13px;\n }\n\n /* Below 1440px the page keeps its full width and only the dock floats. The DOM stays - the chat does not reconnect. */\n @media (max-width: 1439.98px) {\n :host {\n position: fixed;\n inset: 0 0 0 auto;\n height: 100vh;\n height: 100dvh;\n z-index: 10;\n box-shadow: var(--md-sys-elevation-shadow-3, -4px 0 16px rgb(0 0 0 / 20%));\n }\n }\n\n @media (max-width: 599.98px) {\n :host {\n width: 100vw;\n }\n }\n\n .scope {\n display: flex;\n align-items: center;\n gap: 6px;\n min-height: 40px;\n padding: 5px 8px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n\n .scope > md-icon {\n --md-icon-size: 18px;\n flex: none;\n color: var(--md-sys-color-primary);\n }\n\n .what {\n display: grid;\n flex: 1;\n min-width: 0;\n font-size: 12px;\n font-weight: 650;\n line-height: 1.25;\n }\n\n .what span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .detail {\n color: var(--md-sys-color-on-surface-variant);\n font-size: 10.5px;\n font-weight: 400;\n }\n\n .sbtn {\n display: inline-flex;\n align-items: center;\n flex: none;\n padding: 4px;\n border: none;\n border-radius: 8px;\n background: none;\n color: var(--md-sys-color-on-surface-variant);\n cursor: pointer;\n }\n\n .sbtn:hover {\n background: var(--md-sys-color-surface-container-high);\n color: var(--md-sys-color-on-surface);\n }\n\n .sbtn md-icon {\n --md-icon-size: 18px;\n }\n\n ox-assistant-session-toolbar {\n flex: none;\n min-width: 0;\n padding: 3px 8px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n --border-color: var(--md-sys-color-outline-variant);\n --main-section-background-color: var(--md-sys-color-surface-container);\n --primary-color: var(--md-sys-color-primary);\n font: inherit;\n font-size: 12px;\n }\n\n ox-assistant-chat,\n ox-assistant-session-manager {\n flex: 1;\n min-height: 0;\n }\n\n /* No conversation could stand - say what stopped it, never an empty panel. */\n .stuck {\n margin: auto;\n padding: 20px;\n text-align: center;\n line-height: 1.7;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .stuck .sbtn {\n margin-top: 6px;\n gap: 4px;\n font: inherit;\n }\n `\n ]\n\n /** The viewpart this dock lives in - for closing it. */\n @property({ type: String }) viewpart = ASSISTANT_DOCK_VIEWPART\n\n @state() private capability: AiCapability = 'unknown'\n @state() private asked = false\n @state() private surface?: AssistantSurface\n @state() private anchor?: AnchorResult\n @state() private kind = ''\n /** kind → its label, for the manager's rows. */\n @state() private kindLabels: Record<string, string> = {}\n @state() private sessions: AssistantSession[] = []\n @state() private sessionId = ''\n @state() private loading = false\n @state() private failure = ''\n @state() private showingHistory = false\n @state() private conversationView = 0\n @state() private asking?: { ask?: string; draft?: string; requestId: string }\n\n private app = new AppController(this)\n /** The kind the person picked; kept while the surface stays the same. */\n private chosenKind = ''\n private revision = 0\n /** What the conversation was opened for - a send is refused when the screen moved on. */\n private openedFor = ''\n private unsubscribers: (() => void)[] = []\n private controller = new AssistantSessionController(\n assistantSessionTransport,\n next => {\n if (next.sessionId !== this.sessionId) {\n setOpenSession(next.sessionId)\n this.surface?.sessionChanged?.(next.sessionId)\n }\n this.sessions = next.sessions\n this.sessionId = next.sessionId\n this.loading = next.loading\n this.failure = next.error\n },\n { getItem: key => sessionStorage.getItem(key), setItem: (key, value) => sessionStorage.setItem(key, value) },\n { lazy: true }\n )\n\n private onStartNewSession = () => void this.newConversation()\n\n connectedCallback() {\n super.connectedCallback()\n this.addEventListener('assistant-start-new-session', this.onStartNewSession)\n this.unsubscribers.push(\n subscribeAssistantSurface(() => this.follow()),\n subscribeAssistantAsk(() => void this.takeAsk()),\n subscribeSessionActivity(activity => {\n /* A rename or a new conversation elsewhere on this anchor - the tabs read again. */\n if (activity.kind === 'meta' && isAnchor(this.anchor) && activity.anchorId === this.anchor.anchorId) void this.reloadSessions()\n })\n )\n this.follow(true)\n }\n\n disconnectedCallback() {\n this.revision++\n this.removeEventListener('assistant-start-new-session', this.onStartNewSession)\n this.unsubscribers.splice(0).forEach(unsubscribe => unsubscribe())\n setOpenSession('')\n this.controller.clear()\n super.disconnectedCallback()\n }\n\n private scopeKey(surface = this.surface) {\n return JSON.stringify([this.app.contextPath, surface?.key ?? ''])\n }\n\n /** The screen changed - a different surface or domain is a different conversation. */\n private follow(force = false) {\n const next = currentAssistantSurface()\n if (!force && next === this.surface && this.scopeKey(next) === this.openedFor) return\n if (next?.key !== this.surface?.key) this.chosenKind = ''\n this.surface = next\n void this.open()\n }\n\n private async open(): Promise<void> {\n const ticket = ++this.revision\n this.conversationView++\n this.showingHistory = false\n void this.controller.open(undefined)\n this.loading = true\n this.failure = ''\n this.anchor = undefined\n this.openedFor = this.scopeKey()\n\n try {\n if (this.capability !== 'configured') {\n this.capability = await readAiCapability()\n this.asked = true\n }\n if (ticket !== this.revision || this.capability !== 'configured') return\n\n const surface = this.surface\n if (!surface) return\n\n const anchor = await surface.anchor()\n if (ticket !== this.revision) return\n this.anchor = anchor\n if (!isAnchor(anchor)) return\n\n const modes = await modesFor(surface.subject)\n if (ticket !== this.revision) return\n this.kindLabels = Object.fromEntries(modes.map(mode => [mode.kind, mode.label || mode.kind]))\n const chosen = modes.find(mode => mode.kind === this.chosenKind) ?? modes.find(mode => mode.isDefault) ?? modes[0]\n this.kind = chosen?.kind ?? ''\n if (!this.kind) {\n this.anchor = { stuck: 'no-conversation', message: t('no-conversation', 'there is no conversation for this screen.') }\n return\n }\n\n const user = (store.getState() as any).auth?.user\n const userId = user?.id || user?.email\n if (!userId) throw new Error(t('no-user', 'your sign-in could not be read. sign in again.'))\n\n await this.controller.open(this.target(userId, anchor))\n await this.takeAsk()\n } catch (error) {\n if (ticket === this.revision) this.failure = (error as Error).message\n } finally {\n if (ticket === this.revision) this.loading = false\n }\n }\n\n private target(userId: string, anchor: { anchorType: string; anchorId: string }): AssistantSessionTarget {\n /* The conversation kind is part of the key: two conversations on one anchor never share a session (ADR-0072 decision 3). */\n return { scope: JSON.stringify([this.app.contextPath, userId, this.kind]), anchorType: anchor.anchorType, anchorId: anchor.anchorId, kind: this.kind }\n }\n\n private async reloadSessions() {\n const target = this.controller.state.target\n if (target) await this.controller.open(target, true)\n }\n\n private async newConversation() {\n if (this.loading || !isAnchor(this.anchor)) return\n this.showingHistory = false\n const revision = this.controller.state.revision\n await this.controller.reset()\n if (revision !== this.controller.state.revision) this.conversationView++\n }\n\n private selectSession(id: string, pickedKind?: string) {\n this.showingHistory = false\n const follow = followPickedConversation(pickedKind, this.kind)\n if (follow) {\n /* A conversation of another kind on this anchor - the dock follows it rather than refusing it. */\n this.chosenKind = follow\n void this.open().then(() => this.controller.select(id) && this.conversationView++)\n return\n }\n const previous = this.sessionId\n if (this.controller.select(id) && previous !== id) this.conversationView++\n }\n\n private onModeChange = (event: CustomEvent) => {\n const kind = event.detail?.kind\n if (!kind || kind === this.kind) return\n this.chosenKind = kind\n void this.open()\n }\n\n /* ── asks from other screens ────────────────────────────────────────────────────── */\n\n private async takeAsk() {\n if (!isAnchor(this.anchor) || this.loading) return\n const ask: AssistantAsk | undefined = takeAssistantAsk()\n if (!ask) return\n\n if (!ask.continueCurrent && (ask.name || ask.context || ask.transcript?.length)) {\n const id = await this.startCarried(ask)\n if (id) {\n await this.reloadSessions()\n this.controller.select(id)\n }\n } else if (!ask.continueCurrent) {\n await this.newConversation()\n }\n this.conversationView++\n this.asking = { ask: ask.ask, draft: ask.draft, requestId: String(Date.now()) }\n }\n\n /** A new conversation carrying what the other screen had - its name, a note, earlier turns. */\n private async startCarried(ask: AssistantAsk): Promise<string | undefined> {\n const anchor = this.anchor as { anchorType: string; anchorId: string }\n const created = await client.mutate({\n mutation: gql`\n mutation ($t: String!, $i: String!, $n: String) {\n createAISession(anchorType: $t, anchorId: $i, name: $n) {\n id\n }\n }\n `,\n variables: { t: anchor.anchorType, i: anchor.anchorId, n: ask.name || null }\n })\n const id = created.data?.createAISession?.id\n if (!id) return undefined\n if (ask.context) {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $c: String!) {\n appendSessionNote(sessionId: $id, content: $c)\n }\n `,\n variables: { id, c: ask.context }\n })\n }\n if (ask.transcript?.length) {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $turns: JSON!) {\n appendSessionTurns(sessionId: $id, turns: $turns)\n }\n `,\n variables: { id, turns: ask.transcript.map(turn => ({ role: turn.role === 'ai' ? 'assistant' : 'user', content: turn.content })) }\n })\n }\n return id\n }\n\n /* ── proposals ───────────────────────────────────────────────────────────────────── */\n\n private proposalContext(sessionId?: string): ProposalContext {\n return {\n sessionId,\n surface: this.surface,\n confirm: async ({ title, text, confirmText, cancelText, type }) =>\n !!(await OxPrompt.open({\n type: type ?? 'warning',\n title,\n text,\n confirmButton: { text: confirmText ?? t('confirm', 'OK') },\n cancelButton: { text: cancelText ?? t('cancel', 'Cancel') }\n })),\n notify: (level, message) => notify({ level, message })\n }\n }\n\n private async report(sessionId: string | undefined, proposalKey: string | undefined, outcome: ProposalOutcome) {\n if (!sessionId || !proposalKey) return\n try {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $key: String!, $outcome: JSON!) {\n reportProposalOutcome(sessionId: $id, proposalKey: $key, outcome: $outcome)\n }\n `,\n variables: { id: sessionId, key: proposalKey, outcome }\n })\n } catch {\n /* the card then says it heard nothing - never \"done\" */\n }\n }\n\n /** Every proposal ends in exactly one reported outcome - a kind nobody handles is `unavailable`. */\n private onProposal = async (event: CustomEvent) => {\n const { proposal, sessionId, proposalKey } = event.detail ?? {}\n const outcome = await runProposal(proposal, this.proposalContext(sessionId))\n if (outcome.verdict === 'unavailable' && outcome.errorCode === 'unknown-proposal-kind') {\n notify({ level: 'error', message: t('proposal-not-runnable', 'this proposal cannot be run on this screen.') })\n }\n await this.report(sessionId, proposalKey, outcome)\n }\n\n /* ── board surfaces: the chat's scene edits land on the open board ───────────────── */\n\n private onScenePatch = async (event: CustomEvent) => {\n const board = this.surface?.board\n if (!board) return\n const result = await board.applyPatch(event.detail)\n if (result?.missed) notify({ level: 'info', message: t('patch-missed', '{missed} of the changes could not be applied.', { missed: result.missed }) })\n }\n\n private onBoardRevert = (event: CustomEvent) => void this.surface?.board?.revertPatch?.(event.detail?.patchId)\n\n private onSceneAction = (event: CustomEvent) => void this.surface?.board?.applyAction?.(event.detail)\n\n /* ── drawing ─────────────────────────────────────────────────────────────────────── */\n\n private stuckLine(): string {\n if (this.capability === 'not-configured') return t('not-configured', 'no AI is set up for this site. an administrator can set one up in the AI settings.')\n if (this.capability === 'unknown' && this.asked && !this.loading && !this.failure) return t('capability-unknown', 'whether AI is set up here could not be read.')\n if (this.capability === 'configured' && !this.surface && !this.loading) return t('no-surface', 'this screen has no conversation.')\n const anchor = this.anchor\n if (anchor && !isAnchor(anchor)) return anchor.message\n return ''\n }\n\n private header(): TemplateResult {\n const surface = this.surface\n const home = assistantHomeSurface()\n const ready = this.capability === 'configured' && isAnchor(this.anchor)\n return html`\n <div class=\"scope\">\n <md-icon>${surface?.icon || 'forum'}</md-icon>\n <span class=\"what\">\n <span>${surface?.label() || t('title', 'Assistant')}</span>\n ${surface?.detail ? html`<span class=\"detail\">${surface.detail()}</span>` : nothing}\n </span>\n ${home && surface && home !== surface\n ? html`<button class=\"sbtn\" title=${t('to-home', \"back to this application's conversation\")} @click=${() => this.useSurface(home)}>\n <md-icon>home</md-icon>\n </button>`\n : nothing}\n ${ready\n ? html`<button\n class=\"sbtn\"\n title=${this.showingHistory ? t('back-to-conversation', 'back to the conversation') : t('conversations', 'conversations')}\n @click=${() => (this.showingHistory = !this.showingHistory)}\n >\n <md-icon>${this.showingHistory ? 'forum' : 'list'}</md-icon>\n </button>`\n : nothing}\n <button class=\"sbtn\" title=${t('rebind', 'follow this screen again')} @click=${() => this.follow(true)}>\n <md-icon>refresh</md-icon>\n </button>\n <button class=\"sbtn\" title=${t('close', 'close')} @click=${() => closeOverlay(this.viewpart)}>\n <md-icon>close</md-icon>\n </button>\n </div>\n `\n }\n\n /** The home button: talk about the application instead of this screen, until the screen changes. */\n private useSurface(surface: AssistantSurface) {\n this.surface = surface\n this.chosenKind = ''\n void this.open()\n }\n\n render(): TemplateResult {\n const anchor = this.anchor\n const ready = this.capability === 'configured' && isAnchor(anchor)\n const stuck = this.stuckLine()\n const surface = this.surface\n const openedFor = this.openedFor\n const board = surface?.board\n\n const mode: AssistantMode | undefined = ready ? { kind: this.kind, target: (anchor as any).anchorId, hostContext: {} } : undefined\n\n return html`\n ${this.header()}\n ${ready && this.showingHistory\n ? html`<ox-assistant-session-manager\n .anchorType=${(anchor as any).anchorType}\n .anchorId=${(anchor as any).anchorId}\n .sessionId=${this.sessionId}\n .kind=${this.kind}\n .kindLabels=${this.kindLabels}\n @assistant-session-select=${(event: CustomEvent) => this.selectSession(event.detail.sessionId, event.detail.kind)}\n @assistant-session-reset=${() => this.newConversation()}\n @assistant-session-changed=${() => this.reloadSessions()}\n ></ox-assistant-session-manager>`\n : nothing}\n ${ready && !this.showingHistory\n ? html`<ox-assistant-session-toolbar\n .sessions=${this.sessions}\n .sessionId=${this.sessionId}\n .loading=${this.loading}\n .error=${this.failure}\n historyEnabled\n @assistant-session-select=${(event: CustomEvent) => this.selectSession(event.detail.sessionId)}\n @assistant-session-reset=${() => this.newConversation()}\n @assistant-session-history=${() => (this.showingHistory = true)}\n @assistant-session-retry=${() => this.open()}\n ></ox-assistant-session-toolbar>`\n : nothing}\n ${ready && !this.showingHistory && !this.loading && !this.failure\n ? keyed(\n this.conversationView,\n html`<ox-assistant-chat\n .sessionId=${this.sessionId}\n .prepareSession=${(adopt: (id: string) => void) => this.controller.prepareSession(adopt)}\n .contextProvider=${() => {\n /* The screen moved on between writing and sending - do not answer about the old one. */\n if (openedFor !== this.scopeKey(currentAssistantSurface() ?? surface)) throw new Error(t('screen-changed', 'the screen changed while you were writing. send it again.'))\n return { hostContext: surface?.hostContext?.() ?? {} }\n }}\n .mode=${mode}\n .subject=${surface?.subject}\n .chatEndpoint=${board?.chatEndpoint ?? 'assistantChat'}\n ?board-tools=${!!board}\n .currentBoard=${board?.currentBoard?.()}\n .boardProvider=${board?.boardProvider}\n .selectedRefids=${board?.selectedRefids?.() ?? []}\n .knownTypes=${board?.knownTypes?.()}\n .categories=${board?.categories?.()}\n .componentSchemas=${board?.componentSchemas?.()}\n .searchProvider=${board?.searchProvider}\n .autoAsk=${this.asking?.ask}\n .autoAskRequestId=${this.asking?.requestId}\n .draft=${this.asking?.draft}\n .draftRequestId=${this.asking?.requestId}\n @assistant-mode-change=${this.onModeChange}\n @assistant-proposal-execute=${this.onProposal}\n @scene-edit-patch=${this.onScenePatch}\n @board-edit-revert=${this.onBoardRevert}\n @scene-action-execute=${this.onSceneAction}\n ></ox-assistant-chat>`\n )\n : nothing}\n ${stuck\n ? html`<div class=\"stuck\">\n ${stuck}\n ${this.capability === 'unknown'\n ? html`<div><button class=\"sbtn\" @click=${() => this.open()}><md-icon>refresh</md-icon>${t('retry', 'try again')}</button></div>`\n : nothing}\n </div>`\n : nothing}\n ${this.failure && !stuck && !ready\n ? html`<div class=\"stuck\">\n ${this.failure}\n <div><button class=\"sbtn\" @click=${() => this.open()}><md-icon>refresh</md-icon>${t('retry', 'try again')}</button></div>\n </div>`\n : nothing}\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"assistant-dock.js","sourceRoot":"","sources":["../../client/components/assistant-dock.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,gCAAgC,CAAA;AACvC,OAAO,gCAAgC,CAAA;AAEvC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,wB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,CAAC,IAAI,CAAA,oCAAoC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,iBAAiB;gBACjI,CAAC,CAAC,OAAO;iBACN;YACT,CAAC,CAAC,OAAO;QACT,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAA;cACA,IAAI,CAAC,OAAO;+CACqB,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC;iBACpG;YACT,CAAC,CAAC,OAAO;KACZ,CAAA;IACH,CAAC;;AAzc2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAmC;AAE7C;IAAhB,KAAK,EAAE;;iDAA6C;AACpC;IAAhB,KAAK,EAAE;;4CAAsB;AACb;IAAhB,KAAK,EAAE;;8CAAmC;AAC1B;IAAhB,KAAK,EAAE;;6CAA8B;AACrB;IAAhB,KAAK,EAAE;;2CAAkB;AAET;IAAhB,KAAK,EAAE;;iDAAgD;AACvC;IAAhB,KAAK,EAAE;;+CAA0C;AACjC;IAAhB,KAAK,EAAE;;gDAAuB;AACd;IAAhB,KAAK,EAAE;;8CAAwB;AACf;IAAhB,KAAK,EAAE;;8CAAqB;AACZ;IAAhB,KAAK,EAAE;;qDAA+B;AACtB;IAAhB,KAAK,EAAE;;uDAA6B;AACpB;IAAhB,KAAK,EAAE;;6CAAqE;AAhJlE,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CA2kBzB","sourcesContent":["import '@material/web/icon/icon.js'\nimport './assistant-chat.js'\nimport './assistant-session-toolbar.js'\nimport './assistant-session-manager.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, css, html, nothing, type TemplateResult } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { closeOverlay, notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { AppController, store } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { followPickedConversation, type AssistantMode } from './assistant-mode.js'\nimport { AssistantSessionController, type AssistantSession, type AssistantSessionTarget } from '../utils/assistant-session-controller.js'\nimport { assistantSessionTransport } from '../utils/assistant-session-transport.js'\nimport { readAiCapability } from '../utils/assistant-capability-read.js'\nimport type { AiCapability } from '../utils/assistant-capability.js'\nimport { setOpenSession, subscribeSessionActivity } from '../utils/assistant-activity.js'\nimport {\n assistantHomeSurface,\n currentAssistantSurface,\n isAnchor,\n subscribeAssistantSurface,\n type AnchorResult,\n type AssistantSurface\n} from '../utils/assistant-surface.js'\nimport { runProposal, type ProposalContext, type ProposalOutcome } from '../utils/assistant-proposals.js'\nimport { holdAssistantAsk, subscribeAssistantAsk, takeAssistantAsk, type AssistantAsk } from '../utils/assistant-ask.js'\n\nexport const ASSISTANT_DOCK_VIEWPART = 'assistant-dock'\n\nconst t = (key: string, defaultValue: string, options: Record<string, unknown> = {}) =>\n i18next.t(`ai-assistant.dock.${key}`, { defaultValue, ...options })\n\nconst MODES_QUERY = gql`\n query ($subject: String!) {\n assistantModes(subject: $subject) {\n kind\n label\n isDefault\n }\n }\n`\n\nasync function modesFor(subject: string): Promise<{ kind: string; label?: string; isDefault?: boolean }[]> {\n const response = await client.query({ query: MODES_QUERY, variables: { subject }, fetchPolicy: 'network-only' })\n if (response.errors?.length) throw new Error(response.errors[0].message)\n return response.data?.assistantModes ?? []\n}\n\n/**\n * The AI dock - the same in every operato application (design/ai/shared-dock.md).\n *\n * ── What is here and what is not ────────────────────────────────────────────────\n * here where it stands, whether an AI answers, which surface and anchor, which conversation (mode),\n * sessions and their management, unread, proposals and their outcome, asks from other screens\n * the app what its screens show (surfaces, assistant-surface.ts), how its proposal kinds apply\n * (assistant-proposals.ts), and on the server its modes and tools\n *\n * Nothing in this file names an application or a proposal kind. A behaviour one app needs and another does\n * not is a surface field or a handler, never a branch here.\n */\n@customElement('ox-assistant-dock')\nexport class AssistantDock extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n width: 420px;\n max-width: 100vw;\n box-sizing: border-box;\n height: 100%;\n min-height: 0;\n background: var(--md-sys-color-surface-container-lowest);\n border-left: 1px solid var(--md-sys-color-outline-variant);\n color: var(--md-sys-color-on-surface);\n font-size: 13px;\n }\n\n /* Below 1440px the page keeps its full width and only the dock floats. The DOM stays - the chat does not reconnect. */\n @media (max-width: 1439.98px) {\n :host {\n position: fixed;\n inset: 0 0 0 auto;\n height: 100vh;\n height: 100dvh;\n z-index: 10;\n box-shadow: var(--md-sys-elevation-shadow-3, -4px 0 16px rgb(0 0 0 / 20%));\n }\n }\n\n @media (max-width: 599.98px) {\n :host {\n width: 100vw;\n }\n }\n\n .scope {\n display: flex;\n align-items: center;\n gap: 6px;\n min-height: 40px;\n padding: 5px 8px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n\n .scope > md-icon {\n --md-icon-size: 18px;\n flex: none;\n color: var(--md-sys-color-primary);\n }\n\n .what {\n display: grid;\n flex: 1;\n min-width: 0;\n font-size: 12px;\n font-weight: 650;\n line-height: 1.25;\n }\n\n .what span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .detail {\n color: var(--md-sys-color-on-surface-variant);\n font-size: 10.5px;\n font-weight: 400;\n }\n\n .sbtn {\n display: inline-flex;\n align-items: center;\n flex: none;\n padding: 4px;\n border: none;\n border-radius: 8px;\n background: none;\n color: var(--md-sys-color-on-surface-variant);\n cursor: pointer;\n }\n\n .sbtn:hover {\n background: var(--md-sys-color-surface-container-high);\n color: var(--md-sys-color-on-surface);\n }\n\n .sbtn md-icon {\n --md-icon-size: 18px;\n }\n\n ox-assistant-session-toolbar {\n flex: none;\n min-width: 0;\n padding: 3px 8px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n --border-color: var(--md-sys-color-outline-variant);\n --main-section-background-color: var(--md-sys-color-surface-container);\n --primary-color: var(--md-sys-color-primary);\n font: inherit;\n font-size: 12px;\n }\n\n ox-assistant-chat,\n ox-assistant-session-manager {\n flex: 1;\n min-height: 0;\n }\n\n /* No conversation could stand - say what stopped it, never an empty panel. */\n .stuck {\n margin: auto;\n padding: 20px;\n text-align: center;\n line-height: 1.7;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .stuck .sbtn {\n margin-top: 6px;\n gap: 4px;\n font: inherit;\n }\n `\n ]\n\n /** The viewpart this dock lives in - for closing it. */\n @property({ type: String }) viewpart = ASSISTANT_DOCK_VIEWPART\n\n @state() private capability: AiCapability = 'unknown'\n @state() private asked = false\n @state() private surface?: AssistantSurface\n @state() private anchor?: AnchorResult\n @state() private kind = ''\n /** kind → its label, for the manager's rows. */\n @state() private kindLabels: Record<string, string> = {}\n @state() private sessions: AssistantSession[] = []\n @state() private sessionId = ''\n @state() private loading = false\n @state() private failure = ''\n @state() private showingHistory = false\n @state() private conversationView = 0\n @state() private asking?: { ask?: string; draft?: string; requestId: string }\n\n private app = new AppController(this)\n /** The kind the person picked; kept while the surface stays the same. */\n private chosenKind = ''\n private revision = 0\n /** What the conversation was opened for - a send is refused when the screen moved on. */\n private openedFor = ''\n private unsubscribers: (() => void)[] = []\n private controller = new AssistantSessionController(\n assistantSessionTransport,\n next => {\n if (next.sessionId !== this.sessionId) {\n setOpenSession(next.sessionId)\n this.surface?.sessionChanged?.(next.sessionId)\n }\n this.sessions = next.sessions\n this.sessionId = next.sessionId\n this.loading = next.loading\n this.failure = next.error\n },\n { getItem: key => sessionStorage.getItem(key), setItem: (key, value) => sessionStorage.setItem(key, value) },\n { lazy: true }\n )\n\n private onStartNewSession = () => void this.newConversation()\n\n connectedCallback() {\n super.connectedCallback()\n this.addEventListener('assistant-start-new-session', this.onStartNewSession)\n this.unsubscribers.push(\n subscribeAssistantSurface(() => this.follow()),\n subscribeAssistantAsk(() => void this.takeAsk()),\n subscribeSessionActivity(activity => {\n /* A rename or a new conversation elsewhere on this anchor - the tabs read again. */\n if (activity.kind === 'meta' && isAnchor(this.anchor) && activity.anchorId === this.anchor.anchorId) void this.reloadSessions()\n })\n )\n this.follow(true)\n }\n\n disconnectedCallback() {\n this.revision++\n this.removeEventListener('assistant-start-new-session', this.onStartNewSession)\n this.unsubscribers.splice(0).forEach(unsubscribe => unsubscribe())\n setOpenSession('')\n this.controller.clear()\n super.disconnectedCallback()\n }\n\n private scopeKey(surface = this.surface) {\n return JSON.stringify([this.app.contextPath, surface?.key ?? ''])\n }\n\n /** The screen changed - a different surface or domain is a different conversation. */\n private follow(force = false) {\n const next = currentAssistantSurface()\n if (!force && next === this.surface && this.scopeKey(next) === this.openedFor) {\n /* The same conversation, told that its words changed - a name loaded, a board renamed on save. */\n this.requestUpdate()\n return\n }\n if (next?.key !== this.surface?.key) this.chosenKind = ''\n this.surface = next\n void this.open()\n }\n\n private async open(): Promise<void> {\n const ticket = ++this.revision\n this.conversationView++\n this.showingHistory = false\n void this.controller.open(undefined)\n this.loading = true\n this.failure = ''\n this.anchor = undefined\n this.openedFor = this.scopeKey()\n\n try {\n if (this.capability !== 'configured') {\n this.capability = await readAiCapability()\n this.asked = true\n }\n if (ticket !== this.revision || this.capability !== 'configured') return\n\n const surface = this.surface\n if (!surface) return\n\n const anchor = await surface.anchor()\n if (ticket !== this.revision) return\n this.anchor = anchor\n if (!isAnchor(anchor)) return\n\n const modes = await modesFor(surface.subject)\n if (ticket !== this.revision) return\n this.kindLabels = Object.fromEntries(modes.map(mode => [mode.kind, mode.label || mode.kind]))\n const chosen = modes.find(mode => mode.kind === this.chosenKind) ?? modes.find(mode => mode.isDefault) ?? modes[0]\n this.kind = chosen?.kind ?? ''\n if (!this.kind) {\n this.anchor = { stuck: 'no-conversation', message: t('no-conversation', 'there is no conversation for this screen.') }\n return\n }\n\n const user = (store.getState() as any).auth?.user\n const userId = user?.id || user?.email\n if (!userId) throw new Error(t('no-user', 'your sign-in could not be read. sign in again.'))\n\n await this.controller.open(this.target(userId, anchor))\n await this.takeAsk()\n } catch (error) {\n if (ticket === this.revision) this.failure = (error as Error).message\n } finally {\n if (ticket === this.revision) {\n this.loading = false\n /* No conversation can stand here - an ask waiting for one is answered now, not sent later somewhere else. */\n if (this.anchor && !isAnchor(this.anchor)) void this.takeAsk()\n }\n }\n }\n\n private target(userId: string, anchor: { anchorType: string; anchorId: string }): AssistantSessionTarget {\n /* The conversation kind is part of the key: two conversations on one anchor never share a session (ADR-0072 decision 3). */\n return { scope: JSON.stringify([this.app.contextPath, userId, this.kind]), anchorType: anchor.anchorType, anchorId: anchor.anchorId, kind: this.kind }\n }\n\n private async reloadSessions() {\n const target = this.controller.state.target\n if (target) await this.controller.open(target, true)\n }\n\n private async newConversation() {\n if (this.loading || !isAnchor(this.anchor)) return\n this.showingHistory = false\n const revision = this.controller.state.revision\n await this.controller.reset()\n if (revision !== this.controller.state.revision) this.conversationView++\n }\n\n private selectSession(id: string, pickedKind?: string) {\n this.showingHistory = false\n const follow = followPickedConversation(pickedKind, this.kind)\n if (follow) {\n /* A conversation of another kind on this anchor - the dock follows it rather than refusing it. */\n this.chosenKind = follow\n void this.open().then(() => this.controller.select(id) && this.conversationView++)\n return\n }\n const previous = this.sessionId\n if (this.controller.select(id) && previous !== id) this.conversationView++\n }\n\n private onModeChange = (event: CustomEvent) => {\n const kind = event.detail?.kind\n if (!kind || kind === this.kind) return\n this.chosenKind = kind\n void this.open()\n }\n\n /* ── asks from other screens ────────────────────────────────────────────────────── */\n\n private async takeAsk() {\n if (this.loading || !this.anchor) return\n if (!isAnchor(this.anchor)) {\n /*\n A question is not sent later on its own, once some conversation happens to stand - by then the person is looking\n at something else. It is said now why it was not sent. A draft only fills the input, so it waits.\n */\n const waiting = takeAssistantAsk()\n if (!waiting) return\n if (waiting.ask) notify({ level: 'info', message: `${t('ask-needs-conversation', 'the question was not sent.')} ${this.anchor.message}` })\n else holdAssistantAsk(waiting)\n return\n }\n const ask: AssistantAsk | undefined = takeAssistantAsk()\n if (!ask) return\n\n if (!ask.continueCurrent && (ask.name || ask.context || ask.transcript?.length)) {\n const id = await this.startCarried(ask).catch(error => {\n notify({ level: 'error', message: (error as Error).message })\n return undefined\n })\n if (id) {\n await this.reloadSessions()\n this.controller.select(id)\n }\n } else if (!ask.continueCurrent) {\n await this.newConversation()\n }\n this.conversationView++\n this.asking = { ask: ask.ask, draft: ask.draft, requestId: String(Date.now()) }\n }\n\n /** A new conversation carrying what the other screen had - its name, a note, earlier turns. */\n private async startCarried(ask: AssistantAsk): Promise<string | undefined> {\n const anchor = this.anchor as { anchorType: string; anchorId: string }\n const created = await client.mutate({\n mutation: gql`\n mutation ($t: String!, $i: String!, $n: String) {\n createAISession(anchorType: $t, anchorId: $i, name: $n) {\n id\n }\n }\n `,\n variables: { t: anchor.anchorType, i: anchor.anchorId, n: ask.name || null }\n })\n const id = created.data?.createAISession?.id\n if (!id) return undefined\n if (ask.context) {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $c: String!) {\n appendSessionNote(sessionId: $id, content: $c)\n }\n `,\n variables: { id, c: ask.context }\n })\n }\n if (ask.transcript?.length) {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $turns: JSON!) {\n appendSessionTurns(sessionId: $id, turns: $turns)\n }\n `,\n variables: { id, turns: ask.transcript.map(turn => ({ role: turn.role === 'ai' ? 'assistant' : 'user', content: turn.content })) }\n })\n }\n return id\n }\n\n /* ── proposals ───────────────────────────────────────────────────────────────────── */\n\n private proposalContext(sessionId?: string): ProposalContext {\n return {\n sessionId,\n surface: this.surface,\n confirm: async ({ title, text, confirmText, cancelText, type }) =>\n !!(await OxPrompt.open({\n type: type ?? 'warning',\n title,\n text,\n confirmButton: { text: confirmText ?? t('confirm', 'OK') },\n cancelButton: { text: cancelText ?? t('cancel', 'Cancel') }\n })),\n notify: (level, message) => notify({ level, message })\n }\n }\n\n private async report(sessionId: string | undefined, proposalKey: string | undefined, outcome: ProposalOutcome) {\n if (!sessionId || !proposalKey) return\n try {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $key: String!, $outcome: JSON!) {\n reportProposalOutcome(sessionId: $id, proposalKey: $key, outcome: $outcome)\n }\n `,\n variables: { id: sessionId, key: proposalKey, outcome }\n })\n } catch {\n /* the card then says it heard nothing - never \"done\" */\n }\n }\n\n /** Every proposal ends in exactly one reported outcome - a kind nobody handles is `unavailable`. */\n private onProposal = async (event: CustomEvent) => {\n const { proposal, sessionId, proposalKey } = event.detail ?? {}\n const outcome = await runProposal(proposal, this.proposalContext(sessionId))\n if (outcome.verdict === 'unavailable' && outcome.errorCode === 'unknown-proposal-kind') {\n notify({ level: 'error', message: t('proposal-not-runnable', 'this proposal cannot be run on this screen.') })\n }\n await this.report(sessionId, proposalKey, outcome)\n /* What the handler did, in the person's words, stays in the conversation - what was created, why it did not run. */\n if (outcome.note && sessionId) await this.appendNote(sessionId, outcome.note)\n }\n\n private async appendNote(sessionId: string, note: string) {\n try {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $c: String!) {\n appendSessionNote(sessionId: $id, content: $c)\n }\n `,\n variables: { id: sessionId, c: note }\n })\n } catch {\n /* the outcome is already reported; a lost note is not a lost outcome */\n }\n }\n\n /* ── board surfaces: the chat's scene edits land on the open board ───────────────── */\n\n private onScenePatch = async (event: CustomEvent) => {\n const board = this.surface?.board\n if (!board) return\n const result = await board.applyPatch(event.detail)\n if (result?.missed) notify({ level: 'info', message: t('patch-missed', '{missed} of the changes could not be applied.', { missed: result.missed }) })\n }\n\n private onBoardRevert = (event: CustomEvent) => void this.surface?.board?.revertPatch?.(event.detail?.patchId)\n\n private onSceneAction = (event: CustomEvent) => void this.surface?.board?.applyAction?.(event.detail)\n\n /* ── drawing ─────────────────────────────────────────────────────────────────────── */\n\n private stuckLine(): string {\n if (this.capability === 'not-configured') return t('not-configured', 'no AI is set up for this site. an administrator can set one up in the AI settings.')\n if (this.capability === 'unknown' && this.asked && !this.loading && !this.failure) return t('capability-unknown', 'whether AI is set up here could not be read.')\n if (this.capability === 'configured' && !this.surface && !this.loading) return t('no-surface', 'this screen has no conversation.')\n const anchor = this.anchor\n if (anchor && !isAnchor(anchor)) return anchor.message\n return ''\n }\n\n private header(): TemplateResult {\n const surface = this.surface\n const home = assistantHomeSurface()\n const ready = this.capability === 'configured' && isAnchor(this.anchor)\n return html`\n <div class=\"scope\">\n <md-icon>${surface?.icon || 'forum'}</md-icon>\n <span class=\"what\">\n <span>${surface?.label() || t('title', 'Assistant')}</span>\n ${surface?.detail ? html`<span class=\"detail\">${surface.detail()}</span>` : nothing}\n </span>\n ${home && surface && home !== surface\n ? html`<button class=\"sbtn\" title=${t('to-home', \"back to this application's conversation\")} @click=${() => this.useSurface(home)}>\n <md-icon>home</md-icon>\n </button>`\n : nothing}\n ${ready\n ? html`<button\n class=\"sbtn\"\n title=${this.showingHistory ? t('back-to-conversation', 'back to the conversation') : t('conversations', 'conversations')}\n @click=${() => (this.showingHistory = !this.showingHistory)}\n >\n <md-icon>${this.showingHistory ? 'forum' : 'list'}</md-icon>\n </button>`\n : nothing}\n <button class=\"sbtn\" title=${t('rebind', 'follow this screen again')} @click=${() => this.follow(true)}>\n <md-icon>refresh</md-icon>\n </button>\n <button class=\"sbtn\" title=${t('close', 'close')} @click=${() => closeOverlay(this.viewpart)}>\n <md-icon>close</md-icon>\n </button>\n </div>\n `\n }\n\n /** The home button: talk about the application instead of this screen, until the screen changes. */\n private useSurface(surface: AssistantSurface) {\n this.surface = surface\n this.chosenKind = ''\n void this.open()\n }\n\n render(): TemplateResult {\n const anchor = this.anchor\n const ready = this.capability === 'configured' && isAnchor(anchor)\n const stuck = this.stuckLine()\n const surface = this.surface\n const openedFor = this.openedFor\n const board = surface?.board\n\n const mode: AssistantMode | undefined = ready ? { kind: this.kind, target: (anchor as any).anchorId, hostContext: {} } : undefined\n\n return html`\n ${this.header()}\n ${ready && this.showingHistory\n ? html`<ox-assistant-session-manager\n .anchorType=${(anchor as any).anchorType}\n .anchorId=${(anchor as any).anchorId}\n .sessionId=${this.sessionId}\n .kind=${this.kind}\n .kindLabels=${this.kindLabels}\n @assistant-session-select=${(event: CustomEvent) => this.selectSession(event.detail.sessionId, event.detail.kind)}\n @assistant-session-reset=${() => this.newConversation()}\n @assistant-session-changed=${() => this.reloadSessions()}\n ></ox-assistant-session-manager>`\n : nothing}\n ${ready && !this.showingHistory\n ? html`<ox-assistant-session-toolbar\n .sessions=${this.sessions}\n .sessionId=${this.sessionId}\n .loading=${this.loading}\n .error=${this.failure}\n historyEnabled\n @assistant-session-select=${(event: CustomEvent) => this.selectSession(event.detail.sessionId)}\n @assistant-session-reset=${() => this.newConversation()}\n @assistant-session-history=${() => (this.showingHistory = true)}\n @assistant-session-retry=${() => this.open()}\n ></ox-assistant-session-toolbar>`\n : nothing}\n ${ready && !this.showingHistory && !this.loading && !this.failure\n ? keyed(\n this.conversationView,\n html`<ox-assistant-chat\n .sessionId=${this.sessionId}\n .prepareSession=${(adopt: (id: string) => void) => this.controller.prepareSession(adopt)}\n .contextProvider=${() => {\n /* The screen moved on between writing and sending - do not answer about the old one. */\n if (openedFor !== this.scopeKey(currentAssistantSurface() ?? surface)) throw new Error(t('screen-changed', 'the screen changed while you were writing. send it again.'))\n return { hostContext: surface?.hostContext?.() ?? {} }\n }}\n .mode=${mode}\n .subject=${surface?.subject}\n .chatEndpoint=${board?.chatEndpoint ?? 'assistantChat'}\n ?board-tools=${!!board}\n .currentBoard=${board?.currentBoard?.()}\n .boardProvider=${board?.boardProvider}\n .selectedRefids=${board?.selectedRefids?.() ?? []}\n .knownTypes=${board?.knownTypes?.()}\n .categories=${board?.categories?.()}\n .componentSchemas=${board?.componentSchemas?.()}\n .searchProvider=${board?.searchProvider}\n .autoAsk=${this.asking?.ask}\n .autoAskRequestId=${this.asking?.requestId}\n .draft=${this.asking?.draft}\n .draftRequestId=${this.asking?.requestId}\n @assistant-mode-change=${this.onModeChange}\n @assistant-proposal-execute=${this.onProposal}\n @scene-edit-patch=${this.onScenePatch}\n @board-edit-revert=${this.onBoardRevert}\n @scene-action-execute=${this.onSceneAction}\n ></ox-assistant-chat>`\n )\n : nothing}\n ${stuck\n ? html`<div class=\"stuck\">\n ${stuck}\n ${this.capability === 'unknown'\n ? html`<div><button class=\"sbtn\" @click=${() => this.open()}><md-icon>refresh</md-icon>${t('retry', 'try again')}</button></div>`\n : nothing}\n </div>`\n : nothing}\n ${this.failure && !stuck && !ready\n ? html`<div class=\"stuck\">\n ${this.failure}\n <div><button class=\"sbtn\" @click=${() => this.open()}><md-icon>refresh</md-icon>${t('retry', 'try again')}</button></div>\n </div>`\n : nothing}\n `\n }\n}\n"]}
|
|
@@ -25,26 +25,62 @@ let AssistantDockButton = class AssistantDockButton extends LitElement {
|
|
|
25
25
|
this.viewpart = ASSISTANT_DOCK_VIEWPART;
|
|
26
26
|
this.unread = 0;
|
|
27
27
|
}
|
|
28
|
+
/*
|
|
29
|
+
* The band's pill, as its bell draws it (apptool-ui app-header-band `.ctl`): 28px, a 1px edge, a 7px radius, an 18px
|
|
30
|
+
* outlined icon in the muted colour, the count inside the pill. The band shapes bare md-icon tools itself but cannot
|
|
31
|
+
* reach into this element, so the button draws the same shape - a filled 24px mark at full ink stood out on the row
|
|
32
|
+
* (user, 2026-09-25).
|
|
33
|
+
*/
|
|
28
34
|
static { this.styles = css `
|
|
29
35
|
:host {
|
|
30
|
-
position: relative;
|
|
31
36
|
display: inline-flex;
|
|
32
|
-
cursor: pointer;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
height:
|
|
41
|
-
|
|
39
|
+
button {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
gap: 6px;
|
|
44
|
+
height: 28px;
|
|
45
|
+
min-width: 28px;
|
|
46
|
+
padding: 0 8px;
|
|
42
47
|
box-sizing: border-box;
|
|
48
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
43
49
|
border-radius: 7px;
|
|
44
|
-
background: var(--md-sys-color-
|
|
45
|
-
color: var(--md-sys-color-on-
|
|
46
|
-
font
|
|
47
|
-
|
|
50
|
+
background-color: var(--header-band-control-surface, var(--md-sys-color-surface-container-lowest, var(--md-sys-color-surface)));
|
|
51
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
52
|
+
font: inherit;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
button:hover {
|
|
57
|
+
border-color: var(--md-sys-color-primary);
|
|
58
|
+
color: var(--md-sys-color-primary);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
button:focus-visible {
|
|
62
|
+
outline: 2px solid var(--md-sys-color-primary);
|
|
63
|
+
outline-offset: 2px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
md-icon {
|
|
67
|
+
--md-icon-size: 18px;
|
|
68
|
+
font-size: 18px;
|
|
69
|
+
font-variation-settings: 'FILL' 0;
|
|
70
|
+
color: inherit;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.count {
|
|
74
|
+
min-width: 15px;
|
|
75
|
+
height: 15px;
|
|
76
|
+
padding: 0 4px;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
border-radius: 8px;
|
|
79
|
+
background-color: var(--header-band-count-background, var(--md-sys-color-error));
|
|
80
|
+
color: var(--header-band-count-color, var(--md-sys-color-on-error));
|
|
81
|
+
font-size: 10px;
|
|
82
|
+
font-weight: 700;
|
|
83
|
+
line-height: 15px;
|
|
48
84
|
text-align: center;
|
|
49
85
|
}
|
|
50
86
|
`; }
|
|
@@ -62,13 +98,12 @@ let AssistantDockButton = class AssistantDockButton extends LitElement {
|
|
|
62
98
|
* then closed it - the first press did nothing (found on :3700, 2026-09-25). The dock's own ✕ closes it.
|
|
63
99
|
*/
|
|
64
100
|
render() {
|
|
101
|
+
const label = i18next.t('ai-assistant.dock.open', { defaultValue: 'Ask AI' });
|
|
65
102
|
return html `
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
>
|
|
71
|
-
${this.unread ? html `<span class="badge">${this.unread}</span>` : nothing}
|
|
103
|
+
<button title=${label} aria-label=${label} @click=${() => openOverlay(this.viewpart, { backdrop: false })}>
|
|
104
|
+
<md-icon aria-hidden="true">forum</md-icon>
|
|
105
|
+
${this.unread ? html `<span class="count">${this.unread > 99 ? '99+' : this.unread}</span>` : nothing}
|
|
106
|
+
</button>
|
|
72
107
|
`;
|
|
73
108
|
}
|
|
74
109
|
};
|