@michengai/dsh-automation 0.1.11 → 0.1.13
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/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/01-/351/241/271/347/233/256/346/246/202/350/247/210.md +1 -1
- package/lib/client.js +37 -1
- package/lib/client.js.map +3 -3
- package/lib/index.js +25 -44
- package/lib/types/client/create-modal-logic.d.ts +3 -0
- package/lib/types/executor.d.ts +1 -1
- package/lib/types/permission-presets.d.ts +0 -6
- package/lib/types/rpc.d.ts +3 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
- 每次到期都创建全新 root Agent 和 Session,不继承来源对话。
|
|
14
14
|
- 规则、修订号和运行历史持久化。
|
|
15
15
|
- 同一条规则同时最多一个 active run;超时、重叠和 Host 中断都有明确终态。
|
|
16
|
-
-
|
|
16
|
+
- 权限预设与 Chat 保持一致,完整使用 Host 提供的列表与默认值;切换到 `danger-full-access` 时显示同款风险确认。
|
|
17
17
|
|
|
18
18
|
## 稳定边界
|
|
19
19
|
|
package/lib/client.js
CHANGED
|
@@ -405,6 +405,11 @@ function permissionLabel(option, t) {
|
|
|
405
405
|
return option.name || option.value;
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
// src/client/create-modal-logic.ts
|
|
409
|
+
function shouldConfirmFullAccess(current, next) {
|
|
410
|
+
return current !== next && next === "danger-full-access";
|
|
411
|
+
}
|
|
412
|
+
|
|
408
413
|
// src/client/menu.tsx
|
|
409
414
|
var import_react = require("react");
|
|
410
415
|
var import_react_dom = require("react-dom");
|
|
@@ -635,13 +640,29 @@ function CreateModal({
|
|
|
635
640
|
}) {
|
|
636
641
|
const [form, setForm] = (0, import_react2.useState)(() => ({ ...defaultFormState(/* @__PURE__ */ new Date(), workspaces, defaultModel, defaultPermission), ...draft }));
|
|
637
642
|
const [validationError, setValidationError] = (0, import_react2.useState)();
|
|
643
|
+
const [confirmingPermission, setConfirmingPermission] = (0, import_react2.useState)();
|
|
644
|
+
const [fullAccessAcknowledged, setFullAccessAcknowledged] = (0, import_react2.useState)(false);
|
|
638
645
|
const update = (patch) => {
|
|
639
646
|
setForm((current) => ({ ...current, ...patch }));
|
|
640
647
|
setValidationError(void 0);
|
|
641
648
|
};
|
|
642
649
|
const choosePermission = (permission) => {
|
|
650
|
+
if (shouldConfirmFullAccess(form.permission, permission)) {
|
|
651
|
+
setFullAccessAcknowledged(false);
|
|
652
|
+
setConfirmingPermission(permission);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
643
655
|
update({ permission });
|
|
644
656
|
};
|
|
657
|
+
const cancelFullAccessConfirmation = () => {
|
|
658
|
+
setFullAccessAcknowledged(false);
|
|
659
|
+
setConfirmingPermission(void 0);
|
|
660
|
+
};
|
|
661
|
+
const confirmFullAccess = () => {
|
|
662
|
+
if (!fullAccessAcknowledged || confirmingPermission === void 0) return;
|
|
663
|
+
update({ permission: confirmingPermission });
|
|
664
|
+
cancelFullAccessConfirmation();
|
|
665
|
+
};
|
|
645
666
|
(0, import_react2.useEffect)(() => {
|
|
646
667
|
const onKey = (event) => {
|
|
647
668
|
if (event.key !== "Escape") return;
|
|
@@ -837,7 +858,22 @@ function CreateModal({
|
|
|
837
858
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "submit", className: "dsh-st-btn dsh-st-btn--primary", disabled: busy, children: t("modal.save") })
|
|
838
859
|
] })
|
|
839
860
|
] }),
|
|
840
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-st-flyout-root", ref: setMenuHost })
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-st-flyout-root", ref: setMenuHost }),
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
863
|
+
import_dsh_client_ui_primitives.RiskConfirmation,
|
|
864
|
+
{
|
|
865
|
+
open: confirmingPermission !== void 0,
|
|
866
|
+
title: permissionT("confirm.title"),
|
|
867
|
+
description: permissionT("confirm.description"),
|
|
868
|
+
acknowledgeLabel: permissionT("confirm.acknowledge"),
|
|
869
|
+
cancelLabel: permissionT("confirm.cancel"),
|
|
870
|
+
confirmLabel: permissionT("confirm.enable"),
|
|
871
|
+
acknowledged: fullAccessAcknowledged,
|
|
872
|
+
onAcknowledgedChange: setFullAccessAcknowledged,
|
|
873
|
+
onCancel: cancelFullAccessConfirmation,
|
|
874
|
+
onConfirm: confirmFullAccess
|
|
875
|
+
}
|
|
876
|
+
)
|
|
841
877
|
] }) });
|
|
842
878
|
}
|
|
843
879
|
function ModelPicker({
|