@michengai/dsh-im-connect 0.1.38 → 0.1.39
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/CHANGELOG.md +6 -1
- package/CHANGELOG.zh-CN.md +6 -1
- package/README.en.md +43 -62
- package/README.md +43 -62
- package/client.js +28 -296
- package/lib/client.js +28 -296
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 0.1.39 - 2026-09-09
|
|
8
|
+
|
|
9
|
+
- Remove the unused legacy composer component while preserving the current host composer entry.
|
|
10
|
+
|
|
11
|
+
- Unified settings headings, descriptions, and action layouts; maintenance controls no longer squeeze titles or versions. The layout adapts to native DSH settings without Codex UI.
|
|
12
|
+
- Keep account lists and details side by side in equal-width columns with compact channel rows; fix box sizing that caused horizontal overflow in the native settings dialog.
|
|
8
13
|
|
|
9
14
|
## 0.1.38 - 2026-09-08
|
|
10
15
|
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 0.1.39 - 2026-09-09
|
|
8
|
+
|
|
9
|
+
- 移除未使用的旧输入框组件,保留当前宿主输入入口。
|
|
10
|
+
|
|
11
|
+
- 统一设置页标题、说明与操作布局,标题及版本不再被维护按钮挤压;适配原生 DSH 设置内容区,无需安装 Codex UI。
|
|
12
|
+
- 账号列表使用紧凑双行渠道条目,左右列表和详情保持等宽布局;修复原生设置弹窗中盒模型导致的横向溢出。
|
|
8
13
|
|
|
9
14
|
## 0.1.38 - 2026-09-08
|
|
10
15
|
|
package/README.en.md
CHANGED
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
25
|
+
Send tasks to your local DSH through your usual messenger, even when you are away from the computer. Receive replies, answer questions, and handle tool approvals in the same chat.
|
|
26
|
+
|
|
27
|
+
- **Connect familiar platforms**: DingTalk, Feishu, Lark, WeChat, WeCom, QQ, and Telegram.
|
|
28
|
+
- **Configure accounts separately**: each account has its own workspace, model, reasoning effort, permissions, and private-access mode.
|
|
29
|
+
- **Handle task interactions on your phone**: send work, read replies, and answer single- or multiple-choice questions. Approved users can approve or deny tools in private chats.
|
|
30
|
+
- **Keep chat records separate**: each IM chat has its own session under **Channels** in the web workspace.
|
|
31
|
+
- **Connect by QR code or credentials**: use the platform-specific setup in **Settings → IM Assistant**, then control message reception per account.
|
|
32
|
+
- **Control access**: groups trigger through mentions and private chats follow each account’s access settings, as detailed below.
|
|
33
33
|
|
|
34
34
|
## Who can drive the assistant
|
|
35
35
|
|
|
@@ -114,13 +114,18 @@ After connecting, drive the local assistant from each IM:
|
|
|
114
114
|
|
|
115
115
|
## DSH product ecosystem
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
For a ready-to-use workbench, download [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop/releases). If you already use [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), install any of these eight plugins individually. The desktop app includes all eight.
|
|
118
118
|
|
|
119
|
-
|
|
|
119
|
+
| Plugin | What you can do |
|
|
120
120
|
| --- | --- |
|
|
121
|
-
| [
|
|
122
|
-
| [
|
|
123
|
-
|
|
|
121
|
+
| [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | Organize projects and conversations, search tasks, and navigate chat turns |
|
|
122
|
+
| [IM Connect](https://github.com/MichengAI/dsh-im-connect) | Send tasks and receive replies through your usual messenger |
|
|
123
|
+
| [Automation](https://github.com/MichengAI/dsh-automation) | Schedule tasks and review each run |
|
|
124
|
+
| [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | Find, enable, create, and import local skills |
|
|
125
|
+
| [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | Search, restore, or clean up archived conversations |
|
|
126
|
+
| [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | Choose and summon specialists for your task |
|
|
127
|
+
| [BTW](https://github.com/MichengAI/dsh-btw) | Ask side questions without interrupting the main task |
|
|
128
|
+
| [Simplify](https://github.com/MichengAI/dsh-simplify) | Use /simplify to improve code within your Git changes |
|
|
124
129
|
|
|
125
130
|
## Prerequisites
|
|
126
131
|
|
|
@@ -131,40 +136,16 @@ This product can be installed independently or used through the desktop app or W
|
|
|
131
136
|
|
|
132
137
|
## Installation
|
|
133
138
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
### Ask another agent to install it
|
|
139
|
+
The installation commands below use the official npm registry.
|
|
137
140
|
|
|
138
|
-
|
|
141
|
+
### Ask an agent to install it (recommended)
|
|
139
142
|
|
|
140
|
-
|
|
143
|
+
Send the prompt below to any agent that can run terminal commands on your computer. Replace `web` with your actual profile. Once installed, use the plugin in DSH.
|
|
141
144
|
|
|
142
145
|
```text
|
|
143
|
-
Install the
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
From source:
|
|
147
|
-
|
|
148
|
-
```text
|
|
149
|
-
Install the DSH plugin from source at https://github.com/MichengAI/dsh-im-connect: clone it, run npm install and npm test, then run dsh plugin --profile web add . from that directory. Do not copy lib by itself. Then run dsh --profile web --dump-config, confirm im-connect is mounted, and remind me to restart DSH Web, hard-refresh the browser, and open Settings → IM Assistant.
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
| Product | How to use it |
|
|
153
|
-
| --- | --- |
|
|
154
|
-
| DSH | Send one of the sentences above to the current session. |
|
|
155
|
-
| Codex | Send one of the sentences above to Codex and let it install locally. |
|
|
156
|
-
| WorkBuddy | Send one of the sentences above to WorkBuddy; for a source install you can also paste `https://github.com/MichengAI/dsh-im-connect`. |
|
|
157
|
-
|
|
158
|
-
Codex and WorkBuddy only install the plugin. After that, open DSH Web and use **Settings → IM Assistant**.
|
|
159
|
-
|
|
160
|
-
You can also run the same npm command yourself:
|
|
161
|
-
|
|
162
|
-
```powershell
|
|
163
|
-
dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/
|
|
146
|
+
Install the DSH plugin @michengai/dsh-im-connect into my local web profile by running: dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/. Then run dsh --profile web --dump-config, confirm the configuration includes im-connect, and explain how to reload DSH and start using the plugin.
|
|
164
147
|
```
|
|
165
148
|
|
|
166
|
-
If `dsh` is not on PATH, replace the leading `dsh` with `npx --yes @deepseek-ai/dsh`.
|
|
167
|
-
|
|
168
149
|
### Install the latest package from the official npm registry
|
|
169
150
|
|
|
170
151
|
Run this from any PowerShell directory:
|
|
@@ -180,31 +161,13 @@ To pin a release, replace `@latest` with a version such as `@0.1.28`.
|
|
|
180
161
|
|
|
181
162
|
The configuration output should contain `im-connect`. Restart DSH Web and hard-refresh the browser. Do not copy client files manually: `dsh plugin add` also applies `cordis.patch.yml`.
|
|
182
163
|
|
|
183
|
-
### Install from source
|
|
184
|
-
|
|
185
|
-
Use this for debugging or unpublished changes. The cloned directory becomes the plugin source path:
|
|
186
|
-
|
|
187
|
-
```powershell
|
|
188
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
189
|
-
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
190
|
-
Set-Location D:\Repository\deepseek-harness-plugin
|
|
191
|
-
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
192
|
-
Set-Location .\dsh-im-connect
|
|
193
|
-
npm install
|
|
194
|
-
npm test
|
|
195
|
-
dsh plugin --profile web add .
|
|
196
|
-
dsh --profile web --dump-config
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Restart DSH Web and hard-refresh the browser. `dsh plugin ... add .` reads the package metadata and `cordis.patch.yml`; do not install by copying `lib` directly.
|
|
200
|
-
|
|
201
164
|
## Updates
|
|
202
165
|
|
|
203
166
|
The settings title shows the installed version and a **Check for updates** button. When a newer release is available, **Update automatically** runs only when the DSH CLI or Desktop update service is available; otherwise, the dialog provides a profile-specific manual command to copy and run.
|
|
204
167
|
|
|
205
168
|
## Usage
|
|
206
169
|
|
|
207
|
-
Open **Settings → IM Assistant**, select **Add account** under the target channel, then choose that account's workspace, model, permission, and private-access mode.
|
|
170
|
+
Open **Settings → IM Assistant**, select **Add account** under the target channel, then choose that account's workspace, model, permission, and private-access mode.
|
|
208
171
|
|
|
209
172
|
| Goal | Action | Notes |
|
|
210
173
|
| --- | --- | --- |
|
|
@@ -239,6 +202,24 @@ Keep the DSH backend listening on loopback. Remote access should use a controlle
|
|
|
239
202
|
|
|
240
203
|
## Secondary development
|
|
241
204
|
|
|
205
|
+
### Install from source
|
|
206
|
+
|
|
207
|
+
Use this for debugging or unpublished changes. The cloned directory becomes the plugin source path:
|
|
208
|
+
|
|
209
|
+
```powershell
|
|
210
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
211
|
+
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
212
|
+
Set-Location D:\Repository\deepseek-harness-plugin
|
|
213
|
+
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
214
|
+
Set-Location .\dsh-im-connect
|
|
215
|
+
npm install
|
|
216
|
+
npm test
|
|
217
|
+
dsh plugin --profile web add .
|
|
218
|
+
dsh --profile web --dump-config
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Restart DSH Web and hard-refresh the browser. `dsh plugin ... add .` reads the package metadata and `cordis.patch.yml`; do not install by copying `lib` directly.
|
|
222
|
+
|
|
242
223
|
This repository develops in `src` and builds to `lib`:
|
|
243
224
|
|
|
244
225
|
- [src\index.ts](src/index.ts): host entry, config, and lifecycle.
|
|
@@ -271,8 +252,8 @@ npm test
|
|
|
271
252
|
|
|
272
253
|
`prepublishOnly` runs the tests before publishing.
|
|
273
254
|
|
|
274
|
-
##
|
|
255
|
+
## License
|
|
275
256
|
|
|
276
|
-
|
|
257
|
+
Security guidance is in [SECURITY.md](SECURITY.md).
|
|
277
258
|
|
|
278
259
|
Licensed under [Apache License 2.0](LICENSE).
|
package/README.md
CHANGED
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
## 功能概览
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
25
|
+
不在电脑前,也能通过常用聊天软件把任务交给本机 DSH,并在同一聊天里接收回复、回答问题和处理工具审批。
|
|
26
|
+
|
|
27
|
+
- **连接常用消息平台**:支持钉钉、飞书、Lark、微信、企业微信、QQ 和 Telegram。
|
|
28
|
+
- **多个账号分别配置**:同一平台可添加多个账号,各自选择工作区、模型、推理强度、权限和私聊准入。
|
|
29
|
+
- **手机上完成任务交互**:下任务、读回复、回答单选或多选问题;已批准用户可在私聊中批准或拒绝工具执行。
|
|
30
|
+
- **聊天记录互不混淆**:每个 IM 聊天对应独立会话,在网页工作区「频道」中回看。
|
|
31
|
+
- **按平台扫码或填写凭据**:在「设置 → IM助理」连接账号,管理消息接收开关。
|
|
32
|
+
- **控制谁能使用**:群聊通过 @ 触发,私聊按账号的准入设置处理,详见下表。
|
|
33
33
|
|
|
34
34
|
## 谁可以驱动助手
|
|
35
35
|
|
|
@@ -114,13 +114,18 @@
|
|
|
114
114
|
|
|
115
115
|
## DSH 产品生态
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
想直接使用完整工作台,可下载 [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop/releases);已有 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 环境,可按需独立安装以下 8 个自研插件。桌面端已随附这些插件。
|
|
118
118
|
|
|
119
|
-
|
|
|
119
|
+
| 插件 | 你可以用它做什么 |
|
|
120
120
|
| --- | --- |
|
|
121
|
-
| [
|
|
122
|
-
| [
|
|
123
|
-
|
|
|
121
|
+
| [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | 整理项目与会话、搜索任务、跳转对话轮次 |
|
|
122
|
+
| [IM Connect](https://github.com/MichengAI/dsh-im-connect) | 从微信、飞书、钉钉等消息平台下任务、收回复 |
|
|
123
|
+
| [Automation](https://github.com/MichengAI/dsh-automation) | 按计划执行任务,查看每次运行的结果 |
|
|
124
|
+
| [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | 统一查找、启停、创建和导入本机技能 |
|
|
125
|
+
| [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | 搜索、恢复或清理已归档会话 |
|
|
126
|
+
| [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | 按任务选择并召唤专业角色 |
|
|
127
|
+
| [BTW](https://github.com/MichengAI/dsh-btw) | 在当前上下文中临时旁问,不打断主任务 |
|
|
128
|
+
| [Simplify](https://github.com/MichengAI/dsh-simplify) | 用 /simplify 整理 Git 改动范围内的代码 |
|
|
124
129
|
|
|
125
130
|
## 前置条件
|
|
126
131
|
|
|
@@ -131,40 +136,16 @@
|
|
|
131
136
|
|
|
132
137
|
## 安装
|
|
133
138
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
### 交给其他 Agent 一句话安装
|
|
139
|
+
以下安装命令使用官方 npm 源。
|
|
137
140
|
|
|
138
|
-
|
|
141
|
+
### 让 Agent 帮你安装(推荐)
|
|
139
142
|
|
|
140
|
-
|
|
143
|
+
把下面这段话发给任意能够执行本机终端命令的 Agent。将 `web` 替换为实际使用的 profile;安装完成后,在 DSH 中使用本插件。
|
|
141
144
|
|
|
142
145
|
```text
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
从源码安装:
|
|
147
|
-
|
|
148
|
-
```text
|
|
149
|
-
请从 https://github.com/MichengAI/dsh-im-connect 安装 DSH 插件:克隆仓库,执行 npm install 和 npm test,再在该目录执行 dsh plugin --profile web add .。不要只复制 lib。然后执行 dsh --profile web --dump-config,确认已挂载 im-connect,并提醒我重启 DSH Web 后硬刷新浏览器,打开「设置 → IM助理」。
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
| 产品 | 怎么用 |
|
|
153
|
-
| --- | --- |
|
|
154
|
-
| DSH | 把上面其中一句发给当前会话。 |
|
|
155
|
-
| Codex | 把上面其中一句发给 Codex,让它在本机执行安装。 |
|
|
156
|
-
| WorkBuddy | 把上面其中一句发给 WorkBuddy;源码安装也可同时粘贴仓库地址 `https://github.com/MichengAI/dsh-im-connect`。 |
|
|
157
|
-
|
|
158
|
-
Codex 和 WorkBuddy 只负责代装;装好后仍要打开 DSH Web 使用「设置 → IM助理」。
|
|
159
|
-
|
|
160
|
-
也可以自己执行同一条 npm 命令:
|
|
161
|
-
|
|
162
|
-
```powershell
|
|
163
|
-
dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/
|
|
146
|
+
请将 DSH 插件 @michengai/dsh-im-connect 安装到本机 web profile,执行:dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/。安装后执行 dsh --profile web --dump-config,确认配置包含 im-connect,并告诉我如何重新加载 DSH 和开始使用。
|
|
164
147
|
```
|
|
165
148
|
|
|
166
|
-
未把 `dsh` 装进 PATH 时,把开头的 `dsh` 换成 `npx --yes @deepseek-ai/dsh`。
|
|
167
|
-
|
|
168
149
|
### 从官方 npm 安装最新版
|
|
169
150
|
|
|
170
151
|
在任意 PowerShell 目录执行:
|
|
@@ -180,31 +161,13 @@ dsh --profile web --dump-config
|
|
|
180
161
|
|
|
181
162
|
配置输出中应包含 `im-connect`。安装后重启 DSH Web 并在浏览器硬刷新。不要手工复制客户端文件,`dsh plugin add` 会同时应用 `cordis.patch.yml`。
|
|
182
163
|
|
|
183
|
-
### 从源码安装
|
|
184
|
-
|
|
185
|
-
适用于调试或使用未发布改动。克隆后的本地路径就是插件安装路径:
|
|
186
|
-
|
|
187
|
-
```powershell
|
|
188
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
189
|
-
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
190
|
-
Set-Location D:\Repository\deepseek-harness-plugin
|
|
191
|
-
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
192
|
-
Set-Location .\dsh-im-connect
|
|
193
|
-
npm install
|
|
194
|
-
npm test
|
|
195
|
-
dsh plugin --profile web add .
|
|
196
|
-
dsh --profile web --dump-config
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
完成后重启 DSH Web 并硬刷新浏览器。`dsh plugin ... add .` 会读取当前目录的包信息和 `cordis.patch.yml`;不要改为直接复制 `lib` 目录。
|
|
200
|
-
|
|
201
164
|
## 在线更新
|
|
202
165
|
|
|
203
166
|
设置标题会显示当前版本和“检查更新”按钮。发现新版后,只有检测到 DSH CLI 或 Desktop 更新服务时才可使用“自动更新”;其他环境会在弹窗中提供可复制、与当前 Profile 对应的手工更新命令。
|
|
204
167
|
|
|
205
168
|
## 使用
|
|
206
169
|
|
|
207
|
-
打开「设置 → IM
|
|
170
|
+
打开「设置 → IM助理」,在目标渠道点击「添加账号」,并为该账号选择工作区、模型、权限和私聊准入。
|
|
208
171
|
|
|
209
172
|
| 目标 | 操作 | 说明 |
|
|
210
173
|
| --- | --- | --- |
|
|
@@ -239,6 +202,24 @@ DSH 后端保持本机监听;远程访问使用受控 HTTPS 反向代理,并
|
|
|
239
202
|
|
|
240
203
|
## 二次开发
|
|
241
204
|
|
|
205
|
+
### 从源码安装
|
|
206
|
+
|
|
207
|
+
适用于调试或使用未发布改动。克隆后的本地路径就是插件安装路径:
|
|
208
|
+
|
|
209
|
+
```powershell
|
|
210
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
211
|
+
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
212
|
+
Set-Location D:\Repository\deepseek-harness-plugin
|
|
213
|
+
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
214
|
+
Set-Location .\dsh-im-connect
|
|
215
|
+
npm install
|
|
216
|
+
npm test
|
|
217
|
+
dsh plugin --profile web add .
|
|
218
|
+
dsh --profile web --dump-config
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
完成后重启 DSH Web 并硬刷新浏览器。`dsh plugin ... add .` 会读取当前目录的包信息和 `cordis.patch.yml`;不要改为直接复制 `lib` 目录。
|
|
222
|
+
|
|
242
223
|
本仓库用 `src` 开发,构建到 `lib`:
|
|
243
224
|
|
|
244
225
|
- [src\index.ts](src/index.ts):Host 入口、配置和生命周期。
|
|
@@ -271,8 +252,8 @@ npm test
|
|
|
271
252
|
|
|
272
253
|
`prepublishOnly` 会在发布前自动执行测试。
|
|
273
254
|
|
|
274
|
-
##
|
|
255
|
+
## 许可证
|
|
275
256
|
|
|
276
|
-
|
|
257
|
+
安全说明见 [SECURITY.md](SECURITY.md)。
|
|
277
258
|
|
|
278
259
|
本项目采用 [Apache License 2.0](LICENSE)。
|
package/client.js
CHANGED
|
@@ -95,13 +95,8 @@ window.__ModuleLoader__.load({
|
|
|
95
95
|
.ima-avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;border:2px solid #111}
|
|
96
96
|
.ima-avatar.bot{background:#123524;margin-right:-8px;z-index:1}
|
|
97
97
|
.ima-avatar.user{background:#3d3428}
|
|
98
|
-
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:
|
|
99
|
-
.ima-sub{margin:
|
|
100
|
-
.ima-composer-wrap{margin:0 0 16px}
|
|
101
|
-
.ima-composer{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;gap:4px;padding:4px 6px;border:1px solid var(--ima-line);border-radius:14px;background:var(--ima-card)}
|
|
102
|
-
.ima-composer-left,.ima-composer-right{display:contents}
|
|
103
|
-
.ima-composer .ima-chip{width:100%;min-width:0}
|
|
104
|
-
.ima-composer .ima-chip-btn{width:100%;justify-content:center}
|
|
98
|
+
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap;text-align:left}
|
|
99
|
+
.ima-sub{margin:12px 0 0;max-width:42em;color:var(--ima-muted);font-size:14px;line-height:22px;text-align:left}
|
|
105
100
|
.ima-chip{position:relative;min-width:0;z-index:1}
|
|
106
101
|
.ima-chip.is-open{z-index:30}
|
|
107
102
|
.ima-chip-btn{display:inline-flex;align-items:center;gap:6px;min-height:28px;height:28px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--ima-muted);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer}
|
|
@@ -115,7 +110,6 @@ window.__ModuleLoader__.load({
|
|
|
115
110
|
.ima-chip-row-main{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
116
111
|
.ima-chip-tick{width:6px;height:12px;border-right:1.6px solid var(--ima-accent);border-bottom:1.6px solid var(--ima-accent);transform:rotate(45deg) translateY(-2px);flex:none}
|
|
117
112
|
.ima-chip-empty{padding:14px 12px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
118
|
-
.ima-composer-hint{margin-top:8px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
119
113
|
.ima-chip svg{flex:none}
|
|
120
114
|
.ima-chip-row.is-kv .ima-chip-row-main{flex:none}
|
|
121
115
|
.ima-chip-row-side{display:inline-flex;align-items:center;gap:8px;color:var(--ima-muted);font-size:12px;min-width:0}
|
|
@@ -123,9 +117,9 @@ window.__ModuleLoader__.load({
|
|
|
123
117
|
.ima-chip-split{height:1px;margin:6px 8px;background:var(--ima-line)}
|
|
124
118
|
.ima-chip-effort{color:var(--ima-muted);font-weight:500}
|
|
125
119
|
.ima-model-select .ima-chip-btn{border-radius:24px;gap:4px}
|
|
126
|
-
.ima-model-select .ima-chip-menu{width:min(240px,calc(100vw - 32px));
|
|
120
|
+
.ima-model-select .ima-chip-menu{width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:calc(100vw - 32px);box-sizing:border-box;max-height:min(360px,calc(100vh - 96px));padding:4px;border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff))}
|
|
127
121
|
.ima-model-select .ima-chip-row{min-height:40px;padding:0 10px;font-size:14px}
|
|
128
|
-
.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
122
|
+
.ima-model-select .ima-chip-row-side>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
129
123
|
.ima-model-group+.ima-model-group{margin-top:4px}
|
|
130
124
|
.ima-model-group-title{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff));color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:12px;font-weight:500;line-height:18px}
|
|
131
125
|
.ima-model-option{display:flex;width:100%;min-height:38px;align-items:center;gap:8px;padding:6px 8px;border:0;border-radius:10px;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));text-align:left;cursor:pointer}
|
|
@@ -208,8 +202,8 @@ window.__ModuleLoader__.load({
|
|
|
208
202
|
.ima-radio small{display:block;color:var(--ima-muted);margin-top:2px}
|
|
209
203
|
.ima-ok{color:var(--ima-ok);font-size:14px;text-align:center;padding:24px 0}
|
|
210
204
|
.ima-modal .ima-error{color:var(--ima-danger)}
|
|
211
|
-
.ima-page.ima-account-page{max-width:1120px;padding-bottom:40px}
|
|
212
|
-
.ima-account-shell{display:grid;grid-template-columns:
|
|
205
|
+
.ima-page.ima-account-page{container-type:inline-size;min-width:0;max-width:1120px;padding-bottom:40px}
|
|
206
|
+
.ima-account-shell{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:transparent}
|
|
213
207
|
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:transparent}
|
|
214
208
|
.ima-platform{border:0;border-bottom:1px solid var(--ima-line);border-radius:0;margin:0;overflow:visible;background:transparent}.ima-platform:last-child{border-bottom:0}.ima-platform.open{background:transparent}
|
|
215
209
|
.ima-platform-head{display:flex;align-items:center;gap:10px;width:100%;min-height:64px;padding:10px 18px;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
@@ -225,14 +219,31 @@ window.__ModuleLoader__.load({
|
|
|
225
219
|
.ima-inspector-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px;padding-top:18px;border-top:1px solid var(--ima-line)}.ima-inspector-actions .ima-btn{flex:none;min-width:0;min-height:36px;padding:0 8px;font-size:12px;white-space:nowrap}.ima-inspector-actions .danger{margin-left:auto;color:var(--ima-danger);border-color:color-mix(in srgb,var(--ima-danger) 35%,transparent)}
|
|
226
220
|
.ima-save-note{min-height:18px;color:var(--ima-muted);font-size:11px}.ima-save-note.ok{color:var(--ima-ok)}
|
|
227
221
|
.ima-modal.ima-account-modal{width:min(560px,100%);max-height:min(760px,calc(100vh - 48px));overflow:auto}.ima-setup-section{margin:4px 0 14px;padding-bottom:14px;border-bottom:1px solid var(--ima-line)}
|
|
228
|
-
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max(100%,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max-content;min-width:min(100%,calc(100vw - 32px));left:auto;right:0}.ima-account-settings .ima-chip-dialog{grid-column:1/-1;margin-top:0}.ima-picker-note{grid-column:1/-1;color:var(--ima-muted);font-size:11px;line-height:1.5}.ima-picker-note.warning{color:var(--ima-warning)}
|
|
223
|
+
.ima-account-shell,.ima-account-shell *{box-sizing:border-box}
|
|
224
|
+
.ima-platforms{min-width:0}
|
|
225
|
+
.ima-platform-head{display:grid;grid-template-columns:24px minmax(0,1fr) 12px;gap:8px;padding:12px;min-height:76px}
|
|
226
|
+
.ima-platform-head>.ima-logo,.ima-platform-head>.ima-logo svg{width:24px;height:24px}
|
|
227
|
+
.ima-platform-title{grid-column:2;grid-row:1;overflow-wrap:anywhere}
|
|
228
|
+
.ima-platform-caret{grid-column:3;grid-row:1;width:12px;margin:0}
|
|
229
|
+
.ima-platform-count{grid-column:1/3;grid-row:2;font-size:11px;white-space:normal;padding-right:80px}
|
|
230
|
+
.ima-platform-add{grid-column:1/4;grid-row:2;justify-self:end;min-height:28px;padding:0 8px;font-weight:500}
|
|
231
|
+
.ima-account-list{padding:0 8px 10px}
|
|
232
|
+
.ima-account-row{display:grid;grid-template-columns:7px minmax(0,1fr) 12px;gap:6px;min-height:60px;padding:10px 8px}
|
|
233
|
+
.ima-account-row>.ima-logo{display:none}
|
|
234
|
+
.ima-account-copy{grid-column:2;grid-row:1}
|
|
235
|
+
.ima-account-row>.ima-dot{grid-column:1;grid-row:1}
|
|
236
|
+
.ima-account-next{grid-column:3;grid-row:1;width:12px}
|
|
237
|
+
.ima-account-state{grid-column:2;grid-row:2;font-size:11px}
|
|
238
|
+
.ima-inspector{padding:18px 16px;overflow-wrap:anywhere}
|
|
239
|
+
.ima-switch-row{gap:10px}.ima-switch-copy{min-width:0}
|
|
240
|
+
@container(max-width:620px){.ima-inspector{padding:16px 12px}.ima-inspector-head{gap:8px}.ima-inspector-title{font-size:15px}.ima-platform-head{padding:10px 8px;gap:6px}.ima-platform-title{font-size:13px}.ima-inspector-empty{padding:16px;min-height:180px}}
|
|
241
|
+
@container(max-width:420px){.ima-title{font-size:22px}.ima-platform-count{grid-column:1/4;padding-right:0}.ima-platform-add{grid-row:3;justify-self:start}.ima-inspector{padding:12px 8px}.ima-inspector-head{flex-wrap:wrap}}
|
|
242
|
+
@media(max-width:620px){.ima-account-settings{grid-template-columns:1fr}.ima-picker-field.wide{grid-column:auto}}
|
|
232
243
|
@media (prefers-reduced-motion:reduce){.ima-switch i{transition:none}}
|
|
233
244
|
`;
|
|
234
245
|
|
|
235
|
-
const TITLE_LINK_CSS = ".ima-title-row{display:flex;align-items:center;gap:8px;min-width:0}.ima-title-links{display:flex;align-items:center;gap:4px}.ima-title-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap}.ima-title-link:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ima-title-link:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}.ima-title-link svg{flex:none}@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
246
|
+
const TITLE_LINK_CSS = ".ima-title-row{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}.ima-title-links{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.ima-title-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap}.ima-title-link:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ima-title-link:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}.ima-title-link svg{flex:none}@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
236
247
|
|
|
237
248
|
let styleEl = null;
|
|
238
249
|
const ensureStyle = () => {
|
|
@@ -889,7 +900,6 @@ window.__ModuleLoader__.load({
|
|
|
889
900
|
...group.models.map((item) => h(ModelChoiceRow, {
|
|
890
901
|
key: item.value,
|
|
891
902
|
label: item.label,
|
|
892
|
-
description: item.description,
|
|
893
903
|
active: item.provider === provider && item.model === model,
|
|
894
904
|
onClick: () => {
|
|
895
905
|
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
@@ -963,284 +973,6 @@ window.__ModuleLoader__.load({
|
|
|
963
973
|
);
|
|
964
974
|
}
|
|
965
975
|
|
|
966
|
-
function ComposerBar(props) {
|
|
967
|
-
const t = props.t || fallbackT;
|
|
968
|
-
const items = typeof props.useWorkspaces === "function"
|
|
969
|
-
? (props.useWorkspaces((state) => (state && state.items) || []) || [])
|
|
970
|
-
: [];
|
|
971
|
-
const [providers, setProviders] = useState([]);
|
|
972
|
-
const [permissions, setPermissions] = useState([]);
|
|
973
|
-
const [provider, setProvider] = useState("");
|
|
974
|
-
const [model, setModel] = useState("");
|
|
975
|
-
const [effort, setEffort] = useState("");
|
|
976
|
-
const [cwd, setCwd] = useState("");
|
|
977
|
-
const [permission, setPermission] = useState("");
|
|
978
|
-
const [confirmingFullAccess, setConfirmingFullAccess] = useState(false);
|
|
979
|
-
const [fullAccessAcknowledged, setFullAccessAcknowledged] = useState(false);
|
|
980
|
-
const [open, setOpen] = useState("");
|
|
981
|
-
const [modelPane, setModelPane] = useState("root");
|
|
982
|
-
const [hint, setHint] = useState("");
|
|
983
|
-
const [adding, setAdding] = useState(false);
|
|
984
|
-
const [addPath, setAddPath] = useState("");
|
|
985
|
-
const [addBusy, setAddBusy] = useState(false);
|
|
986
|
-
|
|
987
|
-
useEffect(() => {
|
|
988
|
-
api("/assistant").then((data) => {
|
|
989
|
-
if (!data.ok) { setHint(serverText(data.error, t) || t("error.loadAssistant")); return; }
|
|
990
|
-
const list = data.providers || [];
|
|
991
|
-
setProviders(list);
|
|
992
|
-
setPermissions(data.permissions || []);
|
|
993
|
-
const current = data.assistant || {};
|
|
994
|
-
const nextProvider = current.provider || (list[0] && list[0].id) || "";
|
|
995
|
-
const models = ((list.find((item) => item.id === nextProvider) || {}).models) || [];
|
|
996
|
-
const nextModel = current.model || (models[0] && models[0].id) || "";
|
|
997
|
-
const found = models.find((item) => item.id === nextModel) || models[0];
|
|
998
|
-
setProvider(nextProvider);
|
|
999
|
-
setModel(nextModel);
|
|
1000
|
-
setEffort(current.reasoningEffort || (found && found.reasoning && found.reasoning.defaultEffort) || "");
|
|
1001
|
-
setCwd(data.cwd || "");
|
|
1002
|
-
setPermission(data.permission || "");
|
|
1003
|
-
if (!list.length) setHint(t("error.noModels"));
|
|
1004
|
-
}).catch(() => setHint(t("error.loadAssistant")));
|
|
1005
|
-
}, []);
|
|
1006
|
-
|
|
1007
|
-
const save = (body) => {
|
|
1008
|
-
api("/assistant", {
|
|
1009
|
-
method: "POST",
|
|
1010
|
-
headers: { "content-type": "application/json" },
|
|
1011
|
-
body: JSON.stringify(body),
|
|
1012
|
-
}).then((data) => {
|
|
1013
|
-
if (!data.ok) setHint(serverText(data.error, t) || t("error.save"));
|
|
1014
|
-
else setHint("");
|
|
1015
|
-
}).catch(() => setHint(t("error.save")));
|
|
1016
|
-
};
|
|
1017
|
-
|
|
1018
|
-
const workspace = items.find((item) => item.path === cwd);
|
|
1019
|
-
const modelGroups = providers.map((item) => ({
|
|
1020
|
-
id: item.id,
|
|
1021
|
-
name: item.name || item.id,
|
|
1022
|
-
models: (item.models || []).map((entry) => ({
|
|
1023
|
-
value: item.id + "::" + entry.id,
|
|
1024
|
-
provider: item.id,
|
|
1025
|
-
providerName: item.name || item.id,
|
|
1026
|
-
model: entry.id,
|
|
1027
|
-
label: entry.name || entry.id,
|
|
1028
|
-
description: entry.description,
|
|
1029
|
-
reasoning: entry.reasoning,
|
|
1030
|
-
})),
|
|
1031
|
-
})).filter((item) => item.models.length > 0);
|
|
1032
|
-
const models = modelGroups.flatMap((item) => item.models);
|
|
1033
|
-
const currentModel = models.find((item) => item.provider === provider && item.model === model);
|
|
1034
|
-
const reasoning = currentModel && currentModel.reasoning;
|
|
1035
|
-
const effectiveEffort = effort || (reasoning && reasoning.defaultEffort) || "";
|
|
1036
|
-
const efforts = reasoning
|
|
1037
|
-
? [
|
|
1038
|
-
...(reasoning.defaultEffort ? [] : [{ id: "", name: props.modelT("effort.providerDefault") }]),
|
|
1039
|
-
...((reasoning.efforts || []).map((item) => ({ id: item.id, name: item.name || item.id, description: item.description }))),
|
|
1040
|
-
]
|
|
1041
|
-
: [];
|
|
1042
|
-
const effortLabel = reasoning
|
|
1043
|
-
? ((efforts.find((item) => item.id === effectiveEffort) || {}).name || effectiveEffort || props.modelT("effort.providerDefault"))
|
|
1044
|
-
: "";
|
|
1045
|
-
const permissionOptions = permissions.map((item) => ({
|
|
1046
|
-
...item,
|
|
1047
|
-
label: permissionLabel(item, t),
|
|
1048
|
-
}));
|
|
1049
|
-
const perm = permissionOptions.find((item) => item.value === permission) || { label: permission || t("composer.permission") };
|
|
1050
|
-
const modelFallback = props.modelT("trigger.fallback");
|
|
1051
|
-
|
|
1052
|
-
const addWorkspace = (path) => {
|
|
1053
|
-
const next = (path || "").trim();
|
|
1054
|
-
if (!next) { setHint(t("error.chooseWorkspace")); return Promise.resolve(); }
|
|
1055
|
-
if (typeof props.createWorkspace !== "function") { setHint(t("error.workspaceUnavailable")); return Promise.resolve(); }
|
|
1056
|
-
setAddBusy(true);
|
|
1057
|
-
return Promise.resolve(props.createWorkspace({ path: next })).then((created) => {
|
|
1058
|
-
const cwdPath = (created && (created.path || created.cwd)) || next;
|
|
1059
|
-
setCwd(cwdPath);
|
|
1060
|
-
save({ cwd: cwdPath });
|
|
1061
|
-
setAdding(false);
|
|
1062
|
-
setAddPath("");
|
|
1063
|
-
setOpen("");
|
|
1064
|
-
}).catch((error) => {
|
|
1065
|
-
setHint((error && error.message) || t("error.addWorkspace"));
|
|
1066
|
-
}).finally(() => setAddBusy(false));
|
|
1067
|
-
};
|
|
1068
|
-
|
|
1069
|
-
const selectPermission = (next) => {
|
|
1070
|
-
setOpen("");
|
|
1071
|
-
if (next === permission) return;
|
|
1072
|
-
if (next === "danger-full-access") {
|
|
1073
|
-
setFullAccessAcknowledged(false);
|
|
1074
|
-
setConfirmingFullAccess(true);
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
setPermission(next);
|
|
1078
|
-
save({ permission: next });
|
|
1079
|
-
};
|
|
1080
|
-
|
|
1081
|
-
const onAddWorkspace = () => {
|
|
1082
|
-
setOpen("");
|
|
1083
|
-
if (typeof props.pickDirectory === "function") {
|
|
1084
|
-
Promise.resolve(props.pickDirectory()).then((picked) => {
|
|
1085
|
-
if (!picked) return;
|
|
1086
|
-
return addWorkspace(picked);
|
|
1087
|
-
}).catch(() => {
|
|
1088
|
-
setAdding(true);
|
|
1089
|
-
setAddPath("");
|
|
1090
|
-
});
|
|
1091
|
-
return;
|
|
1092
|
-
}
|
|
1093
|
-
setAdding(true);
|
|
1094
|
-
setAddPath("");
|
|
1095
|
-
};
|
|
1096
|
-
|
|
1097
|
-
return h("div", { className: "ima-composer-wrap" },
|
|
1098
|
-
h("div", { className: "ima-composer", "aria-label": t("composer.aria") },
|
|
1099
|
-
h("div", { className: "ima-composer-left" },
|
|
1100
|
-
h(ChipMenu, {
|
|
1101
|
-
open: open === "ws",
|
|
1102
|
-
onToggle: (next) => setOpen(next ? "ws" : ""),
|
|
1103
|
-
icon: h(FolderIcon),
|
|
1104
|
-
label: (workspace && (workspace.title || workspace.path)) || cwd || t("composer.project"),
|
|
1105
|
-
ariaLabel: t("composer.projectAria"),
|
|
1106
|
-
},
|
|
1107
|
-
items.length === 0 && h("div", { className: "ima-chip-empty" }, t("composer.noWorkspaces")),
|
|
1108
|
-
...items.map((item) => h(ChipRow, {
|
|
1109
|
-
key: item.path,
|
|
1110
|
-
icon: h(FolderIcon),
|
|
1111
|
-
label: item.title || item.path,
|
|
1112
|
-
active: item.path === cwd,
|
|
1113
|
-
onClick: () => { setCwd(item.path); save({ cwd: item.path }); setOpen(""); },
|
|
1114
|
-
})),
|
|
1115
|
-
h("div", { className: "ima-chip-split" }),
|
|
1116
|
-
h(ChipRow, {
|
|
1117
|
-
icon: h(PlusIcon),
|
|
1118
|
-
label: t("composer.addWorkspace"),
|
|
1119
|
-
onClick: onAddWorkspace,
|
|
1120
|
-
}),
|
|
1121
|
-
),
|
|
1122
|
-
h(ChipMenu, {
|
|
1123
|
-
open: open === "perm",
|
|
1124
|
-
onToggle: (next) => setOpen(next ? "perm" : ""),
|
|
1125
|
-
icon: h(ShieldIcon),
|
|
1126
|
-
label: perm.label,
|
|
1127
|
-
ariaLabel: t("composer.permission"),
|
|
1128
|
-
},
|
|
1129
|
-
...permissionOptions.map((item) => h(ChipRow, {
|
|
1130
|
-
key: item.value,
|
|
1131
|
-
icon: h(ShieldIcon),
|
|
1132
|
-
label: item.label,
|
|
1133
|
-
active: item.value === permission,
|
|
1134
|
-
onClick: () => selectPermission(item.value),
|
|
1135
|
-
})),
|
|
1136
|
-
),
|
|
1137
|
-
),
|
|
1138
|
-
h("div", { className: "ima-composer-right" },
|
|
1139
|
-
h(ChipMenu, {
|
|
1140
|
-
open: open === "model",
|
|
1141
|
-
onToggle: (next) => {
|
|
1142
|
-
setOpen(next ? "model" : "");
|
|
1143
|
-
if (next) setModelPane("root");
|
|
1144
|
-
},
|
|
1145
|
-
align: "end",
|
|
1146
|
-
className: "ima-model-select",
|
|
1147
|
-
menuClassName: "ima-model-menu",
|
|
1148
|
-
menuAria: props.modelT("menu.aria"),
|
|
1149
|
-
label: (currentModel && currentModel.label) || modelFallback,
|
|
1150
|
-
suffix: effortLabel,
|
|
1151
|
-
ariaLabel: props.modelT("trigger.selectAria"),
|
|
1152
|
-
},
|
|
1153
|
-
modelPane === "root" && [
|
|
1154
|
-
h(ChipRow, {
|
|
1155
|
-
key: "model",
|
|
1156
|
-
kv: true,
|
|
1157
|
-
label: props.modelT("menu.model"),
|
|
1158
|
-
hint: (currentModel && currentModel.label) || modelFallback,
|
|
1159
|
-
chevron: true,
|
|
1160
|
-
onClick: () => setModelPane("model"),
|
|
1161
|
-
}),
|
|
1162
|
-
reasoning && h(ChipRow, {
|
|
1163
|
-
key: "effort",
|
|
1164
|
-
kv: true,
|
|
1165
|
-
label: props.modelT("menu.effort"),
|
|
1166
|
-
hint: effortLabel || props.modelT("effort.providerDefault"),
|
|
1167
|
-
chevron: true,
|
|
1168
|
-
onClick: () => setModelPane("effort"),
|
|
1169
|
-
}),
|
|
1170
|
-
],
|
|
1171
|
-
modelPane === "model" && (
|
|
1172
|
-
models.length === 0
|
|
1173
|
-
? h("div", { className: "ima-chip-empty" }, props.modelT("empty.models"))
|
|
1174
|
-
: modelGroups.map((group) => h("section", { key: group.id, className: "ima-model-group", role: "group", "aria-label": group.name },
|
|
1175
|
-
h("div", { className: "ima-model-group-title" }, group.name),
|
|
1176
|
-
...group.models.map((item) => h(ModelChoiceRow, {
|
|
1177
|
-
key: item.value,
|
|
1178
|
-
label: item.label,
|
|
1179
|
-
description: item.description,
|
|
1180
|
-
active: item.provider === provider && item.model === model,
|
|
1181
|
-
onClick: () => {
|
|
1182
|
-
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
1183
|
-
setProvider(item.provider);
|
|
1184
|
-
setModel(item.model);
|
|
1185
|
-
setEffort(nextEffort);
|
|
1186
|
-
save({ provider: item.provider, model: item.model, reasoningEffort: nextEffort || null });
|
|
1187
|
-
setOpen("");
|
|
1188
|
-
},
|
|
1189
|
-
})),
|
|
1190
|
-
))
|
|
1191
|
-
),
|
|
1192
|
-
modelPane === "effort" && efforts.map((item) => h(ModelChoiceRow, {
|
|
1193
|
-
key: item.id,
|
|
1194
|
-
label: item.name,
|
|
1195
|
-
description: item.description,
|
|
1196
|
-
active: item.id === effectiveEffort,
|
|
1197
|
-
onClick: () => {
|
|
1198
|
-
setEffort(item.id);
|
|
1199
|
-
if (provider && model) save({ provider, model, reasoningEffort: item.id || null });
|
|
1200
|
-
setOpen("");
|
|
1201
|
-
},
|
|
1202
|
-
})),
|
|
1203
|
-
),
|
|
1204
|
-
),
|
|
1205
|
-
),
|
|
1206
|
-
adding && h("div", { className: "ima-chip-dialog" },
|
|
1207
|
-
h("strong", null, t("composer.addWorkspace")),
|
|
1208
|
-
h("input", {
|
|
1209
|
-
value: addPath,
|
|
1210
|
-
placeholder: t("composer.workspacePath"),
|
|
1211
|
-
"aria-label": t("composer.workspacePath"),
|
|
1212
|
-
onChange: (event) => setAddPath(event.target.value),
|
|
1213
|
-
}),
|
|
1214
|
-
h("div", { className: "ima-chip-dialog-actions" },
|
|
1215
|
-
h("button", { className: "ima-btn", onClick: () => { setAdding(false); setAddPath(""); } }, t("action.cancel")),
|
|
1216
|
-
h("button", {
|
|
1217
|
-
className: "ima-btn primary",
|
|
1218
|
-
disabled: addBusy || !addPath.trim(),
|
|
1219
|
-
onClick: () => addWorkspace(addPath),
|
|
1220
|
-
}, addBusy ? t("action.adding") : t("action.confirm")),
|
|
1221
|
-
),
|
|
1222
|
-
),
|
|
1223
|
-
hint && h("div", { className: "ima-composer-hint" }, hint),
|
|
1224
|
-
h(RiskConfirmation, {
|
|
1225
|
-
open: confirmingFullAccess,
|
|
1226
|
-
title: props.permissionT("confirm.title"),
|
|
1227
|
-
description: props.permissionT("confirm.description"),
|
|
1228
|
-
acknowledgeLabel: props.permissionT("confirm.acknowledge"),
|
|
1229
|
-
cancelLabel: props.permissionT("confirm.cancel"),
|
|
1230
|
-
confirmLabel: props.permissionT("confirm.enable"),
|
|
1231
|
-
acknowledged: fullAccessAcknowledged,
|
|
1232
|
-
onAcknowledgedChange: setFullAccessAcknowledged,
|
|
1233
|
-
onCancel: () => { setFullAccessAcknowledged(false); setConfirmingFullAccess(false); },
|
|
1234
|
-
onConfirm: () => {
|
|
1235
|
-
setPermission("danger-full-access");
|
|
1236
|
-
save({ permission: "danger-full-access" });
|
|
1237
|
-
setFullAccessAcknowledged(false);
|
|
1238
|
-
setConfirmingFullAccess(false);
|
|
1239
|
-
},
|
|
1240
|
-
}),
|
|
1241
|
-
);
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
976
|
function AccountInspector({ account, catalog, permissions, workspaces, createWorkspace, pickDirectory, modelT, permissionT, t, onAction, onSave }) {
|
|
1245
977
|
const [draft, setDraft] = useState(account);
|
|
1246
978
|
const [note, setNote] = useState("");
|
package/lib/client.js
CHANGED
|
@@ -389,13 +389,8 @@ window.__ModuleLoader__.load({
|
|
|
389
389
|
.ima-avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;border:2px solid #111}
|
|
390
390
|
.ima-avatar.bot{background:#123524;margin-right:-8px;z-index:1}
|
|
391
391
|
.ima-avatar.user{background:#3d3428}
|
|
392
|
-
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:
|
|
393
|
-
.ima-sub{margin:
|
|
394
|
-
.ima-composer-wrap{margin:0 0 16px}
|
|
395
|
-
.ima-composer{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;gap:4px;padding:4px 6px;border:1px solid var(--ima-line);border-radius:14px;background:var(--ima-card)}
|
|
396
|
-
.ima-composer-left,.ima-composer-right{display:contents}
|
|
397
|
-
.ima-composer .ima-chip{width:100%;min-width:0}
|
|
398
|
-
.ima-composer .ima-chip-btn{width:100%;justify-content:center}
|
|
392
|
+
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap;text-align:left}
|
|
393
|
+
.ima-sub{margin:12px 0 0;max-width:42em;color:var(--ima-muted);font-size:14px;line-height:22px;text-align:left}
|
|
399
394
|
.ima-chip{position:relative;min-width:0;z-index:1}
|
|
400
395
|
.ima-chip.is-open{z-index:30}
|
|
401
396
|
.ima-chip-btn{display:inline-flex;align-items:center;gap:6px;min-height:28px;height:28px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--ima-muted);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer}
|
|
@@ -409,7 +404,6 @@ window.__ModuleLoader__.load({
|
|
|
409
404
|
.ima-chip-row-main{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
410
405
|
.ima-chip-tick{width:6px;height:12px;border-right:1.6px solid var(--ima-accent);border-bottom:1.6px solid var(--ima-accent);transform:rotate(45deg) translateY(-2px);flex:none}
|
|
411
406
|
.ima-chip-empty{padding:14px 12px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
412
|
-
.ima-composer-hint{margin-top:8px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
413
407
|
.ima-chip svg{flex:none}
|
|
414
408
|
.ima-chip-row.is-kv .ima-chip-row-main{flex:none}
|
|
415
409
|
.ima-chip-row-side{display:inline-flex;align-items:center;gap:8px;color:var(--ima-muted);font-size:12px;min-width:0}
|
|
@@ -417,9 +411,9 @@ window.__ModuleLoader__.load({
|
|
|
417
411
|
.ima-chip-split{height:1px;margin:6px 8px;background:var(--ima-line)}
|
|
418
412
|
.ima-chip-effort{color:var(--ima-muted);font-weight:500}
|
|
419
413
|
.ima-model-select .ima-chip-btn{border-radius:24px;gap:4px}
|
|
420
|
-
.ima-model-select .ima-chip-menu{width:min(240px,calc(100vw - 32px));
|
|
414
|
+
.ima-model-select .ima-chip-menu{width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:calc(100vw - 32px);box-sizing:border-box;max-height:min(360px,calc(100vh - 96px));padding:4px;border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff))}
|
|
421
415
|
.ima-model-select .ima-chip-row{min-height:40px;padding:0 10px;font-size:14px}
|
|
422
|
-
.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
416
|
+
.ima-model-select .ima-chip-row-side>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
423
417
|
.ima-model-group+.ima-model-group{margin-top:4px}
|
|
424
418
|
.ima-model-group-title{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff));color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:12px;font-weight:500;line-height:18px}
|
|
425
419
|
.ima-model-option{display:flex;width:100%;min-height:38px;align-items:center;gap:8px;padding:6px 8px;border:0;border-radius:10px;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));text-align:left;cursor:pointer}
|
|
@@ -502,8 +496,8 @@ window.__ModuleLoader__.load({
|
|
|
502
496
|
.ima-radio small{display:block;color:var(--ima-muted);margin-top:2px}
|
|
503
497
|
.ima-ok{color:var(--ima-ok);font-size:14px;text-align:center;padding:24px 0}
|
|
504
498
|
.ima-modal .ima-error{color:var(--ima-danger)}
|
|
505
|
-
.ima-page.ima-account-page{max-width:1120px;padding-bottom:40px}
|
|
506
|
-
.ima-account-shell{display:grid;grid-template-columns:
|
|
499
|
+
.ima-page.ima-account-page{container-type:inline-size;min-width:0;max-width:1120px;padding-bottom:40px}
|
|
500
|
+
.ima-account-shell{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:transparent}
|
|
507
501
|
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:transparent}
|
|
508
502
|
.ima-platform{border:0;border-bottom:1px solid var(--ima-line);border-radius:0;margin:0;overflow:visible;background:transparent}.ima-platform:last-child{border-bottom:0}.ima-platform.open{background:transparent}
|
|
509
503
|
.ima-platform-head{display:flex;align-items:center;gap:10px;width:100%;min-height:64px;padding:10px 18px;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
@@ -519,14 +513,31 @@ window.__ModuleLoader__.load({
|
|
|
519
513
|
.ima-inspector-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px;padding-top:18px;border-top:1px solid var(--ima-line)}.ima-inspector-actions .ima-btn{flex:none;min-width:0;min-height:36px;padding:0 8px;font-size:12px;white-space:nowrap}.ima-inspector-actions .danger{margin-left:auto;color:var(--ima-danger);border-color:color-mix(in srgb,var(--ima-danger) 35%,transparent)}
|
|
520
514
|
.ima-save-note{min-height:18px;color:var(--ima-muted);font-size:11px}.ima-save-note.ok{color:var(--ima-ok)}
|
|
521
515
|
.ima-modal.ima-account-modal{width:min(560px,100%);max-height:min(760px,calc(100vh - 48px));overflow:auto}.ima-setup-section{margin:4px 0 14px;padding-bottom:14px;border-bottom:1px solid var(--ima-line)}
|
|
522
|
-
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max(100%,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
516
|
+
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max-content;min-width:min(100%,calc(100vw - 32px));left:auto;right:0}.ima-account-settings .ima-chip-dialog{grid-column:1/-1;margin-top:0}.ima-picker-note{grid-column:1/-1;color:var(--ima-muted);font-size:11px;line-height:1.5}.ima-picker-note.warning{color:var(--ima-warning)}
|
|
517
|
+
.ima-account-shell,.ima-account-shell *{box-sizing:border-box}
|
|
518
|
+
.ima-platforms{min-width:0}
|
|
519
|
+
.ima-platform-head{display:grid;grid-template-columns:24px minmax(0,1fr) 12px;gap:8px;padding:12px;min-height:76px}
|
|
520
|
+
.ima-platform-head>.ima-logo,.ima-platform-head>.ima-logo svg{width:24px;height:24px}
|
|
521
|
+
.ima-platform-title{grid-column:2;grid-row:1;overflow-wrap:anywhere}
|
|
522
|
+
.ima-platform-caret{grid-column:3;grid-row:1;width:12px;margin:0}
|
|
523
|
+
.ima-platform-count{grid-column:1/3;grid-row:2;font-size:11px;white-space:normal;padding-right:80px}
|
|
524
|
+
.ima-platform-add{grid-column:1/4;grid-row:2;justify-self:end;min-height:28px;padding:0 8px;font-weight:500}
|
|
525
|
+
.ima-account-list{padding:0 8px 10px}
|
|
526
|
+
.ima-account-row{display:grid;grid-template-columns:7px minmax(0,1fr) 12px;gap:6px;min-height:60px;padding:10px 8px}
|
|
527
|
+
.ima-account-row>.ima-logo{display:none}
|
|
528
|
+
.ima-account-copy{grid-column:2;grid-row:1}
|
|
529
|
+
.ima-account-row>.ima-dot{grid-column:1;grid-row:1}
|
|
530
|
+
.ima-account-next{grid-column:3;grid-row:1;width:12px}
|
|
531
|
+
.ima-account-state{grid-column:2;grid-row:2;font-size:11px}
|
|
532
|
+
.ima-inspector{padding:18px 16px;overflow-wrap:anywhere}
|
|
533
|
+
.ima-switch-row{gap:10px}.ima-switch-copy{min-width:0}
|
|
534
|
+
@container(max-width:620px){.ima-inspector{padding:16px 12px}.ima-inspector-head{gap:8px}.ima-inspector-title{font-size:15px}.ima-platform-head{padding:10px 8px;gap:6px}.ima-platform-title{font-size:13px}.ima-inspector-empty{padding:16px;min-height:180px}}
|
|
535
|
+
@container(max-width:420px){.ima-title{font-size:22px}.ima-platform-count{grid-column:1/4;padding-right:0}.ima-platform-add{grid-row:3;justify-self:start}.ima-inspector{padding:12px 8px}.ima-inspector-head{flex-wrap:wrap}}
|
|
536
|
+
@media(max-width:620px){.ima-account-settings{grid-template-columns:1fr}.ima-picker-field.wide{grid-column:auto}}
|
|
526
537
|
@media (prefers-reduced-motion:reduce){.ima-switch i{transition:none}}
|
|
527
538
|
`;
|
|
528
539
|
|
|
529
|
-
const TITLE_LINK_CSS = ".ima-title-row{display:flex;align-items:center;gap:8px;min-width:0}.ima-title-links{display:flex;align-items:center;gap:4px}.ima-title-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap}.ima-title-link:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ima-title-link:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}.ima-title-link svg{flex:none}@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
540
|
+
const TITLE_LINK_CSS = ".ima-title-row{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}.ima-title-links{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.ima-title-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap}.ima-title-link:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ima-title-link:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}.ima-title-link svg{flex:none}@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
530
541
|
|
|
531
542
|
let styleEl = null;
|
|
532
543
|
const ensureStyle = () => {
|
|
@@ -1183,7 +1194,6 @@ window.__ModuleLoader__.load({
|
|
|
1183
1194
|
...group.models.map((item) => h(ModelChoiceRow, {
|
|
1184
1195
|
key: item.value,
|
|
1185
1196
|
label: item.label,
|
|
1186
|
-
description: item.description,
|
|
1187
1197
|
active: item.provider === provider && item.model === model,
|
|
1188
1198
|
onClick: () => {
|
|
1189
1199
|
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
@@ -1257,284 +1267,6 @@ window.__ModuleLoader__.load({
|
|
|
1257
1267
|
);
|
|
1258
1268
|
}
|
|
1259
1269
|
|
|
1260
|
-
function ComposerBar(props) {
|
|
1261
|
-
const t = props.t || fallbackT;
|
|
1262
|
-
const items = typeof props.useWorkspaces === "function"
|
|
1263
|
-
? (props.useWorkspaces((state) => (state && state.items) || []) || [])
|
|
1264
|
-
: [];
|
|
1265
|
-
const [providers, setProviders] = useState([]);
|
|
1266
|
-
const [permissions, setPermissions] = useState([]);
|
|
1267
|
-
const [provider, setProvider] = useState("");
|
|
1268
|
-
const [model, setModel] = useState("");
|
|
1269
|
-
const [effort, setEffort] = useState("");
|
|
1270
|
-
const [cwd, setCwd] = useState("");
|
|
1271
|
-
const [permission, setPermission] = useState("");
|
|
1272
|
-
const [confirmingFullAccess, setConfirmingFullAccess] = useState(false);
|
|
1273
|
-
const [fullAccessAcknowledged, setFullAccessAcknowledged] = useState(false);
|
|
1274
|
-
const [open, setOpen] = useState("");
|
|
1275
|
-
const [modelPane, setModelPane] = useState("root");
|
|
1276
|
-
const [hint, setHint] = useState("");
|
|
1277
|
-
const [adding, setAdding] = useState(false);
|
|
1278
|
-
const [addPath, setAddPath] = useState("");
|
|
1279
|
-
const [addBusy, setAddBusy] = useState(false);
|
|
1280
|
-
|
|
1281
|
-
useEffect(() => {
|
|
1282
|
-
api("/assistant").then((data) => {
|
|
1283
|
-
if (!data.ok) { setHint(serverText(data.error, t) || t("error.loadAssistant")); return; }
|
|
1284
|
-
const list = data.providers || [];
|
|
1285
|
-
setProviders(list);
|
|
1286
|
-
setPermissions(data.permissions || []);
|
|
1287
|
-
const current = data.assistant || {};
|
|
1288
|
-
const nextProvider = current.provider || (list[0] && list[0].id) || "";
|
|
1289
|
-
const models = ((list.find((item) => item.id === nextProvider) || {}).models) || [];
|
|
1290
|
-
const nextModel = current.model || (models[0] && models[0].id) || "";
|
|
1291
|
-
const found = models.find((item) => item.id === nextModel) || models[0];
|
|
1292
|
-
setProvider(nextProvider);
|
|
1293
|
-
setModel(nextModel);
|
|
1294
|
-
setEffort(current.reasoningEffort || (found && found.reasoning && found.reasoning.defaultEffort) || "");
|
|
1295
|
-
setCwd(data.cwd || "");
|
|
1296
|
-
setPermission(data.permission || "");
|
|
1297
|
-
if (!list.length) setHint(t("error.noModels"));
|
|
1298
|
-
}).catch(() => setHint(t("error.loadAssistant")));
|
|
1299
|
-
}, []);
|
|
1300
|
-
|
|
1301
|
-
const save = (body) => {
|
|
1302
|
-
api("/assistant", {
|
|
1303
|
-
method: "POST",
|
|
1304
|
-
headers: { "content-type": "application/json" },
|
|
1305
|
-
body: JSON.stringify(body),
|
|
1306
|
-
}).then((data) => {
|
|
1307
|
-
if (!data.ok) setHint(serverText(data.error, t) || t("error.save"));
|
|
1308
|
-
else setHint("");
|
|
1309
|
-
}).catch(() => setHint(t("error.save")));
|
|
1310
|
-
};
|
|
1311
|
-
|
|
1312
|
-
const workspace = items.find((item) => item.path === cwd);
|
|
1313
|
-
const modelGroups = providers.map((item) => ({
|
|
1314
|
-
id: item.id,
|
|
1315
|
-
name: item.name || item.id,
|
|
1316
|
-
models: (item.models || []).map((entry) => ({
|
|
1317
|
-
value: item.id + "::" + entry.id,
|
|
1318
|
-
provider: item.id,
|
|
1319
|
-
providerName: item.name || item.id,
|
|
1320
|
-
model: entry.id,
|
|
1321
|
-
label: entry.name || entry.id,
|
|
1322
|
-
description: entry.description,
|
|
1323
|
-
reasoning: entry.reasoning,
|
|
1324
|
-
})),
|
|
1325
|
-
})).filter((item) => item.models.length > 0);
|
|
1326
|
-
const models = modelGroups.flatMap((item) => item.models);
|
|
1327
|
-
const currentModel = models.find((item) => item.provider === provider && item.model === model);
|
|
1328
|
-
const reasoning = currentModel && currentModel.reasoning;
|
|
1329
|
-
const effectiveEffort = effort || (reasoning && reasoning.defaultEffort) || "";
|
|
1330
|
-
const efforts = reasoning
|
|
1331
|
-
? [
|
|
1332
|
-
...(reasoning.defaultEffort ? [] : [{ id: "", name: props.modelT("effort.providerDefault") }]),
|
|
1333
|
-
...((reasoning.efforts || []).map((item) => ({ id: item.id, name: item.name || item.id, description: item.description }))),
|
|
1334
|
-
]
|
|
1335
|
-
: [];
|
|
1336
|
-
const effortLabel = reasoning
|
|
1337
|
-
? ((efforts.find((item) => item.id === effectiveEffort) || {}).name || effectiveEffort || props.modelT("effort.providerDefault"))
|
|
1338
|
-
: "";
|
|
1339
|
-
const permissionOptions = permissions.map((item) => ({
|
|
1340
|
-
...item,
|
|
1341
|
-
label: permissionLabel(item, t),
|
|
1342
|
-
}));
|
|
1343
|
-
const perm = permissionOptions.find((item) => item.value === permission) || { label: permission || t("composer.permission") };
|
|
1344
|
-
const modelFallback = props.modelT("trigger.fallback");
|
|
1345
|
-
|
|
1346
|
-
const addWorkspace = (path) => {
|
|
1347
|
-
const next = (path || "").trim();
|
|
1348
|
-
if (!next) { setHint(t("error.chooseWorkspace")); return Promise.resolve(); }
|
|
1349
|
-
if (typeof props.createWorkspace !== "function") { setHint(t("error.workspaceUnavailable")); return Promise.resolve(); }
|
|
1350
|
-
setAddBusy(true);
|
|
1351
|
-
return Promise.resolve(props.createWorkspace({ path: next })).then((created) => {
|
|
1352
|
-
const cwdPath = (created && (created.path || created.cwd)) || next;
|
|
1353
|
-
setCwd(cwdPath);
|
|
1354
|
-
save({ cwd: cwdPath });
|
|
1355
|
-
setAdding(false);
|
|
1356
|
-
setAddPath("");
|
|
1357
|
-
setOpen("");
|
|
1358
|
-
}).catch((error) => {
|
|
1359
|
-
setHint((error && error.message) || t("error.addWorkspace"));
|
|
1360
|
-
}).finally(() => setAddBusy(false));
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
|
-
const selectPermission = (next) => {
|
|
1364
|
-
setOpen("");
|
|
1365
|
-
if (next === permission) return;
|
|
1366
|
-
if (next === "danger-full-access") {
|
|
1367
|
-
setFullAccessAcknowledged(false);
|
|
1368
|
-
setConfirmingFullAccess(true);
|
|
1369
|
-
return;
|
|
1370
|
-
}
|
|
1371
|
-
setPermission(next);
|
|
1372
|
-
save({ permission: next });
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
|
-
const onAddWorkspace = () => {
|
|
1376
|
-
setOpen("");
|
|
1377
|
-
if (typeof props.pickDirectory === "function") {
|
|
1378
|
-
Promise.resolve(props.pickDirectory()).then((picked) => {
|
|
1379
|
-
if (!picked) return;
|
|
1380
|
-
return addWorkspace(picked);
|
|
1381
|
-
}).catch(() => {
|
|
1382
|
-
setAdding(true);
|
|
1383
|
-
setAddPath("");
|
|
1384
|
-
});
|
|
1385
|
-
return;
|
|
1386
|
-
}
|
|
1387
|
-
setAdding(true);
|
|
1388
|
-
setAddPath("");
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
|
-
return h("div", { className: "ima-composer-wrap" },
|
|
1392
|
-
h("div", { className: "ima-composer", "aria-label": t("composer.aria") },
|
|
1393
|
-
h("div", { className: "ima-composer-left" },
|
|
1394
|
-
h(ChipMenu, {
|
|
1395
|
-
open: open === "ws",
|
|
1396
|
-
onToggle: (next) => setOpen(next ? "ws" : ""),
|
|
1397
|
-
icon: h(FolderIcon),
|
|
1398
|
-
label: (workspace && (workspace.title || workspace.path)) || cwd || t("composer.project"),
|
|
1399
|
-
ariaLabel: t("composer.projectAria"),
|
|
1400
|
-
},
|
|
1401
|
-
items.length === 0 && h("div", { className: "ima-chip-empty" }, t("composer.noWorkspaces")),
|
|
1402
|
-
...items.map((item) => h(ChipRow, {
|
|
1403
|
-
key: item.path,
|
|
1404
|
-
icon: h(FolderIcon),
|
|
1405
|
-
label: item.title || item.path,
|
|
1406
|
-
active: item.path === cwd,
|
|
1407
|
-
onClick: () => { setCwd(item.path); save({ cwd: item.path }); setOpen(""); },
|
|
1408
|
-
})),
|
|
1409
|
-
h("div", { className: "ima-chip-split" }),
|
|
1410
|
-
h(ChipRow, {
|
|
1411
|
-
icon: h(PlusIcon),
|
|
1412
|
-
label: t("composer.addWorkspace"),
|
|
1413
|
-
onClick: onAddWorkspace,
|
|
1414
|
-
}),
|
|
1415
|
-
),
|
|
1416
|
-
h(ChipMenu, {
|
|
1417
|
-
open: open === "perm",
|
|
1418
|
-
onToggle: (next) => setOpen(next ? "perm" : ""),
|
|
1419
|
-
icon: h(ShieldIcon),
|
|
1420
|
-
label: perm.label,
|
|
1421
|
-
ariaLabel: t("composer.permission"),
|
|
1422
|
-
},
|
|
1423
|
-
...permissionOptions.map((item) => h(ChipRow, {
|
|
1424
|
-
key: item.value,
|
|
1425
|
-
icon: h(ShieldIcon),
|
|
1426
|
-
label: item.label,
|
|
1427
|
-
active: item.value === permission,
|
|
1428
|
-
onClick: () => selectPermission(item.value),
|
|
1429
|
-
})),
|
|
1430
|
-
),
|
|
1431
|
-
),
|
|
1432
|
-
h("div", { className: "ima-composer-right" },
|
|
1433
|
-
h(ChipMenu, {
|
|
1434
|
-
open: open === "model",
|
|
1435
|
-
onToggle: (next) => {
|
|
1436
|
-
setOpen(next ? "model" : "");
|
|
1437
|
-
if (next) setModelPane("root");
|
|
1438
|
-
},
|
|
1439
|
-
align: "end",
|
|
1440
|
-
className: "ima-model-select",
|
|
1441
|
-
menuClassName: "ima-model-menu",
|
|
1442
|
-
menuAria: props.modelT("menu.aria"),
|
|
1443
|
-
label: (currentModel && currentModel.label) || modelFallback,
|
|
1444
|
-
suffix: effortLabel,
|
|
1445
|
-
ariaLabel: props.modelT("trigger.selectAria"),
|
|
1446
|
-
},
|
|
1447
|
-
modelPane === "root" && [
|
|
1448
|
-
h(ChipRow, {
|
|
1449
|
-
key: "model",
|
|
1450
|
-
kv: true,
|
|
1451
|
-
label: props.modelT("menu.model"),
|
|
1452
|
-
hint: (currentModel && currentModel.label) || modelFallback,
|
|
1453
|
-
chevron: true,
|
|
1454
|
-
onClick: () => setModelPane("model"),
|
|
1455
|
-
}),
|
|
1456
|
-
reasoning && h(ChipRow, {
|
|
1457
|
-
key: "effort",
|
|
1458
|
-
kv: true,
|
|
1459
|
-
label: props.modelT("menu.effort"),
|
|
1460
|
-
hint: effortLabel || props.modelT("effort.providerDefault"),
|
|
1461
|
-
chevron: true,
|
|
1462
|
-
onClick: () => setModelPane("effort"),
|
|
1463
|
-
}),
|
|
1464
|
-
],
|
|
1465
|
-
modelPane === "model" && (
|
|
1466
|
-
models.length === 0
|
|
1467
|
-
? h("div", { className: "ima-chip-empty" }, props.modelT("empty.models"))
|
|
1468
|
-
: modelGroups.map((group) => h("section", { key: group.id, className: "ima-model-group", role: "group", "aria-label": group.name },
|
|
1469
|
-
h("div", { className: "ima-model-group-title" }, group.name),
|
|
1470
|
-
...group.models.map((item) => h(ModelChoiceRow, {
|
|
1471
|
-
key: item.value,
|
|
1472
|
-
label: item.label,
|
|
1473
|
-
description: item.description,
|
|
1474
|
-
active: item.provider === provider && item.model === model,
|
|
1475
|
-
onClick: () => {
|
|
1476
|
-
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
1477
|
-
setProvider(item.provider);
|
|
1478
|
-
setModel(item.model);
|
|
1479
|
-
setEffort(nextEffort);
|
|
1480
|
-
save({ provider: item.provider, model: item.model, reasoningEffort: nextEffort || null });
|
|
1481
|
-
setOpen("");
|
|
1482
|
-
},
|
|
1483
|
-
})),
|
|
1484
|
-
))
|
|
1485
|
-
),
|
|
1486
|
-
modelPane === "effort" && efforts.map((item) => h(ModelChoiceRow, {
|
|
1487
|
-
key: item.id,
|
|
1488
|
-
label: item.name,
|
|
1489
|
-
description: item.description,
|
|
1490
|
-
active: item.id === effectiveEffort,
|
|
1491
|
-
onClick: () => {
|
|
1492
|
-
setEffort(item.id);
|
|
1493
|
-
if (provider && model) save({ provider, model, reasoningEffort: item.id || null });
|
|
1494
|
-
setOpen("");
|
|
1495
|
-
},
|
|
1496
|
-
})),
|
|
1497
|
-
),
|
|
1498
|
-
),
|
|
1499
|
-
),
|
|
1500
|
-
adding && h("div", { className: "ima-chip-dialog" },
|
|
1501
|
-
h("strong", null, t("composer.addWorkspace")),
|
|
1502
|
-
h("input", {
|
|
1503
|
-
value: addPath,
|
|
1504
|
-
placeholder: t("composer.workspacePath"),
|
|
1505
|
-
"aria-label": t("composer.workspacePath"),
|
|
1506
|
-
onChange: (event) => setAddPath(event.target.value),
|
|
1507
|
-
}),
|
|
1508
|
-
h("div", { className: "ima-chip-dialog-actions" },
|
|
1509
|
-
h("button", { className: "ima-btn", onClick: () => { setAdding(false); setAddPath(""); } }, t("action.cancel")),
|
|
1510
|
-
h("button", {
|
|
1511
|
-
className: "ima-btn primary",
|
|
1512
|
-
disabled: addBusy || !addPath.trim(),
|
|
1513
|
-
onClick: () => addWorkspace(addPath),
|
|
1514
|
-
}, addBusy ? t("action.adding") : t("action.confirm")),
|
|
1515
|
-
),
|
|
1516
|
-
),
|
|
1517
|
-
hint && h("div", { className: "ima-composer-hint" }, hint),
|
|
1518
|
-
h(RiskConfirmation, {
|
|
1519
|
-
open: confirmingFullAccess,
|
|
1520
|
-
title: props.permissionT("confirm.title"),
|
|
1521
|
-
description: props.permissionT("confirm.description"),
|
|
1522
|
-
acknowledgeLabel: props.permissionT("confirm.acknowledge"),
|
|
1523
|
-
cancelLabel: props.permissionT("confirm.cancel"),
|
|
1524
|
-
confirmLabel: props.permissionT("confirm.enable"),
|
|
1525
|
-
acknowledged: fullAccessAcknowledged,
|
|
1526
|
-
onAcknowledgedChange: setFullAccessAcknowledged,
|
|
1527
|
-
onCancel: () => { setFullAccessAcknowledged(false); setConfirmingFullAccess(false); },
|
|
1528
|
-
onConfirm: () => {
|
|
1529
|
-
setPermission("danger-full-access");
|
|
1530
|
-
save({ permission: "danger-full-access" });
|
|
1531
|
-
setFullAccessAcknowledged(false);
|
|
1532
|
-
setConfirmingFullAccess(false);
|
|
1533
|
-
},
|
|
1534
|
-
}),
|
|
1535
|
-
);
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
1270
|
function AccountInspector({ account, catalog, permissions, workspaces, createWorkspace, pickDirectory, modelT, permissionT, t, onAction, onSave }) {
|
|
1539
1271
|
const [draft, setDraft] = useState(account);
|
|
1540
1272
|
const [note, setNote] = useState("");
|