dsh-multigameassistant 2.1.1 → 2.2.0

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-5PDYWE24.js → chunk-26JIEF6M.js} +153 -5
  5. package/lib/{chunk-SHTX4AGU.js → chunk-6DSSLS7I.js} +26 -0
  6. package/lib/{chunk-VOTN4IHB.js → chunk-EKTA4OYC.js} +3 -3
  7. package/lib/{chunk-UQLHGLMP.js → chunk-I4NHWXKH.js} +3 -3
  8. package/lib/{chunk-FBDVN6Q2.js → chunk-ICJLH3DP.js} +1 -1
  9. package/lib/chunk-J4QJC6UZ.js +22944 -0
  10. package/lib/chunk-J4QJC6UZ.js.LEGAL.txt +8 -0
  11. package/lib/{chunk-MQG5FLOG.js → chunk-KTOQFJ7R.js} +381 -36
  12. package/lib/{chunk-NM6H6WCQ.js → chunk-NEUZQ7TI.js} +237 -16
  13. package/lib/emulator.js +2 -2
  14. package/lib/feishu.js +5 -5
  15. package/lib/game-intel.js +454 -57
  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 +9 -1
  30. package/skills/script-analysis.md +30 -3
  31. package/skills/web-reading.md +7 -2
  32. package/web/assets/index-C5cMI4PK.css +1 -0
  33. package/web/assets/index-ClYIoZUR.js +244 -0
  34. package/web/assets/index-ClYIoZUR.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
package/cordis.patch.yml CHANGED
@@ -1,4 +1,4 @@
1
- # dsh-multigameassistant 2.1.1
1
+ # dsh-multigameassistant 2.2.0
2
2
  # dsh-multigameassistant: the app's plugins (packages/bundle/cordis.patch.yml, each @adg/<plugin> as dsh-multigameassistant/<plugin>)
3
3
  # sharing the dsh with the person's other chats, and the app's agent preset (dsh's standard one with the app's
4
4
  # tools and prompts, and compaction as 设置 → 对话压缩 says). No row of dsh is restated.
@@ -182,6 +182,10 @@
182
182
  - id: skill-filesystem
183
183
  name: '@deepseek-ai/dsh-skill-filesystem'
184
184
  config:
185
+ # The app's agents read their own skills only, not the folders other agents on the machine share
186
+ # (~/.agents/skills, ~/.dsh/skills, a working folder's .agents/skills or .dsh/skills); dsh's bundled ones stay.
187
+ includeDefaultRoots: false
188
+ bundledSkillDir: !!js "process.env.DSH_BUNDLED_SKILL_DIR || undefined"
185
189
  customSkillDirs:
186
190
  - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
187
191
  - id: tool-skill
@@ -225,6 +229,9 @@
225
229
  auto: !!js "(() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().auto !== false"
226
230
  thresholdRatio: !!js "(Math.min(100, Math.max(5, Number((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().threshold) || 80)) / 100)"
227
231
  retainRatio: !!js "Math.min(0.16, (Math.min(100, Math.max(5, Number((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().threshold) || 80)) / 100) / 2)"
232
+ summarizationProvider: !!js "(s => s !== null && typeof s === 'object' && typeof s.provider === 'string' && s.provider !== '' && typeof s.model === 'string' && s.model !== '' ? s : undefined)((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().summarizer)?.provider ?? ''"
233
+ summarizationModel: !!js "(s => s !== null && typeof s === 'object' && typeof s.provider === 'string' && s.provider !== '' && typeof s.model === 'string' && s.model !== '' ? s : undefined)((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().summarizer)?.model ?? ''"
234
+ maxTokens: !!js "(m => Number.isInteger(m) && m > 0 ? Math.min(m, 65536) : 65536)((s => s !== null && typeof s === 'object' && typeof s.provider === 'string' && s.provider !== '' && typeof s.model === 'string' && s.model !== '' ? s : undefined)((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().summarizer)?.maxTokens)"
228
235
  - id: adg-low-context
229
236
  name: 'dsh-multigameassistant/low-context'
230
237
  config:
@@ -331,6 +338,11 @@
331
338
  name: '@deepseek-ai/dsh-tool-schedule'
332
339
  - id: skill-filesystem
333
340
  name: '@deepseek-ai/dsh-skill-filesystem'
341
+ config:
342
+ # The app's agents read their own skills only, not the folders other agents on the machine share
343
+ # (~/.agents/skills, ~/.dsh/skills, a working folder's .agents/skills or .dsh/skills); dsh's bundled ones stay.
344
+ includeDefaultRoots: false
345
+ bundledSkillDir: !!js "process.env.DSH_BUNDLED_SKILL_DIR || undefined"
334
346
  - id: tool-skill
335
347
  name: '@deepseek-ai/dsh-tool-skill'
336
348
  - id: command-goal
@@ -372,6 +384,9 @@
372
384
  auto: !!js "(() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().auto !== false"
373
385
  thresholdRatio: !!js "(Math.min(100, Math.max(5, Number((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().threshold) || 80)) / 100)"
374
386
  retainRatio: !!js "Math.min(0.16, (Math.min(100, Math.max(5, Number((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().threshold) || 80)) / 100) / 2)"
387
+ summarizationProvider: !!js "(s => s !== null && typeof s === 'object' && typeof s.provider === 'string' && s.provider !== '' && typeof s.model === 'string' && s.model !== '' ? s : undefined)((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().summarizer)?.provider ?? ''"
388
+ summarizationModel: !!js "(s => s !== null && typeof s === 'object' && typeof s.provider === 'string' && s.provider !== '' && typeof s.model === 'string' && s.model !== '' ? s : undefined)((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().summarizer)?.model ?? ''"
389
+ maxTokens: !!js "(m => Number.isInteger(m) && m > 0 ? Math.min(m, 65536) : 65536)((s => s !== null && typeof s === 'object' && typeof s.provider === 'string' && s.provider !== '' && typeof s.model === 'string' && s.model !== '' ? s : undefined)((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().summarizer)?.maxTokens)"
375
390
  - id: adg-low-context
376
391
  name: 'dsh-multigameassistant/low-context'
377
392
  config:
package/lib/analyzer.js CHANGED
@@ -1,4 +1,9 @@
1
1
  import { createRequire as __adgCreateRequire } from 'node:module'; import { dirname as __adgDirname } from 'node:path'; import { fileURLToPath as __adgFileURLToPath } from 'node:url'; const require = __adgCreateRequire(import.meta.url); const __filename = __adgFileURLToPath(import.meta.url); const __dirname = __adgDirname(__filename);
2
+ import {
3
+ discoverMcp,
4
+ discoverSkills,
5
+ mcpEndpoints
6
+ } from "./chunk-J4QJC6UZ.js";
2
7
  import {
3
8
  probeProject
4
9
  } from "./chunk-B4UT4NYH.js";
@@ -6,17 +11,23 @@ import {
6
11
  MANIFEST_FILE,
7
12
  SKILL_FILE,
8
13
  guideIssues,
14
+ parseJsonc,
9
15
  parseManifest,
10
- require_dist
11
- } from "./chunk-5PDYWE24.js";
16
+ require_dist,
17
+ stripJsonc
18
+ } from "./chunk-26JIEF6M.js";
19
+ import "./chunk-I4NHWXKH.js";
20
+ import "./chunk-KTOQFJ7R.js";
21
+ import "./chunk-ICJLH3DP.js";
22
+ import "./chunk-RESS7WVY.js";
12
23
  import {
13
24
  BUILTIN_PACK_VERSION,
14
25
  PACKS_CAPABILITY,
15
26
  ScriptId
16
- } from "./chunk-NM6H6WCQ.js";
27
+ } from "./chunk-NEUZQ7TI.js";
17
28
  import {
18
29
  external_exports
19
- } from "./chunk-SHTX4AGU.js";
30
+ } from "./chunk-6DSSLS7I.js";
20
31
  import {
21
32
  __toESM
22
33
  } from "./chunk-2UFLGPDY.js";
@@ -32,77 +43,6 @@ import { Service } from "@deepseek-ai/cordis";
32
43
  import { readdir, readFile as readFile2, stat } from "node:fs/promises";
33
44
  import { extname, join as join2, relative } from "node:path";
34
45
 
35
- // packages/analyzer/lib/jsonc.js
36
- function stripJsonc(source) {
37
- let out = "";
38
- let i = 0;
39
- let inString = false;
40
- while (i < source.length) {
41
- const c = source[i];
42
- const next = source[i + 1];
43
- if (inString) {
44
- out += c;
45
- if (c === "\\" && next !== void 0) {
46
- out += next;
47
- i += 2;
48
- continue;
49
- }
50
- if (c === '"')
51
- inString = false;
52
- i += 1;
53
- continue;
54
- }
55
- if (c === '"') {
56
- inString = true;
57
- out += c;
58
- i += 1;
59
- continue;
60
- }
61
- if (c === "/" && next === "/") {
62
- while (i < source.length && source[i] !== "\n")
63
- i += 1;
64
- continue;
65
- }
66
- if (c === "/" && next === "*") {
67
- const end = source.indexOf("*/", i + 2);
68
- i = end < 0 ? source.length : end + 2;
69
- continue;
70
- }
71
- out += c;
72
- i += 1;
73
- }
74
- return removeTrailingCommas(out);
75
- }
76
- function removeTrailingCommas(text) {
77
- let out = "";
78
- let inString = false;
79
- for (let i = 0; i < text.length; i++) {
80
- const c = text[i];
81
- if (inString) {
82
- out += c;
83
- if (c === "\\")
84
- out += text[++i] ?? "";
85
- else if (c === '"')
86
- inString = false;
87
- continue;
88
- }
89
- if (c === '"')
90
- inString = true;
91
- if (c === ",") {
92
- let j = i + 1;
93
- while (j < text.length && /\s/.test(text[j]))
94
- j++;
95
- if (text[j] === "}" || text[j] === "]")
96
- continue;
97
- }
98
- out += c;
99
- }
100
- return out;
101
- }
102
- function parseJsonc(source) {
103
- return JSON.parse(stripJsonc(source.replace(/^/, "")));
104
- }
105
-
106
46
  // packages/analyzer/lib/maafw.js
107
47
  import { readFile } from "node:fs/promises";
108
48
  import { dirname, join } from "node:path";
@@ -546,7 +486,7 @@ var AdgAnalyzer = class extends Service {
546
486
  disposers.push(scoped.adgGateway.generalSkill({ ...guide, source: "bundled" }, () => scoped.skills.register({ ...guide, source: "bundled" })));
547
487
  const { scripts: inLibrary } = library.list();
548
488
  for (const pack of library.packs()) {
549
- if (pack.skill === void 0)
489
+ if (pack.skill === void 0 || pack.hub === true)
550
490
  continue;
551
491
  const skill = parseSkill(pack.skill, pack.manifest.id);
552
492
  if (skill === void 0) {
@@ -558,7 +498,7 @@ var AdgAnalyzer = class extends Service {
558
498
  ...pack.manifest.game?.name === void 0 ? {} : { games: [pack.manifest.game.name] }
559
499
  };
560
500
  try {
561
- disposers.push(scoped.adgGateway.skillScope.register({ ...skill, source: pack.builtin ? "bundled" : "custom", path: join4(pack.dir, SKILL_FILE), resourceBase: { kind: "directory", path: pack.dir }, owner }));
501
+ disposers.push(scoped.adgGateway.skillScope.register({ ...skill, source: pack.builtin ? "bundled" : "custom", path: join4(pack.dir, SKILL_FILE), resourceBase: { kind: "directory", path: pack.dir }, owner, kind: "script-pack", pack: pack.manifest.id, ...library.isOwnPack(pack.manifest.id) ? { ownPack: true } : {} }));
562
502
  } catch (error) {
563
503
  log.warn(`pack ${pack.manifest.id}: skill not registered: ${error instanceof Error ? error.message : String(error)}`);
564
504
  }
@@ -637,7 +577,7 @@ var AdgAnalyzer = class extends Service {
637
577
  const { packId, version } = params;
638
578
  if (version === BUILTIN_PACK_VERSION) {
639
579
  if (library.pack(packId)?.over === void 0)
640
- throw new Error(`${packId} \u6CA1\u6709\u5185\u7F6E\u7684\u811A\u672C\u5305\u53EF\u4EE5\u6062\u590D`);
580
+ throw new Error(`${packId} \u6CA1\u6709\u5B98\u65B9\u7684\u811A\u672C\u5305\u53EF\u4EE5\u6062\u590D`);
641
581
  await drafts.discard(packId);
642
582
  } else {
643
583
  await drafts.restore(packId, version);
@@ -716,10 +656,21 @@ function analyzerTools(deps) {
716
656
  const manifest = pack === void 0 ? void 0 : await readFile4(join4(pack.dir, MANIFEST_FILE), "utf8").catch(() => void 0);
717
657
  const repo = script.channels.github?.repo;
718
658
  const online = [...repo === void 0 ? [] : [`https://github.com/${repo}`, `https://github.com/${repo}/wiki`], ...report.docLinks];
659
+ const found = await discoverMcp(script.dir);
660
+ const servers = mcpEndpoints(script.dir, found, void 0, false);
661
+ const skills = await discoverSkills(script.dir).catch(() => []);
719
662
  return {
720
663
  script: { id: script.id, name: script.name, source: script.source, family: script.family },
721
664
  ...report,
722
665
  docLinks: [...new Set(online)],
666
+ mcp: servers.length === 0 ? null : {
667
+ servers: servers.map((e) => ({ name: e.name, file: e.file, server: e.server, transport: e.transport, ...e.transport === "stdio" ? { command: e.command, args: e.args } : { url: e.url }, ...e.problem === void 0 ? {} : { problem: e.problem } })),
668
+ todo: "\u8FD9\u4E2A\u811A\u672C\u6709 MCP \u670D\u52A1\uFF1A\u811A\u672C\u5305\u8981\u5199 mcp \u4E00\u8282\uFF08servers \u7528 from \u6307\u5411\u5B83\u7684\u914D\u7F6E\u6587\u4EF6\uFF1B\u7528 script_mcp_tools \u8FDE\u4E0A\u770B\u770B\u5DE5\u5177\u540E\u5199 usage \u548C tools\uFF09\uFF0CSKILL.md \u91CC\u5199\u4E00\u8282\u300CMCP\u300D\u8BF4\u660E\u4EC0\u4E48\u65F6\u5019\u7528 MCP\u3001\u4EC0\u4E48\u65F6\u5019\u7528 script_run\uFF08\u89C1 script-analysis \u6280\u80FD\u300CMCP\u300D\u4E00\u8282\uFF09"
669
+ },
670
+ skills: skills.length === 0 ? null : {
671
+ items: skills.map((k) => ({ name: k.name, description: k.description, path: k.path, ...k.problem === void 0 ? {} : { problem: k.problem } })),
672
+ todo: "\u8FD9\u4E2A\u811A\u672C\u81EA\u5E26\u6280\u80FD\uFF1A\u8BFB\u4E00\u8BFB\u5B83\u4EEC\uFF0CSKILL.md \u91CC\u63D0\u4E00\u53E5\uFF1B\u7528\u6237\u60F3\u7528\u65F6\u7528 script_skills_import \u653E\u8FDB\u6280\u80FD\u5E93"
673
+ },
723
674
  readFirst: "\u5148\u8BFB\u6587\u6863\uFF08docs \u91CC\u7684\u6587\u4EF6\u3001readme\u3001docLinks \u91CC\u7684\u7F51\u9875\uFF09\uFF0C\u518D\u7ED3\u5408\u4EE3\u7801\u548C\u914D\u7F6E\u6838\u5BF9\u3001\u8865\u5168\uFF1B\u53EA\u6709\u5B8C\u5168\u627E\u4E0D\u5230\u6587\u6863\u65F6\u624D\u76F4\u63A5\u4ECE\u4EE3\u7801\u5206\u6790\u3002",
724
675
  currentPack: pack === void 0 ? null : { id: pack.manifest.id, builtin: pack.builtin, manifest, skill: pack.skill }
725
676
  };
@@ -727,7 +678,7 @@ function analyzerTools(deps) {
727
678
  }),
728
679
  tool({
729
680
  name: "script_help",
730
- description: "\u8FD0\u884C\u811A\u672C\u7A0B\u5E8F\u7684\u5E2E\u52A9\u53C2\u6570\uFF08\u9ED8\u8BA4 --help\uFF09\uFF0C\u62FF\u5230\u5B83\u81EA\u5DF1\u8BF4\u660E\u7684\u547D\u4EE4\u548C\u4EFB\u52A1\u3002\u6700\u591A\u8FD0\u884C 20 \u79D2\u540E\u7ED3\u675F\u3002\u6CA1\u6709\u5185\u7F6E\u811A\u672C\u5305\u7684\u811A\u672C\u4F1A\u5148\u8BF7\u7528\u6237\u786E\u8BA4\uFF0C\u56E0\u4E3A\u8FD9\u4F1A\u542F\u52A8\u5B83\u7684\u7A0B\u5E8F\u3002",
681
+ description: "\u8FD0\u884C\u811A\u672C\u7A0B\u5E8F\u7684\u5E2E\u52A9\u53C2\u6570\uFF08\u9ED8\u8BA4 --help\uFF09\uFF0C\u62FF\u5230\u5B83\u81EA\u5DF1\u8BF4\u660E\u7684\u547D\u4EE4\u548C\u4EFB\u52A1\u3002\u6700\u591A\u8FD0\u884C 20 \u79D2\u540E\u7ED3\u675F\u3002\u6CA1\u6709\u5B98\u65B9\u811A\u672C\u5305\uFF08\u6280\u80FD\u5E93\u4E0B\u8F7D\u7684\uFF09\u7684\u811A\u672C\u4F1A\u5148\u8BF7\u7528\u6237\u786E\u8BA4\uFF0C\u56E0\u4E3A\u8FD9\u4F1A\u542F\u52A8\u5B83\u7684\u7A0B\u5E8F\u3002",
731
682
  properties: {
732
683
  id,
733
684
  exe: { type: "string", description: "\u8981\u8FD0\u884C\u7684\u7A0B\u5E8F\uFF08\u76F8\u5BF9\u811A\u672C\u76EE\u5F55\uFF09\uFF1B\u7701\u7565\u65F6\u7528\u811A\u672C\u5305\u7684\u542F\u52A8\u7A0B\u5E8F\u6216\u627E\u5230\u7684\u7B2C\u4E00\u4E2A\u53EF\u6267\u884C\u6587\u4EF6\u3002" },
@@ -788,7 +739,7 @@ function analyzerTools(deps) {
788
739
  }),
789
740
  tool({
790
741
  name: "pack_propose",
791
- description: "\u4FDD\u5B58\u811A\u672C\u5305\uFF08adg.script.yaml \u548C SKILL.md\uFF09\uFF0C\u76F4\u63A5\u751F\u6548\uFF0C\u4E0D\u7528\u7528\u6237\u518D\u786E\u8BA4\uFF1A\u65B0\u5199\u4E00\u4EFD\uFF0C\u6216\u8005\u7528\u539F\u6765\u7684 id \u6539\u5DF2\u6709\u7684\u4E00\u4EFD\uFF08\u5185\u7F6E\u7684\u3001\u7528\u6237\u786E\u8BA4\u8FC7\u7684\u90FD\u53EF\u4EE5\uFF1B\u88AB\u66FF\u6362\u7684\u90A3\u4E00\u7248\u7559\u5728\u5386\u53F2\u91CC\uFF09\u3002\u4F1A\u6309 schema \u6821\u9A8C\uFF0C\u5E76\u68C0\u67E5 manifest \u91CC\u7ED9\u7528\u6237\u770B\u7684\u4F7F\u7528\u8BF4\u660E\uFF08guide\u3001\u4EFB\u52A1\u548C\u53C2\u6570\u7684 description\u3001\u4E34\u65F6\u4FEE\u6539\u7684 note\uFF09\uFF1A\u7F3A\u4E86\u6216\u6DF7\u8FDB\u4E86\u7ED9 agent \u7684\u5185\u5BB9\uFF08\u5DE5\u5177\u540D\u3001\u811A\u672C\u5305\u5B57\u6BB5\u3001\u5360\u4F4D\u7B26\u3001\u6838\u9A8C\u4F9D\u636E\u3001\u5F85\u786E\u8BA4\uFF09\u90FD\u4F1A\u5931\u8D25\u5E76\u8FD4\u56DE\u5177\u4F53\u4F4D\u7F6E\uFF0C\u811A\u672C\u5305\u4FDD\u6301\u539F\u6837\uFF0C\u4FEE\u6B63\u540E\u91CD\u65B0\u63D0\u4EA4\uFF1B\u901A\u8FC7\u540E\u8FD9\u4E2A\u811A\u672C\u9A6C\u4E0A\u7528\u65B0\u7684\u811A\u672C\u5305\uFF0C\u4E4B\u540E\u7684 script_run\u3001script_tasks \u90FD\u6309\u5B83\u6765\u3002\u4E0D\u4F1A\u4FEE\u6539\u811A\u672C\u672C\u8EAB\u3002",
742
+ description: "\u4FDD\u5B58\u811A\u672C\u5305\uFF08adg.script.yaml \u548C SKILL.md\uFF09\uFF0C\u76F4\u63A5\u751F\u6548\uFF0C\u4E0D\u7528\u7528\u6237\u518D\u786E\u8BA4\uFF1A\u65B0\u5199\u4E00\u4EFD\uFF0C\u6216\u8005\u7528\u539F\u6765\u7684 id \u6539\u5DF2\u6709\u7684\u4E00\u4EFD\uFF08\u5B98\u65B9\u7684\u3001\u7528\u6237\u786E\u8BA4\u8FC7\u7684\u90FD\u53EF\u4EE5\uFF1B\u88AB\u66FF\u6362\u7684\u90A3\u4E00\u7248\u7559\u5728\u5386\u53F2\u91CC\uFF09\u3002\u4F1A\u6309 schema \u6821\u9A8C\uFF0C\u5E76\u68C0\u67E5 manifest \u91CC\u7ED9\u7528\u6237\u770B\u7684\u4F7F\u7528\u8BF4\u660E\uFF08guide\u3001\u4EFB\u52A1\u548C\u53C2\u6570\u7684 description\u3001\u4E34\u65F6\u4FEE\u6539\u7684 note\uFF09\uFF1A\u7F3A\u4E86\u6216\u6DF7\u8FDB\u4E86\u7ED9 agent \u7684\u5185\u5BB9\uFF08\u5DE5\u5177\u540D\u3001\u811A\u672C\u5305\u5B57\u6BB5\u3001\u5360\u4F4D\u7B26\u3001\u6838\u9A8C\u4F9D\u636E\u3001\u5F85\u786E\u8BA4\uFF09\u90FD\u4F1A\u5931\u8D25\u5E76\u8FD4\u56DE\u5177\u4F53\u4F4D\u7F6E\uFF0C\u811A\u672C\u5305\u4FDD\u6301\u539F\u6837\uFF0C\u4FEE\u6B63\u540E\u91CD\u65B0\u63D0\u4EA4\uFF1B\u901A\u8FC7\u540E\u8FD9\u4E2A\u811A\u672C\u9A6C\u4E0A\u7528\u65B0\u7684\u811A\u672C\u5305\uFF0C\u4E4B\u540E\u7684 script_run\u3001script_tasks \u90FD\u6309\u5B83\u6765\u3002\u4E0D\u4F1A\u4FEE\u6539\u811A\u672C\u672C\u8EAB\u3002",
792
743
  properties: {
793
744
  pack_id: { type: "string", description: "\u811A\u672C\u5305 id\uFF08\u4E0E manifest \u91CC\u7684 id \u76F8\u540C\uFF1B\u6539\u8FDB\u5DF2\u6709\u811A\u672C\u5305\u65F6\u7528\u539F id\uFF09\u3002" },
794
745
  script_id: { type: "string", description: "\u8FD9\u4E2A\u5305\u63CF\u8FF0\u7684\u811A\u672C\u5E93\u91CC\u7684\u811A\u672C id\u3002" },
@@ -820,7 +771,12 @@ function analyzerTools(deps) {
820
771
  throw new Error("\u5148\u8BFB\u9879\u76EE\u7684\u6587\u6863\u518D\u5199\u811A\u672C\u5305\uFF1Adocs \u91CC\u5199\u51FA\u8BFB\u8FC7\u7684\u6587\u6863\uFF08\u51FA\u5904\u548C\u5F97\u5230\u4E86\u4EC0\u4E48\uFF09\uFF1B\u786E\u5B9E\u627E\u4E0D\u5230\u6587\u6863\u65F6\u7528 no_docs \u8BF4\u660E\u627E\u8FC7\u54EA\u4E9B\u5730\u65B9\uFF08\u811A\u672C\u76EE\u5F55\u3001\u4ED3\u5E93 README\u3001Wiki\u3001\u6587\u6863\u7AD9\uFF09");
821
772
  }
822
773
  deps.library.get(a.script_id);
823
- const issues = guideIssues(parseManifest(a.manifest, `${a.pack_id}/${MANIFEST_FILE}`));
774
+ const manifest = parseManifest(a.manifest, `${a.pack_id}/${MANIFEST_FILE}`);
775
+ const issues = guideIssues(manifest);
776
+ const dir = deps.library.get(a.script_id).dir;
777
+ if (manifest.mcp === void 0 && dir !== void 0 && (await discoverMcp(dir)).some((e) => e.disabled !== true)) {
778
+ issues.push("\u8FD9\u4E2A\u811A\u672C\u76EE\u5F55\u91CC\u6709 MCP \u914D\u7F6E\uFF1Amanifest \u8981\u5199 mcp \u4E00\u8282\u2014\u2014servers\uFF08\u7528 from \u6307\u5411\u811A\u672C\u7684\u914D\u7F6E\u6587\u4EF6\uFF09\u3001usage\uFF08\u4EC0\u4E48\u65F6\u5019\u7528 MCP\u3001\u600E\u4E48\u7528\uFF09\u548C tools\uFF08\u4E3B\u8981\u5DE5\u5177\u7684\u7528\u9014\uFF09\uFF1B\u786E\u5B9E\u7528\u4E0D\u4E86\u5C31\u5199 mcp: { servers: [], note: \u4E3A\u4EC0\u4E48 }\u3002SKILL.md \u91CC\u4E5F\u5199\u4E00\u8282\u300CMCP\u300D");
779
+ }
824
780
  if (issues.length > 0)
825
781
  throw new Error(`\u4F7F\u7528\u8BF4\u660E\u8FD8\u8981\u6539\uFF08\u6309 script-analysis \u6280\u80FD\u300C\u4F7F\u7528\u8BF4\u660E\u300D\u4E00\u8282\uFF09\uFF1A
826
782
  - ${issues.join("\n- ")}`);
package/lib/browser.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __adgCreateRequire } from 'node:module'; import { dirname as __adgDirname } from 'node:path'; import { fileURLToPath as __adgFileURLToPath } from 'node:url'; const require = __adgCreateRequire(import.meta.url); const __filename = __adgFileURLToPath(import.meta.url); const __dirname = __adgDirname(__filename);
2
2
  import {
3
3
  external_exports
4
- } from "./chunk-SHTX4AGU.js";
4
+ } from "./chunk-6DSSLS7I.js";
5
5
  import "./chunk-2UFLGPDY.js";
6
6
 
7
7
  // packages/browser/lib/client.js
@@ -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-NEUZQ7TI.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,
@@ -14518,5 +14518,31 @@ function date4(params) {
14518
14518
  config(en_default());
14519
14519
 
14520
14520
  export {
14521
+ NEVER,
14522
+ toJSONSchema,
14523
+ iso_exports,
14524
+ safeParse2 as safeParse,
14525
+ string2 as string,
14526
+ email2 as email,
14527
+ url,
14528
+ number2 as number,
14529
+ boolean2 as boolean,
14530
+ _null3 as _null,
14531
+ any,
14532
+ unknown,
14533
+ array,
14534
+ object,
14535
+ looseObject,
14536
+ union,
14537
+ discriminatedUnion,
14538
+ intersection,
14539
+ record,
14540
+ _enum2 as _enum,
14541
+ literal,
14542
+ optional,
14543
+ lazy,
14544
+ preprocess,
14545
+ ZodIssueCode,
14546
+ coerce_exports,
14521
14547
  external_exports
14522
14548
  };
@@ -4,14 +4,14 @@ import {
4
4
  guideView,
5
5
  renderTask,
6
6
  require_dist
7
- } from "./chunk-5PDYWE24.js";
7
+ } from "./chunk-26JIEF6M.js";
8
8
  import {
9
9
  RUNS_CAPABILITY,
10
10
  ScriptId
11
- } from "./chunk-NM6H6WCQ.js";
11
+ } from "./chunk-NEUZQ7TI.js";
12
12
  import {
13
13
  external_exports
14
- } from "./chunk-SHTX4AGU.js";
14
+ } from "./chunk-6DSSLS7I.js";
15
15
  import {
16
16
  __toESM
17
17
  } from "./chunk-2UFLGPDY.js";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __adgCreateRequire } from 'node:module'; import { dirname as __adgDirname } from 'node:path'; import { fileURLToPath as __adgFileURLToPath } from 'node:url'; const require = __adgCreateRequire(import.meta.url); const __filename = __adgFileURLToPath(import.meta.url); const __dirname = __adgDirname(__filename);
2
2
  import {
3
3
  convertRecord
4
- } from "./chunk-MQG5FLOG.js";
4
+ } from "./chunk-KTOQFJ7R.js";
5
5
  import {
6
6
  writeFileAtomic
7
7
  } from "./chunk-RESS7WVY.js";
@@ -20,10 +20,10 @@ import {
20
20
  threadMessage,
21
21
  threadReminder,
22
22
  threadsBetween
23
- } from "./chunk-NM6H6WCQ.js";
23
+ } from "./chunk-NEUZQ7TI.js";
24
24
  import {
25
25
  external_exports
26
- } from "./chunk-SHTX4AGU.js";
26
+ } from "./chunk-6DSSLS7I.js";
27
27
 
28
28
  // packages/notify/lib/index.js
29
29
  import { readFile } from "node:fs/promises";
@@ -4,7 +4,7 @@ import {
4
4
  LOW_CONTEXT_WINDOW_MS,
5
5
  MAX_ARCHIVE_DAYS,
6
6
  MIN_ARCHIVE_DAYS
7
- } from "./chunk-NM6H6WCQ.js";
7
+ } from "./chunk-NEUZQ7TI.js";
8
8
 
9
9
  // packages/gateway/lib/low-context.js
10
10
  import { appendFile, mkdir, readFile, stat } from "node:fs/promises";