dsh-multigameassistant 2.1.1 → 2.2.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.
Files changed (45) hide show
  1. package/cordis.patch.yml +16 -1
  2. package/lib/analyzer.js +37 -81
  3. package/lib/browser.js +1 -1
  4. package/lib/{chunk-FBDVN6Q2.js → chunk-52LYI7WP.js} +1 -1
  5. package/lib/{chunk-SHTX4AGU.js → chunk-6DSSLS7I.js} +26 -0
  6. package/lib/{chunk-VOTN4IHB.js → chunk-EOZKHLHK.js} +3 -3
  7. package/lib/{chunk-NM6H6WCQ.js → chunk-F7ZQE7BT.js} +291 -18
  8. package/lib/{chunk-5PDYWE24.js → chunk-IBPJC6DX.js} +153 -5
  9. package/lib/chunk-NOZCFSQP.js +22944 -0
  10. package/lib/chunk-NOZCFSQP.js.LEGAL.txt +8 -0
  11. package/lib/{chunk-MQG5FLOG.js → chunk-OFVGRKTD.js} +667 -39
  12. package/lib/{chunk-UQLHGLMP.js → chunk-YSTZL6HE.js} +11 -3
  13. package/lib/emulator.js +2 -2
  14. package/lib/feishu.js +5 -5
  15. package/lib/game-intel.js +531 -67
  16. package/lib/gateway.js +14 -6
  17. package/lib/guard.js +2 -2
  18. package/lib/intervene.js +8 -6
  19. package/lib/low-context.js +3 -3
  20. package/lib/monitor.js +4 -4
  21. package/lib/notify.js +5 -5
  22. package/lib/orchestrator.js +8 -8
  23. package/lib/qqbot.js +5 -5
  24. package/lib/runner.js +4 -4
  25. package/lib/scheduler.js +2 -2
  26. package/lib/script-registry.js +33 -3705
  27. package/lib/webapi-GDSF5EWP.js +2481 -0
  28. package/package.json +1 -1
  29. package/skills/game-intel.md +12 -3
  30. package/skills/script-analysis.md +30 -3
  31. package/skills/web-reading.md +52 -15
  32. package/web/assets/index-BBPTH2CM.css +1 -0
  33. package/web/assets/index-DRxvDcu6.js +245 -0
  34. package/web/assets/index-DRxvDcu6.js.map +1 -0
  35. package/web/index.html +2 -2
  36. package/lib/chunk-RFCFA5P5.js +0 -11
  37. package/lib/games/arknights/game.yaml +0 -36
  38. package/lib/games/endfield/game.yaml +0 -25
  39. package/lib/games/starrail/game.yaml +0 -33
  40. package/lib/packs/maa/adg.script.yaml +0 -220
  41. package/lib/packs/maaend/adg.script.yaml +0 -160
  42. package/lib/packs/march7th/adg.script.yaml +0 -216
  43. package/web/assets/index-CL3SeTW9.css +0 -1
  44. package/web/assets/index-GYwpGP3f.js +0 -244
  45. package/web/assets/index-GYwpGP3f.js.map +0 -1
@@ -2,10 +2,10 @@ import { createRequire as __adgCreateRequire } from 'node:module'; import { dirn
2
2
  import {
3
3
  ScriptFamily,
4
4
  ScriptId
5
- } from "./chunk-NM6H6WCQ.js";
5
+ } from "./chunk-F7ZQE7BT.js";
6
6
  import {
7
7
  external_exports
8
- } from "./chunk-SHTX4AGU.js";
8
+ } from "./chunk-6DSSLS7I.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require,
@@ -7589,6 +7589,49 @@ var Guide = external_exports.object({
7589
7589
  tag: external_exports.string().optional()
7590
7590
  })).default([])
7591
7591
  });
7592
+ var MCP_SERVER_NAME = /^[A-Za-z0-9_-]{1,32}$/;
7593
+ var McpServer = external_exports.object({
7594
+ name: external_exports.string().regex(MCP_SERVER_NAME, "letters, digits, _ and -, at most 32"),
7595
+ /** The entry in one of the script's MCP config files (`.mcp.json`, `.vscode/mcp.json`…): `server` defaults to `name`. */
7596
+ from: external_exports.object({ file: RelativePath, server: external_exports.string().min(1).optional() }).optional(),
7597
+ /** `stdio`: a program the app starts; `http` (Streamable HTTP) / `sse`: a service at `url`. */
7598
+ transport: external_exports.enum(["stdio", "http", "sse"]).optional(),
7599
+ command: external_exports.string().min(1).optional(),
7600
+ args: external_exports.array(external_exports.string()).optional(),
7601
+ env: external_exports.record(external_exports.string(), external_exports.string()).optional(),
7602
+ cwd: RelativePath.optional(),
7603
+ url: external_exports.string().regex(/^https?:\/\//, "an http(s) URL").optional(),
7604
+ headers: external_exports.record(external_exports.string(), external_exports.string()).optional(),
7605
+ /** The service runs inside the script's own program: start the script (its window or a task) before connecting. */
7606
+ needsRunning: external_exports.boolean().default(false),
7607
+ /** What the server can do, for the agent. */
7608
+ description: external_exports.string().optional()
7609
+ }).superRefine((server, issues) => {
7610
+ if (server.from !== void 0)
7611
+ return;
7612
+ if (server.transport === void 0)
7613
+ issues.addIssue({ code: "custom", path: ["transport"], message: "give transport (stdio, http or sse), or from: the script's MCP config file" });
7614
+ else if (server.transport === "stdio" && server.command === void 0)
7615
+ issues.addIssue({ code: "custom", path: ["command"], message: "a stdio server needs command" });
7616
+ else if (server.transport !== "stdio" && server.url === void 0)
7617
+ issues.addIssue({ code: "custom", path: ["url"], message: `a ${server.transport} server needs url` });
7618
+ });
7619
+ var Mcp = external_exports.object({
7620
+ servers: external_exports.array(McpServer).default([]),
7621
+ /** For the agent: what to do over MCP rather than with tasks, in which order, what to check first. */
7622
+ usage: external_exports.string().optional(),
7623
+ /** Notes on particular tools: what each is for, its arguments, the task it stands for. */
7624
+ tools: external_exports.array(external_exports.object({
7625
+ name: external_exports.string().min(1),
7626
+ /** Which server's (default: the only one). */
7627
+ server: external_exports.string().regex(MCP_SERVER_NAME).optional(),
7628
+ use: external_exports.string().min(1),
7629
+ /** The pack task it does the same as, by id. */
7630
+ task: external_exports.string().optional()
7631
+ })).default([]),
7632
+ /** Why `servers` is empty though the script has MCP configuration. */
7633
+ note: external_exports.string().optional()
7634
+ });
7592
7635
  function declaresFile(files, file) {
7593
7636
  const norm = (p) => p.replace(/\\/g, "/").toLowerCase();
7594
7637
  return files.some((f) => {
@@ -7651,6 +7694,8 @@ var ScriptManifest = external_exports.object({
7651
7694
  game: Game.optional(),
7652
7695
  /** The user guide shown on the 脚本 page. */
7653
7696
  guide: Guide.optional(),
7697
+ /** The script's MCP servers and how the agent drives the script through them. */
7698
+ mcp: Mcp.optional(),
7654
7699
  intervention: open.optional(),
7655
7700
  update: open.optional()
7656
7701
  }).superRefine((manifest, issues) => {
@@ -7667,6 +7712,25 @@ var ScriptManifest = external_exports.object({
7667
7712
  if (!tags.has(entry.on))
7668
7713
  issues.addIssue({ code: "custom", path: ["recovery", index, "on"], message: `no log rule has tag ${entry.on} (use a rule tag, stalled or failed)` });
7669
7714
  });
7715
+ const mcp = manifest.mcp;
7716
+ if (mcp !== void 0) {
7717
+ const names = /* @__PURE__ */ new Set();
7718
+ mcp.servers.forEach((server, index) => {
7719
+ if (names.has(server.name))
7720
+ issues.addIssue({ code: "custom", path: ["mcp", "servers", index, "name"], message: `duplicate MCP server ${server.name}` });
7721
+ names.add(server.name);
7722
+ });
7723
+ mcp.tools.forEach((tool, index) => {
7724
+ if (tool.server !== void 0 && !names.has(tool.server))
7725
+ issues.addIssue({ code: "custom", path: ["mcp", "tools", index, "server"], message: `no MCP server ${tool.server}` });
7726
+ if (tool.server === void 0 && names.size > 1)
7727
+ issues.addIssue({ code: "custom", path: ["mcp", "tools", index, "server"], message: "several MCP servers: say which one" });
7728
+ if (tool.task !== void 0 && !ids.has(tool.task))
7729
+ issues.addIssue({ code: "custom", path: ["mcp", "tools", index, "task"], message: `no task ${tool.task}` });
7730
+ });
7731
+ if (mcp.servers.length === 0 && (mcp.note ?? "").trim() === "")
7732
+ issues.addIssue({ code: "custom", path: ["mcp", "note"], message: "no MCP servers: say why in note" });
7733
+ }
7670
7734
  const guide = manifest.guide;
7671
7735
  if (guide === void 0)
7672
7736
  return;
@@ -7950,15 +8014,20 @@ var SraSource = external_exports.object({
7950
8014
  locale: external_exports.string().regex(/^[a-z]{2}-[A-Z]{2}$/).optional(),
7951
8015
  api: Url.default("https://starrailassistant.top/api/v1")
7952
8016
  });
8017
+ var SteamSource = external_exports.object({
8018
+ /** The game's Steam app id (the number in store.steampowered.com/app/<id>/). */
8019
+ appid: external_exports.number().int().positive()
8020
+ });
7953
8021
  var GameSource = external_exports.object({
7954
8022
  id: Id,
7955
8023
  name: external_exports.string().min(1),
7956
8024
  /** Where a person (or the agent, with web_fetch) reads it. */
7957
8025
  homepage: Url.optional(),
7958
- /** Read by the plugin itself (smw or sra); without either the source is only for the agent. */
8026
+ /** Read by the plugin itself (smw, sra or steam); without one the source is only for the agent. */
7959
8027
  smw: SmwSource.optional(),
7960
- sra: SraSource.optional()
7961
- }).refine((s) => s.smw === void 0 || s.sra === void 0, "smw \u548C sra \u53EA\u80FD\u5199\u4E00\u4E2A");
8028
+ sra: SraSource.optional(),
8029
+ steam: SteamSource.optional()
8030
+ }).refine((s) => [s.smw, s.sra, s.steam].filter((x) => x !== void 0).length <= 1, "smw\u3001sra \u548C steam \u53EA\u80FD\u5199\u4E00\u4E2A");
7962
8031
  var GameManifest = external_exports.object({
7963
8032
  id: Id,
7964
8033
  name: external_exports.string().min(1),
@@ -7977,6 +8046,11 @@ var GameManifest = external_exports.object({
7977
8046
  window: external_exports.string().min(1).optional()
7978
8047
  }).optional(),
7979
8048
  sources: external_exports.array(GameSource).default([]),
8049
+ /**
8050
+ * A single-player game: no timed events, so its page leads with its
8051
+ * announcements (version updates, patch notes, long-term notices).
8052
+ */
8053
+ single: external_exports.boolean().optional(),
7980
8054
  /** A picture for the game (https), shown when the data sites give none that loads. */
7981
8055
  art: Url.refine((u) => u.startsWith("https://"), "https").optional()
7982
8056
  });
@@ -7996,6 +8070,77 @@ function parseGameManifest(text, file = GAME_MANIFEST_FILE) {
7996
8070
  return parsed.data;
7997
8071
  }
7998
8072
 
8073
+ // packages/pack-schema/lib/jsonc.js
8074
+ function stripJsonc(source) {
8075
+ let out = "";
8076
+ let i = 0;
8077
+ let inString = false;
8078
+ while (i < source.length) {
8079
+ const c = source[i];
8080
+ const next = source[i + 1];
8081
+ if (inString) {
8082
+ out += c;
8083
+ if (c === "\\" && next !== void 0) {
8084
+ out += next;
8085
+ i += 2;
8086
+ continue;
8087
+ }
8088
+ if (c === '"')
8089
+ inString = false;
8090
+ i += 1;
8091
+ continue;
8092
+ }
8093
+ if (c === '"') {
8094
+ inString = true;
8095
+ out += c;
8096
+ i += 1;
8097
+ continue;
8098
+ }
8099
+ if (c === "/" && next === "/") {
8100
+ while (i < source.length && source[i] !== "\n")
8101
+ i += 1;
8102
+ continue;
8103
+ }
8104
+ if (c === "/" && next === "*") {
8105
+ const end = source.indexOf("*/", i + 2);
8106
+ i = end < 0 ? source.length : end + 2;
8107
+ continue;
8108
+ }
8109
+ out += c;
8110
+ i += 1;
8111
+ }
8112
+ return removeTrailingCommas(out);
8113
+ }
8114
+ function removeTrailingCommas(text) {
8115
+ let out = "";
8116
+ let inString = false;
8117
+ for (let i = 0; i < text.length; i++) {
8118
+ const c = text[i];
8119
+ if (inString) {
8120
+ out += c;
8121
+ if (c === "\\")
8122
+ out += text[++i] ?? "";
8123
+ else if (c === '"')
8124
+ inString = false;
8125
+ continue;
8126
+ }
8127
+ if (c === '"')
8128
+ inString = true;
8129
+ if (c === ",") {
8130
+ let j = i + 1;
8131
+ while (j < text.length && /\s/.test(text[j]))
8132
+ j++;
8133
+ if (text[j] === "}" || text[j] === "]")
8134
+ continue;
8135
+ }
8136
+ out += c;
8137
+ }
8138
+ return out;
8139
+ }
8140
+ function parseJsonc(source) {
8141
+ return JSON.parse(stripJsonc(source.replace(/^/, "")));
8142
+ }
8143
+
7999
8144
  // packages/pack-schema/lib/render.js
8000
8145
  var TaskInputError = class extends Error {
8001
8146
  constructor(message) {
@@ -8177,6 +8322,7 @@ var MANIFEST_FILE = "adg.script.yaml";
8177
8322
  var SKILL_FILE = "SKILL.md";
8178
8323
 
8179
8324
  export {
8325
+ MCP_SERVER_NAME,
8180
8326
  guideView,
8181
8327
  guideIssues,
8182
8328
  TaskInputError,
@@ -8187,6 +8333,8 @@ export {
8187
8333
  GAME_MANIFEST_FILE,
8188
8334
  GAME_GUIDE_FILE,
8189
8335
  parseGameManifest,
8336
+ stripJsonc,
8337
+ parseJsonc,
8190
8338
  globToRegExp,
8191
8339
  versionOfTag,
8192
8340
  chooseAsset,