dsh-spec-collab 0.1.2 → 0.1.4
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 +4 -0
- package/lib/client.js +136 -97
- package/lib/types/client/SpecWorkbench.d.ts +2 -1
- package/lib/types/client/SpecWorkbench.d.ts.map +1 -1
- package/lib/types/client/api.d.ts.map +1 -1
- package/lib/types/client/browser-uuid.d.ts +7 -0
- package/lib/types/client/browser-uuid.d.ts.map +1 -0
- package/lib/types/client/mount.d.ts.map +1 -1
- package/lib/types/client/sidebar-anchor.d.ts +6 -0
- package/lib/types/client/sidebar-anchor.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/client/SpecWorkbench.tsx +4 -2
- package/src/client/api.ts +2 -1
- package/src/client/browser-uuid.ts +15 -0
- package/src/client/mount.tsx +9 -7
- package/src/client/sidebar-anchor.ts +16 -0
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@ DeepSeek Harness 的独立双面插件,用于把产品的原始需求澄清为
|
|
|
7
7
|
|
|
8
8
|
产品边界严格止于 Ready Spec,不包含代码实现、测试用例生成、worktree、MR、部署、发布或交付状态管理。
|
|
9
9
|
|
|
10
|
+
兼容 DeepSeek Harness `v0.1.1-rc.1`。插件可在局域网 HTTP 地址下运行,不依赖浏览器提供 `crypto.randomUUID`;DSH 精简侧栏仅显示“设置”时,也会正常挂载“需求讨论”入口。
|
|
11
|
+
|
|
10
12
|
## 一键安装
|
|
11
13
|
|
|
12
14
|
已有 Node.js 环境时,无需先全局安装 DSH CLI:
|
|
@@ -27,6 +29,8 @@ dsh plugin --profile web add dsh-spec-collab@latest
|
|
|
27
29
|
dsh plugin --profile web update dsh-spec-collab@latest
|
|
28
30
|
```
|
|
29
31
|
|
|
32
|
+
插件已经内置非安全 HTTP 环境所需的 UUID fallback,不需要通过代理向 HTML 注入 `crypto` polyfill。团队部署仍建议使用 HTTPS,并在 DSH 前配置认证。
|
|
33
|
+
|
|
30
34
|
## 核心流程
|
|
31
35
|
|
|
32
36
|
```text
|
package/lib/client.js
CHANGED
|
@@ -42,6 +42,18 @@ window.__ModuleLoader__.load({
|
|
|
42
42
|
//#region src/protocol.ts
|
|
43
43
|
const API_PREFIX = "/api/spec-collab";
|
|
44
44
|
//#endregion
|
|
45
|
+
//#region src/client/browser-uuid.ts
|
|
46
|
+
function browserUuid(source = globalThis.crypto) {
|
|
47
|
+
if (typeof source?.randomUUID === "function") return source.randomUUID();
|
|
48
|
+
const bytes = /* @__PURE__ */ new Uint8Array(16);
|
|
49
|
+
if (typeof source?.getRandomValues === "function") source.getRandomValues(bytes);
|
|
50
|
+
else for (let index = 0; index < bytes.length; index += 1) bytes[index] = Math.floor(Math.random() * 256);
|
|
51
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
52
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
53
|
+
const hex = [...bytes].map((value) => value.toString(16).padStart(2, "0"));
|
|
54
|
+
return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
45
57
|
//#region src/client/api.ts
|
|
46
58
|
var SpecApi = class {
|
|
47
59
|
async state() {
|
|
@@ -62,7 +74,7 @@ window.__ModuleLoader__.load({
|
|
|
62
74
|
}
|
|
63
75
|
async action(action) {
|
|
64
76
|
const envelope = {
|
|
65
|
-
requestId:
|
|
77
|
+
requestId: browserUuid(),
|
|
66
78
|
action
|
|
67
79
|
};
|
|
68
80
|
return (await fetch(`${API_PREFIX}/action`, {
|
|
@@ -39153,113 +39165,113 @@ window.__ModuleLoader__.load({
|
|
|
39153
39165
|
document.head.appendChild(tag);
|
|
39154
39166
|
}
|
|
39155
39167
|
var workbench_module_css_default = {
|
|
39156
|
-
"view": "-kTeaG_view",
|
|
39157
|
-
"chatError": "-kTeaG_chatError",
|
|
39158
|
-
"conflictDialog": "-kTeaG_conflictDialog",
|
|
39159
|
-
"conflictDiffs": "-kTeaG_conflictDiffs",
|
|
39160
|
-
"checkBlocked": "-kTeaG_checkBlocked",
|
|
39161
|
-
"summaryInput": "-kTeaG_summaryInput",
|
|
39162
|
-
"paneClosed": "-kTeaG_paneClosed",
|
|
39163
|
-
"decisionForm": "-kTeaG_decisionForm",
|
|
39164
|
-
"checklist": "-kTeaG_checklist",
|
|
39165
39168
|
"documentButton": "-kTeaG_documentButton",
|
|
39166
|
-
"
|
|
39167
|
-
"empty": "-kTeaG_empty",
|
|
39168
|
-
"notice": "-kTeaG_notice",
|
|
39169
|
-
"conflictActions": "-kTeaG_conflictActions",
|
|
39170
|
-
"pendingReview": "-kTeaG_pendingReview",
|
|
39171
|
-
"conflictColumns": "-kTeaG_conflictColumns",
|
|
39172
|
-
"markdownBody": "-kTeaG_markdownBody",
|
|
39173
|
-
"entry": "-kTeaG_entry",
|
|
39174
|
-
"mobileSpec": "-kTeaG_mobileSpec",
|
|
39169
|
+
"dangerText": "-kTeaG_dangerText",
|
|
39175
39170
|
"collapseChat": "-kTeaG_collapseChat",
|
|
39176
|
-
"
|
|
39171
|
+
"unsaved": "-kTeaG_unsaved",
|
|
39172
|
+
"conflictModal": "-kTeaG_conflictModal",
|
|
39173
|
+
"reply": "-kTeaG_reply",
|
|
39174
|
+
"aiConversation": "-kTeaG_aiConversation",
|
|
39175
|
+
"toolbar": "-kTeaG_toolbar",
|
|
39176
|
+
"modal": "-kTeaG_modal",
|
|
39177
39177
|
"mobileCollab": "-kTeaG_mobileCollab",
|
|
39178
|
-
"
|
|
39178
|
+
"legacyWarning": "-kTeaG_legacyWarning",
|
|
39179
|
+
"notice": "-kTeaG_notice",
|
|
39180
|
+
"commentAction": "-kTeaG_commentAction",
|
|
39181
|
+
"richEditor": "-kTeaG_richEditor",
|
|
39182
|
+
"responseForm": "-kTeaG_responseForm",
|
|
39183
|
+
"editorPane": "-kTeaG_editorPane",
|
|
39179
39184
|
"workbench": "-kTeaG_workbench",
|
|
39180
|
-
"patchAccept": "-kTeaG_patchAccept",
|
|
39181
|
-
"entryActive": "-kTeaG_entryActive",
|
|
39182
|
-
"reviewDetails": "-kTeaG_reviewDetails",
|
|
39183
|
-
"editorContext": "-kTeaG_editorContext",
|
|
39184
|
-
"reviewField": "-kTeaG_reviewField",
|
|
39185
|
-
"iconButton": "-kTeaG_iconButton",
|
|
39186
|
-
"newThread": "-kTeaG_newThread",
|
|
39187
|
-
"activeMode": "-kTeaG_activeMode",
|
|
39188
39185
|
"editorBody": "-kTeaG_editorBody",
|
|
39189
|
-
"
|
|
39186
|
+
"panelSummary": "-kTeaG_panelSummary",
|
|
39187
|
+
"conflictColumns": "-kTeaG_conflictColumns",
|
|
39188
|
+
"conflictDiffs": "-kTeaG_conflictDiffs",
|
|
39189
|
+
"versionCompare": "-kTeaG_versionCompare",
|
|
39190
|
+
"entry": "-kTeaG_entry",
|
|
39191
|
+
"execute": "-kTeaG_execute",
|
|
39192
|
+
"preview": "-kTeaG_preview",
|
|
39193
|
+
"endedReview": "-kTeaG_endedReview",
|
|
39190
39194
|
"paneActions": "-kTeaG_paneActions",
|
|
39191
|
-
"
|
|
39192
|
-
"
|
|
39193
|
-
"
|
|
39194
|
-
"
|
|
39195
|
+
"documents": "-kTeaG_documents",
|
|
39196
|
+
"checkIcon": "-kTeaG_checkIcon",
|
|
39197
|
+
"entryActive": "-kTeaG_entryActive",
|
|
39198
|
+
"newThread": "-kTeaG_newThread",
|
|
39199
|
+
"paneHead": "-kTeaG_paneHead",
|
|
39200
|
+
"downstreamReturn": "-kTeaG_downstreamReturn",
|
|
39201
|
+
"itemsPanel": "-kTeaG_itemsPanel",
|
|
39202
|
+
"badges": "-kTeaG_badges",
|
|
39195
39203
|
"selectionPrompt": "-kTeaG_selectionPrompt",
|
|
39196
|
-
"
|
|
39197
|
-
"
|
|
39198
|
-
"toolbar": "-kTeaG_toolbar",
|
|
39199
|
-
"patchDetails": "-kTeaG_patchDetails",
|
|
39200
|
-
"footer": "-kTeaG_footer",
|
|
39201
|
-
"editorPane": "-kTeaG_editorPane",
|
|
39202
|
-
"header": "-kTeaG_header",
|
|
39203
|
-
"tabbar": "-kTeaG_tabbar",
|
|
39204
|
-
"requirementMenu": "-kTeaG_requirementMenu",
|
|
39205
|
-
"collapseRight": "-kTeaG_collapseRight",
|
|
39206
|
-
"richEditor": "-kTeaG_richEditor",
|
|
39204
|
+
"panelAction": "-kTeaG_panelAction",
|
|
39205
|
+
"review": "-kTeaG_review",
|
|
39207
39206
|
"headerActions": "-kTeaG_headerActions",
|
|
39208
|
-
"
|
|
39209
|
-
"
|
|
39210
|
-
"selectedDoc": "-kTeaG_selectedDoc",
|
|
39207
|
+
"decisionForm": "-kTeaG_decisionForm",
|
|
39208
|
+
"chatComposer": "-kTeaG_chatComposer",
|
|
39211
39209
|
"reviewTitle": "-kTeaG_reviewTitle",
|
|
39212
|
-
"
|
|
39213
|
-
"
|
|
39214
|
-
"
|
|
39215
|
-
"
|
|
39216
|
-
"responseForm": "-kTeaG_responseForm",
|
|
39217
|
-
"checkPassed": "-kTeaG_checkPassed",
|
|
39218
|
-
"downstreamReturn": "-kTeaG_downstreamReturn",
|
|
39219
|
-
"endedReview": "-kTeaG_endedReview",
|
|
39220
|
-
"editorMeta": "-kTeaG_editorMeta",
|
|
39221
|
-
"dangerText": "-kTeaG_dangerText",
|
|
39210
|
+
"mobileSpec": "-kTeaG_mobileSpec",
|
|
39211
|
+
"cardActions": "-kTeaG_cardActions",
|
|
39212
|
+
"footer": "-kTeaG_footer",
|
|
39213
|
+
"selectedDoc": "-kTeaG_selectedDoc",
|
|
39222
39214
|
"run": "-kTeaG_run",
|
|
39215
|
+
"userMessage": "-kTeaG_userMessage",
|
|
39216
|
+
"identity": "-kTeaG_identity",
|
|
39217
|
+
"conflictDialog": "-kTeaG_conflictDialog",
|
|
39218
|
+
"compareHead": "-kTeaG_compareHead",
|
|
39219
|
+
"mobileViewSwitch": "-kTeaG_mobileViewSwitch",
|
|
39220
|
+
"requirementRow": "-kTeaG_requirementRow",
|
|
39223
39221
|
"reviewCardBody": "-kTeaG_reviewCardBody",
|
|
39224
|
-
"
|
|
39225
|
-
"
|
|
39226
|
-
"
|
|
39227
|
-
"
|
|
39228
|
-
"grid": "-kTeaG_grid",
|
|
39222
|
+
"questionField": "-kTeaG_questionField",
|
|
39223
|
+
"patchDetails": "-kTeaG_patchDetails",
|
|
39224
|
+
"paneClosed": "-kTeaG_paneClosed",
|
|
39225
|
+
"requirementMenu": "-kTeaG_requirementMenu",
|
|
39229
39226
|
"emptyMain": "-kTeaG_emptyMain",
|
|
39230
|
-
"conflictHeader": "-kTeaG_conflictHeader",
|
|
39231
|
-
"checkIcon": "-kTeaG_checkIcon",
|
|
39232
|
-
"versionRow": "-kTeaG_versionRow",
|
|
39233
|
-
"itemsPanel": "-kTeaG_itemsPanel",
|
|
39234
|
-
"execute": "-kTeaG_execute",
|
|
39235
|
-
"identity": "-kTeaG_identity",
|
|
39236
|
-
"noticeHidden": "-kTeaG_noticeHidden",
|
|
39237
|
-
"documents": "-kTeaG_documents",
|
|
39238
|
-
"resizer": "-kTeaG_resizer",
|
|
39239
|
-
"rowMenuButton": "-kTeaG_rowMenuButton",
|
|
39240
|
-
"panelSummary": "-kTeaG_panelSummary",
|
|
39241
|
-
"commentAction": "-kTeaG_commentAction",
|
|
39242
|
-
"legacyWarning": "-kTeaG_legacyWarning",
|
|
39243
39227
|
"reviewCard": "-kTeaG_reviewCard",
|
|
39244
|
-
"
|
|
39245
|
-
"
|
|
39246
|
-
"
|
|
39247
|
-
"
|
|
39248
|
-
"
|
|
39228
|
+
"header": "-kTeaG_header",
|
|
39229
|
+
"pendingReview": "-kTeaG_pendingReview",
|
|
39230
|
+
"rowMenuButton": "-kTeaG_rowMenuButton",
|
|
39231
|
+
"threadList": "-kTeaG_threadList",
|
|
39232
|
+
"editorMeta": "-kTeaG_editorMeta",
|
|
39233
|
+
"reviewDetails": "-kTeaG_reviewDetails",
|
|
39234
|
+
"noticeHidden": "-kTeaG_noticeHidden",
|
|
39235
|
+
"editorContext": "-kTeaG_editorContext",
|
|
39249
39236
|
"tabBadge": "-kTeaG_tabBadge",
|
|
39237
|
+
"runHistory": "-kTeaG_runHistory",
|
|
39238
|
+
"summaryInput": "-kTeaG_summaryInput",
|
|
39239
|
+
"dangerButton": "-kTeaG_dangerButton",
|
|
39240
|
+
"resizer": "-kTeaG_resizer",
|
|
39241
|
+
"quickOptions": "-kTeaG_quickOptions",
|
|
39242
|
+
"markdownBody": "-kTeaG_markdownBody",
|
|
39243
|
+
"saveButton": "-kTeaG_saveButton",
|
|
39244
|
+
"tabScroller": "-kTeaG_tabScroller",
|
|
39245
|
+
"collapseRight": "-kTeaG_collapseRight",
|
|
39246
|
+
"evidence": "-kTeaG_evidence",
|
|
39250
39247
|
"humanResponse": "-kTeaG_humanResponse",
|
|
39251
|
-
"mobileViewSwitch": "-kTeaG_mobileViewSwitch",
|
|
39252
|
-
"cardActions": "-kTeaG_cardActions",
|
|
39253
39248
|
"missingOptions": "-kTeaG_missingOptions",
|
|
39254
|
-
"
|
|
39255
|
-
"
|
|
39249
|
+
"patchPreview": "-kTeaG_patchPreview",
|
|
39250
|
+
"empty": "-kTeaG_empty",
|
|
39251
|
+
"reviewField": "-kTeaG_reviewField",
|
|
39252
|
+
"grid": "-kTeaG_grid",
|
|
39256
39253
|
"chatToggle": "-kTeaG_chatToggle",
|
|
39254
|
+
"chatMessages": "-kTeaG_chatMessages",
|
|
39255
|
+
"aiMessage": "-kTeaG_aiMessage",
|
|
39256
|
+
"readyHead": "-kTeaG_readyHead",
|
|
39257
|
+
"checkItem": "-kTeaG_checkItem",
|
|
39258
|
+
"checkBlocked": "-kTeaG_checkBlocked",
|
|
39259
|
+
"tabbar": "-kTeaG_tabbar",
|
|
39260
|
+
"patchAccept": "-kTeaG_patchAccept",
|
|
39261
|
+
"checklist": "-kTeaG_checklist",
|
|
39262
|
+
"view": "-kTeaG_view",
|
|
39263
|
+
"iconButton": "-kTeaG_iconButton",
|
|
39264
|
+
"resizerHidden": "-kTeaG_resizerHidden",
|
|
39257
39265
|
"itemRow": "-kTeaG_itemRow",
|
|
39258
|
-
"
|
|
39259
|
-
"
|
|
39260
|
-
"
|
|
39261
|
-
"
|
|
39262
|
-
"
|
|
39266
|
+
"editorTitle": "-kTeaG_editorTitle",
|
|
39267
|
+
"versionRow": "-kTeaG_versionRow",
|
|
39268
|
+
"compareColumns": "-kTeaG_compareColumns",
|
|
39269
|
+
"conflictHeader": "-kTeaG_conflictHeader",
|
|
39270
|
+
"checkPassed": "-kTeaG_checkPassed",
|
|
39271
|
+
"chatError": "-kTeaG_chatError",
|
|
39272
|
+
"titleBlock": "-kTeaG_titleBlock",
|
|
39273
|
+
"conflictActions": "-kTeaG_conflictActions",
|
|
39274
|
+
"activeMode": "-kTeaG_activeMode"
|
|
39263
39275
|
};
|
|
39264
39276
|
//#endregion
|
|
39265
39277
|
//#region src/client/SpecWorkbench.tsx
|
|
@@ -39282,7 +39294,7 @@ window.__ModuleLoader__.load({
|
|
|
39282
39294
|
] })] });
|
|
39283
39295
|
function newParticipant() {
|
|
39284
39296
|
return {
|
|
39285
|
-
participantId:
|
|
39297
|
+
participantId: browserUuid(),
|
|
39286
39298
|
nickname: "",
|
|
39287
39299
|
role: "product",
|
|
39288
39300
|
kind: "human"
|
|
@@ -39325,7 +39337,7 @@ window.__ModuleLoader__.load({
|
|
|
39325
39337
|
versions: "版本记录",
|
|
39326
39338
|
ready: "完成检查"
|
|
39327
39339
|
};
|
|
39328
|
-
function SpecWorkbench({ api }) {
|
|
39340
|
+
function SpecWorkbench({ api, onClose }) {
|
|
39329
39341
|
const [requirements, setRequirements] = (0, react.useState)([]);
|
|
39330
39342
|
const [reviewWorkspaces, setReviewWorkspaces] = (0, react.useState)([]);
|
|
39331
39343
|
const [participantBindings, setParticipantBindings] = (0, react.useState)([]);
|
|
@@ -39650,6 +39662,10 @@ window.__ModuleLoader__.load({
|
|
|
39650
39662
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
39651
39663
|
className: workbench_module_css_default.headerActions,
|
|
39652
39664
|
children: [
|
|
39665
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
39666
|
+
onClick: onClose,
|
|
39667
|
+
children: "返回聊天"
|
|
39668
|
+
}),
|
|
39653
39669
|
selected && !selected.workspaceId && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
39654
39670
|
onClick: () => {
|
|
39655
39671
|
setBindWorkspaceOpen(true);
|
|
@@ -41206,10 +41222,28 @@ window.__ModuleLoader__.load({
|
|
|
41206
41222
|
});
|
|
41207
41223
|
}
|
|
41208
41224
|
//#endregion
|
|
41225
|
+
//#region src/client/sidebar-anchor.ts
|
|
41226
|
+
function exactTextButton(document, text) {
|
|
41227
|
+
return [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === text);
|
|
41228
|
+
}
|
|
41229
|
+
function findSidebarAnchor(document) {
|
|
41230
|
+
const skillCenter = document.querySelector("button[aria-label=\"技能中心\"]") ?? exactTextButton(document, "技能中心");
|
|
41231
|
+
if (skillCenter !== void 0 && skillCenter !== null) return {
|
|
41232
|
+
element: skillCenter,
|
|
41233
|
+
placement: "after"
|
|
41234
|
+
};
|
|
41235
|
+
const settings = document.querySelector("button[aria-label=\"设置\"]") ?? exactTextButton(document, "设置");
|
|
41236
|
+
if (settings !== void 0 && settings !== null) return {
|
|
41237
|
+
element: settings,
|
|
41238
|
+
placement: "before"
|
|
41239
|
+
};
|
|
41240
|
+
}
|
|
41241
|
+
//#endregion
|
|
41209
41242
|
//#region src/client/mount.tsx
|
|
41210
41243
|
const ACTIVE = "data-dsh-spec-collab-active";
|
|
41211
41244
|
const VIEW = "[data-dsh-spec-collab-view]";
|
|
41212
41245
|
const ACTIVATE_EVENT = "dsh-panel-activate";
|
|
41246
|
+
const CLOSE_EVENT = "dsh-spec-collab-close";
|
|
41213
41247
|
function mountWorkbench(api) {
|
|
41214
41248
|
let root;
|
|
41215
41249
|
let container;
|
|
@@ -41224,7 +41258,10 @@ window.__ModuleLoader__.load({
|
|
|
41224
41258
|
container.className = workbench_module_css_default.view;
|
|
41225
41259
|
column.appendChild(container);
|
|
41226
41260
|
root = (0, react_dom_client.createRoot)(container);
|
|
41227
|
-
root.render(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpecWorkbench, {
|
|
41261
|
+
root.render(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpecWorkbench, {
|
|
41262
|
+
api,
|
|
41263
|
+
onClose: () => document.dispatchEvent(new CustomEvent(CLOSE_EVENT))
|
|
41264
|
+
}));
|
|
41228
41265
|
};
|
|
41229
41266
|
const observer = new MutationObserver(ensure);
|
|
41230
41267
|
observer.observe(document.body, {
|
|
@@ -41252,6 +41289,7 @@ window.__ModuleLoader__.load({
|
|
|
41252
41289
|
close();
|
|
41253
41290
|
};
|
|
41254
41291
|
document.addEventListener("click", closeOnExternalNavigation, true);
|
|
41292
|
+
document.addEventListener(CLOSE_EVENT, close);
|
|
41255
41293
|
const toggle = () => {
|
|
41256
41294
|
const opening = !document.documentElement.hasAttribute(ACTIVE);
|
|
41257
41295
|
for (const name of document.documentElement.getAttributeNames()) if (name.startsWith("data-dsh-") && name.endsWith("-active")) document.documentElement.removeAttribute(name);
|
|
@@ -41263,17 +41301,17 @@ window.__ModuleLoader__.load({
|
|
|
41263
41301
|
};
|
|
41264
41302
|
const ensure = () => {
|
|
41265
41303
|
if (row?.isConnected) return;
|
|
41266
|
-
const
|
|
41267
|
-
if (
|
|
41304
|
+
const anchor = findSidebarAnchor(document);
|
|
41305
|
+
if (anchor === void 0) return;
|
|
41268
41306
|
row = document.createElement("button");
|
|
41269
41307
|
row.type = "button";
|
|
41270
41308
|
row.dataset.dshSpecCollabEntry = "";
|
|
41271
|
-
row.className = `${
|
|
41309
|
+
row.className = `${anchor.element.className} ${workbench_module_css_default.entry}`;
|
|
41272
41310
|
row.title = "需求讨论";
|
|
41273
41311
|
row.setAttribute("aria-label", "需求讨论");
|
|
41274
41312
|
row.innerHTML = "<span aria-hidden=\"true\">▤</span><span>需求讨论</span>";
|
|
41275
41313
|
row.addEventListener("click", toggle);
|
|
41276
|
-
|
|
41314
|
+
anchor.element[anchor.placement](row);
|
|
41277
41315
|
};
|
|
41278
41316
|
const observer = new MutationObserver(ensure);
|
|
41279
41317
|
observer.observe(document.body, {
|
|
@@ -41284,6 +41322,7 @@ window.__ModuleLoader__.load({
|
|
|
41284
41322
|
return () => {
|
|
41285
41323
|
observer.disconnect();
|
|
41286
41324
|
document.removeEventListener("click", closeOnExternalNavigation, true);
|
|
41325
|
+
document.removeEventListener(CLOSE_EVENT, close);
|
|
41287
41326
|
close();
|
|
41288
41327
|
row?.remove();
|
|
41289
41328
|
document.querySelector(VIEW)?.remove();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@toast-ui/editor/dist/i18n/zh-cn';
|
|
2
2
|
import type { SpecApi } from './api.ts';
|
|
3
|
-
export declare function SpecWorkbench({ api }: {
|
|
3
|
+
export declare function SpecWorkbench({ api, onClose }: {
|
|
4
4
|
api: SpecApi;
|
|
5
|
+
onClose: () => void;
|
|
5
6
|
}): import("react").JSX.Element;
|
|
6
7
|
//# sourceMappingURL=SpecWorkbench.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpecWorkbench.d.ts","sourceRoot":"","sources":["../../../src/client/SpecWorkbench.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAA;AAGzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"SpecWorkbench.d.ts","sourceRoot":"","sources":["../../../src/client/SpecWorkbench.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAA;AAGzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAiCvC,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,+BA0IpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/client/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/client/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEtO,MAAM,WAAW,WAAW;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,mBAAmB,EAAE,CAAC;IAAC,YAAY,EAAE,eAAe,EAAE,CAAA;CAAE;AACvH,qBAAa,OAAO;IACZ,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAC7B,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACrD,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1D,OAAO,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAClE,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAC3E,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACrF,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;CACzC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface BrowserCrypto {
|
|
2
|
+
randomUUID?: () => string;
|
|
3
|
+
getRandomValues?: <T extends ArrayBufferView | null>(array: T) => T;
|
|
4
|
+
}
|
|
5
|
+
export declare function browserUuid(source?: BrowserCrypto | undefined): string;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=browser-uuid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-uuid.d.ts","sourceRoot":"","sources":["../../../src/client/browser-uuid.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,MAAM,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,CAAC,CAAC,SAAS,eAAe,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAA;CACpE;AAED,wBAAgB,WAAW,CAAC,MAAM,GAAE,aAAa,GAAG,SAA6B,GAAG,MAAM,CASzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/client/mount.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/client/mount.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAUvC,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,IAAI,CAoBvD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,IAAI,CAwC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-anchor.d.ts","sourceRoot":"","sources":["../../../src/client/sidebar-anchor.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,iBAAiB,CAAA;IAC1B,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC9B;AAMD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,CAM/E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-spec-collab",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "AI-assisted requirement clarification and Git-backed Spec co-creation for DeepSeek Harness, ending at a human-confirmed Ready Spec.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
70
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.
|
|
71
|
-
"@deepseek-ai/dsh-client-runtime": "^0.1.
|
|
72
|
-
"@deepseek-ai/dsh-host-apiproxy": "^0.1.
|
|
73
|
-
"@deepseek-ai/dsh-host-webserver": "^0.1.
|
|
74
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
75
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.
|
|
76
|
-
"@deepseek-ai/dsh-tools": "^0.1.
|
|
70
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.1-rc.1",
|
|
71
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.1",
|
|
72
|
+
"@deepseek-ai/dsh-host-apiproxy": "^0.1.1-rc.1",
|
|
73
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.1",
|
|
74
|
+
"@deepseek-ai/dsh-llm": "^0.1.1-rc.1",
|
|
75
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.1",
|
|
76
|
+
"@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
|
|
77
77
|
"@types/markdown-it": "^14.1.2",
|
|
78
78
|
"@types/node": "^22.20.0",
|
|
79
79
|
"@types/react": "~18.3.1",
|
|
@@ -5,6 +5,7 @@ import '@toast-ui/editor/dist/i18n/zh-cn'
|
|
|
5
5
|
import { InputRule, inputRules } from 'prosemirror-inputrules'
|
|
6
6
|
import type { CollaborationAction, CommentResolution, MyActionItem, ParticipantRole, ParticipantSnapshot, RequirementStage, RequirementVersion, RequirementView, ReviewKind, ReviewWorkspaceSummary, SaveConflict } from '../protocol.ts'
|
|
7
7
|
import type { SpecApi } from './api.ts'
|
|
8
|
+
import { browserUuid } from './browser-uuid.ts'
|
|
8
9
|
import css from './workbench.module.css'
|
|
9
10
|
|
|
10
11
|
const md = new MarkdownIt({ html: false, linkify: true })
|
|
@@ -21,7 +22,7 @@ const markdownShortcutsPlugin = () => ({ wysiwygPlugins: [() => inputRules({ rul
|
|
|
21
22
|
] })] })
|
|
22
23
|
type SideTab = 'review' | 'discussion' | 'patches' | 'decisions' | 'items' | 'versions' | 'ready'
|
|
23
24
|
type CommentAnchor = { quote: string; prefix: string; suffix: string; heading?: string }
|
|
24
|
-
function newParticipant(): ParticipantSnapshot { return { participantId:
|
|
25
|
+
function newParticipant(): ParticipantSnapshot { return { participantId: browserUuid(), nickname: '', role: 'product', kind: 'human' } }
|
|
25
26
|
function loadParticipant(): ParticipantSnapshot { try { const value = JSON.parse(localStorage.getItem('dsh-spec-collab.participant') ?? '') as ParticipantSnapshot; if (value.participantId) return { ...value, kind: 'human' } } catch {} return newParticipant() }
|
|
26
27
|
function stageLabel(stage: RequirementStage): string { return ({ 'product-review': '产品审核', 'product-confirmation': '产品确认', 'joint-review': '产研共审', ready: 'Ready' })[stage] }
|
|
27
28
|
function currentPendingActions(requirement: RequirementView): RequirementView['actionItems'] {
|
|
@@ -36,7 +37,7 @@ function currentPendingActions(requirement: RequirementView): RequirementView['a
|
|
|
36
37
|
}
|
|
37
38
|
const tabLabel: Record<SideTab, string> = { review: '审核问题', discussion: '协作讨论', patches: '修改建议', decisions: '确认决策', items: '我的事项', versions: '版本记录', ready: '完成检查' }
|
|
38
39
|
|
|
39
|
-
export function SpecWorkbench({ api }: { api: SpecApi }) {
|
|
40
|
+
export function SpecWorkbench({ api, onClose }: { api: SpecApi; onClose: () => void }) {
|
|
40
41
|
const [requirements, setRequirements] = useState<RequirementView[]>([])
|
|
41
42
|
const [reviewWorkspaces, setReviewWorkspaces] = useState<ReviewWorkspaceSummary[]>([])
|
|
42
43
|
const [participantBindings, setParticipantBindings] = useState<ParticipantSnapshot[]>([])
|
|
@@ -147,6 +148,7 @@ export function SpecWorkbench({ api }: { api: SpecApi }) {
|
|
|
147
148
|
<header className={css.header}>
|
|
148
149
|
<div className={css.titleBlock}><strong>{selected?.title ?? 'AI 需求澄清与 Spec 共创'}</strong>{selected && <span>{stageLabel(selected.stage)} · {selected.workspaceId ? reviewWorkspaces.find(workspace => workspace.workspaceId === selected.workspaceId)?.title ?? selected.workspaceId : '未绑定工作区'} · {selected.currentCommit.slice(0, 10)} · {selected.reviewItems.filter(item => item.commit === selected.currentCommit && item.severity === 'blocking' && !['resolved', 'non-blocking-verify', 'joint-review'].includes(item.status)).length} 阻塞</span>}</div>
|
|
149
150
|
<div className={css.headerActions}>
|
|
151
|
+
<button onClick={onClose}>返回聊天</button>
|
|
150
152
|
{selected && !selected.workspaceId && <button onClick={() => { setBindWorkspaceOpen(true); void api.reviewWorkspaces().then(setReviewWorkspaces, error => setNotice(error instanceof Error ? error.message : String(error))) }}>绑定工作区</button>}
|
|
151
153
|
{selected?.stage === 'product-review' && <><button disabled={productFirstRunning || !selected.workspaceId} title={!selected.workspaceId ? '请先绑定工作区' : productFirstRunning ? '初审进行中' : '启动智能初审'} onClick={() => void requestReview('product-first')}>智能初审</button><button disabled={!selected.workspaceId} onClick={() => void requestReview('product-second')}>智能复审</button><button className={css.execute} onClick={() => void advance()}>进入产品确认</button></>}
|
|
152
154
|
{selected?.stage === 'product-confirmation' && <><button onClick={() => void confirm('product')}>产品确认当前版本</button><button onClick={() => void advance()}>进入产研共审</button></>}
|
package/src/client/api.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { API_PREFIX, type ActionEnvelope, type ActionResult, type CollaborationAction, type MyActionItem, type ParticipantSnapshot, type RequirementVersion, type RequirementView, type ReviewWorkspaceSummary } from '../protocol.ts'
|
|
2
|
+
import { browserUuid } from './browser-uuid.ts'
|
|
2
3
|
export interface ClientState { revision: number; participants: ParticipantSnapshot[]; requirements: RequirementView[] }
|
|
3
4
|
export class SpecApi {
|
|
4
5
|
async state(): Promise<ClientState> { const response = await fetch(`${API_PREFIX}/state`, { headers: { accept: 'application/json' } }); if (!response.ok) throw new Error(`state request failed (${response.status})`); const state = await response.json() as Partial<ClientState>; return { revision: state.revision ?? 0, participants: state.participants ?? [], requirements: state.requirements ?? [] } }
|
|
5
6
|
async reviewWorkspaces(): Promise<ReviewWorkspaceSummary[]> { const response = await fetch(`${API_PREFIX}/review-workspaces`, { headers: { accept: 'application/json' } }); const result = await response.json() as { ok: boolean; workspaces?: ReviewWorkspaceSummary[]; error?: string }; if (!response.ok || !result.ok) throw new Error(result.error ?? '加载需求工作区失败'); return result.workspaces ?? [] }
|
|
6
|
-
async action(action: CollaborationAction): Promise<ActionResult> { const envelope: ActionEnvelope = { requestId:
|
|
7
|
+
async action(action: CollaborationAction): Promise<ActionResult> { const envelope: ActionEnvelope = { requestId: browserUuid(), action }; const response = await fetch(`${API_PREFIX}/action`, { method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json' }, body: JSON.stringify(envelope) }); return response.json() as Promise<ActionResult> }
|
|
7
8
|
async myItems(participant: ParticipantSnapshot): Promise<MyActionItem[]> { const query = new URLSearchParams({ participantId: participant.participantId, role: participant.role }); const response = await fetch(`${API_PREFIX}/my-items?${query}`, { headers: { accept: 'application/json' } }); const result = await response.json() as { ok: boolean; items?: MyActionItem[]; error?: string }; if (!response.ok || !result.ok) throw new Error(result.error ?? '加载我的事项失败'); return result.items ?? [] }
|
|
8
9
|
async version(requirementId: string, commit: string): Promise<RequirementVersion> { const query = new URLSearchParams({ requirementId, commit }); const response = await fetch(`${API_PREFIX}/version?${query}`, { headers: { accept: 'application/json' } }); const result = await response.json() as { ok: boolean; version?: RequirementVersion; error?: string }; if (!response.ok || !result.ok || !result.version) throw new Error(result.error ?? '加载历史版本失败'); return result.version }
|
|
9
10
|
async conversation(requirementId: string, sessionId: string): Promise<Array<{ role: 'user' | 'assistant'; text: string }>> { const query = new URLSearchParams({ requirementId, sessionId }); const response = await fetch(`${API_PREFIX}/ai-conversation?${query}`, { headers: { accept: 'application/json' } }); const result = await response.json() as { ok: boolean; messages?: Array<{ role: 'user' | 'assistant'; text: string }>; error?: string }; if (!response.ok || !result.ok) throw new Error(result.error ?? '加载 AI 对话失败'); return result.messages ?? [] }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface BrowserCrypto {
|
|
2
|
+
randomUUID?: () => string
|
|
3
|
+
getRandomValues?: <T extends ArrayBufferView | null>(array: T) => T
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function browserUuid(source: BrowserCrypto | undefined = globalThis.crypto): string {
|
|
7
|
+
if (typeof source?.randomUUID === 'function') return source.randomUUID()
|
|
8
|
+
const bytes = new Uint8Array(16)
|
|
9
|
+
if (typeof source?.getRandomValues === 'function') source.getRandomValues(bytes)
|
|
10
|
+
else for (let index = 0; index < bytes.length; index += 1) bytes[index] = Math.floor(Math.random() * 256)
|
|
11
|
+
bytes[6] = (bytes[6]! & 0x0f) | 0x40
|
|
12
|
+
bytes[8] = (bytes[8]! & 0x3f) | 0x80
|
|
13
|
+
const hex = [...bytes].map(value => value.toString(16).padStart(2, '0'))
|
|
14
|
+
return `${hex.slice(0, 4).join('')}-${hex.slice(4, 6).join('')}-${hex.slice(6, 8).join('')}-${hex.slice(8, 10).join('')}-${hex.slice(10).join('')}`
|
|
15
|
+
}
|
package/src/client/mount.tsx
CHANGED
|
@@ -3,10 +3,12 @@ import { createRoot } from 'react-dom/client'
|
|
|
3
3
|
import type { SpecApi } from './api.ts'
|
|
4
4
|
import { SpecWorkbench } from './SpecWorkbench.tsx'
|
|
5
5
|
import css from './workbench.module.css'
|
|
6
|
+
import { findSidebarAnchor } from './sidebar-anchor.ts'
|
|
6
7
|
|
|
7
8
|
const ACTIVE = 'data-dsh-spec-collab-active'
|
|
8
9
|
const VIEW = '[data-dsh-spec-collab-view]'
|
|
9
10
|
const ACTIVATE_EVENT = 'dsh-panel-activate'
|
|
11
|
+
const CLOSE_EVENT = 'dsh-spec-collab-close'
|
|
10
12
|
|
|
11
13
|
export function mountWorkbench(api: SpecApi): () => void {
|
|
12
14
|
let root: Root | undefined
|
|
@@ -22,7 +24,7 @@ export function mountWorkbench(api: SpecApi): () => void {
|
|
|
22
24
|
container.className = css.view!
|
|
23
25
|
column.appendChild(container)
|
|
24
26
|
root = createRoot(container)
|
|
25
|
-
root.render(<SpecWorkbench api={api} />)
|
|
27
|
+
root.render(<SpecWorkbench api={api} onClose={() => document.dispatchEvent(new CustomEvent(CLOSE_EVENT))} />)
|
|
26
28
|
}
|
|
27
29
|
const observer = new MutationObserver(ensure)
|
|
28
30
|
observer.observe(document.body, { childList: true, subtree: true })
|
|
@@ -40,6 +42,7 @@ export function mountSidebarEntry(): () => void {
|
|
|
40
42
|
close()
|
|
41
43
|
}
|
|
42
44
|
document.addEventListener('click', closeOnExternalNavigation, true)
|
|
45
|
+
document.addEventListener(CLOSE_EVENT, close)
|
|
43
46
|
const toggle = (): void => {
|
|
44
47
|
const opening = !document.documentElement.hasAttribute(ACTIVE)
|
|
45
48
|
for (const name of document.documentElement.getAttributeNames()) {
|
|
@@ -53,21 +56,20 @@ export function mountSidebarEntry(): () => void {
|
|
|
53
56
|
}
|
|
54
57
|
const ensure = (): void => {
|
|
55
58
|
if (row?.isConnected) return
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
if (skillCenter === undefined || skillCenter === null) return
|
|
59
|
+
const anchor = findSidebarAnchor(document)
|
|
60
|
+
if (anchor === undefined) return
|
|
59
61
|
row = document.createElement('button')
|
|
60
62
|
row.type = 'button'
|
|
61
63
|
row.dataset.dshSpecCollabEntry = ''
|
|
62
|
-
row.className = `${
|
|
64
|
+
row.className = `${anchor.element.className} ${css.entry!}`
|
|
63
65
|
row.title = '需求讨论'
|
|
64
66
|
row.setAttribute('aria-label', '需求讨论')
|
|
65
67
|
row.innerHTML = '<span aria-hidden="true">▤</span><span>需求讨论</span>'
|
|
66
68
|
row.addEventListener('click', toggle)
|
|
67
|
-
|
|
69
|
+
anchor.element[anchor.placement](row)
|
|
68
70
|
}
|
|
69
71
|
const observer = new MutationObserver(ensure)
|
|
70
72
|
observer.observe(document.body, { childList: true, subtree: true })
|
|
71
73
|
ensure()
|
|
72
|
-
return () => { observer.disconnect(); document.removeEventListener('click', closeOnExternalNavigation, true); close(); row?.remove(); document.querySelector(VIEW)?.remove() }
|
|
74
|
+
return () => { observer.disconnect(); document.removeEventListener('click', closeOnExternalNavigation, true); document.removeEventListener(CLOSE_EVENT, close); close(); row?.remove(); document.querySelector(VIEW)?.remove() }
|
|
73
75
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SidebarAnchor {
|
|
2
|
+
element: HTMLButtonElement
|
|
3
|
+
placement: 'before' | 'after'
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function exactTextButton(document: Document, text: string): HTMLButtonElement | undefined {
|
|
7
|
+
return [...document.querySelectorAll<HTMLButtonElement>('button')].find(button => button.textContent?.trim() === text)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function findSidebarAnchor(document: Document): SidebarAnchor | undefined {
|
|
11
|
+
const skillCenter = document.querySelector<HTMLButtonElement>('button[aria-label="技能中心"]') ?? exactTextButton(document, '技能中心')
|
|
12
|
+
if (skillCenter !== undefined && skillCenter !== null) return { element: skillCenter, placement: 'after' }
|
|
13
|
+
const settings = document.querySelector<HTMLButtonElement>('button[aria-label="设置"]') ?? exactTextButton(document, '设置')
|
|
14
|
+
if (settings !== undefined && settings !== null) return { element: settings, placement: 'before' }
|
|
15
|
+
return undefined
|
|
16
|
+
}
|