@sonicloud/dsh-sonicloud-device 0.1.1 → 0.1.2
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 +16 -0
- package/CHANGELOG.zh.md +16 -0
- package/README.md +67 -95
- package/README.zh.md +112 -0
- package/dist/build.json +1 -1
- package/dist/client.js +103 -28
- package/docs/contributing/development.md +24 -29
- package/docs/images/plugin-install.png +0 -0
- package/docs/images/sonicloud-device.png +0 -0
- package/docs/specs/ci-cd.md +24 -37
- package/docs/specs/mouse-settings.md +7 -34
- package/docs/specs/smart-mouse-plugin.md +23 -34
- package/native/desktop/VoicePanel.cs +191 -59
- package/native/desktop/typer.dll +0 -0
- package/native/desktop/windows.ps1 +1 -1
- package/package.json +2 -1
- package/src/devices/actions.mjs +7 -1
- package/src/devices/manager.mjs +108 -78
- /package/{src/client/assets → docs/images}/contact-wechat.jpg +0 -0
package/dist/client.js
CHANGED
|
@@ -20151,6 +20151,20 @@ var DevicePreferences = class {
|
|
|
20151
20151
|
}
|
|
20152
20152
|
};
|
|
20153
20153
|
|
|
20154
|
+
// src/client/retry.mjs
|
|
20155
|
+
function waitForRetry(signal, delayMs) {
|
|
20156
|
+
return new Promise((resolve) => {
|
|
20157
|
+
const done = () => {
|
|
20158
|
+
clearTimeout(timer);
|
|
20159
|
+
signal.removeEventListener("abort", done);
|
|
20160
|
+
resolve();
|
|
20161
|
+
};
|
|
20162
|
+
const timer = setTimeout(done, delayMs);
|
|
20163
|
+
signal.addEventListener("abort", done, { once: true });
|
|
20164
|
+
if (signal.aborted) done();
|
|
20165
|
+
});
|
|
20166
|
+
}
|
|
20167
|
+
|
|
20154
20168
|
// src/client/controller.mjs
|
|
20155
20169
|
var DeviceController = class {
|
|
20156
20170
|
editors = /* @__PURE__ */ new Map();
|
|
@@ -20191,9 +20205,6 @@ var DeviceController = class {
|
|
|
20191
20205
|
this.stream = this.api.watch(this.clientId, signal);
|
|
20192
20206
|
for await (const event2 of this.stream) {
|
|
20193
20207
|
if (signal.aborted) return;
|
|
20194
|
-
if (event2.type === "devices" && this.reconnecting) {
|
|
20195
|
-
this.reconnecting = false;
|
|
20196
|
-
}
|
|
20197
20208
|
await this.event(event2);
|
|
20198
20209
|
}
|
|
20199
20210
|
} catch {
|
|
@@ -20202,18 +20213,8 @@ var DeviceController = class {
|
|
|
20202
20213
|
this.stream = void 0;
|
|
20203
20214
|
}
|
|
20204
20215
|
if (signal.aborted) return;
|
|
20205
|
-
this.reconnecting = true;
|
|
20206
20216
|
this.publish({ status: "\u8BBE\u5907\u670D\u52A1\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u2026", devices: [] });
|
|
20207
|
-
await
|
|
20208
|
-
const done = () => {
|
|
20209
|
-
clearTimeout(timer);
|
|
20210
|
-
signal.removeEventListener("abort", done);
|
|
20211
|
-
resolve();
|
|
20212
|
-
};
|
|
20213
|
-
const timer = setTimeout(done, this.retryDelayMs);
|
|
20214
|
-
signal.addEventListener("abort", done, { once: true });
|
|
20215
|
-
if (signal.aborted) done();
|
|
20216
|
-
});
|
|
20217
|
+
await waitForRetry(signal, this.retryDelayMs);
|
|
20217
20218
|
}
|
|
20218
20219
|
}
|
|
20219
20220
|
async event(event2) {
|
|
@@ -20357,16 +20358,7 @@ var AiConversationClient = class {
|
|
|
20357
20358
|
for (const id2 of this.targets.keys()) this.release(id2);
|
|
20358
20359
|
}
|
|
20359
20360
|
if (signal.aborted) return;
|
|
20360
|
-
await
|
|
20361
|
-
const done = () => {
|
|
20362
|
-
clearTimeout(timer);
|
|
20363
|
-
signal.removeEventListener("abort", done);
|
|
20364
|
-
resolve();
|
|
20365
|
-
};
|
|
20366
|
-
const timer = setTimeout(done, this.retryDelayMs);
|
|
20367
|
-
signal.addEventListener("abort", done, { once: true });
|
|
20368
|
-
if (signal.aborted) done();
|
|
20369
|
-
});
|
|
20361
|
+
await waitForRetry(signal, this.retryDelayMs);
|
|
20370
20362
|
}
|
|
20371
20363
|
}
|
|
20372
20364
|
dispose() {
|
|
@@ -20508,13 +20500,20 @@ function DeviceForm({ device: device2, controller, state }) {
|
|
|
20508
20500
|
change("recognition", { language: item.language, accent: item.accent, rlang: item.rlang });
|
|
20509
20501
|
} })), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "\u8BED\u97F3\u7FFB\u8BD1", description: !state.translationReady ? "\u7FFB\u8BD1\u670D\u52A1\u5C1A\u672A\u914D\u7F6E\uFF0C\u6682\u4E0D\u53EF\u7528" : void 0 }, /* @__PURE__ */ import_react2.default.createElement(Select, { label: "\u7FFB\u8BD1\u6E90\u8BED\u8A00", value: form.from, options: sourceOptions, onChange: (value) => change("from", value) }), /* @__PURE__ */ import_react2.default.createElement("span", { "aria-hidden": "true" }, "\u203A"), /* @__PURE__ */ import_react2.default.createElement(Select, { label: "\u7FFB\u8BD1\u76EE\u6807\u8BED\u8A00", value: form.to, options: TRANS_TO_LANG_LIST, onChange: (value) => change("to", value) })), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "DPI \u952E", description: /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, "\u7528\u4E8E\u8C03\u8282\u9F20\u6807\u5149\u6807\u79FB\u52A8\u7075\u654F\u5EA6", device2.dpiState === "failed" && /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("br", null), /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-asr-error" }, "DPI \u5C1A\u672A\u5E94\u7528\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u540E\u91CD\u8BD5"))) }, /* @__PURE__ */ import_react2.default.createElement(Select, { label: "DPI", value: form.dpi, options: DPI_LIST, onChange: (value) => change("dpi", value) })), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-key-group" }, /* @__PURE__ */ import_react2.default.createElement(Row, { label: "M \u952E", description: "\u9F20\u6807\u591A\u529F\u80FD\u952E" }, /* @__PURE__ */ import_react2.default.createElement(Select, { label: "M \u952E\u52A8\u4F5C", value: form.mAction, options: M_KEY_FUNC_LIST, onChange: (value) => change("mAction", value) })), form.mAction === "speechSearch" && /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-subrow" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-controls" }, /* @__PURE__ */ import_react2.default.createElement(Select, { label: "\u641C\u7D22\u5F15\u64CE", value: form.searchUrl, options: M_KEY_SEARCH_URL_LIST, onChange: (value) => change("searchUrl", value) }))), form.mAction === "openWebUrl" && /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-subrow" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-controls dsh-mouse-link-controls" }, /* @__PURE__ */ import_react2.default.createElement(import_dsh_client_ui_primitives.Input, { "aria-label": "\u4E00\u952E\u94FE\u63A5 URL", type: "url", placeholder: "https://example.com", value: form.linkUrl, "aria-invalid": invalid || void 0, onChange: (event2) => change("linkUrl", event2.target.value) }), /* @__PURE__ */ import_react2.default.createElement(import_dsh_client_ui_primitives.Button, { disabled: busy, onClick: () => editor.commitLink() }, "\u786E\u8BA4")))), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "\u8BED\u97F3\u952E", description: "\u957F\u6309\u8BED\u97F3\u6253\u5B57\u6216\u7FFB\u8BD1\uFF0C\u677E\u624B\u5C06\u6587\u5B57\u586B\u5145\u5230\u5DF2\u83B7\u53D6\u7126\u70B9\u7684\u8F93\u5165\u6846" }, /* @__PURE__ */ import_react2.default.createElement(Select, { label: "\u8BED\u97F3\u952E\u52A8\u4F5C", value: form.speechAction, options: [{ value: "voice_input", label: "\u8BED\u97F3\u6253\u5B57" }, { value: "translate", label: "\u8BED\u97F3\u7FFB\u8BD1" }], onChange: (value) => change("speechAction", value) })), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "AI \u952E", description: "\u957F\u6309\u8BED\u97F3\u6253\u5B57\uFF0C\u677E\u624B\u81EA\u52A8\u5C06\u6587\u5B57\u586B\u5145\u5230 AI \u5BF9\u8BDD\u8F93\u5165\u6846" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-switch" }, /* @__PURE__ */ import_react2.default.createElement("span", null, "\u81EA\u52A8\u53D1\u9001"), /* @__PURE__ */ import_react2.default.createElement(import_dsh_client_ui_primitives.Switch, { label: "\u81EA\u52A8\u53D1\u9001", checked: form.aiAutoSend, onChange: (value) => change("aiAutoSend", value) })))), error62 && form.mAction !== "openWebUrl" && /* @__PURE__ */ import_react2.default.createElement("p", { role: "alert", className: "dsh-asr-error" }, error62), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-footer" }, /* @__PURE__ */ import_react2.default.createElement("span", { role: "status", className: "dsh-asr-muted" }, busy ? "\u6B63\u5728\u5E94\u7528\u2026" : ""), /* @__PURE__ */ import_react2.default.createElement(import_dsh_client_ui_primitives.Button, { size: "sm", className: "dsh-mouse-reset", onClick: () => editor.reset() }, "\u6062\u590D\u9ED8\u8BA4")));
|
|
20510
20502
|
}
|
|
20511
|
-
|
|
20503
|
+
var NO_SIDEBAR = { sidebarVisible: true };
|
|
20504
|
+
var subscribeNone = () => () => {
|
|
20505
|
+
};
|
|
20506
|
+
function Devices({ controller, sidebar }) {
|
|
20512
20507
|
const state = (0, import_react2.useSyncExternalStore)(controller.subscribe, controller.snapshot);
|
|
20508
|
+
const { sidebarVisible } = (0, import_react2.useSyncExternalStore)(sidebar?.subscribe ?? subscribeNone, sidebar?.snapshot ?? (() => NO_SIDEBAR));
|
|
20513
20509
|
const [selected, setSelected] = (0, import_react2.useState)(null);
|
|
20514
20510
|
const devices2 = state.devices, device2 = devices2.find((item) => item.id === selected) ?? devices2[0];
|
|
20515
20511
|
const index = device2 ? devices2.indexOf(device2) : 0;
|
|
20516
20512
|
const count = new Set(devices2.filter((item) => item.identityConfirmed).map((item) => item.sn)).size;
|
|
20517
|
-
return /* @__PURE__ */ import_react2.default.createElement("section", { className: "dsh-mouse-settings", "aria-label": "\u58F0\u4E91\u8BBE\u5907" }, /* @__PURE__ */ import_react2.default.createElement("h2", null, "\u58F0\u4E91\u8BBE\u5907"), /* @__PURE__ */ import_react2.default.createElement("p", { className: "dsh-asr-intro" }, count, " \u53F0\u8BBE\u5907\u5DF2\u8FDE\u63A5 \xB7 \u4E3A\u6BCF\u53F0\u8BBE\u5907\u8BBE\u7F6E\u4E13\u5C5E\u504F\u597D"), !device2 ? /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-empty" }, /* @__PURE__ */ import_react2.default.createElement("span", { "aria-hidden": "true" }, "\u2301"), /* @__PURE__ */ import_react2.default.createElement("h3", null, "\u6682\u65E0\u8BBE\u5907\u8FDE\u63A5"), /* @__PURE__ */ import_react2.default.createElement("p", null, "\u8BF7\u8FDE\u63A5\u667A\u80FD\u9F20\u6807\u7684 USB \u63A5\u6536\u5668\uFF0C\u6216\u901A\u8FC7\u84DD\u7259\u8FDE\u63A5\u9F20\u6807\u3002"), /* @__PURE__ */ import_react2.default.createElement("p", { className: "dsh-asr-muted" }, state.status)) : /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-carousel" }, devices2.length > 1 && /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", "aria-label": "\u4E0A\u4E00\u53F0\u8BBE\u5907", onClick: () => setSelected(devices2[(index + devices2.length - 1) % devices2.length].id) }, "\u2039"), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-product" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-illustration", role: "img", "aria-label": "\u667A\u80FD\u9F20\u6807\u793A\u610F\u56FE" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-wheel" }), /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-ai" }, "AI")), /* @__PURE__ */ import_react2.default.createElement("h3", null, device2.name)), devices2.length > 1 && /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", "aria-label": "\u4E0B\u4E00\u53F0\u8BBE\u5907", onClick: () => setSelected(devices2[(index + 1) % devices2.length].id) }, "\u203A")), devices2.length > 1 && /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-dots" }, devices2.map((item, i) => /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", key: item.id, "aria-label": `\u5207\u6362\u5230\u8BBE\u5907 ${i + 1}`, "aria-current": item.id === device2.id ? "true" : void 0, onClick: () => setSelected(item.id) }))), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "SN" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-value" }, device2.sn || "\u8BBE\u5907\u8EAB\u4EFD\u672A\u786E\u8BA4")), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "\u8FDE\u63A5\u65B9\u5F0F" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-value" }, device2.connection === "usb" ? "USB \u63A5\u6536\u5668" : "\u84DD\u7259")), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "\u8BBE\u5907\u7535\u91CF" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-value" }, device2.battery === null ? "\u672A\u77E5" : `${device2.battery}%`)), device2.type === "smart-mouse" ? /* @__PURE__ */ import_react2.default.createElement(DeviceForm, { key: device2.id, device: device2, controller, state }) : /* @__PURE__ */ import_react2.default.createElement("p", null, "\u6B64\u8BBE\u5907\u7C7B\u578B\u6682\u672A\u63D0\u4F9B\u4E13\u5C5E\u8BBE\u7F6E\u3002")));
|
|
20513
|
+
return /* @__PURE__ */ import_react2.default.createElement("section", { className: "dsh-mouse-settings", "aria-label": "\u58F0\u4E91\u8BBE\u5907" }, /* @__PURE__ */ import_react2.default.createElement("header", { className: "dsh-mouse-head" }, /* @__PURE__ */ import_react2.default.createElement("h2", null, "\u58F0\u4E91\u8BBE\u5907"), sidebar && /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-switch" }, /* @__PURE__ */ import_react2.default.createElement("span", null, "\u4FA7\u8FB9\u680F"), /* @__PURE__ */ import_react2.default.createElement(import_dsh_client_ui_primitives.Switch, { label: "\u4FA7\u8FB9\u680F", checked: sidebarVisible, onChange: (value) => sidebar.setVisible(value) }))), /* @__PURE__ */ import_react2.default.createElement("p", { className: "dsh-asr-intro" }, count, " \u53F0\u8BBE\u5907\u5DF2\u8FDE\u63A5 \xB7 \u4E3A\u6BCF\u53F0\u8BBE\u5907\u8BBE\u7F6E\u4E13\u5C5E\u504F\u597D"), !device2 ? /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-empty" }, /* @__PURE__ */ import_react2.default.createElement("span", { "aria-hidden": "true" }, "\u2301"), /* @__PURE__ */ import_react2.default.createElement("h3", null, "\u6682\u65E0\u8BBE\u5907\u8FDE\u63A5"), /* @__PURE__ */ import_react2.default.createElement("p", null, "\u8BF7\u8FDE\u63A5\u667A\u80FD\u9F20\u6807\u7684 USB \u63A5\u6536\u5668\uFF0C\u6216\u901A\u8FC7\u84DD\u7259\u8FDE\u63A5\u9F20\u6807\u3002"), /* @__PURE__ */ import_react2.default.createElement("p", { className: "dsh-asr-muted" }, state.status)) : /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-carousel" }, devices2.length > 1 && /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", "aria-label": "\u4E0A\u4E00\u53F0\u8BBE\u5907", onClick: () => setSelected(devices2[(index + devices2.length - 1) % devices2.length].id) }, "\u2039"), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-product" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-illustration", role: "img", "aria-label": "\u667A\u80FD\u9F20\u6807\u793A\u610F\u56FE" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-wheel" }), /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-ai" }, "AI")), /* @__PURE__ */ import_react2.default.createElement("h3", null, device2.name)), devices2.length > 1 && /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", "aria-label": "\u4E0B\u4E00\u53F0\u8BBE\u5907", onClick: () => setSelected(devices2[(index + 1) % devices2.length].id) }, "\u203A")), devices2.length > 1 && /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-dots" }, devices2.map((item, i) => /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", key: item.id, "aria-label": `\u5207\u6362\u5230\u8BBE\u5907 ${i + 1}`, "aria-current": item.id === device2.id ? "true" : void 0, onClick: () => setSelected(item.id) }))), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "SN" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-value" }, device2.sn || "\u8BBE\u5907\u8EAB\u4EFD\u672A\u786E\u8BA4")), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "\u8FDE\u63A5\u65B9\u5F0F" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-value" }, device2.connection === "usb" ? "USB \u63A5\u6536\u5668" : "\u84DD\u7259")), /* @__PURE__ */ import_react2.default.createElement(Row, { label: "\u8BBE\u5907\u7535\u91CF" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "dsh-mouse-value" }, device2.battery === null ? "\u672A\u77E5" : `${device2.battery}%`)), device2.type === "smart-mouse" ? /* @__PURE__ */ import_react2.default.createElement(DeviceForm, { key: device2.id, device: device2, controller, state }) : /* @__PURE__ */ import_react2.default.createElement("p", null, "\u6B64\u8BBE\u5907\u7C7B\u578B\u6682\u672A\u63D0\u4F9B\u4E13\u5C5E\u8BBE\u7F6E\u3002")));
|
|
20514
|
+
}
|
|
20515
|
+
function DevicesPanel(props) {
|
|
20516
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { className: "dsh-mouse-panel" }, /* @__PURE__ */ import_react2.default.createElement(Devices, { ...props }));
|
|
20518
20517
|
}
|
|
20519
20518
|
|
|
20520
20519
|
// src/client/Notice.jsx
|
|
@@ -20551,12 +20550,82 @@ function SonicloudIcon({ size = 16 }) {
|
|
|
20551
20550
|
);
|
|
20552
20551
|
}
|
|
20553
20552
|
|
|
20553
|
+
// src/client/sidebar-panel.mjs
|
|
20554
|
+
var SIDEBAR_PANEL_ID = "dsh-sonicloud-device-panel";
|
|
20555
|
+
var SIDEBAR_PREFERENCE_KEY = "sonicloud.sidebar-panel";
|
|
20556
|
+
function readSidebarPanelPreference(storage) {
|
|
20557
|
+
try {
|
|
20558
|
+
return storage?.getItem(SIDEBAR_PREFERENCE_KEY) !== "false";
|
|
20559
|
+
} catch {
|
|
20560
|
+
return true;
|
|
20561
|
+
}
|
|
20562
|
+
}
|
|
20563
|
+
var SidebarPanelPreference = class {
|
|
20564
|
+
constructor(storage) {
|
|
20565
|
+
this.storage = storage ?? null;
|
|
20566
|
+
this.visible = readSidebarPanelPreference(storage);
|
|
20567
|
+
this.state = { sidebarVisible: this.visible };
|
|
20568
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
20569
|
+
}
|
|
20570
|
+
subscribe = (listener) => {
|
|
20571
|
+
this.listeners.add(listener);
|
|
20572
|
+
return () => this.listeners.delete(listener);
|
|
20573
|
+
};
|
|
20574
|
+
snapshot = () => this.state;
|
|
20575
|
+
setVisible(visible) {
|
|
20576
|
+
const next = !!visible;
|
|
20577
|
+
if (next === this.visible) return;
|
|
20578
|
+
this.visible = next;
|
|
20579
|
+
this.state = { sidebarVisible: next };
|
|
20580
|
+
try {
|
|
20581
|
+
this.storage?.setItem(SIDEBAR_PREFERENCE_KEY, String(next));
|
|
20582
|
+
} catch {
|
|
20583
|
+
}
|
|
20584
|
+
for (const listener of this.listeners) listener();
|
|
20585
|
+
}
|
|
20586
|
+
};
|
|
20587
|
+
function mountSidebarPanel(ctx, { icon, panel, props }) {
|
|
20588
|
+
return ctx.inject(["slots"], (scope) => {
|
|
20589
|
+
scope.slots.inject("sidebar.panellist", () => scope.slots.register({
|
|
20590
|
+
name: "sidebar.panellist",
|
|
20591
|
+
id: SIDEBAR_PANEL_ID,
|
|
20592
|
+
order: 20,
|
|
20593
|
+
label: () => "\u58F0\u4E91\u8BBE\u5907"
|
|
20594
|
+
}, icon));
|
|
20595
|
+
scope.slots.inject("main", () => scope.slots.register({
|
|
20596
|
+
name: "main",
|
|
20597
|
+
key: SIDEBAR_PANEL_ID,
|
|
20598
|
+
inject: () => props()
|
|
20599
|
+
}, panel));
|
|
20600
|
+
});
|
|
20601
|
+
}
|
|
20602
|
+
function attachSidebarPanel(ctx, { icon, panel, props, preferences }) {
|
|
20603
|
+
let mounted = null;
|
|
20604
|
+
const unmount = () => {
|
|
20605
|
+
const scope = mounted;
|
|
20606
|
+
mounted = null;
|
|
20607
|
+
void scope?.dispose();
|
|
20608
|
+
};
|
|
20609
|
+
const sync = () => {
|
|
20610
|
+
if (preferences.visible === (mounted !== null)) return;
|
|
20611
|
+
if (preferences.visible) mounted = mountSidebarPanel(ctx, { icon, panel, props });
|
|
20612
|
+
else unmount();
|
|
20613
|
+
};
|
|
20614
|
+
sync();
|
|
20615
|
+
const unsubscribe = preferences.subscribe(sync);
|
|
20616
|
+
return () => {
|
|
20617
|
+
unsubscribe();
|
|
20618
|
+
unmount();
|
|
20619
|
+
};
|
|
20620
|
+
}
|
|
20621
|
+
|
|
20554
20622
|
// src/client/styles.css
|
|
20555
|
-
var styles_default = ".dsh-asr-settings { display:flex; flex-direction:column; gap:12px; max-width:720px; color:var(--dsw-alias-label-primary,#202124); }\n.dsh-asr-settings h2 { margin:0; font-size:16px; line-height:24px; font-weight:500; }\n.dsh-asr-intro { margin:0; font-size:14px; line-height:22px; color:var(--dsw-alias-label-tertiary,#858890); }\n.dsh-asr-muted { margin:0; font-size:12px; line-height:18px; color:var(--dsw-alias-label-tertiary,#858890); }\n.dsh-asr-services { list-style:none; margin:12px 0 0; padding:0; display:flex; flex-direction:column; gap:8px; }\n.dsh-asr-service { border:.5px solid var(--dsw-alias-settings-card-stroke,#d8d8dc); background:var(--dsw-alias-settings-card-fill,#fff); border-radius:var(--dsw-radius-xl,20px); padding:14px; display:flex; flex-direction:column; gap:8px; }\n.dsh-asr-service-head { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:14px; }\n.dsh-asr-service-head strong { font-weight:500; }\n.dsh-asr-actions { display:flex; justify-content:flex-end; align-items:center; gap:6px; margin-left:auto; }\n.dsh-asr-tag { border:.5px solid var(--dsw-alias-border-l3,#ddd); border-radius:4px; padding:1px 6px; font-size:11px; color:var(--dsw-alias-label-secondary,#666); }\n.dsh-asr-selected { display:inline-flex; align-items:center; gap:5px; font-size:12px; color:var(--dsw-alias-label-secondary,#666); }\n.dsh-asr-dot { width:8px; height:8px; border-radius:50%; background:var(--dsw-alias-state-business-primary,#4d6bfe); }\n.dsh-asr-address { overflow-wrap:anywhere; font-size:12px; color:var(--dsw-alias-label-secondary,#666); }\n.dsh-asr-key { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:12px; }\n.dsh-asr-key code { overflow-wrap:anywhere; }\n.dsh-asr-delete,.dsh-asr-error { color:var(--dsw-alias-state-error-primary,#e33c3c)!important; }\n.dsh-asr-add { border:1px dashed var(--dsw-alias-settings-card-stroke,#d8d8dc)!important; border-radius:var(--dsw-radius-lg,14px)!important; min-height:48px; width:100%; margin-top:4px; }\n.dsh-asr-form { display:flex; flex-direction:column; gap:14px; min-width:min(420px,70vw); max-width:600px; }\n.dsh-asr-field { display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--dsw-alias-label-primary,#202124); }\n.dsh-asr-field-row { display:flex; gap:6px; align-items:center; }\n.dsh-asr-field input { box-sizing:border-box; width:100%; min-width:0; height:36px; padding:6px 10px; border:1px solid var(--dsw-alias-settings-card-stroke,#d8d8dc); border-radius:var(--dsw-radius-md,10px); color:inherit; background:var(--dsw-alias-settings-card-fill,#fff); font:inherit; }\n.dsh-asr-field input:focus-visible { outline:2px solid var(--dsw-alias-state-business-primary,#4d6bfe); outline-offset:2px; }\n.dsh-mouse-settings { width:100%; color:var(--dsw-alias-label-primary,#14161a); }\n.dsh-mouse-settings h2 { margin:0 0 12px; font-size:16px; line-height:24px; font-weight:500; }\n.dsh-mouse-settings h3 { font-size:16px; font-weight:600; }\n.dsh-mouse-carousel { display:flex; align-items:center; justify-content:center; gap:80px; padding:40px 20px 0; }\n.dsh-mouse-carousel > button { border:0; background:none; font-size:36px; color:var(--dsw-alias-label-tertiary,#858890); cursor:pointer; }\n.dsh-mouse-product { text-align:center; }\n.dsh-mouse-illustration { position:relative; width:105px; height:150px; margin:0 auto; border:1px solid #aeb5c0; border-radius:48% 48% 45% 45%; background:linear-gradient(125deg,#fbfcfd,#d0d4da); }\n.dsh-mouse-illustration:before { content:''; position:absolute; width:1px; height:65px; left:50%; top:0; background:#b1b7c0; }\n.dsh-mouse-wheel { position:absolute; width:10px; height:29px; left:calc(50% - 5px); top:18px; border-radius:8px; background:repeating-linear-gradient(#9ba3b0 0 3px,#cbd0d7 4px 6px); border:1px solid #939aa7; }\n.dsh-mouse-ai { position:absolute; bottom:22px; left:0; width:100%; font-size:9px; letter-spacing:2px; color:#8d949f; }\n.dsh-mouse-dots { display:flex; justify-content:center; gap:12px; margin:0 0 38px; }\n.dsh-mouse-dots button { padding:0; width:7px; height:7px; border:0; border-radius:8px; background:#e5e5e5; cursor:pointer; }\n.dsh-mouse-dots button[aria-current=true] { width:20px; background:var(--dsw-alias-label-primary,#14161a); }\n.dsh-mouse-row { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:16px 0; border-bottom:.5px solid var(--dsw-alias-border-l2,#e8e8ea); }\n.dsh-mouse-label { flex:1; min-width:0; padding-right:48px; font-size:14px; line-height:22px; }\n.dsh-mouse-label p { margin:4px 0 0; color:var(--dsw-alias-label-tertiary,#858890); font-size:12px; line-height:18px; }\n.dsh-mouse-key-group { border-bottom:.5px solid var(--dsw-alias-border-l2,#e8e8ea); }\n.dsh-mouse-key-group > .dsh-mouse-row { border-bottom:0; }\n.dsh-mouse-subrow { display:flex; justify-content:flex-end; padding-bottom:16px; }\n.dsh-mouse-subrow .dsh-mouse-controls { justify-content:flex-end; gap:8px; }\n.dsh-mouse-controls { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:12px; min-width:0; font-size:14px; line-height:22px; }\n.dsh-mouse-controls .dsh-mouse-select { justify-content:space-between; gap:12px; height:36px; padding:0 14px; border-radius:var(--dsw-radius-md,10px); background:var(--dsw-alias-bg-module-platform,#f5f6f7); font-size:14px; font-weight:400; }\n.dsh-mouse-controls .dsh-mouse-select:hover { background:var(--dsw-alias-interactive-bg-hover,#eceef1); }\n.dsh-mouse-select > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }\n.dsh-mouse-controls input[type=url] { width:240px; max-width:100%; }\n.dsh-mouse-link-controls { flex-wrap:nowrap; }\n.dsh-mouse-link-controls input[type=url] { min-width:0; }\n.dsh-mouse-link-controls button { flex-shrink:0; }\n.dsh-mouse-value { color:var(--dsw-alias-label-tertiary,#858890); overflow-wrap:anywhere; }\n.dsh-mouse-footer { display:flex; align-items:center; justify-content:space-between; gap:16px; padding-top:16px; }\n.dsh-mouse-footer .dsh-mouse-reset { flex:none; color:var(--dsw-alias-state-warn-label,#b86b00); background:var(--dsw-alias-state-warn-tertiary,#fff4df); }\n.dsh-mouse-footer .dsh-mouse-reset:hover { background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#b86b00) 18%,transparent); }\n.dsh-mouse-switch { display:flex; align-items:center; gap:8px; color:var(--dsw-alias-label-secondary,#626976); font-size:12px; }\n.dsh-mouse-empty { padding:54px 24px; text-align:center; color:var(--dsw-alias-label-secondary,#626976); }\n.dsh-mouse-empty > span { font-size:54px; }\n@media(max-width:600px) { .dsh-mouse-carousel { gap:32px; }.dsh-mouse-row { align-items:flex-start; flex-direction:column; gap:12px; }.dsh-mouse-label { padding-right:0; }.dsh-mouse-controls { width:100%; justify-content:space-between; }.dsh-mouse-controls .dsh-mouse-select { max-width:230px; } }\n";
|
|
20623
|
+
var styles_default = ".dsh-asr-settings { display:flex; flex-direction:column; gap:12px; max-width:720px; color:var(--dsw-alias-label-primary,#202124); }\n.dsh-asr-settings h2 { margin:0; font-size:16px; line-height:24px; font-weight:500; }\n.dsh-asr-intro { margin:0; font-size:14px; line-height:22px; color:var(--dsw-alias-label-tertiary,#858890); }\n.dsh-asr-muted { margin:0; font-size:12px; line-height:18px; color:var(--dsw-alias-label-tertiary,#858890); }\n.dsh-asr-services { list-style:none; margin:12px 0 0; padding:0; display:flex; flex-direction:column; gap:8px; }\n.dsh-asr-service { border:.5px solid var(--dsw-alias-settings-card-stroke,#d8d8dc); background:var(--dsw-alias-settings-card-fill,#fff); border-radius:var(--dsw-radius-xl,20px); padding:14px; display:flex; flex-direction:column; gap:8px; }\n.dsh-asr-service-head { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:14px; }\n.dsh-asr-service-head strong { font-weight:500; }\n.dsh-asr-actions { display:flex; justify-content:flex-end; align-items:center; gap:6px; margin-left:auto; }\n.dsh-asr-tag { border:.5px solid var(--dsw-alias-border-l3,#ddd); border-radius:4px; padding:1px 6px; font-size:11px; color:var(--dsw-alias-label-secondary,#666); }\n.dsh-asr-selected { display:inline-flex; align-items:center; gap:5px; font-size:12px; color:var(--dsw-alias-label-secondary,#666); }\n.dsh-asr-dot { width:8px; height:8px; border-radius:50%; background:var(--dsw-alias-state-business-primary,#4d6bfe); }\n.dsh-asr-address { overflow-wrap:anywhere; font-size:12px; color:var(--dsw-alias-label-secondary,#666); }\n.dsh-asr-key { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:12px; }\n.dsh-asr-key code { overflow-wrap:anywhere; }\n.dsh-asr-delete,.dsh-asr-error { color:var(--dsw-alias-state-error-primary,#e33c3c)!important; }\n.dsh-asr-add { border:1px dashed var(--dsw-alias-settings-card-stroke,#d8d8dc)!important; border-radius:var(--dsw-radius-lg,14px)!important; min-height:48px; width:100%; margin-top:4px; }\n.dsh-asr-form { display:flex; flex-direction:column; gap:14px; min-width:min(420px,70vw); max-width:600px; }\n.dsh-asr-field { display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--dsw-alias-label-primary,#202124); }\n.dsh-asr-field-row { display:flex; gap:6px; align-items:center; }\n.dsh-asr-field input { box-sizing:border-box; width:100%; min-width:0; height:36px; padding:6px 10px; border:1px solid var(--dsw-alias-settings-card-stroke,#d8d8dc); border-radius:var(--dsw-radius-md,10px); color:inherit; background:var(--dsw-alias-settings-card-fill,#fff); font:inherit; }\n.dsh-asr-field input:focus-visible { outline:2px solid var(--dsw-alias-state-business-primary,#4d6bfe); outline-offset:2px; }\n.dsh-mouse-settings { width:100%; color:var(--dsw-alias-label-primary,#14161a); }\n.dsh-mouse-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; }\n.dsh-mouse-head h2 { margin:0; }\n/* main \u5168\u5C40\u9762\u677F\uFF1A\u5BF9\u9F50\u5BBF\u4E3B\u63D2\u4EF6\u9875\u7ED3\u6784\u2014\u2014\u9875\u9762\u6839\u5360\u636E\u5168\u9AD8\u5E76\u81EA\u5E26\u7EB5\u5411\u6EDA\u52A8\uFF0C\u5185\u5BB9\u9650\u5BBD\u5C45\u4E2D\uFF1B\u9876\u90E8\u5B89\u5168\u8DDD\u79BB\u4EC5 darwin \u9700\u8981\uFF08Windows \u4E3A\u539F\u751F\u6807\u9898\u680F\uFF09\u3002 */\n.dsh-mouse-panel { box-sizing:border-box; height:100%; padding:0 clamp(24px,4vw,48px); display:flex; flex-direction:column; align-items:center; overflow:hidden auto; }\n.dsh-mouse-panel > .dsh-mouse-settings { flex:none; max-width:720px; padding:28px 0 48px; }\n[data-platform='darwin'] .dsh-mouse-panel > .dsh-mouse-settings { padding-top:calc(28px + var(--dsh-frame-top-clearance,0px)); }\n.dsh-mouse-settings h2 { margin:0 0 12px; font-size:16px; line-height:24px; font-weight:500; }\n.dsh-mouse-settings h3 { font-size:16px; font-weight:600; }\n.dsh-mouse-carousel { display:flex; align-items:center; justify-content:center; gap:80px; padding:40px 20px 0; }\n.dsh-mouse-carousel > button { border:0; background:none; font-size:36px; color:var(--dsw-alias-label-tertiary,#858890); cursor:pointer; }\n.dsh-mouse-product { text-align:center; }\n.dsh-mouse-illustration { position:relative; width:105px; height:150px; margin:0 auto; border:1px solid #aeb5c0; border-radius:48% 48% 45% 45%; background:linear-gradient(125deg,#fbfcfd,#d0d4da); }\n.dsh-mouse-illustration:before { content:''; position:absolute; width:1px; height:65px; left:50%; top:0; background:#b1b7c0; }\n.dsh-mouse-wheel { position:absolute; width:10px; height:29px; left:calc(50% - 5px); top:18px; border-radius:8px; background:repeating-linear-gradient(#9ba3b0 0 3px,#cbd0d7 4px 6px); border:1px solid #939aa7; }\n.dsh-mouse-ai { position:absolute; bottom:22px; left:0; width:100%; font-size:9px; letter-spacing:2px; color:#8d949f; }\n.dsh-mouse-dots { display:flex; justify-content:center; gap:12px; margin:0 0 38px; }\n.dsh-mouse-dots button { padding:0; width:7px; height:7px; border:0; border-radius:8px; background:#e5e5e5; cursor:pointer; }\n.dsh-mouse-dots button[aria-current=true] { width:20px; background:var(--dsw-alias-label-primary,#14161a); }\n.dsh-mouse-row { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:16px 0; border-bottom:.5px solid var(--dsw-alias-border-l2,#e8e8ea); }\n.dsh-mouse-label { flex:1; min-width:0; padding-right:48px; font-size:14px; line-height:22px; }\n.dsh-mouse-label p { margin:4px 0 0; color:var(--dsw-alias-label-tertiary,#858890); font-size:12px; line-height:18px; }\n.dsh-mouse-key-group { border-bottom:.5px solid var(--dsw-alias-border-l2,#e8e8ea); }\n.dsh-mouse-key-group > .dsh-mouse-row { border-bottom:0; }\n.dsh-mouse-subrow { display:flex; justify-content:flex-end; padding-bottom:16px; }\n.dsh-mouse-subrow .dsh-mouse-controls { justify-content:flex-end; gap:8px; }\n.dsh-mouse-controls { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:12px; min-width:0; font-size:14px; line-height:22px; }\n.dsh-mouse-controls .dsh-mouse-select { justify-content:space-between; gap:12px; height:36px; padding:0 14px; border-radius:var(--dsw-radius-md,10px); background:var(--dsw-alias-bg-module-platform,#f5f6f7); font-size:14px; font-weight:400; }\n.dsh-mouse-controls .dsh-mouse-select:hover { background:var(--dsw-alias-interactive-bg-hover,#eceef1); }\n.dsh-mouse-select > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }\n.dsh-mouse-controls input[type=url] { width:240px; max-width:100%; }\n.dsh-mouse-link-controls { flex-wrap:nowrap; }\n.dsh-mouse-link-controls input[type=url] { min-width:0; }\n.dsh-mouse-link-controls button { flex-shrink:0; }\n.dsh-mouse-value { color:var(--dsw-alias-label-tertiary,#858890); overflow-wrap:anywhere; }\n.dsh-mouse-footer { display:flex; align-items:center; justify-content:space-between; gap:16px; padding-top:16px; }\n.dsh-mouse-footer .dsh-mouse-reset { flex:none; color:var(--dsw-alias-state-warn-label,#b86b00); background:var(--dsw-alias-state-warn-tertiary,#fff4df); }\n.dsh-mouse-footer .dsh-mouse-reset:hover { background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#b86b00) 18%,transparent); }\n.dsh-mouse-switch { display:flex; align-items:center; gap:8px; color:var(--dsw-alias-label-secondary,#626976); font-size:12px; }\n.dsh-mouse-empty { padding:54px 24px; text-align:center; color:var(--dsw-alias-label-secondary,#626976); }\n.dsh-mouse-empty > span { font-size:54px; }\n@media(max-width:600px) { .dsh-mouse-carousel { gap:32px; }.dsh-mouse-row { align-items:flex-start; flex-direction:column; gap:12px; }.dsh-mouse-label { padding-right:0; }.dsh-mouse-controls { width:100%; justify-content:space-between; }.dsh-mouse-controls .dsh-mouse-select { max-width:230px; } }\n";
|
|
20556
20624
|
|
|
20557
20625
|
// src/client/index.jsx
|
|
20558
20626
|
var inject = ["remote", "slots"];
|
|
20559
20627
|
async function apply(ctx) {
|
|
20628
|
+
const preferences = new SidebarPanelPreference(typeof localStorage === "undefined" ? void 0 : localStorage);
|
|
20560
20629
|
const unmountRemote = await ctx.remote.$mount(REMOTE);
|
|
20561
20630
|
const view = new AiConversationView({ document, closeTopModal: import_dsh_client_ui_primitives3.closeTopModal });
|
|
20562
20631
|
let ui, aiUi;
|
|
@@ -20580,7 +20649,7 @@ async function apply(ctx) {
|
|
|
20580
20649
|
id: "dsh-sonicloud-device",
|
|
20581
20650
|
order: 11,
|
|
20582
20651
|
label: () => "\u58F0\u4E91\u8BBE\u5907",
|
|
20583
|
-
inject: () => ({ api, controller })
|
|
20652
|
+
inject: () => ({ api, controller, sidebar: preferences })
|
|
20584
20653
|
}, Devices));
|
|
20585
20654
|
scope.slots.inject("settings.section.icon", () => scope.slots.register({
|
|
20586
20655
|
name: "settings.section.icon",
|
|
@@ -20596,6 +20665,12 @@ async function apply(ctx) {
|
|
|
20596
20665
|
id: "dsh-sonicloud-device-ai-target",
|
|
20597
20666
|
inject: () => ({ view })
|
|
20598
20667
|
}, AiConversationTarget));
|
|
20668
|
+
scope.effect(() => attachSidebarPanel(scope, {
|
|
20669
|
+
icon: SonicloudIcon,
|
|
20670
|
+
panel: DevicesPanel,
|
|
20671
|
+
props: () => ({ controller, sidebar: preferences }),
|
|
20672
|
+
preferences
|
|
20673
|
+
}));
|
|
20599
20674
|
});
|
|
20600
20675
|
await ui;
|
|
20601
20676
|
aiUi = ctx.inject(["remote.asr", "sessions", "layout", "conversation", "uiWorkspace", "workspaces"], (scope) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# 本地开发与代码贡献
|
|
2
2
|
|
|
3
|
-
本项目是 DeepSeek Harness 插件,前端和后端均由宿主加载。本文面向开发者,说明本地调试、技术配置、验证和贡献流程。普通用户的安装与使用说明见 [README](../../README.md)。以下命令在仓库根目录执行。
|
|
3
|
+
本项目是 DeepSeek Harness 插件,前端和后端均由宿主加载。本文面向开发者,说明本地调试、技术配置、验证和贡献流程。普通用户的安装与使用说明见 [README](../../README.zh.md)。以下命令在仓库根目录执行。
|
|
4
4
|
|
|
5
5
|
## 环境准备
|
|
6
6
|
|
|
7
|
-
- 安装 Git、Node.js 22 或更高版本及 npm
|
|
7
|
+
- 安装 Git、Node.js 22 或更高版本及 npm。本仓库统一使用 npm 与 `package-lock.json`。
|
|
8
8
|
- 安装 DeepSeek Harness 0.2.1-rc.5 或更高版本;先启动一次完成初始化,再完全退出。
|
|
9
9
|
- 需要实机调试时连接智能鼠标。仓库随包提供 macOS ARM64、Windows x64 的 mouse-sdk 0.4.20;系统要求、依赖与许可证见 [原生 SDK 说明](../../native/README.md)。其他平台需提供对应 SDK 并配置 `native.libraryPath`。
|
|
10
10
|
|
|
@@ -17,6 +17,8 @@ npm ci
|
|
|
17
17
|
|
|
18
18
|
仅修改业务代码时无需更新依赖锁文件。增删或升级依赖使用 `npm install` / `npm uninstall`,同时提交 `package.json` 与 `package-lock.json` 的对应变更。
|
|
19
19
|
|
|
20
|
+
Harness profile 自身的 pnpm 配置由宿主管理,与本仓库的 npm 开发流程独立;普通用户通过插件界面安装,见 [README](../../README.zh.md#安装与启用)。
|
|
21
|
+
|
|
20
22
|
## 启动开发模式
|
|
21
23
|
|
|
22
24
|
确认 Harness 已完全退出后执行:
|
|
@@ -70,7 +72,7 @@ dsh plugin --profile desktop add /绝对路径/项目目录/artifacts/实际包
|
|
|
70
72
|
|
|
71
73
|
| 路径 | 职责 |
|
|
72
74
|
| --- | --- |
|
|
73
|
-
| `src/client/` | React
|
|
75
|
+
| `src/client/` | React 设备设置、偏好编辑、AI 对话桥接与连接重试 |
|
|
74
76
|
| `src/desktop/`、`native/desktop/` | 桌面浮层进程、私有标准流协议及系统输入框回填 |
|
|
75
77
|
| `src/host/` | 宿主插件入口、Remote 注册与存储适配 |
|
|
76
78
|
| `src/devices/` | SDK 独立进程、设备管理、偏好、语音会话与按键动作 |
|
|
@@ -78,17 +80,19 @@ dsh plugin --profile desktop add /绝对路径/项目目录/artifacts/实际包
|
|
|
78
80
|
| `src/shared/` | 前后端共享协议、语言映射和鼠标设置定义 |
|
|
79
81
|
| `native/` | 原生 SDK、依赖库、来源与许可证 |
|
|
80
82
|
| `scripts/`、`tests/` | 构建、开发辅助脚本与自动化测试 |
|
|
81
|
-
| `docs/specs/` | [插件规格](../specs/smart-mouse-plugin.md)、[鼠标设置](../specs/mouse-settings.md)与[
|
|
83
|
+
| `docs/specs/` | [插件规格](../specs/smart-mouse-plugin.md)、[鼠标设置](../specs/mouse-settings.md)与[发布规格](../specs/ci-cd.md) |
|
|
82
84
|
| `dist/`、`work/` | 正式前端构建产物与本地开发产物,不提交 |
|
|
83
85
|
|
|
84
86
|
## 桌面语音浮层
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
运行行为与验收要求见[插件规格第 3–4 节](../specs/smart-mouse-plugin.md#34-ai-键动作)。实现入口:
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
- `DeviceManager` 串行处理设备事件和偏好保存,分别处理连接、身份、电量、DPI 上报及按键;语音识别与最终结果输出分开处理,共用会话取消和清理路径。
|
|
91
|
+
- AI 键通过 `watchAi` / `answerAi` Remote 通道连接前端。前端使用 `sessions`、`workspaces`、`layout`、`uiWorkspace` 和 `conversation.input` 公共接口,保留目标引用,以 `workspaceId` 创建对话,并通过输入扩展槽等待组件挂载。
|
|
92
|
+
- `insert` 携带录音时的 `aiAutoSend`,通过 `requestDraftInitialization` 追加草稿,按开关调用目标组件的 `inputActions.submit()`。请求绑定同一前端连接;断开不重放填充,结束释放引用。原生浮层对 `ai_input` 只提供预览、取消和失败结果复制。
|
|
89
93
|
|
|
90
94
|
- macOS:`native/desktop/VoicePanel.swift` 构建不激活的 NSPanel,默认采用兼容粘贴,核对进程、窗口、文档、焦点和输入活动计数;可读取内容与选区时同时检查,不再要求辅助功能写入接口。随包提供 ARM64 应用;修改源码后在 macOS 执行 `node scripts/native/build-desktop.mjs`,需要 Xcode Command Line Tools。普通用户无需 Swift 工具链。
|
|
91
|
-
- Windows:`windows.ps1` 在隐藏的 STA 进程中加载 `VoicePanel.cs`,使用系统 WinForms 与 UI Automation
|
|
95
|
+
- Windows:`windows.ps1` 在隐藏的 STA 进程中加载 `VoicePanel.cs`,使用系统 WinForms 与 UI Automation,无需额外下载运行时。不支持安全回填的控件显示结果供复制。验证范围见下文记录。
|
|
92
96
|
- 浮层和 Host 通过私有 stdin/stdout 交换 JSON,文字不进入命令行、临时文件或日志;macOS 默认通过临时粘贴回填,随后恢复此前的全部剪贴板类型,若期间有新复制则保留新内容。其他剪贴板写入仅来自用户点击“复制结果”。辅助功能权限不足不阻止预览,但不能自动回填。
|
|
93
97
|
- 开发代际复制 `native/desktop/` 并将浮层模块的资源路径固定到对应代际。修改开发构建脚本后须重启 `npm run dev`。
|
|
94
98
|
|
|
@@ -130,11 +134,7 @@ DPI 选项及保存值见[鼠标设置](../specs/mouse-settings.md#dpi-设置)
|
|
|
130
134
|
|
|
131
135
|
硬件 `dpiChanged.level` 默认按 `{ "800": 0, "1200": 1, "1600": 2, "2400": 3 }` 映射(与现有鼠标客户端一致)。其他固件可覆盖 `dpiReportLevels`;未知、歧义或无效档位不修改 DPI 偏好。有效上报更新对应 SN 的保存值并推送界面,不再次下发指令;重复值不增加配置版本。硬件广播还可能出现在连接及通道切换时,不能当作软件设置的确认回执。实际固件档位仍需实机验收。
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
默认内置 43 项识别选项映射,设置提供 43 项语音打字、27 项翻译源和 28 项翻译目标语言。覆盖范围、默认设置和语言编号见[鼠标设置规格](../specs/mouse-settings.md)。
|
|
136
|
-
|
|
137
|
-
翻译使用源语言识别后的完整文本,调用开放平台 `POST /v1/translate/text`,读取 `data.resultText`。鉴权失效时刷新并重试一次,仍失败则在独立浮层提示;错误处理和时限见插件规格。实网翻译与真实设备链路仍待验收。
|
|
137
|
+
鉴权、凭据迁移和翻译流程见[插件规格第 5–6 节](../specs/smart-mouse-plugin.md#5-接口与鉴权),语言选项及映射见[鼠标设置](../specs/mouse-settings.md)。
|
|
138
138
|
|
|
139
139
|
## 验证变更
|
|
140
140
|
|
|
@@ -160,27 +160,22 @@ npm test
|
|
|
160
160
|
|
|
161
161
|
### 已有验证记录
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
| 范围 | 记录与边界 |
|
|
166
|
-
| --- | --- |
|
|
167
|
-
| 构建与自动化 | 曾通过构建、自动化测试、真实 Harness Gateway 与本地 Token / ASR 模拟服务集成及安装包检查;覆盖双鼠标隔离、配置切换、取消与重连、末句处理、翻译适配器、搜索编码、DPI 重试及设置界面 |
|
|
168
|
-
| AI 键自动发送(2026-11-09) | 构建及全量 108 项测试通过;覆盖开关保存与恢复默认、旧配置迁移、设备隔离、录音配置快照、填充后发送一次及失败不发送,Gateway 验证 `autoSend` 的开/关传输;真实鼠标与宿主界面的自动发送联调待验证 |
|
|
169
|
-
| AI 键历史验证(2026-11-09) | 全量 104 项测试通过,覆盖设置关闭、输入组件就绪、工作区归属、定向填充与 Gateway 通道;此前安装包实测从设置页及插件页返回后填充成功且不发送,测试草稿已清空,macOS ARM64 浮层编译与包内容检查通过;真实鼠标长按、尾音及窗口唤起、Windows 实机待验证 |
|
|
170
|
-
| macOS 兼容粘贴回填(2026-11-09) | 临时文档已验证中英文及多行文字兼容粘贴,用户确认真实鼠标语音可正常回填;默认兼容粘贴已在 VS Code 输入框验证中英文和多行文字;80 项回归测试通过,其他应用和完整翻译链路仍待验收 |
|
|
171
|
-
| macOS ARM64 | 曾验证 SDK 加载、初始化和退出;2026-11-05 确认退出独占 USB 接口的 ClawMouse 并重新加载后,Harness 显示 1 台 USB 鼠标、SN 和电量,未覆盖录音与按键动作 |
|
|
172
|
-
| 开发重载 | 在隔离 profile 中验证 Harness 0.2.1-rc.5 HMR:同一 Host 进程替换后端并通知前端,旧 SDK 子进程退出,新 SDK 初始化;自动化覆盖编译失败保护、保存监听、恢复及退出清理,桌面窗口实际重绘尚待验收 |
|
|
173
|
-
| 识别语言 | 普通话、英语、日语、粤语、法语及普通话繁体曾用合成音频抽样验证,其余映射尚未逐项实网验收 |
|
|
174
|
-
|
|
175
|
-
待验证:真实鼠标 BLE / 2.4G 音频与尾音时序、DPI 固件映射、系统按键与辅助功能权限、Windows 实机及开发流程;新鉴权及翻译实网链路。
|
|
163
|
+
以下汇总截至 2026-11-09 的历史记录,不代表每次提交均已通过。维护者已确认完成 0.1.0 的 README 实机验收;专项验证仍以表内范围为准,未记录的场景不推定通过。发布平台记录单独维护在 [CI/CD 规格](../specs/ci-cd.md#6-验收与平台状态)。
|
|
176
164
|
|
|
177
|
-
|
|
165
|
+
| 范围 | 已验证 | 边界 |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| 自动化与安装包 | 构建、真实 Harness Gateway 与本地 Token/ASR 模拟服务、包内容检查;覆盖设备隔离、保存、取消、重连、末句、翻译、搜索、DPI 和界面 | 不替代真实硬件与实网验收 |
|
|
168
|
+
| AI 键 | 自动化覆盖目标对话、工作区归属、组件就绪、追加草稿、自动发送、旧配置、去重、取消和 Gateway;安装包曾实测关闭设置及从设置/插件页新建对话后填充 | 实机填充记录来自自动发送加入前;真实鼠标长按、尾音、窗口唤起及自动发送联调待验证 |
|
|
169
|
+
| macOS 回填 | ARM64 浮层编译、显示、最小化后可见;Zed 和 VS Code 的中英文、多行兼容粘贴;用户确认真实鼠标在 Zed 可回填;保护策略自动化覆盖目标/输入变化与新剪贴板内容 | 其他应用、多屏/全屏、完整翻译链路待验证 |
|
|
170
|
+
| macOS SDK | 加载、初始化和退出;2026-11-05 退出 ClawMouse 后,Harness 显示 USB 鼠标、SN 和电量 | 该次连接检查未覆盖录音与按键 |
|
|
171
|
+
| 开发重载 | 隔离 profile 下同一 Host 进程替换后端、通知前端、重建 SDK;自动化覆盖失败保护、监听、恢复及退出清理 | 桌面实际重绘及 Windows 开发流程待验证 |
|
|
172
|
+
| 语言与服务 | 语言范围曾核对官方文档;普通话、英语、日语、粤语、法语及普通话繁体通过合成音频抽样 | 其余语言、新鉴权与文本翻译实网链路待验证 |
|
|
178
173
|
|
|
179
|
-
|
|
174
|
+
专项待验证:BLE/2.4G 音频与尾音时序、DPI 固件映射、系统按键及辅助功能权限、Windows 原生浮层与真实鼠标链路。产品与硬件待确认事项见[插件规格第 8 节](../specs/smart-mouse-plugin.md#8-待确认与联调)。
|
|
180
175
|
|
|
181
176
|
## 贡献流程
|
|
182
177
|
|
|
183
|
-
1.
|
|
178
|
+
1. 从团队约定的目标分支创建工作分支,一次变更聚焦一个问题。目标分支和合并策略待维护者确认;`dev`、`main` 的推送会触发[发布流程](../specs/ci-cd.md),合并前确认版本与产物要求。
|
|
184
179
|
2. 按所属模块修改代码;修复缺陷或新增行为时,补充能验证该行为的测试。功能、配置或使用方式变化时同步相关文档。
|
|
185
180
|
3. 执行适用的自动化与手工验证,区分通过、失败和未验证项。对用户或贡献者有意义的变更,同步记录到 [中文更新日志](../../CHANGELOG.zh.md)和[英文更新日志](../../CHANGELOG.md)的未发布章节;格式遵循 [项目规范](../../AGENTS.md)。
|
|
186
181
|
4. 用 `git diff`、`git status --short` 检查范围,只暂存本次变更的文件。不提交构建产物、开发链接、个人配置或真实凭据。
|
|
@@ -195,6 +190,6 @@ npm test
|
|
|
195
190
|
| 提示已有开发构建进程 | 停止旧监听;仅在确认无开发进程且锁文件损坏时清理 `work/dev-plugin/watch.lock` |
|
|
196
191
|
| 构建成功但未收到重载确认 | 检查插件是否启用、profile 与 `DSH_HOME` 是否一致,再检查宿主日志;首次使用需先安装开发链接 |
|
|
197
192
|
| 同一 profile 中其他插件的 HMR 失效 | 在 profile 的用户 patch 中将各插件入口一起加入 `hmr.config.root`;用户 patch 优先级更高 |
|
|
198
|
-
| SDK 初始化成功但没有鼠标 | 检查鼠标电源、连接模式与接收器占用;ClawMouse 等应用可能独占数据接口,排查方法见 [README](../../README.md#接收器已插入但没有设备) |
|
|
193
|
+
| SDK 初始化成功但没有鼠标 | 检查鼠标电源、连接模式与接收器占用;ClawMouse 等应用可能独占数据接口,排查方法见 [README](../../README.zh.md#接收器已插入但没有设备) |
|
|
199
194
|
|
|
200
195
|
接收器占用诊断目前仅适用于 macOS 默认 uMouse 接收器,Windows 尚未提供占用进程诊断。SDK 初始化成功不代表设备已连接;排查时分别确认 SDK 状态、设备列表与实际按键、音频事件。
|
|
Binary file
|
|
Binary file
|
package/docs/specs/ci-cd.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# CI/CD
|
|
1
|
+
# CI/CD 发布规格
|
|
2
2
|
|
|
3
3
|
状态:已实现工作流和发布校验工具;平台发布验证见第 6 节。工作流:[`release.yml`](../../.github/workflows/release.yml),校验与发布工具:[`scripts/ci`](../../scripts/ci/)。
|
|
4
4
|
|
|
5
|
-
GitHub 仓库:[SonicloudTech/dsh-sonicloud-device](https://github.com/SonicloudTech/dsh-sonicloud-device)
|
|
5
|
+
GitHub 仓库:[SonicloudTech/dsh-sonicloud-device](https://github.com/SonicloudTech/dsh-sonicloud-device)。
|
|
6
6
|
|
|
7
7
|
## 1. 触发与产物
|
|
8
8
|
|
|
@@ -19,8 +19,8 @@ GitHub 仓库:[SonicloudTech/dsh-sonicloud-device](https://github.com/Soniclou
|
|
|
19
19
|
|
|
20
20
|
- 正式版本以 `package.json.version` 为准,必须是未发布、比当前正式版高的稳定 SemVer 版本;`package-lock.json` 同步更新。CI 不自动提交版本修改。
|
|
21
21
|
- 测试版本格式:`<目标正式版本>-dev.<run_number>.<run_attempt>`,例如 `0.3.0-dev.128.1`;仅修改 CI 工作副本中的包版本及锁文件。
|
|
22
|
-
- 开发阶段在两份 CHANGELOG 的“未发布 / Unreleased
|
|
23
|
-
-
|
|
22
|
+
- 开发阶段在两份 CHANGELOG 的“未发布 / Unreleased”中维护变更;正式发布前,建议移入对应版本和日期章节,保留顶部未发布章节——未折叠时发布流程自动回退采用未发布章节内容,完全折叠(无未发布章节)时直接采用当前版本章节。格式遵循 [项目规范](../../AGENTS.md)。
|
|
23
|
+
- 测试运行摘要读取当前提交的中文“未发布”章节,标明“本轮累计变更”;正式运行摘要读取当前版本章节(无版本章节时回退读取未发布章节),附对应提交的完整日志链接。
|
|
24
24
|
- 无变更说明、正式版本重复或中英文版本/日期/分类/条目结构不一致时,停止发布并报告原因;翻译内容一致性由维护者确认。
|
|
25
25
|
|
|
26
26
|
## 3. 构建与分发
|
|
@@ -32,33 +32,16 @@ GitHub 仓库:[SonicloudTech/dsh-sonicloud-device](https://github.com/Soniclou
|
|
|
32
32
|
- 每次打包生成 `.tgz`、校验文件和发布信息(版本、提交 SHA、工作流地址);包名与文件名从打包结果读取,不硬编码。
|
|
33
33
|
- 测试产物上传 Actions Artifact,保留 30 天;运行摘要提供下载地址及有效期。下载后解压外层归档获得 `.tgz`。下载需要登录 GitHub;公开仓库的 Artifact 不作为内部保密分发渠道。[下载规则](https://docs.github.com/en/actions/how-tos/manage-workflow-runs/download-workflow-artifacts)
|
|
34
34
|
- 正式产物与发布信息先存入 Artifact,保留 30 天供重跑核对;再发布已经检查的同一份 `.tgz`,指定 `--access public --tag latest`。发布后等待 npm 异步处理(最多 3 分钟),查询并下载 npm 产物,确认版本、`latest`、SRI 和 SHA-256 一致;运行摘要提供 npm 版本页面和该版本 `dist.tarball` 下载地址。
|
|
35
|
-
- CI 通过仅代表自动化验证通过;推送到 `main` 前完成 [README 使用流程](../../README.md) 中与本次变更相关的实机验证。
|
|
35
|
+
- CI 通过仅代表自动化验证通过;推送到 `main` 前完成 [README 使用流程](../../README.zh.md) 中与本次变更相关的实机验证。
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
# 测试包:文件名以实际产物为准
|
|
41
|
-
dsh plugin --profile desktop add /绝对路径/测试包.tgz
|
|
42
|
-
|
|
43
|
-
# 正式包:替换为本次确切版本
|
|
44
|
-
dsh plugin --profile desktop add @sonicloud/dsh-sonicloud-device@<版本>
|
|
45
|
-
```
|
|
37
|
+
测试包与正式包的安装、更新和旧包迁移见 [README](../../README.zh.md#安装与启用)。
|
|
46
38
|
|
|
47
39
|
## 4. 权限与首次配置
|
|
48
40
|
|
|
49
41
|
### 4.1 仓库与包准备
|
|
50
42
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
"repository": {
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/SonicloudTech/dsh-sonicloud-device.git"
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
- 项目代码采用 MIT 许可,原生 SDK 和第三方组件保留各自许可。维护者已确认完成 0.1.0 的 README 实机验收;包名迁移已在隔离 Harness profile 验证旧包移除、新包安装与数据文件保留。
|
|
43
|
+
- 包元数据与 `package-lock.json` 保持一致;`repository` 指向上述仓库。插件实例 ID 与设备配置存储键保持兼容,包名迁移须验证旧包移除、新包安装及配置保留。
|
|
44
|
+
- 项目代码采用 MIT 许可,原生 SDK 和第三方组件保留各自许可。
|
|
62
45
|
- 第三方 Actions 固定提交 SHA,日志内容按数据处理,不直接拼接执行命令。[GitHub 安全说明](https://docs.github.com/en/actions/reference/security/secure-use)
|
|
63
46
|
- 当前 `src/asr/config.mjs` 不含内置凭据;打包检查拒绝常见密钥和凭据字面量。CI Secrets 不得注入公开源码或安装包,历史泄露凭据需单独撤销。
|
|
64
47
|
|
|
@@ -72,7 +55,7 @@ npm 组织 `sonicloud` 与 GitHub 组织 `SonicloudTech` 独立管理,加入 G
|
|
|
72
55
|
|
|
73
56
|
### 4.3 首次发布
|
|
74
57
|
|
|
75
|
-
|
|
58
|
+
首次建包由维护者发布首个正式版本,再为该包配置 Trusted Publisher。若目标包已有版本,先确认维护权限和已发布版本,跳过首次建包步骤。
|
|
76
59
|
|
|
77
60
|
完成 4.1 后,在本地执行以下命令;发布参数使用已经检查的实际 `.tgz` 路径,按提示完成账号验证:
|
|
78
61
|
|
|
@@ -88,9 +71,9 @@ npm publish /绝对路径/已检查的正式包.tgz --access public --tag latest
|
|
|
88
71
|
|
|
89
72
|
### 4.4 GitHub Environment 与 npm Trusted Publisher
|
|
90
73
|
|
|
91
|
-
|
|
74
|
+
首次配置时先提交 `.github/workflows/release.yml`,再配置 Trusted Publisher;现有配置与验证记录见第 6 节。
|
|
92
75
|
|
|
93
|
-
1. 在 [仓库设置](https://github.com/SonicloudTech/dsh-sonicloud-device/settings/environments) → Environments 创建 `npm-production`。Deployment branches and tags 选择 Selected branches and tags,仅添加 Branch 类型的 `main`;不设置 Required reviewers。私有组织仓库使用此功能需 GitHub Team 或 Enterprise
|
|
76
|
+
1. 在 [仓库设置](https://github.com/SonicloudTech/dsh-sonicloud-device/settings/environments) → Environments 创建 `npm-production`。Deployment branches and tags 选择 Selected branches and tags,仅添加 Branch 类型的 `main`;不设置 Required reviewers。私有组织仓库使用此功能需 GitHub Team 或 Enterprise,本仓库的配置记录见第 6 节。[Environment 配置](https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments)
|
|
94
77
|
2. 正式发布 job 仅在 `main` 运行,声明 `environment: npm-production`;默认权限为 `contents: read`,仅该 job 增加 `id-token: write`。按第 3 节发布已检查的 `.tgz`,不配置 `NPM_TOKEN` 或 `NODE_AUTH_TOKEN` 发布密钥。
|
|
95
78
|
3. 由具备包设置权限的维护者打开 [npm 包页面](https://www.npmjs.com/package/@sonicloud/dsh-sonicloud-device) → Settings → Trusted publishing,添加 GitHub Actions,按下表填写并保存。
|
|
96
79
|
|
|
@@ -100,7 +83,7 @@ npm publish /绝对路径/已检查的正式包.tgz --access public --tag latest
|
|
|
100
83
|
| Repository | `dsh-sonicloud-device` |
|
|
101
84
|
| Workflow filename | `release.yml`(不含目录) |
|
|
102
85
|
| Environment name | `npm-production` |
|
|
103
|
-
| Allowed actions | 启用直接 `npm publish
|
|
86
|
+
| Allowed actions | 启用直接 `npm publish`;不需要额外启用 `npm dist-tag` |
|
|
104
87
|
|
|
105
88
|
字段需大小写完全匹配。新建配置后须在 **2 天内成功发布一次**;过期则删除并重新创建。配置保存成功不代表发布验证通过,应以首次 OIDC 发布结果为准。[npm Trusted Publisher 配置与限制](https://docs.npmjs.com/trusted-publishers/)
|
|
106
89
|
|
|
@@ -111,18 +94,22 @@ npm publish /绝对路径/已检查的正式包.tgz --access public --tag latest
|
|
|
111
94
|
- 测试、构建或包检查失败:停止上传和发布,在 Actions 运行摘要中记录失败阶段,仅展示实际可用的产物链接。
|
|
112
95
|
- 正式发布串行执行,不取消正在进行的发布;新发布不得使 `latest` 回退。发布前再次核对 npm 版本状态,重复版本不覆盖。
|
|
113
96
|
- 同一次运行重试时,恢复该运行保存的正式 Artifact 并重新执行测试,不重新打包;记录必须匹配仓库、提交 SHA、运行 ID、包名、版本和哈希。若 npm 已存在该版本,再核对 npm 完整性与 `latest`;一致则补全摘要,不一致、产物过期或记录缺失则失败。
|
|
97
|
+
- 重跑前确认原 Artifact 仍可下载;仅发布 job 失败时优先重跑失败 job,保留构建结果。若原 Artifact 已不可用,不用新打包结果冒充原产物,也不重新发布已存在版本;核查首次发布结果后,后续改动使用新版本。
|
|
114
98
|
- 已发布问题版本通过新修复版本替代,不自动删除或覆盖现有 npm 版本。
|
|
115
99
|
|
|
116
100
|
## 6. 验收与平台状态
|
|
117
101
|
|
|
118
102
|
验收:仅 `push dev/main` 触发;`dev` 产出可安装测试包;`main` 发布 npm 正式版;运行摘要中的版本、日志和产物对应;失败及重跑不误报、不重复发布;首次迁移保留既有配置。
|
|
119
103
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
已验证:本地完整测试通过(新增发布等待测试后共 124 项);实际正式包内容检查通过;隔离 Harness profile 迁移检查通过;actionlint 工作流检查通过。维护者已确认 0.1.0 实机验收。
|
|
123
|
-
|
|
124
|
-
平台已确认:GitHub 仓库公开;`npm-production` 仅允许 `main` 分支、无人工审批;npm 账号 `bingmax` 是 `sonicloud` Owner 且已启用 2FA。
|
|
104
|
+
以下为 2026-11-09 的验收记录,不表示平台实时状态;插件功能的实机范围见[开发说明](../contributing/development.md#已有验证记录)。
|
|
125
105
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
106
|
+
| 范围 | 结果与证据 |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| 本地校验 | 全量测试、正式包内容、隔离 Harness profile 迁移及 actionlint 通过;插件 ID 与配置数据保留 |
|
|
109
|
+
| 平台配置 | 仓库公开;`npm-production` 仅允许 `main`、无人工审批;维护者具备 npm `sonicloud` Owner 权限并启用 2FA;Trusted Publisher 按第 4.4 节保存且当时状态为 `Valid` |
|
|
110
|
+
| 测试分支 | [`dev` 实际运行](https://github.com/SonicloudTech/dsh-sonicloud-device/actions/runs/42594309932)通过,上传测试产物,跳过 npm 发布 |
|
|
111
|
+
| 首次建包 | `0.1.0` 由维护者发布,核对版本、`latest`、SRI 和下载 SHA-256;临时登录已撤销,凭据文件已删除 |
|
|
112
|
+
| OIDC 发布 | [`0.1.1` 第 1 次尝试](https://github.com/SonicloudTech/dsh-sonicloud-device/actions/runs/42595306280/attempts/1)通过;当时 `latest=0.1.1`,SRI、SHA-256 及 provenance 的仓库、分支、工作流、提交均匹配 |
|
|
113
|
+
| 产物缺失保护 | [`0.1.1` 第 2 次尝试](https://github.com/SonicloudTech/dsh-sonicloud-device/actions/runs/42595306280/attempts/2)在 preflight 停止,未重新打包或重复发布;原 Artifact 列表为空、ID 查询返回 404,消失原因未确定,首次 npm 发布不受影响 |
|
|
114
|
+
|
|
115
|
+
尚未完成平台验收:原 Artifact 可用时的成功恢复分支;该分支已通过本地测试。
|
|
@@ -43,38 +43,11 @@
|
|
|
43
43
|
| 翻译源语言 | 27 | 文本翻译支持,且有明确的 ASR 映射。 |
|
|
44
44
|
| 翻译目标语言 | 28 | 文本翻译支持。 |
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### 接口映射边界
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
识别使用 `lanid`、`lid=0`、`role=0`;翻译使用源语言识别后的最终文本,单独调用文本翻译接口,不使用流式翻译。鉴权、请求/响应、收尾和重试规则统一见[插件规格第 5 节](smart-mouse-plugin.md#5-接口与鉴权)。
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
| --- | --- | --- |
|
|
52
|
-
| `lanid` | String,默认 `"0"` | 识别语种编号,支持 `0–127`;普通话为 `"0"`、粤语为 `"4"`、繁体中文为 `"100"`。鼠标选项映射见下表。 |
|
|
53
|
-
| `lid` | String,默认 `"0"` | 工作模式:`"0"` 为识别,`"1"` 为同声传译。当前插件使用 `"0"`。 |
|
|
54
|
-
| `role` | Integer,默认 `0` | 是否区分说话人:`0` 不区分、`1` 区分;仅在 `lid=0` 时有效。当前插件取 `0`,序列化到 Query 后为字符串 `"0"`。 |
|
|
55
|
-
| `fromlan` | String,`lid=1` 时必填 | 流式翻译的源语言代码,取自实时识别语种表的“语言代码”列;不是 `lanid` 编号。当前插件不传。 |
|
|
56
|
-
| `tolan` | String,`lid=1` 时必填 | 流式翻译的目标语言代码,规则同 `fromlan`。当前插件不传。 |
|
|
57
|
-
|
|
58
|
-
`lid=0` 且提供 `fromlan/tolan` 时,接口支持识别后翻译;`lid=1` 为双向同声传译,限 `lanid=0–99`。流式翻译不支持 `lanid>=100` 的语种。当前鼠标翻译流程为“源语言识别 → 最终文本 → 独立文本翻译”,不使用流式翻译模式。
|
|
59
|
-
|
|
60
|
-
识别结果使用 `result`;`End>0` 表示一句完整结果,`errCode="10"` 表示整个流结束。流式翻译的 `trans` 是该 WebSocket 接口的译文字段,不能作为文本翻译接口的响应字段。
|
|
61
|
-
|
|
62
|
-
### 文本翻译接口字段
|
|
63
|
-
|
|
64
|
-
开放平台接口为 `POST /v1/translate/text`。以下参数与返回字段依据[文本翻译文档](https://open.sinicloud.com/documents/webapi/translate-text)。
|
|
65
|
-
|
|
66
|
-
| 字段 | 类型与要求 | 含义 |
|
|
67
|
-
| --- | --- | --- |
|
|
68
|
-
| `text` | String,必填,最多 5000 字符 | 待翻译文本;语音翻译使用 ASR 完成后的最终文本。 |
|
|
69
|
-
| `from` | String,参数表标注可选,默认 `auto` | 源语言代码。鼠标已指定源语言,应显式传对应代码;中文简体使用 `zh`。 |
|
|
70
|
-
| `to` | String,必填 | 目标语言代码;不能与 `from` 相同。 |
|
|
71
|
-
| `code` | Integer,响应字段 | `0` 表示成功,其他值按该接口错误码处理。 |
|
|
72
|
-
| `msg` | String,响应字段 | 状态或错误说明。 |
|
|
73
|
-
| `data.resultText` | String,成功响应字段 | 翻译后的文本。 |
|
|
74
|
-
|
|
75
|
-
官方参数表允许省略 `from`,错误码表同时列有“源语言必填”;鼠标请求显式传入源代码,不依赖缺省行为。`auto` 是接口的自动检测值,当前设置不提供此选项。
|
|
76
|
-
|
|
77
|
-
[翻译适配器](../../src/devices/translate.mjs)已接入开放平台,使用来源设备 Token,按本节映射语言代码并读取 `data.resultText`;缓存和重试规则见[插件规格](smart-mouse-plugin.md#5-接口与鉴权)。
|
|
50
|
+
本节只定义设置值到接口参数的映射:识别三元组查找 `lanid`,翻译 `value` 映射为 `from/to`,不能互相代用。
|
|
78
51
|
|
|
79
52
|
### 项目内部语言字段
|
|
80
53
|
|
|
@@ -88,7 +61,7 @@
|
|
|
88
61
|
| `value` | 设置保存的翻译语言标识。 | 按翻译表映射为开放平台 `from/to`;中文 `cn → zh`,其余当前选项同值。 |
|
|
89
62
|
| `locale` | 翻译源关联的项目识别语言。 | 匹配 `language=locale, accent=mandarin, rlang=""`,再取得 `lanid`;不发送到翻译接口。 |
|
|
90
63
|
|
|
91
|
-
|
|
64
|
+
三元组完整保存,保留大小写、连字符、下划线及空字符串;不能直接拼成服务端参数。
|
|
92
65
|
|
|
93
66
|
### 语音打字选项
|
|
94
67
|
|
|
@@ -223,7 +196,7 @@
|
|
|
223
196
|
| bing | `https://www.bing.com/search?q=` |
|
|
224
197
|
| google | `https://www.google.com/search?q=` |
|
|
225
198
|
|
|
226
|
-
搜索地址为所选前缀加 `encodeURIComponent(最终识别文本.trim())
|
|
199
|
+
搜索地址为所选前缀加 `encodeURIComponent(最终识别文本.trim())`;触发与输出规则见[插件规格第 3.3 节](smart-mouse-plugin.md#33-m-键动作)。
|
|
227
200
|
|
|
228
201
|
### 一键链接
|
|
229
202
|
|
|
@@ -240,7 +213,7 @@ AI 键显示标题“AI 键”和说明“长按语音打字,松手自动将
|
|
|
240
213
|
|
|
241
214
|
“自动发送”对应 `aiAutoSend`,默认开启,按设备 SN 保存;旧配置缺少该字段时按开启读取,“恢复默认”也恢复为开启。开启时,语音识别结束并成功填充后自动发送;关闭时仅填充草稿,由用户手动发送。录音使用按下时的配置,开关修改影响后续会话;语音键与 M 键不受影响。
|
|
242
215
|
|
|
243
|
-
AI
|
|
216
|
+
AI 键的目标对话、填充、发送及失败处理统一见[插件规格第 3.4 节](smart-mouse-plugin.md#34-ai-键动作)。
|
|
244
217
|
|
|
245
218
|
## 保存与校验
|
|
246
219
|
|
|
@@ -252,4 +225,4 @@ AI 键仅作用于 DeepSeek Harness:不在前台时自动调至前台;已在
|
|
|
252
225
|
|
|
253
226
|
## 验证状态
|
|
254
227
|
|
|
255
|
-
|
|
228
|
+
历史验证与未验收范围统一见[开发说明](../contributing/development.md#已有验证记录)。
|