@michengai/dsh-agency-agents 0.1.10 → 0.1.11
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 +36 -6
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2509,6 +2509,9 @@ window.__ModuleLoader__.load({
|
|
|
2509
2509
|
"settings.loading": "正在加载专家…",
|
|
2510
2510
|
"settings.enabled": "已启用",
|
|
2511
2511
|
"settings.disabled": "已停用",
|
|
2512
|
+
"error.conflict": "配置已被其他窗口修改。",
|
|
2513
|
+
"error.conflict.refreshed": "配置已被其他窗口修改,已为您刷新。",
|
|
2514
|
+
"error.conflict.refreshFailed": "配置已被其他窗口修改,但刷新失败,请手动刷新。",
|
|
2512
2515
|
"btn.refresh": "刷新",
|
|
2513
2516
|
"btn.enable": "启用",
|
|
2514
2517
|
"btn.disable": "停用",
|
|
@@ -2547,6 +2550,9 @@ window.__ModuleLoader__.load({
|
|
|
2547
2550
|
"settings.loading": "Loading experts…",
|
|
2548
2551
|
"settings.enabled": "Enabled",
|
|
2549
2552
|
"settings.disabled": "Disabled",
|
|
2553
|
+
"error.conflict": "Settings were changed in another window.",
|
|
2554
|
+
"error.conflict.refreshed": "Settings were changed in another window and have been refreshed.",
|
|
2555
|
+
"error.conflict.refreshFailed": "Settings were changed in another window, but refresh failed. Please refresh manually.",
|
|
2550
2556
|
"btn.refresh": "Refresh",
|
|
2551
2557
|
"btn.enable": "Enable",
|
|
2552
2558
|
"btn.disable": "Disable",
|
|
@@ -6646,9 +6652,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6646
6652
|
return active === "en" && e.descriptionEn !== "" ? e.descriptionEn : e.description;
|
|
6647
6653
|
}
|
|
6648
6654
|
const CSS = ".aag-btn-wrap{position:relative;order:1;margin-right:-8px}.aag-btn{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 4px 0 8px;border:none;border-radius:24px;background:transparent;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px;font-weight:500;cursor:pointer}.aag-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.aag-menu{position:absolute;bottom:calc(100% + 4px);left:0;box-sizing:border-box;padding:4px;display:flex;flex-direction:column;gap:0;width:300px;max-width:360px;max-height:calc(100vh - 24px);overflow-y:auto;border:1px solid var(--dsw-alias-border-inverted);border-radius:12px;background:var(--dsw-specific-menu);box-shadow:var(--dsw-shadow-lv3);z-index:10000}.aag-menu-title{padding:8px 10px;font-size:12px;line-height:16px;color:var(--dsw-alias-label-tertiary)}.aag-menu-item{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:8px 10px;border:none;border-radius:10px;background:transparent;cursor:pointer;text-align:left;font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary);box-sizing:border-box}.aag-menu-item:hover{background:var(--dsw-alias-interactive-bg-hover)}.aag-emoji{flex:0 0 auto;font-size:16px}.aag-menu-empty{padding:8px 10px;color:var(--dsw-alias-label-secondary);font-size:13px}[data-composer-card] :has(> button[aria-haspopup=\"listbox\"]) > :nth-child(2){order:2}\n.aag-section{box-sizing:border-box;display:flex;min-width:0;max-width:760px;width:100%;margin:0 auto;flex-direction:column;gap:16px;padding:0 0 32px;color:var(--dsw-alias-label-primary)}\n.aag-toolbar{display:flex;align-items:flex-start;gap:16px;padding-bottom:12px}\n.aag-title{margin:0;font-size:20px;line-height:28px;font-weight:650;letter-spacing:-.2px}\n.aag-desc{margin:4px 0 0;max-width:42em;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}\n.aag-actions{display:flex;align-items:center;gap:8px;margin-left:auto}\n.aag-action{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-height:32px;padding:0 12px;border:1px solid transparent;border-radius:8px;background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground);font:inherit;font-size:13px;font-weight:550;cursor:pointer;transition:opacity 180ms ease,background 180ms ease,border-color 180ms ease}\n.aag-action:hover:not(:disabled){opacity:.9}.aag-action:disabled{opacity:.5;cursor:default}\n.aag-action-secondary{background:transparent;border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}\n.aag-action:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}\n.aag-summary{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2)}\n.aag-summary-count{font-size:18px;font-weight:650}.aag-summary-label{color:var(--dsw-alias-label-secondary);font-size:12px}.aag-summary-separator{width:1px;height:24px;background:var(--dsw-alias-border-l2)}\n.aag-group{display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2)}\n.aag-group-head{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--dsw-alias-border-l1)}\n.aag-group-title{margin:0;font-size:14px;font-weight:600}.aag-count{color:var(--dsw-alias-label-tertiary);font-size:12px}\n.aag-row{display:flex;align-items:center;gap:12px;padding:13px 16px;border-bottom:1px solid var(--dsw-alias-border-l1)}\n.aag-row:last-child{border-bottom:0}\n.aag-row-main{display:flex;min-width:0;flex:1;flex-direction:column;gap:3px}\n.aag-row-id{display:flex;align-items:center;gap:7px;min-width:0}\n.aag-row-name{overflow:hidden;font-size:13px;font-weight:500;line-height:20px;text-overflow:ellipsis;white-space:nowrap}\n.aag-tag{flex:none;padding:1px 6px;border:1px solid var(--dsw-alias-border-l3);border-radius:4px;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:16px}\n.aag-tag-on{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}\n.aag-tag-off{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}\n.aag-note{overflow:hidden;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-overflow:ellipsis;white-space:nowrap}\n.aag-error{color:var(--dsw-alias-state-error-primary);font-size:13px;line-height:20px}\n@media (max-width:560px){.aag-toolbar{flex-wrap:wrap}.aag-actions{margin-left:0}.aag-row{align-items:flex-start;flex-wrap:wrap}.aag-row>.aag-action{margin-left:auto}}\n@media (prefers-reduced-motion:reduce){.aag-action{transition:none}}\n" + DIVISION_ORDER.map((d) => `[role="listbox"] div[data-source="division.${d}"] ~ button span:last-child`).join(",") + "{flex:1 1 auto;max-width:none;min-width:0}";
|
|
6649
|
-
|
|
6650
|
-
function
|
|
6651
|
-
if (error instanceof Error && error.message.includes("changed since it was read"))
|
|
6655
|
+
/** 将写失败映射到 agency 词条;非冲突错误返回 null,由调用方展示原始消息。 */
|
|
6656
|
+
function writeErrorKey(error, options) {
|
|
6657
|
+
if (error instanceof Error && error.message.includes("changed since it was read")) {
|
|
6658
|
+
if (options?.refreshed === true) return "error.conflict.refreshed";
|
|
6659
|
+
if (options?.refreshed === false) return "error.conflict.refreshFailed";
|
|
6660
|
+
return "error.conflict";
|
|
6661
|
+
}
|
|
6662
|
+
return null;
|
|
6663
|
+
}
|
|
6664
|
+
/** 写失败时的用户可见文案。冲突场景必须显式传入 refreshed;传入 t 时按当前语言翻译。 */
|
|
6665
|
+
function writeErrorMessage(error, options) {
|
|
6666
|
+
const key = writeErrorKey(error, options);
|
|
6667
|
+
if (key !== null) return (options?.t ?? ((item) => zh[item]))(key);
|
|
6652
6668
|
return error instanceof Error ? error.message : String(error);
|
|
6653
6669
|
}
|
|
6654
6670
|
async function readEnabled(remote) {
|
|
@@ -6787,6 +6803,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6787
6803
|
}, [props.remote]);
|
|
6788
6804
|
const toggle = (slug) => {
|
|
6789
6805
|
if (state === null || saving.current) return;
|
|
6806
|
+
const previous = state;
|
|
6790
6807
|
const next = new Set(state.enabled);
|
|
6791
6808
|
if (next.has(slug)) next.delete(slug);
|
|
6792
6809
|
else next.add(slug);
|
|
@@ -6796,11 +6813,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6796
6813
|
enabled: next,
|
|
6797
6814
|
revision: state.revision
|
|
6798
6815
|
});
|
|
6799
|
-
writeEnabled(props.remote, next, state.revision).then(
|
|
6816
|
+
writeEnabled(props.remote, next, state.revision).then((current) => {
|
|
6817
|
+
setState(current);
|
|
6818
|
+
setError(null);
|
|
6819
|
+
}).catch(async (err) => {
|
|
6800
6820
|
try {
|
|
6801
6821
|
setState(await readEnabled(props.remote));
|
|
6802
|
-
|
|
6803
|
-
|
|
6822
|
+
setError(writeErrorMessage(err, {
|
|
6823
|
+
refreshed: true,
|
|
6824
|
+
t: props.t
|
|
6825
|
+
}));
|
|
6826
|
+
} catch {
|
|
6827
|
+
setState(previous);
|
|
6828
|
+
setError(writeErrorMessage(err, {
|
|
6829
|
+
refreshed: false,
|
|
6830
|
+
t: props.t
|
|
6831
|
+
}));
|
|
6832
|
+
}
|
|
6804
6833
|
}).finally(() => {
|
|
6805
6834
|
saving.current = false;
|
|
6806
6835
|
setIsSaving(false);
|
|
@@ -6929,6 +6958,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6929
6958
|
//#endregion
|
|
6930
6959
|
exports.apply = apply;
|
|
6931
6960
|
exports.inject = inject;
|
|
6961
|
+
exports.writeErrorKey = writeErrorKey;
|
|
6932
6962
|
exports.writeErrorMessage = writeErrorMessage;
|
|
6933
6963
|
return module.exports;
|
|
6934
6964
|
}
|
package/package.json
CHANGED