dsh-multigameassistant 2.2.1 → 2.2.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.
@@ -4,11 +4,11 @@ import {
4
4
  guideView,
5
5
  renderTask,
6
6
  require_dist
7
- } from "./chunk-IBPJC6DX.js";
7
+ } from "./chunk-RGEGJH6R.js";
8
8
  import {
9
9
  RUNS_CAPABILITY,
10
10
  ScriptId
11
- } from "./chunk-F7ZQE7BT.js";
11
+ } from "./chunk-LXHF6AKU.js";
12
12
  import {
13
13
  external_exports
14
14
  } from "./chunk-6DSSLS7I.js";
@@ -2054,6 +2054,21 @@ var Runner = class {
2054
2054
  * not restarted unless a person asks for it (`byUser`).
2055
2055
  * @throws Error when the task cannot start again (e.g. its resources are busy).
2056
2056
  */
2057
+ async repair(runId, scriptId, taskId) {
2058
+ const original = this.#run(runId);
2059
+ if (original.info.scriptId !== scriptId || original.info.taskId !== taskId)
2060
+ throw new Error("\u8865\u507F\u76EE\u6807\u4E0E\u539F\u8FD0\u884C\u7684\u811A\u672C\u6216\u4EFB\u52A1\u4E0D\u4E00\u81F4");
2061
+ if (original.info.endedAt === void 0 || original.info.state === "succeeded")
2062
+ throw new Error("\u53EA\u80FD\u8865\u507F\u5DF2\u7ED3\u675F\u4E14\u672A\u6210\u529F\u7684\u8FD0\u884C");
2063
+ const pending = this.#successors.get(runId);
2064
+ if (pending) {
2065
+ const successor = await pending;
2066
+ if (successor)
2067
+ return successor;
2068
+ throw new Error("\u5148\u524D\u7684\u8865\u507F\u672A\u80FD\u542F\u52A8\uFF0C\u8BF7\u68C0\u67E5\u8FD0\u884C\u8BB0\u5F55\u540E\u91CD\u8BD5");
2069
+ }
2070
+ return this.restart(runId, "\u9488\u5BF9\u539F\u8FD0\u884C\u7684\u8865\u507F");
2071
+ }
2057
2072
  async restart(runId, reason, options = {}) {
2058
2073
  const run = this.#run(runId);
2059
2074
  if (run.mode !== "task")
@@ -2072,7 +2087,12 @@ var Runner = class {
2072
2087
  throw new Error("\u8FD9\u6B21\u8FD0\u884C\u5DF2\u7ECF\u88AB\u505C\u6B62\u4E86\uFF0C\u4E0D\u518D\u91CD\u65B0\u8FD0\u884C");
2073
2088
  return this.start(run.info.scriptId, run.info.taskId, run.info.params, { retryOf: runId, profile: run.info.profile, signal: abort.signal });
2074
2089
  })();
2075
- this.#successors.set(runId, next.catch(() => void 0));
2090
+ const successor = next.catch(() => {
2091
+ if (this.#successors.get(runId) === successor)
2092
+ this.#successors.delete(runId);
2093
+ return void 0;
2094
+ });
2095
+ this.#successors.set(runId, successor);
2076
2096
  return next;
2077
2097
  }
2078
2098
  /**
@@ -2722,6 +2742,7 @@ function runnerTools(runner, config) {
2722
2742
  task: { type: "string", description: "\u4EFB\u52A1 id\uFF08script_tasks \u53EF\u67E5\uFF09\u3002" },
2723
2743
  params: { ...PARAMS_SCHEMA, description: '\u4EFB\u52A1\u53C2\u6570\uFF0C\u4F8B\u5982 [{"name":"stage","value":"1-7"}]\uFF1B\u7701\u7565\u7684\u53C2\u6570\u7528\u9ED8\u8BA4\u503C\u3002' },
2724
2744
  wait: { type: "boolean", description: "\u7B49\u8FD0\u884C\u7ED3\u675F\u518D\u8FD4\u56DE\uFF08\u6700\u957F 3 \u5C0F\u65F6\uFF09\u3002" },
2745
+ repair_of: { type: "string", description: "\u8865\u507F\u67D0\u4E2A\u5DF2\u5931\u8D25\u7684\u8FD0\u884C\u65F6\uFF0C\u4F20\u5B83\u7684 run_id\u3002\u6CBF\u7528\u539F\u53C2\u6570\u548C\u914D\u7F6E\uFF0C\u91CD\u590D\u8BF7\u6C42\u8FD4\u56DE\u540C\u4E00\u8865\u507F\u3002" },
2725
2746
  profile: { ...profile, description: "\u7528\u54EA\u4EFD\u914D\u7F6E\u8FD0\u884C\uFF08script_profiles \u53EF\u67E5\uFF09\uFF1B\u4E0D\u586B\u5C31\u662F\u5F53\u524D\u90A3\u4EFD\u3002\u7528\u6237\u8BF4\u300C\u7528\u5C0F\u53F7\u7684\u914D\u7F6E\u300D\u4E4B\u7C7B\u65F6\u586B\u3002" }
2726
2747
  },
2727
2748
  required: ["id", "task"],
@@ -2729,9 +2750,11 @@ function runnerTools(runner, config) {
2729
2750
  kind: "execute",
2730
2751
  title: (a) => `\u8FD0\u884C\uFF1A${String(a["id"] ?? "")} / ${String(a["task"] ?? "")}`,
2731
2752
  execute: async (args, exec) => {
2732
- const a = parse(external_exports.object({ id: ScriptId, task: external_exports.string().min(1).max(64), params: external_exports.array(external_exports.object({ name: external_exports.string().min(1), value: external_exports.string() })).max(40).nullish(), wait: external_exports.boolean().nullish(), profile: Profile }), args);
2753
+ const a = parse(external_exports.object({ id: ScriptId, task: external_exports.string().min(1).max(64), params: external_exports.array(external_exports.object({ name: external_exports.string().min(1), value: external_exports.string() })).max(40).nullish(), wait: external_exports.boolean().nullish(), repair_of: external_exports.string().min(1).nullish(), profile: Profile }), args);
2733
2754
  const spec = config.library.packOf(a.id)?.manifest.tasks.find((t) => t.id === a.task)?.params ?? {};
2734
- const started = await runner.start(a.id, a.task, taskParams(a.params, spec), { profile: ref(a.profile) });
2755
+ if (a.repair_of && (a.params?.length || a.profile))
2756
+ throw new Error("\u8865\u507F\u6CBF\u7528\u539F\u8FD0\u884C\u7684\u53C2\u6570\u548C\u914D\u7F6E");
2757
+ const started = a.repair_of ? await runner.repair(a.repair_of, a.id, a.task) : await runner.start(a.id, a.task, taskParams(a.params, spec), { profile: ref(a.profile) });
2735
2758
  if (a.wait !== true || started.endedAt !== void 0)
2736
2759
  return brief(runner, started.id);
2737
2760
  const onAbort = () => void runner.stop(started.id);
package/lib/emulator.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  EMULATORS_CAPABILITY,
11
11
  EmulatorSettings
12
- } from "./chunk-F7ZQE7BT.js";
12
+ } from "./chunk-LXHF6AKU.js";
13
13
  import {
14
14
  external_exports
15
15
  } from "./chunk-6DSSLS7I.js";
package/lib/feishu.js CHANGED
@@ -2,7 +2,7 @@ import { createRequire as __adgCreateRequire } from 'node:module'; import { dirn
2
2
  import {
3
3
  replyMarkdown,
4
4
  replyPlain
5
- } from "./chunk-YSTZL6HE.js";
5
+ } from "./chunk-6YPSKAQ5.js";
6
6
  import {
7
7
  require_extension,
8
8
  require_permessage_deflate,
@@ -12,8 +12,8 @@ import {
12
12
  require_subprotocol,
13
13
  require_websocket,
14
14
  require_websocket_server
15
- } from "./chunk-OFVGRKTD.js";
16
- import "./chunk-52LYI7WP.js";
15
+ } from "./chunk-DSWWQWQH.js";
16
+ import "./chunk-KMVQK5CI.js";
17
17
  import {
18
18
  writeFileAtomic
19
19
  } from "./chunk-RESS7WVY.js";
@@ -22,7 +22,7 @@ import {
22
22
  FEISHU_SECRET_REF,
23
23
  FeishuPending,
24
24
  FeishuSettings
25
- } from "./chunk-F7ZQE7BT.js";
25
+ } from "./chunk-LXHF6AKU.js";
26
26
  import {
27
27
  external_exports
28
28
  } from "./chunk-6DSSLS7I.js";