dsh-spec-collab 0.1.3 → 0.1.5
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/lib/client.js +101 -91
- package/lib/index.js +1 -1
- package/lib/types/client/SpecWorkbench.d.ts +2 -1
- package/lib/types/client/SpecWorkbench.d.ts.map +1 -1
- package/lib/types/client/mount.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/SpecWorkbench.tsx +2 -1
- package/src/client/mount.tsx +4 -2
- package/src/routes.ts +1 -1
package/lib/client.js
CHANGED
|
@@ -39165,113 +39165,113 @@ window.__ModuleLoader__.load({
|
|
|
39165
39165
|
document.head.appendChild(tag);
|
|
39166
39166
|
}
|
|
39167
39167
|
var workbench_module_css_default = {
|
|
39168
|
-
"
|
|
39169
|
-
"
|
|
39170
|
-
"
|
|
39171
|
-
"richEditor": "-kTeaG_richEditor",
|
|
39172
|
-
"markdownBody": "-kTeaG_markdownBody",
|
|
39173
|
-
"notice": "-kTeaG_notice",
|
|
39174
|
-
"editorBody": "-kTeaG_editorBody",
|
|
39175
|
-
"collapseChat": "-kTeaG_collapseChat",
|
|
39176
|
-
"view": "-kTeaG_view",
|
|
39177
|
-
"checklist": "-kTeaG_checklist",
|
|
39178
|
-
"chatMessages": "-kTeaG_chatMessages",
|
|
39179
|
-
"mobileSpec": "-kTeaG_mobileSpec",
|
|
39180
|
-
"identity": "-kTeaG_identity",
|
|
39181
|
-
"resizerHidden": "-kTeaG_resizerHidden",
|
|
39182
|
-
"summaryInput": "-kTeaG_summaryInput",
|
|
39183
|
-
"requirementMenu": "-kTeaG_requirementMenu",
|
|
39184
|
-
"run": "-kTeaG_run",
|
|
39185
|
-
"aiConversation": "-kTeaG_aiConversation",
|
|
39186
|
-
"emptyMain": "-kTeaG_emptyMain",
|
|
39187
|
-
"runHistory": "-kTeaG_runHistory",
|
|
39188
|
-
"titleBlock": "-kTeaG_titleBlock",
|
|
39189
|
-
"grid": "-kTeaG_grid",
|
|
39168
|
+
"entryActive": "-kTeaG_entryActive",
|
|
39169
|
+
"execute": "-kTeaG_execute",
|
|
39170
|
+
"tabbar": "-kTeaG_tabbar",
|
|
39190
39171
|
"quickOptions": "-kTeaG_quickOptions",
|
|
39191
|
-
"
|
|
39192
|
-
"
|
|
39193
|
-
"
|
|
39194
|
-
"
|
|
39195
|
-
"
|
|
39196
|
-
"
|
|
39197
|
-
"
|
|
39198
|
-
"patchDetails": "-kTeaG_patchDetails",
|
|
39172
|
+
"selectionPrompt": "-kTeaG_selectionPrompt",
|
|
39173
|
+
"selectedDoc": "-kTeaG_selectedDoc",
|
|
39174
|
+
"collapseChat": "-kTeaG_collapseChat",
|
|
39175
|
+
"noticeHidden": "-kTeaG_noticeHidden",
|
|
39176
|
+
"footer": "-kTeaG_footer",
|
|
39177
|
+
"reply": "-kTeaG_reply",
|
|
39178
|
+
"saveButton": "-kTeaG_saveButton",
|
|
39199
39179
|
"chatError": "-kTeaG_chatError",
|
|
39200
|
-
"humanResponse": "-kTeaG_humanResponse",
|
|
39201
|
-
"responseForm": "-kTeaG_responseForm",
|
|
39202
|
-
"checkItem": "-kTeaG_checkItem",
|
|
39203
|
-
"itemsPanel": "-kTeaG_itemsPanel",
|
|
39204
|
-
"paneHead": "-kTeaG_paneHead",
|
|
39205
39180
|
"versionCompare": "-kTeaG_versionCompare",
|
|
39206
|
-
"
|
|
39181
|
+
"conflictModal": "-kTeaG_conflictModal",
|
|
39182
|
+
"paneHead": "-kTeaG_paneHead",
|
|
39183
|
+
"rowMenuButton": "-kTeaG_rowMenuButton",
|
|
39207
39184
|
"conflictActions": "-kTeaG_conflictActions",
|
|
39208
|
-
"
|
|
39185
|
+
"mobileSpec": "-kTeaG_mobileSpec",
|
|
39186
|
+
"tabBadge": "-kTeaG_tabBadge",
|
|
39187
|
+
"toolbar": "-kTeaG_toolbar",
|
|
39188
|
+
"mobileViewSwitch": "-kTeaG_mobileViewSwitch",
|
|
39189
|
+
"markdownBody": "-kTeaG_markdownBody",
|
|
39190
|
+
"dangerText": "-kTeaG_dangerText",
|
|
39191
|
+
"documentButton": "-kTeaG_documentButton",
|
|
39192
|
+
"entry": "-kTeaG_entry",
|
|
39193
|
+
"paneClosed": "-kTeaG_paneClosed",
|
|
39194
|
+
"review": "-kTeaG_review",
|
|
39195
|
+
"reviewTitle": "-kTeaG_reviewTitle",
|
|
39196
|
+
"patchPreview": "-kTeaG_patchPreview",
|
|
39197
|
+
"titleBlock": "-kTeaG_titleBlock",
|
|
39198
|
+
"pendingReview": "-kTeaG_pendingReview",
|
|
39199
|
+
"conflictHeader": "-kTeaG_conflictHeader",
|
|
39200
|
+
"newThread": "-kTeaG_newThread",
|
|
39201
|
+
"modal": "-kTeaG_modal",
|
|
39202
|
+
"evidence": "-kTeaG_evidence",
|
|
39203
|
+
"richEditor": "-kTeaG_richEditor",
|
|
39204
|
+
"aiMessage": "-kTeaG_aiMessage",
|
|
39205
|
+
"iconButton": "-kTeaG_iconButton",
|
|
39206
|
+
"checkBlocked": "-kTeaG_checkBlocked",
|
|
39207
|
+
"itemsPanel": "-kTeaG_itemsPanel",
|
|
39208
|
+
"aiConversation": "-kTeaG_aiConversation",
|
|
39209
|
+
"emptyMain": "-kTeaG_emptyMain",
|
|
39210
|
+
"empty": "-kTeaG_empty",
|
|
39211
|
+
"reviewCard": "-kTeaG_reviewCard",
|
|
39212
|
+
"editorTitle": "-kTeaG_editorTitle",
|
|
39209
39213
|
"editorPane": "-kTeaG_editorPane",
|
|
39210
|
-
"
|
|
39214
|
+
"headerActions": "-kTeaG_headerActions",
|
|
39215
|
+
"reviewField": "-kTeaG_reviewField",
|
|
39216
|
+
"summaryInput": "-kTeaG_summaryInput",
|
|
39217
|
+
"chatMessages": "-kTeaG_chatMessages",
|
|
39218
|
+
"grid": "-kTeaG_grid",
|
|
39219
|
+
"mobileCollab": "-kTeaG_mobileCollab",
|
|
39220
|
+
"unsaved": "-kTeaG_unsaved",
|
|
39221
|
+
"conflictDialog": "-kTeaG_conflictDialog",
|
|
39222
|
+
"badges": "-kTeaG_badges",
|
|
39223
|
+
"questionField": "-kTeaG_questionField",
|
|
39211
39224
|
"chatToggle": "-kTeaG_chatToggle",
|
|
39212
|
-
"commentAction": "-kTeaG_commentAction",
|
|
39213
39225
|
"conflictColumns": "-kTeaG_conflictColumns",
|
|
39226
|
+
"identity": "-kTeaG_identity",
|
|
39214
39227
|
"requirementRow": "-kTeaG_requirementRow",
|
|
39215
|
-
"entryActive": "-kTeaG_entryActive",
|
|
39216
|
-
"mobileCollab": "-kTeaG_mobileCollab",
|
|
39217
|
-
"decisionForm": "-kTeaG_decisionForm",
|
|
39218
|
-
"tabScroller": "-kTeaG_tabScroller",
|
|
39219
|
-
"iconButton": "-kTeaG_iconButton",
|
|
39220
|
-
"checkBlocked": "-kTeaG_checkBlocked",
|
|
39221
|
-
"tabbar": "-kTeaG_tabbar",
|
|
39222
|
-
"conflictDialog": "-kTeaG_conflictDialog",
|
|
39223
|
-
"conflictModal": "-kTeaG_conflictModal",
|
|
39224
|
-
"modal": "-kTeaG_modal",
|
|
39225
39228
|
"header": "-kTeaG_header",
|
|
39226
|
-
"
|
|
39227
|
-
"
|
|
39228
|
-
"
|
|
39229
|
+
"resizer": "-kTeaG_resizer",
|
|
39230
|
+
"documents": "-kTeaG_documents",
|
|
39231
|
+
"checklist": "-kTeaG_checklist",
|
|
39232
|
+
"conflictDiffs": "-kTeaG_conflictDiffs",
|
|
39233
|
+
"notice": "-kTeaG_notice",
|
|
39229
39234
|
"paneActions": "-kTeaG_paneActions",
|
|
39230
|
-
"
|
|
39231
|
-
"
|
|
39232
|
-
"execute": "-kTeaG_execute",
|
|
39235
|
+
"patchDetails": "-kTeaG_patchDetails",
|
|
39236
|
+
"panelAction": "-kTeaG_panelAction",
|
|
39233
39237
|
"compareHead": "-kTeaG_compareHead",
|
|
39234
|
-
"
|
|
39235
|
-
"
|
|
39236
|
-
"
|
|
39237
|
-
"
|
|
39238
|
-
"
|
|
39239
|
-
"endedReview": "-kTeaG_endedReview",
|
|
39238
|
+
"chatComposer": "-kTeaG_chatComposer",
|
|
39239
|
+
"commentAction": "-kTeaG_commentAction",
|
|
39240
|
+
"checkIcon": "-kTeaG_checkIcon",
|
|
39241
|
+
"humanResponse": "-kTeaG_humanResponse",
|
|
39242
|
+
"collapseRight": "-kTeaG_collapseRight",
|
|
39240
39243
|
"preview": "-kTeaG_preview",
|
|
39241
|
-
"
|
|
39242
|
-
"
|
|
39243
|
-
"
|
|
39244
|
+
"workbench": "-kTeaG_workbench",
|
|
39245
|
+
"patchAccept": "-kTeaG_patchAccept",
|
|
39246
|
+
"dangerButton": "-kTeaG_dangerButton",
|
|
39247
|
+
"panelSummary": "-kTeaG_panelSummary",
|
|
39248
|
+
"missingOptions": "-kTeaG_missingOptions",
|
|
39249
|
+
"editorContext": "-kTeaG_editorContext",
|
|
39250
|
+
"userMessage": "-kTeaG_userMessage",
|
|
39251
|
+
"legacyWarning": "-kTeaG_legacyWarning",
|
|
39252
|
+
"decisionForm": "-kTeaG_decisionForm",
|
|
39253
|
+
"checkItem": "-kTeaG_checkItem",
|
|
39244
39254
|
"checkPassed": "-kTeaG_checkPassed",
|
|
39245
|
-
"
|
|
39246
|
-
"
|
|
39255
|
+
"reviewCardBody": "-kTeaG_reviewCardBody",
|
|
39256
|
+
"run": "-kTeaG_run",
|
|
39257
|
+
"endedReview": "-kTeaG_endedReview",
|
|
39258
|
+
"downstreamReturn": "-kTeaG_downstreamReturn",
|
|
39259
|
+
"requirementMenu": "-kTeaG_requirementMenu",
|
|
39247
39260
|
"threadList": "-kTeaG_threadList",
|
|
39261
|
+
"view": "-kTeaG_view",
|
|
39248
39262
|
"editorMeta": "-kTeaG_editorMeta",
|
|
39249
|
-
"unsaved": "-kTeaG_unsaved",
|
|
39250
|
-
"pendingReview": "-kTeaG_pendingReview",
|
|
39251
|
-
"toolbar": "-kTeaG_toolbar",
|
|
39252
|
-
"resizer": "-kTeaG_resizer",
|
|
39253
|
-
"dangerButton": "-kTeaG_dangerButton",
|
|
39254
|
-
"empty": "-kTeaG_empty",
|
|
39255
|
-
"collapseRight": "-kTeaG_collapseRight",
|
|
39256
|
-
"reviewCard": "-kTeaG_reviewCard",
|
|
39257
|
-
"reviewField": "-kTeaG_reviewField",
|
|
39258
|
-
"questionField": "-kTeaG_questionField",
|
|
39259
|
-
"patchPreview": "-kTeaG_patchPreview",
|
|
39260
|
-
"downstreamReturn": "-kTeaG_downstreamReturn",
|
|
39261
39263
|
"itemRow": "-kTeaG_itemRow",
|
|
39262
|
-
"missingOptions": "-kTeaG_missingOptions",
|
|
39263
39264
|
"reviewDetails": "-kTeaG_reviewDetails",
|
|
39264
|
-
"
|
|
39265
|
+
"cardActions": "-kTeaG_cardActions",
|
|
39266
|
+
"runHistory": "-kTeaG_runHistory",
|
|
39267
|
+
"resizerHidden": "-kTeaG_resizerHidden",
|
|
39268
|
+
"activeMode": "-kTeaG_activeMode",
|
|
39269
|
+
"editorBody": "-kTeaG_editorBody",
|
|
39270
|
+
"responseForm": "-kTeaG_responseForm",
|
|
39271
|
+
"readyHead": "-kTeaG_readyHead",
|
|
39265
39272
|
"versionRow": "-kTeaG_versionRow",
|
|
39266
|
-
"
|
|
39267
|
-
"
|
|
39268
|
-
"userMessage": "-kTeaG_userMessage",
|
|
39269
|
-
"conflictDiffs": "-kTeaG_conflictDiffs",
|
|
39270
|
-
"chatComposer": "-kTeaG_chatComposer",
|
|
39271
|
-
"rowMenuButton": "-kTeaG_rowMenuButton",
|
|
39272
|
-
"newThread": "-kTeaG_newThread",
|
|
39273
|
-
"reviewCardBody": "-kTeaG_reviewCardBody",
|
|
39274
|
-
"evidence": "-kTeaG_evidence"
|
|
39273
|
+
"tabScroller": "-kTeaG_tabScroller",
|
|
39274
|
+
"compareColumns": "-kTeaG_compareColumns"
|
|
39275
39275
|
};
|
|
39276
39276
|
//#endregion
|
|
39277
39277
|
//#region src/client/SpecWorkbench.tsx
|
|
@@ -39337,7 +39337,7 @@ window.__ModuleLoader__.load({
|
|
|
39337
39337
|
versions: "版本记录",
|
|
39338
39338
|
ready: "完成检查"
|
|
39339
39339
|
};
|
|
39340
|
-
function SpecWorkbench({ api }) {
|
|
39340
|
+
function SpecWorkbench({ api, onClose }) {
|
|
39341
39341
|
const [requirements, setRequirements] = (0, react.useState)([]);
|
|
39342
39342
|
const [reviewWorkspaces, setReviewWorkspaces] = (0, react.useState)([]);
|
|
39343
39343
|
const [participantBindings, setParticipantBindings] = (0, react.useState)([]);
|
|
@@ -39662,6 +39662,10 @@ window.__ModuleLoader__.load({
|
|
|
39662
39662
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
39663
39663
|
className: workbench_module_css_default.headerActions,
|
|
39664
39664
|
children: [
|
|
39665
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
39666
|
+
onClick: onClose,
|
|
39667
|
+
children: "返回聊天"
|
|
39668
|
+
}),
|
|
39665
39669
|
selected && !selected.workspaceId && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
39666
39670
|
onClick: () => {
|
|
39667
39671
|
setBindWorkspaceOpen(true);
|
|
@@ -41239,6 +41243,7 @@ window.__ModuleLoader__.load({
|
|
|
41239
41243
|
const ACTIVE = "data-dsh-spec-collab-active";
|
|
41240
41244
|
const VIEW = "[data-dsh-spec-collab-view]";
|
|
41241
41245
|
const ACTIVATE_EVENT = "dsh-panel-activate";
|
|
41246
|
+
const CLOSE_EVENT = "dsh-spec-collab-close";
|
|
41242
41247
|
function mountWorkbench(api) {
|
|
41243
41248
|
let root;
|
|
41244
41249
|
let container;
|
|
@@ -41253,7 +41258,10 @@ window.__ModuleLoader__.load({
|
|
|
41253
41258
|
container.className = workbench_module_css_default.view;
|
|
41254
41259
|
column.appendChild(container);
|
|
41255
41260
|
root = (0, react_dom_client.createRoot)(container);
|
|
41256
|
-
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
|
+
}));
|
|
41257
41265
|
};
|
|
41258
41266
|
const observer = new MutationObserver(ensure);
|
|
41259
41267
|
observer.observe(document.body, {
|
|
@@ -41281,6 +41289,7 @@ window.__ModuleLoader__.load({
|
|
|
41281
41289
|
close();
|
|
41282
41290
|
};
|
|
41283
41291
|
document.addEventListener("click", closeOnExternalNavigation, true);
|
|
41292
|
+
document.addEventListener(CLOSE_EVENT, close);
|
|
41284
41293
|
const toggle = () => {
|
|
41285
41294
|
const opening = !document.documentElement.hasAttribute(ACTIVE);
|
|
41286
41295
|
for (const name of document.documentElement.getAttributeNames()) if (name.startsWith("data-dsh-") && name.endsWith("-active")) document.documentElement.removeAttribute(name);
|
|
@@ -41313,6 +41322,7 @@ window.__ModuleLoader__.load({
|
|
|
41313
41322
|
return () => {
|
|
41314
41323
|
observer.disconnect();
|
|
41315
41324
|
document.removeEventListener("click", closeOnExternalNavigation, true);
|
|
41325
|
+
document.removeEventListener(CLOSE_EVENT, close);
|
|
41316
41326
|
close();
|
|
41317
41327
|
row?.remove();
|
|
41318
41328
|
document.querySelector(VIEW)?.remove();
|
package/lib/index.js
CHANGED
|
@@ -1291,7 +1291,7 @@ function trusted(req) {
|
|
|
1291
1291
|
if (!(remote === "127.0.0.1" || remote === "::1" || remote === "::ffff:127.0.0.1")) return false;
|
|
1292
1292
|
if (req.headers["sec-fetch-site"] === "cross-site") return false;
|
|
1293
1293
|
const origin = req.headers.origin;
|
|
1294
|
-
if (origin === void 0) return
|
|
1294
|
+
if (origin === void 0) return true;
|
|
1295
1295
|
try {
|
|
1296
1296
|
return new URL(origin).host === req.headers.host;
|
|
1297
1297
|
} catch {
|
|
@@ -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;AAiCvC,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,+
|
|
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":"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"}
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@ function currentPendingActions(requirement: RequirementView): RequirementView['a
|
|
|
37
37
|
}
|
|
38
38
|
const tabLabel: Record<SideTab, string> = { review: '审核问题', discussion: '协作讨论', patches: '修改建议', decisions: '确认决策', items: '我的事项', versions: '版本记录', ready: '完成检查' }
|
|
39
39
|
|
|
40
|
-
export function SpecWorkbench({ api }: { api: SpecApi }) {
|
|
40
|
+
export function SpecWorkbench({ api, onClose }: { api: SpecApi; onClose: () => void }) {
|
|
41
41
|
const [requirements, setRequirements] = useState<RequirementView[]>([])
|
|
42
42
|
const [reviewWorkspaces, setReviewWorkspaces] = useState<ReviewWorkspaceSummary[]>([])
|
|
43
43
|
const [participantBindings, setParticipantBindings] = useState<ParticipantSnapshot[]>([])
|
|
@@ -148,6 +148,7 @@ export function SpecWorkbench({ api }: { api: SpecApi }) {
|
|
|
148
148
|
<header className={css.header}>
|
|
149
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>
|
|
150
150
|
<div className={css.headerActions}>
|
|
151
|
+
<button onClick={onClose}>返回聊天</button>
|
|
151
152
|
{selected && !selected.workspaceId && <button onClick={() => { setBindWorkspaceOpen(true); void api.reviewWorkspaces().then(setReviewWorkspaces, error => setNotice(error instanceof Error ? error.message : String(error))) }}>绑定工作区</button>}
|
|
152
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></>}
|
|
153
154
|
{selected?.stage === 'product-confirmation' && <><button onClick={() => void confirm('product')}>产品确认当前版本</button><button onClick={() => void advance()}>进入产研共审</button></>}
|
package/src/client/mount.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { findSidebarAnchor } from './sidebar-anchor.ts'
|
|
|
8
8
|
const ACTIVE = 'data-dsh-spec-collab-active'
|
|
9
9
|
const VIEW = '[data-dsh-spec-collab-view]'
|
|
10
10
|
const ACTIVATE_EVENT = 'dsh-panel-activate'
|
|
11
|
+
const CLOSE_EVENT = 'dsh-spec-collab-close'
|
|
11
12
|
|
|
12
13
|
export function mountWorkbench(api: SpecApi): () => void {
|
|
13
14
|
let root: Root | undefined
|
|
@@ -23,7 +24,7 @@ export function mountWorkbench(api: SpecApi): () => void {
|
|
|
23
24
|
container.className = css.view!
|
|
24
25
|
column.appendChild(container)
|
|
25
26
|
root = createRoot(container)
|
|
26
|
-
root.render(<SpecWorkbench api={api} />)
|
|
27
|
+
root.render(<SpecWorkbench api={api} onClose={() => document.dispatchEvent(new CustomEvent(CLOSE_EVENT))} />)
|
|
27
28
|
}
|
|
28
29
|
const observer = new MutationObserver(ensure)
|
|
29
30
|
observer.observe(document.body, { childList: true, subtree: true })
|
|
@@ -41,6 +42,7 @@ export function mountSidebarEntry(): () => void {
|
|
|
41
42
|
close()
|
|
42
43
|
}
|
|
43
44
|
document.addEventListener('click', closeOnExternalNavigation, true)
|
|
45
|
+
document.addEventListener(CLOSE_EVENT, close)
|
|
44
46
|
const toggle = (): void => {
|
|
45
47
|
const opening = !document.documentElement.hasAttribute(ACTIVE)
|
|
46
48
|
for (const name of document.documentElement.getAttributeNames()) {
|
|
@@ -69,5 +71,5 @@ export function mountSidebarEntry(): () => void {
|
|
|
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
|
}
|
package/src/routes.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { DshReviewCoordinator } from './review-runtime.ts'
|
|
|
7
7
|
const BODY_LIMIT = 2 * 1024 * 1024
|
|
8
8
|
const HEARTBEAT_MS = 15_000
|
|
9
9
|
function json(res: ServerResponse, status: number, body: unknown): void { res.writeHead(status, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store', 'referrer-policy': 'no-referrer' }); res.end(JSON.stringify(body)) }
|
|
10
|
-
function trusted(req: IncomingMessage): boolean { const remote = req.socket.remoteAddress; if (!(remote === '127.0.0.1' || remote === '::1' || remote === '::ffff:127.0.0.1')) return false; if (req.headers['sec-fetch-site'] === 'cross-site') return false; const origin = req.headers.origin; if (origin === undefined) return
|
|
10
|
+
function trusted(req: IncomingMessage): boolean { const remote = req.socket.remoteAddress; if (!(remote === '127.0.0.1' || remote === '::1' || remote === '::ffff:127.0.0.1')) return false; if (req.headers['sec-fetch-site'] === 'cross-site') return false; const origin = req.headers.origin; if (origin === undefined) return true; try { return new URL(origin).host === req.headers.host } catch { return false } }
|
|
11
11
|
async function readJson(req: IncomingMessage): Promise<unknown> { const chunks: Buffer[] = []; let size = 0; for await (const chunk of req) { const buffer = chunk as Buffer; size += buffer.length; if (size > BODY_LIMIT) throw new Error('body-too-large'); chunks.push(buffer) } return JSON.parse(Buffer.concat(chunks).toString('utf8')) }
|
|
12
12
|
|
|
13
13
|
export function makeRoutes(engine: CollaborationEngine, coordinator: DshReviewCoordinator): WebRoute[] {
|