@xmanrui/dsh-im 4.36.0 → 4.36.1
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 +27 -6
- package/lib/index.js +247 -247
- package/package.json +1 -1
- package/plugin-src/client/connection-error.js +2 -1
- package/src/channels/shared/connection-error.mjs +1 -0
- package/src/channels/shared/diagnostic-details.mjs +7 -1
- package/src/channels/shared/harness-client.mjs +15 -8
- package/src/channels/shared/i18n-en/diagnostics.mjs +3 -0
- package/src/channels/shared/message-failure.mjs +1 -1
package/lib/client.js
CHANGED
|
@@ -595,7 +595,7 @@ var React39 = __toESM(require("react"), 1);
|
|
|
595
595
|
// package.json
|
|
596
596
|
var package_default = {
|
|
597
597
|
name: "@xmanrui/dsh-im",
|
|
598
|
-
version: "4.36.
|
|
598
|
+
version: "4.36.1",
|
|
599
599
|
icon: "./assets/logo-plugin-message-link-gradient.webp",
|
|
600
600
|
description: "\u628A\u5FAE\u4FE1\u3001\u98DE\u4E66\u3001\u4F01\u5FAE\u3001\u9489\u9489\u3001QQ\u3001Telegram\u3001WhatsApp\u3001Slack\u3001Discord\u3001Matrix\u63A5\u5165DSH\u3002 Connect Telegram, WhatsApp, Slack, Discord, Matrix, WeChat, Feishu, WeCom, DingTalk, and QQ to DSH.",
|
|
601
601
|
keywords: [
|
|
@@ -1002,6 +1002,9 @@ var diagnostics_default = Object.freeze({
|
|
|
1002
1002
|
"\u6682\u672A\u8BC6\u522B\u5177\u4F53\u539F\u56E0\uFF0C\u8BF7\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\uFF0C\u5E76\u67E5\u770B\u76F8\u540C\u53C2\u8003\u53F7\u7684 DSH \u65E5\u5FD7\u3002": "The underlying cause is unknown. Copy the diagnostics and find the matching reference in the DSH logs.",
|
|
1003
1003
|
"\u591A\u4E2A\u539F\u56E0": "Multiple causes",
|
|
1004
1004
|
"\u670D\u52A1\u57DF\u540D": "Service host",
|
|
1005
|
+
"RPC \u65B9\u6CD5": "RPC method",
|
|
1006
|
+
"\u8C03\u7528\u65B9\u5F0F": "Transport",
|
|
1007
|
+
"\u5BBF\u4E3B API\uFF08\u8FDB\u7A0B\u5185\uFF09": "Host API (in-process)",
|
|
1005
1008
|
"\u8BF7\u6C42\u8017\u65F6\uFF08\u6BEB\u79D2\uFF09": "Request duration (ms)",
|
|
1006
1009
|
"\u8D85\u65F6\u9608\u503C\uFF08\u6BEB\u79D2\uFF09": "Timeout (ms)",
|
|
1007
1010
|
"Node \u7248\u672C": "Node version",
|
|
@@ -2586,6 +2589,22 @@ var REASONS = /* @__PURE__ */ new Set([
|
|
|
2586
2589
|
"read-only"
|
|
2587
2590
|
]);
|
|
2588
2591
|
var RESOURCES = /* @__PURE__ */ new Set(["credential-store", "account-config", "account-state", "workspace-config", "workspace-directory"]);
|
|
2592
|
+
var RPC_METHODS = /* @__PURE__ */ new Set([
|
|
2593
|
+
"host.describe",
|
|
2594
|
+
"workspace.list",
|
|
2595
|
+
"workspace.create",
|
|
2596
|
+
"session.list",
|
|
2597
|
+
"session.create",
|
|
2598
|
+
"session.history",
|
|
2599
|
+
"session.prompt",
|
|
2600
|
+
"session.rename",
|
|
2601
|
+
"session.cancel",
|
|
2602
|
+
"session.models",
|
|
2603
|
+
"session.permissions",
|
|
2604
|
+
"session.selectModel",
|
|
2605
|
+
"llm.models"
|
|
2606
|
+
]);
|
|
2607
|
+
var TRANSPORTS = /* @__PURE__ */ new Set(["host-api", "http"]);
|
|
2589
2608
|
var CONFIG_FILES = /* @__PURE__ */ new Set(["config.json", "workspaces.json"]);
|
|
2590
2609
|
var CONFIG_ISSUE_LABELS = Object.freeze({
|
|
2591
2610
|
"expected-object": "\u5E94\u4E3A JSON \u5BF9\u8C61\u3002",
|
|
@@ -2607,7 +2626,7 @@ var CONFIG_FIELD = /^(?:\$|version|accounts(?:\[\d{1,10}\](?:\.(?:accountId|owne
|
|
|
2607
2626
|
function normalizeDiagnosticDetails(value) {
|
|
2608
2627
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
2609
2628
|
const result = {};
|
|
2610
|
-
for (const [field2, allowed] of [["operation", OPERATIONS], ["stage", STAGES], ["reason", REASONS], ["resource", RESOURCES]]) {
|
|
2629
|
+
for (const [field2, allowed] of [["operation", OPERATIONS], ["stage", STAGES], ["reason", REASONS], ["resource", RESOURCES], ["method", RPC_METHODS], ["transport", TRANSPORTS]]) {
|
|
2611
2630
|
if (allowed.has(value[field2])) result[field2] = value[field2];
|
|
2612
2631
|
}
|
|
2613
2632
|
if (DIAGNOSTIC_CHANNELS.includes(value.channel)) result.channel = value.channel;
|
|
@@ -2702,7 +2721,7 @@ function formatConnectionDiagnostic(value) {
|
|
|
2702
2721
|
localizeText(error.message),
|
|
2703
2722
|
details.hint ? localizeText(details.hint) : null,
|
|
2704
2723
|
localizeText("\u9519\u8BEF\u7801") + ": " + error.code,
|
|
2705
|
-
...["channel", "operation", "stage", "reason", "reasons", "host", "durationMs", "timeoutMs", "nodeVersion", "dshVersion", "platform", "dependencies", "proxyConfigured", "truncated", "httpStatus", "providerCode", "resource", "file", "field", "issue", "referenceId", "occurredAt", "rollback", "pluginVersion"].filter((field2) => details[field2] !== void 0).map((field2) => `${field2}: ${typeof details[field2] === "object" ? JSON.stringify(details[field2]) : details[field2]}`)
|
|
2724
|
+
...["channel", "operation", "stage", "method", "transport", "reason", "reasons", "host", "durationMs", "timeoutMs", "nodeVersion", "dshVersion", "platform", "dependencies", "proxyConfigured", "truncated", "httpStatus", "providerCode", "resource", "file", "field", "issue", "referenceId", "occurredAt", "rollback", "pluginVersion"].filter((field2) => details[field2] !== void 0).map((field2) => `${field2}: ${typeof details[field2] === "object" ? JSON.stringify(details[field2]) : details[field2]}`)
|
|
2706
2725
|
].filter(Boolean).join("\n");
|
|
2707
2726
|
}
|
|
2708
2727
|
function ConnectionError({ error: value, warning = false, showMessage = true }) {
|
|
@@ -2723,6 +2742,8 @@ function ConnectionError({ error: value, warning = false, showMessage = true })
|
|
|
2723
2742
|
const fields = [
|
|
2724
2743
|
["\u9519\u8BEF\u7801", error.code],
|
|
2725
2744
|
["\u5931\u8D25\u9636\u6BB5", localizeText(STAGE_LABELS[details.stage] ?? details.stage ?? "")],
|
|
2745
|
+
["RPC \u65B9\u6CD5", details.method],
|
|
2746
|
+
["\u8C03\u7528\u65B9\u5F0F", details.transport === "host-api" ? localizeText("\u5BBF\u4E3B API\uFF08\u8FDB\u7A0B\u5185\uFF09") : details.transport === "http" ? "HTTP" : void 0],
|
|
2726
2747
|
["\u5E95\u5C42\u539F\u56E0", details.reason === "unknown" ? localizeText("\u6682\u672A\u8BC6\u522B") : details.reason],
|
|
2727
2748
|
["\u591A\u4E2A\u539F\u56E0", details.reasons?.join(", ")],
|
|
2728
2749
|
["\u670D\u52A1\u57DF\u540D", details.host],
|
|
@@ -15191,7 +15212,7 @@ var PROVIDER_HINTS = {
|
|
|
15191
15212
|
gmail: "\u9700\u8981\u5148\u5F00\u542F\u4E24\u6B65\u9A8C\u8BC1\uFF0C\u518D\u751F\u6210\u300C\u5E94\u7528\u4E13\u7528\u5BC6\u7801\u300D\u3002",
|
|
15192
15213
|
custom: "\u8BF7\u586B\u5199\u90AE\u7BB1\u670D\u52A1\u5546\u63D0\u4F9B\u7684 IMAP \u4E0E SMTP \u670D\u52A1\u5668\u5730\u5740\u53CA\u7AEF\u53E3\u3002"
|
|
15193
15214
|
};
|
|
15194
|
-
var
|
|
15215
|
+
var TRANSPORTS2 = [
|
|
15195
15216
|
{
|
|
15196
15217
|
key: "imap-smtp",
|
|
15197
15218
|
label: "IMAP / SMTP\uFF08\u4EFB\u610F\u90AE\u7BB1\uFF09",
|
|
@@ -15351,7 +15372,7 @@ function MailboxPanel({ busy, error, onSubmit, onCancel, rpcCall, endpoints }) {
|
|
|
15351
15372
|
const [imapPort, setImapPort] = React26.useState("");
|
|
15352
15373
|
const [smtpHost, setSmtpHost] = React26.useState("");
|
|
15353
15374
|
const [smtpPort, setSmtpPort] = React26.useState("");
|
|
15354
|
-
const transport =
|
|
15375
|
+
const transport = TRANSPORTS2.find((entry) => entry.key === transportKey) ?? TRANSPORTS2[0];
|
|
15355
15376
|
const custom = transport.needsProvider && provider === "custom";
|
|
15356
15377
|
const isAgentMail = transport.key === "agent-mail";
|
|
15357
15378
|
const maySubmit = Boolean(address.trim()) && (!transport.needsPassword || Boolean(password)) && (!isAgentMail || Boolean(tokens));
|
|
@@ -15397,7 +15418,7 @@ function MailboxPanel({ busy, error, onSubmit, onCancel, rpcCall, endpoints }) {
|
|
|
15397
15418
|
value: transportKey,
|
|
15398
15419
|
onChange: (event) => setTransportKey(event.target.value),
|
|
15399
15420
|
disabled: busy
|
|
15400
|
-
},
|
|
15421
|
+
}, TRANSPORTS2.map((entry) => h2("option", { key: entry.key, value: entry.key }, entry.label))),
|
|
15401
15422
|
h2("span", { className: "dim-emailHint" }, transport.hint)
|
|
15402
15423
|
),
|
|
15403
15424
|
field(
|