@cannbot-plugin/cannbot-harness 0.2.5 → 0.2.7

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/README.md CHANGED
@@ -9,25 +9,25 @@ CANNBot Harness 是安装在原版 DeepSeek Harness(DSH)中的独立插件
9
9
  在 DSH **插件 → 添加插件** 中输入:
10
10
 
11
11
  ```text
12
- cannbot-harness@0.2.5
12
+ cannbot-harness@0.2.7
13
13
  ```
14
14
 
15
- 完整包名为 `@cannbot-plugin/cannbot-harness@0.2.5`。请只选择一种入口安装。
15
+ 完整包名为 `@cannbot-plugin/cannbot-harness@0.2.7`。请只选择一种入口安装。
16
16
  兼容范围保持 DSH `>=0.1.1-rc.1 <0.3.0`,Node.js 24.9 或更新版本;图形包管理依赖 DSH 提供官方认证 Fetch 路由与插件管理接口。
17
17
 
18
- 主插件首次启用时,从 npm 自动安装目录中默认启用的 9 个工作流包,目前提供 129 个 Skills。首次获取需要网络;主安装包不再内嵌整份工作流资源。安装后,菜单随已安装的工作流动态更新。
18
+ 从 0.2.6 起,目录包将默认工作流声明为标准 npm 必需依赖。DSH 的安装过程会一次下载主插件、目录包与全部 9 个默认工作流包,目前提供 129 个 Skills;任一依赖下载失败,安装阶段就会报错。首次启用只准备本地已安装资源,全部准备完成后插件才启用,不再后台补装子包。首次安装需要网络;安装完成后可离线加载。
19
19
 
20
20
  Linux 可使用同一个包:
21
21
 
22
22
  ```sh
23
- dsh plugin --profile web add cannbot-harness@0.2.5
23
+ dsh plugin --profile web add cannbot-harness@0.2.7
24
24
  dsh web
25
25
  ```
26
26
 
27
27
  ## 独立更新工作流
28
28
 
29
29
  插件详情页的 **工作流管理** 为每个工作流显示包名、已安装版本和最新版本,可逐项安装、更新、回退,也可 **更新全部工作流**。
30
- 程序启用时检查并同步未固定的默认工作流。回退后固定该版本,自动同步和批量更新不会将它升回去;主动更新这一项即可恢复跟随最新版。
30
+ 程序启用时加载已经安装的工作流;下载新版本通过详情页明确触发。回退后固定该版本,批量更新不会将它升回去;主动更新这一项即可恢复跟随最新版。
31
31
 
32
32
  目录包是 `@cannbot-plugin/workflow-catalog`;工作流包统一为 `@cannbot-plugin/workflow-<ID>`。发布已有工作流的新版本只需更新对应小包;新增工作流先发布内容包,再更新小型目录包,无需发布主程序。维护者操作见 [独立工作流发布说明](WORKFLOW_PUBLISHING.md)。
33
33
 
@@ -49,3 +49,9 @@ node <工作流包>/upstream/bin/cannbot.js install <ID> --tool dsh --target <
49
49
  工作区初始化按“工作区、工作流包版本及完整性”记录,更新无关工作流不会重复初始化当前工作流。
50
50
 
51
51
  仅当主程序界面、加载机制或包格式协议发生不兼容变化时,才需发布新的 Harness 主程序。
52
+
53
+ ## 首次安装依赖(0.2.6 起)
54
+
55
+ 目录包的 `dependencies` 声明全部默认工作流,版本使用 `>=1.0.0`,让新用户在 DSH 标准 npm 安装阶段一次获取当时可解析的最新稳定包,并排除历史占位版本。主插件依赖目录包 `^1.0.2`。发布目录包前必须确保所有工作流已公开;新增默认工作流同时加入目录及其 `dependencies`。已有工作流发布新版本仍不必重发目录包或主插件。
56
+
57
+ 启用时仅从 npm 已安装的依赖准备本地缓存,等待全部完成后才注册工作流能力,不运行 npm 安装脚本,不覆盖缓存内独立升级或固定回退的版本。新版本下载由用户在工作流管理中明确触发。项目级外部依赖依然在选择工作流时按需初始化,不能在未选择项目时提前运行。
package/lib/client.js CHANGED
@@ -44,7 +44,7 @@ window.__ModuleLoader__.load({
44
44
  contentUpdate: "更新",
45
45
  contentRollback: "回退到",
46
46
  contentUpToDate: "已是最新",
47
- contentUnchecked: "尚未检查更新",
47
+ contentUnchecked: "已安装,可使用",
48
48
  contentNotInstalled: "未安装",
49
49
  contentUnavailable: "暂不可用",
50
50
  contentTitle: "工作流管理",
@@ -52,7 +52,7 @@ window.__ModuleLoader__.load({
52
52
  contentBusy: "正在准备…",
53
53
  contentDownloading: "正在从 npm 获取独立工作流包…",
54
54
  contentInitializing: "正在执行官方安装器,准备工作区依赖…",
55
- contentReady: "工作流包可独立更新。选择工作流时自动准备当前工作区。",
55
+ contentReady: "工作流已准备完成,可独立更新。选择工作流时自动准备当前工作区。",
56
56
  contentFailed: "准备未完成。已有工作流版本保留;请查看日志后重试。",
57
57
  contentFallback: "正在准备首次安装的工作流包。",
58
58
  contentWorkflows: "个已安装工作流",
@@ -102,7 +102,7 @@ window.__ModuleLoader__.load({
102
102
  contentUpdate: "Update",
103
103
  contentRollback: "Roll back to",
104
104
  contentUpToDate: "Up to date",
105
- contentUnchecked: "Not checked yet",
105
+ contentUnchecked: "Installed and ready",
106
106
  contentNotInstalled: "Not installed",
107
107
  contentUnavailable: "Unavailable",
108
108
  contentTitle: "Workflow manager",
@@ -110,7 +110,7 @@ window.__ModuleLoader__.load({
110
110
  contentBusy: "Preparing…",
111
111
  contentDownloading: "Fetching independent workflow packages from npm…",
112
112
  contentInitializing: "Running the official installer to prepare workspace dependencies…",
113
- contentReady: "Using synchronized content. Selecting a workflow prepares this workspace automatically.",
113
+ contentReady: "Workflows are ready and can be updated independently. Selecting one prepares this workspace automatically.",
114
114
  contentFailed: "Preparation did not finish. Existing workflow versions are retained; check the log and retry.",
115
115
  contentFallback: "Preparing the first workflow package installation.",
116
116
  contentWorkflows: "installed workflows",
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["primitives","primitives","LegacyMenu","unwrap","raw","Fragment","interfaceCss"],"sources":["../src/client/locales.ts","../src/client/Brand.tsx","../src/workflows.ts","../src/client/WorkflowIcon.tsx","../src/content-types.ts","../src/client/content-store.ts","../src/client/WorkflowSelector.tsx","../src/client/WorkflowCompat.tsx","../src/client/theme.ts","../src/client/InterfaceToggle.tsx","../src/client/presentation.ts","../src/client/slot-compat.ts","../src/client/workflow-selection.ts","../src/client/plugin-update.ts","../src/client/PluginUpdateCard.tsx","../src/client/host-update.ts","../src/client/ContentCard.tsx","../src/client/register-updates.ts","../src/client/index.ts"],"sourcesContent":["export const PRODUCT = 'CANNBot Harness'\nexport const NAMESPACE = 'cannbotHarness'\nexport const PACKAGE = '@cannbot-plugin/cannbot-harness'\nexport const COMMAND = '/ops-direct-invoke'\n\nexport const zh = {\n contentCatalog: '工作流目录', contentCheck: '检查工作流更新', contentVersion: '当前版本', contentLatest: '最新版本', contentPinned: '已固定回退版本',\n contentInstall: '安装', contentUpdate: '更新', contentRollback: '回退到', contentUpToDate: '已是最新', contentUnchecked: '尚未检查更新', contentNotInstalled: '未安装', contentUnavailable: '暂不可用',\n contentTitle: '工作流管理', contentSync: '更新全部工作流', contentBusy: '正在准备…', contentDownloading: '正在从 npm 获取独立工作流包…',\n contentInitializing: '正在执行官方安装器,准备工作区依赖…', contentReady: '工作流包可独立更新。选择工作流时自动准备当前工作区。',\n contentFailed: '准备未完成。已有工作流版本保留;请查看日志后重试。', contentFallback: '正在准备首次安装的工作流包。', contentWorkflows: '个已安装工作流', contentLogs: '查看准备日志',\n updateBackground: '后台正在更新,请勿重复安装。', updateRestored: '更新失败,已恢复旧版。',\n updateRepair: '更新和恢复未完成,请在插件页重新安装原版本。', updateConnectionLost: '连接中断,后台更新可能仍在进行。请重新打开插件页确认版本,勿重复安装。', updateDismiss: '关闭更新提示',\n updateTitle: '版本更新', updateCurrent: '当前版本', updateCheck: '检查更新', updateChecking: '正在检查…',\n updateTo: '更新到', updateRunning: '正在更新…', updateAvailable: '发现新版本,点击上方按钮更新。',\n updateLatest: '当前已是最新版本。', updateDone: '更新已完成。', updateRestart: '新版已安装,重启 DSH 后生效。',\n updateManual: '当前 DSH 要求先卸载旧版。请先下载新版包,再在插件页卸载旧版并添加下载的安装包。',\n updateIncompatible: '当前 DSH 不支持此版本,请先升级 DSH。', updateFailed: '暂时无法完成,请稍后重试。', updateDownload: '下载新版安装包',\n workflow: '选择工作流', ordinary: '普通对话', saving: '正在应用工作流…', operator: '算子开发工作流', commandHint: '发送时自动应用所选工作流,只需填写需求。',\n flash: 'Ascend C Flash 核函数开发', registry: 'ACLNN / GEIR 注册算子开发', model: 'NPU 模型推理优化',\n hccl: 'HCCL 通信算子开发', triton: 'Triton 算子开发', catlass: 'CATLASS 算子开发', performance: 'Ascend C 性能调优', pypto: 'PyPTO 算子开发',\n chooseWorkspace: '请先选择工作目录。', insertFailed: '工作流准备或设置未完成,请到插件详情查看准备日志后重试。',\n}\nexport const en: typeof zh = {\n contentCatalog: 'Workflow catalog', contentCheck: 'Check workflow updates', contentVersion: 'Installed', contentLatest: 'Latest', contentPinned: 'Rolled-back version pinned',\n contentInstall: 'Install', contentUpdate: 'Update', contentRollback: 'Roll back to', contentUpToDate: 'Up to date', contentUnchecked: 'Not checked yet', contentNotInstalled: 'Not installed', contentUnavailable: 'Unavailable',\n contentTitle: 'Workflow manager', contentSync: 'Update all workflows', contentBusy: 'Preparing…', contentDownloading: 'Fetching independent workflow packages from npm…',\n contentInitializing: 'Running the official installer to prepare workspace dependencies…', contentReady: 'Using synchronized content. Selecting a workflow prepares this workspace automatically.',\n contentFailed: 'Preparation did not finish. Existing workflow versions are retained; check the log and retry.', contentFallback: 'Preparing the first workflow package installation.', contentWorkflows: 'installed workflows', contentLogs: 'View preparation log',\n updateBackground: 'Updating in the background. Do not install again.', updateRestored: 'Update failed; the previous version was restored.',\n updateRepair: 'Update and recovery did not finish. Reinstall the previous version from Plugins.', updateConnectionLost: 'Connection lost. The Host may still be updating. Reopen Plugins to check the version before retrying.', updateDismiss: 'Dismiss update notice',\n updateTitle: 'Updates', updateCurrent: 'Installed version', updateCheck: 'Check for updates', updateChecking: 'Checking…',\n updateTo: 'Update to', updateRunning: 'Updating…', updateAvailable: 'A new version is available. Use the button above to update.',\n updateLatest: 'You are up to date.', updateDone: 'Update completed.', updateRestart: 'The update is installed. Restart DSH to apply it.',\n updateManual: 'This DSH version requires removing the old plugin first. Download the update, then uninstall the old plugin and add the downloaded package.',\n updateIncompatible: 'This release requires updating DSH first.', updateFailed: 'Unable to complete this operation. Please retry.', updateDownload: 'Download update',\n workflow: 'Choose workflow', ordinary: 'Ordinary conversation', saving: 'Applying workflow…', operator: 'Operator development workflow', commandHint: 'The selected workflow is applied in the background when you send.',\n flash: 'Ascend C Flash kernel development', registry: 'ACLNN / GEIR operator development', model: 'NPU model inference optimization',\n hccl: 'HCCL communication operators', triton: 'Triton operator development', catlass: 'CATLASS operator development', performance: 'Ascend C performance tuning', pypto: 'PyPTO operator development',\n chooseWorkspace: 'Choose a working directory first.', insertFailed: 'Workflow preparation or saving failed. Check preparation logs in the plugin details and retry.',\n}\nexport type LocaleKey = keyof typeof zh\n","import type { HeroBrandMarkOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type { SidebarBrandMarkOwnerProps } from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { PRODUCT } from './locales.ts'\n\nexport function Mark({ size }: { size: number }) {\n return <svg width={size} height={size} viewBox=\"0 0 40 40\" aria-hidden=\"true\">\n <rect x=\"1\" y=\"1\" width=\"38\" height=\"38\" rx=\"12\" fill=\"var(--dsw-alias-brand-primary)\" />\n <path d=\"M27 12a11 11 0 1 0 0 16\" fill=\"none\" stroke=\"var(--dsw-alias-label-primary-foreground)\" strokeWidth=\"4\" strokeLinecap=\"round\" />\n </svg>\n}\nexport function SidebarMark({ size }: SidebarBrandMarkOwnerProps) { return <Mark size={size} /> }\nexport function SidebarName() { return <span className=\"cannbot-harness-name\">{PRODUCT}</span> }\nexport function Hero({ size }: HeroBrandMarkOwnerProps) {\n return <span data-cannbot-harness-hero=\"\"><Mark size={size} /><span>{PRODUCT}</span></span>\n}\n","export const WORKFLOWS = [\n { id: 'ops-direct-invoke', label: 'operator' },\n { id: 'ops-direct-invoke-flash', label: 'flash' },\n { id: 'ops-registry-invoke', label: 'registry' },\n { id: 'model-infer-optimize', label: 'model' },\n { id: 'hccl-op-generator', label: 'hccl' },\n { id: 'triton-op-generator', label: 'triton' },\n { id: 'catlass-op-generator', label: 'catlass' },\n { id: 'ops-perf-optimize', label: 'performance' },\n { id: 'pypto-op-orchestrator', label: 'pypto' },\n] as const\n","import * as primitives from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ComponentType } from 'react'\n\n/** The exact icon component used by DSH's original Standard mode selector. */\nexport function WorkflowIcon({ size = 16 }: { size?: number }) {\n const icons = primitives as unknown as Record<string, ComponentType<{ size?: number }>>\n const Icon = icons.IconAgentPresetOutlineRegular ?? icons.IconAgentPresetOutline16 ?? icons.IconRefreshOutline16\n return Icon ? <Icon size={size} /> : null\n}\n\nexport function ChevronIcon({ size = 12 }: { size?: number }) {\n const icons = primitives as unknown as Record<string, ComponentType<{ size?: number }>>\n const Icon = icons.IconChevronDownOutlineRegular ?? icons.IconChevronDownOutline14\n return Icon ? <Icon size={size} /> : <svg width={size} height={size} viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\"><path d=\"m3 4.5 3 3 3-3\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" /></svg>\n}\n","export interface ContentPlugin { id: string; title: string; aliases: Record<string, string>; resourceDirectory?: string; version?: string; packageName?: string }\nexport interface ContentSkill { name: string; originalName: string; pluginId: string; path: string; entry: boolean }\nexport interface ContentCatalog { revision?: string; commit?: string; skillsCommit?: string; plugins: ContentPlugin[]; exposedSkills: ContentSkill[] }\nexport interface WorkflowEntry { id: string; title: string; package: string; default: boolean }\nexport interface WorkflowRow extends WorkflowEntry {\n version?: string; latest?: string; previous?: string; installed: boolean; pinned: boolean; error?: string\n}\nexport interface WorkflowDescriptor {\n schemaVersion: 1; id: string; title: string; version: string\n initialization: { kind: 'cannbot-cli'; entry: string } | { kind: 'skill-native' }\n skills: { name: string; path: string; hash: string; entry: boolean }[]\n source: { repository: string; commit: string; skillsCommit: string }\n}\nexport interface ContentStatus {\n phase: 'idle' | 'syncing' | 'ready' | 'error' | 'initializing'\n plugins: { id: string; title: string }[]\n commit?: string; skillsCommit?: string; updatedAt?: string\n fallback: boolean; message: string; log: string\n workflows?: WorkflowRow[]; busy?: boolean; catalogVersion?: string\n}\nexport const CONTENT_PATH = 'api/cannbot-harness/content'\n","import { WORKFLOWS } from '../workflows.ts'\nimport { CONTENT_PATH, type ContentStatus } from '../content-types.ts'\nexport interface DynamicWorkflow { id: string; title: string }\nconst initial: { workflows: DynamicWorkflow[]; status: ContentStatus | undefined } = { workflows: WORKFLOWS.map(({ id }) => ({ id, title: id })), status: undefined }\nexport function createContentStore() {\n let state = initial, closed = false, timer: ReturnType<typeof setTimeout> | undefined\n const listeners = new Set<() => void>()\n const publish = (status: ContentStatus) => { if (!closed) { state = { status, workflows: status.plugins }; for (const listener of listeners) listener() } }\n const endpoint = () => new URL(CONTENT_PATH, document.baseURI)\n const pull = async () => {\n try {\n const response = await fetch(endpoint(), { credentials: 'same-origin', cache: 'no-store', signal: AbortSignal.timeout(15000) })\n if (response.ok) {\n const status = await response.json() as ContentStatus\n if (Array.isArray(status.plugins) && status.plugins.every(item => /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(item.id) && typeof item.title === 'string')) publish(status)\n }\n } catch { /* Keep the last catalog across a short disconnect. */ }\n }\n const post = async (body: object) => {\n const response = await fetch(endpoint(), { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })\n if (!response.ok) { await pull(); throw new Error('CANNBot content preparation failed') }\n await pull()\n }\n return {\n getSnapshot: () => state,\n subscribe(listener: () => void) { listeners.add(listener); return () => { listeners.delete(listener) } },\n start() {\n const tick = async () => { await pull(); if (!closed) timer = setTimeout(() => { void tick() }, 3000) }\n void tick()\n return () => { closed = true; clearTimeout(timer); listeners.clear() }\n },\n sync: () => post({ action: 'sync' }),\n check: () => post({ action: 'check' }),\n update: (id: string, version: string) => post({ action: 'update', id, version }),\n rollback: (id: string) => post({ action: 'rollback', id }),\n prepare: (sessionId: string, id: string) => post({ action: 'prepare', sessionId, id }),\n }\n}\nexport type ContentStore = ReturnType<typeof createContentStore>\nexport const fallbackContent = { getSnapshot: () => initial, subscribe: (_: () => void) => () => {} }\n","import { useState, useSyncExternalStore, type ComponentType, type ReactNode } from 'react'\nimport * as primitives from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { WORKFLOWS } from '../workflows.ts'\nimport { WorkflowIcon, ChevronIcon } from './WorkflowIcon.tsx'\nimport type { WorkflowSelection } from './workflow-selection.ts'\nimport { fallbackContent, type ContentStore, type DynamicWorkflow } from './content-store.ts'\n\nexport type WorkflowProps = PropsRuntime<'conversation.hero.agentPreset'> & PropsLocale<'cannbotHarness'> & { selection: WorkflowSelection; content?: ContentStore }\n\n/** Select a workflow without submitting, replacing text, or discarding reference chips. */\nexport function WorkflowSelector({ sessionId, inputActions, useInput, t, selection, content = fallbackContent as ContentStore }: WorkflowProps) {\n const { workflows } = useSyncExternalStore(content.subscribe, content.getSnapshot)\n const title = (workflow: DynamicWorkflow) => { const known = WORKFLOWS.find(item => item.id === workflow.id); return known ? t(known.label) : workflow.title }\n const input = useInput(state => state)\n const saved = useSyncExternalStore(selection.subscribe, selection.getSnapshot)\n const [open, setOpen] = useState(false)\n const selected = workflows.find(workflow => sessionId && saved.values[sessionId] === workflow.id)\n const available = !!sessionId && saved.ready && !saved.pending && inputActions !== undefined && input !== undefined && input.phase === 'plain'\n const pick = (id: string) => {\n setOpen(false)\n if (sessionId && available) void selection.choose(sessionId, id, t('saving'))\n }\n const anchor = (\n <button type=\"button\" className=\"cannbot-harness-workflow-trigger\" aria-label={t('workflow')} aria-haspopup=\"menu\" aria-expanded={open}\n disabled={!available} title={inputActions === undefined ? t('chooseWorkspace') : t('commandHint')}\n onClick={() => setOpen(value => !value)}>\n <WorkflowIcon />\n <span className=\"cannbot-harness-workflow-label\">{selected ? title(selected) : t('workflow')}</span><ChevronIcon size={12} />\n </button>\n )\n const label = (workflow: DynamicWorkflow) => <span className=\"cannbot-harness-workflow-option\">\n <span>{title(workflow)}</span>\n <small lang=\"en\">{workflow.id}</small>\n </span>\n const { Menu, MenuItemButton } = primitives\n const LegacyMenu = Menu as unknown as ComponentType<{ open: boolean; anchor: ReactNode; portal: boolean; className: string; onClose(): void; selectedId?: string; onSelect(id: string): void; items: { id: string; label: ReactNode; icon: ReactNode }[] }>\n return <span className=\"cannbot-harness-workflow\">\n {typeof MenuItemButton === 'function' ? <Menu open={open} onClose={() => setOpen(false)} portal className=\"cannbot-harness-workflow-anchor\" anchor={anchor}>\n <MenuItemButton icon={<WorkflowIcon />} onSelect={() => pick('')}>{t('ordinary')}</MenuItemButton>\n {workflows.map(workflow => <MenuItemButton key={workflow.id} icon={<WorkflowIcon />} onSelect={() => pick(workflow.id)}>{label(workflow)}</MenuItemButton>)}\n </Menu> : <LegacyMenu open={open} onClose={() => setOpen(false)} portal className=\"cannbot-harness-workflow-anchor\" anchor={anchor}\n selectedId={selected?.id} items={[{ id: '', label: t('ordinary'), icon: <WorkflowIcon /> }, ...workflows.map(workflow => ({ id: workflow.id, label: label(workflow), icon: <WorkflowIcon /> }))]}\n onSelect={pick} />}\n {saved.error && <span role=\"alert\" className=\"cannbot-harness-error\">{t('insertFailed')}</span>}\n </span>\n}\n","import { useMemo, useSyncExternalStore } from 'react'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { WorkflowSelector, type WorkflowProps } from './WorkflowSelector.tsx'\n\n/** Older DSH declares the hero seat at root scope. Resolve its current session\n * through the public services rather than reaching into the editor or DOM. */\nexport function WorkflowCompat({ ctx, ...props }: WorkflowProps & { ctx: Context }) {\n return typeof props.useInput === 'function'\n ? <WorkflowSelector {...props} />\n : <LegacyWorkflow ctx={ctx} {...props} />\n}\n\nfunction LegacyWorkflow({ ctx, ...props }: WorkflowProps & { ctx: Context }) {\n type Input = ReturnType<Context['conversation']['input']['for']>\n const legacy = ctx as unknown as { sessions: { list: { subscribe(listener: () => void): () => void; getSnapshot(): { current?: string } }; scope(id: string): Context | undefined } }\n const sessions = useSyncExternalStore(legacy.sessions.list.subscribe, legacy.sessions.list.getSnapshot)\n const input = useMemo(() => {\n const scope = sessions.current && legacy.sessions.scope(sessions.current)\n return scope ? ctx.conversation.input.for(scope) as Input : undefined\n }, [ctx, sessions.current])\n const state = useSyncExternalStore(input?.state.subscribe ?? noSubscribe, input?.state.getSnapshot ?? noSnapshot)\n return <WorkflowSelector {...props} sessionId={sessions.current as WorkflowProps['sessionId']} useInput={select => state ? select(state) : undefined as never} inputActions={input ? {} as WorkflowProps['inputActions'] : undefined} />\n}\nconst noSubscribe = () => () => {}\nconst noSnapshot = () => undefined\n","import type { ThemeTokenOverrides } from '@deepseek-ai/dsh-client-ui-theme/client'\n\n/** Portal design-v2 palette, applied through the documented theme override layer. */\nexport const cannTheme: ThemeTokenOverrides = Object.fromEntries(Object.entries({\n '--dsw-alias-bg-base': ['#ffffff', '#101114'],\n '--dsw-alias-bg-layer-1': ['#ffffff', '#17191e'],\n '--dsw-alias-bg-layer-2': ['#ffffff', '#1d2026'],\n '--dsw-alias-bg-layer-3': ['#f6f8fa', '#252830'],\n '--dsw-specific-sidebar-fill': ['#f6f8fa', '#14161b'],\n '--dsw-specific-input-major': ['#ffffff', '#1d2026'],\n '--dsw-specific-sidebar-nav-item-active': ['#fdeef0', '#392029'],\n '--dsw-specific-sidebar-nav-item-active-accent': ['#fdeef0', '#392029'],\n '--dsw-alias-label-primary': ['#17181d', '#f3f4f6'],\n '--dsw-alias-label-primary-foreground': ['#ffffff', '#ffffff'],\n '--dsw-alias-label-primary-inverted': ['#ffffff', '#ffffff'],\n '--dsw-alias-label-primary-dimmed': ['#30343e', '#dde1e8'],\n '--dsw-alias-label-primary-bluish': ['#7f0f26', '#ff9aab'],\n '--dsw-alias-label-secondary': ['#59637a', '#b0b8c7'],\n '--dsw-alias-label-tertiary': ['#727d91', '#929db0'],\n '--dsw-alias-brand-primary': ['#da203e', '#ef4560'],\n '--dsw-alias-brand-text': ['#17181d', '#f3f4f6'],\n '--dsw-alias-button-primary-hover': ['#b11430', '#ff647d'],\n '--dsw-alias-button-info-fill': ['#da203e', '#da203e'],\n '--dsw-alias-button-info-hover': ['#b11430', '#b11430'],\n '--dsw-alias-state-business-primary': ['#da203e', '#ff8297'],\n '--dsw-alias-state-business-tertiary': ['#fdeef0', '#392029'],\n '--dsw-alias-link': ['#b11430', '#ff9aab'],\n '--dsw-focus-ring-color': ['#da203e', '#ff8297'],\n '--dsw-alias-border-l1': ['#f0f1f5', '#252830'],\n '--dsw-alias-border-l2': ['#e6e9ef', '#323641'],\n '--dsw-alias-border-l3': ['#dce0e8', '#414754'],\n '--dsw-alias-border-l4': ['#ced4df', '#505867'],\n '--dsw-alias-interactive-bg-hover': ['#eef0f4', '#252830'],\n '--dsw-alias-interactive-bg-active': ['#fdeef0', '#392029'],\n '--dsw-specific-bubble': ['#fff3f5', '#302027'],\n '--dsw-specific-bubble-highlight': ['#fbd6dd', '#59303d'],\n '--dsw-radius-panel': ['18px', '18px'],\n '--dsw-radius-xl': ['14px', '14px'],\n '--dsw-radius-lg': ['12px', '12px'],\n '--dsw-radius-md': ['10px', '10px'],\n '--cann-grid': ['#e6e9ef', '#323641'],\n '--cann-night': ['#0e0f12', '#0e0f12'],\n '--cann-night-label': ['#dde1e8', '#dde1e8'],\n}).map(([name, values]) => [name, { light: values[0]!, dark: values[1]! }]))\n","import { useSyncExternalStore } from 'react'\nimport type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { PresentationController } from './presentation.ts'\nimport { Mark } from './Brand.tsx'\nimport { PRODUCT } from './locales.ts'\n\nexport function InterfaceToggle({ wide, controller }: PropsRuntime<'sidebar.footer.action'> & { controller: PresentationController }) {\n const enabled = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot)\n return <div className={`cannbot-harness-toggle${wide ? '' : ' cannbot-harness-toggle-compact'}`}>\n <span className=\"cannbot-harness-toggle-name\" title={PRODUCT}><Mark size={20} />{wide && <span>{PRODUCT}</span>}</span>\n <button type=\"button\" role=\"switch\" aria-label={PRODUCT} aria-checked={enabled} title={PRODUCT}\n className=\"cannbot-harness-switch\" onClick={() => controller.setEnabled(!enabled)}><span /></button>\n </div>\n}\n","/** Per-activation UI preference: enabling the plugin always starts with its interface on. */\nexport interface PresentationController {\n getSnapshot(): boolean\n subscribe(listener: () => void): () => void\n setEnabled(enabled: boolean): void\n dispose(): void\n}\nexport function createPresentationController(mount: () => () => void): PresentationController {\n let enabled = true\n let stopped = false\n let unmount: (() => void) | undefined = mount()\n const listeners = new Set<() => void>()\n return {\n getSnapshot: () => enabled,\n subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener) } },\n setEnabled(next) {\n if (stopped || next === enabled) return\n if (next) unmount = mount()\n else { unmount?.(); unmount = undefined }\n enabled = next\n for (const listener of listeners) listener()\n },\n dispose() { if (stopped) return; stopped = true; unmount?.(); unmount = undefined; listeners.clear() },\n }\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport type { SlotMap } from '@deepseek-ai/dsh-client-ui-slots'\n\n/** Older DSH declares the injected parent modules before this plugin and uses direct register(). */\nexport function injectSlot(ctx: Context, name: keyof SlotMap & string, register: () => () => void): () => void {\n return typeof ctx.slots.inject === 'function' ? ctx.slots.inject(name, register) : register()\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\nimport { WORKFLOWS } from '../workflows.ts'\n\nconst NS = 'cannbot-harness'\ntype Values = Record<string, string>\ninterface Choice { sessionId: string; workflow: string }\ninterface View { ns: string; value: { selections?: Choice[] }; revision?: number }\nconst valuesOf = (view?: View): Values => Object.fromEntries((view?.value.selections ?? []).map(item => [item.sessionId, item.workflow]))\nexport interface WorkflowTransport {\n describe(): Promise<{ namespaces: View[] }>\n update(ns: string, patch: { selections: Choice[] }, revision?: number): Promise<View>\n}\nexport interface SelectionSnapshot { ready: boolean; pending: boolean; error: boolean; values: Values }\nexport interface WorkflowSelection {\n subscribe(listener: () => void): () => void\n getSnapshot(): SelectionSnapshot\n attach(transport: WorkflowTransport): () => void\n choose(sessionId: string, workflow: string, reason?: string): Promise<void>\n dispose(): void\n}\nexport function createWorkflowSelection(blockSubmission: (sessionId: string, reason: string) => () => void = () => () => {}, prepare: (sessionId: string, id: string) => Promise<void> = async () => {}): WorkflowSelection {\n let snapshot: SelectionSnapshot = { ready: false, pending: false, error: false, values: {} }\n let transport: WorkflowTransport | undefined\n let generation = 0\n let pendingRelease: (() => void) | undefined\n const listeners = new Set<() => void>()\n const publish = (next: SelectionSnapshot) => { snapshot = next; for (const listener of listeners) listener() }\n return {\n subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener) } },\n getSnapshot: () => snapshot,\n attach(next) {\n transport = next\n const own = ++generation\n void next.describe().then(view => {\n if (own !== generation) return\n const section = view.namespaces.find(item => item.ns === NS)\n publish({ ready: !!section, pending: false, error: !section, values: valuesOf(section) })\n }).catch(() => { if (own === generation) publish({ ...snapshot, ready: false, error: true }) })\n return () => { if (own === generation) { generation++; transport = undefined; publish({ ...snapshot, ready: false }) } }\n },\n async choose(sessionId, workflow, reason = 'CANNBot Harness…') {\n if (!transport || !snapshot.ready || snapshot.pending) return\n if (workflow !== '' && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(workflow)) throw new Error('Unknown workflow')\n const current = transport, own = generation\n const unblock = blockSubmission(sessionId, reason)\n let released = false\n const release = () => { if (!released) { released = true; unblock() } }\n pendingRelease = release\n publish({ ...snapshot, pending: true, error: false })\n try {\n if (workflow) await prepare(sessionId, workflow)\n // Fresh revision prevents simultaneous windows from overwriting selections.\n const view = (await current.describe()).namespaces.find(item => item.ns === NS)\n if (!view) throw new Error('Workflow settings unavailable')\n const values = { ...valuesOf(view), [sessionId]: workflow }\n const selections = Object.entries(values).filter(([, id]) => id !== '').map(([sessionId, workflow]) => ({ sessionId, workflow }))\n const result = await current.update(NS, { selections }, view.revision)\n if (own === generation) publish({ ready: true, pending: false, error: false, values: valuesOf(result) })\n } catch {\n if (own === generation) publish({ ...snapshot, pending: false, error: true })\n } finally {\n release()\n if (pendingRelease === release) pendingRelease = undefined\n }\n },\n dispose() { generation++; transport = undefined; pendingRelease?.(); pendingRelease = undefined; listeners.clear() },\n }\n}\n\n/** Both transports are official DSH settings APIs; no private editor access. */\nexport function connectWorkflowSelection(ctx: Context, selection: WorkflowSelection) {\n ctx.inject(['remote', 'remote.settings'], scoped => {\n const settings = scoped.remote.settings\n scoped.effect(() => selection.attach({\n describe: async () => unwrap(await settings.describe()),\n update: async (ns, patch, revision) => unwrap(await settings.update(ns, patch, revision)),\n }))\n })\n ctx.inject(['connection'], scoped => {\n const api = (scoped as unknown as { connection: { api?: { settings: { describe(payload: object): Promise<unknown>; update(payload: object): Promise<unknown> } } } }).connection.api\n if (!api?.settings) return\n scoped.effect(() => selection.attach({\n describe: async () => unwrap(await api.settings.describe({})),\n update: async (ns, patch, expectedRevision) => unwrap(await api.settings.update({ ns, patch, expectedRevision })),\n }))\n })\n}\nfunction unwrap<T>(response: unknown): T {\n const raw = response as { result?: unknown }\n const result = (raw.result ?? response) as { ok: boolean; value: T; error?: { message: string } }\n if (!result.ok) throw new Error(result.error?.message ?? 'Workflow settings failed')\n return result.value\n}\n","export const UPDATE_PACKAGES = ['cannbot-harness', '@cannbot-plugin/cannbot-harness'] as const\nexport interface InstalledBundle { name: string; version?: string; installed: boolean }\nexport interface Change { application: string; error?: { code: string }; version?: string }\nexport interface UpdateBridge {\n list(): Promise<InstalledBundle[]>\n install(spec: string): Promise<Change>\n update?(name: string, version: string): Promise<{ result: Change; restore?: Change }>\n}\nexport interface Release { name: string; version: string; tarball: string }\nexport type UpdatePhase = 'idle' | 'checking' | 'latest' | 'available' | 'updating' | 'done' | 'restart' | 'manual' | 'incompatible' | 'error'\nexport interface UpdateSnapshot { phase: UpdatePhase; current?: string; release?: Release; packageName?: string }\n\n/** Only stable npm releases of our two installation entries may be selected. */\nexport function newerVersion(candidate: string, current: string): boolean {\n const next = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(candidate)\n const old = /^(\\d+)\\.(\\d+)\\.(\\d+)(?:[-+].*)?$/.exec(current)\n if (!next || !old) return false\n for (let index = 1; index < 4; index++) {\n const difference = Number(next[index]) - Number(old[index])\n if (difference) return difference > 0\n }\n return current.includes('-')\n}\n\nexport async function latestRelease(name: string, signal: AbortSignal): Promise<Release> {\n if (!UPDATE_PACKAGES.includes(name as typeof UPDATE_PACKAGES[number])) throw new Error('Unsupported update target')\n const answers = await Promise.allSettled(['https://registry.npmjs.org/', 'https://registry.npmmirror.com/'].map(async registry => {\n const response = await fetch(`${registry}${encodeURIComponent(name)}/latest`, {\n signal: AbortSignal.any([signal, AbortSignal.timeout(15000)]), cache: 'no-store',\n })\n if (!response.ok) throw new Error('Registry unavailable')\n const manifest = await response.json() as { name?: string; version?: string; dist?: { tarball?: string }; dsh?: { bundle?: unknown } }\n if (manifest.name !== name || !manifest.version || !/^\\d+\\.\\d+\\.\\d+$/.test(manifest.version) || !manifest.dsh?.bundle || !manifest.dist?.tarball) throw new Error('Invalid release')\n const url = new URL(manifest.dist.tarball)\n if (url.protocol !== 'https:' || !['registry.npmjs.org', 'registry.npmmirror.com'].includes(url.hostname)) throw new Error('Invalid download origin')\n return { name, version: manifest.version, tarball: url.href }\n }))\n signal.throwIfAborted()\n const releases = answers.flatMap(answer => answer.status === 'fulfilled' ? [answer.value] : [])\n const latest = releases.reduce<Release | undefined>((best, release) => !best || newerVersion(release.version, best.version) ? release : best, undefined)\n if (!latest) throw new Error('No release available')\n return latest\n}\n\nexport function createPluginUpdater(bridge: UpdateBridge, requestedName: string, lookup = latestRelease) {\n let state: UpdateSnapshot = { phase: 'idle' }\n let disposed = false\n let checking: AbortController | undefined\n const listeners = new Set<() => void>()\n const publish = (next: UpdateSnapshot) => { if (disposed) return; state = next; for (const listener of listeners) listener() }\n const failed = (result: Change) => !['applied', 'restart-required'].includes(result.application) || !!result.error\n return {\n getSnapshot: () => state,\n subscribe(listener: () => void) { listeners.add(listener); return () => { listeners.delete(listener) } },\n async check() {\n if (disposed || state.phase === 'checking' || state.phase === 'updating') return\n checking?.abort()\n const abort = new AbortController()\n checking = abort\n publish({ ...state, phase: 'checking' })\n try {\n const bundles = (await bridge.list()).filter(bundle => bundle.installed && UPDATE_PACKAGES.includes(bundle.name as typeof UPDATE_PACKAGES[number]))\n // Update the actual direct dependency, preserving short/long installation form.\n const bundle = bundles.find(bundle => bundle.name === requestedName) ?? bundles[0]\n if (!bundle?.version) throw new Error('Installed entry unavailable')\n publish({ ...state, current: bundle.version, packageName: bundle.name })\n const release = await lookup(bundle.name, abort.signal)\n if (checking !== abort || disposed) return\n publish({ phase: newerVersion(release.version, bundle.version) ? 'available' : 'latest', current: bundle.version, release, packageName: bundle.name })\n } catch {\n if (!abort.signal.aborted) publish({ ...state, phase: 'error' })\n }\n },\n async update() {\n if (disposed || state.phase !== 'available' || !state.release || !state.packageName) return\n const target = state.release, name = state.packageName\n publish({ ...state, phase: 'updating' })\n try {\n // The Host owns the complete transaction, including self-removal and recovery.\n // Frontend disposal must never cancel an update that already started.\n const answer = bridge.update\n ? await bridge.update(name, target.version)\n : { result: await bridge.install(`${name}@${target.version}`) }\n const result = answer.result\n if (failed(result)) {\n const code = result.error?.code\n publish({ ...state, phase: code === 'already-installed' || code === 'stop-profile' ? 'manual' : code === 'incompatible-version' ? 'incompatible' : 'error' })\n } else {\n publish({ ...state, phase: result.application === 'restart-required' ? 'restart' : 'done', current: target.version })\n }\n } catch { publish({ ...state, phase: 'error' }) }\n },\n dispose() { disposed = true; checking?.abort(); listeners.clear() },\n }\n}\nexport type PluginUpdater = ReturnType<typeof createPluginUpdater>\n","import { useEffect, useSyncExternalStore } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { PluginUpdater } from './plugin-update.ts'\n\nexport function PluginUpdateCard({ updater, t }: { updater: PluginUpdater } & PropsLocale<'cannbotHarness'>) {\n const state = useSyncExternalStore(updater.subscribe, updater.getSnapshot)\n useEffect(() => { void updater.check() }, [updater])\n const busy = state.phase === 'checking' || state.phase === 'updating'\n const canUpdate = state.phase === 'available'\n const message = state.phase === 'latest' ? t('updateLatest')\n : state.phase === 'available' ? t('updateAvailable')\n : state.phase === 'updating' ? t('updateRunning')\n : state.phase === 'done' ? t('updateDone')\n : state.phase === 'restart' ? t('updateRestart')\n : state.phase === 'manual' ? t('updateManual')\n : state.phase === 'incompatible' ? t('updateIncompatible')\n : state.phase === 'error' ? t('updateFailed') : ''\n return <section className=\"cannbot-harness-update\" aria-label={t('updateTitle')}>\n <div className=\"cannbot-harness-update-heading\"><h4>{t('updateTitle')}</h4>\n {state.current && <span>{t('updateCurrent')} {state.current}</span>}</div>\n <div className=\"cannbot-harness-update-actions\">\n {state.phase === 'manual' && state.release ? <>\n <a className=\"cannbot-harness-update-button\" href={state.release.tarball} download rel=\"noreferrer\">{t('updateDownload')} {state.release.version}</a>\n <button type=\"button\" className=\"cannbot-harness-update-recheck\" onClick={() => { void updater.check() }}>{t('updateCheck')}</button>\n </> :\n <button type=\"button\" className=\"cannbot-harness-update-button\" disabled={busy}\n onClick={() => { void (canUpdate ? updater.update() : updater.check()) }}>\n {state.phase === 'checking' ? t('updateChecking') : state.phase === 'updating' ? t('updateRunning')\n : canUpdate ? `${t('updateTo')} ${state.release?.version}` : t('updateCheck')}\n </button>\n }\n </div>\n {message && <p role={state.phase === 'error' ? 'alert' : 'status'} aria-live=\"polite\">{message}</p>}\n </section>\n}\n","import type { Change } from './plugin-update.ts'\nimport { en, zh } from './locales.ts'\n\n/** This notice belongs to the in-flight update, so removing the plugin must not remove it. */\nexport async function updateOnHost(name: string, version: string): Promise<{ result: Change; restore?: Change }> {\n const words = document.documentElement.lang.startsWith('en') ? en : zh\n const notice = document.createElement('div')\n notice.setAttribute('role', 'status')\n notice.setAttribute('aria-live', 'polite')\n notice.dataset.cannbotUpdate = 'progress'\n Object.assign(notice.style, { position: 'fixed', bottom: '24px', right: '24px', zIndex: '2147483647',\n maxWidth: 'min(380px, calc(100vw - 48px))', padding: '16px', borderRadius: '12px',\n background: 'var(--dsw-alias-bg-base, white)', color: 'var(--dsw-alias-label-primary, #222)',\n border: '1px solid var(--dsw-alias-border-l2, #ddd)', boxShadow: '0 8px 32px #0002', fontSize: '13px', lineHeight: '1.6' })\n const text = document.createElement('span')\n text.textContent = `${words.updateRunning} ${version} · ${words.updateBackground}`\n notice.append(text)\n document.body.append(notice)\n try {\n const response = await fetch(new URL('api/cannbot-harness/update', document.baseURI), {\n method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ name, version }),\n // No plugin-lifetime abort: its own uninstall is expected during the transaction.\n })\n if (!response.ok) throw new Error('Host update unavailable')\n const answer = await response.json() as { result: Change; restore?: Change }\n if (!answer?.result || typeof answer.result.application !== 'string') throw new Error('Invalid update result')\n const succeeded = (result: Change) => !result.error && ['applied', 'restart-required'].includes(result.application)\n text.textContent = succeeded(answer.result)\n ? `${answer.result.application === 'restart-required' ? words.updateRestart : words.updateDone} (${version})`\n : answer.restore ? succeeded(answer.restore) ? words.updateRestored : words.updateRepair : words.updateFailed\n return answer\n } catch (error) {\n text.textContent = words.updateConnectionLost\n throw error\n } finally {\n const close = document.createElement('button')\n close.type = 'button'; close.textContent = '×'; close.setAttribute('aria-label', words.updateDismiss)\n Object.assign(close.style, { marginLeft: '12px', border: '0', background: 'transparent', color: 'inherit', cursor: 'pointer', fontSize: '18px' })\n close.addEventListener('click', () => notice.remove(), { once: true })\n notice.append(close)\n }\n}\n","import { useState, useSyncExternalStore } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ContentStore } from './content-store.ts'\nimport { newerVersion } from './plugin-update.ts'\nexport function ContentCard({ content, t }: { content: ContentStore } & PropsLocale<'cannbotHarness'>) {\n const { status } = useSyncExternalStore(content.subscribe, content.getSnapshot)\n const [failed, setFailed] = useState(false)\n const busy = status?.busy || status?.phase === 'syncing' || status?.phase === 'initializing'\n const act = (action: () => Promise<void>) => { setFailed(false); void action().catch(() => setFailed(true)) }\n return <section className=\"cannbot-harness-update cannbot-harness-content\" aria-label={t('contentTitle')}>\n <div className=\"cannbot-harness-update-heading\"><h4>{t('contentTitle')}</h4>\n {status?.catalogVersion && <span>{t('contentCatalog')} {status.catalogVersion}</span>}</div>\n <div className=\"cannbot-harness-update-actions\">\n <button type=\"button\" className=\"cannbot-harness-update-button\" disabled={busy} onClick={() => act(content.sync)}>{busy ? t('contentBusy') : t('contentSync')}</button>\n <button type=\"button\" className=\"cannbot-harness-update-recheck\" disabled={busy} onClick={() => act(content.check)}>{t('contentCheck')}</button>\n </div>\n <p role={failed || status?.phase === 'error' ? 'alert' : 'status'} aria-live=\"polite\">\n {failed || status?.phase === 'error' ? t('contentFailed') : status?.phase === 'initializing' ? t('contentInitializing') : status?.phase === 'syncing' ? t('contentDownloading') : status?.fallback ? t('contentFallback') : t('contentReady')}\n </p>\n {status && <p>{status.plugins.length} {t('contentWorkflows')}</p>}\n <div className=\"cannbot-harness-workflow-packages\">\n {status?.workflows?.map(row => {\n const available = row.latest && (!row.version || newerVersion(row.latest, row.version))\n return <div className=\"cannbot-harness-workflow-package\" key={row.id}>\n <div><strong>{row.title}</strong><small lang=\"en\">{row.package}</small>\n <small>{row.version ? `${t('contentVersion')} ${row.version}` : t('contentNotInstalled')}\n {available && ` · ${t('contentLatest')} ${row.latest}`}{row.pinned && ` · ${t('contentPinned')}`}</small>\n {row.error && <small role=\"alert\">{row.error}</small>}</div>\n <div className=\"cannbot-harness-workflow-package-actions\">\n {available ? <button type=\"button\" className=\"cannbot-harness-update-recheck\" disabled={busy}\n aria-label={`${row.installed ? t('contentUpdate') : t('contentInstall')} ${row.title}`}\n onClick={() => act(() => content.update(row.id, row.latest!))}>{row.installed ? t('contentUpdate') : t('contentInstall')}</button>\n : <small>{row.installed ? row.latest ? t('contentUpToDate') : t('contentUnchecked') : t('contentUnavailable')}</small>}\n {row.previous && <button type=\"button\" className=\"cannbot-harness-update-recheck\" disabled={busy}\n aria-label={`${t('contentRollback')} ${row.title}`} onClick={() => act(() => content.rollback(row.id))}>{t('contentRollback')} {row.previous}</button>}\n </div>\n </div>\n })}\n </div>\n {(status?.log || status?.message) && <details><summary>{t('contentLogs')}</summary><pre>{status.message}{'\\n'}{status.log}</pre></details>}\n </section>\n}\n","import { createElement, Fragment } from 'react'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { createPluginUpdater, UPDATE_PACKAGES } from './plugin-update.ts'\nimport { PluginUpdateCard } from './PluginUpdateCard.tsx'\nimport { NAMESPACE } from './locales.ts'\nimport { injectSlot } from './slot-compat.ts'\nimport { updateOnHost } from './host-update.ts'\nimport { ContentCard } from './ContentCard.tsx'\nimport type { ContentStore } from './content-store.ts'\n\n/** Optional integration: old DSH versions without a Plugins page keep loading. */\nexport function registerPluginUpdates(ctx: Context, content?: ContentStore) {\n ctx.inject(['remote', 'remote.pluginManager'], scoped => {\n const manager = scoped.remote.pluginManager\n for (const name of UPDATE_PACKAGES) {\n const updater = createPluginUpdater({\n list: async () => unwrap(await manager.listBundles()),\n install: async spec => unwrap(await manager.installBundle(spec, { saveExact: true })),\n update: updateOnHost,\n }, name)\n scoped.effect(() => () => updater.dispose())\n scoped.effect(() => injectSlot(scoped, 'plugins.bundle.config', () => scoped.slots.register({\n name: 'plugins.bundle.config', key: name, locale: NAMESPACE,\n }, props => createElement(Fragment, null,\n createElement(PluginUpdateCard, { ...(props as PropsLocale<'cannbotHarness'>), updater }),\n content && createElement(ContentCard, { ...(props as PropsLocale<'cannbotHarness'>), content })))))\n }\n })\n}\nfunction unwrap<T>(result: { ok: true; value: T } | { ok: false; error: unknown }): T {\n if (!result.ok) throw result.error\n return result.value\n}\n","/** Browser companion using the existing DSH theme, settings and UI slots. */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-theme/client'\nimport { en, zh, NAMESPACE, PACKAGE, type LocaleKey } from './locales.ts'\nimport { SidebarMark, SidebarName, Hero } from './Brand.tsx'\nimport { WorkflowCompat } from './WorkflowCompat.tsx'\nimport { cannTheme } from './theme.ts'\nimport interfaceCss from './interface.css?inline'\nimport './controls.css'\nimport { createElement } from 'react'\nimport { InterfaceToggle } from './InterfaceToggle.tsx'\nimport { createPresentationController } from './presentation.ts'\nimport { injectSlot } from './slot-compat.ts'\nimport { createWorkflowSelection, connectWorkflowSelection, type WorkflowSelection } from './workflow-selection.ts'\nimport { registerPluginUpdates } from './register-updates.ts'\nimport { createContentStore, type ContentStore } from './content-store.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap { cannbotHarness: LocaleKey }\n}\nexport const inject = ['slots', 'theme', 'locale', 'sessions', 'conversation']\n\n/** Register presentation with an explicit disposer so the original entries remain live underneath. */\nfunction mountInterface(ctx: Context, selection: WorkflowSelection, content: ContentStore): () => void {\n const style = document.createElement('style')\n style.dataset.cannbotHarness = 'interface'\n style.textContent = interfaceCss\n document.head.append(style)\n const releases = [\n ctx.theme.overrideTokens(PACKAGE, cannTheme),\n injectSlot(ctx, 'sidebar.brand.mark', () => ctx.slots.register({ name: 'sidebar.brand.mark', priority: -100 }, SidebarMark)),\n injectSlot(ctx, 'sidebar.brand.name', () => ctx.slots.register({ name: 'sidebar.brand.name', priority: -100 }, SidebarName)),\n injectSlot(ctx, 'conversation.hero.brand.mark', () => ctx.slots.register({ name: 'conversation.hero.brand.mark', priority: -100 }, Hero)),\n injectSlot(ctx, 'conversation.hero.agentPreset', () => ctx.slots.register({ name: 'conversation.hero.agentPreset', priority: -100, locale: NAMESPACE }, props => createElement(WorkflowCompat, { ...props, ctx, selection, content }))),\n ]\n return () => { for (const release of releases.reverse()) release(); style.remove() }\n}\n\nexport function apply(ctx: Context): void {\n const content = createContentStore()\n ctx.effect(() => content.start())\n registerPluginUpdates(ctx, content)\n const selection = createWorkflowSelection((sessionId, reason) => {\n const blocks = ctx.conversation.blocks\n const id = sessionId as Parameters<typeof blocks.set>[0]\n const store = blocks.storeFor(id)\n // Do not replace a block owned by another DSH plugin.\n if (store.getSnapshot() !== undefined) return () => {}\n const block = { reason }\n blocks.set(id, block)\n return () => { if (store.getSnapshot() === block) blocks.set(id, undefined) }\n }, content.prepare)\n connectWorkflowSelection(ctx, selection)\n ctx.effect(() => () => selection.dispose())\n ctx.effect(() => ctx.locale.register(NAMESPACE, { zh, en, ja: en, es: en, fr: en, de: en, ru: en, pt: en }))\n ctx.effect(() => {\n const controller = createPresentationController(() => mountInterface(ctx, selection, content))\n const releaseToggle = injectSlot(ctx, 'sidebar.footer.action', () => ctx.slots.register({\n name: 'sidebar.footer.action', id: 'cannbot-harness-interface', order: -100,\n }, props => createElement(InterfaceToggle, { ...props, controller })))\n return () => { releaseToggle(); controller.dispose() }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,MAAa,UAAU;EACvB,MAAa,YAAY;EACzB,MAAa,UAAU;EAGvB,MAAa,KAAK;GAChB,gBAAgB;GAAS,cAAc;GAAW,gBAAgB;GAAQ,eAAe;GAAQ,eAAe;GAChH,gBAAgB;GAAM,eAAe;GAAM,iBAAiB;GAAO,iBAAiB;GAAQ,kBAAkB;GAAU,qBAAqB;GAAO,oBAAoB;GACxK,cAAc;GAAS,aAAa;GAAW,aAAa;GAAS,oBAAoB;GACzF,qBAAqB;GAAsB,cAAc;GACzD,eAAe;GAA6B,iBAAiB;GAAkB,kBAAkB;GAAW,aAAa;GACzH,kBAAkB;GAAkB,gBAAgB;GACpD,cAAc;GAA0B,sBAAsB;GA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,CAAC;IACrD,MAAM,QAAQ,EAAE,OAAO;IACvB,OAAO,IAAI,IAAI,KAAK;IACpB,aAAa;KAAE,IAAI,MAAM,YAAY,MAAM,OAAO,OAAO,IAAI,IAAI,KAAA,CAAS;IAAE;GAC9E,GAAG,QAAQ,OAAO;GAClB,yBAAyB,KAAK,SAAS;GACvC,IAAI,mBAAmB,UAAU,QAAQ,CAAC;GAC1C,IAAI,aAAa,IAAI,OAAO,SAAS,WAAW;IAAE;IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;GAAG,CAAC,CAAC;GAC3G,IAAI,aAAa;IACf,MAAM,aAAa,mCAAmC,eAAe,KAAK,WAAW,OAAO,CAAC;IAC7F,MAAM,gBAAgB,WAAW,KAAK,+BAA+B,IAAI,MAAM,SAAS;KACtF,MAAM;KAAyB,IAAI;KAA6B,OAAO;IACzE,IAAG,WAAA,GAAA,MAAA,cAAA,CAAuB,iBAAiB;KAAE,GAAG;KAAO;IAAW,CAAC,CAAC,CAAC;IACrE,aAAa;KAAE,cAAc;KAAG,WAAW,QAAQ;IAAE;GACvD,CAAC;EACH"}
1
+ {"version":3,"file":"client.js","names":["primitives","primitives","LegacyMenu","unwrap","raw","Fragment","interfaceCss"],"sources":["../src/client/locales.ts","../src/client/Brand.tsx","../src/workflows.ts","../src/client/WorkflowIcon.tsx","../src/content-types.ts","../src/client/content-store.ts","../src/client/WorkflowSelector.tsx","../src/client/WorkflowCompat.tsx","../src/client/theme.ts","../src/client/InterfaceToggle.tsx","../src/client/presentation.ts","../src/client/slot-compat.ts","../src/client/workflow-selection.ts","../src/client/plugin-update.ts","../src/client/PluginUpdateCard.tsx","../src/client/host-update.ts","../src/client/ContentCard.tsx","../src/client/register-updates.ts","../src/client/index.ts"],"sourcesContent":["export const PRODUCT = 'CANNBot Harness'\nexport const NAMESPACE = 'cannbotHarness'\nexport const PACKAGE = '@cannbot-plugin/cannbot-harness'\nexport const COMMAND = '/ops-direct-invoke'\n\nexport const zh = {\n contentCatalog: '工作流目录', contentCheck: '检查工作流更新', contentVersion: '当前版本', contentLatest: '最新版本', contentPinned: '已固定回退版本',\n contentInstall: '安装', contentUpdate: '更新', contentRollback: '回退到', contentUpToDate: '已是最新', contentUnchecked: '已安装,可使用', contentNotInstalled: '未安装', contentUnavailable: '暂不可用',\n contentTitle: '工作流管理', contentSync: '更新全部工作流', contentBusy: '正在准备…', contentDownloading: '正在从 npm 获取独立工作流包…',\n contentInitializing: '正在执行官方安装器,准备工作区依赖…', contentReady: '工作流已准备完成,可独立更新。选择工作流时自动准备当前工作区。',\n contentFailed: '准备未完成。已有工作流版本保留;请查看日志后重试。', contentFallback: '正在准备首次安装的工作流包。', contentWorkflows: '个已安装工作流', contentLogs: '查看准备日志',\n updateBackground: '后台正在更新,请勿重复安装。', updateRestored: '更新失败,已恢复旧版。',\n updateRepair: '更新和恢复未完成,请在插件页重新安装原版本。', updateConnectionLost: '连接中断,后台更新可能仍在进行。请重新打开插件页确认版本,勿重复安装。', updateDismiss: '关闭更新提示',\n updateTitle: '版本更新', updateCurrent: '当前版本', updateCheck: '检查更新', updateChecking: '正在检查…',\n updateTo: '更新到', updateRunning: '正在更新…', updateAvailable: '发现新版本,点击上方按钮更新。',\n updateLatest: '当前已是最新版本。', updateDone: '更新已完成。', updateRestart: '新版已安装,重启 DSH 后生效。',\n updateManual: '当前 DSH 要求先卸载旧版。请先下载新版包,再在插件页卸载旧版并添加下载的安装包。',\n updateIncompatible: '当前 DSH 不支持此版本,请先升级 DSH。', updateFailed: '暂时无法完成,请稍后重试。', updateDownload: '下载新版安装包',\n workflow: '选择工作流', ordinary: '普通对话', saving: '正在应用工作流…', operator: '算子开发工作流', commandHint: '发送时自动应用所选工作流,只需填写需求。',\n flash: 'Ascend C Flash 核函数开发', registry: 'ACLNN / GEIR 注册算子开发', model: 'NPU 模型推理优化',\n hccl: 'HCCL 通信算子开发', triton: 'Triton 算子开发', catlass: 'CATLASS 算子开发', performance: 'Ascend C 性能调优', pypto: 'PyPTO 算子开发',\n chooseWorkspace: '请先选择工作目录。', insertFailed: '工作流准备或设置未完成,请到插件详情查看准备日志后重试。',\n}\nexport const en: typeof zh = {\n contentCatalog: 'Workflow catalog', contentCheck: 'Check workflow updates', contentVersion: 'Installed', contentLatest: 'Latest', contentPinned: 'Rolled-back version pinned',\n contentInstall: 'Install', contentUpdate: 'Update', contentRollback: 'Roll back to', contentUpToDate: 'Up to date', contentUnchecked: 'Installed and ready', contentNotInstalled: 'Not installed', contentUnavailable: 'Unavailable',\n contentTitle: 'Workflow manager', contentSync: 'Update all workflows', contentBusy: 'Preparing…', contentDownloading: 'Fetching independent workflow packages from npm…',\n contentInitializing: 'Running the official installer to prepare workspace dependencies…', contentReady: 'Workflows are ready and can be updated independently. Selecting one prepares this workspace automatically.',\n contentFailed: 'Preparation did not finish. Existing workflow versions are retained; check the log and retry.', contentFallback: 'Preparing the first workflow package installation.', contentWorkflows: 'installed workflows', contentLogs: 'View preparation log',\n updateBackground: 'Updating in the background. Do not install again.', updateRestored: 'Update failed; the previous version was restored.',\n updateRepair: 'Update and recovery did not finish. Reinstall the previous version from Plugins.', updateConnectionLost: 'Connection lost. The Host may still be updating. Reopen Plugins to check the version before retrying.', updateDismiss: 'Dismiss update notice',\n updateTitle: 'Updates', updateCurrent: 'Installed version', updateCheck: 'Check for updates', updateChecking: 'Checking…',\n updateTo: 'Update to', updateRunning: 'Updating…', updateAvailable: 'A new version is available. Use the button above to update.',\n updateLatest: 'You are up to date.', updateDone: 'Update completed.', updateRestart: 'The update is installed. Restart DSH to apply it.',\n updateManual: 'This DSH version requires removing the old plugin first. Download the update, then uninstall the old plugin and add the downloaded package.',\n updateIncompatible: 'This release requires updating DSH first.', updateFailed: 'Unable to complete this operation. Please retry.', updateDownload: 'Download update',\n workflow: 'Choose workflow', ordinary: 'Ordinary conversation', saving: 'Applying workflow…', operator: 'Operator development workflow', commandHint: 'The selected workflow is applied in the background when you send.',\n flash: 'Ascend C Flash kernel development', registry: 'ACLNN / GEIR operator development', model: 'NPU model inference optimization',\n hccl: 'HCCL communication operators', triton: 'Triton operator development', catlass: 'CATLASS operator development', performance: 'Ascend C performance tuning', pypto: 'PyPTO operator development',\n chooseWorkspace: 'Choose a working directory first.', insertFailed: 'Workflow preparation or saving failed. Check preparation logs in the plugin details and retry.',\n}\nexport type LocaleKey = keyof typeof zh\n","import type { HeroBrandMarkOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type { SidebarBrandMarkOwnerProps } from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { PRODUCT } from './locales.ts'\n\nexport function Mark({ size }: { size: number }) {\n return <svg width={size} height={size} viewBox=\"0 0 40 40\" aria-hidden=\"true\">\n <rect x=\"1\" y=\"1\" width=\"38\" height=\"38\" rx=\"12\" fill=\"var(--dsw-alias-brand-primary)\" />\n <path d=\"M27 12a11 11 0 1 0 0 16\" fill=\"none\" stroke=\"var(--dsw-alias-label-primary-foreground)\" strokeWidth=\"4\" strokeLinecap=\"round\" />\n </svg>\n}\nexport function SidebarMark({ size }: SidebarBrandMarkOwnerProps) { return <Mark size={size} /> }\nexport function SidebarName() { return <span className=\"cannbot-harness-name\">{PRODUCT}</span> }\nexport function Hero({ size }: HeroBrandMarkOwnerProps) {\n return <span data-cannbot-harness-hero=\"\"><Mark size={size} /><span>{PRODUCT}</span></span>\n}\n","export const WORKFLOWS = [\n { id: 'ops-direct-invoke', label: 'operator' },\n { id: 'ops-direct-invoke-flash', label: 'flash' },\n { id: 'ops-registry-invoke', label: 'registry' },\n { id: 'model-infer-optimize', label: 'model' },\n { id: 'hccl-op-generator', label: 'hccl' },\n { id: 'triton-op-generator', label: 'triton' },\n { id: 'catlass-op-generator', label: 'catlass' },\n { id: 'ops-perf-optimize', label: 'performance' },\n { id: 'pypto-op-orchestrator', label: 'pypto' },\n] as const\n","import * as primitives from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ComponentType } from 'react'\n\n/** The exact icon component used by DSH's original Standard mode selector. */\nexport function WorkflowIcon({ size = 16 }: { size?: number }) {\n const icons = primitives as unknown as Record<string, ComponentType<{ size?: number }>>\n const Icon = icons.IconAgentPresetOutlineRegular ?? icons.IconAgentPresetOutline16 ?? icons.IconRefreshOutline16\n return Icon ? <Icon size={size} /> : null\n}\n\nexport function ChevronIcon({ size = 12 }: { size?: number }) {\n const icons = primitives as unknown as Record<string, ComponentType<{ size?: number }>>\n const Icon = icons.IconChevronDownOutlineRegular ?? icons.IconChevronDownOutline14\n return Icon ? <Icon size={size} /> : <svg width={size} height={size} viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\"><path d=\"m3 4.5 3 3 3-3\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" /></svg>\n}\n","export interface ContentPlugin { id: string; title: string; aliases: Record<string, string>; resourceDirectory?: string; version?: string; packageName?: string }\nexport interface ContentSkill { name: string; originalName: string; pluginId: string; path: string; entry: boolean }\nexport interface ContentCatalog { revision?: string; commit?: string; skillsCommit?: string; plugins: ContentPlugin[]; exposedSkills: ContentSkill[] }\nexport interface WorkflowEntry { id: string; title: string; package: string; default: boolean }\nexport interface WorkflowRow extends WorkflowEntry {\n version?: string; latest?: string; previous?: string; installed: boolean; pinned: boolean; error?: string\n}\nexport interface WorkflowDescriptor {\n schemaVersion: 1; id: string; title: string; version: string\n initialization: { kind: 'cannbot-cli'; entry: string } | { kind: 'skill-native' }\n skills: { name: string; path: string; hash: string; entry: boolean }[]\n source: { repository: string; commit: string; skillsCommit: string }\n}\nexport interface ContentStatus {\n phase: 'idle' | 'syncing' | 'ready' | 'error' | 'initializing'\n plugins: { id: string; title: string }[]\n commit?: string; skillsCommit?: string; updatedAt?: string\n fallback: boolean; message: string; log: string\n workflows?: WorkflowRow[]; busy?: boolean; catalogVersion?: string\n}\nexport const CONTENT_PATH = 'api/cannbot-harness/content'\n","import { WORKFLOWS } from '../workflows.ts'\nimport { CONTENT_PATH, type ContentStatus } from '../content-types.ts'\nexport interface DynamicWorkflow { id: string; title: string }\nconst initial: { workflows: DynamicWorkflow[]; status: ContentStatus | undefined } = { workflows: WORKFLOWS.map(({ id }) => ({ id, title: id })), status: undefined }\nexport function createContentStore() {\n let state = initial, closed = false, timer: ReturnType<typeof setTimeout> | undefined\n const listeners = new Set<() => void>()\n const publish = (status: ContentStatus) => { if (!closed) { state = { status, workflows: status.plugins }; for (const listener of listeners) listener() } }\n const endpoint = () => new URL(CONTENT_PATH, document.baseURI)\n const pull = async () => {\n try {\n const response = await fetch(endpoint(), { credentials: 'same-origin', cache: 'no-store', signal: AbortSignal.timeout(15000) })\n if (response.ok) {\n const status = await response.json() as ContentStatus\n if (Array.isArray(status.plugins) && status.plugins.every(item => /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(item.id) && typeof item.title === 'string')) publish(status)\n }\n } catch { /* Keep the last catalog across a short disconnect. */ }\n }\n const post = async (body: object) => {\n const response = await fetch(endpoint(), { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })\n if (!response.ok) { await pull(); throw new Error('CANNBot content preparation failed') }\n await pull()\n }\n return {\n getSnapshot: () => state,\n subscribe(listener: () => void) { listeners.add(listener); return () => { listeners.delete(listener) } },\n start() {\n const tick = async () => { await pull(); if (!closed) timer = setTimeout(() => { void tick() }, 3000) }\n void tick()\n return () => { closed = true; clearTimeout(timer); listeners.clear() }\n },\n sync: () => post({ action: 'sync' }),\n check: () => post({ action: 'check' }),\n update: (id: string, version: string) => post({ action: 'update', id, version }),\n rollback: (id: string) => post({ action: 'rollback', id }),\n prepare: (sessionId: string, id: string) => post({ action: 'prepare', sessionId, id }),\n }\n}\nexport type ContentStore = ReturnType<typeof createContentStore>\nexport const fallbackContent = { getSnapshot: () => initial, subscribe: (_: () => void) => () => {} }\n","import { useState, useSyncExternalStore, type ComponentType, type ReactNode } from 'react'\nimport * as primitives from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { WORKFLOWS } from '../workflows.ts'\nimport { WorkflowIcon, ChevronIcon } from './WorkflowIcon.tsx'\nimport type { WorkflowSelection } from './workflow-selection.ts'\nimport { fallbackContent, type ContentStore, type DynamicWorkflow } from './content-store.ts'\n\nexport type WorkflowProps = PropsRuntime<'conversation.hero.agentPreset'> & PropsLocale<'cannbotHarness'> & { selection: WorkflowSelection; content?: ContentStore }\n\n/** Select a workflow without submitting, replacing text, or discarding reference chips. */\nexport function WorkflowSelector({ sessionId, inputActions, useInput, t, selection, content = fallbackContent as ContentStore }: WorkflowProps) {\n const { workflows } = useSyncExternalStore(content.subscribe, content.getSnapshot)\n const title = (workflow: DynamicWorkflow) => { const known = WORKFLOWS.find(item => item.id === workflow.id); return known ? t(known.label) : workflow.title }\n const input = useInput(state => state)\n const saved = useSyncExternalStore(selection.subscribe, selection.getSnapshot)\n const [open, setOpen] = useState(false)\n const selected = workflows.find(workflow => sessionId && saved.values[sessionId] === workflow.id)\n const available = !!sessionId && saved.ready && !saved.pending && inputActions !== undefined && input !== undefined && input.phase === 'plain'\n const pick = (id: string) => {\n setOpen(false)\n if (sessionId && available) void selection.choose(sessionId, id, t('saving'))\n }\n const anchor = (\n <button type=\"button\" className=\"cannbot-harness-workflow-trigger\" aria-label={t('workflow')} aria-haspopup=\"menu\" aria-expanded={open}\n disabled={!available} title={inputActions === undefined ? t('chooseWorkspace') : t('commandHint')}\n onClick={() => setOpen(value => !value)}>\n <WorkflowIcon />\n <span className=\"cannbot-harness-workflow-label\">{selected ? title(selected) : t('workflow')}</span><ChevronIcon size={12} />\n </button>\n )\n const label = (workflow: DynamicWorkflow) => <span className=\"cannbot-harness-workflow-option\">\n <span>{title(workflow)}</span>\n <small lang=\"en\">{workflow.id}</small>\n </span>\n const { Menu, MenuItemButton } = primitives\n const LegacyMenu = Menu as unknown as ComponentType<{ open: boolean; anchor: ReactNode; portal: boolean; className: string; onClose(): void; selectedId?: string; onSelect(id: string): void; items: { id: string; label: ReactNode; icon: ReactNode }[] }>\n return <span className=\"cannbot-harness-workflow\">\n {typeof MenuItemButton === 'function' ? <Menu open={open} onClose={() => setOpen(false)} portal className=\"cannbot-harness-workflow-anchor\" anchor={anchor}>\n <MenuItemButton icon={<WorkflowIcon />} onSelect={() => pick('')}>{t('ordinary')}</MenuItemButton>\n {workflows.map(workflow => <MenuItemButton key={workflow.id} icon={<WorkflowIcon />} onSelect={() => pick(workflow.id)}>{label(workflow)}</MenuItemButton>)}\n </Menu> : <LegacyMenu open={open} onClose={() => setOpen(false)} portal className=\"cannbot-harness-workflow-anchor\" anchor={anchor}\n selectedId={selected?.id} items={[{ id: '', label: t('ordinary'), icon: <WorkflowIcon /> }, ...workflows.map(workflow => ({ id: workflow.id, label: label(workflow), icon: <WorkflowIcon /> }))]}\n onSelect={pick} />}\n {saved.error && <span role=\"alert\" className=\"cannbot-harness-error\">{t('insertFailed')}</span>}\n </span>\n}\n","import { useMemo, useSyncExternalStore } from 'react'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { WorkflowSelector, type WorkflowProps } from './WorkflowSelector.tsx'\n\n/** Older DSH declares the hero seat at root scope. Resolve its current session\n * through the public services rather than reaching into the editor or DOM. */\nexport function WorkflowCompat({ ctx, ...props }: WorkflowProps & { ctx: Context }) {\n return typeof props.useInput === 'function'\n ? <WorkflowSelector {...props} />\n : <LegacyWorkflow ctx={ctx} {...props} />\n}\n\nfunction LegacyWorkflow({ ctx, ...props }: WorkflowProps & { ctx: Context }) {\n type Input = ReturnType<Context['conversation']['input']['for']>\n const legacy = ctx as unknown as { sessions: { list: { subscribe(listener: () => void): () => void; getSnapshot(): { current?: string } }; scope(id: string): Context | undefined } }\n const sessions = useSyncExternalStore(legacy.sessions.list.subscribe, legacy.sessions.list.getSnapshot)\n const input = useMemo(() => {\n const scope = sessions.current && legacy.sessions.scope(sessions.current)\n return scope ? ctx.conversation.input.for(scope) as Input : undefined\n }, [ctx, sessions.current])\n const state = useSyncExternalStore(input?.state.subscribe ?? noSubscribe, input?.state.getSnapshot ?? noSnapshot)\n return <WorkflowSelector {...props} sessionId={sessions.current as WorkflowProps['sessionId']} useInput={select => state ? select(state) : undefined as never} inputActions={input ? {} as WorkflowProps['inputActions'] : undefined} />\n}\nconst noSubscribe = () => () => {}\nconst noSnapshot = () => undefined\n","import type { ThemeTokenOverrides } from '@deepseek-ai/dsh-client-ui-theme/client'\n\n/** Portal design-v2 palette, applied through the documented theme override layer. */\nexport const cannTheme: ThemeTokenOverrides = Object.fromEntries(Object.entries({\n '--dsw-alias-bg-base': ['#ffffff', '#101114'],\n '--dsw-alias-bg-layer-1': ['#ffffff', '#17191e'],\n '--dsw-alias-bg-layer-2': ['#ffffff', '#1d2026'],\n '--dsw-alias-bg-layer-3': ['#f6f8fa', '#252830'],\n '--dsw-specific-sidebar-fill': ['#f6f8fa', '#14161b'],\n '--dsw-specific-input-major': ['#ffffff', '#1d2026'],\n '--dsw-specific-sidebar-nav-item-active': ['#fdeef0', '#392029'],\n '--dsw-specific-sidebar-nav-item-active-accent': ['#fdeef0', '#392029'],\n '--dsw-alias-label-primary': ['#17181d', '#f3f4f6'],\n '--dsw-alias-label-primary-foreground': ['#ffffff', '#ffffff'],\n '--dsw-alias-label-primary-inverted': ['#ffffff', '#ffffff'],\n '--dsw-alias-label-primary-dimmed': ['#30343e', '#dde1e8'],\n '--dsw-alias-label-primary-bluish': ['#7f0f26', '#ff9aab'],\n '--dsw-alias-label-secondary': ['#59637a', '#b0b8c7'],\n '--dsw-alias-label-tertiary': ['#727d91', '#929db0'],\n '--dsw-alias-brand-primary': ['#da203e', '#ef4560'],\n '--dsw-alias-brand-text': ['#17181d', '#f3f4f6'],\n '--dsw-alias-button-primary-hover': ['#b11430', '#ff647d'],\n '--dsw-alias-button-info-fill': ['#da203e', '#da203e'],\n '--dsw-alias-button-info-hover': ['#b11430', '#b11430'],\n '--dsw-alias-state-business-primary': ['#da203e', '#ff8297'],\n '--dsw-alias-state-business-tertiary': ['#fdeef0', '#392029'],\n '--dsw-alias-link': ['#b11430', '#ff9aab'],\n '--dsw-focus-ring-color': ['#da203e', '#ff8297'],\n '--dsw-alias-border-l1': ['#f0f1f5', '#252830'],\n '--dsw-alias-border-l2': ['#e6e9ef', '#323641'],\n '--dsw-alias-border-l3': ['#dce0e8', '#414754'],\n '--dsw-alias-border-l4': ['#ced4df', '#505867'],\n '--dsw-alias-interactive-bg-hover': ['#eef0f4', '#252830'],\n '--dsw-alias-interactive-bg-active': ['#fdeef0', '#392029'],\n '--dsw-specific-bubble': ['#fff3f5', '#302027'],\n '--dsw-specific-bubble-highlight': ['#fbd6dd', '#59303d'],\n '--dsw-radius-panel': ['18px', '18px'],\n '--dsw-radius-xl': ['14px', '14px'],\n '--dsw-radius-lg': ['12px', '12px'],\n '--dsw-radius-md': ['10px', '10px'],\n '--cann-grid': ['#e6e9ef', '#323641'],\n '--cann-night': ['#0e0f12', '#0e0f12'],\n '--cann-night-label': ['#dde1e8', '#dde1e8'],\n}).map(([name, values]) => [name, { light: values[0]!, dark: values[1]! }]))\n","import { useSyncExternalStore } from 'react'\nimport type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { PresentationController } from './presentation.ts'\nimport { Mark } from './Brand.tsx'\nimport { PRODUCT } from './locales.ts'\n\nexport function InterfaceToggle({ wide, controller }: PropsRuntime<'sidebar.footer.action'> & { controller: PresentationController }) {\n const enabled = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot)\n return <div className={`cannbot-harness-toggle${wide ? '' : ' cannbot-harness-toggle-compact'}`}>\n <span className=\"cannbot-harness-toggle-name\" title={PRODUCT}><Mark size={20} />{wide && <span>{PRODUCT}</span>}</span>\n <button type=\"button\" role=\"switch\" aria-label={PRODUCT} aria-checked={enabled} title={PRODUCT}\n className=\"cannbot-harness-switch\" onClick={() => controller.setEnabled(!enabled)}><span /></button>\n </div>\n}\n","/** Per-activation UI preference: enabling the plugin always starts with its interface on. */\nexport interface PresentationController {\n getSnapshot(): boolean\n subscribe(listener: () => void): () => void\n setEnabled(enabled: boolean): void\n dispose(): void\n}\nexport function createPresentationController(mount: () => () => void): PresentationController {\n let enabled = true\n let stopped = false\n let unmount: (() => void) | undefined = mount()\n const listeners = new Set<() => void>()\n return {\n getSnapshot: () => enabled,\n subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener) } },\n setEnabled(next) {\n if (stopped || next === enabled) return\n if (next) unmount = mount()\n else { unmount?.(); unmount = undefined }\n enabled = next\n for (const listener of listeners) listener()\n },\n dispose() { if (stopped) return; stopped = true; unmount?.(); unmount = undefined; listeners.clear() },\n }\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport type { SlotMap } from '@deepseek-ai/dsh-client-ui-slots'\n\n/** Older DSH declares the injected parent modules before this plugin and uses direct register(). */\nexport function injectSlot(ctx: Context, name: keyof SlotMap & string, register: () => () => void): () => void {\n return typeof ctx.slots.inject === 'function' ? ctx.slots.inject(name, register) : register()\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\nimport { WORKFLOWS } from '../workflows.ts'\n\nconst NS = 'cannbot-harness'\ntype Values = Record<string, string>\ninterface Choice { sessionId: string; workflow: string }\ninterface View { ns: string; value: { selections?: Choice[] }; revision?: number }\nconst valuesOf = (view?: View): Values => Object.fromEntries((view?.value.selections ?? []).map(item => [item.sessionId, item.workflow]))\nexport interface WorkflowTransport {\n describe(): Promise<{ namespaces: View[] }>\n update(ns: string, patch: { selections: Choice[] }, revision?: number): Promise<View>\n}\nexport interface SelectionSnapshot { ready: boolean; pending: boolean; error: boolean; values: Values }\nexport interface WorkflowSelection {\n subscribe(listener: () => void): () => void\n getSnapshot(): SelectionSnapshot\n attach(transport: WorkflowTransport): () => void\n choose(sessionId: string, workflow: string, reason?: string): Promise<void>\n dispose(): void\n}\nexport function createWorkflowSelection(blockSubmission: (sessionId: string, reason: string) => () => void = () => () => {}, prepare: (sessionId: string, id: string) => Promise<void> = async () => {}): WorkflowSelection {\n let snapshot: SelectionSnapshot = { ready: false, pending: false, error: false, values: {} }\n let transport: WorkflowTransport | undefined\n let generation = 0\n let pendingRelease: (() => void) | undefined\n const listeners = new Set<() => void>()\n const publish = (next: SelectionSnapshot) => { snapshot = next; for (const listener of listeners) listener() }\n return {\n subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener) } },\n getSnapshot: () => snapshot,\n attach(next) {\n transport = next\n const own = ++generation\n void next.describe().then(view => {\n if (own !== generation) return\n const section = view.namespaces.find(item => item.ns === NS)\n publish({ ready: !!section, pending: false, error: !section, values: valuesOf(section) })\n }).catch(() => { if (own === generation) publish({ ...snapshot, ready: false, error: true }) })\n return () => { if (own === generation) { generation++; transport = undefined; publish({ ...snapshot, ready: false }) } }\n },\n async choose(sessionId, workflow, reason = 'CANNBot Harness…') {\n if (!transport || !snapshot.ready || snapshot.pending) return\n if (workflow !== '' && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(workflow)) throw new Error('Unknown workflow')\n const current = transport, own = generation\n const unblock = blockSubmission(sessionId, reason)\n let released = false\n const release = () => { if (!released) { released = true; unblock() } }\n pendingRelease = release\n publish({ ...snapshot, pending: true, error: false })\n try {\n if (workflow) await prepare(sessionId, workflow)\n // Fresh revision prevents simultaneous windows from overwriting selections.\n const view = (await current.describe()).namespaces.find(item => item.ns === NS)\n if (!view) throw new Error('Workflow settings unavailable')\n const values = { ...valuesOf(view), [sessionId]: workflow }\n const selections = Object.entries(values).filter(([, id]) => id !== '').map(([sessionId, workflow]) => ({ sessionId, workflow }))\n const result = await current.update(NS, { selections }, view.revision)\n if (own === generation) publish({ ready: true, pending: false, error: false, values: valuesOf(result) })\n } catch {\n if (own === generation) publish({ ...snapshot, pending: false, error: true })\n } finally {\n release()\n if (pendingRelease === release) pendingRelease = undefined\n }\n },\n dispose() { generation++; transport = undefined; pendingRelease?.(); pendingRelease = undefined; listeners.clear() },\n }\n}\n\n/** Both transports are official DSH settings APIs; no private editor access. */\nexport function connectWorkflowSelection(ctx: Context, selection: WorkflowSelection) {\n ctx.inject(['remote', 'remote.settings'], scoped => {\n const settings = scoped.remote.settings\n scoped.effect(() => selection.attach({\n describe: async () => unwrap(await settings.describe()),\n update: async (ns, patch, revision) => unwrap(await settings.update(ns, patch, revision)),\n }))\n })\n ctx.inject(['connection'], scoped => {\n const api = (scoped as unknown as { connection: { api?: { settings: { describe(payload: object): Promise<unknown>; update(payload: object): Promise<unknown> } } } }).connection.api\n if (!api?.settings) return\n scoped.effect(() => selection.attach({\n describe: async () => unwrap(await api.settings.describe({})),\n update: async (ns, patch, expectedRevision) => unwrap(await api.settings.update({ ns, patch, expectedRevision })),\n }))\n })\n}\nfunction unwrap<T>(response: unknown): T {\n const raw = response as { result?: unknown }\n const result = (raw.result ?? response) as { ok: boolean; value: T; error?: { message: string } }\n if (!result.ok) throw new Error(result.error?.message ?? 'Workflow settings failed')\n return result.value\n}\n","export const UPDATE_PACKAGES = ['cannbot-harness', '@cannbot-plugin/cannbot-harness'] as const\nexport interface InstalledBundle { name: string; version?: string; installed: boolean }\nexport interface Change { application: string; error?: { code: string }; version?: string }\nexport interface UpdateBridge {\n list(): Promise<InstalledBundle[]>\n install(spec: string): Promise<Change>\n update?(name: string, version: string): Promise<{ result: Change; restore?: Change }>\n}\nexport interface Release { name: string; version: string; tarball: string }\nexport type UpdatePhase = 'idle' | 'checking' | 'latest' | 'available' | 'updating' | 'done' | 'restart' | 'manual' | 'incompatible' | 'error'\nexport interface UpdateSnapshot { phase: UpdatePhase; current?: string; release?: Release; packageName?: string }\n\n/** Only stable npm releases of our two installation entries may be selected. */\nexport function newerVersion(candidate: string, current: string): boolean {\n const next = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(candidate)\n const old = /^(\\d+)\\.(\\d+)\\.(\\d+)(?:[-+].*)?$/.exec(current)\n if (!next || !old) return false\n for (let index = 1; index < 4; index++) {\n const difference = Number(next[index]) - Number(old[index])\n if (difference) return difference > 0\n }\n return current.includes('-')\n}\n\nexport async function latestRelease(name: string, signal: AbortSignal): Promise<Release> {\n if (!UPDATE_PACKAGES.includes(name as typeof UPDATE_PACKAGES[number])) throw new Error('Unsupported update target')\n const answers = await Promise.allSettled(['https://registry.npmjs.org/', 'https://registry.npmmirror.com/'].map(async registry => {\n const response = await fetch(`${registry}${encodeURIComponent(name)}/latest`, {\n signal: AbortSignal.any([signal, AbortSignal.timeout(15000)]), cache: 'no-store',\n })\n if (!response.ok) throw new Error('Registry unavailable')\n const manifest = await response.json() as { name?: string; version?: string; dist?: { tarball?: string }; dsh?: { bundle?: unknown } }\n if (manifest.name !== name || !manifest.version || !/^\\d+\\.\\d+\\.\\d+$/.test(manifest.version) || !manifest.dsh?.bundle || !manifest.dist?.tarball) throw new Error('Invalid release')\n const url = new URL(manifest.dist.tarball)\n if (url.protocol !== 'https:' || !['registry.npmjs.org', 'registry.npmmirror.com'].includes(url.hostname)) throw new Error('Invalid download origin')\n return { name, version: manifest.version, tarball: url.href }\n }))\n signal.throwIfAborted()\n const releases = answers.flatMap(answer => answer.status === 'fulfilled' ? [answer.value] : [])\n const latest = releases.reduce<Release | undefined>((best, release) => !best || newerVersion(release.version, best.version) ? release : best, undefined)\n if (!latest) throw new Error('No release available')\n return latest\n}\n\nexport function createPluginUpdater(bridge: UpdateBridge, requestedName: string, lookup = latestRelease) {\n let state: UpdateSnapshot = { phase: 'idle' }\n let disposed = false\n let checking: AbortController | undefined\n const listeners = new Set<() => void>()\n const publish = (next: UpdateSnapshot) => { if (disposed) return; state = next; for (const listener of listeners) listener() }\n const failed = (result: Change) => !['applied', 'restart-required'].includes(result.application) || !!result.error\n return {\n getSnapshot: () => state,\n subscribe(listener: () => void) { listeners.add(listener); return () => { listeners.delete(listener) } },\n async check() {\n if (disposed || state.phase === 'checking' || state.phase === 'updating') return\n checking?.abort()\n const abort = new AbortController()\n checking = abort\n publish({ ...state, phase: 'checking' })\n try {\n const bundles = (await bridge.list()).filter(bundle => bundle.installed && UPDATE_PACKAGES.includes(bundle.name as typeof UPDATE_PACKAGES[number]))\n // Update the actual direct dependency, preserving short/long installation form.\n const bundle = bundles.find(bundle => bundle.name === requestedName) ?? bundles[0]\n if (!bundle?.version) throw new Error('Installed entry unavailable')\n publish({ ...state, current: bundle.version, packageName: bundle.name })\n const release = await lookup(bundle.name, abort.signal)\n if (checking !== abort || disposed) return\n publish({ phase: newerVersion(release.version, bundle.version) ? 'available' : 'latest', current: bundle.version, release, packageName: bundle.name })\n } catch {\n if (!abort.signal.aborted) publish({ ...state, phase: 'error' })\n }\n },\n async update() {\n if (disposed || state.phase !== 'available' || !state.release || !state.packageName) return\n const target = state.release, name = state.packageName\n publish({ ...state, phase: 'updating' })\n try {\n // The Host owns the complete transaction, including self-removal and recovery.\n // Frontend disposal must never cancel an update that already started.\n const answer = bridge.update\n ? await bridge.update(name, target.version)\n : { result: await bridge.install(`${name}@${target.version}`) }\n const result = answer.result\n if (failed(result)) {\n const code = result.error?.code\n publish({ ...state, phase: code === 'already-installed' || code === 'stop-profile' ? 'manual' : code === 'incompatible-version' ? 'incompatible' : 'error' })\n } else {\n publish({ ...state, phase: result.application === 'restart-required' ? 'restart' : 'done', current: target.version })\n }\n } catch { publish({ ...state, phase: 'error' }) }\n },\n dispose() { disposed = true; checking?.abort(); listeners.clear() },\n }\n}\nexport type PluginUpdater = ReturnType<typeof createPluginUpdater>\n","import { useEffect, useSyncExternalStore } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { PluginUpdater } from './plugin-update.ts'\n\nexport function PluginUpdateCard({ updater, t }: { updater: PluginUpdater } & PropsLocale<'cannbotHarness'>) {\n const state = useSyncExternalStore(updater.subscribe, updater.getSnapshot)\n useEffect(() => { void updater.check() }, [updater])\n const busy = state.phase === 'checking' || state.phase === 'updating'\n const canUpdate = state.phase === 'available'\n const message = state.phase === 'latest' ? t('updateLatest')\n : state.phase === 'available' ? t('updateAvailable')\n : state.phase === 'updating' ? t('updateRunning')\n : state.phase === 'done' ? t('updateDone')\n : state.phase === 'restart' ? t('updateRestart')\n : state.phase === 'manual' ? t('updateManual')\n : state.phase === 'incompatible' ? t('updateIncompatible')\n : state.phase === 'error' ? t('updateFailed') : ''\n return <section className=\"cannbot-harness-update\" aria-label={t('updateTitle')}>\n <div className=\"cannbot-harness-update-heading\"><h4>{t('updateTitle')}</h4>\n {state.current && <span>{t('updateCurrent')} {state.current}</span>}</div>\n <div className=\"cannbot-harness-update-actions\">\n {state.phase === 'manual' && state.release ? <>\n <a className=\"cannbot-harness-update-button\" href={state.release.tarball} download rel=\"noreferrer\">{t('updateDownload')} {state.release.version}</a>\n <button type=\"button\" className=\"cannbot-harness-update-recheck\" onClick={() => { void updater.check() }}>{t('updateCheck')}</button>\n </> :\n <button type=\"button\" className=\"cannbot-harness-update-button\" disabled={busy}\n onClick={() => { void (canUpdate ? updater.update() : updater.check()) }}>\n {state.phase === 'checking' ? t('updateChecking') : state.phase === 'updating' ? t('updateRunning')\n : canUpdate ? `${t('updateTo')} ${state.release?.version}` : t('updateCheck')}\n </button>\n }\n </div>\n {message && <p role={state.phase === 'error' ? 'alert' : 'status'} aria-live=\"polite\">{message}</p>}\n </section>\n}\n","import type { Change } from './plugin-update.ts'\nimport { en, zh } from './locales.ts'\n\n/** This notice belongs to the in-flight update, so removing the plugin must not remove it. */\nexport async function updateOnHost(name: string, version: string): Promise<{ result: Change; restore?: Change }> {\n const words = document.documentElement.lang.startsWith('en') ? en : zh\n const notice = document.createElement('div')\n notice.setAttribute('role', 'status')\n notice.setAttribute('aria-live', 'polite')\n notice.dataset.cannbotUpdate = 'progress'\n Object.assign(notice.style, { position: 'fixed', bottom: '24px', right: '24px', zIndex: '2147483647',\n maxWidth: 'min(380px, calc(100vw - 48px))', padding: '16px', borderRadius: '12px',\n background: 'var(--dsw-alias-bg-base, white)', color: 'var(--dsw-alias-label-primary, #222)',\n border: '1px solid var(--dsw-alias-border-l2, #ddd)', boxShadow: '0 8px 32px #0002', fontSize: '13px', lineHeight: '1.6' })\n const text = document.createElement('span')\n text.textContent = `${words.updateRunning} ${version} · ${words.updateBackground}`\n notice.append(text)\n document.body.append(notice)\n try {\n const response = await fetch(new URL('api/cannbot-harness/update', document.baseURI), {\n method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ name, version }),\n // No plugin-lifetime abort: its own uninstall is expected during the transaction.\n })\n if (!response.ok) throw new Error('Host update unavailable')\n const answer = await response.json() as { result: Change; restore?: Change }\n if (!answer?.result || typeof answer.result.application !== 'string') throw new Error('Invalid update result')\n const succeeded = (result: Change) => !result.error && ['applied', 'restart-required'].includes(result.application)\n text.textContent = succeeded(answer.result)\n ? `${answer.result.application === 'restart-required' ? words.updateRestart : words.updateDone} (${version})`\n : answer.restore ? succeeded(answer.restore) ? words.updateRestored : words.updateRepair : words.updateFailed\n return answer\n } catch (error) {\n text.textContent = words.updateConnectionLost\n throw error\n } finally {\n const close = document.createElement('button')\n close.type = 'button'; close.textContent = '×'; close.setAttribute('aria-label', words.updateDismiss)\n Object.assign(close.style, { marginLeft: '12px', border: '0', background: 'transparent', color: 'inherit', cursor: 'pointer', fontSize: '18px' })\n close.addEventListener('click', () => notice.remove(), { once: true })\n notice.append(close)\n }\n}\n","import { useState, useSyncExternalStore } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ContentStore } from './content-store.ts'\nimport { newerVersion } from './plugin-update.ts'\nexport function ContentCard({ content, t }: { content: ContentStore } & PropsLocale<'cannbotHarness'>) {\n const { status } = useSyncExternalStore(content.subscribe, content.getSnapshot)\n const [failed, setFailed] = useState(false)\n const busy = status?.busy || status?.phase === 'syncing' || status?.phase === 'initializing'\n const act = (action: () => Promise<void>) => { setFailed(false); void action().catch(() => setFailed(true)) }\n return <section className=\"cannbot-harness-update cannbot-harness-content\" aria-label={t('contentTitle')}>\n <div className=\"cannbot-harness-update-heading\"><h4>{t('contentTitle')}</h4>\n {status?.catalogVersion && <span>{t('contentCatalog')} {status.catalogVersion}</span>}</div>\n <div className=\"cannbot-harness-update-actions\">\n <button type=\"button\" className=\"cannbot-harness-update-button\" disabled={busy} onClick={() => act(content.sync)}>{busy ? t('contentBusy') : t('contentSync')}</button>\n <button type=\"button\" className=\"cannbot-harness-update-recheck\" disabled={busy} onClick={() => act(content.check)}>{t('contentCheck')}</button>\n </div>\n <p role={failed || status?.phase === 'error' ? 'alert' : 'status'} aria-live=\"polite\">\n {failed || status?.phase === 'error' ? t('contentFailed') : status?.phase === 'initializing' ? t('contentInitializing') : status?.phase === 'syncing' ? t('contentDownloading') : status?.fallback ? t('contentFallback') : t('contentReady')}\n </p>\n {status && <p>{status.plugins.length} {t('contentWorkflows')}</p>}\n <div className=\"cannbot-harness-workflow-packages\">\n {status?.workflows?.map(row => {\n const available = row.latest && (!row.version || newerVersion(row.latest, row.version))\n return <div className=\"cannbot-harness-workflow-package\" key={row.id}>\n <div><strong>{row.title}</strong><small lang=\"en\">{row.package}</small>\n <small>{row.version ? `${t('contentVersion')} ${row.version}` : t('contentNotInstalled')}\n {available && ` · ${t('contentLatest')} ${row.latest}`}{row.pinned && ` · ${t('contentPinned')}`}</small>\n {row.error && <small role=\"alert\">{row.error}</small>}</div>\n <div className=\"cannbot-harness-workflow-package-actions\">\n {available ? <button type=\"button\" className=\"cannbot-harness-update-recheck\" disabled={busy}\n aria-label={`${row.installed ? t('contentUpdate') : t('contentInstall')} ${row.title}`}\n onClick={() => act(() => content.update(row.id, row.latest!))}>{row.installed ? t('contentUpdate') : t('contentInstall')}</button>\n : <small>{row.installed ? row.latest ? t('contentUpToDate') : t('contentUnchecked') : t('contentUnavailable')}</small>}\n {row.previous && <button type=\"button\" className=\"cannbot-harness-update-recheck\" disabled={busy}\n aria-label={`${t('contentRollback')} ${row.title}`} onClick={() => act(() => content.rollback(row.id))}>{t('contentRollback')} {row.previous}</button>}\n </div>\n </div>\n })}\n </div>\n {(status?.log || status?.message) && <details><summary>{t('contentLogs')}</summary><pre>{status.message}{'\\n'}{status.log}</pre></details>}\n </section>\n}\n","import { createElement, Fragment } from 'react'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { createPluginUpdater, UPDATE_PACKAGES } from './plugin-update.ts'\nimport { PluginUpdateCard } from './PluginUpdateCard.tsx'\nimport { NAMESPACE } from './locales.ts'\nimport { injectSlot } from './slot-compat.ts'\nimport { updateOnHost } from './host-update.ts'\nimport { ContentCard } from './ContentCard.tsx'\nimport type { ContentStore } from './content-store.ts'\n\n/** Optional integration: old DSH versions without a Plugins page keep loading. */\nexport function registerPluginUpdates(ctx: Context, content?: ContentStore) {\n ctx.inject(['remote', 'remote.pluginManager'], scoped => {\n const manager = scoped.remote.pluginManager\n for (const name of UPDATE_PACKAGES) {\n const updater = createPluginUpdater({\n list: async () => unwrap(await manager.listBundles()),\n install: async spec => unwrap(await manager.installBundle(spec, { saveExact: true })),\n update: updateOnHost,\n }, name)\n scoped.effect(() => () => updater.dispose())\n scoped.effect(() => injectSlot(scoped, 'plugins.bundle.config', () => scoped.slots.register({\n name: 'plugins.bundle.config', key: name, locale: NAMESPACE,\n }, props => createElement(Fragment, null,\n createElement(PluginUpdateCard, { ...(props as PropsLocale<'cannbotHarness'>), updater }),\n content && createElement(ContentCard, { ...(props as PropsLocale<'cannbotHarness'>), content })))))\n }\n })\n}\nfunction unwrap<T>(result: { ok: true; value: T } | { ok: false; error: unknown }): T {\n if (!result.ok) throw result.error\n return result.value\n}\n","/** Browser companion using the existing DSH theme, settings and UI slots. */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-theme/client'\nimport { en, zh, NAMESPACE, PACKAGE, type LocaleKey } from './locales.ts'\nimport { SidebarMark, SidebarName, Hero } from './Brand.tsx'\nimport { WorkflowCompat } from './WorkflowCompat.tsx'\nimport { cannTheme } from './theme.ts'\nimport interfaceCss from './interface.css?inline'\nimport './controls.css'\nimport { createElement } from 'react'\nimport { InterfaceToggle } from './InterfaceToggle.tsx'\nimport { createPresentationController } from './presentation.ts'\nimport { injectSlot } from './slot-compat.ts'\nimport { createWorkflowSelection, connectWorkflowSelection, type WorkflowSelection } from './workflow-selection.ts'\nimport { registerPluginUpdates } from './register-updates.ts'\nimport { createContentStore, type ContentStore } from './content-store.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap { cannbotHarness: LocaleKey }\n}\nexport const inject = ['slots', 'theme', 'locale', 'sessions', 'conversation']\n\n/** Register presentation with an explicit disposer so the original entries remain live underneath. */\nfunction mountInterface(ctx: Context, selection: WorkflowSelection, content: ContentStore): () => void {\n const style = document.createElement('style')\n style.dataset.cannbotHarness = 'interface'\n style.textContent = interfaceCss\n document.head.append(style)\n const releases = [\n ctx.theme.overrideTokens(PACKAGE, cannTheme),\n injectSlot(ctx, 'sidebar.brand.mark', () => ctx.slots.register({ name: 'sidebar.brand.mark', priority: -100 }, SidebarMark)),\n injectSlot(ctx, 'sidebar.brand.name', () => ctx.slots.register({ name: 'sidebar.brand.name', priority: -100 }, SidebarName)),\n injectSlot(ctx, 'conversation.hero.brand.mark', () => ctx.slots.register({ name: 'conversation.hero.brand.mark', priority: -100 }, Hero)),\n injectSlot(ctx, 'conversation.hero.agentPreset', () => ctx.slots.register({ name: 'conversation.hero.agentPreset', priority: -100, locale: NAMESPACE }, props => createElement(WorkflowCompat, { ...props, ctx, selection, content }))),\n ]\n return () => { for (const release of releases.reverse()) release(); style.remove() }\n}\n\nexport function apply(ctx: Context): void {\n const content = createContentStore()\n ctx.effect(() => content.start())\n registerPluginUpdates(ctx, content)\n const selection = createWorkflowSelection((sessionId, reason) => {\n const blocks = ctx.conversation.blocks\n const id = sessionId as Parameters<typeof blocks.set>[0]\n const store = blocks.storeFor(id)\n // Do not replace a block owned by another DSH plugin.\n if (store.getSnapshot() !== undefined) return () => {}\n const block = { reason }\n blocks.set(id, block)\n return () => { if (store.getSnapshot() === block) blocks.set(id, undefined) }\n }, content.prepare)\n connectWorkflowSelection(ctx, selection)\n ctx.effect(() => () => selection.dispose())\n ctx.effect(() => ctx.locale.register(NAMESPACE, { zh, en, ja: en, es: en, fr: en, de: en, ru: en, pt: en }))\n ctx.effect(() => {\n const controller = createPresentationController(() => mountInterface(ctx, selection, content))\n const releaseToggle = injectSlot(ctx, 'sidebar.footer.action', () => ctx.slots.register({\n name: 'sidebar.footer.action', id: 'cannbot-harness-interface', order: -100,\n }, props => createElement(InterfaceToggle, { ...props, controller })))\n return () => { releaseToggle(); controller.dispose() }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,MAAa,UAAU;EACvB,MAAa,YAAY;EACzB,MAAa,UAAU;EAGvB,MAAa,KAAK;GAChB,gBAAgB;GAAS,cAAc;GAAW,gBAAgB;GAAQ,eAAe;GAAQ,eAAe;GAChH,gBAAgB;GAAM,eAAe;GAAM,iBAAiB;GAAO,iBAAiB;GAAQ,kBAAkB;GAAW,qBAAqB;GAAO,oBAAoB;GACzK,cAAc;GAAS,aAAa;GAAW,aAAa;GAAS,oBAAoB;GACzF,qBAAqB;GAAsB,cAAc;GACzD,eAAe;GAA6B,iBAAiB;GAAkB,kBAAkB;GAAW,aAAa;GACzH,kBAAkB;GAAkB,gBAAgB;GACpD,cAAc;GAA0B,sBAAsB;GAAuC,eAAe;GACpH,aAAa;GAAQ,eAAe;GAAQ,aAAa;GAAQ,gBAAgB;GACjF,UAAU;GAAO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AAE,IAAI,MAAM,YAAY,MAAM,OAAO,OAAO,IAAI,IAAI,KAAA,CAAS;IAAE;GAC9E,GAAG,QAAQ,OAAO;GAClB,yBAAyB,KAAK,SAAS;GACvC,IAAI,mBAAmB,UAAU,QAAQ,CAAC;GAC1C,IAAI,aAAa,IAAI,OAAO,SAAS,WAAW;IAAE;IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;IAAI,IAAI;GAAG,CAAC,CAAC;GAC3G,IAAI,aAAa;IACf,MAAM,aAAa,mCAAmC,eAAe,KAAK,WAAW,OAAO,CAAC;IAC7F,MAAM,gBAAgB,WAAW,KAAK,+BAA+B,IAAI,MAAM,SAAS;KACtF,MAAM;KAAyB,IAAI;KAA6B,OAAO;IACzE,IAAG,WAAA,GAAA,MAAA,cAAA,CAAuB,iBAAiB;KAAE,GAAG;KAAO;IAAW,CAAC,CAAC,CAAC;IACrE,aAAa;KAAE,cAAc;KAAG,WAAW,QAAQ;IAAE;GACvD,CAAC;EACH"}
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ import z from "@deepseek-ai/schemastery";
8
8
  import { spawn } from "node:child_process";
9
9
  import { createHash, randomUUID } from "node:crypto";
10
10
  import { readFileSync, realpathSync, statSync } from "node:fs";
11
- import { mkdir, mkdtemp, open, readFile, realpath, rename, unlink, writeFile } from "node:fs/promises";
11
+ import { cp, mkdir, mkdtemp, open, readFile, realpath, rename, unlink, writeFile } from "node:fs/promises";
12
12
  import { homedir } from "node:os";
13
13
  //#region src/workflows.ts
14
14
  const WORKFLOWS = [
@@ -287,7 +287,7 @@ function checkedEntry(value) {
287
287
  if (!item || typeof item.id !== "string" || !validId(item.id) || item.package !== "@cannbot-plugin/workflow-" + item.id || typeof item.title !== "string" || item.title.length > 200 || typeof item.default !== "boolean") throw new Error("Invalid workflow catalog entry");
288
288
  return item;
289
289
  }
290
- /** Resource-only npm packages live in a private cache; they are not DSH bundle dependencies. */
290
+ /** npm installs the baseline; a private cache supports independent updates and rollback. */
291
291
  var ContentManager = class {
292
292
  root;
293
293
  index;
@@ -553,6 +553,58 @@ var ContentManager = class {
553
553
  });
554
554
  return this.pending;
555
555
  }
556
+ installDependencies(catalogFile, resolvePackage) {
557
+ return this.operation("dependencies", async () => {
558
+ const catalog = JSON.parse(await readFile(catalogFile, "utf8"));
559
+ if (catalog.name !== "@cannbot-plugin/workflow-catalog" || !validVersion(catalog.version) || catalog.cannbotWorkflowCatalog?.schemaVersion !== 1 || !Array.isArray(catalog.cannbotWorkflowCatalog.workflows)) throw new Error("Invalid installed workflow catalog");
560
+ const baseline = catalog.cannbotWorkflowCatalog.workflows.map(checkedEntry);
561
+ if (!baseline.length || new Set(baseline.map((item) => item.id)).size !== baseline.length) throw new Error("Invalid installed workflow entries");
562
+ const newerCatalog = this.index.catalogVersion && newerVersion(this.index.catalogVersion, catalog.version);
563
+ const entries = newerCatalog ? [...this.index.entries] : [...baseline];
564
+ for (const old of this.index.entries) if (!entries.some((item) => item.id === old.id)) entries.push(old);
565
+ await this.save({
566
+ ...this.index,
567
+ entries,
568
+ catalogVersion: newerCatalog ? this.index.catalogVersion : catalog.version
569
+ });
570
+ for (const entry of baseline.filter((item) => item.default)) {
571
+ if (this.index.records[entry.id]) continue;
572
+ if (!catalog.dependencies?.[entry.package]) throw new Error(`Workflow dependency missing: ${entry.package}`);
573
+ const packageFile = resolvePackage(entry.package);
574
+ const manifest = JSON.parse(await readFile(packageFile, "utf8"));
575
+ if (manifest.name !== entry.package || !validVersion(manifest.version)) throw new Error("Incorrect installed workflow dependency");
576
+ const parent = join(this.root, "packages", entry.id);
577
+ await mkdir(parent, { recursive: true });
578
+ const directory = await mkdtemp(join(parent, `${manifest.version}-dependency-`));
579
+ await cp(dirname(packageFile), directory, {
580
+ recursive: true,
581
+ dereference: true
582
+ });
583
+ const integrity = "dependency:" + createHash("sha512").update(await readFile(join(directory, "workflow.json"))).digest("base64");
584
+ const record = {
585
+ id: entry.id,
586
+ package: entry.package,
587
+ version: manifest.version,
588
+ integrity,
589
+ directory: relative(this.root, directory).split(sep).join("/"),
590
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
591
+ dependency: true
592
+ };
593
+ this.descriptor(record);
594
+ await this.save({
595
+ ...this.index,
596
+ records: {
597
+ ...this.index.records,
598
+ [entry.id]: record
599
+ }
600
+ });
601
+ }
602
+ this.publish({
603
+ phase: "ready",
604
+ message: "Installed workflow dependencies are ready."
605
+ });
606
+ });
607
+ }
556
608
  async checkPackages() {
557
609
  this.registry = REGISTRY;
558
610
  this.publish({
@@ -604,7 +656,7 @@ var ContentManager = class {
604
656
  this.validateManifest(entry, manifest);
605
657
  const previous = this.index.records[entry.id];
606
658
  if (previous?.version === manifest.version) {
607
- if (previous.integrity !== manifest.dist.integrity) throw new Error("A published workflow version changed integrity");
659
+ if (!previous.dependency && previous.integrity !== manifest.dist.integrity) throw new Error("A published workflow version changed integrity");
608
660
  continue;
609
661
  }
610
662
  if (previous && !newerVersion(manifest.version, previous.version)) continue;
@@ -889,15 +941,17 @@ function registerContentRoutes(ctx, content) {
889
941
  }
890
942
  }
891
943
  });
892
- if (process.env.CANNBOT_HARNESS_AUTOSYNC !== "0") content.sync().catch(() => {});
893
944
  });
894
945
  }
895
946
  //#endregion
896
947
  //#region src/index.ts
897
948
  const inject = ["skills"];
898
- function apply(ctx, config = {}) {
949
+ async function apply(ctx, config = {}) {
899
950
  registerHostUpdater(ctx);
900
951
  const content = new ContentManager(fileURLToPath(new URL("../workflow-defaults.json", import.meta.url)));
952
+ const catalogFile = createRequire(import.meta.url).resolve("@cannbot-plugin/workflow-catalog/package.json");
953
+ const dependencies = createRequire(catalogFile);
954
+ await content.installDependencies(catalogFile, (name) => dependencies.resolve(`${name}/package.json`));
901
955
  registerContentRoutes(ctx, content);
902
956
  installWorkflowContext(ctx, config, content);
903
957
  ctx.skills.registerProvider((control) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cannbot-plugin/cannbot-harness",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "CANNBot Harness: DSH interface with independently versioned npm workflow packages",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN THIRD_PARTY_NOTICES.md",
@@ -61,7 +61,8 @@
61
61
  "@deepseek-ai/dsh-skill": ">=0.1.1-0 <0.3.0"
62
62
  },
63
63
  "dependencies": {
64
- "pacote": "^21.0.3"
64
+ "pacote": "^21.0.3",
65
+ "@cannbot-plugin/workflow-catalog": "^1.0.2"
65
66
  },
66
67
  "devDependencies": {
67
68
  "yaml": "^2.4.2"