@xmanrui/dsh-im 4.38.1 → 4.38.2

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 CHANGED
@@ -595,7 +595,7 @@ var React40 = __toESM(require("react"), 1);
595
595
  // package.json
596
596
  var package_default = {
597
597
  name: "@xmanrui/dsh-im",
598
- version: "4.38.1",
598
+ version: "4.38.2",
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: [
@@ -962,6 +962,25 @@ var image_input_default = {
962
962
 
963
963
  // src/channels/shared/i18n-en/diagnostics.mjs
964
964
  var diagnostics_default = Object.freeze({
965
+ "\u51C6\u5907\u4F1A\u8BDD": "Prepare session",
966
+ "\u51C6\u5907\u6D88\u606F": "Prepare message",
967
+ "\u5EFA\u7ACB\u4EA4\u4E92\u901A\u9053": "Open interaction channel",
968
+ "\u63D0\u4EA4\u6D88\u606F": "Submit message",
969
+ "\u7B49\u5F85\u5904\u7406\u7ED3\u679C": "Wait for result",
970
+ "\u6D88\u606F\u63D0\u4EA4\u72B6\u6001": "Message submission status",
971
+ "\u672A\u63D0\u4EA4": "Not submitted",
972
+ "\u5DF2\u786E\u8BA4\u63A5\u6536": "Acceptance confirmed",
973
+ "\u63D0\u4EA4\u7ED3\u679C\u672A\u77E5": "Submission outcome unknown",
974
+ "\u8FDE\u63A5\u5C1D\u8BD5\u6B21\u6570": "Connection attempts",
975
+ "\u6700\u8FD1\u4E00\u6B21\u8FDE\u63A5\u5931\u8D25": "Last observed connection failure",
976
+ "\u6253\u5F00\u524D\u5173\u95ED": "Closed before opening",
977
+ "\u6253\u5F00\u524D\u5931\u8D25": "Failed before opening",
978
+ "\u901A\u9053\u8FDE\u63A5\u5931\u8D25": "Stream connection failed",
979
+ "\u4E0E DSH \u7684\u4EA4\u4E92\u901A\u9053\u5728 30 \u79D2\u5185\u672A\u5C31\u7EEA\uFF0C\u672C\u6761\u6D88\u606F\u5C1A\u672A\u63D0\u4EA4\u6267\u884C\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "The DSH interaction channel was not ready within 30 seconds. This message has not been submitted for execution. Please try again later.",
980
+ "\u6D88\u606F\u63D0\u4EA4\u524D\u7684\u64CD\u4F5C\u8D85\u65F6\uFF0C\u672C\u6761\u6D88\u606F\u5C1A\u672A\u63D0\u4EA4\u6267\u884C\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "An operation timed out before submission. This message has not been submitted for execution. Please try again later.",
981
+ "\u6D88\u606F\u63D0\u4EA4\u524D\u7684\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25\uFF0C\u672C\u6761\u6D88\u606F\u5C1A\u672A\u63D0\u4EA4\u6267\u884C\u3002\u8BF7\u68C0\u67E5\u8FDE\u63A5\u540E\u91CD\u8BD5\u3002": "A network request failed before submission. This message has not been submitted for execution. Check the connection and try again.",
982
+ "\u6D88\u606F\u5728\u63D0\u4EA4\u524D\u5904\u7406\u5931\u8D25\uFF0C\u5C1A\u672A\u63D0\u4EA4\u6267\u884C\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u53D1\u751F\uFF0C\u8BF7\u5C06\u53C2\u8003\u53F7\u63D0\u4F9B\u7ED9\u7BA1\u7406\u5458\u3002": "Message preparation failed before submission. It has not been submitted for execution. Try again; if this persists, share the reference with your administrator.",
983
+ "\u6D88\u606F\u5DF2\u5C1D\u8BD5\u63D0\u4EA4\uFF0C\u4F46\u4EFB\u52A1\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\u3002\u8BF7\u5148\u5230 DSH \u67E5\u770B\u72B6\u6001\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\uFF1B\u82E5\u6301\u7EED\u53D1\u751F\uFF0C\u8BF7\u5C06\u53C2\u8003\u53F7\u63D0\u4F9B\u7ED9\u7BA1\u7406\u5458\u3002": "Message submission was attempted, but the task outcome is unconfirmed. Check its status in DSH before resubmitting; if this persists, share the reference with your administrator.",
965
984
  "DSH \u7248\u672C": "DSH version",
966
985
  "\u4F9D\u8D56\u7248\u672C": "Dependency versions",
967
986
  "\u4EE3\u7406\u5DF2\u914D\u7F6E": "Proxy configured",
@@ -2525,6 +2544,11 @@ var OPERATIONS = /* @__PURE__ */ new Set([
2525
2544
  "bot.alias.set"
2526
2545
  ]);
2527
2546
  var STAGES = /* @__PURE__ */ new Set([
2547
+ "session.prepare",
2548
+ "prompt.prepare",
2549
+ "interaction.open",
2550
+ "prompt.submit",
2551
+ "reply.wait",
2528
2552
  "credential.verify",
2529
2553
  "permission.check",
2530
2554
  "sdk.load",
@@ -2559,6 +2583,9 @@ var STAGES = /* @__PURE__ */ new Set([
2559
2583
  "management.request"
2560
2584
  ]);
2561
2585
  var REASONS = /* @__PURE__ */ new Set([
2586
+ "stream-closed-before-open",
2587
+ "stream-failed-before-open",
2588
+ "stream-failed",
2562
2589
  "ENOTFOUND",
2563
2590
  "EAI_AGAIN",
2564
2591
  "ECONNREFUSED",
@@ -2624,7 +2651,8 @@ var RPC_METHODS = /* @__PURE__ */ new Set([
2624
2651
  "session.selectModel",
2625
2652
  "llm.models"
2626
2653
  ]);
2627
- var TRANSPORTS = /* @__PURE__ */ new Set(["host-api", "http"]);
2654
+ var TRANSPORTS = /* @__PURE__ */ new Set(["host-api", "http", "websocket"]);
2655
+ var SUBMISSION_STATES = /* @__PURE__ */ new Set(["not-submitted", "accepted", "unknown"]);
2628
2656
  var CONFIG_FILES = /* @__PURE__ */ new Set(["config.json", "workspaces.json"]);
2629
2657
  var CONFIG_ISSUE_LABELS = Object.freeze({
2630
2658
  "expected-object": "\u5E94\u4E3A JSON \u5BF9\u8C61\u3002",
@@ -2646,7 +2674,7 @@ var CONFIG_FIELD = /^(?:\$|version|accounts(?:\[\d{1,10}\](?:\.(?:accountId|owne
2646
2674
  function normalizeDiagnosticDetails(value) {
2647
2675
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
2648
2676
  const result = {};
2649
- for (const [field2, allowed] of [["operation", OPERATIONS], ["stage", STAGES], ["reason", REASONS], ["resource", RESOURCES], ["method", RPC_METHODS], ["transport", TRANSPORTS]]) {
2677
+ for (const [field2, allowed] of [["operation", OPERATIONS], ["stage", STAGES], ["reason", REASONS], ["resource", RESOURCES], ["method", RPC_METHODS], ["transport", TRANSPORTS], ["submissionState", SUBMISSION_STATES], ["lastFailureReason", REASONS]]) {
2650
2678
  if (allowed.has(value[field2])) result[field2] = value[field2];
2651
2679
  }
2652
2680
  if (DIAGNOSTIC_CHANNELS.includes(value.channel)) result.channel = value.channel;
@@ -2655,6 +2683,7 @@ function normalizeDiagnosticDetails(value) {
2655
2683
  if (reasons.length) result.reasons = reasons;
2656
2684
  }
2657
2685
  for (const field2 of ["durationMs", "timeoutMs"]) if (Number.isFinite(value[field2]) && value[field2] >= 0) result[field2] = Math.round(value[field2]);
2686
+ if (Number.isSafeInteger(value.attempts) && value.attempts >= 0) result.attempts = value.attempts;
2658
2687
  for (const field2 of ["nodeVersion", "dshVersion"]) if (typeof value[field2] === "string" && /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value[field2]) && value[field2].length < 80) result[field2] = value[field2];
2659
2688
  if (["darwin", "linux", "win32", "freebsd"].includes(value.platform)) result.platform = value.platform;
2660
2689
  if (["ilinkai.weixin.qq.com", "oapi.dingtalk.com", "api.dingtalk.com", "api.telegram.org", "discord.com", "slack.com", "open.feishu.cn", "qyapi.weixin.qq.com"].includes(value.host)) result.host = value.host;
@@ -2694,6 +2723,11 @@ function diagnosticFields(value) {
2694
2723
 
2695
2724
  // plugin-src/client/connection-error.js
2696
2725
  var STAGE_LABELS = {
2726
+ "session.prepare": "\u51C6\u5907\u4F1A\u8BDD",
2727
+ "prompt.prepare": "\u51C6\u5907\u6D88\u606F",
2728
+ "interaction.open": "\u5EFA\u7ACB\u4EA4\u4E92\u901A\u9053",
2729
+ "prompt.submit": "\u63D0\u4EA4\u6D88\u606F",
2730
+ "reply.wait": "\u7B49\u5F85\u5904\u7406\u7ED3\u679C",
2697
2731
  "credential.verify": "\u9A8C\u8BC1\u51ED\u636E",
2698
2732
  "permission.check": "\u68C0\u67E5\u6743\u9650",
2699
2733
  "sdk.load": "\u52A0\u8F7D\u6E20\u9053\u7EC4\u4EF6",
@@ -2727,6 +2761,13 @@ var STAGE_LABELS = {
2727
2761
  rollback: "\u6062\u590D\u539F\u8D26\u53F7\u72B6\u6001",
2728
2762
  "management.request": "\u8BBF\u95EE DSH \u7BA1\u7406\u63A5\u53E3"
2729
2763
  };
2764
+ var SUBMISSION_LABELS = { "not-submitted": "\u672A\u63D0\u4EA4", accepted: "\u5DF2\u786E\u8BA4\u63A5\u6536", unknown: "\u63D0\u4EA4\u7ED3\u679C\u672A\u77E5" };
2765
+ var STREAM_REASON_LABELS = {
2766
+ "stream-closed-before-open": "\u6253\u5F00\u524D\u5173\u95ED",
2767
+ "stream-failed-before-open": "\u6253\u5F00\u524D\u5931\u8D25",
2768
+ "stream-failed": "\u901A\u9053\u8FDE\u63A5\u5931\u8D25",
2769
+ unknown: "\u6682\u672A\u8BC6\u522B"
2770
+ };
2730
2771
  function provisioningErrorTitle(error) {
2731
2772
  const stage = error?.details?.stage;
2732
2773
  if (stage === "qr.begin" || stage === "qr.encode") return "\u65E0\u6CD5\u751F\u6210\u5FAE\u4FE1\u4E8C\u7EF4\u7801";
@@ -2741,7 +2782,7 @@ function formatConnectionDiagnostic(value) {
2741
2782
  localizeText(error.message),
2742
2783
  details.hint ? localizeText(details.hint) : null,
2743
2784
  localizeText("\u9519\u8BEF\u7801") + ": " + error.code,
2744
- ...["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]}`)
2785
+ ...["channel", "operation", "stage", "method", "transport", "submissionState", "attempts", "lastFailureReason", "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]}`)
2745
2786
  ].filter(Boolean).join("\n");
2746
2787
  }
2747
2788
  function ConnectionError({ error: value, warning = false, showMessage = true }) {
@@ -2763,7 +2804,10 @@ function ConnectionError({ error: value, warning = false, showMessage = true })
2763
2804
  ["\u9519\u8BEF\u7801", error.code],
2764
2805
  ["\u5931\u8D25\u9636\u6BB5", localizeText(STAGE_LABELS[details.stage] ?? details.stage ?? "")],
2765
2806
  ["RPC \u65B9\u6CD5", details.method],
2766
- ["\u8C03\u7528\u65B9\u5F0F", details.transport === "host-api" ? localizeText("\u5BBF\u4E3B API\uFF08\u8FDB\u7A0B\u5185\uFF09") : details.transport === "http" ? "HTTP" : void 0],
2807
+ ["\u8C03\u7528\u65B9\u5F0F", details.transport === "host-api" ? localizeText("\u5BBF\u4E3B API\uFF08\u8FDB\u7A0B\u5185\uFF09") : details.transport === "http" ? "HTTP" : details.transport === "websocket" ? "WebSocket" : void 0],
2808
+ ["\u6D88\u606F\u63D0\u4EA4\u72B6\u6001", localizeText(SUBMISSION_LABELS[details.submissionState] ?? "")],
2809
+ ["\u8FDE\u63A5\u5C1D\u8BD5\u6B21\u6570", details.attempts],
2810
+ ["\u6700\u8FD1\u4E00\u6B21\u8FDE\u63A5\u5931\u8D25", localizeText(STREAM_REASON_LABELS[details.lastFailureReason] ?? details.lastFailureReason ?? "")],
2767
2811
  ["\u5E95\u5C42\u539F\u56E0", details.reason === "unknown" ? localizeText("\u6682\u672A\u8BC6\u522B") : details.reason],
2768
2812
  ["\u591A\u4E2A\u539F\u56E0", details.reasons?.join(", ")],
2769
2813
  ["\u670D\u52A1\u57DF\u540D", details.host],