kexvar-launcher 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +44 -19
  2. package/lib/client.js +142 -47
  3. package/package.json +5 -3
package/README.md CHANGED
@@ -1,37 +1,56 @@
1
1
  # kexvar-launcher
2
2
 
3
- DeepSeek Harness 左侧栏里的 KEXVAR 入口。点击后只打开固定地址 <https://kexvar.apps.grok.bot/>。
3
+ DeepSeek Harness 左侧栏上方的 KEXVAR 入口。点击后在官方右侧栏浏览器里打开固定地址 <https://kexvar.apps.grok.bot/>,并留在当前会话。
4
4
 
5
- 英文包名、插件 id、插槽 id 和浏览器模块 id 都是 `kexvar-launcher`。界面上的文字是 `KEXVAR`。这个包不提供网页、控制台、账号代理或其它业务,也不改 KEXVAR 网站的登录。
5
+ 英文包名、插件 id、面板 id 和浏览器模块 id 都是 `kexvar-launcher`。界面文字是 `KEXVAR`。图标用官方地球符号 `dsw-icon-globe-outline-regular`。按钮、悬停和字号属于壳层的面板行,这个包不另画按钮。它不提供网页、控制台或账号代理,也不改 KEXVAR 网站。
6
+
7
+ `0.1.0` 把按钮放在左下并交给系统浏览器。`0.1.1` 去掉那个底栏按钮。
6
8
 
7
9
  ## 它出现在哪里
8
10
 
9
- Harness `0.2.2` 的左侧面板行(`sidebar.panellist`)没有外链字段。壳层按钮只会 `selectPanel(id)`;没有对应主面板时直接抛错。主面板会换掉当前会话视图,右侧栏浏览器则会把页面放进 iframe。这两处都不适合“点一下就离开 Harness 去打开网站”。
11
+ 入口注册在 `sidebar.panellist`,`order` 是 15。官方插件行是 0,自动化任务是 10。壳层按 `order` 排序。左侧「更多」是壳层自己的按钮,不是插件能注册的同一行。
10
12
 
11
- 因此入口注册在同一条左侧栏里、设置按钮上方的官方席位 `sidebar.footer.action`。这个席位的按钮归插件自己,点击不会切换主面板,也不会嵌入页面。
13
+ 同一 id 还注册一个 `main` 面板。壳层点击只会 `layout.selectPanel(id)`;没有对应主面板时直接抛错。这个主面板挂上后立刻 `selectPanel(null)`,回到当前会话。成功时主列不留说明页。
12
14
 
13
- 依据是标签 `dsh-v0.2.2-rc.3`(`38a6a5c965aa99ab525161efb7cc5cf1fe62fced`)。同一席位在 `dsh-v0.2.2-rc.1` 已经存在,并且 `master` 的 `39163dd30f703a79079e2d2446545cff3c453738` 里,席位声明和侧栏渲染顺序与该标签相同:
15
+ 依据是标签 `dsh-v0.2.2-rc.4`:
14
16
 
15
- - <https://github.com/deepseek-ai/deepseek-harness/blob/38a6a5c965aa99ab525161efb7cc5cf1fe62fced/packages/client/ui-sidebar/src/client/contract/slots.ts>
16
- - <https://github.com/deepseek-ai/deepseek-harness/blob/38a6a5c965aa99ab525161efb7cc5cf1fe62fced/packages/client/ui-sidebar/src/client/SidebarRoot.tsx>
17
+ - <https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.4/packages/client/ui-sidebar/src/client/index.ts>
18
+ - <https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.4/packages/client/ui-sidebar/src/client/SidebarRoot.tsx>
19
+ - <https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.4/packages/client/ui-primitives/src/icons/index.tsx>
17
20
 
18
21
  `engines.dsh` 声明为 `>=0.2.2-rc.1 <0.3.0`。更早版本未核验。`0.3.0` 及以后未核验。
19
22
 
20
23
  ## 点击后怎么打开
21
24
 
22
- 和内置浏览器工具栏的“在系统浏览器中打开”一样,调用:
25
+ 回到会话之后调用官方右侧栏:
23
26
 
24
27
  ```js
25
- window.open('https://kexvar.apps.grok.bot/', '_blank', 'noopener,noreferrer')
28
+ ctx.sidebarRight.openTab('browser', {
29
+ params: { url: 'https://kexvar.apps.grok.bot/' },
30
+ })
26
31
  ```
27
32
 
28
- - 新浏览上下文,不替换 Harness 当前窗口。
29
- - `noopener` 让目标页拿不到 `window.opener`。
30
- - `noreferrer` 不发送 Referer。
33
+ 官方 browser 类型 `multiple: true`。每次 `openTab` 的地址是 `sidebar://browser/` 加一个新的 id,所以再调用一次会多开一个标签。本插件记下第一次打开后 `active()` 的标签 id,再次点击改为 `sidebarRight.focus`。标签已经关掉时才重新 `openTab`。
34
+
31
35
  - 地址是源码里的常量,不加 query、fragment 或 token。
32
- - 桌面版主窗口对 `http:` / `https:` 的 `window.open` 会交给 `shell.openExternal`,并拒绝应用内新窗口。见 <https://github.com/deepseek-ai/deepseek-harness/blob/38a6a5c965aa99ab525161efb7cc5cf1fe62fced/apps/desktop/src/main.ts>。
36
+ - 不调用系统浏览器,也不另做页面容器。
37
+ - 没有会话表面时,官方调用会失败。插件改成一句可读的错误,并停在这个主面板上。
38
+ - 桌面版用官方 Electron 访客页。Web 档案走另一条实现,不在这个候选版的验收里。
39
+ - 右侧栏里的登录由 KEXVAR 网站自己完成。这个包不读 cookie,也不代登录。
40
+
41
+ ## 主题能不能传给网页
42
+
43
+ 能配合的只有系统级配色,没有给这个插件用的主题 URL。
44
+
45
+ 桌面预加载监视 `html[data-ds-theme-source]`,取值是 `light`、`dark` 或 `system`,再写到 Electron 的 `nativeTheme.themeSource`。官方说明这会让各渲染端的 `prefers-color-scheme` 跟随应用,而不是只跟随操作系统。侧栏访客页的附着参数里没有单独的主题字段,加载地址就是调用方给出的 URL。
46
+
47
+ `theme=light` 或 `theme=dark` 只加在 Platform 授权链接上,见 `platformLoginUrl`。侧栏浏览器不会给普通网址加这个参数。宿主的 `--dsw-*` 变量和 `data-ds-dark-theme` 在跨源页面里读不到。这个包不追加 query,不建立 `postMessage`,也不改网站。网站若要贴近 Harness,应自己响应 `prefers-color-scheme`。
33
48
 
34
- Web 版由浏览器打开新标签。桌面版打开系统默认浏览器。两种都不是同窗口导航,也不是 iframe。
49
+ 依据:
50
+
51
+ - <https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.4/apps/desktop/src/preload-theme.ts>
52
+ - <https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.4/apps/desktop/src/main.ts>
53
+ - <https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.4/packages/client/ui-sidebar-browser/src/client/electron/ElectronWebviewPresentation.ts>
35
54
 
36
55
  ## 给安装者:npm 官方源
37
56
 
@@ -47,7 +66,13 @@ kexvar-launcher
47
66
 
48
67
  装完后点 **Enable now**。官方说明:安装改的是 profile 磁盘上的 bundle 列表,正在运行的 profile 要重启后才会换成新 bundle。见 <https://github.com/deepseek-ai/deepseek-harness/blob/38a6a5c965aa99ab525161efb7cc5cf1fe62fced/apps/cli/reference/README.md>。
49
68
 
50
- 要钉死版本,填 `kexvar-launcher@0.1.0`。插件页不按 `keywords` 搜索,也不要求包名以 `dsh-` 开头。`keywords` 只出现在 npm 网站的搜索里。
69
+ 2026-11-22 的只读查询里,官方源已有 `0.1.0` 和占位 `0.0.0-stage`,没有 `0.1.1`。`0.1.0` 仍是底栏加系统浏览器。`0.1.1` 还没有上传。要装源上的旧行为,填 `kexvar-launcher@0.1.0`。插件页不按 `keywords` 搜索,也不要求包名以 `dsh-` 开头。`keywords` 只出现在 npm 网站的搜索里。
70
+
71
+ 候选包用本地 tarball,不经过 npm 上传:
72
+
73
+ ```sh
74
+ dsh plugin --profile <profile> add /absolute/path/kexvar-launcher-0.1.1.tgz
75
+ ```
51
76
 
52
77
  同一安装的命令行形式是:
53
78
 
@@ -71,7 +96,7 @@ dsh plugin --profile <profile> update kexvar-launcher --registry https://registr
71
96
  dsh plugin --profile <profile> add kexvar-launcher@0.1.0 --registry https://registry.npmjs.org/
72
97
  ```
73
98
 
74
- 把 `0.1.0` 换成要装的版本。更新后同样重启该 profile。
99
+ 把 `0.1.0` 换成官方源上已经存在的版本。`0.1.1` 在上传之前只能加 tarball。更新后同样重启该 profile。
75
100
 
76
101
  官方命名依据:
77
102
 
@@ -83,7 +108,7 @@ dsh plugin --profile <profile> add kexvar-launcher@0.1.0 --registry https://regi
83
108
 
84
109
  ## 从旧的 Git 或本地目录迁过来
85
110
 
86
- 旧安装和这个 npm 包用的是同一个包名。浏览器模块 id 也是包名,Loader 行 id 和 `sidebar.footer.action` 的 id 同样是 `kexvar-launcher`。换安装来源不会多出一个按钮,也不会改点击行为。
111
+ 旧安装和这个 npm 包用的是同一个包名。浏览器模块 id 也是包名。`0.1.1` 用同一个 id 替换底栏按钮,不会再留一个左下角入口。先卸掉旧的,再装新的。不要两个来源一起留着:一个 profile 里同一个包名只有一条依赖。
87
112
 
88
113
  Git、`link:`、本地目录和 tarball 装上的包,插件页没有 registry 的 **Versions** 更新。先卸掉旧的,再按官方源安装。不要两个一起留着:一个 profile 里同一个包名只有一条依赖。
89
114
 
@@ -102,7 +127,7 @@ https://origin.cursor.com/kcx-chance/kexvar-launcher.git
102
127
 
103
128
  ## 维护者发布前
104
129
 
105
- `private` 是 `false`,`publishConfig.registry` 是 `https://registry.npmjs.org/`,`publishConfig.access` 是 `public`。无 scope 的包发布后就是公开的。这次没有执行 `npm publish`。包名当时查到未被占用,并不等于已经注册或保留。未发布前,官方源上没有这个包,也没有 npm 页面。
130
+ `private` 是 `false`,`publishConfig.registry` 是 `https://registry.npmjs.org/`,`publishConfig.access` 是 `public`。无 scope 的包发布后就是公开的。这次没有执行 `npm publish`,也没有 stage 或 approve。官方源上已经能看到 `0.1.0` 和 `0.0.0-stage`;`0.1.1` 还没有。
106
131
 
107
132
  仓库没有 `license` 和 `author`。本次不附加开源许可。公开 tarball 里会有 `package.json`、本 README,以及未压缩的 `lib/index.js`、`lib/client.js` 和 `cordis.patch.yml`。这些内容会公开,即使 Origin 仓库保持私人。`src/`、`scripts/`、`test/` 不在 `files` 白名单里。
108
133
 
@@ -118,7 +143,7 @@ node --test
118
143
 
119
144
  ## 明确不做的事
120
145
 
121
- - 本仓库的这次准备不执行 `npm publish`,不占包名,不改 npm 可见性。
146
+ - 本仓库的这次改动不执行 `npm publish`、`npm stage` 或 approve,也不改 npm 可见性。
122
147
  - 不改 Origin 仓库的私人状态,不镜像到其它托管。
123
148
  - 不收集密钥,不代理 Cursor 或 KEXVAR 登录。
124
149
  - 不在目标 URL 上附加 token。
package/lib/client.js CHANGED
@@ -3,71 +3,166 @@ var module = { exports: {} }; var exports = module.exports;
3
3
  /**
4
4
  * Browser half of kexvar-launcher.
5
5
  *
6
- * DeepSeek Harness 0.2.2 has no sidebar href. `sidebar.panellist` always
7
- * calls selectPanel, and a missing main panel throws. This entry instead
8
- * uses `sidebar.footer.action`, the left-sidebar foot seat whose registrant
9
- * owns the button (ui-sidebar contract, rendered above Settings).
6
+ * The shell owns the sidebar row: click, hover, type size, and the KEXVAR
7
+ * label. This module only supplies the official globe sprite symbol,
8
+ * `dsw-icon-globe-outline-regular`, at the size the row asks for.
10
9
  *
11
- * The click uses the same new-context features as the built-in browser
12
- * toolbar: window.open(url, '_blank', 'noopener,noreferrer'). Desktop's
13
- * primary window denies that in-app window and hands http(s) URLs to the
14
- * operating-system browser. The target is a fixed literal with no query.
10
+ * That click always calls layout.selectPanel. The matching main panel exists
11
+ * so the call can succeed, then returns to the current conversation before
12
+ * the official right sidebar opens the fixed KEXVAR address. A global panel
13
+ * has no session surface, so the browser call follows selectPanel(null).
14
+ *
15
+ * The official browser kind allows more than one tab and records each open
16
+ * at a new address. Repeating the open therefore cannot focus the existing
17
+ * KEXVAR tab. This module remembers the tab id and calls focus on the next
18
+ * click. A missing tab falls through to a new open. The address is not given
19
+ * a theme query; desktop already publishes the app palette through the
20
+ * platform color scheme.
15
21
  */
16
22
 
17
23
  const React = require('react')
18
24
 
19
25
  const TARGET_URL = 'https://kexvar.apps.grok.bot/'
20
26
  const LABEL = 'KEXVAR'
27
+ const PANEL_ID = 'kexvar-launcher'
28
+ const PANEL_ORDER = 15
29
+ const BROWSER_KIND = 'browser'
30
+ const GLOBE_SYMBOL = 'dsw-icon-globe-outline-regular'
31
+
32
+ let kexvarTabId
33
+ let holdError
34
+ let suppressHandoff = false
35
+
36
+ function once(fn) {
37
+ let done = false
38
+ return function dispose() {
39
+ if (done) return
40
+ done = true
41
+ fn()
42
+ }
43
+ }
44
+
45
+ function unavailable() {
46
+ return new Error('kexvar-launcher: the official desktop browser is not available')
47
+ }
48
+
49
+ function explain(error) {
50
+ const message = error instanceof Error ? error.message : String(error)
51
+ if (message.includes('no session surface is mounted')) {
52
+ return new Error('kexvar-launcher: open a conversation before opening KEXVAR')
53
+ }
54
+ if (message.includes('no tab type is registered') || message.includes('official desktop browser is not available')) {
55
+ return unavailable()
56
+ }
57
+ return error instanceof Error ? error : new Error(message)
58
+ }
59
+
60
+ function officialBrowser(sidebarRight) {
61
+ if (!sidebarRight || typeof sidebarRight.openTab !== 'function' || typeof sidebarRight.focus !== 'function') {
62
+ return undefined
63
+ }
64
+ return sidebarRight
65
+ }
21
66
 
22
- function openKexvar(openWindow) {
23
- openWindow(TARGET_URL, '_blank', 'noopener,noreferrer')
67
+ function openInOfficialBrowser(sidebarRight) {
68
+ if (kexvarTabId !== undefined) {
69
+ try {
70
+ sidebarRight.focus(kexvarTabId)
71
+ } catch (error) {
72
+ kexvarTabId = undefined
73
+ throw error
74
+ }
75
+ const active = typeof sidebarRight.active === 'function' ? sidebarRight.active() : undefined
76
+ if (active && active.id === kexvarTabId) return
77
+ kexvarTabId = undefined
78
+ }
79
+ sidebarRight.openTab(BROWSER_KIND, { params: { url: TARGET_URL } })
80
+ const opened = typeof sidebarRight.active === 'function' ? sidebarRight.active() : undefined
81
+ if (opened && opened.kind === BROWSER_KIND && opened.id !== undefined) kexvarTabId = opened.id
24
82
  }
25
83
 
26
- function entryStyle(wide) {
27
- return {
28
- appearance: 'none',
29
- background: 'transparent',
30
- color: 'inherit',
31
- border: 0,
32
- cursor: 'pointer',
33
- font: 'inherit',
34
- fontSize: wide ? 'inherit' : '12px',
35
- display: 'flex',
36
- alignItems: 'center',
37
- justifyContent: wide ? 'flex-start' : 'center',
38
- width: '100%',
39
- boxSizing: 'border-box',
40
- minHeight: wide ? '32px' : '36px',
41
- padding: wide ? '0 12px' : '0 4px',
42
- borderRadius: 'var(--dsw-radius-sm, 6px)',
43
- textAlign: wide ? 'left' : 'center',
84
+ function showError(ctx, error, notify, restore) {
85
+ holdError = explain(error).message
86
+ if (restore) {
87
+ suppressHandoff = true
88
+ ctx.layout.selectPanel(PANEL_ID)
89
+ return
90
+ }
91
+ notify()
92
+ }
93
+
94
+ function handoff(ctx, notify) {
95
+ if (suppressHandoff) {
96
+ suppressHandoff = false
97
+ return
98
+ }
99
+ const sidebarRight = officialBrowser(ctx.sidebarRight)
100
+ if (sidebarRight === undefined) {
101
+ showError(ctx, unavailable(), notify, false)
102
+ return
103
+ }
104
+ ctx.layout.selectPanel(null)
105
+ try {
106
+ openInOfficialBrowser(sidebarRight)
107
+ holdError = undefined
108
+ } catch (error) {
109
+ showError(ctx, error, notify, true)
44
110
  }
45
111
  }
46
112
 
47
- function KexvarLauncherEntry(props) {
48
- const wide = Boolean(props.wide)
49
- return React.createElement('button', {
50
- type: 'button',
51
- 'aria-label': LABEL,
52
- title: LABEL,
53
- 'data-kexvar-launcher': 'entry',
54
- style: entryStyle(wide),
55
- onClick() {
56
- openKexvar(window.open.bind(window))
57
- },
58
- }, LABEL)
113
+ function KexvarIcon(props) {
114
+ const size = props && props.size ? props.size : 14
115
+ return React.createElement('svg', {
116
+ width: size,
117
+ height: size,
118
+ 'data-icon': GLOBE_SYMBOL,
119
+ 'aria-hidden': 'true',
120
+ }, React.createElement('use', { href: `#${GLOBE_SYMBOL}` }))
59
121
  }
60
122
 
61
123
  exports.name = 'kexvar-launcher'
62
- exports.inject = ['slots']
124
+ exports.inject = ['slots', 'layout', 'sidebarRight']
63
125
  exports.TARGET_URL = TARGET_URL
64
126
  exports.apply = function apply(ctx) {
65
- ctx.slots.inject('sidebar.footer.action', function registerEntry() {
66
- return ctx.slots.register({
67
- name: 'sidebar.footer.action',
68
- id: 'kexvar-launcher',
69
- order: 20,
70
- }, KexvarLauncherEntry)
127
+ let disposeMain = function () {}
128
+ let disposeList = function () {}
129
+
130
+ function KexvarMain() {
131
+ const [, notify] = React.useState(0)
132
+ React.useEffect(function () {
133
+ handoff(ctx, function () { notify(function (value) { return value + 1 }) })
134
+ }, [])
135
+ if (!holdError) return null
136
+ return React.createElement('p', {
137
+ role: 'alert',
138
+ 'data-kexvar-launcher': 'error',
139
+ }, holdError)
140
+ }
141
+
142
+ const dispose = once(function () {
143
+ kexvarTabId = undefined
144
+ holdError = undefined
145
+ suppressHandoff = false
146
+ disposeMain()
147
+ disposeList()
148
+ })
149
+
150
+ ctx.slots.inject('main', function () {
151
+ disposeMain = once(ctx.slots.register({
152
+ name: 'main',
153
+ key: PANEL_ID,
154
+ }, KexvarMain))
155
+ return dispose
156
+ })
157
+ ctx.slots.inject('sidebar.panellist', function () {
158
+ disposeList = once(ctx.slots.register({
159
+ name: 'sidebar.panellist',
160
+ id: PANEL_ID,
161
+ order: PANEL_ORDER,
162
+ label: function label() { return LABEL },
163
+ }, KexvarIcon))
164
+ return dispose
71
165
  })
166
+ return dispose
72
167
  }
73
168
  return module.exports; } });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "kexvar-launcher",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
- "description": "DeepSeek Harness left-sidebar entry that opens KEXVAR.",
5
+ "description": "DeepSeek Harness left-sidebar entry that opens KEXVAR in the official desktop browser.",
6
6
  "keywords": [
7
7
  "kexvar",
8
8
  "deepseek-harness",
@@ -32,7 +32,9 @@
32
32
  "client": {
33
33
  "platform": "web",
34
34
  "inject": [
35
- "@deepseek-ai/dsh-client-ui-sidebar"
35
+ "@deepseek-ai/dsh-client-ui-sidebar",
36
+ "@deepseek-ai/dsh-client-ui-layout",
37
+ "@deepseek-ai/dsh-client-ui-sidebar-right"
36
38
  ]
37
39
  }
38
40
  },