@michengai/dsh-agency-agents 0.1.29 → 0.1.30
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 +4 -0
- package/CHANGELOG.zh-CN.md +4 -0
- package/lib/client.js +73 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ The five most recent published versions are listed below.
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.1.30 — 2026-09-03
|
|
10
|
+
|
|
11
|
+
- When no experts are enabled, the composer Experts button opens Settings → Experts. It only clicks a uniquely labeled Settings trigger and ignores composer dialogs such as the + button.
|
|
12
|
+
|
|
9
13
|
## 0.1.29 — 2026-09-03
|
|
10
14
|
|
|
11
15
|
- Updated the DSH development baseline to `0.1.2-rc.1` while retaining the existing `>=0.1.0-rc.5 <0.2.0` peer compatibility range.
|
package/CHANGELOG.zh-CN.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -2574,7 +2574,7 @@ window.__ModuleLoader__.load({
|
|
|
2574
2574
|
"summary.enabled.other": "位已启用",
|
|
2575
2575
|
"summary.group": "{count} 个",
|
|
2576
2576
|
"button.title": "召唤专家",
|
|
2577
|
-
"menu.empty": "
|
|
2577
|
+
"menu.empty": "暂无可召唤的专家。请先在设置里启用。",
|
|
2578
2578
|
"division.academic": ZH_DIVISION.academic,
|
|
2579
2579
|
"division.design": ZH_DIVISION.design,
|
|
2580
2580
|
"division.engineering": ZH_DIVISION.engineering,
|
|
@@ -2626,7 +2626,7 @@ window.__ModuleLoader__.load({
|
|
|
2626
2626
|
"summary.enabled.other": "enabled",
|
|
2627
2627
|
"summary.group": "{count} items",
|
|
2628
2628
|
"button.title": "Summon expert",
|
|
2629
|
-
"menu.empty": "No experts available yet",
|
|
2629
|
+
"menu.empty": "No experts available yet. Enable some in Settings first.",
|
|
2630
2630
|
"division.academic": EN_DIVISION.academic,
|
|
2631
2631
|
"division.design": EN_DIVISION.design,
|
|
2632
2632
|
"division.engineering": EN_DIVISION.engineering,
|
|
@@ -6918,21 +6918,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6918
6918
|
function menuGroup(g, pick, t, getActive) {
|
|
6919
6919
|
return react.default.createElement("div", { key: g.division }, react.default.createElement("div", { className: "aag-menu-title" }, t(`division.${g.division}`)), g.experts.map((e) => menuItem(e, pick, getActive)));
|
|
6920
6920
|
}
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6921
|
+
/** 没有可召唤专家时打开设置页,否则打开本地菜单。 */
|
|
6922
|
+
function resolveExpertToolbarClick(enabledCount) {
|
|
6923
|
+
return enabledCount === 0 ? "settings" : "menu";
|
|
6924
|
+
}
|
|
6925
|
+
const SETTINGS_TRIGGER_LABELS = /* @__PURE__ */ new Set(["设置", "Settings"]);
|
|
6926
|
+
const COMPOSER_TRIGGER_SCOPE = "[data-composer-card], .aag-btn-wrap";
|
|
6927
|
+
function isSettingsTriggerLabel(label) {
|
|
6928
|
+
return SETTINGS_TRIGGER_LABELS.has(label.trim());
|
|
6929
|
+
}
|
|
6930
|
+
/** 只认明确的设置按钮;输入区里的「+」和其他弹窗一律排除。 */
|
|
6931
|
+
function pickHostSettingsTrigger(candidates) {
|
|
6932
|
+
const labeled = candidates.filter((item) => !item.inComposer && isSettingsTriggerLabel(item.label));
|
|
6933
|
+
if (labeled.length === 1) return labeled[0];
|
|
6934
|
+
if (labeled.length > 1) return void 0;
|
|
6935
|
+
const dialogs = candidates.filter((item) => !item.inComposer && item.hasDialogPopup);
|
|
6936
|
+
return dialogs.length === 1 ? dialogs[0] : void 0;
|
|
6937
|
+
}
|
|
6938
|
+
function buttonAccessibleLabel(button) {
|
|
6939
|
+
return (button.getAttribute("aria-label") ?? button.textContent ?? "").trim();
|
|
6940
|
+
}
|
|
6941
|
+
function collectSettingsTriggerCandidates(root) {
|
|
6942
|
+
const result = [];
|
|
6943
|
+
for (const node of root.querySelectorAll("button")) {
|
|
6944
|
+
if (!(node instanceof HTMLElement)) continue;
|
|
6945
|
+
result.push({
|
|
6946
|
+
button: node,
|
|
6947
|
+
label: buttonAccessibleLabel(node),
|
|
6948
|
+
inComposer: node.closest(COMPOSER_TRIGGER_SCOPE) !== null,
|
|
6949
|
+
hasDialogPopup: node.getAttribute("aria-haspopup") === "dialog"
|
|
6950
|
+
});
|
|
6925
6951
|
}
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6952
|
+
return result;
|
|
6953
|
+
}
|
|
6954
|
+
function findHostSettingsTrigger(root) {
|
|
6955
|
+
return pickHostSettingsTrigger(collectSettingsTriggerCandidates(root))?.button;
|
|
6956
|
+
}
|
|
6957
|
+
function findExpertSettingsNavButton(root, navLabel) {
|
|
6958
|
+
for (const dialog of root.querySelectorAll("[role=\"dialog\"]")) for (const button of dialog.querySelectorAll("nav button")) if (button instanceof HTMLElement && (button.textContent ?? "").trim() === navLabel) return button;
|
|
6959
|
+
}
|
|
6960
|
+
function queueSettingsNav(work) {
|
|
6961
|
+
if (typeof requestAnimationFrame === "function") {
|
|
6962
|
+
requestAnimationFrame(() => {
|
|
6963
|
+
requestAnimationFrame(work);
|
|
6964
|
+
});
|
|
6965
|
+
return;
|
|
6966
|
+
}
|
|
6967
|
+
work();
|
|
6968
|
+
}
|
|
6969
|
+
/** 打开宿主设置并选中专家分区;找不到唯一设置入口时返回 false,由调用方回退到本地菜单。 */
|
|
6970
|
+
function openAgentSettings(navLabel, root = document, schedule = queueSettingsNav) {
|
|
6971
|
+
const existing = findExpertSettingsNavButton(root, navLabel);
|
|
6972
|
+
if (existing !== void 0) {
|
|
6973
|
+
existing.click();
|
|
6974
|
+
return true;
|
|
6975
|
+
}
|
|
6976
|
+
const trigger = findHostSettingsTrigger(root);
|
|
6977
|
+
if (trigger === void 0) return false;
|
|
6978
|
+
trigger.click();
|
|
6979
|
+
schedule(() => {
|
|
6980
|
+
findExpertSettingsNavButton(root, navLabel)?.click();
|
|
6935
6981
|
});
|
|
6982
|
+
return true;
|
|
6936
6983
|
}
|
|
6937
6984
|
function resolveReferenceInsertionTarget(sessions, sessionId, getConversation) {
|
|
6938
6985
|
const targetSessionId = sessionId ?? sessions.list?.getSnapshot().current;
|
|
@@ -6988,9 +7035,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6988
7035
|
readEnabled(props.remote).then((current) => {
|
|
6989
7036
|
setEnabled(current.enabled);
|
|
6990
7037
|
props.onEnabledChange?.(current.enabled);
|
|
6991
|
-
if (current.enabled.size ===
|
|
6992
|
-
openAgentSettings(props.t)
|
|
6993
|
-
|
|
7038
|
+
if (resolveExpertToolbarClick(current.enabled.size) === "settings") {
|
|
7039
|
+
if (openAgentSettings(props.t("settings.nav"))) {
|
|
7040
|
+
setOpen(false);
|
|
7041
|
+
return;
|
|
7042
|
+
}
|
|
6994
7043
|
}
|
|
6995
7044
|
setInsertError(null);
|
|
6996
7045
|
setOpen((prev) => !prev);
|
|
@@ -7471,6 +7520,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7471
7520
|
exports.compareExpertName = compareExpertName;
|
|
7472
7521
|
exports.expertMentionFromReference = expertMentionFromReference;
|
|
7473
7522
|
exports.filterExperts = filterExperts;
|
|
7523
|
+
exports.findExpertSettingsNavButton = findExpertSettingsNavButton;
|
|
7524
|
+
exports.findHostSettingsTrigger = findHostSettingsTrigger;
|
|
7474
7525
|
exports.formatExpertMention = formatExpertMention;
|
|
7475
7526
|
exports.formatExpertMentionInsertion = formatExpertMentionInsertion;
|
|
7476
7527
|
exports.inject = inject;
|
|
@@ -7480,9 +7531,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7480
7531
|
exports.inputTriggerSourceName = inputTriggerSourceName;
|
|
7481
7532
|
exports.insertExpertReference = insertExpertReference;
|
|
7482
7533
|
exports.insertSelectedExpert = insertSelectedExpert;
|
|
7534
|
+
exports.isSettingsTriggerLabel = isSettingsTriggerLabel;
|
|
7483
7535
|
exports.keepComposerFocus = keepComposerFocus;
|
|
7484
7536
|
exports.matchExpertQuery = matchExpertQuery;
|
|
7485
7537
|
exports.normalizeExpertQuery = normalizeExpertQuery;
|
|
7538
|
+
exports.openAgentSettings = openAgentSettings;
|
|
7539
|
+
exports.pickHostSettingsTrigger = pickHostSettingsTrigger;
|
|
7540
|
+
exports.resolveExpertToolbarClick = resolveExpertToolbarClick;
|
|
7486
7541
|
exports.resolveReferenceInsertionTarget = resolveReferenceInsertionTarget;
|
|
7487
7542
|
exports.writeErrorKey = writeErrorKey;
|
|
7488
7543
|
exports.writeErrorMessage = writeErrorMessage;
|
package/package.json
CHANGED