@eclipse-docks/extension-ai-system 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +2 -2
  2. package/dist/api.js +1 -1
  3. package/dist/{cognitive-extension-CG_d39K5.js → cognitive-extension-7_ZMUCGD.js} +358 -92
  4. package/dist/cognitive-extension-7_ZMUCGD.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/runtime/abort.d.ts +5 -0
  7. package/dist/runtime/abort.d.ts.map +1 -0
  8. package/dist/runtime/attachment-paths.d.ts +17 -0
  9. package/dist/runtime/attachment-paths.d.ts.map +1 -0
  10. package/dist/runtime/attachments.d.ts +5 -5
  11. package/dist/runtime/attachments.d.ts.map +1 -1
  12. package/dist/runtime/cognitive-runtime.d.ts +7 -3
  13. package/dist/runtime/cognitive-runtime.d.ts.map +1 -1
  14. package/dist/runtime/index.d.ts +2 -0
  15. package/dist/runtime/index.d.ts.map +1 -1
  16. package/dist/runtime/models/openai-compatible.d.ts.map +1 -1
  17. package/dist/runtime/session-workspace.d.ts +20 -0
  18. package/dist/runtime/session-workspace.d.ts.map +1 -0
  19. package/dist/runtime/specialists/index.d.ts.map +1 -1
  20. package/dist/runtime/specialists/loop.d.ts.map +1 -1
  21. package/dist/runtime/tools/command-adapter.d.ts.map +1 -1
  22. package/dist/runtime/tools/index.d.ts +0 -1
  23. package/dist/runtime/tools/index.d.ts.map +1 -1
  24. package/dist/runtime/tools/workspace-adapter.d.ts +1 -1
  25. package/dist/runtime/tools/workspace-adapter.d.ts.map +1 -1
  26. package/dist/runtime/tools/workspace-path-qualify.d.ts +22 -0
  27. package/dist/runtime/tools/workspace-path-qualify.d.ts.map +1 -0
  28. package/dist/runtime/tools/workspace-path.d.ts +17 -0
  29. package/dist/runtime/tools/workspace-path.d.ts.map +1 -0
  30. package/dist/{runtime-DfNGzEjU.js → runtime-By5PP2BC.js} +696 -384
  31. package/dist/runtime-By5PP2BC.js.map +1 -0
  32. package/dist/view/busy-status.d.ts +12 -0
  33. package/dist/view/busy-status.d.ts.map +1 -0
  34. package/dist/view/cognitive-settings-editor.d.ts +0 -1
  35. package/dist/view/cognitive-settings-editor.d.ts.map +1 -1
  36. package/dist/view/cognitive-view.d.ts +21 -0
  37. package/dist/view/cognitive-view.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/cognitive-extension-CG_d39K5.js.map +0 -1
  40. package/dist/runtime/tools/attachment-adapter.d.ts +0 -6
  41. package/dist/runtime/tools/attachment-adapter.d.ts.map +0 -1
  42. package/dist/runtime-DfNGzEjU.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cognitive-extension-7_ZMUCGD.js","names":["APPROVAL_OPTIONS"],"sources":["../src/view/busy-status.ts","../src/view/cognitive-view.ts","../src/view/cognitive-settings-editor.ts","../src/cognitive-extension.ts"],"sourcesContent":["/** Shown immediately when waiting on a model turn. */\nexport const INITIAL_BUSY_STATUS = 'Thinking…';\n\n/**\n * Rotating wait copy (Cursor / Copilot style). Picked at random after the initial message.\n * Keep these light and short — they appear in the composer while busy.\n */\nexport const BUSY_STATUS_MESSAGES: readonly string[] = [\n 'Bribing the hamster…',\n 'Consulting the rubber duck…',\n 'Untangling the spaghetti…',\n 'Herding tokens…',\n 'Warming up the crystals…',\n 'Counting electric sheep…',\n 'Negotiating with the compiler…',\n 'Teaching frogs to code…',\n 'Aligning the bits…',\n 'Feeding the GPU snacks…',\n 'Looking under the couch…',\n 'Summoning a specialist…',\n 'Checking the manual twice…',\n 'Reticulating splines…',\n 'Sharpening pencils…',\n 'Pedaling harder…',\n 'Buffering brilliance…',\n 'Reversing the polarity…',\n 'Convincing the bits to cooperate…',\n 'Dusting off the playbook…',\n 'Whispering to the model…',\n 'Calibrating optimism…',\n 'Unfolding the roadmap…',\n 'Polishing ones and zeros…',\n 'Asking politely…',\n];\n\nconst ROTATE_MS_MIN = 3_000;\nconst ROTATE_MS_MAX = 12_000;\n\n/** Random delay until the next busy-status line (3–12s). */\nexport function busyStatusRotateMs(): number {\n return ROTATE_MS_MIN + Math.floor(Math.random() * (ROTATE_MS_MAX - ROTATE_MS_MIN + 1));\n}\n\n/** Next status, avoiding an immediate repeat of `current`. */\nexport function nextBusyStatus(current: string): string {\n const pool = BUSY_STATUS_MESSAGES.filter((m) => m !== current);\n if (!pool.length) return INITIAL_BUSY_STATUS;\n return pool[Math.floor(Math.random() * pool.length)]!;\n}\n","import '@eclipse-docks/core/externals/webawesome';\nimport {\n html,\n css,\n nothing,\n customElement,\n query,\n state,\n type TemplateResult,\n} from '@eclipse-docks/core/externals/lit';\nimport { DocksPart, toastError } from '@eclipse-docks/core';\nimport {\n ATTACHMENT_FILE_ACCEPT,\n MAX_ATTACHMENTS,\n OPEN_AI_SETTINGS_COMMAND,\n TOPIC,\n cognitiveRuntime,\n detectEffortCapability,\n estimateSessionContextUsage,\n formatBucketDetail,\n formatContextPercent,\n formatTokenCount,\n readPromptAttachmentFromFile,\n} from '../runtime';\nimport type {\n ChatMessage,\n CognitiveSession,\n ContextUsage,\n EffortLevel,\n MessagePart,\n ModelPolicy,\n PermissionAction,\n PromptAttachment,\n SessionAttachment,\n ToolApprovalMode,\n} from '../runtime';\nimport {\n INITIAL_BUSY_STATUS,\n busyStatusRotateMs,\n nextBusyStatus,\n} from './busy-status';\n\ninterface PermissionRequest {\n requestId: string;\n toolName: string;\n args: Record<string, unknown>;\n sessionId: string;\n}\n\n@customElement('docks-cognitive-view')\nexport class DocksCognitiveView extends DocksPart {\n protected scrollMode: 'scroller' | 'native' | 'none' = 'none';\n\n static styles = css`\n :host {\n height: 100%;\n min-height: 0;\n background: var(--wa-color-surface-default);\n color: var(--wa-color-text-normal);\n font-family: var(--wa-font-family-body);\n }\n\n .part-content,\n .part-content-inner {\n height: 100%;\n min-height: 0;\n }\n\n .cognitive-shell {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n overflow: hidden;\n /* Establish a definite containing block for wa-scroller's height: 100%. */\n position: relative;\n }\n\n wa-dropdown.history-menu::part(menu) {\n min-width: 18rem;\n max-width: min(24rem, 92vw);\n max-height: min(28rem, 70vh);\n overflow-y: auto;\n padding-top: 0;\n }\n\n .history-search {\n position: sticky;\n top: 0;\n z-index: 1;\n display: block;\n padding: var(--wa-space-s);\n background: var(--wa-color-surface-raised);\n border-bottom: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n }\n\n .history-search wa-input {\n width: 100%;\n }\n\n .history-item-title {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .history-item-meta {\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-xs);\n flex-shrink: 0;\n }\n\n .history-empty {\n padding: var(--wa-space-m);\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-s);\n text-align: center;\n }\n\n wa-scroller.transcript {\n /* flex-basis 0 so the host gets a definite height; wa-scroller vertical uses height:100%. */\n flex: 1 1 0;\n min-height: 0;\n height: 100%;\n overflow: hidden;\n }\n\n .transcript-inner {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-m);\n padding: var(--wa-space-m);\n min-height: 100%;\n box-sizing: border-box;\n }\n\n /* Pushes short threads to the bottom without breaking overflow scroll. */\n .transcript-spacer {\n flex: 1 0 0;\n min-height: 0;\n }\n\n .msg {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n max-width: 100%;\n }\n\n .msg.user {\n align-items: flex-end;\n }\n\n .msg-meta {\n position: absolute;\n right: var(--wa-space-2xs);\n bottom: var(--wa-space-2xs);\n z-index: 1;\n display: flex;\n gap: var(--wa-space-2xs);\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-end;\n max-width: calc(100% - var(--wa-space-s));\n padding: var(--wa-space-3xs) var(--wa-space-2xs);\n border-radius: var(--wa-border-radius-m);\n background: color-mix(in srgb, var(--wa-color-surface-default) 88%, transparent);\n font-size: var(--wa-font-size-xs);\n color: var(--wa-color-text-quiet);\n opacity: 0;\n pointer-events: none;\n transition: opacity var(--wa-transition-fast, 120ms) ease;\n }\n\n .msg:hover .msg-meta,\n .msg:focus-within .msg-meta {\n opacity: 1;\n pointer-events: auto;\n }\n\n .bubble {\n padding: var(--wa-space-s) var(--wa-space-m);\n border-radius: var(--wa-border-radius-l);\n background: var(--wa-color-surface-raised);\n border: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n white-space: pre-wrap;\n line-height: var(--wa-line-height-normal);\n max-width: 100%;\n }\n\n .msg.user .bubble {\n background: color-mix(in srgb, var(--wa-color-brand-fill-normal) 22%, transparent);\n border-color: color-mix(in srgb, var(--wa-color-brand-fill-normal) 40%, transparent);\n }\n\n .streaming-meta {\n display: flex;\n gap: var(--wa-space-2xs);\n align-items: center;\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-s);\n }\n\n .composer-shell {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-s);\n padding: var(--wa-space-s) var(--wa-space-m) var(--wa-space-m);\n border-top: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n flex-shrink: 0;\n }\n\n wa-dropdown.settings-menu::part(menu) {\n min-width: 16rem;\n max-width: min(28rem, 92vw);\n }\n\n wa-dropdown.context-menu::part(menu) {\n min-width: 17rem;\n max-width: min(22rem, 92vw);\n padding: var(--wa-space-s);\n }\n\n .context-ring {\n --size: 1.35rem;\n --track-width: 2.5px;\n --indicator-width: 2.5px;\n font-size: 0;\n }\n\n .context-panel {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-s);\n }\n\n .context-header {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n gap: var(--wa-space-s);\n }\n\n .context-header strong {\n font-size: var(--wa-font-size-s);\n }\n\n .context-header span {\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-xs);\n }\n\n .context-bars {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n }\n\n .context-row {\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--wa-space-2xs);\n font-size: var(--wa-font-size-xs);\n }\n\n .context-row-label {\n color: var(--wa-color-text-quiet);\n }\n\n .context-meter {\n grid-column: 1 / -1;\n height: 0.35rem;\n border-radius: var(--wa-border-radius-pill);\n background: var(--wa-color-neutral-fill-quiet);\n overflow: hidden;\n }\n\n .context-meter > span {\n display: block;\n height: 100%;\n border-radius: inherit;\n background: var(--bucket-color, var(--wa-color-brand-fill-normal));\n }\n\n .context-footer {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n }\n\n .context-remaining {\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-xs);\n }\n\n .composer {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n flex: 1;\n min-width: 0;\n }\n\n .composer-row {\n display: flex;\n gap: var(--wa-space-s);\n align-items: flex-end;\n }\n\n .composer wa-textarea {\n flex: 1;\n min-width: 0;\n }\n\n .composer-actions {\n display: flex;\n align-items: center;\n gap: var(--wa-space-2xs);\n flex-shrink: 0;\n }\n\n .composer-shell.drag-over {\n outline: 2px dashed var(--wa-color-brand-border-normal);\n outline-offset: -2px;\n background: color-mix(in srgb, var(--wa-color-brand-fill-quiet) 35%, transparent);\n }\n\n wa-dropdown.attach-menu::part(menu) {\n min-width: 18rem;\n max-width: min(24rem, 92vw);\n padding: var(--wa-space-2xs);\n }\n\n .attach-panel {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n max-height: min(22rem, 50vh);\n }\n\n .attach-list {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n overflow: auto;\n min-height: 0;\n }\n\n .attach-row {\n display: flex;\n align-items: center;\n gap: var(--wa-space-2xs);\n min-width: 0;\n }\n\n .attach-preview-btn {\n display: flex;\n align-items: center;\n gap: var(--wa-space-s);\n flex: 1;\n min-width: 0;\n margin: 0;\n padding: var(--wa-space-2xs);\n border: none;\n border-radius: var(--wa-border-radius-s);\n background: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: pointer;\n }\n\n .attach-preview-btn:hover {\n background: var(--wa-color-neutral-fill-quiet);\n }\n\n .attach-thumb,\n .msg-file-thumb {\n width: 2.5rem;\n height: 2.5rem;\n object-fit: cover;\n border-radius: var(--wa-border-radius-s);\n border: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n flex-shrink: 0;\n }\n\n .attach-file-icon {\n display: grid;\n place-items: center;\n width: 2.5rem;\n height: 2.5rem;\n border-radius: var(--wa-border-radius-s);\n border: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n color: var(--wa-color-text-quiet);\n flex-shrink: 0;\n }\n\n .attach-name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--wa-font-size-s);\n }\n\n .attach-empty {\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-xs);\n padding: var(--wa-space-s);\n }\n\n .msg-file-thumb {\n width: 4.5rem;\n height: 4.5rem;\n }\n\n .attach-dialog-body {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-s);\n max-height: min(70vh, 40rem);\n overflow: auto;\n }\n\n .attach-dialog-image {\n max-width: 100%;\n height: auto;\n border-radius: var(--wa-border-radius-m);\n }\n\n .attach-dialog-text {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n font-family: var(--wa-font-family-code, ui-monospace, monospace);\n font-size: var(--wa-font-size-s);\n }\n\n .msg-files {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wa-space-2xs);\n margin-bottom: var(--wa-space-2xs);\n }\n\n .approval-actions {\n display: flex;\n gap: var(--wa-space-s);\n margin-top: var(--wa-space-s);\n flex-wrap: wrap;\n }\n\n pre.args {\n margin: var(--wa-space-s) 0 0;\n font-family: var(--wa-font-family-code, var(--wa-font-mono));\n font-size: var(--wa-font-size-xs);\n white-space: pre-wrap;\n overflow-x: auto;\n }\n\n wa-details {\n font-size: var(--wa-font-size-s);\n }\n\n wa-details.msg-details {\n width: 100%;\n font-size: var(--wa-font-size-s);\n }\n\n wa-details.msg-details::part(base),\n wa-details.msg-details::part(details) {\n border: none;\n background: transparent;\n }\n\n wa-details.msg-details::part(header) {\n align-items: flex-start;\n gap: var(--wa-space-2xs);\n padding: 0;\n }\n\n wa-details.msg-details::part(summary) {\n flex: 1;\n min-width: 0;\n }\n\n wa-details.msg-details::part(content) {\n padding: var(--wa-space-s) 0 0;\n }\n\n .msg-summary {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xs);\n width: 100%;\n }\n\n .msg-tech {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-s);\n margin-inline-start: var(--wa-space-l);\n padding-inline-start: var(--wa-space-m);\n border-inline-start: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n }\n\n .tool-heading {\n font-size: var(--wa-font-size-xs);\n color: var(--wa-color-text-quiet);\n margin-bottom: var(--wa-space-2xs);\n }\n\n .tool-row {\n display: flex;\n align-items: center;\n gap: var(--wa-space-2xs);\n flex-wrap: wrap;\n }\n\n .tool-row .tool-heading {\n margin-bottom: 0;\n flex: 1;\n min-width: 0;\n }\n\n .tool-detail-body {\n max-height: min(70vh, 36rem);\n overflow: auto;\n }\n\n .tool-detail-body pre {\n margin: 0;\n font-family: var(--wa-font-family-code, var(--wa-font-mono));\n font-size: var(--wa-font-size-xs);\n white-space: pre-wrap;\n word-break: break-word;\n }\n `;\n\n @query('wa-textarea') private textarea?: HTMLElement & { value: string; shadowRoot: ShadowRoot | null };\n @query('#attach-file-input') private fileInput?: HTMLInputElement;\n private composerPasteBound = false;\n\n @state() private sessions: CognitiveSession[] = [];\n @state() private focusedId: string | null = null;\n @state() private draft = '';\n /** Session attachment ids to publish with the next user turn. */\n @state() private pendingAttachmentIds: string[] = [];\n @state() private dragOver = false;\n @state() private previewAttachmentId: string | null = null;\n @state() private toolDetail: Extract<MessagePart, { type: 'tool' }> | null = null;\n @state() private busy = false;\n @state() private busyStatus = INITIAL_BUSY_STATUS;\n @state() private pendingPermission: PermissionRequest | null = null;\n @state() private policyMode: 'auto' | 'manual' = 'auto';\n @state() private optimizeFor: 'cost' | 'balance' | 'intelligence' = 'balance';\n @state() private manualModel = '';\n @state() private manualEffort: EffortLevel | 'auto' = 'auto';\n @state() private approvalMode: ToolApprovalMode = 'auto_safe';\n @state() private modelIds: string[] = [];\n @state() private streamingParts: MessagePart[] = [];\n @state() private historyOpen = false;\n @state() private historyQuery = '';\n private unsubs: Array<() => void> = [];\n private scrollDebounceTimer?: ReturnType<typeof setTimeout>;\n private busyStatusTimer?: ReturnType<typeof setTimeout>;\n private promptController: AbortController | null = null;\n private nativePasteHandler = (e: Event) => void this.onComposerPaste(e as ClipboardEvent);\n private cancelKeyHandler = (e: KeyboardEvent) => {\n if (!this.busy || e.key !== 'Escape') return;\n e.preventDefault();\n this.cancelTurn();\n };\n\n protected updated(): void {\n this.bindComposerPaste();\n }\n\n private bindComposerPaste(): void {\n if (this.composerPasteBound) return;\n const native = this.textarea?.shadowRoot?.querySelector('textarea');\n if (!native) return;\n native.addEventListener('paste', this.nativePasteHandler);\n this.composerPasteBound = true;\n }\n\n protected doBeforeUI(): void {\n cognitiveRuntime.start();\n this.syncSessions();\n this.syncModels();\n this.approvalMode = cognitiveRuntime.getApprovalMode();\n void cognitiveRuntime.whenReady().then(() => {\n this.syncSessions();\n this.restoreRoutingFromRuntime();\n this.scheduleScrollToBottom();\n });\n this.unsubs.push(\n cognitiveRuntime.events.subscribe(TOPIC.sessionChanged, () => {\n this.syncSessions();\n this.scheduleScrollToBottom();\n }),\n cognitiveRuntime.events.subscribe(TOPIC.providersChanged, () => this.onProvidersChanged()),\n cognitiveRuntime.events.subscribe(TOPIC.approvalModeChanged, (mode) => {\n this.approvalMode = mode as ToolApprovalMode;\n }),\n cognitiveRuntime.events.subscribe(TOPIC.permissionAsked, (payload) => {\n this.pendingPermission = payload as PermissionRequest;\n this.scheduleScrollToBottom();\n }),\n cognitiveRuntime.events.subscribe(TOPIC.messagePart, (payload) => {\n const { sessionId, part } = payload as { sessionId: string; part: MessagePart };\n if (sessionId !== this.focusedId) return;\n this.streamingParts = mergePart(this.streamingParts, part);\n this.scheduleScrollToBottom();\n }),\n cognitiveRuntime.events.subscribe(TOPIC.messageDone, () => {\n this.streamingParts = [];\n this.syncSessions();\n this.scheduleScrollToBottom();\n }),\n );\n }\n\n protected doClose(): void {\n if (this.scrollDebounceTimer) clearTimeout(this.scrollDebounceTimer);\n this.scrollDebounceTimer = undefined;\n this.cancelTurn();\n this.stopBusyStatus();\n const native = this.textarea?.shadowRoot?.querySelector('textarea');\n native?.removeEventListener('paste', this.nativePasteHandler);\n this.composerPasteBound = false;\n for (const u of this.unsubs) u();\n this.unsubs = [];\n }\n\n private startBusyStatus(): void {\n this.stopBusyStatus();\n this.busyStatus = INITIAL_BUSY_STATUS;\n void this.setComposerText(this.busyStatus);\n window.addEventListener('keydown', this.cancelKeyHandler);\n const schedule = () => {\n this.busyStatusTimer = setTimeout(() => {\n this.busyStatus = nextBusyStatus(this.busyStatus);\n void this.setComposerText(this.busyStatus);\n schedule();\n }, busyStatusRotateMs());\n };\n schedule();\n }\n\n private stopBusyStatus(): void {\n if (this.busyStatusTimer) clearTimeout(this.busyStatusTimer);\n this.busyStatusTimer = undefined;\n this.busyStatus = INITIAL_BUSY_STATUS;\n window.removeEventListener('keydown', this.cancelKeyHandler);\n }\n\n private syncSessions(): void {\n const byRecency = cognitiveRuntime.sessions.list();\n this.sessions = [...byRecency].sort((a, b) => a.createdAt - b.createdAt);\n const focused = cognitiveRuntime.sessions.focused();\n const activeId = focused?.id ?? byRecency[0]?.id ?? null;\n if (activeId && focused?.id !== activeId) {\n cognitiveRuntime.sessions.focus(activeId);\n }\n this.focusedId = activeId;\n }\n\n private scheduleScrollToBottom(): void {\n if (this.scrollDebounceTimer) clearTimeout(this.scrollDebounceTimer);\n this.scrollDebounceTimer = setTimeout(() => {\n this.scrollDebounceTimer = undefined;\n void this.scrollToBottom();\n }, 50);\n }\n\n private async scrollToBottom(): Promise<void> {\n await this.updateComplete;\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n const scroller = this.renderRoot.querySelector('wa-scroller.transcript');\n if (!scroller?.shadowRoot) return;\n\n const container = scroller.shadowRoot.querySelector('#content');\n if (!(container instanceof HTMLElement)) return;\n container.scrollTop = container.scrollHeight;\n }\n\n private focusedSession(): CognitiveSession | undefined {\n return this.sessions.find((s) => s.id === this.focusedId) ?? this.sessions[0];\n }\n\n private deleteSession(sessionId: string): void {\n if (this.sessions.length <= 1) {\n cognitiveRuntime.sessions.createSession({ title: 'Chat' });\n cognitiveRuntime.removeSession(sessionId);\n } else {\n cognitiveRuntime.removeSession(sessionId);\n }\n this.streamingParts = [];\n this.syncSessions();\n }\n\n private openSession(sessionId: string): void {\n if (!cognitiveRuntime.sessions.focus(sessionId)) return;\n this.streamingParts = [];\n this.syncSessions();\n this.historyOpen = false;\n this.historyQuery = '';\n cognitiveRuntime.commitSessions();\n this.scheduleScrollToBottom();\n }\n\n private newSession(): void {\n cognitiveRuntime.sessions.createSession({ title: 'Chat' });\n this.streamingParts = [];\n this.historyOpen = false;\n this.historyQuery = '';\n this.syncSessions();\n cognitiveRuntime.commitSessions();\n }\n\n private historySessions(): CognitiveSession[] {\n const q = this.historyQuery.trim().toLowerCase();\n const sorted = [...this.sessions].sort((a, b) => b.updatedAt - a.updatedAt);\n if (!q) return sorted;\n return sorted.filter((s) => {\n if (s.title.toLowerCase().includes(q)) return true;\n return s.history.some((m) =>\n m.parts.some((p) => {\n if (p.type === 'text') return p.text.toLowerCase().includes(q);\n if (p.type === 'file') {\n return (\n p.name.toLowerCase().includes(q) ||\n p.id.toLowerCase().includes(q) ||\n (p.path?.toLowerCase().includes(q) ?? false)\n );\n }\n return false;\n }),\n );\n });\n }\n\n private syncModels(): void {\n this.modelIds = cognitiveRuntime.listConfiguredModels();\n if (!this.manualModel || !this.modelIds.includes(this.manualModel)) {\n this.manualModel = this.modelIds[0] ?? cognitiveRuntime.defaultModelId();\n }\n }\n\n /** Mirror persisted runtime policy into the gear menu after hydrate. */\n private restoreRoutingFromRuntime(): void {\n this.syncModels();\n const policy = cognitiveRuntime.getModelPolicy();\n if (policy.mode === 'auto') {\n this.policyMode = 'auto';\n this.optimizeFor = policy.optimizeFor;\n } else {\n this.policyMode = 'manual';\n this.manualModel = policy.model;\n this.manualEffort = policy.effort ?? 'auto';\n if (!this.manualModel || !this.modelIds.includes(this.manualModel)) {\n this.manualModel = this.modelIds[0] ?? cognitiveRuntime.defaultModelId();\n this.applyPolicy();\n }\n }\n this.approvalMode = cognitiveRuntime.getApprovalMode();\n }\n\n private onProvidersChanged(): void {\n this.syncModels();\n if (this.policyMode !== 'manual') return;\n if (this.manualModel && this.modelIds.includes(this.manualModel)) return;\n this.manualModel = this.modelIds[0] ?? cognitiveRuntime.defaultModelId();\n this.applyPolicy();\n }\n\n private effortChoices(): Array<EffortLevel | 'auto'> {\n const cap = detectEffortCapability(this.manualModel || cognitiveRuntime.defaultModelId());\n if (!cap.supported) return ['auto', 'none'];\n return ['auto', ...cap.levels];\n }\n\n private routerValue(): string {\n return this.policyMode === 'auto' ? `auto:${this.optimizeFor}` : `model:${this.manualModel}`;\n }\n\n private routerLabel(): string {\n if (this.policyMode === 'auto') return `Auto · ${capitalize(this.optimizeFor)}`;\n if (!this.modelIds.length) return 'No models';\n return shortModelLabel(this.manualModel || this.modelIds[0]!);\n }\n\n private activeModelRef(): string {\n const session = this.focusedSession();\n const routed = [...(session?.history ?? [])]\n .reverse()\n .find((m) => m.role === 'assistant' && m.routedModel)?.routedModel;\n if (routed) return routed;\n if (this.policyMode === 'manual') {\n return this.manualModel || this.modelIds[0] || cognitiveRuntime.defaultModelId();\n }\n return this.modelIds[0] || cognitiveRuntime.defaultModelId();\n }\n\n private contextUsage(): ContextUsage {\n return estimateSessionContextUsage(this.focusedSession(), this.activeModelRef());\n }\n\n private async compactFocused(): Promise<void> {\n if (!this.focusedId) return;\n await cognitiveRuntime.compactSession(this.focusedId);\n this.syncSessions();\n }\n\n private onRouterSelect(value: string): void {\n if (value.startsWith('auto:')) {\n const optimize = value.slice(5);\n if (optimize === 'cost' || optimize === 'balance' || optimize === 'intelligence') {\n this.policyMode = 'auto';\n this.optimizeFor = optimize;\n this.applyPolicy();\n }\n return;\n }\n if (value.startsWith('model:')) {\n const model = value.slice(6);\n if (!model) return;\n this.policyMode = 'manual';\n this.manualModel = model;\n this.applyPolicy();\n }\n }\n\n private applyPolicy(): void {\n const policy: ModelPolicy =\n this.policyMode === 'manual'\n ? {\n mode: 'manual',\n model: this.manualModel || cognitiveRuntime.defaultModelId(),\n effort: this.manualEffort,\n }\n : { mode: 'auto', optimizeFor: this.optimizeFor };\n cognitiveRuntime.setModelPolicy(policy);\n }\n\n private async setComposerText(value: string): Promise<void> {\n this.draft = value;\n await this.updateComplete;\n if (this.textarea) this.textarea.value = value;\n }\n\n private async clearComposer(): Promise<void> {\n this.pendingAttachmentIds = [];\n if (this.fileInput) this.fileInput.value = '';\n await this.setComposerText('');\n }\n\n private sessionAttachments(): SessionAttachment[] {\n return this.focusedSession()?.attachments ?? [];\n }\n\n private previewAttachment(): SessionAttachment | undefined {\n if (!this.previewAttachmentId) return undefined;\n return this.sessionAttachments().find((a) => a.id === this.previewAttachmentId);\n }\n\n private openAttachmentPreview(attachmentId: string): void {\n this.previewAttachmentId = attachmentId;\n }\n\n private closeAttachmentPreview(): void {\n this.previewAttachmentId = null;\n }\n\n private removeSessionAttachment(attachmentId: string): void {\n const sessionId = this.focusedId ?? cognitiveRuntime.ensureSessionId();\n cognitiveRuntime.removeAttachment(sessionId, attachmentId);\n this.pendingAttachmentIds = this.pendingAttachmentIds.filter((id) => id !== attachmentId);\n if (this.previewAttachmentId === attachmentId) this.previewAttachmentId = null;\n this.syncSessions();\n }\n\n private async addFiles(fileList: FileList | File[]): Promise<void> {\n const files = [...fileList];\n if (!files.length) return;\n\n const sessionId = cognitiveRuntime.ensureSessionId(this.focusedId ?? undefined);\n this.focusedId = sessionId;\n const existing = this.sessionAttachments();\n const accepted: PromptAttachment[] = [];\n\n for (const file of files) {\n if (existing.length + accepted.length >= MAX_ATTACHMENTS) {\n toastError(`At most ${MAX_ATTACHMENTS} files per session`);\n break;\n }\n if (\n existing.some((a) => a.name === file.name && a.byteLength === file.size) ||\n accepted.some((a) => a.name === file.name && a.byteLength === file.size)\n ) {\n continue;\n }\n const result = await readPromptAttachmentFromFile(file);\n if (!result.ok) {\n toastError(result.error);\n continue;\n }\n accepted.push(result.attachment);\n }\n\n const stored = await cognitiveRuntime.addAttachments(sessionId, accepted);\n if (stored.length) {\n this.pendingAttachmentIds = [\n ...this.pendingAttachmentIds,\n ...stored.map((a) => a.id).filter((id) => !this.pendingAttachmentIds.includes(id)),\n ];\n }\n this.syncSessions();\n }\n\n private openFilePicker(): void {\n this.fileInput?.click();\n }\n\n private async onFileInputChange(e: Event): Promise<void> {\n const input = e.target as HTMLInputElement;\n if (input.files?.length) await this.addFiles(input.files);\n input.value = '';\n }\n\n private onComposerDragOver(e: DragEvent): void {\n if (!e.dataTransfer?.types.includes('Files')) return;\n e.preventDefault();\n this.dragOver = true;\n }\n\n private onComposerDragLeave(e: DragEvent): void {\n if (e.currentTarget === e.target) this.dragOver = false;\n }\n\n private async onComposerDrop(e: DragEvent): Promise<void> {\n e.preventDefault();\n this.dragOver = false;\n if (e.dataTransfer?.files?.length) await this.addFiles(e.dataTransfer.files);\n }\n\n /** Attach clipboard files/images (e.g. Ctrl+V screenshot) when focused in the prompt. */\n private async onComposerPaste(e: ClipboardEvent): Promise<void> {\n if (this.busy) {\n e.preventDefault();\n return;\n }\n const files = filesFromClipboard(e.clipboardData);\n if (!files.length) return;\n e.preventDefault();\n await this.addFiles(files);\n }\n\n private cancelTurn(): void {\n if (!this.busy && !this.promptController) return;\n this.promptController?.abort();\n if (this.pendingPermission) this.resolvePermission('deny');\n }\n\n private async send(): Promise<void> {\n const text = this.draft.trim();\n const attachmentIds = [...this.pendingAttachmentIds];\n if ((!text && !attachmentIds.length) || this.busy) return;\n this.applyPolicy();\n this.pendingAttachmentIds = [];\n if (this.fileInput) this.fileInput.value = '';\n const controller = new AbortController();\n this.promptController = controller;\n this.busy = true;\n this.streamingParts = [];\n this.startBusyStatus();\n try {\n await cognitiveRuntime.prompt({\n sessionId: this.focusedId ?? undefined,\n text,\n attachmentIds,\n signal: controller.signal,\n });\n } finally {\n if (this.promptController === controller) this.promptController = null;\n this.stopBusyStatus();\n this.busy = false;\n this.streamingParts = [];\n await this.clearComposer();\n this.syncSessions();\n this.scheduleScrollToBottom();\n this.textarea?.focus();\n }\n }\n\n private renderAttachmentDropdown() {\n const attachments = this.sessionAttachments();\n const count = attachments.length;\n return html`\n <wa-dropdown class=\"attach-menu\" size=\"s\" placement=\"top-end\" distance=\"4\">\n <wa-button\n slot=\"trigger\"\n size=\"s\"\n appearance=\"plain\"\n title=${count ? `${count} attachment${count === 1 ? '' : 's'}` : 'Attachments'}\n ?disabled=${this.busy}\n >\n <wa-icon name=\"paperclip\" label=\"Attachments\"></wa-icon>\n ${count > 0 ? html`<wa-badge pill>${count}</wa-badge>` : nothing}\n </wa-button>\n <div\n class=\"attach-panel\"\n @click=${(e: Event) => e.stopPropagation()}\n @keydown=${(e: Event) => e.stopPropagation()}\n >\n ${count\n ? html`\n <div class=\"attach-list\">\n ${attachments.map(\n (file) => html`\n <div class=\"attach-row\">\n <button\n type=\"button\"\n class=\"attach-preview-btn\"\n title=\"Open ${file.name}\"\n @click=${() => this.openAttachmentPreview(file.id)}\n >\n ${file.kind === 'image' && file.dataUrl\n ? html`<img\n class=\"attach-thumb\"\n src=${file.dataUrl}\n alt=${file.name}\n />`\n : html`\n <span class=\"attach-file-icon\">\n <wa-icon name=\"file\" label=\"\"></wa-icon>\n </span>\n `}\n <span class=\"attach-name\">${file.name}</span>\n </button>\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n title=\"Remove from session\"\n ?disabled=${this.busy}\n @click=${() => this.removeSessionAttachment(file.id)}\n >\n <wa-icon name=\"xmark\" label=\"Remove\"></wa-icon>\n </wa-button>\n </div>\n `,\n )}\n </div>\n `\n : html`<div class=\"attach-empty\">No attachments in this session</div>`}\n <wa-button\n size=\"s\"\n appearance=\"outlined\"\n ?disabled=${this.busy || count >= MAX_ATTACHMENTS}\n @click=${() => this.openFilePicker()}\n >\n <wa-icon slot=\"start\" name=\"plus\"></wa-icon>\n Add files…\n </wa-button>\n </div>\n </wa-dropdown>\n `;\n }\n\n private renderAttachmentDialog() {\n const preview = this.previewAttachment();\n if (!preview) return nothing;\n return html`\n <wa-dialog\n label=${preview.name}\n open\n light-dismiss\n with-footer\n style=\"--width: min(40rem, 94vw)\"\n @wa-after-hide=${() => this.closeAttachmentPreview()}\n >\n <div class=\"attach-dialog-body\">\n ${preview.kind === 'image' && preview.dataUrl\n ? html`<img class=\"attach-dialog-image\" src=${preview.dataUrl} alt=${preview.name} />`\n : nothing}\n ${preview.text\n ? html`<pre class=\"attach-dialog-text\">${preview.text}</pre>`\n : preview.kind === 'image' && preview.dataUrl\n ? nothing\n : html`<pre class=\"attach-dialog-text\"></pre>`}\n </div>\n <div slot=\"footer\">\n <wa-button\n variant=\"danger\"\n appearance=\"outlined\"\n @click=${() => this.removeSessionAttachment(preview.id)}\n >\n Remove\n </wa-button>\n <wa-button variant=\"brand\" @click=${() => this.closeAttachmentPreview()}>Close</wa-button>\n </div>\n </wa-dialog>\n `;\n }\n\n private openToolDetail(part: Extract<MessagePart, { type: 'tool' }>): void {\n this.toolDetail = part;\n }\n\n private closeToolDetail(): void {\n this.toolDetail = null;\n }\n\n private renderToolDetailDialog() {\n const tool = this.toolDetail;\n if (!tool) return nothing;\n const label = `${tool.name} · ${tool.status}${tool.durationMs != null ? ` · ${tool.durationMs}ms` : ''}`;\n const body = JSON.stringify({ args: tool.args ?? {}, result: tool.result ?? null }, null, 2);\n return html`\n <wa-dialog\n label=${label}\n open\n light-dismiss\n with-footer\n style=\"--width: min(44rem, 96vw)\"\n @wa-after-hide=${() => this.closeToolDetail()}\n >\n <div class=\"tool-detail-body\">\n <pre>${body}</pre>\n </div>\n <div slot=\"footer\">\n <wa-button variant=\"brand\" @click=${() => this.closeToolDetail()}>Close</wa-button>\n </div>\n </wa-dialog>\n `;\n }\n\n private resolvePermission(action: PermissionAction): void {\n if (!this.pendingPermission) return;\n cognitiveRuntime.resolvePermission(this.pendingPermission.requestId, action);\n this.pendingPermission = null;\n }\n\n protected renderToolbar(): TemplateResult {\n const session = this.focusedSession();\n const title = session?.title || 'Chat';\n return html`\n <span class=\"toolbar-title\" title=${title}>${title}</span>\n <wa-button size=\"s\" appearance=\"plain\" title=\"New chat\" @click=${() => this.newSession()}>\n <wa-icon name=\"plus\" label=\"New chat\"></wa-icon>\n </wa-button>\n ${this.renderHistoryDropdown()}\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n title=\"Checkpoint\"\n @click=${() => {\n if (!this.focusedId) return;\n cognitiveRuntime.sessions.checkpoint(this.focusedId);\n this.syncSessions();\n cognitiveRuntime.commitSessions();\n }}\n >\n <wa-icon name=\"floppy-disk\" label=\"Checkpoint\"></wa-icon>\n </wa-button>\n ${this.renderSettingsDropdown()}\n `;\n }\n\n private contextRingStyle(level: ContextUsage['level']): string {\n const tone = level === 'critical' ? 'danger' : level === 'warn' ? 'warning' : 'success';\n // Match Web Awesome docs: quiet track + loud indicator.\n return [\n `--track-color: var(--wa-color-${tone}-fill-quiet)`,\n `--indicator-color: var(--wa-color-${tone}-fill-loud)`,\n ].join(';');\n }\n\n private renderContextDropdown() {\n const usage = this.contextUsage();\n const canCompact = (this.focusedSession()?.history.length ?? 0) > 12;\n const percentLabel = formatContextPercent(usage.percent);\n const title = `Context ${percentLabel} · ${formatTokenCount(usage.used)} / ${formatTokenCount(usage.limit)} tokens`;\n const ringValue = Math.min(100, Math.max(usage.percent, usage.used > 0 ? 1 : 0));\n\n return html`\n <wa-dropdown\n class=\"context-menu\"\n size=\"s\"\n placement=\"top-end\"\n distance=\"4\"\n >\n <wa-button\n slot=\"trigger\"\n appearance=\"plain\"\n size=\"s\"\n title=${title}\n >\n <wa-progress-ring\n class=\"context-ring\"\n style=${this.contextRingStyle(usage.level)}\n value=${ringValue}\n label=${title}\n ></wa-progress-ring>\n </wa-button>\n\n <div\n class=\"context-panel\"\n @click=${(e: Event) => e.stopPropagation()}\n @keydown=${(e: Event) => e.stopPropagation()}\n >\n <div class=\"context-header\">\n <strong>Context tokens</strong>\n <span>${percentLabel}</span>\n </div>\n <div class=\"context-bars\">\n ${usage.buckets.map((bucket) => {\n const share = usage.limit > 0 ? (bucket.tokens / usage.limit) * 100 : 0;\n return html`\n <div class=\"context-row\">\n <span class=\"context-row-label\">${bucket.label}</span>\n <span>${formatBucketDetail(bucket)}</span>\n <div class=\"context-meter\">\n <span\n style=\"width:${Math.max(share, bucket.tokens > 0 ? 0.5 : 0)}%; --bucket-color: var(--wa-color-brand-fill-normal)\"\n ></span>\n </div>\n </div>\n `;\n })}\n </div>\n <div class=\"context-footer\">\n <span class=\"context-remaining\">\n ~${formatTokenCount(usage.used)} used · ${formatTokenCount(usage.remaining)} free of\n ${formatTokenCount(usage.limit)}\n · ${shortModelLabel(usage.modelRef)}\n </span>\n <wa-button\n size=\"s\"\n variant=${usage.level === 'critical' ? 'danger' : 'neutral'}\n appearance=${canCompact ? 'filled' : 'outlined'}\n ?disabled=${!canCompact || this.busy}\n @click=${() => this.compactFocused()}\n >\n <wa-icon slot=\"start\" name=\"arrows-down-to-line\"></wa-icon>\n Compact conversation\n </wa-button>\n </div>\n </div>\n </wa-dropdown>\n `;\n }\n\n protected renderContent() {\n const session = this.focusedSession();\n return html`\n <div class=\"cognitive-shell\">\n <wa-scroller class=\"transcript\" orientation=\"vertical\">\n <div class=\"transcript-inner\">\n <div class=\"transcript-spacer\" aria-hidden=\"true\"></div>\n ${session ? this.renderTranscript(session) : nothing}\n </div>\n </wa-scroller>\n\n <div\n class=\"composer-shell ${this.dragOver ? 'drag-over' : ''}\"\n @dragover=${(e: DragEvent) => this.onComposerDragOver(e)}\n @dragleave=${(e: DragEvent) => this.onComposerDragLeave(e)}\n @drop=${(e: DragEvent) => void this.onComposerDrop(e)}\n >\n <input\n id=\"attach-file-input\"\n type=\"file\"\n multiple\n accept=${ATTACHMENT_FILE_ACCEPT}\n hidden\n @change=${(e: Event) => void this.onFileInputChange(e)}\n />\n <div class=\"composer\">\n <div class=\"composer-row\">\n <wa-textarea\n placeholder=${this.busy ? this.busyStatus : 'Enter your message here…'}\n size=\"s\"\n resize=\"auto\"\n rows=\"1\"\n .value=${this.busy ? this.busyStatus : this.draft}\n ?disabled=${this.busy}\n ?readonly=${this.busy}\n @input=${(e: Event) => {\n if (this.busy) return;\n this.draft = (e.target as HTMLTextAreaElement).value;\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (this.busy) {\n if (e.key === 'Escape') {\n e.preventDefault();\n this.cancelTurn();\n return;\n }\n e.preventDefault();\n return;\n }\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n void this.send();\n }\n }}\n ></wa-textarea>\n <div class=\"composer-actions\">\n ${this.busy\n ? html`\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n variant=\"danger\"\n title=\"Stop (Esc)\"\n @click=${() => this.cancelTurn()}\n >\n <wa-icon name=\"stop\" label=\"Stop\"></wa-icon>\n </wa-button>\n `\n : nothing}\n ${this.renderAttachmentDropdown()}\n ${this.renderContextDropdown()}\n </div>\n </div>\n </div>\n </div>\n ${this.renderAttachmentDialog()}\n ${this.renderToolDetailDialog()}\n </div>\n `;\n }\n\n private renderTranscript(session: CognitiveSession) {\n const showStreaming = this.streamingParts.length > 0;\n const showPermission =\n this.pendingPermission && this.pendingPermission.sessionId === session.id;\n\n return html`\n ${session.history.map((m) => this.renderMessage(m))}\n ${showStreaming\n ? this.renderAssistantMessage(\n {\n id: 'streaming',\n role: 'assistant',\n parts: this.streamingParts,\n createdAt: Date.now(),\n },\n { streaming: true },\n )\n : nothing}\n ${showPermission\n ? html`\n <wa-callout variant=\"warning\" appearance=\"outlined\">\n <wa-icon slot=\"icon\" name=\"shield-halved\"></wa-icon>\n Allow tool <code>${this.pendingPermission!.toolName}</code>?\n <pre class=\"args\">${JSON.stringify(this.pendingPermission!.args, null, 2)}</pre>\n <div class=\"approval-actions\">\n <wa-button size=\"s\" variant=\"success\" @click=${() => this.resolvePermission('allow')}>\n <wa-icon slot=\"start\" name=\"check\"></wa-icon>\n Allow\n </wa-button>\n <wa-button\n size=\"s\"\n variant=\"neutral\"\n appearance=\"outlined\"\n @click=${() => this.resolvePermission('deny')}\n >\n <wa-icon slot=\"start\" name=\"xmark\"></wa-icon>\n Deny\n </wa-button>\n </div>\n </wa-callout>\n `\n : nothing}\n `;\n }\n\n private renderHistoryDropdown() {\n const items = this.historySessions();\n const groups = groupSessionsByRecency(items);\n\n return html`\n <wa-dropdown\n class=\"history-menu\"\n size=\"s\"\n placement=\"bottom-end\"\n distance=\"4\"\n ?open=${this.historyOpen}\n @wa-after-show=${() => {\n this.historyOpen = true;\n }}\n @wa-after-hide=${() => {\n this.historyOpen = false;\n this.historyQuery = '';\n }}\n >\n <wa-button\n slot=\"trigger\"\n appearance=\"plain\"\n size=\"s\"\n with-caret\n title=\"Chat history\"\n @click=${(e: Event) => {\n e.stopPropagation();\n this.historyOpen = !this.historyOpen;\n }}\n >\n <wa-icon name=\"clock-rotate-left\" label=\"Chat history\"></wa-icon>\n </wa-button>\n\n <div\n class=\"history-search\"\n @click=${(e: Event) => e.stopPropagation()}\n @keydown=${(e: Event) => e.stopPropagation()}\n >\n <wa-input\n size=\"s\"\n clearable\n placeholder=\"Search chats…\"\n .value=${this.historyQuery}\n @input=${(e: Event) => {\n this.historyQuery = (e.target as HTMLInputElement).value;\n }}\n >\n <wa-icon slot=\"start\" name=\"magnifying-glass\"></wa-icon>\n </wa-input>\n </div>\n\n ${groups.length\n ? groups.map(\n (group) => html`\n <h3>${group.label}</h3>\n ${group.sessions.map(\n (s) => html`\n <wa-dropdown-item @click=${() => this.openSession(s.id)}>\n <wa-icon\n slot=\"icon\"\n name=${s.id === this.focusedId ? 'check' : 'message'}\n ></wa-icon>\n <span class=\"history-item-title\" title=${s.title}>${s.title}</span>\n <div slot=\"details\" style=\"display:flex;align-items:center;gap:0.25rem\">\n <span class=\"history-item-meta\">${relativeTime(s.updatedAt)}</span>\n <wa-button\n appearance=\"plain\"\n size=\"s\"\n title=\"Delete chat\"\n @click=${(e: Event) => {\n e.stopPropagation();\n this.deleteSession(s.id);\n }}\n >\n <wa-icon name=\"trash\" label=\"Delete chat\"></wa-icon>\n </wa-button>\n </div>\n </wa-dropdown-item>\n `,\n )}\n `,\n )\n : html`<div class=\"history-empty\">${this.historyQuery ? 'No matching chats' : 'No chats yet'}</div>`}\n </wa-dropdown>\n `;\n }\n\n private onSettingsSelect(value: string): void {\n if (value === 'settings') {\n void this.executeCommand(OPEN_AI_SETTINGS_COMMAND, {});\n return;\n }\n if (value.startsWith('approval:')) {\n const mode = value.slice('approval:'.length);\n if (mode === 'manual' || mode === 'auto_safe' || mode === 'auto_all') {\n this.approvalMode = mode;\n cognitiveRuntime.setApprovalMode(mode);\n }\n return;\n }\n if (value.startsWith('effort:')) {\n this.manualEffort = (value.slice(7) as EffortLevel | 'auto') || 'auto';\n this.applyPolicy();\n return;\n }\n this.onRouterSelect(value);\n }\n\n private renderSettingsDropdown() {\n const selected = this.routerValue();\n const autoOptions = [\n { value: 'auto:cost', label: 'Auto · Cost' },\n { value: 'auto:balance', label: 'Auto · Balance' },\n { value: 'auto:intelligence', label: 'Auto · Intelligence' },\n ];\n const effortOptions = this.effortChoices();\n\n return html`\n <wa-dropdown\n class=\"settings-menu\"\n size=\"s\"\n placement=\"bottom-end\"\n distance=\"4\"\n @wa-select=${(e: CustomEvent<{ item?: { value?: string } }>) => {\n const value = e.detail?.item?.value;\n if (value != null) this.onSettingsSelect(value);\n }}\n >\n <wa-button\n slot=\"trigger\"\n appearance=\"plain\"\n size=\"s\"\n with-caret\n title=${`AI · ${this.routerLabel()}`}\n >\n <wa-icon name=\"gear\" label=\"AI settings\"></wa-icon>\n </wa-button>\n\n <h3>Auto</h3>\n ${autoOptions.map(\n (option) => html`\n <wa-dropdown-item\n value=${option.value}\n type=\"checkbox\"\n .checked=${option.value === selected}\n >\n ${option.label}\n </wa-dropdown-item>\n `,\n )}\n\n <wa-divider></wa-divider>\n <h3>Models</h3>\n ${this.modelIds.length\n ? this.modelIds.map(\n (id) => html`\n <wa-dropdown-item\n value=${`model:${id}`}\n type=\"checkbox\"\n .checked=${selected === `model:${id}`}\n >\n ${id}\n </wa-dropdown-item>\n `,\n )\n : html`<wa-dropdown-item disabled>No models configured</wa-dropdown-item>`}\n\n ${this.policyMode === 'manual'\n ? html`\n <wa-divider></wa-divider>\n <h3>Effort</h3>\n ${effortOptions.map(\n (level) => html`\n <wa-dropdown-item\n value=${`effort:${level}`}\n type=\"checkbox\"\n .checked=${this.manualEffort === level}\n >\n ${level}\n </wa-dropdown-item>\n `,\n )}\n `\n : nothing}\n\n <wa-divider></wa-divider>\n <h3>Tool approvals</h3>\n ${APPROVAL_OPTIONS.map(\n (option) => html`\n <wa-dropdown-item\n value=${`approval:${option.value}`}\n type=\"checkbox\"\n .checked=${this.approvalMode === option.value}\n >\n ${option.label}\n </wa-dropdown-item>\n `,\n )}\n\n <wa-divider></wa-divider>\n <wa-dropdown-item value=\"settings\">\n <wa-icon slot=\"icon\" name=\"sliders\"></wa-icon>\n Settings…\n </wa-dropdown-item>\n </wa-dropdown>\n `;\n }\n\n private resolveAttachmentDataUrl(fileId: string): string | undefined {\n return this.focusedSession()?.attachments?.find((a) => a.id === fileId)?.dataUrl;\n }\n\n private renderMessage(message: ChatMessage) {\n if (message.role === 'user') {\n const files = message.parts.filter((p): p is Extract<MessagePart, { type: 'file' }> => p.type === 'file');\n const texts = message.parts.filter((p) => p.type === 'text');\n return html`\n <div class=\"msg user\">\n ${files.length\n ? html`\n <div class=\"msg-files\">\n ${files.map((file) => {\n const dataUrl =\n file.kind === 'image' ? this.resolveAttachmentDataUrl(file.id) : undefined;\n return dataUrl\n ? html`<img\n class=\"msg-file-thumb\"\n src=${dataUrl}\n alt=${file.name}\n title=${`${file.name} (${file.id})`}\n />`\n : html`\n <wa-tag\n size=\"s\"\n appearance=\"outlined\"\n title=${`${file.path || file.name} (${file.id})`}\n >\n <wa-icon slot=\"start\" name=${file.kind === 'image' ? 'image' : 'file'}></wa-icon>\n ${file.name}\n </wa-tag>\n `;\n })}\n </div>\n `\n : nothing}\n ${texts.map((p) => this.renderTextPart(p))}\n ${this.renderMessageMeta(message)}\n </div>\n `;\n }\n return this.renderAssistantMessage(message);\n }\n\n private renderAssistantMessage(message: ChatMessage, opts: { streaming?: boolean } = {}) {\n const { summaryText, techParts } = splitAssistantPresentation(message.parts);\n const open =\n opts.streaming === true ||\n techParts.some((p) => (p.type === 'reasoning' || p.type === 'tool') && p.status === 'streaming');\n\n const summaryBubble = summaryText.length\n ? summaryText.map((p) => this.renderTextPart(p))\n : html`<div class=\"bubble\">${technicalSummary(techParts)}</div>`;\n\n const summary = html`\n <div slot=\"summary\" class=\"msg-summary\">\n ${opts.streaming\n ? html`\n <div class=\"streaming-meta\">\n <wa-spinner style=\"font-size: 0.85rem\"></wa-spinner>\n <span>${this.busy ? this.busyStatus : 'streaming…'}</span>\n </div>\n `\n : nothing}\n ${summaryBubble}\n </div>\n `;\n\n if (!techParts.length) {\n return html`\n <div class=\"msg assistant\">\n ${opts.streaming\n ? html`\n <div class=\"streaming-meta\">\n <wa-spinner style=\"font-size: 0.85rem\"></wa-spinner>\n <span>${this.busy ? this.busyStatus : 'streaming…'}</span>\n </div>\n `\n : nothing}\n ${summaryBubble}\n ${message.id !== 'streaming' ? this.renderMessageMeta(message) : nothing}\n </div>\n `;\n }\n\n return html`\n <div class=\"msg assistant\">\n <wa-details class=\"msg-details\" appearance=\"plain\" ?open=${open}>\n ${summary}\n <div class=\"msg-tech\">${techParts.map((p) => this.renderTechnicalPart(p))}</div>\n </wa-details>\n ${message.id !== 'streaming' ? this.renderMessageMeta(message) : nothing}\n </div>\n `;\n }\n\n private renderMessageMeta(message: ChatMessage) {\n const timeLabel = formatMessageTime(message.createdAt);\n return html`\n <div class=\"msg-meta\">\n <wa-tag size=\"s\" appearance=\"outlined\" title=${new Date(message.createdAt).toLocaleString()}>\n ${timeLabel}\n </wa-tag>\n ${message.routedModel\n ? html`<wa-tag size=\"s\" appearance=\"outlined\">${message.routedModel}</wa-tag>`\n : nothing}\n ${message.effort\n ? html`<wa-tag size=\"s\" appearance=\"outlined\">${message.effort}</wa-tag>`\n : nothing}\n </div>\n `;\n }\n\n private renderTextPart(part: MessagePart) {\n if (part.type === 'text') return html`<div class=\"bubble\">${part.text}</div>`;\n return nothing;\n }\n\n private renderTechnicalPart(part: MessagePart) {\n if (part.type === 'reasoning') {\n return html`\n <div>\n <div class=\"tool-heading\">Thinking</div>\n <div class=\"bubble\">${part.text}</div>\n </div>\n `;\n }\n if (part.type === 'tool') {\n const heading = `${part.name} · ${part.status}${part.durationMs != null ? ` · ${part.durationMs}ms` : ''}`;\n const hasDetail = part.args != null || part.result != null || part.status === 'error';\n return html`\n <div class=\"tool-row\">\n <div class=\"tool-heading\">${heading}</div>\n ${hasDetail\n ? html`\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n variant=\"neutral\"\n @click=${() => this.openToolDetail(part)}\n >\n Details\n </wa-button>\n `\n : nothing}\n </div>\n `;\n }\n if (part.type === 'step') {\n return html`<div class=\"tool-heading\">Step: ${part.title} · ${part.status}</div>`;\n }\n return nothing;\n }\n}\n\nconst APPROVAL_OPTIONS: Array<{ value: ToolApprovalMode; label: string }> = [\n { value: 'auto_safe', label: 'Auto-approve non-critical' },\n { value: 'manual', label: 'Manual' },\n { value: 'auto_all', label: 'Approve all' },\n];\n\nfunction capitalize(value: string): string {\n return value ? value[0]!.toUpperCase() + value.slice(1) : value;\n}\n\n/**\n * Prefer text after the last tool/reasoning as the visible reply.\n * Interim narration stays out of the bubble — tool details cover the execution trail.\n */\nfunction splitAssistantPresentation(parts: MessagePart[]): {\n summaryText: Array<Extract<MessagePart, { type: 'text' }>>;\n techParts: MessagePart[];\n} {\n const techParts = parts.filter((p) => p.type !== 'text');\n let lastTechIndex = -1;\n for (let i = 0; i < parts.length; i++) {\n if (parts[i]!.type !== 'text') lastTechIndex = i;\n }\n\n if (lastTechIndex < 0) {\n return {\n summaryText: parts.filter((p): p is Extract<MessagePart, { type: 'text' }> => p.type === 'text'),\n techParts,\n };\n }\n\n const afterTools = parts\n .slice(lastTechIndex + 1)\n .filter((p): p is Extract<MessagePart, { type: 'text' }> => p.type === 'text')\n .filter((p) => p.text.trim());\n\n if (afterTools.length) {\n return { summaryText: afterTools, techParts };\n }\n\n // Tools ran but no trailing reply yet (streaming) — keep the bubble light.\n return { summaryText: [], techParts };\n}\n\nfunction technicalSummary(parts: MessagePart[]): string {\n const tools = parts.filter((p): p is Extract<MessagePart, { type: 'tool' }> => p.type === 'tool');\n const done = tools.filter((t) => t.status === 'done').length;\n const errors = tools.filter((t) => t.status === 'error').length;\n if (!tools.length) {\n if (parts.some((p) => p.type === 'reasoning')) return 'Thinking…';\n return 'Details';\n }\n if (errors && done) return `Finished with ${errors} issue${errors === 1 ? '' : 's'} (${done} ok).`;\n if (errors) return `Couldn't complete ${errors} step${errors === 1 ? '' : 's'}.`;\n if (tools.some((t) => t.status === 'running' || t.status === 'preparing')) {\n return 'Working…';\n }\n return done === 1 ? 'Done.' : `Done · ${done} steps.`;\n}\n\nfunction startOfDay(ts: number): number {\n const d = new Date(ts);\n d.setHours(0, 0, 0, 0);\n return d.getTime();\n}\n\nfunction groupSessionsByRecency(sessions: CognitiveSession[]): Array<{ label: string; sessions: CognitiveSession[] }> {\n const now = Date.now();\n const today = startOfDay(now);\n const yesterday = today - 86_400_000;\n const week = today - 7 * 86_400_000;\n const buckets: Record<'today' | 'yesterday' | 'week' | 'older', CognitiveSession[]> = {\n today: [],\n yesterday: [],\n week: [],\n older: [],\n };\n\n for (const s of sessions) {\n const day = startOfDay(s.updatedAt);\n if (day >= today) buckets.today.push(s);\n else if (day >= yesterday) buckets.yesterday.push(s);\n else if (day >= week) buckets.week.push(s);\n else buckets.older.push(s);\n }\n\n return (\n [\n { label: 'Today', sessions: buckets.today },\n { label: 'Yesterday', sessions: buckets.yesterday },\n { label: 'Previous 7 Days', sessions: buckets.week },\n { label: 'Older', sessions: buckets.older },\n ] as const\n ).filter((g) => g.sessions.length > 0);\n}\n\nfunction relativeTime(ts: number): string {\n const delta = Math.max(0, Date.now() - ts);\n const mins = Math.floor(delta / 60_000);\n if (mins < 1) return 'now';\n if (mins < 60) return `${mins}m`;\n const hours = Math.floor(mins / 60);\n if (hours < 24) return `${hours}h`;\n const days = Math.floor(hours / 24);\n if (days < 7) return `${days}d`;\n return new Date(ts).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n}\n\nfunction formatMessageTime(ts: number): string {\n const date = new Date(ts);\n const now = new Date();\n const sameDay =\n date.getFullYear() === now.getFullYear() &&\n date.getMonth() === now.getMonth() &&\n date.getDate() === now.getDate();\n const time = date.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });\n if (sameDay) return time;\n return `${date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })} ${time}`;\n}\n\nfunction shortModelLabel(modelRef: string): string {\n const slash = modelRef.indexOf('/');\n return slash === -1 ? modelRef : modelRef.slice(slash + 1);\n}\n\nfunction filesFromClipboard(data: DataTransfer | null): File[] {\n if (!data) return [];\n\n const fromFiles = [...(data.files ?? [])].filter((f) => f && f.size > 0);\n if (fromFiles.length) return fromFiles;\n\n const fromItems: File[] = [];\n for (const item of data.items ?? []) {\n if (item.kind !== 'file') continue;\n const file = item.getAsFile();\n if (!file || file.size <= 0) continue;\n fromItems.push(nameClipboardFile(file, item.type));\n }\n return fromItems;\n}\n\nfunction nameClipboardFile(file: File, mimeHint?: string): File {\n const mime = (file.type || mimeHint || 'application/octet-stream').toLowerCase();\n if (file.name && file.name !== 'image.png' && file.name !== 'blob') return file;\n const ext =\n mime === 'image/jpeg' || mime === 'image/jpg'\n ? 'jpg'\n : mime === 'image/png'\n ? 'png'\n : mime === 'image/gif'\n ? 'gif'\n : mime === 'image/webp'\n ? 'webp'\n : mime === 'image/svg+xml'\n ? 'svg'\n : mime.startsWith('image/')\n ? 'png'\n : 'bin';\n const name = `clipboard-${Date.now()}.${ext}`;\n return new File([file], name, { type: mime || file.type, lastModified: file.lastModified });\n}\n\nfunction mergePart(parts: MessagePart[], part: MessagePart): MessagePart[] {\n const next = [...parts];\n const last = next[next.length - 1];\n if (part.type === 'text' && last?.type === 'text') {\n next[next.length - 1] = { ...last, text: last.text + part.text };\n return next;\n }\n if (part.type === 'reasoning' && last?.type === 'reasoning') {\n next[next.length - 1] = { ...last, text: last.text + part.text, status: part.status };\n return next;\n }\n if (part.type === 'tool' && last?.type === 'tool' && last.id === part.id) {\n next[next.length - 1] = part;\n return next;\n }\n next.push(part);\n return next;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'docks-cognitive-view': DocksCognitiveView;\n }\n}\n","import '@eclipse-docks/core/externals/webawesome';\nimport {\n DocksPart,\n EditorInput,\n confirmDialog,\n toastError,\n toastInfo,\n} from '@eclipse-docks/core';\nimport { css, customElement, html, property, state } from '@eclipse-docks/core/externals/lit';\nimport {\n cognitiveRuntime,\n TOPIC,\n defaultProvidersSettings,\n fetchOpenAICompatibleModels,\n parseModelIds,\n} from '../runtime';\nimport type { ProviderConfig, ProvidersSettings, RemoteModelInfo, ToolApprovalMode } from '../runtime';\n\nconst APPROVAL_OPTIONS: Array<{ value: ToolApprovalMode; label: string; hint: string }> = [\n {\n value: 'auto_safe',\n label: 'Auto-approve non-critical',\n hint: 'The agent classifies each tool as safe or critical; only critical ones ask for approval',\n },\n { value: 'manual', label: 'Manual', hint: 'Confirm every tool before it runs' },\n { value: 'auto_all', label: 'Approve all', hint: 'Run every tool without asking' },\n];\n\n@customElement('docks-cognitive-settings-editor')\nexport class DocksCognitiveSettingsEditor extends DocksPart {\n @property({ attribute: false }) public input?: EditorInput;\n\n @state() private settings: ProvidersSettings = defaultProvidersSettings();\n @state() private approvalMode: ToolApprovalMode = 'auto_safe';\n @state() private availableModels: Record<number, RemoteModelInfo[]> = {};\n @state() private loadingModels: Record<number, boolean> = {};\n @state() private modelErrors: Record<number, string> = {};\n\n private unsubs: Array<() => void> = [];\n private fetchControllers = new Map<number, AbortController>();\n private fetchTimers = new Map<number, ReturnType<typeof setTimeout>>();\n private autoFetchedKeys = new Set<string>();\n\n protected doInitUI(): void {\n cognitiveRuntime.start();\n this.loadFromRuntime();\n this.unsubs.push(\n cognitiveRuntime.events.subscribe(TOPIC.providersChanged, () => {\n if (!this.isDirty()) this.loadFromRuntime();\n }),\n cognitiveRuntime.events.subscribe(TOPIC.approvalModeChanged, (mode) => {\n this.approvalMode = mode as ToolApprovalMode;\n }),\n );\n }\n\n disconnectedCallback(): void {\n for (const unsub of this.unsubs) unsub();\n this.unsubs = [];\n for (const timer of this.fetchTimers.values()) clearTimeout(timer);\n this.fetchTimers.clear();\n for (const controller of this.fetchControllers.values()) controller.abort();\n this.fetchControllers.clear();\n super.disconnectedCallback();\n }\n\n private loadFromRuntime(): void {\n this.settings = cognitiveRuntime.getProvidersSettings();\n this.approvalMode = cognitiveRuntime.getApprovalMode();\n this.availableModels = {};\n this.loadingModels = {};\n this.modelErrors = {};\n this.autoFetchedKeys.clear();\n this.markDirty(false);\n this.settings.providers.forEach((provider, index) => {\n if (provider.apiKey.trim() && provider.baseUrl.trim()) {\n void this.fetchModels(index, { auto: true });\n }\n });\n }\n\n private setApprovalMode(mode: ToolApprovalMode): void {\n this.approvalMode = mode;\n cognitiveRuntime.setApprovalMode(mode);\n }\n\n private touch(next: ProvidersSettings): void {\n this.settings = next;\n this.markDirty(true);\n }\n\n private updateProvider(index: number, patch: Partial<ProviderConfig>): void {\n const prev = this.settings.providers[index];\n const providers = this.settings.providers.map((p, i) => (i === index ? { ...p, ...patch } : p));\n let defaultProviderId = this.settings.defaultProviderId;\n if (patch.id && prev?.id === defaultProviderId) {\n defaultProviderId = patch.id;\n }\n this.touch({ ...this.settings, defaultProviderId, providers });\n\n if (patch.apiKey !== undefined || patch.baseUrl !== undefined) {\n const next = providers[index];\n if (next?.apiKey.trim() && next.baseUrl.trim()) {\n this.scheduleFetchModels(index);\n } else if (!next?.apiKey.trim()) {\n this.clearModels(index);\n }\n }\n }\n\n private clearModels(index: number): void {\n this.fetchTimers.get(index) && clearTimeout(this.fetchTimers.get(index)!);\n this.fetchTimers.delete(index);\n this.fetchControllers.get(index)?.abort();\n this.fetchControllers.delete(index);\n const { [index]: _a, ...available } = this.availableModels;\n const { [index]: _b, ...loading } = this.loadingModels;\n const { [index]: _c, ...errors } = this.modelErrors;\n this.availableModels = available;\n this.loadingModels = loading;\n this.modelErrors = errors;\n }\n\n private scheduleFetchModels(index: number): void {\n const existing = this.fetchTimers.get(index);\n if (existing) clearTimeout(existing);\n this.fetchTimers.set(\n index,\n setTimeout(() => {\n this.fetchTimers.delete(index);\n void this.fetchModels(index, { auto: true });\n }, 400),\n );\n }\n\n private async fetchModels(index: number, opts: { auto?: boolean } = {}): Promise<void> {\n const provider = this.settings.providers[index];\n if (!provider?.baseUrl.trim()) {\n toastError('Set a base URL before fetching models');\n return;\n }\n if (opts.auto && !provider.apiKey.trim()) return;\n\n const fingerprint = `${provider.baseUrl}|${provider.apiKey}`;\n if (opts.auto && this.autoFetchedKeys.has(fingerprint) && this.availableModels[index]?.length) {\n return;\n }\n\n this.fetchControllers.get(index)?.abort();\n const controller = new AbortController();\n this.fetchControllers.set(index, controller);\n this.loadingModels = { ...this.loadingModels, [index]: true };\n this.modelErrors = { ...this.modelErrors, [index]: '' };\n\n try {\n const models = await fetchOpenAICompatibleModels(\n provider.baseUrl,\n provider.apiKey || undefined,\n controller.signal,\n );\n if (controller.signal.aborted) return;\n this.availableModels = { ...this.availableModels, [index]: models };\n this.autoFetchedKeys.add(fingerprint);\n if (!opts.auto) toastInfo(`Loaded ${models.length} models`);\n } catch (err) {\n if (controller.signal.aborted) return;\n const message = err instanceof Error ? err.message : String(err);\n this.modelErrors = { ...this.modelErrors, [index]: message };\n this.availableModels = { ...this.availableModels, [index]: [] };\n if (!opts.auto) toastError(message);\n } finally {\n if (this.fetchControllers.get(index) === controller) {\n this.fetchControllers.delete(index);\n this.loadingModels = { ...this.loadingModels, [index]: false };\n }\n }\n }\n\n private onModelsSelect(index: number, e: Event): void {\n const target = e.target as HTMLSelectElement & { value: string | string[] };\n const value = target.value;\n const selected = Array.isArray(value) ? value : value ? [value] : [];\n this.updateProvider(index, { models: selected.join(',') });\n }\n\n private addProvider(): void {\n const id = uniqueProviderId(this.settings.providers);\n this.touch({\n ...this.settings,\n providers: [\n ...this.settings.providers,\n { id, baseUrl: '', apiKey: '', models: '', enabled: true },\n ],\n defaultProviderId: this.settings.defaultProviderId || id,\n });\n }\n\n private async deleteProvider(index: number): Promise<void> {\n const provider = this.settings.providers[index];\n if (!provider) return;\n if (!(await confirmDialog(`Delete provider \"${provider.id || '(unnamed)'}\"?`))) return;\n this.clearModels(index);\n const providers = this.settings.providers.filter((_, i) => i !== index);\n const defaultProviderId =\n this.settings.defaultProviderId === provider.id\n ? (providers.find((p) => p.enabled)?.id ?? '')\n : this.settings.defaultProviderId;\n this.touch({ providers, defaultProviderId });\n this.reindexModelState(index);\n }\n\n /** Shift per-row model fetch state after a row is removed. */\n private reindexModelState(removed: number): void {\n const remap = <T,>(src: Record<number, T>): Record<number, T> => {\n const next: Record<number, T> = {};\n for (const [key, value] of Object.entries(src)) {\n const i = Number(key);\n if (Number.isNaN(i) || i === removed) continue;\n next[i > removed ? i - 1 : i] = value;\n }\n return next;\n };\n this.availableModels = remap(this.availableModels);\n this.loadingModels = remap(this.loadingModels);\n this.modelErrors = remap(this.modelErrors);\n }\n\n private setDefault(id: string): void {\n this.touch({ ...this.settings, defaultProviderId: id });\n }\n\n override async save(): Promise<void> {\n if (!this.isDirty()) return;\n try {\n await cognitiveRuntime.setProvidersSettings(this.settings);\n this.loadFromRuntime();\n toastInfo('AI providers saved');\n } catch (err) {\n toastError(err instanceof Error ? err.message : String(err));\n }\n }\n\n protected renderContent() {\n const rows = this.settings.providers;\n return html`\n <div class=\"editor\">\n <section class=\"section\">\n <header class=\"header\">\n <div>\n <h2>AI Providers</h2>\n <p class=\"hint\">OpenAI-compatible endpoints. Edit cells in place, then save from the toolbar.</p>\n </div>\n <wa-button size=\"s\" variant=\"brand\" appearance=\"filled\" @click=${() => this.addProvider()}>\n <wa-icon slot=\"start\" name=\"plus\"></wa-icon>\n Add provider\n </wa-button>\n </header>\n\n ${rows.length === 0\n ? html`<wa-callout variant=\"neutral\" appearance=\"outlined\">No providers configured.</wa-callout>`\n : html`\n <div class=\"table-wrap\">\n <table class=\"providers\">\n <thead>\n <tr>\n <th class=\"col-on\">On</th>\n <th class=\"col-id\">ID</th>\n <th class=\"col-url\">Base URL</th>\n <th class=\"col-key\">API Key</th>\n <th class=\"col-models\">Models</th>\n <th class=\"col-default\">Default</th>\n <th class=\"col-actions\"></th>\n </tr>\n </thead>\n <tbody>\n ${rows.map((provider, index) => this.renderRow(provider, index))}\n </tbody>\n </table>\n </div>\n `}\n\n <wa-callout variant=\"neutral\" appearance=\"plain\" size=\"s\">\n <wa-icon slot=\"icon\" name=\"circle-info\"></wa-icon>\n Enter an API key to load available models. Catalog ids become\n <code>providerId/modelId</code> for Auto routing.\n </wa-callout>\n </section>\n\n <section class=\"section\">\n <header class=\"header\">\n <div>\n <h2>Tool approvals</h2>\n <p class=\"hint\">How the agent handles tool confirmation — same options as GitHub Copilot.</p>\n </div>\n </header>\n <wa-radio-group\n name=\"approval-mode\"\n label=\"Approval mode\"\n orientation=\"vertical\"\n .value=${this.approvalMode}\n @change=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value;\n if (value === 'manual' || value === 'auto_safe' || value === 'auto_all') {\n this.setApprovalMode(value);\n }\n }}\n >\n ${APPROVAL_OPTIONS.map(\n (option) => html`\n <wa-radio value=${option.value}>\n <span class=\"approval-option\">\n <span class=\"approval-label\">${option.label}</span>\n <span class=\"approval-hint\">${option.hint}</span>\n </span>\n </wa-radio>\n `,\n )}\n </wa-radio-group>\n </section>\n </div>\n `;\n }\n\n private renderRow(provider: ProviderConfig, index: number) {\n const isDefault = this.settings.defaultProviderId === provider.id;\n return html`\n <tr class=${isDefault ? 'is-default' : ''}>\n <td>\n <wa-checkbox\n ?checked=${provider.enabled}\n @change=${(e: Event) =>\n this.updateProvider(index, { enabled: (e.target as HTMLInputElement).checked })}\n ></wa-checkbox>\n </td>\n <td>\n <wa-input\n size=\"s\"\n .value=${provider.id}\n placeholder=\"openai\"\n @input=${(e: Event) => this.updateProvider(index, { id: (e.target as HTMLInputElement).value })}\n ></wa-input>\n </td>\n <td>\n <wa-input\n size=\"s\"\n .value=${provider.baseUrl}\n placeholder=\"https://api.openai.com/v1\"\n @input=${(e: Event) =>\n this.updateProvider(index, { baseUrl: (e.target as HTMLInputElement).value })}\n ></wa-input>\n </td>\n <td>\n <wa-input\n size=\"s\"\n type=\"password\"\n password-toggle\n .value=${provider.apiKey}\n placeholder=\"optional\"\n @input=${(e: Event) =>\n this.updateProvider(index, { apiKey: (e.target as HTMLInputElement).value })}\n ></wa-input>\n </td>\n <td>${this.renderModelsCell(provider, index)}</td>\n <td class=\"col-default\">\n ${isDefault\n ? html`<wa-tag size=\"s\" variant=\"brand\" pill>Default</wa-tag>`\n : html`\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n ?disabled=${!provider.id}\n @click=${() => this.setDefault(provider.id)}\n >\n Set\n </wa-button>\n `}\n </td>\n <td class=\"col-actions\">\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n variant=\"danger\"\n title=\"Delete\"\n @click=${() => void this.deleteProvider(index)}\n >\n <wa-icon name=\"trash\" label=\"Delete\"></wa-icon>\n </wa-button>\n </td>\n </tr>\n `;\n }\n\n private renderModelsCell(provider: ProviderConfig, index: number) {\n const hasKey = Boolean(provider.apiKey.trim());\n const remote = this.availableModels[index] ?? [];\n const loading = Boolean(this.loadingModels[index]);\n const error = this.modelErrors[index];\n const selected = parseModelIds(provider.models);\n const showPicker = hasKey || remote.length > 0;\n\n if (!showPicker) {\n return html`\n <div class=\"models-cell\">\n <wa-input\n size=\"s\"\n .value=${provider.models}\n placeholder=\"gpt-4o-mini,gpt-4o\"\n @input=${(e: Event) =>\n this.updateProvider(index, { models: (e.target as HTMLInputElement).value })}\n ></wa-input>\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n title=\"Fetch models\"\n ?disabled=${!provider.baseUrl.trim() || loading}\n ?loading=${loading}\n @click=${() => void this.fetchModels(index)}\n >\n <wa-icon name=\"arrows-rotate\" label=\"Reload models\"></wa-icon>\n </wa-button>\n </div>\n `;\n }\n\n return html`\n <div class=\"models-cell\">\n <wa-select\n size=\"s\"\n multiple\n with-clear\n placeholder=${loading ? 'Loading models…' : 'Select models'}\n .value=${selected}\n ?disabled=${loading && remote.length === 0}\n @change=${(e: Event) => this.onModelsSelect(index, e)}\n >\n ${remote.map(\n (m) => html`<wa-option value=${m.id}>${m.name === m.id ? m.id : `${m.name} (${m.id})`}</wa-option>`,\n )}\n ${selected\n .filter((id) => !remote.some((m) => m.id === id))\n .map((id) => html`<wa-option value=${id}>${id}</wa-option>`)}\n </wa-select>\n <wa-button\n size=\"s\"\n appearance=\"plain\"\n title=\"Reload models\"\n ?disabled=${!provider.baseUrl.trim() || loading}\n ?loading=${loading}\n @click=${() => void this.fetchModels(index)}\n >\n <wa-icon name=\"arrows-rotate\" label=\"Reload models\"></wa-icon>\n </wa-button>\n </div>\n ${error ? html`<div class=\"models-error\">${error}</div>` : ''}\n `;\n }\n\n static styles = css`\n :host {\n display: block;\n height: 100%;\n }\n\n .editor {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-2xl);\n padding: var(--wa-space-l);\n min-width: 0;\n }\n\n .section {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-l);\n min-width: 0;\n }\n\n .header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: var(--wa-space-m);\n flex-wrap: wrap;\n }\n\n .header h2 {\n margin: 0;\n font-size: var(--wa-font-size-l);\n }\n\n wa-radio-group {\n max-width: 36rem;\n }\n\n .approval-option {\n display: flex;\n flex-direction: column;\n gap: var(--wa-space-3xs);\n padding-block: var(--wa-space-3xs);\n }\n\n .approval-label {\n font-weight: 500;\n }\n\n .approval-hint {\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-s);\n }\n\n .hint {\n margin: var(--wa-space-2xs) 0 0;\n color: var(--wa-color-text-quiet);\n font-size: var(--wa-font-size-s);\n }\n\n .table-wrap {\n overflow: auto;\n border: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n border-radius: var(--wa-border-radius-m);\n }\n\n table.providers {\n width: 100%;\n border-collapse: collapse;\n min-width: 56rem;\n }\n\n th,\n td {\n padding: var(--wa-space-2xs) var(--wa-space-s);\n border-bottom: var(--wa-border-width-s) solid var(--wa-color-border-normal);\n text-align: left;\n vertical-align: middle;\n }\n\n th {\n font-size: var(--wa-font-size-xs);\n font-weight: 600;\n color: var(--wa-color-text-quiet);\n background: var(--wa-color-surface-lowered);\n white-space: nowrap;\n }\n\n tr.is-default td {\n background: color-mix(in srgb, var(--wa-color-brand-fill-normal) 8%, transparent);\n }\n\n tbody tr:last-child td {\n border-bottom: none;\n }\n\n .col-on {\n width: 2.5rem;\n }\n\n .col-id {\n width: 8rem;\n }\n\n .col-key {\n width: 11rem;\n }\n\n .col-models {\n min-width: 16rem;\n }\n\n .col-default {\n width: 5.5rem;\n white-space: nowrap;\n }\n\n .col-actions {\n width: 2.75rem;\n text-align: end;\n }\n\n td wa-input {\n width: 100%;\n }\n\n .models-cell {\n display: flex;\n gap: var(--wa-space-2xs);\n align-items: flex-start;\n min-width: 14rem;\n }\n\n .models-cell wa-input,\n .models-cell wa-select {\n flex: 1;\n min-width: 0;\n }\n\n .models-error {\n margin-top: var(--wa-space-3xs);\n color: var(--wa-color-danger-on-quiet);\n font-size: var(--wa-font-size-xs);\n }\n\n code {\n font-family: var(--wa-font-family-code, var(--wa-font-mono));\n font-size: 0.9em;\n }\n `;\n}\n\nfunction uniqueProviderId(existing: ProviderConfig[]): string {\n const used = new Set(existing.map((p) => p.id));\n if (!used.has('provider')) return 'provider';\n let n = 2;\n while (used.has(`provider-${n}`)) n += 1;\n return `provider-${n}`;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'docks-cognitive-settings-editor': DocksCognitiveSettingsEditor;\n }\n}\n","import {\n contributionRegistry,\n editorRegistry,\n registerAll,\n rootContext,\n SIDEBAR_AUXILIARY,\n type EditorInput,\n} from '@eclipse-docks/core';\nimport { html } from '@eclipse-docks/core/externals/lit';\nimport {\n AI_SETTINGS_EDITOR_ID,\n AI_SETTINGS_KEY,\n AI_VIEW_NAME,\n OPEN_AI_SETTINGS_COMMAND,\n cognitiveRuntime,\n} from './runtime';\nimport './view/cognitive-view';\nimport './view/cognitive-settings-editor';\n\ncognitiveRuntime.start();\nrootContext.put('cognitiveRuntime', cognitiveRuntime);\n\ncontributionRegistry.registerContribution(SIDEBAR_AUXILIARY, {\n name: AI_VIEW_NAME,\n label: 'AI',\n icon: 'robot',\n editorId: AI_VIEW_NAME,\n component: (id: string) => html`<docks-cognitive-view id=\"${id}\"></docks-cognitive-view>`,\n});\n\neditorRegistry.registerEditorInputHandler({\n editorId: AI_SETTINGS_EDITOR_ID,\n label: 'AI Settings',\n ranking: 1000,\n canHandle: (input: EditorInput) => input.key === AI_SETTINGS_KEY,\n handle: async (input: EditorInput) => {\n input.component = (id: string) =>\n html`<docks-cognitive-settings-editor id=\"${id}\" .input=${input}></docks-cognitive-settings-editor>`;\n return input;\n },\n});\n\nregisterAll({\n command: {\n id: OPEN_AI_SETTINGS_COMMAND,\n name: 'Open AI Settings',\n description: 'Configure AI model providers',\n parameters: [],\n },\n handler: {\n execute: () => {\n const editorInput = {\n title: 'AI Settings',\n data: {},\n key: AI_SETTINGS_KEY,\n icon: 'gear',\n state: {},\n } as EditorInput;\n void editorRegistry.loadEditor(editorInput);\n },\n },\n});\n"],"mappings":";;;;;;;AACA,IAAa,sBAAsB;;;;;AAMnC,IAAa,uBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAM,gBAAgB;;AAItB,SAAgB,qBAA6B;CAC3C,OAAO,gBAAgB,KAAK,MAAM,KAAK,OAAO,IAAK,IAAkC;AACvF;;AAGA,SAAgB,eAAe,SAAyB;CACtD,MAAM,OAAO,qBAAqB,QAAQ,MAAM,MAAM,OAAO;CAC7D,IAAI,CAAC,KAAK,QAAQ,OAAO;CACzB,OAAO,KAAK,KAAK,MAAM,KAAK,OAAO,IAAI,KAAK,MAAM;AACpD;;;ACEO,IAAM,qBAAN,MAAM,2BAA2B,UAAU;;;EACO,KAAA,aAAA;EA8e1B,KAAA,qBAAA;EAEmB,KAAA,WAAA,CAAC;EACL,KAAA,YAAA;EACnB,KAAA,QAAA;EAEyB,KAAA,uBAAA,CAAC;EACvB,KAAA,WAAA;EAC0B,KAAA,sBAAA;EACuB,KAAA,aAAA;EACrD,KAAA,OAAA;EACM,KAAA,aAAA;EACiC,KAAA,oBAAA;EACd,KAAA,aAAA;EACmB,KAAA,cAAA;EACrC,KAAA,cAAA;EACuB,KAAA,eAAA;EACJ,KAAA,eAAA;EACZ,KAAA,WAAA,CAAC;EACU,KAAA,iBAAA,CAAC;EACnB,KAAA,cAAA;EACC,KAAA,eAAA;EACI,KAAA,SAAA,CAAC;EAGc,KAAA,mBAAA;EACrB,KAAA,sBAAA,MAAa,KAAK,KAAK,gBAAgB,CAAmB;EAC5D,KAAA,oBAAA,MAAqB;GAC/C,IAAI,CAAC,KAAK,QAAQ,EAAE,QAAQ,UAAU;GACtC,EAAE,eAAe;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eAAe;EACb,MAAM,cAAc;GAClB,OAAO;GACP,MAAM,CAAC;GACP,KAAK;GACL,MAAM;GACN,OAAO,CAAC;EACV;EACA,eAAoB,WAAW,WAAW;CAC5C,EACF;AACF,CAAC"}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ extensionRegistry.registerExtension({
9
9
  id: pkg.name,
10
10
  name: t.EXT_COGNITIVE_NAME,
11
11
  description: t.EXT_COGNITIVE_DESC,
12
- loader: () => import("./cognitive-extension-CG_d39K5.js"),
12
+ loader: () => import("./cognitive-extension-7_ZMUCGD.js"),
13
13
  icon: "robot"
14
14
  });
15
15
  //#endregion
@@ -0,0 +1,5 @@
1
+ /** True when an AbortSignal has already been aborted. */
2
+ export declare function isAborted(signal?: AbortSignal | null): boolean;
3
+ /** True for DOMException / Error abort failures from fetch and friends. */
4
+ export declare function isAbortError(err: unknown): boolean;
5
+ //# sourceMappingURL=abort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../src/runtime/abort.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAE9D;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIlD"}
@@ -0,0 +1,17 @@
1
+ import { SessionAttachment } from './types';
2
+ /** Mirrors core `IN_MEMORY_ROOT_NAME` without importing the filesys graph. */
3
+ export declare const IN_MEMORY_ROOT_NAME = "in-memory";
4
+ /** URI scheme for UI references (`in-memory://<sessionId>/<file>`). */
5
+ export declare const IN_MEMORY_URI_SCHEME = "in-memory://";
6
+ /** Sanitize a single path segment (no slashes). Prefer id-prefixed names for uniqueness. */
7
+ export declare function safeAttachmentFileName(name: string, id: string): string;
8
+ /** Workspace path used by workspace_* tools (no protocol). */
9
+ export declare function attachmentWorkspacePath(sessionId: string, stored: Pick<SessionAttachment, 'id' | 'name'>): string;
10
+ /** UI / catalog URI form (`in-memory://<sessionId>/<file>`). */
11
+ export declare function attachmentUri(sessionId: string, stored: Pick<SessionAttachment, 'id' | 'name'>): string;
12
+ /**
13
+ * Map `in-memory://…` references to composite workspace paths.
14
+ * Real workspace paths are returned unchanged.
15
+ */
16
+ export declare function toWorkspaceToolPath(path: string): string;
17
+ //# sourceMappingURL=attachment-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-paths.d.ts","sourceRoot":"","sources":["../../src/runtime/attachment-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD,4FAA4F;AAC5F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED,8DAA8D;AAC9D,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,MAAM,CAAC,GAC7C,MAAM,CAER;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,MAAM,CAAC,GAC7C,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWxD"}
@@ -1,18 +1,18 @@
1
1
  import { MessagePart, PromptAttachment, SessionAttachment } from './types';
2
2
  import { ProviderContent } from './models/types';
3
- /** Soft cap per attached text file when stored / returned by attachment_read. */
3
+ /** Soft cap per attached text file when stored / returned via workspace_read. */
4
4
  export declare const MAX_ATTACHMENT_CHARS = 100000;
5
5
  /** Soft cap for visual media attachments (bytes). */
6
6
  export declare const MAX_IMAGE_BYTES = 4000000;
7
7
  /** Max files accepted on a single user turn. */
8
8
  export declare const MAX_ATTACHMENTS = 8;
9
- /** Default max characters returned by attachment_read for text. */
9
+ /** Default max characters returned when reading text attachments. */
10
10
  export declare const DEFAULT_READ_CHARS = 40000;
11
11
  type MediaMode = 'raster' | 'svg';
12
12
  interface MediaType {
13
13
  mime: string;
14
14
  mode: MediaMode;
15
- /** Prefer presenting bytes to vision models on attachment_read. */
15
+ /** Prefer presenting bytes to vision models on workspace_read. */
16
16
  vision: boolean;
17
17
  }
18
18
  /** File picker `accept` list for visual media + common text sources. */
@@ -30,7 +30,7 @@ export declare function toSessionAttachment(attachment: PromptAttachment, opts?:
30
30
  id?: string;
31
31
  messageId?: string;
32
32
  }): SessionAttachment;
33
- /** Lightweight history/UI reference — no payload. */
33
+ /** Lightweight history/UI reference — no payload (path is an in-memory workspace path/URI). */
34
34
  export declare function toFileRefPart(stored: SessionAttachment): Extract<MessagePart, {
35
35
  type: 'file';
36
36
  }>;
@@ -40,7 +40,7 @@ export declare function formatAttachmentRefForModel(part: Extract<MessagePart, {
40
40
  }>): string;
41
41
  /**
42
42
  * Build provider user content from history parts.
43
- * File parts are references only — payloads stay in the session store.
43
+ * File parts are references only — payloads live under the in-memory workspace root.
44
44
  */
45
45
  export declare function userContentFromParts(parts: MessagePart[]): ProviderContent;
46
46
  export declare function attachmentMeta(stored: SessionAttachment): {
@@ -1 +1 @@
1
- {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/runtime/attachments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,SAAU,CAAC;AAE5C,qDAAqD;AACrD,eAAO,MAAM,eAAe,UAAY,CAAC;AAEzC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AE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAiC9E;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAMlE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAA;CAAE,GAC1C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA0BjC,mFAAmF;AACnF,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA4G5F"}
@@ -48,10 +48,12 @@ export declare class CognitiveRuntime {
48
48
  commitSessions(): void;
49
49
  /** Ensure a focused session exists and return its id. */
50
50
  ensureSessionId(sessionId?: string): string;
51
- /** Store attachment payloads on the session (not inlined into history until prompt). */
52
- addAttachments(sessionId: string | undefined, attachments: PromptAttachment[]): SessionAttachment[];
53
- /** Remove an attachment payload from the session store. */
51
+ /** Store attachment payloads on the session and mirror them into in-memory/<sessionId>/. */
52
+ addAttachments(sessionId: string | undefined, attachments: PromptAttachment[]): Promise<SessionAttachment[]>;
53
+ /** Remove an attachment payload from the session store and in-memory workspace. */
54
54
  removeAttachment(sessionId: string, attachmentId: string): boolean;
55
+ /** Drop a session and its in-memory attachment folder. */
56
+ removeSession(sessionId: string): boolean;
55
57
  /**
56
58
  * Compact a session: drop older turns, store a summary (LLM when possible),
57
59
  * and persist. The summary is injected into later model calls.
@@ -73,6 +75,8 @@ export declare class CognitiveRuntime {
73
75
  private rebuildCatalog;
74
76
  private requestPermission;
75
77
  private emitSessions;
78
+ /** Live in-memory file refs that resolve payloads from the session store. */
79
+ private mirrorAttachments;
76
80
  private hydrateAll;
77
81
  private hydrateProviders;
78
82
  private persistProviders;
@@ -1 +1 @@
1
- {"version":3,"file":"cognitive-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/cognitive-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,WAAW,EAEX,gBAAgB,EAQjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAqB,aAAa,EAAE,iBAAiB,EAAgB,MAAM,UAAU,CAAC;AAClG,OAAO,EACL,UAAU,EAIX,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAS,MAAM,UAAU,CAAC;AAShD,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,MAAM,gBAAuB;IACtC,QAAQ,CAAC,QAAQ,iBAAwB;IACzC,QAAQ,CAAC,MAAM,kBAAyB;IACxC,QAAQ,CAAC,SAAS,mBAA0B;IAC5C,QAAQ,CAAC,MAAM,cAAqB;IACpC,QAAQ,CAAC,KAAK,aAAoB;IAElC,OAAO,CAAC,IAAI,CAAmC;IAC/C,OAAO,CAAC,MAAM,CAAyD;IACvE,OAAO,CAAC,iBAAiB,CAAiD;IAC1E,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,mBAAmB,CAAyD;IACpF,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAoC;IAEjD,KAAK,IAAI,IAAI;IAgB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
10
  export * from './compact/compaction';
11
11
  export * from './context/usage';
12
12
  export * from './attachments';
13
+ export * from './attachment-paths';
14
+ export * from './session-workspace';
13
15
  export * from './cognitive-runtime';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"openai-compatible.d.ts","sourceRoot":"","sources":["../../../src/runtime/models/openai-compatible.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQ7F,mEAAmE;AACnE,wBAAgB,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 import { MemoryLiveContents } from '@eclipse-docks/core';
2
+ import { SessionAttachment } from './types';
3
+ export { IN_MEMORY_ROOT_NAME, IN_MEMORY_URI_SCHEME, attachmentUri, attachmentWorkspacePath, safeAttachmentFileName, toWorkspaceToolPath, } from './attachment-paths';
4
+ /** Resolve the current attachment payload (session store remains source of truth). */
5
+ export type AttachmentPayloadResolver = () => SessionAttachment | undefined;
6
+ /** Build live-file callbacks that always re-read via the caller-provided resolver. */
7
+ export declare function attachmentLiveContents(resolve: AttachmentPayloadResolver): MemoryLiveContents;
8
+ /**
9
+ * Publish a live file node. Payload is resolved only through `resolve` — nothing is copied.
10
+ */
11
+ export declare function syncAttachmentToWorkspace(sessionId: string, stored: SessionAttachment, resolve: AttachmentPayloadResolver): Promise<string>;
12
+ export declare function syncAttachmentsToWorkspace(sessionId: string, attachments: SessionAttachment[], resolveById: (attachmentId: string) => SessionAttachment | undefined): Promise<void>;
13
+ export declare function removeAttachmentFromWorkspace(sessionId: string, stored: Pick<SessionAttachment, 'id' | 'name'>): Promise<void>;
14
+ export declare function removeSessionWorkspaceFolder(sessionId: string): Promise<void>;
15
+ /**
16
+ * Restrict the workspace-mounted in-memory view to a single folder name (active session).
17
+ * Pass `null` to show the full tree again.
18
+ */
19
+ export declare function projectInMemoryMountToFolder(folderName: string | null): void;
20
+ //# sourceMappingURL=session-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-workspace.d.ts","sourceRoot":"","sources":["../../src/runtime/session-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,sFAAsF;AACtF,MAAM,MAAM,yBAAyB,GAAG,MA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,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,MAAM,CAiBR"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/specialists/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG,CACjC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,KAC3D,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9B,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,MAAM,CA4BR"}
@@ -1 +1 @@
1
- {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/runtime/specialists/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AACzG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWlD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACx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C;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AASD,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,WAAW,EAAE,EACtB,iBAAiB,CAAC,EAAE,MAAM,GACzB,mBAAmB,EAAE,CA6CvB;AAED,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA6MjG"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/command-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAgB/C,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAsDlF"}
1
+ {"version":3,"file":"command-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/command-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AA+B/C,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CA4DlF"}
@@ -1,5 +1,4 @@
1
1
  export * from './broker';
2
2
  export * from './workspace-adapter';
3
3
  export * from './command-adapter';
4
- export * from './attachment-adapter';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { ToolBroker } from './broker';
2
- /** Registers built-in workspace file tools on the broker. */
2
+ /** Registers built-in workspace file tools (paths may use in-memory:// URI form). */
3
3
  export declare function registerWorkspaceTools(broker: ToolBroker): void;
4
4
  //# sourceMappingURL=workspace-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/workspace-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAoG/D"}
1
+ {"version":3,"file":"workspace-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/workspace-adapter.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA8F3C,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CA0M/D"}
@@ -0,0 +1,22 @@
1
+ export type RootQualificationDecision = {
2
+ action: 'keep';
3
+ } | {
4
+ action: 'prefix';
5
+ root: string;
6
+ } | {
7
+ action: 'pick';
8
+ } | {
9
+ action: 'error';
10
+ error: string;
11
+ };
12
+ export declare function isInMemoryToolPath(path: string): boolean;
13
+ export declare function isWorkspaceRootPath(path: string): boolean;
14
+ /** First path segment — composite roots are keyed by this name. */
15
+ export declare function firstPathSegment(path: string): string;
16
+ export declare function pathHasKnownRoot(path: string, rootNames: Iterable<string>): boolean;
17
+ export declare function joinUnderRoot(rootPath: string, relativePath: string): string;
18
+ /**
19
+ * Decide how to qualify a workspace tool path that is missing a connected-root prefix.
20
+ */
21
+ export declare function decideRootQualification(path: string, durableRoots: string[], mode: 'write' | 'read'): RootQualificationDecision;
22
+ //# sourceMappingURL=workspace-path-qualify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-path-qualify.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/workspace-path-qualify.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,yBAAyB,GACjC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAKnF;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EAAE,EACtB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,yBAAyB,CA0B3B"}
@@ -0,0 +1,17 @@
1
+ export type QualifyPathResult = {
2
+ ok: true;
3
+ path: string;
4
+ resolvedFrom?: string;
5
+ } | {
6
+ ok: false;
7
+ error: string;
8
+ };
9
+ export { decideRootQualification, joinUnderRoot, pathHasKnownRoot, } from './workspace-path-qualify';
10
+ /**
11
+ * Ensure tool paths are under a composite workspace root.
12
+ * - Already rooted / in-memory / empty → unchanged
13
+ * - One durable root → auto-prefix
14
+ * - Several durable roots (writes) → folder picker dialog
15
+ */
16
+ export declare function qualifyWorkspaceToolPath(rawPath: string, mode?: 'write' | 'read'): Promise<QualifyPathResult>;
17
+ //# sourceMappingURL=workspace-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-path.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/workspace-path.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,OAAO,GAAG,MAAgB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CA2B5B"}