@nelsonlongxiang/dsh-prompt-templates 0.2.10 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["css","IconSendOutline16","IconGlobeOutline14","IconEditOutline16","IconTrashOutline16","IconPlusOutline16","css","#actions","#pendingAutoOpen","#sessions","#conversation","#require","#inputOf"],"sources":["client/api.js","client/Panel.js","client/PanelButton.js","client/store.js","client/service.js","client/locales.js","client/index.js"],"sourcesContent":["/**\n * Browser-side API over the host's `/plugins/dsh-prompt-templates` routes.\n * One fetch helper per verb; every response settles into the same\n * `{ ok: true; value } | { ok: false; error }` envelope the panel face\n * consumes, so callers never see transport details.\n */\nconst BASE = '/plugins/dsh-prompt-templates';\n/** Load the full template set (global + every session's). */\nexport async function listTemplates() {\n const response = await fetch(`${BASE}/templates`, { cache: 'no-store' });\n if (!response.ok)\n return [];\n const body = await response.json();\n return [...body.items ?? []];\n}\n/** Create one template. */\nexport async function createTemplate(request) {\n return mutate('POST', '/templates', request);\n}\n/** Patch one template by id. */\nexport async function updateTemplate(id, request) {\n return mutate('PATCH', `/templates/${encodeURIComponent(id)}`, request);\n}\n/** Promote one session template to the global partition. */\nexport async function makeTemplateGlobal(id) {\n return mutate('POST', `/templates/${encodeURIComponent(id)}/make-global`, {});\n}\n/** Delete one template by id. */\nexport async function deleteTemplate(id) {\n return mutate('DELETE', `/templates/${encodeURIComponent(id)}`);\n}\n/** Run one mutating request and settle it into the action envelope. */\nasync function mutate(method, path, body) {\n try {\n const response = await fetch(`${BASE}${path}`, {\n method,\n headers: body === undefined ? undefined : { 'content-type': 'application/json' },\n body: body === undefined ? undefined : JSON.stringify(body),\n cache: 'no-store',\n });\n if (!response.ok) {\n const payload = await response.json().catch(() => null);\n return {\n ok: false,\n error: payload?.error ?? { code: `http:${response.status}`, message: response.statusText },\n };\n }\n return { ok: true, value: await response.json().catch(() => undefined) };\n }\n catch (error) {\n return { ok: false, error: { code: 'network-error', message: String(error) } };\n }\n}\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * Quick prompt panel: the right-anchored floating surface registered into\n * shell.overlay. Lists global templates plus the current session's private\n * ones; clicking a row inserts its content into the composer draft. The\n * injected face carries the CRUD verbs and insert; the panel store holds\n * visibility; the current session arrives through the standard kit.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { IconEditOutline16, IconGlobeOutline14, IconPlusOutline16, IconSendOutline16, IconTrashOutline16 } from '@deepseek-ai/dsh-client-ui-primitives';\nimport css from './Panel.module.css';\nfunction TemplateRow({ template, onInsert, onSend, onEdit, onDelete, onMakeGlobal, t }) {\n return (_jsxs(\"div\", { className: css.row, \"data-prompt-template\": true, children: [_jsxs(\"button\", { type: \"button\", className: css.insert, onClick: () => { onInsert(template.content); }, title: t('panel.insert'), children: [_jsx(\"span\", { className: css.name, children: template.name }), _jsx(\"span\", { className: css.preview, children: template.content })] }), _jsx(\"button\", { type: \"button\", className: css.sendBtn, onClick: () => { onSend(template.content); }, \"aria-label\": t('panel.sendNow'), title: t('panel.sendNow'), children: _jsx(IconSendOutline16, { size: 12 }) }), onMakeGlobal !== undefined && (_jsx(\"button\", { type: \"button\", className: css.globalBtn, onClick: () => { onMakeGlobal(template.id); }, \"aria-label\": t('panel.makeGlobal'), title: t('panel.makeGlobal'), children: _jsx(IconGlobeOutline14, { size: 12 }) })), _jsx(\"button\", { type: \"button\", className: css.editBtn, onClick: () => { onEdit(template.id); }, \"aria-label\": t('panel.edit'), title: t('panel.edit'), children: _jsx(IconEditOutline16, { size: 12 }) }), _jsx(\"button\", { type: \"button\", className: css.deleteBtn, onClick: () => { onDelete(template.id); }, \"aria-label\": t('panel.delete'), children: _jsx(IconTrashOutline16, { size: 12 }) })] }));\n}\n/** The template inline form: creation (with scope picker) and in-place edit. */\nfunction TemplateForm({ initial, allowScope, sessionId, t, submitLabel, onSubmit, onDone }) {\n const [name, setName] = useState(initial?.name ?? '');\n const [content, setContent] = useState(initial?.content ?? '');\n const [scope, setScope] = useState('global');\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState(null);\n const submit = useCallback(async () => {\n const trimmedName = name.trim();\n const trimmedContent = content.trim();\n if (trimmedName === '' || trimmedContent === '')\n return;\n if (allowScope && scope === 'session' && sessionId === null) {\n setError(t('panel.error'));\n return;\n }\n setBusy(true);\n setError(null);\n const ok = await onSubmit(trimmedName, trimmedContent, scope);\n setBusy(false);\n if (!ok) {\n setError(t('panel.error'));\n return;\n }\n onDone();\n }, [name, content, scope, allowScope, sessionId, onSubmit, t, onDone]);\n return (_jsxs(\"div\", { className: css.addForm, \"data-prompt-add\": true, children: [_jsx(\"input\", { className: css.nameInput, type: \"text\", placeholder: t('panel.addName'), value: name, onChange: (e) => { setName(e.target.value); }, \"aria-label\": t('panel.addName') }), _jsx(\"textarea\", { className: css.contentInput, placeholder: t('panel.addContent'), value: content, onChange: (e) => { setContent(e.target.value); }, rows: 3, \"aria-label\": t('panel.addContent') }), _jsxs(\"div\", { className: css.addRow, children: [allowScope && (_jsx(\"label\", { className: css.scopeLabel, children: _jsxs(\"select\", { value: scope, onChange: (e) => { setScope(e.target.value); }, \"aria-label\": \"scope\", children: [_jsx(\"option\", { value: \"global\", children: t('panel.global') }), _jsx(\"option\", { value: \"session\", disabled: sessionId === null, children: t('panel.session') })] }) })), _jsxs(\"div\", { className: css.addActions, children: [error !== null && _jsx(\"span\", { className: css.error, role: \"alert\", children: error }), _jsx(\"button\", { type: \"button\", className: css.saveBtn, onClick: () => void submit(), disabled: busy || name.trim() === '' || content.trim() === '', children: submitLabel })] })] })] }));\n}\n/**\n * The prompt-templates panel body.\n * @param props - runtime kit, injected face members, store handle, and locale.\n */\nexport function PromptPanel(props) {\n const { useStore, useSessions, refresh, create, update, remove, makeGlobal, insert, send, panelPosition, savePanelPosition, resetPanelPosition, actions, t, } = props;\n const open = useStore(s => s.open);\n const currentSession = useSessions(s => s.current);\n const [templates, setTemplates] = useState([]);\n const [showAdd, setShowAdd] = useState(false);\n // Live search filter over name + content, case-insensitive.\n const [query, setQuery] = useState('');\n // In-place editing: the id whose row swaps to the edit form, null = none.\n const [editingId, setEditingId] = useState(null);\n // Drag placement: seeded from the persisted position, live-updated while\n // dragging, committed to the settings document on release. A null with no\n // drag in flight keeps the CSS right-anchored default.\n const persisted = panelPosition();\n const [dragPos, setDragPos] = useState(null);\n const dragRef = useRef(null);\n const panelRef = useRef(null);\n const sessionId = currentSession ?? null;\n const load = useCallback(async () => {\n const items = await refresh();\n setTemplates(items);\n }, [refresh]);\n useEffect(() => {\n if (open)\n void load();\n }, [open, load]);\n const handleInsert = useCallback((content) => {\n if (sessionId === null)\n return;\n insert(sessionId, content);\n }, [insert, sessionId]);\n const handleSend = useCallback((content) => {\n if (sessionId === null)\n return;\n send(sessionId, content);\n }, [send, sessionId]);\n const handleRemove = useCallback(async (id) => {\n const result = await remove(id);\n if (result.ok)\n void load();\n }, [remove, load]);\n const handleMakeGlobal = useCallback(async (id) => {\n const result = await makeGlobal(id);\n if (result.ok)\n void load();\n }, [makeGlobal, load]);\n // Drag-by-header: capture the pointer, track the offset, clamp so the\n // header always stays reachable inside the viewport, commit on release.\n const onHeaderPointerDown = (event) => {\n if (event.button !== 0)\n return;\n const target = event.target;\n if (target.closest('button'))\n return;\n const panel = panelRef.current;\n if (panel === null)\n return;\n const rect = panel.getBoundingClientRect();\n dragRef.current = { pointerId: event.pointerId, offX: event.clientX - rect.left, offY: event.clientY - rect.top };\n // jsdom lacks the pointer-capture API; feature-detect before using it.\n if (Reflect.has(event.currentTarget, 'setPointerCapture')) {\n event.currentTarget.setPointerCapture(event.pointerId);\n }\n };\n const onHeaderPointerMove = (event) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId)\n return;\n const width = panelRef.current?.getBoundingClientRect().width ?? 320;\n const maxX = Math.max(0, window.innerWidth - width);\n const maxY = Math.max(0, window.innerHeight - 40);\n const x = Math.min(Math.max(event.clientX - drag.offX, 0), maxX);\n const y = Math.min(Math.max(event.clientY - drag.offY, 0), maxY);\n setDragPos({ x, y });\n };\n const onHeaderPointerUp = (event) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId)\n return;\n dragRef.current = null;\n if (Reflect.has(event.currentTarget, 'releasePointerCapture')) {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n if (dragPos !== null)\n savePanelPosition(dragPos);\n };\n // Double-click the header to forget the placement and re-anchor right.\n const onHeaderDoubleClick = () => {\n setDragPos(null);\n resetPanelPosition();\n };\n if (!open)\n return null;\n // The full set is loaded; group here — a server-side session filter would\n // hide global rows (their session_id is NULL and never matches). The search\n // query narrows both groups by name + content, case-insensitive.\n const needle = query.trim().toLowerCase();\n const matches = (row) => needle === ''\n || row.name.toLowerCase().includes(needle)\n || row.content.toLowerCase().includes(needle);\n const globalRows = templates.filter(row => row.scope === 'global' && matches(row));\n /** One list row: the edit form while being edited, the rendered row otherwise. */\n const renderTemplateRow = (row) => (editingId === row.id\n ? (_jsx(TemplateForm, { initial: { name: row.name, content: row.content }, allowScope: false, sessionId: sessionId, t: t, submitLabel: t('panel.addSave'), onSubmit: async (name, content) => (await update(row.id, { name, content })).ok, onDone: () => { setEditingId(null); void load(); } }, row.id))\n : (_jsx(TemplateRow, { template: row, onInsert: (c) => { handleInsert(c); }, onSend: (c) => { handleSend(c); }, onEdit: (id) => { setEditingId(id); }, onDelete: (id) => { void handleRemove(id); }, onMakeGlobal: row.scope === 'session' ? (id) => { void handleMakeGlobal(id); } : undefined, t: t }, row.id)));\n const sessionRows = templates.filter(row => row.scope === 'session' && row.session_id === sessionId && matches(row));\n const placement = dragPos ?? persisted;\n const placementStyle = placement === null\n ? undefined\n : { left: placement.x, top: placement.y, right: 'auto', bottom: 'auto' };\n return (_jsxs(\"div\", { className: css.panel, \"data-prompt-panel\": true, ref: panelRef, style: placementStyle, children: [_jsxs(\"div\", { className: css.header, title: t('panel.dragHint'), onPointerDown: onHeaderPointerDown, onPointerMove: onHeaderPointerMove, onPointerUp: onHeaderPointerUp, onDoubleClick: onHeaderDoubleClick, children: [_jsx(\"span\", { className: css.title, children: t('panel.title') }), _jsx(\"button\", { type: \"button\", className: css.closeBtn, onClick: () => { actions.close(); }, \"aria-label\": t('panel.close'), children: \"\\u00D7\" })] }), _jsx(\"div\", { className: css.searchBar, children: _jsx(\"input\", { type: \"search\", className: css.searchInput, value: query, onChange: (e) => { setQuery(e.target.value); }, placeholder: t('panel.search'), \"aria-label\": t('panel.search') }) }), _jsxs(\"div\", { className: css.body, children: [templates.length === 0 && !showAdd && (_jsx(\"div\", { className: css.empty, children: t('panel.empty') })), templates.length > 0 && needle !== '' && globalRows.length === 0 && sessionRows.length === 0 && (_jsx(\"div\", { className: css.empty, children: t('panel.noMatch') })), globalRows.length > 0 && (_jsxs(\"div\", { className: css.group, children: [_jsx(\"div\", { className: css.groupTitle, children: t('panel.global') }), globalRows.map(row => renderTemplateRow(row))] })), sessionRows.length > 0 && sessionId !== null && (_jsxs(\"div\", { className: css.group, children: [_jsx(\"div\", { className: css.groupTitle, children: t('panel.session') }), sessionRows.map(row => renderTemplateRow(row))] })), showAdd && (_jsx(TemplateForm, { sessionId: sessionId, t: t, allowScope: true, submitLabel: t('panel.addSave'), onSubmit: async (name, content, scope) => {\n const result = await create({\n name,\n content,\n scope,\n session_id: scope === 'session' ? sessionId : null,\n });\n return result.ok;\n }, onDone: () => { setShowAdd(false); void load(); } }))] }), _jsx(\"div\", { className: css.footer, children: _jsxs(\"button\", { type: \"button\", className: css.addBtn, onClick: () => { setShowAdd(v => !v); }, children: [_jsx(IconPlusOutline16, { size: 12 }), \" \", t('panel.add')] }) })] }));\n}\n","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport css from './PanelButton.module.css';\n/**\n * The composer tool-row button.\n * @param props - runtime kit (includes the InputZone owner share), the toggle verb, and the locale seat.\n */\nexport function PanelButton({ toggle, t }) {\n return (_jsx(\"button\", { type: \"button\", className: css.button, onClick: toggle, \"aria-label\": t('panel.open'), \"aria-pressed\": \"false\", title: t('panel.title'), children: _jsx(\"span\", { className: css.glyph, children: \"\\u25A4\" }) }));\n}\n","/**\n * Panel store owned by the shell.overlay entry: the open flag plus the\n * ever-opened marker. The composer button reaches the same state through\n * ctx.promptPanel (the controller holds the entry's bound actions); inserts\n * go through the controller's session-input path, never this store. The\n * ever-opened marker lets the settings-driven default-open apply exactly\n * once: any manual toggle or open marks the panel user-owned, so a late\n * settings load can never reopen what the user closed.\n *\n * Module level exports the factory only (de-facto singleton prohibition —\n * see ui-layout's store).\n */\nimport { defineStore } from '@deepseek-ai/dsh-client-runtime/client';\n/**\n * Complete write set for the panel.\n * @returns the store handle (spec + type + identity + factory in one).\n */\nexport function createPromptPanelStore() {\n const handle = defineStore({\n init: () => ({ open: false, everOpened: false }),\n actions: {\n toggle: (d) => {\n d.everOpened = true;\n d.open = !d.open;\n },\n open: (d) => {\n d.everOpened = true;\n d.open = true;\n },\n close: (d) => {\n d.everOpened = true;\n d.open = false;\n },\n // One-shot settings-driven default open: a no-op once the user has\n // ever touched the panel (either direction).\n openOnce: (d) => {\n if (d.everOpened)\n return;\n d.everOpened = true;\n d.open = true;\n },\n },\n });\n return handle;\n}\n","/**\n * Cross-entry panel face (ctx.promptPanel).\n */\nexport class PromptPanelController {\n #actions;\n #sessions;\n #conversation;\n #pendingAutoOpen = false;\n /**\n * Adopt the shell.overlay entry's bound store actions. Called from that\n * registration's inject hook; a re-register overwrites the stale set. A\n * default-open that arrived before the entry's first render is applied\n * here, once wiring exists.\n * @param actions - bound actions of the panel store instance.\n */\n attach(actions) {\n this.#actions = actions;\n if (this.#pendingAutoOpen) {\n this.#pendingAutoOpen = false;\n actions.openOnce();\n }\n }\n /**\n * Bind the session-scope resolution services needed for inserts.\n * @param deps - sessions and conversation services from the plugin closure.\n */\n bind(deps) {\n this.#sessions = deps.sessions;\n this.#conversation = deps.conversation;\n }\n /** Flip the panel open/closed. */\n toggle() {\n this.#require().toggle();\n }\n /**\n * Apply the settings-driven default open, at most once per store lifetime\n * and never after any user interaction with the panel. Before the entry's\n * first render the request parks as pending and attach() replays it.\n */\n openOnce() {\n if (this.#actions === undefined) {\n this.#pendingAutoOpen = true;\n return;\n }\n this.#actions.openOnce();\n }\n /**\n * Append one template's content to a session's composer draft. An empty\n * draft takes the content verbatim; a non-empty draft joins with a newline.\n * @param sessionId - target session.\n * @param content - template content.\n */\n insert(sessionId, content) {\n const input = this.#inputOf(sessionId);\n if (input === undefined)\n return;\n const draft = input.state.getSnapshot().draft;\n input.setDraft(draft === '' ? content : `${draft}\\n${content}`);\n }\n /**\n * Fill the draft with one template's content and submit it immediately —\n * the same transaction as typing the text and pressing send.\n * @param sessionId - target session.\n * @param content - template content.\n */\n send(sessionId, content) {\n const input = this.#inputOf(sessionId);\n if (input === undefined)\n return;\n input.setDraft(content);\n input.submit();\n }\n /** Resolve a session's input facade, or undefined when out of reach. */\n #inputOf(sessionId) {\n const sessions = this.#sessions;\n const conversation = this.#conversation;\n if (sessions === undefined || conversation === undefined)\n return undefined;\n const actx = sessions.scope(sessionId);\n if (actx === undefined)\n return undefined;\n return conversation.input.for(actx);\n }\n #require() {\n if (this.#actions === undefined) {\n throw new Error('prompt-panel: panel actions not wired (shell.overlay entry not mounted)');\n }\n return this.#actions;\n }\n}\n","/** Locale keys for the prompt-templates surface. */\n/** Chinese dictionary. */\nexport const zh = {\n 'panel.title': '快捷提示词',\n 'panel.dragHint': '拖动移动,双击复位',\n 'panel.sendNow': '直接发送',\n 'panel.open': '打开提示词面板',\n 'panel.close': '关闭提示词面板',\n 'panel.empty': '暂无模板',\n 'panel.search': '搜索模板…',\n 'panel.noMatch': '没有匹配的模板',\n 'panel.global': '全局模板',\n 'panel.session': '会话模板',\n 'panel.add': '新增',\n 'panel.addName': '模板名称',\n 'panel.addContent': '模板内容',\n 'panel.addSave': '保存',\n 'panel.addCancel': '取消',\n 'panel.insert': '插入',\n 'panel.delete': '删除',\n 'panel.edit': '编辑',\n 'panel.makeGlobal': '设为全局',\n 'panel.error': '操作失败',\n 'panel.inserted': '已插入',\n 'panel.none': '无',\n};\n/** English dictionary. */\nexport const en = {\n 'panel.title': 'Quick prompts',\n 'panel.dragHint': 'Drag to move, double-click to reset',\n 'panel.sendNow': 'Send now',\n 'panel.open': 'Open prompt panel',\n 'panel.close': 'Close prompt panel',\n 'panel.empty': 'No templates yet',\n 'panel.search': 'Search templates…',\n 'panel.noMatch': 'No matching templates',\n 'panel.global': 'Global templates',\n 'panel.session': 'Session templates',\n 'panel.add': 'Add',\n 'panel.addName': 'Template name',\n 'panel.addContent': 'Template content',\n 'panel.addSave': 'Save',\n 'panel.addCancel': 'Cancel',\n 'panel.insert': 'Insert',\n 'panel.delete': 'Delete',\n 'panel.edit': 'Edit',\n 'panel.makeGlobal': 'Make global',\n 'panel.error': 'Operation failed',\n 'panel.inserted': 'Inserted',\n 'panel.none': 'None',\n};\n","import { listTemplates, createTemplate, updateTemplate, deleteTemplate, makeTemplateGlobal, } from \"./api.js\";\nimport { PromptPanel } from \"./Panel.js\";\nimport { PanelButton } from \"./PanelButton.js\";\nimport { createPromptPanelStore } from \"./store.js\";\nimport { PromptPanelController } from \"./service.js\";\nimport { en, zh } from \"./locales.js\";\nexport { PromptPanel } from \"./Panel.js\";\nexport { PanelButton } from \"./PanelButton.js\";\nexport { PromptPanelController } from \"./service.js\";\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'promptTemplates';\n/** Required services: slots, sessions, locale, conversation, and settings scope. */\nexport const inject = ['slots', 'sessions', 'locale', 'conversation', 'settingsScope'];\n/**\n * Client plugin body: the shell.overlay panel owns the store; the controller\n * bridges its actions to the composer entry and performs inserts.\n * @param ctx - client root context.\n */\nexport function apply(ctx) {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'ui-prompt-templates: dictionaries');\n const controller = new PromptPanelController();\n controller.bind({ sessions: ctx.sessions, conversation: ctx.conversation });\n ctx.effect(() => ctx.reflect.provide('promptPanel', controller), 'ui-prompt-templates: panel service');\n const uiSettings = ctx.settingsScope.bind({ namespace: 'prompt-templates' });\n // The panel's business face, created exactly once: the `refresh` identity\n // feeds the panel's load-effect dependency array, so a fresh object per\n // inject evaluation would loop the effect. refresh pulls EVERYTHING and\n // the component groups rows — a server-side session_id filter would hide\n // the global rows (their session_id is NULL and never matches).\n const panelFace = {\n refresh: listTemplates,\n create: (request) => {\n return createTemplate(request);\n },\n update: (id, request) => {\n return updateTemplate(id, request);\n },\n remove: (id) => {\n return deleteTemplate(id);\n },\n makeGlobal: (id) => {\n return makeTemplateGlobal(id);\n },\n insert: (sessionId, content) => {\n controller.insert(sessionId, content);\n },\n send: (sessionId, content) => {\n controller.send(sessionId, content);\n },\n panelPosition: () => {\n const snapshot = uiSettings.getSnapshot();\n if (snapshot.status !== 'ready')\n return null;\n const panel = snapshot.value?.panel;\n if (panel === undefined)\n return null;\n return typeof panel.x === 'number' && typeof panel.y === 'number' ? panel : null;\n },\n savePanelPosition: (position) => {\n void uiSettings.set('panel', { x: Math.round(position.x), y: Math.round(position.y) });\n },\n resetPanelPosition: () => {\n void uiSettings.unset('panel');\n },\n };\n // Settings-driven default open: applied once per store lifetime, only\n // while the user has never touched the panel. The scope is a snapshot\n // source, so the subscription re-checks when the host document lands (the\n // initial read usually races the settings transport). Before the entry\n // renders, openOnce parks the request and attach() replays it.\n const applyDefaultOpen = () => {\n const snapshot = uiSettings.getSnapshot();\n if (snapshot.status === 'ready' && snapshot.value?.defaultOpen === true) {\n controller.openOnce();\n }\n };\n ctx.effect(() => {\n const unsubscribe = uiSettings.subscribe(applyDefaultOpen);\n return () => { unsubscribe(); };\n }, 'ui-prompt-templates: default-open watch');\n applyDefaultOpen();\n // The shell.overlay entry: root scope, owns the panel store; the inject\n // hook hands the bound actions to the controller and the shared face.\n ctx.slots.inject('shell.overlay', () => ctx.slots.register({\n name: 'shell.overlay',\n id: 'prompt-templates',\n order: 10,\n locale: NS,\n store: createPromptPanelStore,\n inject: (actions) => {\n // attach is a side effect on the controller; the face is the data verbs.\n controller.attach(actions);\n return panelFace;\n },\n }, PromptPanel));\n // The composer entry: session scope, toggles the panel via the controller.\n ctx.slots.inject('conversation.input.right', () => ctx.slots.register({\n name: 'conversation.input.right',\n id: 'prompt-templates',\n order: 10,\n locale: NS,\n inject: () => ({\n toggle: () => { controller.toggle(); },\n }),\n }, PanelButton));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;EAMA,MAAM,OAAO;;EAEb,eAAsB,gBAAgB;GAClC,MAAM,WAAW,MAAM,MAAM,GAAG,KAAK,aAAa,EAAE,OAAO,WAAW,CAAC;GACvE,IAAI,CAAC,SAAS,IACV,OAAO,CAAC;GAEZ,OAAO,CAAC,IAAG,MADQ,SAAS,KAAK,EAAA,CACjB,SAAS,CAAC,CAAC;EAC/B;;EAEA,eAAsB,eAAe,SAAS;GAC1C,OAAO,OAAO,QAAQ,cAAc,OAAO;EAC/C;;EAEA,eAAsB,eAAe,IAAI,SAAS;GAC9C,OAAO,OAAO,SAAS,cAAc,mBAAmB,EAAE,KAAK,OAAO;EAC1E;;EAEA,eAAsB,mBAAmB,IAAI;GACzC,OAAO,OAAO,QAAQ,cAAc,mBAAmB,EAAE,EAAE,eAAe,CAAC,CAAC;EAChF;;EAEA,eAAsB,eAAe,IAAI;GACrC,OAAO,OAAO,UAAU,cAAc,mBAAmB,EAAE,GAAG;EAClE;;EAEA,eAAe,OAAO,QAAQ,MAAM,MAAM;GACtC,IAAI;IACA,MAAM,WAAW,MAAM,MAAM,GAAG,OAAO,QAAQ;KAC3C;KACA,SAAS,SAAS,KAAA,IAAY,KAAA,IAAY,EAAE,gBAAgB,mBAAmB;KAC/E,MAAM,SAAS,KAAA,IAAY,KAAA,IAAY,KAAK,UAAU,IAAI;KAC1D,OAAO;IACX,CAAC;IACD,IAAI,CAAC,SAAS,IAEV,OAAO;KACH,IAAI;KACJ,QAAO,MAHW,SAAS,KAAK,CA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,OAAO,OAAO,MAAM,MAAM,YAAY,OAAO,MAAM,MAAM,WAAW,QAAQ;IAChF;IACA,oBAAoB,aAAa;KAC7B,WAAgB,IAAI,SAAS;MAAE,GAAG,KAAK,MAAM,SAAS,CAAC;MAAG,GAAG,KAAK,MAAM,SAAS,CAAC;KAAE,CAAC;IACzF;IACA,0BAA0B;KACtB,WAAgB,MAAM,OAAO;IACjC;GACJ;GAMA,MAAM,yBAAyB;IAC3B,MAAM,WAAW,WAAW,YAAY;IACxC,IAAI,SAAS,WAAW,WAAW,SAAS,OAAO,gBAAgB,MAC/D,WAAW,SAAS;GAE5B;GACA,IAAI,aAAa;IACb,MAAM,cAAc,WAAW,UAAU,gBAAgB;IACzD,aAAa;KAAE,YAAY;IAAG;GAClC,GAAG,yCAAyC;GAC5C,iBAAiB;GAGjB,IAAI,MAAM,OAAO,uBAAuB,IAAI,MAAM,SAAS;IACvD,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS,YAAY;KAEjB,WAAW,OAAO,OAAO;KACzB,OAAO;IACX;GACJ,GAAG,WAAW,CAAC;GAEf,IAAI,MAAM,OAAO,kCAAkC,IAAI,MAAM,SAAS;IAClE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,eAAe,EACX,cAAc;KAAE,WAAW,OAAO;IAAG,EACzC;GACJ,GAAG,WAAW,CAAC;EACnB"}
1
+ {"version":3,"file":"client.js","names":["css","IconQueueOutline14","IconSendOutline16","IconGlobeOutline14","IconEditOutline16","IconTrashOutline16","IconPlusOutline16","css","#actions","#pendingAutoOpen","#sessions","#conversation","#require","#inputOf"],"sources":["client/api.js","client/Panel.js","client/PanelButton.js","client/store.js","client/service.js","client/locales.js","client/index.js"],"sourcesContent":["/**\n * Browser-side API over the host's `/plugins/dsh-prompt-templates` routes.\n * One fetch helper per verb; every response settles into the same\n * `{ ok: true; value } | { ok: false; error }` envelope the panel face\n * consumes, so callers never see transport details.\n */\nconst BASE = '/plugins/dsh-prompt-templates';\n/** Load the full template set (global + every session's). */\nexport async function listTemplates() {\n const response = await fetch(`${BASE}/templates`, { cache: 'no-store' });\n if (!response.ok)\n return [];\n const body = await response.json();\n return [...body.items ?? []];\n}\n/** Load every user category tab (global + all sessions'; the panel filters). */\nexport async function listCategories() {\n const response = await fetch(`${BASE}/categories`, { cache: 'no-store' });\n if (!response.ok)\n return [];\n const body = await response.json();\n return [...body.items ?? []];\n}\n/** Create one category tab. */\nexport async function createCategory(request) {\n return mutate('POST', '/categories', request);\n}\n/** Delete one category tab (its templates fall back to the default tab). */\nexport async function deleteCategory(name, scope, sessionId) {\n const params = new URLSearchParams({ scope });\n if (sessionId !== null)\n params.set('session_id', sessionId);\n return mutate('DELETE', `/categories/${encodeURIComponent(name)}?${params.toString()}`);\n}\n/** Create one template. */\nexport async function createTemplate(request) {\n return mutate('POST', '/templates', request);\n}\n/** Patch one template by id. */\nexport async function updateTemplate(id, request) {\n return mutate('PATCH', `/templates/${encodeURIComponent(id)}`, request);\n}\n/** Promote one session template to the global partition. */\nexport async function makeTemplateGlobal(id) {\n return mutate('POST', `/templates/${encodeURIComponent(id)}/make-global`, {});\n}\n/** Delete one template by id. */\nexport async function deleteTemplate(id) {\n return mutate('DELETE', `/templates/${encodeURIComponent(id)}`);\n}\n/** Run one mutating request and settle it into the action envelope. */\nasync function mutate(method, path, body) {\n try {\n const response = await fetch(`${BASE}${path}`, {\n method,\n headers: body === undefined ? undefined : { 'content-type': 'application/json' },\n body: body === undefined ? undefined : JSON.stringify(body),\n cache: 'no-store',\n });\n if (!response.ok) {\n const payload = await response.json().catch(() => null);\n return {\n ok: false,\n error: payload?.error ?? { code: `http:${response.status}`, message: response.statusText },\n };\n }\n return { ok: true, value: await response.json().catch(() => undefined) };\n }\n catch (error) {\n return { ok: false, error: { code: 'network-error', message: String(error) } };\n }\n}\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/**\n * Quick prompt panel: the right-anchored floating surface registered into\n * shell.overlay. Lists global templates plus the current session's private\n * ones; clicking a row inserts its content into the composer draft. The\n * injected face carries the CRUD verbs and insert; the panel store holds\n * visibility; the current session arrives through the standard kit.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { IconEditOutline16, IconGlobeOutline14, IconPlusOutline16, IconQueueOutline14, IconSendOutline16, IconTrashOutline16 } from '@deepseek-ai/dsh-client-ui-primitives';\nimport css from './Panel.module.css';\nfunction TemplateRow({ template, onInsert, onSend, onInterject, onEdit, onDelete, onMakeGlobal, onDragStart, onDropOn, t }) {\n return (_jsxs(\"div\", { className: css.row, \"data-prompt-template\": true, onMouseDown: (e) => { e.preventDefault(); }, draggable: true, onDragStart: () => { onDragStart(template.id); }, onDragOver: (e) => { e.preventDefault(); }, onDrop: (e) => { e.preventDefault(); e.stopPropagation(); onDropOn(template.id); }, children: [_jsxs(\"button\", { type: \"button\", className: css.insert, onClick: () => { onInsert(template.content); }, title: t('panel.insert'), children: [_jsx(\"span\", { className: css.name, children: template.name }), _jsx(\"span\", { className: css.preview, children: template.content })] }), _jsx(\"button\", { type: \"button\", className: css.interjectBtn, onClick: () => { onInterject(template.content); }, \"aria-label\": t('panel.interject'), title: t('panel.interject'), children: _jsx(IconQueueOutline14, { size: 12 }) }), _jsx(\"button\", { type: \"button\", className: css.sendBtn, onClick: () => { onSend(template.content); }, \"aria-label\": t('panel.sendNow'), title: t('panel.sendNow'), children: _jsx(IconSendOutline16, { size: 12 }) }), onMakeGlobal !== undefined && (_jsx(\"button\", { type: \"button\", className: css.globalBtn, onClick: () => { onMakeGlobal(template.id); }, \"aria-label\": t('panel.makeGlobal'), title: t('panel.makeGlobal'), children: _jsx(IconGlobeOutline14, { size: 12 }) })), _jsx(\"button\", { type: \"button\", className: css.editBtn, onClick: () => { onEdit(template.id); }, \"aria-label\": t('panel.edit'), title: t('panel.edit'), children: _jsx(IconEditOutline16, { size: 12 }) }), _jsx(\"button\", { type: \"button\", className: css.deleteBtn, onClick: () => { onDelete(template.id); }, \"aria-label\": t('panel.delete'), children: _jsx(IconTrashOutline16, { size: 12 }) })] }));\n}\n/** The template inline form: creation (with scope + category pickers) and in-place edit. */\nfunction TemplateForm({ initial, allowScope, sessionId, categories, t, submitLabel, onSubmit, onDone, onCancel }) {\n const [name, setName] = useState(initial?.name ?? '');\n const [content, setContent] = useState(initial?.content ?? '');\n const [scope, setScope] = useState('global');\n const [category, setCategory] = useState(null);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState(null);\n const submit = useCallback(async () => {\n const trimmedName = name.trim();\n const trimmedContent = content.trim();\n if (trimmedName === '' || trimmedContent === '')\n return;\n if (allowScope && scope === 'session' && sessionId === null) {\n setError(t('panel.error'));\n return;\n }\n setBusy(true);\n setError(null);\n const ok = await onSubmit(trimmedName, trimmedContent, scope, category);\n setBusy(false);\n if (!ok) {\n setError(t('panel.error'));\n return;\n }\n onDone();\n }, [name, content, scope, category, allowScope, sessionId, onSubmit, t, onDone]);\n // Categories selectable for the CURRENT scope pick (matching partition).\n const scopeCategories = categories.filter((cat) => cat.scope === scope && (cat.scope === 'global' || cat.session_id === sessionId));\n return (_jsxs(\"div\", { className: css.addForm, \"data-prompt-add\": true, children: [_jsx(\"input\", { className: css.nameInput, type: \"text\", placeholder: t('panel.addName'), value: name, onChange: (e) => { setName(e.target.value); }, \"aria-label\": t('panel.addName') }), _jsx(\"textarea\", { className: css.contentInput, placeholder: t('panel.addContent'), value: content, onChange: (e) => { setContent(e.target.value); }, rows: 3, \"aria-label\": t('panel.addContent') }), _jsxs(\"div\", { className: css.addRow, children: [allowScope && (_jsx(\"label\", { className: css.scopeLabel, children: _jsxs(\"select\", { value: scope, onChange: (e) => { setScope(e.target.value); setCategory(null); }, \"aria-label\": \"scope\", children: [_jsx(\"option\", { value: \"global\", children: t('panel.global') }), _jsx(\"option\", { value: \"session\", disabled: sessionId === null, children: t('panel.session') })] }) })), _jsx(\"label\", { className: css.scopeLabel, children: _jsxs(\"select\", { value: category ?? '', onChange: (e) => { setCategory(e.target.value === '' ? null : e.target.value); }, \"aria-label\": t('panel.category'), children: [_jsx(\"option\", { value: \"\", children: t('panel.categoryNone') }), scopeCategories.map((cat) => _jsx(\"option\", { value: cat.name, children: cat.name }, `${cat.scope}:${cat.name}`))] }) }), _jsxs(\"div\", { className: css.addActions, children: [error !== null && _jsx(\"span\", { className: css.error, role: \"alert\", children: error }), onCancel !== undefined && (_jsx(\"button\", { type: \"button\", className: css.cancelBtn, onClick: onCancel, disabled: busy, children: t('panel.addCancel') })), _jsx(\"button\", { type: \"button\", className: css.saveBtn, onClick: () => void submit(), disabled: busy || name.trim() === '' || content.trim() === '', children: submitLabel })] })] })] }));\n}\n/** Panel width used for viewport clamping (mirrors the CSS `.panel` width). */\nconst PANEL_WIDTH = 320;\n/**\n * Clamp a restored panel position into the current viewport so a placement\n * saved on a wider screen (or a monitor that is no longer attached) can never\n * render the panel unreachable off-screen. Null passes through untouched.\n * @param position - the persisted placement, if any.\n * @returns the clamped placement.\n */\nfunction clampToViewport(position) {\n if (position === null)\n return null;\n const maxX = Math.max(0, window.innerWidth - PANEL_WIDTH);\n const maxY = Math.max(0, window.innerHeight - 40);\n return {\n x: Math.min(Math.max(position.x, 0), maxX),\n y: Math.min(Math.max(position.y, 0), maxY),\n };\n}\n/**\n * The prompt-templates panel body.\n * @param props - runtime kit, injected face members, store handle, and locale.\n */\nexport function PromptPanel(props) {\n const { useStore, useSessions, refresh, refreshCategories, createCategory, removeCategory, create, update, remove, makeGlobal, insert, send, interject, panelPosition, savePanelPosition, resetPanelPosition, actions, t, } = props;\n const open = useStore(s => s.open);\n const currentSession = useSessions(s => s.current);\n const [templates, setTemplates] = useState([]);\n const [categories, setCategories] = useState([]);\n const [showAdd, setShowAdd] = useState(false);\n // Live search filter over name + content, case-insensitive.\n const [query, setQuery] = useState('');\n // In-place editing: the id whose row swaps to the edit form, null = none.\n const [editingId, setEditingId] = useState(null);\n // Active tab: 'global' / 'session' (the implicit default tabs) or\n // `cat:<scope>:<name>` for one user-created category tab.\n const [activeTab, setActiveTab] = useState('global');\n const [showCatForm, setShowCatForm] = useState(false);\n // Row drag-sort: the id currently being dragged (HTML5 DnD).\n const dragRowRef = useRef(null);\n // Drag placement: seeded from the persisted position, live-updated while\n // dragging, committed to the settings document on release. A null with no\n // drag in flight keeps the CSS right-anchored default. The restored value\n // is clamped into the current viewport: a position saved on a wider screen\n // or a second monitor would otherwise render the panel off-screen forever.\n const persisted = clampToViewport(panelPosition());\n const [dragPos, setDragPos] = useState(null);\n const dragRef = useRef(null);\n const panelRef = useRef(null);\n const sessionId = currentSession ?? null;\n const load = useCallback(async () => {\n const items = await refresh();\n setTemplates(items);\n }, [refresh]);\n const loadCategories = useCallback(async () => {\n setCategories(await refreshCategories());\n }, [refreshCategories]);\n useEffect(() => {\n if (open) {\n void load();\n void loadCategories();\n }\n }, [open, load, loadCategories]);\n const handleInsert = useCallback((content) => {\n if (sessionId === null)\n return;\n insert(sessionId, content);\n }, [insert, sessionId]);\n const handleSend = useCallback((content) => {\n if (sessionId === null)\n return;\n send(sessionId, content);\n }, [send, sessionId]);\n const handleInterject = useCallback((content) => {\n if (sessionId === null)\n return;\n interject(sessionId, content);\n }, [interject, sessionId]);\n const handleRemove = useCallback(async (id) => {\n const result = await remove(id);\n if (result.ok)\n void load();\n }, [remove, load]);\n const handleMakeGlobal = useCallback(async (id) => {\n const result = await makeGlobal(id);\n if (result.ok)\n void load();\n }, [makeGlobal, load]);\n // Drag-by-header: capture the pointer, track the offset, clamp so the\n // header always stays reachable inside the viewport, commit on release.\n const onHeaderPointerDown = (event) => {\n if (event.button !== 0)\n return;\n const target = event.target;\n if (target.closest('button'))\n return;\n const panel = panelRef.current;\n if (panel === null)\n return;\n const rect = panel.getBoundingClientRect();\n dragRef.current = { pointerId: event.pointerId, offX: event.clientX - rect.left, offY: event.clientY - rect.top };\n // jsdom lacks the pointer-capture API; feature-detect before using it.\n if (Reflect.has(event.currentTarget, 'setPointerCapture')) {\n event.currentTarget.setPointerCapture(event.pointerId);\n }\n };\n const onHeaderPointerMove = (event) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId)\n return;\n const width = panelRef.current?.getBoundingClientRect().width ?? 320;\n const maxX = Math.max(0, window.innerWidth - width);\n const maxY = Math.max(0, window.innerHeight - 40);\n const x = Math.min(Math.max(event.clientX - drag.offX, 0), maxX);\n const y = Math.min(Math.max(event.clientY - drag.offY, 0), maxY);\n setDragPos({ x, y });\n };\n const onHeaderPointerUp = (event) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId)\n return;\n dragRef.current = null;\n if (Reflect.has(event.currentTarget, 'releasePointerCapture')) {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n if (dragPos !== null)\n savePanelPosition(dragPos);\n };\n // Double-click the header to forget the placement and re-anchor right.\n const onHeaderDoubleClick = () => {\n setDragPos(null);\n resetPanelPosition();\n };\n if (!open)\n return null;\n // The full set is loaded; filtering happens here. The search query\n // narrows by name + content, case-insensitive.\n const needle = query.trim().toLowerCase();\n const matches = (row) => needle === ''\n || row.name.toLowerCase().includes(needle)\n || row.content.toLowerCase().includes(needle);\n // Visible user-category tabs: global ones always, session ones only for\n // the current session.\n const visibleCategories = categories.filter((cat) => cat.scope === 'global' || (cat.scope === 'session' && cat.session_id === sessionId));\n const activeCategory = activeTab.startsWith('cat:')\n ? visibleCategories.find((cat) => `cat:${cat.scope}:${cat.name}` === activeTab)\n : undefined;\n // A deleted (or no-longer-visible) category tab falls back to 全局.\n const effectiveTab = activeTab.startsWith('cat:') && activeCategory === undefined ? 'global' : activeTab;\n // The active tab decides the visible partition; rows sort by position.\n const tabRows = templates.filter((row) => {\n if (!matches(row))\n return false;\n if (effectiveTab === 'global')\n return row.scope === 'global' && row.category === null;\n if (effectiveTab === 'session')\n return row.scope === 'session' && row.session_id === sessionId && row.category === null;\n return activeCategory !== undefined\n && row.category === activeCategory.name\n && row.scope === activeCategory.scope\n && (activeCategory.scope === 'global' || row.session_id === sessionId);\n });\n // Drop one dragged row onto another: reorder within the tab by writing the\n // full position sequence back (idempotent and partition-local).\n const handleRowDrop = (targetId) => {\n const draggedId = dragRowRef.current;\n dragRowRef.current = null;\n if (draggedId === null || draggedId === targetId)\n return;\n const ids = tabRows.map((row) => row.id);\n const from = ids.indexOf(draggedId);\n const to = ids.indexOf(targetId);\n if (from === -1 || to === -1)\n return;\n ids.splice(to, 0, ...ids.splice(from, 1));\n void (async () => {\n await Promise.all(ids.map((id, index) => update(id, { position: index })));\n void load();\n })();\n };\n /** One list row: the edit form while being edited, the rendered row otherwise. */\n const renderTemplateRow = (row) => (editingId === row.id\n ? (_jsx(TemplateForm, { initial: { name: row.name, content: row.content }, allowScope: false, sessionId: sessionId, categories: visibleCategories, t: t, submitLabel: t('panel.addSave'), onSubmit: async (name, content, _scope, category) => (await update(row.id, { name, content, category: row.scope === 'global' ? category : category })).ok, onDone: () => { setEditingId(null); void load(); }, onCancel: () => { setEditingId(null); } }, row.id))\n : (_jsx(TemplateRow, { template: row, onInsert: (c) => { handleInsert(c); }, onSend: (c) => { handleSend(c); }, onInterject: (c) => { handleInterject(c); }, onEdit: (id) => { setEditingId(id); }, onDelete: (id) => { void handleRemove(id); }, onMakeGlobal: row.scope === 'session' ? (id) => { void handleMakeGlobal(id); } : undefined, onDragStart: (id) => { dragRowRef.current = id; }, onDropOn: (id) => { handleRowDrop(id); }, t: t }, row.id)));\n const placement = dragPos ?? persisted;\n // With bottom:auto the fixed panel's height is content-driven, so a long\n // list would stretch past the viewport with no internal scroll. Cap the\n // height at (viewport - top - margin); the flex column + body's\n // min-height/overflow then keeps the list scrolling inside the panel.\n const placementStyle = placement === null\n ? undefined\n : {\n left: placement.x,\n top: placement.y,\n right: 'auto',\n bottom: 'auto',\n maxHeight: `calc(100vh - ${placement.y}px - 16px)`,\n };\n return (_jsxs(\"div\", { className: css.panel, \"data-prompt-panel\": true, ref: panelRef, style: placementStyle, children: [_jsxs(\"div\", { className: css.header, title: t('panel.dragHint'), onPointerDown: onHeaderPointerDown, onPointerMove: onHeaderPointerMove, onPointerUp: onHeaderPointerUp, onDoubleClick: onHeaderDoubleClick, children: [_jsx(\"span\", { className: css.title, children: t('panel.title') }), _jsx(\"button\", { type: \"button\", className: css.closeBtn, onClick: () => { actions.close(); }, \"aria-label\": t('panel.close'), children: \"\\u00D7\" })] }), _jsx(\"div\", { className: css.searchBar, children: _jsx(\"input\", { type: \"search\", className: css.searchInput, value: query, onChange: (e) => { setQuery(e.target.value); }, placeholder: t('panel.search'), \"aria-label\": t('panel.search') }) }), _jsxs(\"div\", { className: css.tabsBar, children: [_jsx(\"button\", { type: \"button\", className: effectiveTab === 'global' ? `${css.tab} ${css.tabActive}` : css.tab, onClick: () => { setActiveTab('global'); }, children: t('panel.global') }), _jsx(\"button\", { type: \"button\", className: effectiveTab === 'session' ? `${css.tab} ${css.tabActive}` : css.tab, onClick: () => { setActiveTab('session'); }, disabled: sessionId === null, children: t('panel.session') }), visibleCategories.map((cat) => {\n const key = `cat:${cat.scope}:${cat.name}`;\n return (_jsxs(\"span\", { className: effectiveTab === key ? `${css.tab} ${css.tabActive}` : css.tab, children: [_jsx(\"button\", { type: \"button\", onClick: () => { setActiveTab(key); }, children: cat.name }), _jsx(\"button\", { type: \"button\", className: css.tabDelete, \"aria-label\": t('panel.deleteCategory'), title: t('panel.deleteCategory'), onClick: () => {\n void (async () => {\n const result = await removeCategory(cat.name, cat.scope, cat.session_id);\n if (result.ok) {\n if (effectiveTab === key)\n setActiveTab('global');\n void loadCategories();\n void load();\n }\n })();\n }, children: \"\\u00D7\" })] }, key));\n }), _jsx(\"button\", { type: \"button\", className: css.tabAdd, \"aria-label\": t('panel.newCategory'), title: t('panel.newCategory'), onClick: () => { setShowCatForm(v => !v); }, children: _jsx(IconPlusOutline16, { size: 10 }) })] }), showCatForm && (_jsx(CategoryForm, { sessionId: sessionId, createCategory: createCategory, t: t, onDone: () => { setShowCatForm(false); void loadCategories(); } })), _jsxs(\"div\", { className: css.body, children: [tabRows.length === 0 && !showAdd && !showCatForm && (_jsx(\"div\", { className: css.empty, children: needle !== '' ? t('panel.noMatch') : t('panel.empty') })), tabRows.length > 0 && (_jsx(\"div\", { className: css.group, onDragOver: (e) => { e.preventDefault(); }, children: tabRows.map(row => renderTemplateRow(row)) })), showAdd && (_jsx(TemplateForm, { sessionId: sessionId, categories: visibleCategories, t: t, allowScope: true, submitLabel: t('panel.addSave'), onSubmit: async (name, content, scope, category) => {\n const result = await create({\n name,\n content,\n scope,\n session_id: scope === 'session' ? sessionId : null,\n category,\n });\n return result.ok;\n }, onDone: () => { setShowAdd(false); void load(); }, onCancel: () => { setShowAdd(false); } }))] }), _jsx(\"div\", { className: css.footer, children: _jsxs(\"button\", { type: \"button\", className: css.addBtn, onClick: () => { setShowAdd(v => !v); }, children: [_jsx(IconPlusOutline16, { size: 12 }), \" \", t('panel.add')] }) })] }));\n}\n/** Inline form creating one category tab: name + scope (global, or the current session). */\nfunction CategoryForm({ sessionId, createCategory, t, onDone }) {\n const [name, setName] = useState('');\n const [scope, setScope] = useState('global');\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState(null);\n const submit = async () => {\n const trimmed = name.trim();\n if (trimmed === '')\n return;\n if (scope === 'session' && sessionId === null) {\n setError(t('panel.error'));\n return;\n }\n setBusy(true);\n setError(null);\n const result = await createCategory({\n name: trimmed,\n scope,\n session_id: scope === 'session' ? sessionId : null,\n });\n setBusy(false);\n if (!result.ok) {\n setError(t('panel.error'));\n return;\n }\n onDone();\n };\n return (_jsxs(\"div\", { className: css.addForm, \"data-prompt-category-add\": true, children: [_jsx(\"input\", { className: css.nameInput, type: \"text\", placeholder: t('panel.categoryName'), value: name, onChange: (e) => { setName(e.target.value); }, \"aria-label\": t('panel.categoryName') }), _jsxs(\"div\", { className: css.addRow, children: [_jsx(\"label\", { className: css.scopeLabel, children: _jsxs(\"select\", { value: scope, onChange: (e) => { setScope(e.target.value); }, \"aria-label\": \"scope\", children: [_jsx(\"option\", { value: \"global\", children: t('panel.global') }), _jsx(\"option\", { value: \"session\", disabled: sessionId === null, children: t('panel.session') })] }) }), _jsxs(\"div\", { className: css.addActions, children: [error !== null && _jsx(\"span\", { className: css.error, role: \"alert\", children: error }), _jsx(\"button\", { type: \"button\", className: css.saveBtn, onClick: () => void submit(), disabled: busy || name.trim() === '', children: t('panel.addSave') })] })] })] }));\n}\n","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport css from './PanelButton.module.css';\n/**\n * The composer tool-row button.\n * @param props - runtime kit (includes the InputZone owner share), the toggle verb, and the locale seat.\n */\nexport function PanelButton({ toggle, t }) {\n return (_jsx(\"button\", { type: \"button\", className: css.button, onClick: toggle, \"aria-label\": t('panel.open'), \"aria-pressed\": \"false\", title: t('panel.title'), children: _jsx(\"span\", { className: css.glyph, children: \"\\u25A4\" }) }));\n}\n","/**\n * Panel store owned by the shell.overlay entry: the open flag plus the\n * ever-opened marker. The composer button reaches the same state through\n * ctx.promptPanel (the controller holds the entry's bound actions); inserts\n * go through the controller's session-input path, never this store. The\n * ever-opened marker lets the settings-driven default-open apply exactly\n * once: any manual toggle or open marks the panel user-owned, so a late\n * settings load can never reopen what the user closed.\n *\n * Module level exports the factory only (de-facto singleton prohibition —\n * see ui-layout's store).\n */\nimport { defineStore } from '@deepseek-ai/dsh-client-runtime/client';\n/**\n * Complete write set for the panel.\n * @returns the store handle (spec + type + identity + factory in one).\n */\nexport function createPromptPanelStore() {\n const handle = defineStore({\n init: () => ({ open: false, everOpened: false }),\n actions: {\n toggle: (d) => {\n d.everOpened = true;\n d.open = !d.open;\n },\n open: (d) => {\n d.everOpened = true;\n d.open = true;\n },\n close: (d) => {\n d.everOpened = true;\n d.open = false;\n },\n // One-shot settings-driven default open: a no-op once the user has\n // ever touched the panel (either direction).\n openOnce: (d) => {\n if (d.everOpened)\n return;\n d.everOpened = true;\n d.open = true;\n },\n },\n });\n return handle;\n}\n","/**\n * Locate the composer textarea for one draft. The input machine publishes\n * no caret, so the caret can only be read from the DOM: of every textarea\n * on the page, the one whose value equals the draft snapshot is the\n * composer (the panel's own form fields never hold the draft). Falls back\n * to null when no match exists (detached DOM, session switched mid-click).\n */\nfunction composerTextarea(draft) {\n if (typeof document === 'undefined')\n return null;\n for (const el of Array.from(document.querySelectorAll('textarea'))) {\n if (el.value === draft)\n return el;\n }\n return null;\n}\n/**\n * Cross-entry panel face (ctx.promptPanel).\n */\nexport class PromptPanelController {\n #actions;\n #sessions;\n #conversation;\n #pendingAutoOpen = false;\n /**\n * Adopt the shell.overlay entry's bound store actions. Called from that\n * registration's inject hook; a re-register overwrites the stale set. A\n * default-open that arrived before the entry's first render is applied\n * here, once wiring exists.\n * @param actions - bound actions of the panel store instance.\n */\n attach(actions) {\n this.#actions = actions;\n if (this.#pendingAutoOpen) {\n this.#pendingAutoOpen = false;\n actions.openOnce();\n }\n }\n /**\n * Bind the session-scope resolution services needed for inserts.\n * @param deps - sessions and conversation services from the plugin closure.\n */\n bind(deps) {\n this.#sessions = deps.sessions;\n this.#conversation = deps.conversation;\n }\n /** Flip the panel open/closed. */\n toggle() {\n this.#require().toggle();\n }\n /**\n * Apply the settings-driven default open, at most once per store lifetime\n * and never after any user interaction with the panel. Before the entry's\n * first render the request parks as pending and attach() replays it.\n */\n openOnce() {\n if (this.#actions === undefined) {\n this.#pendingAutoOpen = true;\n return;\n }\n this.#actions.openOnce();\n }\n /**\n * Insert one template's content into a session's composer draft at the\n * live caret position (selection, when a range is selected, is replaced).\n * The caret lives only in the DOM textarea — the input machine publishes\n * no caret — so the composer textarea is located by matching its value\n * against the draft snapshot; when no textarea is found the content falls\n * back to an end-append (empty draft takes it verbatim, non-empty joins\n * with a newline).\n * @param sessionId - target session.\n * @param content - template content.\n */\n insert(sessionId, content) {\n const input = this.#inputOf(sessionId);\n if (input === undefined)\n return;\n const draft = input.state.getSnapshot().draft;\n const textarea = composerTextarea(draft);\n if (textarea === null) {\n input.setDraft(draft === '' ? content : `${draft}\\n${content}`);\n return;\n }\n const start = textarea.selectionStart ?? draft.length;\n const end = textarea.selectionEnd ?? start;\n const next = `${draft.slice(0, start)}${content}${draft.slice(end)}`;\n const caret = start + content.length;\n input.setDraft(next);\n // Return focus and land the caret after the inserted text; the panel\n // rows preventDefault on mousedown, so the textarea never lost focus.\n textarea.focus();\n textarea.setSelectionRange(caret, caret);\n }\n /**\n * Interject one template: steer it into the running agent turn. With\n * steer mode the content interrupts the current turn at its next step\n * (the same delivery as Cmd/Ctrl+Enter插话发送), rather than queuing\n * after it. The user's own draft is left untouched.\n * @param sessionId - target session.\n * @param content - template content.\n */\n interject(sessionId, content) {\n const input = this.#inputOf(sessionId);\n if (input === undefined)\n return;\n input.setDraft(content);\n input.submit('steer');\n }\n /**\n * Fill the draft with one template's content and submit it immediately —\n * the same transaction as typing the text and pressing send.\n * @param sessionId - target session.\n * @param content - template content.\n */\n send(sessionId, content) {\n const input = this.#inputOf(sessionId);\n if (input === undefined)\n return;\n input.setDraft(content);\n input.submit();\n }\n /** Resolve a session's input facade, or undefined when out of reach. */\n #inputOf(sessionId) {\n const sessions = this.#sessions;\n const conversation = this.#conversation;\n if (sessions === undefined || conversation === undefined)\n return undefined;\n const actx = sessions.scope(sessionId);\n if (actx === undefined)\n return undefined;\n return conversation.input.for(actx);\n }\n #require() {\n if (this.#actions === undefined) {\n throw new Error('prompt-panel: panel actions not wired (shell.overlay entry not mounted)');\n }\n return this.#actions;\n }\n}\n","/** Locale keys for the prompt-templates surface. */\n/** Chinese dictionary. */\nexport const zh = {\n 'panel.title': '快捷提示词',\n 'panel.dragHint': '拖动移动,双击复位',\n 'panel.sendNow': '直接发送',\n 'panel.open': '打开提示词面板',\n 'panel.close': '关闭提示词面板',\n 'panel.empty': '暂无模板',\n 'panel.search': '搜索模板…',\n 'panel.noMatch': '没有匹配的模板',\n 'panel.global': '全局模板',\n 'panel.session': '会话模板',\n 'panel.add': '新增',\n 'panel.addName': '模板名称',\n 'panel.addContent': '模板内容',\n 'panel.addSave': '保存',\n 'panel.addCancel': '取消',\n 'panel.insert': '插入',\n 'panel.interject': '插话打断',\n 'panel.newCategory': '新增分类',\n 'panel.categoryName': '分类名称',\n 'panel.categoryNone': '不设分类',\n 'panel.category': '分类',\n 'panel.deleteCategory': '删除分类',\n 'panel.delete': '删除',\n 'panel.edit': '编辑',\n 'panel.makeGlobal': '设为全局',\n 'panel.error': '操作失败',\n 'panel.inserted': '已插入',\n 'panel.none': '无',\n};\n/** English dictionary. */\nexport const en = {\n 'panel.title': 'Quick prompts',\n 'panel.dragHint': 'Drag to move, double-click to reset',\n 'panel.sendNow': 'Send now',\n 'panel.open': 'Open prompt panel',\n 'panel.close': 'Close prompt panel',\n 'panel.empty': 'No templates yet',\n 'panel.search': 'Search templates…',\n 'panel.noMatch': 'No matching templates',\n 'panel.global': 'Global templates',\n 'panel.session': 'Session templates',\n 'panel.add': 'Add',\n 'panel.addName': 'Template name',\n 'panel.addContent': 'Template content',\n 'panel.addSave': 'Save',\n 'panel.addCancel': 'Cancel',\n 'panel.insert': 'Insert',\n 'panel.interject': 'Interject (steer)',\n 'panel.newCategory': 'New category',\n 'panel.categoryName': 'Category name',\n 'panel.categoryNone': 'No category',\n 'panel.category': 'Category',\n 'panel.deleteCategory': 'Delete category',\n 'panel.delete': 'Delete',\n 'panel.edit': 'Edit',\n 'panel.makeGlobal': 'Make global',\n 'panel.error': 'Operation failed',\n 'panel.inserted': 'Inserted',\n 'panel.none': 'None',\n};\n","import { listTemplates, listCategories, createCategory, deleteCategory, createTemplate, updateTemplate, deleteTemplate, makeTemplateGlobal, } from \"./api.js\";\nimport { PromptPanel } from \"./Panel.js\";\nimport { PanelButton } from \"./PanelButton.js\";\nimport { createPromptPanelStore } from \"./store.js\";\nimport { PromptPanelController } from \"./service.js\";\nimport { en, zh } from \"./locales.js\";\nexport { PromptPanel } from \"./Panel.js\";\nexport { PanelButton } from \"./PanelButton.js\";\nexport { PromptPanelController } from \"./service.js\";\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'promptTemplates';\n/** Required services: slots, sessions, locale, conversation, and settings scope. */\nexport const inject = ['slots', 'sessions', 'locale', 'conversation', 'settingsScope'];\n/**\n * Client plugin body: the shell.overlay panel owns the store; the controller\n * bridges its actions to the composer entry and performs inserts.\n * @param ctx - client root context.\n */\nexport function apply(ctx) {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'ui-prompt-templates: dictionaries');\n const controller = new PromptPanelController();\n controller.bind({ sessions: ctx.sessions, conversation: ctx.conversation });\n ctx.effect(() => ctx.reflect.provide('promptPanel', controller), 'ui-prompt-templates: panel service');\n const uiSettings = ctx.settingsScope.bind({ namespace: 'prompt-templates' });\n // The panel's business face, created exactly once: the `refresh` identity\n // feeds the panel's load-effect dependency array, so a fresh object per\n // inject evaluation would loop the effect. refresh pulls EVERYTHING and\n // the component groups rows — a server-side session_id filter would hide\n // the global rows (their session_id is NULL and never matches).\n const panelFace = {\n refresh: listTemplates,\n refreshCategories: listCategories,\n createCategory: (request) => {\n return createCategory(request);\n },\n removeCategory: (name, scope, sessionId) => {\n return deleteCategory(name, scope, sessionId);\n },\n create: (request) => {\n return createTemplate(request);\n },\n update: (id, request) => {\n return updateTemplate(id, request);\n },\n remove: (id) => {\n return deleteTemplate(id);\n },\n makeGlobal: (id) => {\n return makeTemplateGlobal(id);\n },\n insert: (sessionId, content) => {\n controller.insert(sessionId, content);\n },\n send: (sessionId, content) => {\n controller.send(sessionId, content);\n },\n interject: (sessionId, content) => {\n controller.interject(sessionId, content);\n },\n panelPosition: () => {\n const snapshot = uiSettings.getSnapshot();\n if (snapshot.status !== 'ready')\n return null;\n const panel = snapshot.value?.panel;\n if (panel === undefined)\n return null;\n return typeof panel.x === 'number' && typeof panel.y === 'number' ? panel : null;\n },\n savePanelPosition: (position) => {\n void uiSettings.set('panel', { x: Math.round(position.x), y: Math.round(position.y) });\n },\n resetPanelPosition: () => {\n void uiSettings.unset('panel');\n },\n };\n // Settings-driven default open: applied once per store lifetime, only\n // while the user has never touched the panel. The scope is a snapshot\n // source, so the subscription re-checks when the host document lands (the\n // initial read usually races the settings transport). Before the entry\n // renders, openOnce parks the request and attach() replays it.\n const applyDefaultOpen = () => {\n const snapshot = uiSettings.getSnapshot();\n if (snapshot.status === 'ready' && snapshot.value?.defaultOpen === true) {\n controller.openOnce();\n }\n };\n ctx.effect(() => {\n const unsubscribe = uiSettings.subscribe(applyDefaultOpen);\n return () => { unsubscribe(); };\n }, 'ui-prompt-templates: default-open watch');\n applyDefaultOpen();\n // The shell.overlay entry: root scope, owns the panel store; the inject\n // hook hands the bound actions to the controller and the shared face.\n ctx.slots.inject('shell.overlay', () => ctx.slots.register({\n name: 'shell.overlay',\n id: 'prompt-templates',\n order: 10,\n locale: NS,\n store: createPromptPanelStore,\n inject: (actions) => {\n // attach is a side effect on the controller; the face is the data verbs.\n controller.attach(actions);\n return panelFace;\n },\n }, PromptPanel));\n // The composer entry: session scope, toggles the panel via the controller.\n ctx.slots.inject('conversation.input.right', () => ctx.slots.register({\n name: 'conversation.input.right',\n id: 'prompt-templates',\n order: 10,\n locale: NS,\n inject: () => ({\n toggle: () => { controller.toggle(); },\n }),\n }, PanelButton));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;EAMA,MAAM,OAAO;;EAEb,eAAsB,gBAAgB;GAClC,MAAM,WAAW,MAAM,MAAM,GAAG,KAAK,aAAa,EAAE,OAAO,WAAW,CAAC;GACvE,IAAI,CAAC,SAAS,IACV,OAAO,CAAC;GAEZ,OAAO,CAAC,IAAG,MADQ,SAAS,KAAK,EAAA,CACjB,SAAS,CAAC,CAAC;EAC/B;;EAEA,eAAsB,iBAAiB;GACnC,MAAM,WAAW,MAAM,MAAM,GAAG,KAAK,cAAc,EAAE,OAAO,WAAW,CAAC;GACxE,IAAI,CAAC,SAAS,IACV,OAAO,CAAC;GAEZ,OAAO,CAAC,IAAG,MADQ,SAAS,KAAK,EAAA,CACjB,SAAS,CAAC,CAAC;EAC/B;;EAEA,eAAsB,eAAe,SAAS;GAC1C,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E,CAAC;IACzF;IACA,0BAA0B;KACtB,WAAgB,MAAM,OAAO;IACjC;GACJ;GAMA,MAAM,yBAAyB;IAC3B,MAAM,WAAW,WAAW,YAAY;IACxC,IAAI,SAAS,WAAW,WAAW,SAAS,OAAO,gBAAgB,MAC/D,WAAW,SAAS;GAE5B;GACA,IAAI,aAAa;IACb,MAAM,cAAc,WAAW,UAAU,gBAAgB;IACzD,aAAa;KAAE,YAAY;IAAG;GAClC,GAAG,yCAAyC;GAC5C,iBAAiB;GAGjB,IAAI,MAAM,OAAO,uBAAuB,IAAI,MAAM,SAAS;IACvD,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS,YAAY;KAEjB,WAAW,OAAO,OAAO;KACzB,OAAO;IACX;GACJ,GAAG,WAAW,CAAC;GAEf,IAAI,MAAM,OAAO,kCAAkC,IAAI,MAAM,SAAS;IAClE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,eAAe,EACX,cAAc;KAAE,WAAW,OAAO;IAAG,EACzC;GACJ,GAAG,WAAW,CAAC;EACnB"}
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * dsh-prompt-templates host half: spawns the Python backend child through
3
- * the subprocess seam and exposes template CRUD over web-server routes the
4
- * browser panel fetches (`/plugins/dsh-prompt-templates/*`). The Python
5
- * child owns all durable state; this plugin owns the child process, the
2
+ * dsh-prompt-templates host half: a pure-TS template store over
3
+ * `node:sqlite` (same schema and database file as the former Python
4
+ * backend child) exposed over web-server routes the browser panel fetches
5
+ * (`/plugins/dsh-prompt-templates/*`). The plugin owns the store, the
6
6
  * routes, and the settings namespace (panel default-open + placement).
7
7
  *
8
8
  * Route map (JSON bodies, `Cache-Control: no-store`):
@@ -17,46 +17,32 @@
17
17
  */
18
18
  import s from '@deepseek-ai/schemastery';
19
19
  import { settingsNamespace } from '@deepseek-ai/dsh-settings';
20
- import { DEFAULT_EOF_GRACE_MS, PythonBridgeError, resolveEofGrace } from '@nelsonlongxiang/dsh-python-bridge';
20
+ import { TemplateRuleError, TemplateStore } from "./store.js";
21
21
  export const name = 'prompt-templates';
22
- /** Spawns the Python child through the pythonBridge service; the web-server route registration waits for it lazily. */
23
- export const inject = ['pythonBridge'];
24
22
  export const Config = s.object({
25
- command: s.array(s.string()).required(),
26
- cwd: s.string(),
27
- eofGraceMs: s.number(),
28
23
  dbPath: s.string(),
29
24
  });
30
25
  /** Web-server service key candidates, newest first. */
31
26
  const WEB_SERVER_KEYS = ['webServer', 'httpServer'];
27
+ /** Resolve the default database path under `$DSH_HOME` (default `~/.dsh`). */
28
+ function defaultDbPath() {
29
+ const home = process.env['DSH_HOME'] ?? `${process.getBuiltinModule('node:os').homedir()}/.dsh`;
30
+ return `${home.replaceAll('\\', '/')}/ext/prompt-templates/db.sqlite3`;
31
+ }
32
32
  /**
33
- * Host plugin body: lazily register the web routes once the web server and
34
- * this plugin's pythonBridge service are both live; headless profiles without a
35
- * web server never block boot.
36
- * @param ctx - Host context carrying the pythonBridge service.
37
- * @param config - validated spawn facts for the Python backend.
33
+ * Host plugin body: own the template store, register the settings
34
+ * namespace, and lazily register the web routes once a web server is live;
35
+ * headless profiles without a web server never block boot.
36
+ * @param ctx - Host context.
37
+ * @param config - persistence facts.
38
38
  */
39
39
  export function apply(ctx, config) {
40
- const resolved = {
41
- command: [...config.command],
42
- cwd: config.cwd ?? process.cwd(),
43
- eofGraceMs: resolveEofGrace(config.eofGraceMs ?? DEFAULT_EOF_GRACE_MS, 'prompt-templates'),
44
- dbPath: config.dbPath ?? undefined,
45
- };
46
- let bridge;
40
+ let store;
47
41
  const client = () => {
48
- if (bridge === undefined) {
49
- bridge = ctx.pythonBridge.create({
50
- argv: resolved.dbPath === undefined
51
- ? [...resolved.command]
52
- : [...resolved.command, '--db', resolved.dbPath],
53
- cwd: resolved.cwd,
54
- eofGraceMs: resolved.eofGraceMs,
55
- });
56
- }
57
- return bridge;
42
+ store ??= new TemplateStore(config.dbPath ?? defaultDbPath());
43
+ return store;
58
44
  };
59
- ctx.effect(() => () => { void bridge?.dispose(); }, 'prompt-templates: python bridge teardown');
45
+ ctx.effect(() => () => { store?.close(); }, 'prompt-templates: store close');
60
46
  // Browser preference namespace (panel default-open and remembered
61
47
  // position), optional: without a mounted settings provider the client
62
48
  // scope simply reports unavailable.
@@ -87,57 +73,80 @@ export function apply(ctx, config) {
87
73
  }
88
74
  });
89
75
  }
90
- /** Dispatch one API request against the Python child. */
76
+ /** Dispatch one API request against the template store. */
91
77
  async function handle(req, res, client) {
92
78
  const url = new URL(req.url ?? '/', 'http://x');
93
79
  const segments = url.pathname.split('/').filter(part => part !== '');
94
- // Expect ['plugins', 'dsh-prompt-templates', 'templates', ...rest].
80
+ // Route namespace: `/plugins/dsh-prompt-templates/<resource>/...`.
81
+ // `templates` and `categories` are both segments[2]; their operation
82
+ // remainder starts at index 3. Dispatching categories from rest[0] made
83
+ // its root URL (`/categories`) indistinguishable from `/templates`.
84
+ const resource = segments[2];
95
85
  const rest = segments.slice(3);
96
86
  const method = req.method ?? 'GET';
97
87
  try {
88
+ // Category tabs: GET/POST /categories, DELETE /categories/:name?scope&session_id.
89
+ if (resource === 'categories') {
90
+ if (rest.length === 0 && method === 'GET') {
91
+ return json(res, 200, { items: client().listCategories() });
92
+ }
93
+ if (rest.length === 0 && method === 'POST') {
94
+ const body = await readJson(req);
95
+ const category = client().createCategory(body);
96
+ return json(res, 200, { category });
97
+ }
98
+ const catName = rest[0];
99
+ if (catName !== undefined && rest.length === 1 && method === 'DELETE') {
100
+ const deleted = client().deleteCategory(decodeURIComponent(catName), url.searchParams.get('scope') ?? 'global', url.searchParams.get('session_id'));
101
+ return json(res, 200, { deleted });
102
+ }
103
+ return json(res, 405, errorBody('method-not-allowed', `${method} ${url.pathname}`));
104
+ }
105
+ if (resource !== 'templates')
106
+ return json(res, 404, errorBody('not-found', url.pathname));
98
107
  if (rest.length === 0 && method === 'GET') {
99
- const items = await client().call('templates/list', {});
108
+ const items = client().list();
100
109
  return json(res, 200, { items });
101
110
  }
102
111
  if (rest.length === 0 && method === 'POST') {
103
112
  const body = await readJson(req);
104
- const template = await client().call('templates/create', body);
113
+ const template = client().create(body);
105
114
  return json(res, 200, { template });
106
115
  }
107
116
  const id = rest[0];
108
117
  if (id === undefined)
109
118
  return json(res, 400, errorBody('bad-request', 'missing template id'));
110
119
  if (rest.length === 1 && method === 'GET') {
111
- const template = await client().call('templates/get', { id });
112
- if (template === null)
120
+ const template = client().get(id);
121
+ if (template === undefined)
113
122
  return json(res, 404, notFound(id));
114
123
  return json(res, 200, { template });
115
124
  }
116
125
  if (rest.length === 1 && method === 'PATCH') {
117
126
  const body = await readJson(req);
118
- const template = await client().call('templates/update', { id, ...body });
119
- if (template === null)
127
+ const template = client().update(id, body);
128
+ if (template === undefined)
120
129
  return json(res, 404, notFound(id));
121
130
  return json(res, 200, { template });
122
131
  }
123
132
  if (rest.length === 2 && rest[1] === 'make-global' && method === 'POST') {
124
- const template = await client().call('templates/make_global', { id });
125
- if (template === null)
133
+ const template = client().makeGlobal(id);
134
+ if (template === undefined)
126
135
  return json(res, 404, notFound(id));
127
136
  return json(res, 200, { template });
128
137
  }
129
138
  if (rest.length === 1 && method === 'DELETE') {
130
- const deleted = await client().call('templates/delete', { id });
139
+ const deleted = client().delete(id);
131
140
  return json(res, 200, { deleted });
132
141
  }
133
142
  return json(res, 405, errorBody('method-not-allowed', `${method} ${url.pathname}`));
134
143
  }
135
144
  catch (error) {
136
- if (error instanceof PythonBridgeError) {
137
- return json(res, 502, errorBody(`python:${String(error.code)}`, error.message));
145
+ if (error instanceof TemplateRuleError) {
146
+ return json(res, 400, errorBody('rule-violation', error.message));
138
147
  }
139
148
  const message = error instanceof Error ? error.message : String(error);
140
- return json(res, 500, errorBody('bridge-error', message));
149
+ return json(res, 500, errorBody('store-error', message));
141
150
  }
142
151
  }
143
152
  /** Read and parse one JSON request body. */
@@ -178,3 +187,4 @@ function notFound(id) {
178
187
  function errorBody(code, message) {
179
188
  return { error: { code, message } };
180
189
  }
190
+ export { TemplateStore, TemplateRuleError } from "./store.js";