@things-factory/ai-assistant 10.1.79 → 10.1.81
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-chat.ts +102 -13
- package/client/components/assistant-dock.ts +160 -18
- package/client/components/assistant-mode.test.ts +16 -2
- package/client/components/assistant-session-manager.ts +52 -25
- package/client/components/assistant-session-toolbar.ts +4 -2
- package/client/components/chat-echo-dedup.ts +4 -0
- package/client/components/proposal-outcome-line.ts +36 -0
- package/client/components/proposal-request.test.ts +52 -0
- package/client/utils/assistant-navigation.test.ts +38 -0
- package/client/utils/assistant-navigation.ts +6 -0
- package/client/utils/assistant-surface.ts +21 -0
- package/dist-client/components/assistant-chat.d.ts +15 -0
- package/dist-client/components/assistant-chat.js +106 -13
- package/dist-client/components/assistant-chat.js.map +1 -1
- package/dist-client/components/assistant-dock.d.ts +13 -0
- package/dist-client/components/assistant-dock.js +175 -20
- package/dist-client/components/assistant-dock.js.map +1 -1
- package/dist-client/components/assistant-mode.test.js +14 -2
- package/dist-client/components/assistant-mode.test.js.map +1 -1
- package/dist-client/components/assistant-session-manager.d.ts +4 -0
- package/dist-client/components/assistant-session-manager.js +68 -26
- package/dist-client/components/assistant-session-manager.js.map +1 -1
- package/dist-client/components/assistant-session-toolbar.d.ts +1 -0
- package/dist-client/components/assistant-session-toolbar.js +8 -2
- package/dist-client/components/assistant-session-toolbar.js.map +1 -1
- package/dist-client/components/chat-echo-dedup.d.ts +2 -0
- package/dist-client/components/chat-echo-dedup.js +2 -0
- package/dist-client/components/chat-echo-dedup.js.map +1 -1
- package/dist-client/components/proposal-outcome-line.d.ts +29 -0
- package/dist-client/components/proposal-outcome-line.js +15 -0
- package/dist-client/components/proposal-outcome-line.js.map +1 -1
- package/dist-client/components/proposal-request.test.d.ts +1 -0
- package/dist-client/components/proposal-request.test.js +45 -0
- package/dist-client/components/proposal-request.test.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/assistant-navigation.d.ts +6 -0
- package/dist-client/utils/assistant-navigation.js +9 -0
- package/dist-client/utils/assistant-navigation.js.map +1 -0
- package/dist-client/utils/assistant-navigation.test.d.ts +1 -0
- package/dist-client/utils/assistant-navigation.test.js +37 -0
- package/dist-client/utils/assistant-navigation.test.js.map +1 -0
- package/dist-client/utils/assistant-surface.d.ts +19 -0
- package/dist-client/utils/assistant-surface.js.map +1 -1
- package/dist-server/service/assistant-chat-resolver.js +1 -0
- package/dist-server/service/assistant-chat-resolver.js.map +1 -1
- package/dist-server/service/chat-message/chat-message.d.ts +10 -0
- package/dist-server/service/chat-message/chat-message.js +29 -0
- package/dist-server/service/chat-message/chat-message.js.map +1 -1
- package/dist-server/service/chat-message/proposal-outcome.d.ts +8 -0
- package/dist-server/service/chat-message/proposal-outcome.js +35 -1
- package/dist-server/service/chat-message/proposal-outcome.js.map +1 -1
- package/dist-server/service/chat-session/session-inbox.d.ts +7 -0
- package/dist-server/service/chat-session/session-inbox.js +7 -0
- package/dist-server/service/chat-session/session-inbox.js.map +1 -1
- package/dist-server/service/chat-session-resolver.d.ts +1 -0
- package/dist-server/service/chat-session-resolver.js +63 -9
- package/dist-server/service/chat-session-resolver.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/service/assistant-chat-resolver.ts +1 -0
- package/server/service/chat-message/chat-message.ts +32 -0
- package/server/service/chat-message/proposal-outcome.test.ts +53 -2
- package/server/service/chat-message/proposal-outcome.ts +33 -0
- package/server/service/chat-session/session-inbox.ts +7 -0
- package/server/service/chat-session-resolver.ts +71 -12
- package/test/assistant-dock.test.ts +8 -3
- package/test/assistant-session-toolbar.test.ts +7 -1
- package/test/open-doors.test.ts +2 -1
- package/test/session-discovery.test.ts +42 -0
- package/translations/en.json +26 -1
- package/translations/ja.json +26 -1
- package/translations/ko.json +26 -1
- package/translations/ms.json +26 -1
- package/translations/zh.json +26 -1
|
@@ -1 +1 @@
|
|
|
1
|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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"]}
|
|
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,wBAAwB,EAAsB,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,0BAA0B,EAAsD,MAAM,0CAA0C,CAAA;AACzI,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzF,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,yBAAyB,EAG1B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,WAAW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\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'\nimport { surfaceTransition } from '../utils/assistant-navigation.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 .next-step {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n background: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface-variant);\n font-size: 12px;\n line-height: 1.4;\n }\n\n .next-step a {\n display: inline-flex;\n align-items: center;\n gap: 3px;\n flex: none;\n color: var(--md-sys-color-primary);\n font-weight: 650;\n text-decoration: none;\n }\n\n .next-step a:hover { text-decoration: underline; }\n .next-step md-icon { --md-icon-size: 16px; }\n ox-assistant-chat[hidden] { display: none; }\n .transition { padding: 10px 12px; font-size: 13px; line-height: 1.5; border-bottom: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface-container-low); }\n .transition button { display: block; margin-top: 6px; font: inherit; }\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 @state() private screenChanged = false\n @state() private navigationNotice = ''\n private openedIdentity = ''\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 store.subscribe(() => { if (this.openedIdentity !== this.identityKey()) 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: AssistantSurface | undefined) {\n return JSON.stringify([this.app.contextPath, surface?.key ?? ''])\n }\n\n private identityKey() {\n const user = (store.getState() as any).auth?.user\n return JSON.stringify([this.app.contextPath, user?.id || user?.email || ''])\n }\n\n private get navigationState() {\n return (this.renderRoot.querySelector('ox-assistant-chat') as any)?.navigationState ?? { busy: false, draft: false }\n }\n\n private async mayLeaveConversation(): Promise<boolean> {\n if (this.navigationState.busy) {\n notify({ level: 'info', message: t('wait-before-switch', 'Wait for the current response before changing conversations.') })\n return false\n }\n if (!this.navigationState.draft) return true\n const identity = this.identityKey()\n const accepted = await OxPrompt.open({\n type: 'warning', title: t('switch-title', 'Change conversation?'),\n text: t('switch-draft', 'Your unsent text and attachments will not move to the other conversation.'),\n confirmButton: { text: t('switch-confirm', 'Discard draft and switch') },\n cancelButton: { text: t('stay', 'Keep writing') }\n })\n return !!accepted && identity === this.identityKey()\n }\n\n private async requestSurface(surface: AssistantSurface | undefined) {\n if (!(await this.mayLeaveConversation())) return\n this.chosenKind = ''\n this.surface = surface\n this.navigationNotice = surface ? t('now-about', 'Conversation subject: {name}', { name: surface.label() }) : ''\n await this.open()\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 const transition = surfaceTransition({\n identityChanged: this.openedIdentity !== this.identityKey(),\n sameSubject: this.scopeKey(next) === this.openedFor,\n active: isAnchor(this.anchor) && (!!this.sessionId || this.navigationState.draft || this.navigationState.busy)\n })\n if (!force && transition === 'refresh') {\n this.surface = next\n this.screenChanged = false\n this.requestUpdate()\n return\n }\n if (!force && transition === 'offer') {\n this.screenChanged = true\n return\n }\n if (transition === 'reset') {\n this.asking = undefined\n this.capability = 'unknown'\n if (this.openedIdentity) takeAssistantAsk()\n }\n this.navigationNotice = transition === 'follow' && next ? t('now-about', 'Conversation subject: {name}', { name: next.label() }) : ''\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 this.openedIdentity = this.identityKey()\n this.screenChanged = false\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(this.surface)\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 if (!(await this.mayLeaveConversation())) 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 async selectSession(id: string, pickedKind?: string) {\n if (id !== this.sessionId && !(await this.mayLeaveConversation())) return\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 = async (event: CustomEvent) => {\n const kind = event.detail?.kind\n if (!kind || kind === this.kind) return\n if (!(await this.mayLeaveConversation())) 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 (this.screenChanged || this.navigationState.busy || this.navigationState.draft) {\n const waiting = takeAssistantAsk()\n if (waiting) notify({ level: 'info', message: t('ask-kept-current', 'The current conversation was kept. Switch to the intended subject before asking again.') })\n return\n }\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 const identity = this.identityKey()\n const scope = this.openedFor\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 })) && identity === this.identityKey() && scope === this.scopeKey(currentAssistantSurface()),\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: ProposalOutcome = this.openedFor !== this.scopeKey(currentAssistantSurface()) || this.openedIdentity !== this.identityKey()\n ? { verdict: 'unavailable', errorCode: 'conversation-screen-changed', note: t('return-to-subject', 'Return to the conversation subject before applying this proposal.') }\n : 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 /**\n * \"Check result\" - asks the surface what became of a requested proposal and reports only what it learns.\n * Nothing is run: a lost answer never turns into a second application (ADR-0097 Q-D4 ④).\n */\n private onProposalCheck = async (event: CustomEvent) => {\n const { proposal, sessionId, proposalKey } = event.detail ?? {}\n const ask = this.surface?.proposalOutcome\n if (!ask) {\n notify({ level: 'info', message: t('proposal-result-uncheckable', 'this screen cannot check that result. open the screen where it was applied.') })\n return\n }\n\n let outcome: ProposalOutcome | undefined\n try {\n outcome = await ask.call(this.surface, proposalKey, proposal)\n } catch {\n outcome = undefined\n }\n if (!outcome?.verdict) {\n notify({ level: 'info', message: t('proposal-result-unknown', 'the result is still unknown. it was not applied again.') })\n return\n }\n\n await this.report(sessionId, proposalKey, outcome)\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 if (!this.mayApplyOnScreen()) return\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 mayApplyOnScreen() {\n if (this.openedFor === this.scopeKey(currentAssistantSurface()) && this.openedIdentity === this.identityKey()) return true\n notify({ level: 'info', message: t('return-to-subject', 'Return to the conversation subject before applying this proposal.') })\n return false\n }\n\n private onBoardRevert = (event: CustomEvent) => { if (this.mayApplyOnScreen()) void this.surface?.board?.revertPatch?.(event.detail?.patchId) }\n\n private onSceneAction = (event: CustomEvent) => { if (this.mayApplyOnScreen()) 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 && this.showingHistory\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>arrow_back</md-icon>${t('back-to-conversation', 'back to the conversation')}\n </button>`\n : nothing}\n <button class=\"sbtn\" title=${t('rebind', 'follow this screen again')} @click=${() => this.requestSurface(currentAssistantSurface())}>\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 void this.requestSurface(surface)\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 ${surface?.nextStep ? html`<div class=\"next-step\" role=\"status\">\n <span>${surface.nextStep.description?.() || ''}</span>\n <a href=${surface.nextStep.href}>${surface.nextStep.label()}<md-icon>arrow_forward</md-icon></a>\n </div>` : nothing}\n ${this.screenChanged ? html`<div class=\"transition\" role=\"status\">\n ${t('screen-and-conversation', 'Screen: {screen}. Conversation: {conversation}. Your conversation has been kept.', { screen: currentAssistantSurface()?.label() || t('no-subject', 'No subject'), conversation: surface?.label() || '' })}\n <button class=\"sbtn\" @click=${() => this.requestSurface(currentAssistantSurface())}>${t('switch-to-screen', 'Talk about this screen')}</button>\n </div>` : this.navigationNotice ? html`<div class=\"transition\" role=\"status\">${this.navigationNotice}</div>` : nothing}\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 .scopeLabel=${t('conversation-scope', 'Conversations · {name}', { name: surface?.label() || '' })}\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 singleConversation\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.loading && !this.failure\n ? keyed(\n this.conversationView,\n html`<ox-assistant-chat\n ?hidden=${this.showingHistory}\n .sendBlocked=${this.screenChanged ? t('return-to-subject', 'Return to the conversation subject before sending or applying changes.') : ''}\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()) || this.openedIdentity !== this.identityKey()) throw new Error(t('return-to-subject', 'Return to the conversation subject before applying this proposal.'))\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 @assistant-proposal-check=${this.onProposalCheck}\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"]}
|
|
@@ -21,9 +21,13 @@ const MODE_VIEW = {
|
|
|
21
21
|
stagedNotice: undefined
|
|
22
22
|
};
|
|
23
23
|
/** The board product, which declares no mode and names its own door. */
|
|
24
|
+
/*
|
|
25
|
+
* A host on the neutral door. A board host (`chatEndpoint: 'boardAIChat'`) keeps its own door even with
|
|
26
|
+
* a mode - it alone carries the board document (16d14bce2b, ADR-0061 decision 0-1) - and is pinned below.
|
|
27
|
+
*/
|
|
24
28
|
const HOST_PROPERTIES = {
|
|
25
29
|
hostContext: { boardId: 'B-1' },
|
|
26
|
-
chatEndpoint: '
|
|
30
|
+
chatEndpoint: 'assistantChat'
|
|
27
31
|
};
|
|
28
32
|
const GLOBAL_DEFAULTS = {
|
|
29
33
|
catalogEntries: [{ type: 'rect' }],
|
|
@@ -57,7 +61,7 @@ describe('a mode names the conversation; the server says what it offers', () =>
|
|
|
57
61
|
});
|
|
58
62
|
describe('a host with no mode', () => {
|
|
59
63
|
test('gets its own properties and the registered defaults, as before modes existed', () => {
|
|
60
|
-
const c = resolveConversation(undefined, HOST_PROPERTIES, GLOBAL_DEFAULTS);
|
|
64
|
+
const c = resolveConversation(undefined, { ...HOST_PROPERTIES, chatEndpoint: 'boardAIChat' }, GLOBAL_DEFAULTS);
|
|
61
65
|
expect(c.hostContext).toEqual({ boardId: 'B-1' });
|
|
62
66
|
expect(c.slashTemplates).toEqual(GLOBAL_DEFAULTS.slashTemplates);
|
|
63
67
|
expect(c.footerNotice).toBe('previewed on the board');
|
|
@@ -119,4 +123,12 @@ describe('followPickedConversation', () => {
|
|
|
119
123
|
expect(followPickedConversation('', 'figure.modeller')).toBeUndefined();
|
|
120
124
|
});
|
|
121
125
|
});
|
|
126
|
+
describe('a board host keeps the board door', () => {
|
|
127
|
+
test('★ with a mode, the door stays boardAIChat and the board defaults fill what the mode leaves out', () => {
|
|
128
|
+
const c = resolveConversation(MODE, { ...HOST_PROPERTIES, chatEndpoint: 'boardAIChat' }, GLOBAL_DEFAULTS, undefined);
|
|
129
|
+
expect(c.kind).toBe('twin.space');
|
|
130
|
+
expect(c.chatEndpoint).toBe('boardAIChat');
|
|
131
|
+
expect(c.catalogEntries).toEqual(GLOBAL_DEFAULTS.catalogEntries);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
122
134
|
//# sourceMappingURL=assistant-mode.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-mode.test.js","sourceRoot":"","sources":["../../client/components/assistant-mode.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAsB,eAAe,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAE9I,MAAM,IAAI,GAAkB,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAA;AAEpG,8EAA8E;AAC9E,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,YAAY;IAClB,cAAc,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAC7F,cAAc,EAAE,EAAE;IAClB,eAAe,EAAE,EAAE;IACnB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;CACxB,CAAA;AAED,wEAAwE;AACxE,M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CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAC9F,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,wBAAwB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;IACxF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QAC9E,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QACzE,MAAM,CAAC,wBAAwB,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;IACzE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/*\n * A mode is one value, and the point of it is that the parts of a conversation cannot disagree\n * with each other. Since ADR-0061 decision 7 the parts live on the server: the browser names the\n * conversation (`kind`) and its subject (`target`), and the persona, the tool categories, the\n * model and the limits are the app server's.\n *\n * The defect this still guards against shipped: a screen whose prompt said \"you do not edit boards\n * here\" offered `/add-monitor` in the same panel, because the prompt was an element property and\n * the slash list was a module global. A mode's wording now comes from the same declaration the\n * door reads, so the two cannot describe different conversations.\n */\nimport { isDifferentConversation, resolveConversation, type AssistantMode, pickInitialMode, followPickedConversation } from './assistant-mode'\n\nconst MODE: AssistantMode = { kind: 'twin.space', target: 'S-12', hostContext: { spaceId: 'S-12' } }\n\n/** What the server said this mode offers, already in the request's locale. */\nconst MODE_VIEW = {\n kind: 'twin.space',\n slashTemplates: [{ name: 'status', description: 'summarize', template: '이 공간의 지금 상태를 요약해줘' }],\n catalogEntries: [],\n proposalChoices: [],\n footerNotice: undefined,\n stagedNotice: undefined\n}\n\n/** The board product, which declares no mode and names its own door. */\nconst HOST_PROPERTIES = {\n hostContext: { boardId: 'B-1' },\n chatEndpoint: 'boardAIChat' as const\n}\n\nconst GLOBAL_DEFAULTS = {\n catalogEntries: [{ type: 'rect' }],\n slashTemplates: [{ name: 'add-monitor', template: '모니터를 추가해줘' }],\n footerNotice: 'previewed on the board'\n}\n\ndescribe('a mode names the conversation; the server says what it offers', () => {\n test('★ the subject travels, and the door is the neutral one', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, MODE_VIEW)\n\n expect(c.kind).toBe('twin.space')\n expect(c.target).toBe('S-12')\n expect(c.hostContext).toEqual({ spaceId: 'S-12' })\n expect(c.chatEndpoint).toBe('assistantChat')\n })\n\n test('★ what the mode offers comes from the server, not from what another package registered', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, MODE_VIEW)\n\n expect(c.slashTemplates).toEqual(MODE_VIEW.slashTemplates)\n expect(JSON.stringify(c.slashTemplates)).not.toContain('add-monitor')\n expect(c.catalogEntries).toEqual([])\n expect(c.footerNotice).toBeUndefined()\n })\n\n test('★ before the server has answered, a mode offers nothing — the defaults do not stand in', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, undefined)\n\n expect(c.slashTemplates).toEqual([])\n expect(c.catalogEntries).toEqual([])\n })\n\n test('a view for another kind is ignored — the panel is showing this conversation', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, { ...MODE_VIEW, kind: 'twin.board' })\n\n expect(c.slashTemplates).toEqual([])\n })\n})\n\ndescribe('a host with no mode', () => {\n test('gets its own properties and the registered defaults, as before modes existed', () => {\n const c = resolveConversation(undefined, HOST_PROPERTIES, GLOBAL_DEFAULTS)\n\n expect(c.hostContext).toEqual({ boardId: 'B-1' })\n expect(c.slashTemplates).toEqual(GLOBAL_DEFAULTS.slashTemplates)\n expect(c.footerNotice).toBe('previewed on the board')\n expect(c.chatEndpoint).toBe('boardAIChat')\n })\n\n test('★ must name its door — there is no default any more', () => {\n expect(() => resolveConversation(undefined, {}, {})).toThrow(/chatEndpoint/)\n })\n})\n\ndescribe('isDifferentConversation', () => {\n const station3: AssistantMode = { kind: 'plant.station', target: '3' }\n\n test('★ a different subject ends the conversation, and so does a different kind', () => {\n expect(isDifferentConversation(station3, { kind: 'plant.station', target: '7' })).toBe(true)\n expect(isDifferentConversation(station3, { kind: 'plant.factory', target: '3' })).toBe(true)\n expect(isDifferentConversation(undefined, station3)).toBe(true)\n })\n\n test('the same subject, described again, does not', () => {\n expect(isDifferentConversation(station3, { ...station3, hostContext: { reread: true } })).toBe(false)\n expect(isDifferentConversation(undefined, undefined)).toBe(false)\n })\n})\n\n/*\n * ADR-0072 A17 ① — 화면을 열 때 어느 대화로 서나.\n *\n * 되살리는 것은 고른 대화이지 세션이 아니다. 그리고 없어진 대화로 되살리지 않는다 — 그러면 대화가\n * 안 열리고 사람은 자기가 무엇을 잘못했는지 알 길이 없다.\n */\ndescribe('pickInitialMode', () => {\n const choices = [\n { kind: 'twin.board', label: '이 그림 고치기', isDefault: true },\n { kind: 'twin.space', label: '이 현장 지금', isDefault: false }\n ]\n\n it('★ 지난번에 고른 대화로 돌아간다 — 매번 같은 손질을 다시 하지 않는다', () => {\n expect(pickInitialMode('twin.board', choices, 'twin.space')).toBe('twin.space')\n })\n\n it('★ 지금 목록에 없는 기억은 따르지 않는다 — 안 열리는 대화로 들어간다', () => {\n expect(pickInitialMode('twin.board', choices, 'twin.gone')).toBe('twin.board')\n })\n\n it('★ 고를 것이 하나뿐이면 기억을 보지 않는다 — 고른 적이 없는 화면이다', () => {\n expect(pickInitialMode('plant.station', [choices[0]], 'twin.space')).toBe('plant.station')\n })\n\n it('기억이 없으면 host 가 준 것으로 선다', () => {\n expect(pickInitialMode('twin.board', choices, undefined)).toBe('twin.board')\n })\n})\n\n/*\n * ADR-0072 결정 3 — 목록에서 고른 대화로 화면이 따라간다.\n */\ndescribe('followPickedConversation', () => {\n it('★ 다른 대화의 세션을 고르면 그 대화로 간다 — 안 따라가면 문이 거절한다', () => {\n expect(followPickedConversation('figure.catalog', 'figure.modeller')).toBe('figure.catalog')\n })\n\n it('같은 대화면 그대로 둔다', () => {\n expect(followPickedConversation('figure.modeller', 'figure.modeller')).toBeUndefined()\n })\n\n it('★ 칸이 서기 전 세션은 지금 대화로 둔다 — 서버가 다음 턴에 찍는다', () => {\n expect(followPickedConversation(undefined, 'figure.modeller')).toBeUndefined()\n expect(followPickedConversation(null, 'figure.modeller')).toBeUndefined()\n expect(followPickedConversation('', 'figure.modeller')).toBeUndefined()\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"assistant-mode.test.js","sourceRoot":"","sources":["../../client/components/assistant-mode.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAsB,eAAe,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAE9I,MAAM,IAAI,GAAkB,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAA;AAEpG,8EAA8E;AAC9E,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,YAAY;IAClB,cAAc,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAC7F,cAAc,EAAE,EAAE;IAClB,eAAe,EAAE,EAAE;IACnB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;CACxB,CAAA;AAED,wEAAwE;AACxE;;;GAGG;AACH,MAAM,eAAe,GAAG;IACtB,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;IAC/B,YAAY,EAAE,eAAwB;CACvC,CAAA;AAED,MAAM,eAAe,GAAG;IACtB,cAAc,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAClC,c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,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;IACxF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QAC9E,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QACzE,MAAM,CAAC,wBAAwB,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;IACzE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAI,CAAC,gGAAgG,EAAE,GAAG,EAAE;QAC1G,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,EAAE,EAAE,GAAG,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,eAAe,EAAE,SAAS,CAAC,CAAA;QAEpH,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACjC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAC1C,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/*\n * A mode is one value, and the point of it is that the parts of a conversation cannot disagree\n * with each other. Since ADR-0061 decision 7 the parts live on the server: the browser names the\n * conversation (`kind`) and its subject (`target`), and the persona, the tool categories, the\n * model and the limits are the app server's.\n *\n * The defect this still guards against shipped: a screen whose prompt said \"you do not edit boards\n * here\" offered `/add-monitor` in the same panel, because the prompt was an element property and\n * the slash list was a module global. A mode's wording now comes from the same declaration the\n * door reads, so the two cannot describe different conversations.\n */\nimport { isDifferentConversation, resolveConversation, type AssistantMode, pickInitialMode, followPickedConversation } from './assistant-mode'\n\nconst MODE: AssistantMode = { kind: 'twin.space', target: 'S-12', hostContext: { spaceId: 'S-12' } }\n\n/** What the server said this mode offers, already in the request's locale. */\nconst MODE_VIEW = {\n kind: 'twin.space',\n slashTemplates: [{ name: 'status', description: 'summarize', template: '이 공간의 지금 상태를 요약해줘' }],\n catalogEntries: [],\n proposalChoices: [],\n footerNotice: undefined,\n stagedNotice: undefined\n}\n\n/** The board product, which declares no mode and names its own door. */\n/*\n * A host on the neutral door. A board host (`chatEndpoint: 'boardAIChat'`) keeps its own door even with\n * a mode - it alone carries the board document (16d14bce2b, ADR-0061 decision 0-1) - and is pinned below.\n */\nconst HOST_PROPERTIES = {\n hostContext: { boardId: 'B-1' },\n chatEndpoint: 'assistantChat' as const\n}\n\nconst GLOBAL_DEFAULTS = {\n catalogEntries: [{ type: 'rect' }],\n slashTemplates: [{ name: 'add-monitor', template: '모니터를 추가해줘' }],\n footerNotice: 'previewed on the board'\n}\n\ndescribe('a mode names the conversation; the server says what it offers', () => {\n test('★ the subject travels, and the door is the neutral one', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, MODE_VIEW)\n\n expect(c.kind).toBe('twin.space')\n expect(c.target).toBe('S-12')\n expect(c.hostContext).toEqual({ spaceId: 'S-12' })\n expect(c.chatEndpoint).toBe('assistantChat')\n })\n\n test('★ what the mode offers comes from the server, not from what another package registered', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, MODE_VIEW)\n\n expect(c.slashTemplates).toEqual(MODE_VIEW.slashTemplates)\n expect(JSON.stringify(c.slashTemplates)).not.toContain('add-monitor')\n expect(c.catalogEntries).toEqual([])\n expect(c.footerNotice).toBeUndefined()\n })\n\n test('★ before the server has answered, a mode offers nothing — the defaults do not stand in', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, undefined)\n\n expect(c.slashTemplates).toEqual([])\n expect(c.catalogEntries).toEqual([])\n })\n\n test('a view for another kind is ignored — the panel is showing this conversation', () => {\n const c = resolveConversation(MODE, HOST_PROPERTIES, GLOBAL_DEFAULTS, { ...MODE_VIEW, kind: 'twin.board' })\n\n expect(c.slashTemplates).toEqual([])\n })\n})\n\ndescribe('a host with no mode', () => {\n test('gets its own properties and the registered defaults, as before modes existed', () => {\n const c = resolveConversation(undefined, { ...HOST_PROPERTIES, chatEndpoint: 'boardAIChat' }, GLOBAL_DEFAULTS)\n\n expect(c.hostContext).toEqual({ boardId: 'B-1' })\n expect(c.slashTemplates).toEqual(GLOBAL_DEFAULTS.slashTemplates)\n expect(c.footerNotice).toBe('previewed on the board')\n expect(c.chatEndpoint).toBe('boardAIChat')\n })\n\n test('★ must name its door — there is no default any more', () => {\n expect(() => resolveConversation(undefined, {}, {})).toThrow(/chatEndpoint/)\n })\n})\n\ndescribe('isDifferentConversation', () => {\n const station3: AssistantMode = { kind: 'plant.station', target: '3' }\n\n test('★ a different subject ends the conversation, and so does a different kind', () => {\n expect(isDifferentConversation(station3, { kind: 'plant.station', target: '7' })).toBe(true)\n expect(isDifferentConversation(station3, { kind: 'plant.factory', target: '3' })).toBe(true)\n expect(isDifferentConversation(undefined, station3)).toBe(true)\n })\n\n test('the same subject, described again, does not', () => {\n expect(isDifferentConversation(station3, { ...station3, hostContext: { reread: true } })).toBe(false)\n expect(isDifferentConversation(undefined, undefined)).toBe(false)\n })\n})\n\n/*\n * ADR-0072 A17 ① — 화면을 열 때 어느 대화로 서나.\n *\n * 되살리는 것은 고른 대화이지 세션이 아니다. 그리고 없어진 대화로 되살리지 않는다 — 그러면 대화가\n * 안 열리고 사람은 자기가 무엇을 잘못했는지 알 길이 없다.\n */\ndescribe('pickInitialMode', () => {\n const choices = [\n { kind: 'twin.board', label: '이 그림 고치기', isDefault: true },\n { kind: 'twin.space', label: '이 현장 지금', isDefault: false }\n ]\n\n it('★ 지난번에 고른 대화로 돌아간다 — 매번 같은 손질을 다시 하지 않는다', () => {\n expect(pickInitialMode('twin.board', choices, 'twin.space')).toBe('twin.space')\n })\n\n it('★ 지금 목록에 없는 기억은 따르지 않는다 — 안 열리는 대화로 들어간다', () => {\n expect(pickInitialMode('twin.board', choices, 'twin.gone')).toBe('twin.board')\n })\n\n it('★ 고를 것이 하나뿐이면 기억을 보지 않는다 — 고른 적이 없는 화면이다', () => {\n expect(pickInitialMode('plant.station', [choices[0]], 'twin.space')).toBe('plant.station')\n })\n\n it('기억이 없으면 host 가 준 것으로 선다', () => {\n expect(pickInitialMode('twin.board', choices, undefined)).toBe('twin.board')\n })\n})\n\n/*\n * ADR-0072 결정 3 — 목록에서 고른 대화로 화면이 따라간다.\n */\ndescribe('followPickedConversation', () => {\n it('★ 다른 대화의 세션을 고르면 그 대화로 간다 — 안 따라가면 문이 거절한다', () => {\n expect(followPickedConversation('figure.catalog', 'figure.modeller')).toBe('figure.catalog')\n })\n\n it('같은 대화면 그대로 둔다', () => {\n expect(followPickedConversation('figure.modeller', 'figure.modeller')).toBeUndefined()\n })\n\n it('★ 칸이 서기 전 세션은 지금 대화로 둔다 — 서버가 다음 턴에 찍는다', () => {\n expect(followPickedConversation(undefined, 'figure.modeller')).toBeUndefined()\n expect(followPickedConversation(null, 'figure.modeller')).toBeUndefined()\n expect(followPickedConversation('', 'figure.modeller')).toBeUndefined()\n })\n})\n\ndescribe('a board host keeps the board door', () => {\n test('★ with a mode, the door stays boardAIChat and the board defaults fill what the mode leaves out', () => {\n const c = resolveConversation(MODE, { ...HOST_PROPERTIES, chatEndpoint: 'boardAIChat' }, GLOBAL_DEFAULTS, undefined)\n\n expect(c.kind).toBe('twin.space')\n expect(c.chatEndpoint).toBe('boardAIChat')\n expect(c.catalogEntries).toEqual(GLOBAL_DEFAULTS.catalogEntries)\n })\n})\n"]}
|
|
@@ -32,6 +32,7 @@ export declare class AssistantSessionManager extends LitElement {
|
|
|
32
32
|
anchorId: string;
|
|
33
33
|
/** The conversation the dock has open - marked in the list. */
|
|
34
34
|
sessionId: string;
|
|
35
|
+
scopeLabel: string;
|
|
35
36
|
/** The doors. Replaceable for tests; a host normally leaves it. */
|
|
36
37
|
admin: AssistantSessionAdmin;
|
|
37
38
|
/** The conversation kind (mode) open in the dock - the list's default scope (§2-6). */
|
|
@@ -51,6 +52,9 @@ export declare class AssistantSessionManager extends LitElement {
|
|
|
51
52
|
private loading;
|
|
52
53
|
private error;
|
|
53
54
|
private renamingId;
|
|
55
|
+
private filtersOpen;
|
|
56
|
+
private get hasFilters();
|
|
57
|
+
private resetFilters;
|
|
54
58
|
private generation;
|
|
55
59
|
private searchTimer?;
|
|
56
60
|
/** Read the list again - the host calls this after it opened or started a conversation. */
|
|
@@ -39,6 +39,7 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
39
39
|
this.anchorId = '';
|
|
40
40
|
/** The conversation the dock has open - marked in the list. */
|
|
41
41
|
this.sessionId = '';
|
|
42
|
+
this.scopeLabel = '';
|
|
42
43
|
/** The doors. Replaceable for tests; a host normally leaves it. */
|
|
43
44
|
this.admin = assistantSessionAdmin;
|
|
44
45
|
/** The conversation kind (mode) open in the dock - the list's default scope (§2-6). */
|
|
@@ -58,14 +59,26 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
58
59
|
this.loading = false;
|
|
59
60
|
this.error = '';
|
|
60
61
|
this.renamingId = '';
|
|
62
|
+
this.filtersOpen = false;
|
|
61
63
|
this.generation = 0;
|
|
62
64
|
}
|
|
63
65
|
static { this.styles = css `
|
|
66
|
+
.scope-label { padding: 12px 12px 0; font-size: 14px; font-weight: 600; }
|
|
67
|
+
.filter-toggle, .reset { margin: 6px 10px; padding: 7px; font: inherit; background: transparent; color: inherit; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 6px; cursor: pointer; }
|
|
68
|
+
.filter-toggle { align-self: flex-end; }
|
|
69
|
+
.filters[hidden] { display: none; }
|
|
70
|
+
.open-row { display: block; flex: 1; min-width: 0; text-align: start; border: 0; background: transparent; color: inherit; font: inherit; padding: 4px; cursor: pointer; }
|
|
71
|
+
.meta { display: block; margin-top: 5px; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
|
|
72
|
+
.actions summary { cursor: pointer; padding: 8px; font-size: 18px; list-style: none; }
|
|
73
|
+
.actions[open] .acts { display: flex; flex-direction: column; position: absolute; right: 10px; top: 40px; z-index: 2; min-width: 180px; padding: 6px; background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--md-sys-color-outline-variant); border-radius: 8px; box-shadow: 0 4px 16px #0002; }
|
|
74
|
+
.actions button.icon { min-height: 40px; padding: 8px 12px; font: inherit; text-align: start; }
|
|
75
|
+
.actions button.danger { color: var(--md-sys-color-error, #b42318); }
|
|
76
|
+
button:focus-visible, summary:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
|
|
64
77
|
:host {
|
|
65
78
|
display: flex;
|
|
66
79
|
flex-direction: column;
|
|
67
80
|
min-height: 0;
|
|
68
|
-
font-size:
|
|
81
|
+
font-size: 14px;
|
|
69
82
|
color: var(--md-sys-color-on-surface);
|
|
70
83
|
}
|
|
71
84
|
|
|
@@ -206,11 +219,6 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
206
219
|
gap: 2px;
|
|
207
220
|
}
|
|
208
221
|
|
|
209
|
-
.row:hover .acts,
|
|
210
|
-
.row:focus-within .acts {
|
|
211
|
-
display: flex;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
222
|
button.icon {
|
|
215
223
|
display: inline-flex;
|
|
216
224
|
padding: 3px;
|
|
@@ -308,6 +316,19 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
308
316
|
--md-icon-size: 16px;
|
|
309
317
|
}
|
|
310
318
|
`; }
|
|
319
|
+
get hasFilters() {
|
|
320
|
+
return !!this.search.trim() || this.allKinds || this.whose !== 'all' || this.visibility !== 'all' || this.includeHidden || this.unreadOnly;
|
|
321
|
+
}
|
|
322
|
+
resetFilters() {
|
|
323
|
+
clearTimeout(this.searchTimer);
|
|
324
|
+
this.refilter(() => {
|
|
325
|
+
this.search = '';
|
|
326
|
+
this.allKinds = false;
|
|
327
|
+
this.whose = 'all';
|
|
328
|
+
this.visibility = 'all';
|
|
329
|
+
this.includeHidden = this.unreadOnly = false;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
311
332
|
/** Read the list again - the host calls this after it opened or started a conversation. */
|
|
312
333
|
async reload() {
|
|
313
334
|
const generation = ++this.generation;
|
|
@@ -434,17 +455,22 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
434
455
|
render() {
|
|
435
456
|
const shown = this.entries.length;
|
|
436
457
|
return html `
|
|
458
|
+
<div class="scope-label">${this.scopeLabel}</div>
|
|
437
459
|
<div class="bar">
|
|
438
460
|
<input
|
|
439
461
|
.value=${this.search}
|
|
440
|
-
placeholder=${t('search', 'Search
|
|
441
|
-
aria-label=${t('search', 'Search
|
|
462
|
+
placeholder=${t('search', 'Search conversations')}
|
|
463
|
+
aria-label=${t('search', 'Search conversations')}
|
|
442
464
|
@input=${(e) => this.onSearch(e.target.value)}
|
|
443
|
-
@keydown=${(e) => e.key === 'Escape' && this.
|
|
465
|
+
@keydown=${(e) => { if (e.key === 'Escape' && this.search) {
|
|
466
|
+
e.stopPropagation();
|
|
467
|
+
this.onSearch('');
|
|
468
|
+
} }}
|
|
444
469
|
/>
|
|
445
470
|
<button class="new" @click=${() => this.emit('assistant-session-reset')}>+ ${t('new', 'New conversation')}</button>
|
|
446
471
|
</div>
|
|
447
|
-
<
|
|
472
|
+
<button class="filter-toggle" aria-expanded=${this.filtersOpen} @click=${() => (this.filtersOpen = !this.filtersOpen)}>${t('filters', 'Filters')}${this.hasFilters ? ' •' : ''}</button>
|
|
473
|
+
<div class="filters" ?hidden=${!this.filtersOpen}>
|
|
448
474
|
${this.kind
|
|
449
475
|
? html `<select aria-label=${t('filter-kind', 'Which kind')} .value=${this.allKinds ? 'all' : 'this'}
|
|
450
476
|
@change=${(e) => this.refilter(() => (this.allKinds = e.target.value === 'all'))}>
|
|
@@ -469,10 +495,12 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
469
495
|
<label><input type="checkbox" .checked=${this.includeHidden}
|
|
470
496
|
@change=${(e) => this.refilter(() => (this.includeHidden = e.target.checked))} />${t('filter-hidden', 'Including hidden')}</label>
|
|
471
497
|
</div>
|
|
498
|
+
${this.hasFilters ? html `<button class="reset" @click=${() => this.resetFilters()}>${t('reset-filters', 'Clear search and filters')}</button>` : nothing}
|
|
472
499
|
<div class="list">
|
|
473
500
|
${this.error ? html `<div class="note" role="alert">${this.error}</div>` : nothing}
|
|
474
|
-
${
|
|
475
|
-
|
|
501
|
+
${this.loading ? html `<div class="note" role="status">${t('loading', 'Loading conversations…')}</div>` : nothing}
|
|
502
|
+
${shown === 0 && !this.loading && !this.error
|
|
503
|
+
? html `<div class="empty" role="status">${this.hasFilters ? t('filtered-empty', 'No conversations match these filters here.') : t('scope-empty', 'No conversations for this subject yet.')}</div>`
|
|
476
504
|
: this.entries.map(entry => this.renderRow(entry))}
|
|
477
505
|
${shown < this.total
|
|
478
506
|
? html `<button class="more" @click=${() => this.loadMore()}>${t('load-more', 'Show more ({rest})', { rest: this.total - shown })}</button>`
|
|
@@ -500,8 +528,10 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
500
528
|
@keydown=${(e) => {
|
|
501
529
|
if (e.key === 'Enter')
|
|
502
530
|
this.rename(entry, e.target.value);
|
|
503
|
-
if (e.key === 'Escape')
|
|
531
|
+
if (e.key === 'Escape') {
|
|
532
|
+
e.stopPropagation();
|
|
504
533
|
this.renamingId = '';
|
|
534
|
+
}
|
|
505
535
|
}}
|
|
506
536
|
@blur=${(e) => this.rename(entry, e.target.value)}
|
|
507
537
|
/>
|
|
@@ -509,29 +539,32 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
509
539
|
}
|
|
510
540
|
return html `<div
|
|
511
541
|
class="row ${entry.unread ? 'unread' : ''} ${entry.hidden ? 'hidden' : ''} ${entry.id === this.sessionId ? 'current' : ''}"
|
|
512
|
-
@click=${() => this.emit('assistant-session-select', { sessionId: entry.id, kind: entry.kind })}
|
|
513
542
|
>
|
|
514
543
|
<span class="dot"></span>
|
|
515
|
-
<
|
|
516
|
-
>${
|
|
517
|
-
>
|
|
518
|
-
<span class="body">
|
|
519
|
-
<div class="title" @dblclick=${(e) => { e.stopPropagation(); if (actions.rename)
|
|
520
|
-
this.renamingId = entry.id; }}>${name}</div>
|
|
544
|
+
<button class="open-row" aria-current=${entry.id === this.sessionId ? 'true' : 'false'} @click=${() => this.emit('assistant-session-select', { sessionId: entry.id, kind: entry.kind })}>
|
|
545
|
+
<div class="title">${name}</div>
|
|
521
546
|
<div class="prev">${this.allKinds && entry.kind ? html `<span class="kind">${this.kindLabels[entry.kind] || entry.kind}</span> · ` : nothing}${entry.lastMessagePreview || ''}</div>
|
|
522
|
-
|
|
547
|
+
<span class="meta">${isPrivate ? t('audience-private', 'Participants only') : t('audience-open', 'Everyone in this domain')}${entry.lastMessageAt && Number.isFinite(Date.parse(entry.lastMessageAt)) ? html ` · <time datetime=${entry.lastMessageAt}>${new Intl.DateTimeFormat(i18next.language || 'en', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }).format(new Date(entry.lastMessageAt))}</time>` : nothing}${entry.mine ? html ` · ${t('filter-mine', 'Started by me')}` : nothing}</span>
|
|
548
|
+
</button>
|
|
549
|
+
<details class="actions" @keydown=${(e) => { if (e.key === 'Escape') {
|
|
550
|
+
e.stopPropagation();
|
|
551
|
+
const details = e.currentTarget;
|
|
552
|
+
details.open = false;
|
|
553
|
+
details.querySelector('summary')?.focus();
|
|
554
|
+
} }}>
|
|
555
|
+
<summary aria-label=${t('manage', 'Manage conversation')}>⋯</summary>
|
|
523
556
|
<span class="acts" @click=${(e) => e.stopPropagation()}>
|
|
524
557
|
${actions.rename
|
|
525
558
|
? html `<button class="icon" title=${t('rename', 'Rename')} aria-label=${t('rename', 'Rename')} @click=${() => (this.renamingId = entry.id)}>
|
|
526
|
-
|
|
559
|
+
${t('rename', 'Rename')}
|
|
527
560
|
</button>`
|
|
528
561
|
: nothing}
|
|
529
562
|
${actions.setVisibility
|
|
530
563
|
? isPrivate
|
|
531
564
|
? html `<button class="icon" title=${t('make-open', 'Make public')} aria-label=${t('make-open', 'Make public')}
|
|
532
|
-
@click=${() => this.askOpen(entry, name)}
|
|
565
|
+
@click=${() => this.askOpen(entry, name)}>${t('make-open', 'Make public')}</button>`
|
|
533
566
|
: html `<button class="icon" title=${t('make-private', 'Make private')} aria-label=${t('make-private', 'Make private')}
|
|
534
|
-
@click=${() => this.setVisibility(entry, 'private')}
|
|
567
|
+
@click=${() => this.setVisibility(entry, 'private')}>${t('make-private', 'Make private')}</button>`
|
|
535
568
|
: nothing}
|
|
536
569
|
<button
|
|
537
570
|
class="icon"
|
|
@@ -539,13 +572,14 @@ let AssistantSessionManager = class AssistantSessionManager extends LitElement {
|
|
|
539
572
|
aria-label=${actions.unhide ? t('unhide', 'Show in my list') : t('hide', 'Hide from my list')}
|
|
540
573
|
@click=${() => this.setHidden(entry, !entry.hidden)}
|
|
541
574
|
>
|
|
542
|
-
|
|
575
|
+
${actions.unhide ? t('unhide', 'Show in my list') : t('hide', 'Hide from my list')}
|
|
543
576
|
</button>
|
|
544
577
|
${actions.remove
|
|
545
578
|
? html `<button class="icon danger" title=${t('remove', 'Delete')} aria-label=${t('remove', 'Delete')}
|
|
546
|
-
@click=${() => this.askRemove(entry, name)}
|
|
579
|
+
@click=${() => this.askRemove(entry, name)}>${t('remove', 'Delete')}</button>`
|
|
547
580
|
: nothing}
|
|
548
581
|
</span>
|
|
582
|
+
</details>
|
|
549
583
|
</div>`;
|
|
550
584
|
}
|
|
551
585
|
/** Before what cannot be taken back - the platform's confirm, [Cancel][OK] (decided 2026-09-25, §7-3). */
|
|
@@ -581,6 +615,10 @@ __decorate([
|
|
|
581
615
|
property({ type: String }),
|
|
582
616
|
__metadata("design:type", Object)
|
|
583
617
|
], AssistantSessionManager.prototype, "sessionId", void 0);
|
|
618
|
+
__decorate([
|
|
619
|
+
property({ type: String }),
|
|
620
|
+
__metadata("design:type", Object)
|
|
621
|
+
], AssistantSessionManager.prototype, "scopeLabel", void 0);
|
|
584
622
|
__decorate([
|
|
585
623
|
property({ attribute: false }),
|
|
586
624
|
__metadata("design:type", Object)
|
|
@@ -645,6 +683,10 @@ __decorate([
|
|
|
645
683
|
state(),
|
|
646
684
|
__metadata("design:type", Object)
|
|
647
685
|
], AssistantSessionManager.prototype, "renamingId", void 0);
|
|
686
|
+
__decorate([
|
|
687
|
+
state(),
|
|
688
|
+
__metadata("design:type", Object)
|
|
689
|
+
], AssistantSessionManager.prototype, "filtersOpen", void 0);
|
|
648
690
|
AssistantSessionManager = __decorate([
|
|
649
691
|
customElement('ox-assistant-session-manager')
|
|
650
692
|
], AssistantSessionManager);
|