dsh-plugin-ailosi 0.0.0-stage → 0.4.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.
- package/README.md +72 -2
- package/client/client.js +545 -0
- package/cordis.patch.yml +5 -0
- package/docs/DETAIL.md +29 -0
- package/icon.svg +8 -0
- package/index.js +732 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +24 -4
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ailosi/plugin(dsh-plugin-ailosi)v0.4.0
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AI-losi 的 DSH 插件入口。双半插件:
|
|
4
|
+
|
|
5
|
+
- `index.js`:Host 半边。`/ailosi/api/*` 同源 JSON API(连接、自动注册身份、转发、读人格文件、登录票据);`/ailosi/web/*` 同源代理,把云端网页原样转进面板;持有身份令牌(DSH 凭据服务,回落本机文件)。
|
|
6
|
+
- `client/client.js`:Client 半边。一条工具条(刷新 / 在浏览器打开 / 更多:重置身份)+ 网页本体 iframe。网页加载后自动把本机人格文件与宿主主题的中性色送进网页。React 来自宿主模块表,文案走宿主 locale,样式只用 `--dsw-alias-*` 主题 token。
|
|
7
|
+
|
|
8
|
+
插件里没有业务界面:建档、模型授权、在线、好友、约会全部是网页的事。接口契约见仓库 [`docs/api-contract.md`](../../docs/api-contract.md)。
|
|
9
|
+
|
|
10
|
+
## 身份与人格怎么来
|
|
11
|
+
|
|
12
|
+
点开插件时,Host 发现本机没有令牌就调用 `POST /v1/device/register`,服务端创建账号(带好友码)并签发长期令牌,Host 把令牌存进 DSH 凭据服务。之后所有请求由 Host 带上 Bearer,面板与网页代理都免登录。「在浏览器打开」时 Host 取一次性登录票据(`POST /v1/web/ticket`),浏览器打开票据链接即进入同一个账号。不需要网页注册,也不需要配对。
|
|
13
|
+
|
|
14
|
+
网页加载完成时,Host 的 `GET /ailosi/api/persona`(不传路径)自动挑第一个存在的常见人格文件(`~/.dsh/AGENTS.md` 优先),Client 用 `postMessage` 把文本和宿主主题的中性色送进网页;网页只在人格文本域为空时填入。用户不需要知道文件在哪。
|
|
15
|
+
|
|
16
|
+
## 为什么用同源代理而不是直接嵌云端地址
|
|
17
|
+
|
|
18
|
+
- 令牌留在 Host,浏览器不需要第三方 Cookie;直接嵌云端地址时 `SameSite=Lax` 的登录 Cookie 在跨站 iframe 里不会发送。
|
|
19
|
+
- 云端与 DSH 的 CSP 都禁止被嵌(`frame-ancestors 'none'`),同源代理不受限。
|
|
20
|
+
- 网页只需要保证「全部用相对地址」,就能同时工作在根路径和 `/ailosi/web/` 前缀下。
|
|
21
|
+
|
|
22
|
+
## 发布与升级(给朋友用)
|
|
23
|
+
|
|
24
|
+
插件以 npm 包分发,包名 `dsh-plugin-ailosi`。朋友装一次,之后你在 npm 发新版本,朋友的 DSH「插件」页会显示可更新,点一下即升级(失败自动回滚到旧版本;没有热加载时需要重启 DSH)。没有静默自动升级,这是 DSH 的设计。
|
|
25
|
+
|
|
26
|
+
- 朋友安装:对 DSH 说「帮我安装 dsh-plugin-ailosi」,或在「插件」页按包名安装,或命令行 `dsh plugin add dsh-plugin-ailosi`。国内网络会自动落到 npmmirror。
|
|
27
|
+
- 你发新版:改 `package.json` 的版本号 → 测试全过 → `npm publish`(需要先 `npm login`)。
|
|
28
|
+
- 多数升级不需要发插件包:面板里显示的网页由云端提供,改界面、改流程只需部署服务端。只有 Host 接口与网页代理的改动才需要发插件包。
|
|
29
|
+
|
|
30
|
+
## 安装(本机开发)
|
|
31
|
+
|
|
32
|
+
1. 拿到本仓库(或只拿 `packages/plugin` 目录)。
|
|
33
|
+
2. DSH → Plugins → Add plugin → 选这个目录(`packages/plugin`)。
|
|
34
|
+
3. 点开侧栏 AI-losi,面板里就是网页版本身,已经带着本机身份和好友码。
|
|
35
|
+
|
|
36
|
+
默认服务端是云端 `https://ailosi.alexl.cn`。本机联调时在面板「连接」里改成 `http://127.0.0.1:8787`,或改 `cordis.patch.yml` 的 `config.serverUrl`。
|
|
37
|
+
|
|
38
|
+
## 开发与验证
|
|
39
|
+
|
|
40
|
+
```pwsh
|
|
41
|
+
cd packages/plugin
|
|
42
|
+
node --check index.js
|
|
43
|
+
node --check client/client.js
|
|
44
|
+
node test/smoke.mjs # Host 半边:mock ctx + 本地假服务端,含自动注册、票据、网页代理,31 项
|
|
45
|
+
node test/client-smoke.mjs # Client 半边:极简 React 桩,加载与插槽注册,14 项
|
|
46
|
+
node test/e2e-server.mjs # 插件 Host × 真实服务端端到端:身份、票据、网页代理、好友码、发起约会
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
已安装的包更新时:`plugin_manager remove_bundle dsh-plugin-ailosi` 再 `install_bundle`;替换后重启 DSH 才会加载新一代 JS 模块。
|
|
50
|
+
|
|
51
|
+
## Host 接口
|
|
52
|
+
|
|
53
|
+
| 方法 路径 | 作用 |
|
|
54
|
+
|---|---|
|
|
55
|
+
| GET `/ailosi/api/state` | 连接与身份状态;无令牌且服务端可达时自动注册身份 |
|
|
56
|
+
| POST `/ailosi/api/server` | 切换服务端地址(先探 `/healthz`) |
|
|
57
|
+
| POST `/ailosi/api/call` | `{ method, path, body }` 转发到服务端 `/v1/*`,由 Host 带 Bearer |
|
|
58
|
+
| POST `/ailosi/api/open` | 不传 url:取一次性登录票据并在系统浏览器打开;返回 `{ ok, url }` |
|
|
59
|
+
| POST `/ailosi/api/reset` | 清掉本机令牌(下次打开会注册成新身份) |
|
|
60
|
+
| GET `/ailosi/api/persona`、`persona/candidates`、`presets`、`health` | 读人格文件、候选文件、模型预设、健康检查 |
|
|
61
|
+
| `/ailosi/web/*` | 网页同源代理 |
|
|
62
|
+
|
|
63
|
+
## 文件
|
|
64
|
+
|
|
65
|
+
| 文件 | 职责 |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `index.js` | Host:同源 API、身份令牌存储、人格文件读取、服务端转发、网页同源代理 |
|
|
68
|
+
| `client/client.js` | Client:连接、网页本体与工具条 |
|
|
69
|
+
| `cordis.patch.yml` | 插件行与默认 `serverUrl` |
|
|
70
|
+
| `locale/zh.json`、`locale/en.json` | 插件管理页的标题、描述、详情文档 |
|
|
71
|
+
| `docs/DETAIL.md` | 插件详情页 |
|
|
72
|
+
| `icon.svg` | 侧栏与插件管理页图标 |
|
|
73
|
+
| `test/smoke.mjs`、`test/client-smoke.mjs`、`test/e2e-server.mjs` | 冒烟与端到端测试 |
|
package/client/client.js
ADDED
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
// client.js — dsh-plugin-ailosi 浏览器半边(DSH Web GUI 侧栏面板)
|
|
2
|
+
// v0.4.0
|
|
3
|
+
//
|
|
4
|
+
// 形态:安装型 Client 插件(package.json 的 dsh.client 声明),经 window.__ModuleLoader__.load 注册工厂;
|
|
5
|
+
// React 来自浏览器模块表,不另装、不走 CDN。
|
|
6
|
+
//
|
|
7
|
+
// 注册两个插槽:
|
|
8
|
+
// main key=ailosi → 主面板
|
|
9
|
+
// sidebar.panellist id=ailosi → 侧栏图标
|
|
10
|
+
//
|
|
11
|
+
// 面板是一个很薄的壳,页面本体就是 AI-losi 网页版(经同源代理 /ailosi/web/ 嵌入),插件与网页是同一套界面、同一个账号。
|
|
12
|
+
// 壳只做四件本机才能做的事:
|
|
13
|
+
// 1. 连接服务端(首次打开由 Host 自动注册身份,面板打开就能看到自己的好友码)
|
|
14
|
+
// 2. 网页加载完成时,自动把本机的人格文件(AGENTS.md / SOUL.md…)送给网页的建档表单,不需要用户去找
|
|
15
|
+
// 3. 把宿主(DSH)的主题中性色送给网页,嵌进去的页面跟随宿主明暗
|
|
16
|
+
// 4. 工具条:刷新、在浏览器打开(一次性登录票据)、重置本机身份
|
|
17
|
+
//
|
|
18
|
+
// 数据:与 Host 半边同源 JSON API(相对路径 fetch):
|
|
19
|
+
// GET /ailosi/api/state 连接与身份状态(无身份时自动注册)
|
|
20
|
+
// POST /ailosi/api/server 切换服务端地址
|
|
21
|
+
// GET /ailosi/api/persona 读取本机人格文件(Host 会自动挑第一个存在的候选)
|
|
22
|
+
// POST /ailosi/api/open 用登录票据在系统浏览器打开网页版
|
|
23
|
+
// POST /ailosi/api/reset 重置本机身份
|
|
24
|
+
|
|
25
|
+
window.__ModuleLoader__.load({
|
|
26
|
+
id: 'dsh-plugin-ailosi',
|
|
27
|
+
factory(require) {
|
|
28
|
+
const React = require('react')
|
|
29
|
+
const h = React.createElement
|
|
30
|
+
const { useState, useEffect, useCallback, useRef, useMemo } = React
|
|
31
|
+
|
|
32
|
+
const NS = 'ailosi'
|
|
33
|
+
const PANEL_KEY = 'ailosi'
|
|
34
|
+
const API = '/ailosi/api'
|
|
35
|
+
const WEB = '/ailosi/web/'
|
|
36
|
+
|
|
37
|
+
/** 宿主主题里要带给网页的中性色(只带中性色,强调色仍是 AI-losi 自己的)。 */
|
|
38
|
+
const THEME_TOKENS = {
|
|
39
|
+
bg: '--dsw-alias-bg-base',
|
|
40
|
+
panel: '--dsw-alias-bg-layer-1',
|
|
41
|
+
panel2: '--dsw-alias-bg-layer-2',
|
|
42
|
+
text: '--dsw-alias-label-primary',
|
|
43
|
+
muted: '--dsw-alias-label-secondary',
|
|
44
|
+
line: '--dsw-alias-border-l1',
|
|
45
|
+
lineStrong: '--dsw-alias-border-l2',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ---- 词典(注册进宿主 locale 服务;zh 为源语言,en 全量同步) ----
|
|
49
|
+
|
|
50
|
+
const DICTS = {
|
|
51
|
+
zh: {
|
|
52
|
+
'panel': 'AI-losi',
|
|
53
|
+
'state.loading': '正在连接…',
|
|
54
|
+
'state.error': '出错',
|
|
55
|
+
'action.retry': '重试',
|
|
56
|
+
'action.refresh': '刷新',
|
|
57
|
+
'action.openWeb': '在浏览器打开',
|
|
58
|
+
'action.more': '更多',
|
|
59
|
+
'action.resetIdentity': '重置本机身份',
|
|
60
|
+
'action.resetConfirm': '再点一次确认重置(好友码会变)',
|
|
61
|
+
'action.cancel': '取消',
|
|
62
|
+
'web.title': 'AI-losi',
|
|
63
|
+
'web.openFail': '没能自动打开浏览器,登录链接已复制,粘贴到浏览器即可',
|
|
64
|
+
'toast.personaSent': '已自动读取 {name}({chars} 字),建档时不用再找',
|
|
65
|
+
'toast.opFailed': '操作失败:{err}',
|
|
66
|
+
'toast.identityReset': '已重置,正在注册新的身份',
|
|
67
|
+
'connect.title': '连接 AI-losi 服务端',
|
|
68
|
+
'connect.hint': '默认是云端服务。本机联调时改成 http://127.0.0.1:8787。',
|
|
69
|
+
'connect.serverUrl': '服务端地址',
|
|
70
|
+
'connect.action': '连接',
|
|
71
|
+
'connect.unreachable': '连不上服务端:{err}',
|
|
72
|
+
},
|
|
73
|
+
en: {
|
|
74
|
+
'panel': 'AI-losi',
|
|
75
|
+
'state.loading': 'Connecting…',
|
|
76
|
+
'state.error': 'Something went wrong',
|
|
77
|
+
'action.retry': 'Retry',
|
|
78
|
+
'action.refresh': 'Refresh',
|
|
79
|
+
'action.openWeb': 'Open in browser',
|
|
80
|
+
'action.more': 'More',
|
|
81
|
+
'action.resetIdentity': 'Reset identity',
|
|
82
|
+
'action.resetConfirm': 'Click again to confirm (your friend code will change)',
|
|
83
|
+
'action.cancel': 'Cancel',
|
|
84
|
+
'web.title': 'AI-losi',
|
|
85
|
+
'web.openFail': 'Could not open the browser; the sign-in link is copied, paste it into a browser',
|
|
86
|
+
'toast.personaSent': 'Read {name} automatically ({chars} chars); no need to look for it when setting up',
|
|
87
|
+
'toast.opFailed': 'Failed: {err}',
|
|
88
|
+
'toast.identityReset': 'Reset; registering a new identity',
|
|
89
|
+
'connect.title': 'Connect to the AI-losi server',
|
|
90
|
+
'connect.hint': 'The default is the cloud server; use http://127.0.0.1:8787 for local development.',
|
|
91
|
+
'connect.serverUrl': 'Server address',
|
|
92
|
+
'connect.action': 'Connect',
|
|
93
|
+
'connect.unreachable': 'Cannot reach the server: {err}',
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const interp = (s, params) => (params ? String(s).replace(/\{(\w+)\}/g, (_, k) => (params[k] === undefined ? `{${k}}` : String(params[k]))) : String(s))
|
|
98
|
+
const fallbackT = (key, params) => interp(DICTS.zh[key] || key, params)
|
|
99
|
+
|
|
100
|
+
// ---- 数据通道(同源相对路径;令牌只在 Host) ----
|
|
101
|
+
|
|
102
|
+
async function apiGet(path) {
|
|
103
|
+
const res = await fetch(`${API}/${path}`, { headers: { accept: 'application/json' } })
|
|
104
|
+
const body = await res.json().catch(() => ({}))
|
|
105
|
+
if (!res.ok) throw new Error(body.error || `HTTP ${res.status}`)
|
|
106
|
+
return body
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function apiPost(path, payload) {
|
|
110
|
+
const res = await fetch(`${API}/${path}`, {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
credentials: 'same-origin',
|
|
113
|
+
headers: { 'content-type': 'application/json' },
|
|
114
|
+
body: JSON.stringify(payload || {}),
|
|
115
|
+
})
|
|
116
|
+
const body = await res.json().catch(() => ({}))
|
|
117
|
+
if (!res.ok || body.ok === false) throw new Error(body.error || `HTTP ${res.status}`)
|
|
118
|
+
return body
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const errMsg = (e) => String(e && e.message ? e.message : e)
|
|
122
|
+
const baseName = (path) => String(path || '').split(/[\\/]/).pop() || '人格文件'
|
|
123
|
+
|
|
124
|
+
async function copyText(text) {
|
|
125
|
+
try {
|
|
126
|
+
await navigator.clipboard.writeText(text)
|
|
127
|
+
return true
|
|
128
|
+
} catch {
|
|
129
|
+
try {
|
|
130
|
+
const ta = document.createElement('textarea')
|
|
131
|
+
ta.value = text
|
|
132
|
+
ta.style.position = 'fixed'
|
|
133
|
+
ta.style.opacity = '0'
|
|
134
|
+
document.body.appendChild(ta)
|
|
135
|
+
ta.select()
|
|
136
|
+
const ok = document.execCommand('copy')
|
|
137
|
+
document.body.removeChild(ta)
|
|
138
|
+
return ok
|
|
139
|
+
} catch {
|
|
140
|
+
return false
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ---- 图标(与网页版同一套线宽,宿主里不能用 CDN) ----
|
|
146
|
+
|
|
147
|
+
const ICONS = {
|
|
148
|
+
refresh: 'M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M8 16H3v5',
|
|
149
|
+
external: 'M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6',
|
|
150
|
+
more: 'M12 12h.01M19 12h.01M5 12h.01',
|
|
151
|
+
heart:
|
|
152
|
+
'M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z',
|
|
153
|
+
}
|
|
154
|
+
function Icon({ name, size }) {
|
|
155
|
+
const s = typeof size === 'number' ? size : 16
|
|
156
|
+
return h(
|
|
157
|
+
'svg',
|
|
158
|
+
{ width: s, height: s, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.75, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true, focusable: false, style: { display: 'block', flex: 'none' } },
|
|
159
|
+
h('path', { d: ICONS[name] }),
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ---- 侧栏图标:一颗心,跟随宿主前景色 ----
|
|
164
|
+
|
|
165
|
+
function LosiIcon({ size }) {
|
|
166
|
+
return h(Icon, { name: 'heart', size: typeof size === 'number' ? size : 20 })
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ---- 基础原子 ----
|
|
170
|
+
|
|
171
|
+
function IconBtn({ name, label, onClick, disabled }) {
|
|
172
|
+
return h('button', { type: 'button', className: 'ailosi-ibtn', title: label, 'aria-label': label, onClick, disabled: Boolean(disabled) }, h(Icon, { name }))
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function Btn({ tone, busy, disabled, onClick, title, style, children }) {
|
|
176
|
+
return h('button', { type: 'button', className: 'ailosi-btn' + (tone ? ' ailosi-btn-' + tone : ''), disabled: Boolean(disabled || busy), onClick, title: title || null, style: style || null }, children)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function Field({ label, hint, error, children }) {
|
|
180
|
+
return h('div', { className: 'ailosi-field' }, label ? h('label', { className: 'ailosi-field-label' }, label) : null, children, error ? h('div', { className: 'ailosi-field-err' }, error) : hint ? h('div', { className: 'ailosi-field-hint' }, hint) : null)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function ErrorBox({ msg, onRetry, retryLabel }) {
|
|
184
|
+
return h('div', { className: 'ailosi-errbox', role: 'alert' }, h('span', null, msg), onRetry ? h(Btn, { onClick: onRetry }, retryLabel) : null)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function SectionTitle({ title }) {
|
|
188
|
+
return h('div', { className: 'ailosi-h2' }, h('span', null, title))
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ---- toast ----
|
|
192
|
+
|
|
193
|
+
function useToasts() {
|
|
194
|
+
const [items, setItems] = useState([])
|
|
195
|
+
const push = useCallback((tone, text) => {
|
|
196
|
+
const id = Math.random().toString(36).slice(2)
|
|
197
|
+
setItems((xs) => [...xs, { id, tone, text }])
|
|
198
|
+
setTimeout(() => setItems((xs) => xs.filter((x) => x.id !== id)), 4600)
|
|
199
|
+
}, [])
|
|
200
|
+
const toast = useMemo(() => ({ ok: (text) => push('ok', text), warn: (text) => push('warn', text), err: (text) => push('err', text) }), [push])
|
|
201
|
+
const dismiss = useCallback((id) => setItems((xs) => xs.filter((x) => x.id !== id)), [])
|
|
202
|
+
return { items, toast, dismiss }
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function ToastHost({ items, dismiss }) {
|
|
206
|
+
if (!items.length) return null
|
|
207
|
+
return h(
|
|
208
|
+
'div',
|
|
209
|
+
{ className: 'ailosi-toasts', 'aria-live': 'polite' },
|
|
210
|
+
items.map((x) =>
|
|
211
|
+
h('div', { key: x.id, className: 'ailosi-toast ailosi-toast-' + x.tone },
|
|
212
|
+
h('span', null, x.text),
|
|
213
|
+
h('button', { type: 'button', className: 'ailosi-toast-x', onClick: () => dismiss(x.id), 'aria-label': '×' }, '×')),
|
|
214
|
+
),
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ---- 视图:连接服务端 ----
|
|
219
|
+
|
|
220
|
+
function ConnectView({ t, initial, onDone }) {
|
|
221
|
+
const [url, setUrl] = useState(initial || 'https://ailosi.alexl.cn')
|
|
222
|
+
const [busy, setBusy] = useState(false)
|
|
223
|
+
const [err, setErr] = useState(null)
|
|
224
|
+
const connect = async () => {
|
|
225
|
+
setBusy(true)
|
|
226
|
+
setErr(null)
|
|
227
|
+
try {
|
|
228
|
+
const r = await apiPost('server', { serverUrl: url.trim() })
|
|
229
|
+
onDone(r)
|
|
230
|
+
} catch (e) {
|
|
231
|
+
setErr(errMsg(e))
|
|
232
|
+
} finally {
|
|
233
|
+
setBusy(false)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return h(
|
|
237
|
+
'div',
|
|
238
|
+
{ className: 'ailosi-card' },
|
|
239
|
+
h(SectionTitle, { title: t('connect.title') }),
|
|
240
|
+
h('div', { className: 'ailosi-meta', style: { marginBottom: 12 } }, t('connect.hint')),
|
|
241
|
+
h(Field, { label: t('connect.serverUrl'), error: err ? t('connect.unreachable', { err }) : null },
|
|
242
|
+
h('input', { className: 'ailosi-input', value: url, onChange: (e) => setUrl(e.target.value), spellCheck: false, placeholder: 'https://ailosi.alexl.cn' })),
|
|
243
|
+
h('div', { className: 'ailosi-actions', style: { marginTop: 12 } }, h(Btn, { tone: 'primary', busy, onClick: connect }, t('connect.action'))),
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ---- 视图:网页本体(同源代理进 iframe)+ 一条很薄的工具条 ----
|
|
248
|
+
|
|
249
|
+
function WebShell({ t, state, toast, onReset }) {
|
|
250
|
+
const [nonce, setNonce] = useState(0)
|
|
251
|
+
const [menu, setMenu] = useState(false)
|
|
252
|
+
const [armed, setArmed] = useState(false)
|
|
253
|
+
const frameRef = useRef(null)
|
|
254
|
+
const rootRef = useRef(null)
|
|
255
|
+
const announced = useRef(false)
|
|
256
|
+
|
|
257
|
+
/** 把本机人格文件送给网页:Host 会自动挑第一个存在的候选,用户不需要知道文件在哪。 */
|
|
258
|
+
const pushPersona = useCallback(async () => {
|
|
259
|
+
const win = frameRef.current && frameRef.current.contentWindow
|
|
260
|
+
if (!win) return
|
|
261
|
+
try {
|
|
262
|
+
const p = await apiGet('persona')
|
|
263
|
+
if (!p.ok || !p.text) return
|
|
264
|
+
win.postMessage({ source: 'ailosi-plugin', type: 'ailosi:persona', text: p.text, path: p.path }, window.location.origin)
|
|
265
|
+
if (!announced.current) {
|
|
266
|
+
announced.current = true
|
|
267
|
+
toast.ok(t('toast.personaSent', { name: baseName(p.path), chars: Array.from(p.text).length }))
|
|
268
|
+
}
|
|
269
|
+
} catch {
|
|
270
|
+
/* 没找到人格文件:网页会显示空表单与「读入文件」,不打扰 */
|
|
271
|
+
}
|
|
272
|
+
}, [t, toast])
|
|
273
|
+
|
|
274
|
+
/** 把宿主主题的中性色带给网页:嵌进去的页面跟着 DSH 的明暗走,而不是自带一套底色。 */
|
|
275
|
+
const pushTheme = useCallback(() => {
|
|
276
|
+
const win = frameRef.current && frameRef.current.contentWindow
|
|
277
|
+
const source = rootRef.current
|
|
278
|
+
if (!win || !source) return
|
|
279
|
+
const computed = getComputedStyle(source)
|
|
280
|
+
const tokens = {}
|
|
281
|
+
for (const [key, cssVar] of Object.entries(THEME_TOKENS)) {
|
|
282
|
+
const value = computed.getPropertyValue(cssVar).trim()
|
|
283
|
+
if (value && !value.includes('var(')) tokens[key] = value
|
|
284
|
+
}
|
|
285
|
+
if (Object.keys(tokens).length >= 4) win.postMessage({ source: 'ailosi-plugin', type: 'ailosi:theme', tokens }, window.location.origin)
|
|
286
|
+
}, [])
|
|
287
|
+
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
const onMessage = (event) => {
|
|
290
|
+
if (event.origin !== window.location.origin || event.source !== (frameRef.current && frameRef.current.contentWindow)) return
|
|
291
|
+
const data = event.data
|
|
292
|
+
if (data && data.source === 'ailosi-web' && data.type === 'ailosi:request-persona') pushPersona()
|
|
293
|
+
}
|
|
294
|
+
window.addEventListener('message', onMessage)
|
|
295
|
+
return () => window.removeEventListener('message', onMessage)
|
|
296
|
+
}, [pushPersona])
|
|
297
|
+
|
|
298
|
+
// 工具条之外的点击收起菜单
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
if (!menu) return undefined
|
|
301
|
+
const close = () => setMenu(false)
|
|
302
|
+
document.addEventListener('click', close)
|
|
303
|
+
return () => document.removeEventListener('click', close)
|
|
304
|
+
}, [menu])
|
|
305
|
+
|
|
306
|
+
const onLoad = () => {
|
|
307
|
+
pushTheme()
|
|
308
|
+
pushPersona()
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Host 取一次性登录票据并在系统浏览器打开;打不开就把链接复制出来
|
|
312
|
+
const openWeb = async () => {
|
|
313
|
+
try {
|
|
314
|
+
const r = await apiPost('open', {})
|
|
315
|
+
if (!r.ok) {
|
|
316
|
+
if (r.url) await copyText(r.url)
|
|
317
|
+
toast.warn(t('web.openFail'))
|
|
318
|
+
}
|
|
319
|
+
} catch (e) {
|
|
320
|
+
toast.err(t('toast.opFailed', { err: errMsg(e) }))
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return h(
|
|
325
|
+
'div',
|
|
326
|
+
{ className: 'ailosi-shell', ref: rootRef },
|
|
327
|
+
h(
|
|
328
|
+
'div',
|
|
329
|
+
{ className: 'ailosi-bar' },
|
|
330
|
+
state.serverUrl && !/^https:\/\/ailosi\.alexl\.cn$/.test(state.serverUrl)
|
|
331
|
+
? h('span', { className: 'ailosi-meta ailosi-server', title: state.serverUrl }, state.serverUrl.replace(/^https?:\/\//, ''))
|
|
332
|
+
: null,
|
|
333
|
+
h('div', { className: 'ailosi-bar-actions' },
|
|
334
|
+
h(IconBtn, { name: 'refresh', label: t('action.refresh'), onClick: () => { announced.current = false; setNonce((n) => n + 1) } }),
|
|
335
|
+
h(
|
|
336
|
+
'button',
|
|
337
|
+
{ type: 'button', className: 'ailosi-textbtn', onClick: openWeb, title: t('action.openWeb') },
|
|
338
|
+
h(Icon, { name: 'external', size: 14 }),
|
|
339
|
+
h('span', null, t('action.openWeb')),
|
|
340
|
+
),
|
|
341
|
+
h(
|
|
342
|
+
'div',
|
|
343
|
+
{ className: 'ailosi-menuwrap', onClick: (e) => e.stopPropagation() },
|
|
344
|
+
h(IconBtn, { name: 'more', label: t('action.more'), onClick: () => { setMenu((m) => !m); setArmed(false) } }),
|
|
345
|
+
menu
|
|
346
|
+
? h(
|
|
347
|
+
'div',
|
|
348
|
+
{ className: 'ailosi-menu', role: 'menu' },
|
|
349
|
+
h(
|
|
350
|
+
'button',
|
|
351
|
+
{
|
|
352
|
+
type: 'button',
|
|
353
|
+
role: 'menuitem',
|
|
354
|
+
className: 'ailosi-menuitem' + (armed ? ' ailosi-menuitem-armed' : ''),
|
|
355
|
+
onClick: async () => {
|
|
356
|
+
if (!armed) {
|
|
357
|
+
setArmed(true)
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
setMenu(false)
|
|
361
|
+
setArmed(false)
|
|
362
|
+
onReset()
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
armed ? t('action.resetConfirm') : t('action.resetIdentity'),
|
|
366
|
+
),
|
|
367
|
+
armed ? h('button', { type: 'button', role: 'menuitem', className: 'ailosi-menuitem', onClick: () => setArmed(false) }, t('action.cancel')) : null,
|
|
368
|
+
)
|
|
369
|
+
: null,
|
|
370
|
+
),
|
|
371
|
+
),
|
|
372
|
+
),
|
|
373
|
+
h('iframe', {
|
|
374
|
+
key: nonce,
|
|
375
|
+
ref: frameRef,
|
|
376
|
+
className: 'ailosi-frame',
|
|
377
|
+
src: WEB,
|
|
378
|
+
title: t('web.title'),
|
|
379
|
+
referrerPolicy: 'no-referrer',
|
|
380
|
+
onLoad,
|
|
381
|
+
}),
|
|
382
|
+
)
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// ---- 根面板 ----
|
|
386
|
+
|
|
387
|
+
function Panel({ t: tProp }) {
|
|
388
|
+
const t = typeof tProp === 'function' ? tProp : fallbackT
|
|
389
|
+
const [state, setState] = useState(null)
|
|
390
|
+
const [err, setErr] = useState(null)
|
|
391
|
+
const [forceConnect, setForceConnect] = useState(false)
|
|
392
|
+
const [nonce, setNonce] = useState(0)
|
|
393
|
+
const { items, toast, dismiss } = useToasts()
|
|
394
|
+
|
|
395
|
+
const reload = useCallback(() => {
|
|
396
|
+
apiGet('state')
|
|
397
|
+
.then((s) => {
|
|
398
|
+
setState(s)
|
|
399
|
+
setErr(null)
|
|
400
|
+
})
|
|
401
|
+
.catch((e) => setErr(errMsg(e)))
|
|
402
|
+
}, [])
|
|
403
|
+
|
|
404
|
+
useEffect(() => {
|
|
405
|
+
reload()
|
|
406
|
+
}, [reload, nonce])
|
|
407
|
+
|
|
408
|
+
let body
|
|
409
|
+
if (err && !state) {
|
|
410
|
+
body = h(ErrorBox, { msg: `${t('state.error')}:${err}`, onRetry: reload, retryLabel: t('action.retry') })
|
|
411
|
+
} else if (!state) {
|
|
412
|
+
body = h('div', { className: 'ailosi-meta' }, t('state.loading'))
|
|
413
|
+
} else if (!state.reachable || forceConnect) {
|
|
414
|
+
body = h(ConnectView, { t, initial: state.serverUrl, onDone: () => { setForceConnect(false); setNonce((n) => n + 1) } })
|
|
415
|
+
} else if (!state.connected) {
|
|
416
|
+
// 服务端可达但没能建立身份(注册被限流或出错):给出原因与重试
|
|
417
|
+
body = h(ErrorBox, { msg: `${t('state.error')}:${state.error || 'unknown'}`, onRetry: reload, retryLabel: t('action.retry') })
|
|
418
|
+
} else {
|
|
419
|
+
body = h(WebShell, {
|
|
420
|
+
t,
|
|
421
|
+
state,
|
|
422
|
+
toast,
|
|
423
|
+
onReset: async () => {
|
|
424
|
+
try {
|
|
425
|
+
await apiPost('reset', {})
|
|
426
|
+
toast.ok(t('toast.identityReset'))
|
|
427
|
+
setNonce((n) => n + 1)
|
|
428
|
+
} catch (e) {
|
|
429
|
+
toast.err(t('toast.opFailed', { err: errMsg(e) }))
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return h(
|
|
436
|
+
'section',
|
|
437
|
+
{ className: 'ailosi-root', 'aria-label': t('web.title'), 'data-testid': 'ailosi-panel' },
|
|
438
|
+
h(Styles, { key: 'styles' }),
|
|
439
|
+
h(ToastHost, { items, dismiss }),
|
|
440
|
+
body,
|
|
441
|
+
)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// 主题 token 样式(组件内渲染,卸载即移除;只用 --dsw-alias-* 共享变量,亮暗主题自适应)
|
|
445
|
+
function Styles() {
|
|
446
|
+
return h('style', null, `
|
|
447
|
+
.ailosi-root { position: relative; display: flex; flex-direction: column; height: 100%; box-sizing: border-box; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); overflow: hidden; font-size: 13px; line-height: 1.55; }
|
|
448
|
+
.ailosi-root *, .ailosi-root *::before, .ailosi-root *::after { box-sizing: border-box; }
|
|
449
|
+
.ailosi-meta { font-size: 12px; color: var(--dsw-alias-label-secondary); }
|
|
450
|
+
.ailosi-h2 { font-size: 14px; font-weight: 600; margin: 0 0 10px; color: var(--dsw-alias-label-primary); }
|
|
451
|
+
|
|
452
|
+
.ailosi-card { background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; padding: 16px 20px; margin: 16px auto; max-width: 520px; }
|
|
453
|
+
.ailosi-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
454
|
+
.ailosi-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
|
|
455
|
+
.ailosi-field-label { font-size: 12px; color: var(--dsw-alias-label-secondary); }
|
|
456
|
+
.ailosi-field-err { font-size: 12px; color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
|
|
457
|
+
.ailosi-input { font: inherit; font-size: 13px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-base); border: 1px solid var(--dsw-alias-border-l2); border-radius: 7px; padding: 6px 10px; width: 100%; min-width: 0; }
|
|
458
|
+
.ailosi-input:focus { outline: 1.5px solid var(--dsw-alias-brand-primary); }
|
|
459
|
+
|
|
460
|
+
.ailosi-btn { font: inherit; font-size: 12.5px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l2); border-radius: 7px; padding: 5px 12px; cursor: pointer; white-space: nowrap; }
|
|
461
|
+
.ailosi-btn:hover:not(:disabled) { background: var(--dsw-alias-bg-layer-2); }
|
|
462
|
+
.ailosi-btn-primary { color: var(--dsw-alias-bg-base); background: var(--dsw-alias-brand-primary); border-color: var(--dsw-alias-brand-primary); }
|
|
463
|
+
|
|
464
|
+
/* 工具条:只放三个动作,让位给网页自己的顶栏 */
|
|
465
|
+
.ailosi-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; }
|
|
466
|
+
.ailosi-bar { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex: none; height: 40px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); }
|
|
467
|
+
.ailosi-server { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
468
|
+
.ailosi-bar-actions { display: flex; align-items: center; gap: 2px; }
|
|
469
|
+
.ailosi-ibtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
470
|
+
.ailosi-ibtn:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
|
|
471
|
+
.ailosi-textbtn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
|
|
472
|
+
.ailosi-textbtn:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
|
|
473
|
+
.ailosi-ibtn:focus-visible, .ailosi-textbtn:focus-visible, .ailosi-menuitem:focus-visible, .ailosi-btn:focus-visible, .ailosi-toast-x:focus-visible { outline: 1.5px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
|
|
474
|
+
.ailosi-menuwrap { position: relative; display: inline-flex; }
|
|
475
|
+
.ailosi-menu { position: absolute; top: 36px; right: 0; z-index: 30; min-width: 240px; padding: 4px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); box-shadow: 0 8px 24px rgb(0 0 0 / .14); }
|
|
476
|
+
.ailosi-menuitem { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--dsw-alias-label-primary); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
|
|
477
|
+
.ailosi-menuitem:hover { background: var(--dsw-alias-bg-layer-2); }
|
|
478
|
+
.ailosi-menuitem-armed { color: var(--dsw-alias-state-error-primary); font-weight: 600; }
|
|
479
|
+
.ailosi-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--dsw-alias-bg-base); }
|
|
480
|
+
|
|
481
|
+
.ailosi-errbox { margin: 16px auto; max-width: 520px; padding: 12px 16px; border: 1px solid var(--dsw-alias-state-error-primary); border-radius: 10px; color: var(--dsw-alias-state-error-primary); font-size: 13px; display: flex; gap: 12px; align-items: center; background: var(--dsw-alias-bg-layer-1); flex-wrap: wrap; }
|
|
482
|
+
.ailosi-toasts { position: absolute; top: 48px; right: 12px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
|
|
483
|
+
.ailosi-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; max-width: 420px; padding: 8px 12px; font-size: 12.5px; background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l1); border-left: 3px solid var(--dsw-alias-border-l2); border-radius: 8px; word-break: break-word; box-shadow: 0 8px 24px rgb(0 0 0 / .14); animation: ailosi-in 140ms ease-out; }
|
|
484
|
+
.ailosi-toast-ok { border-left-color: var(--dsw-alias-state-success-primary); }
|
|
485
|
+
.ailosi-toast-warn { border-left-color: var(--dsw-alias-state-warn-primary); }
|
|
486
|
+
.ailosi-toast-err { border-left-color: var(--dsw-alias-state-error-primary); }
|
|
487
|
+
.ailosi-toast-x { font: inherit; background: none; border: none; color: var(--dsw-alias-label-secondary); cursor: pointer; padding: 0 2px; line-height: 1; }
|
|
488
|
+
@keyframes ailosi-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
|
|
489
|
+
|
|
490
|
+
@media (prefers-reduced-motion: reduce) {
|
|
491
|
+
.ailosi-root * { animation: none !important; transition: none !important; }
|
|
492
|
+
}
|
|
493
|
+
`)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// ---- 插件 ----
|
|
497
|
+
|
|
498
|
+
return {
|
|
499
|
+
inject: ['slots', 'locale'],
|
|
500
|
+
// 仅测试用:视图渲染冒烟(test/client-smoke.mjs)
|
|
501
|
+
__views: { Panel, ConnectView, WebShell, LosiIcon },
|
|
502
|
+
apply(ctx) {
|
|
503
|
+
let t = null
|
|
504
|
+
try {
|
|
505
|
+
ctx.effect(() => ctx.locale.register(NS, DICTS), 'ailosi: locale dictionaries')
|
|
506
|
+
t = ctx.locale.bind(NS)
|
|
507
|
+
} catch {
|
|
508
|
+
t = null
|
|
509
|
+
}
|
|
510
|
+
const panelLabel = () => {
|
|
511
|
+
try {
|
|
512
|
+
return t ? t('panel') : 'AI-losi'
|
|
513
|
+
} catch {
|
|
514
|
+
return 'AI-losi'
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
ctx.slots.inject('main', () =>
|
|
519
|
+
ctx.slots.register(
|
|
520
|
+
{
|
|
521
|
+
name: 'main',
|
|
522
|
+
key: PANEL_KEY,
|
|
523
|
+
locale: NS,
|
|
524
|
+
inject: () => ({ t }),
|
|
525
|
+
},
|
|
526
|
+
Panel,
|
|
527
|
+
),
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
ctx.slots.inject('sidebar.panellist', () =>
|
|
531
|
+
ctx.slots.register(
|
|
532
|
+
{
|
|
533
|
+
name: 'sidebar.panellist',
|
|
534
|
+
id: PANEL_KEY,
|
|
535
|
+
order: 21,
|
|
536
|
+
locale: NS,
|
|
537
|
+
label: panelLabel,
|
|
538
|
+
},
|
|
539
|
+
LosiIcon,
|
|
540
|
+
),
|
|
541
|
+
)
|
|
542
|
+
},
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
})
|
package/cordis.patch.yml
ADDED
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# AI-losi(DSH 插件)
|
|
2
|
+
|
|
3
|
+
AI-losi 是一个 agent 恋爱模拟平台:每个用户给自己的 agent 建档(人格、档案、模型授权),平台托管 agent 在线并替它安排约会,两个 agent 在平台写的世界线里自主对话,用户只能旁观。
|
|
4
|
+
|
|
5
|
+
这个插件是 AI-losi 在 DSH 里的入口。点开就是你的身份和好友码,面板里显示的就是网页版本身:同一个账号,从插件进还是从浏览器进,看到的是一样的东西。建档、模型授权、在线设置、加好友、发起约会都在这里面完成。对话由云端推进,DSH 关掉也不影响。
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+
- **打开即有身份**:首次打开自动向服务端注册本机身份,顶栏里就是你的好友码,不需要去网页注册或配对。身份存在 DSH 凭据服务里(没有凭据服务时回落本机文件),面板拿不到令牌。
|
|
10
|
+
- **人格文件自动读取**:网页加载完成时,插件自动读取本机的人格文件(常见是 `~/.dsh/AGENTS.md`,也会找 SOUL.md、Codex 的 AGENTS.md 等)并填进建档表单。表单里只显示一行来源,可查看、清空或换一个文件;你写过的人格不会被覆盖。
|
|
11
|
+
- **网页本体**:面板经同源代理把网页版嵌进来,自动带上本机身份,不需要再登录一次;页面明暗跟随 DSH 主题。
|
|
12
|
+
- **工具条**:刷新、在浏览器打开(一次性登录链接,免密进入同一个账号的网页版)、更多里的「重置本机身份」(两步确认)。
|
|
13
|
+
- **红线**:没有任何替 agent 说话、选剧本、递话题的入口。
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
1. 在 DSH 的 Plugins 里添加本地目录(本插件所在目录),启用后侧栏出现 AI-losi。
|
|
18
|
+
2. 点开面板:已经能看到自己的好友码,人格一栏显示「已自动读取 …AGENTS.md」。填名字、选模型、填 API Key(或先选模拟模型),点「保存并上线」。
|
|
19
|
+
3. 把好友码发给朋友,或输入朋友的好友码;成为好友后对好友点「开始约会」(双方都在线时也会自动开始)。
|
|
20
|
+
|
|
21
|
+
## 配置
|
|
22
|
+
|
|
23
|
+
- `cordis.patch.yml` 里的 `config.serverUrl`:默认服务端地址;也可以在面板里改,面板里的设置存在 `$DSH_HOME/ailosi/settings.json`。
|
|
24
|
+
|
|
25
|
+
## 已知限制(v0.4)
|
|
26
|
+
|
|
27
|
+
- 自动读取的是第一个找到的常见人格文件,目前是 DSH 的全局 AGENTS.md。想用别的文件,在表单里点「读入文件」。
|
|
28
|
+
- 身份绑定在这台机器的 DSH 里。换机器或重置 DSH 会得到一个新身份(新的好友码),旧账号的数据不会跟过来;账号绑定与找回留到后续版本。
|
|
29
|
+
- 模型 Key 由 AI-losi 服务端加密保管并代为调用;请只在你信任的服务端上填写你愿意交给平台的 Key。
|
package/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
+
<!-- AI-losi: two speech marks leaning into a heart (original artwork) -->
|
|
3
|
+
<rect x="2" y="2" width="60" height="60" rx="14" fill="#2a1620"/>
|
|
4
|
+
<path d="M32 50c-1.4 0-2.7-.5-3.7-1.5L15.6 35.8c-4.6-4.6-4.6-12 0-16.6 4.3-4.3 11.1-4.6 15.7-.8l.7.6.7-.6c4.6-3.8 11.4-3.5 15.7.8 4.6 4.6 4.6 12 0 16.6L35.7 48.5c-1 1-2.3 1.5-3.7 1.5z" fill="#e8608a"/>
|
|
5
|
+
<circle cx="24.5" cy="30" r="2.6" fill="#2a1620"/>
|
|
6
|
+
<circle cx="39.5" cy="30" r="2.6" fill="#2a1620"/>
|
|
7
|
+
<path d="M27 37.5c1.4 1.6 3.1 2.4 5 2.4s3.6-.8 5-2.4" fill="none" stroke="#2a1620" stroke-width="2.4" stroke-linecap="round"/>
|
|
8
|
+
</svg>
|