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
@@ -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
 
6
6
  // packages/protocol/lib/emulators.js
7
7
  var EMULATORS_CAPABILITY = "emulators";
@@ -191,6 +191,8 @@ var PackSummary = external_exports.object({
191
191
  builtin: external_exports.boolean(),
192
192
  /** A script with this pack is in the library. */
193
193
  installed: external_exports.boolean(),
194
+ /** The user's own (the agent wrote it, in the user's pack directory): `scripts/packs/remove` deletes it. */
195
+ own: external_exports.boolean().optional(),
194
196
  /** Problems loading the pack, if any; the pack is skipped. */
195
197
  error: external_exports.string().optional()
196
198
  });
@@ -339,6 +341,33 @@ var InstallSettings = external_exports.object({
339
341
  autoUpdate: ScriptUpdatePolicy
340
342
  });
341
343
  var Empty = external_exports.object({});
344
+ var ScriptMcpServer = external_exports.object({
345
+ name: external_exports.string(),
346
+ /** `pack`: its pack names it; `discovered`: only in the script's own MCP config file. */
347
+ source: external_exports.enum(["pack", "discovered"]),
348
+ transport: external_exports.enum(["stdio", "http", "sse"]),
349
+ /** The program it starts, or its address. */
350
+ target: external_exports.string(),
351
+ /** The script's config file it was read from. */
352
+ file: external_exports.string().optional(),
353
+ /** Served by the script's own program while it runs. */
354
+ needsRunning: external_exports.boolean(),
355
+ description: external_exports.string().optional(),
356
+ /** Why it cannot be used as written. */
357
+ problem: external_exports.string().optional(),
358
+ /** Started without asking: a built-in pack's, or approved before. */
359
+ trusted: external_exports.boolean(),
360
+ connected: external_exports.boolean()
361
+ });
362
+ var ScriptSkillItem = external_exports.object({
363
+ name: external_exports.string(),
364
+ description: external_exports.string(),
365
+ /** Its folder in the script directory. */
366
+ path: external_exports.string(),
367
+ problem: external_exports.string().optional(),
368
+ /** Among this app's skills: under which name, whether it is the script's current version, whether it was changed here. */
369
+ imported: external_exports.object({ name: external_exports.string(), current: external_exports.boolean(), changed: external_exports.boolean() }).optional()
370
+ });
342
371
  var ById = external_exports.object({ id: ScriptId });
343
372
  var ScriptRequests = {
344
373
  /** Library, plus the packs that could be installed. */
@@ -538,11 +567,56 @@ var ScriptRequests = {
538
567
  params: external_exports.object({ id: ScriptId }),
539
568
  result: external_exports.object({ sessionId: external_exports.string() })
540
569
  },
570
+ /** Forget a script; its own script pack (one the agent wrote for it, that no other script uses) goes with it. */
541
571
  "scripts/remove": {
542
572
  capability: SCRIPTS_CAPABILITY,
543
573
  params: external_exports.object({ id: ScriptId, deleteFiles: external_exports.boolean().optional() }),
544
574
  result: Empty
545
575
  },
576
+ /**
577
+ * Delete one of the user's own script packs (`own`). Scripts it describes
578
+ * stay, without its tasks; packs from the 技能库 are deleted there.
579
+ */
580
+ "scripts/packs/remove": {
581
+ capability: SCRIPTS_CAPABILITY,
582
+ params: external_exports.object({ id: external_exports.string().min(1) }),
583
+ result: Empty
584
+ },
585
+ /**
586
+ * What the script offers agents beyond its tasks: its MCP servers (read
587
+ * from its MCP config files and its pack) and the skills it ships.
588
+ */
589
+ "scripts/mcp": {
590
+ capability: SCRIPTS_CAPABILITY,
591
+ params: ById,
592
+ result: external_exports.object({
593
+ servers: external_exports.array(ScriptMcpServer),
594
+ /** The pack's notes for the agent on using them. */
595
+ usage: external_exports.string().optional(),
596
+ note: external_exports.string().optional(),
597
+ skills: external_exports.array(ScriptSkillItem)
598
+ })
599
+ },
600
+ /** Connect to one of the script's MCP servers and list its tools (the user's click: trusted from then on). */
601
+ "scripts/mcp/probe": {
602
+ capability: SCRIPTS_CAPABILITY,
603
+ params: external_exports.object({ id: ScriptId, server: external_exports.string().min(1).max(32) }),
604
+ result: external_exports.object({
605
+ ok: external_exports.boolean(),
606
+ tools: external_exports.array(external_exports.object({ name: external_exports.string(), title: external_exports.string().optional(), description: external_exports.string().optional() })).optional(),
607
+ server: external_exports.object({ name: external_exports.string(), version: external_exports.string() }).optional(),
608
+ error: external_exports.string().optional()
609
+ })
610
+ },
611
+ /** Put the script's skills (these, or all) among this app's skills, belonging to the script. */
612
+ "scripts/skills/import": {
613
+ capability: SCRIPTS_CAPABILITY,
614
+ params: external_exports.object({ id: ScriptId, names: external_exports.array(external_exports.string().min(1).max(200)).max(50).optional() }),
615
+ result: external_exports.object({
616
+ imported: external_exports.array(external_exports.object({ skill: external_exports.string(), name: external_exports.string(), replaced: external_exports.boolean() })),
617
+ skipped: external_exports.array(external_exports.object({ skill: external_exports.string(), reason: external_exports.string() }))
618
+ })
619
+ },
546
620
  /** Check the script's runtime requirements on this machine. */
547
621
  "scripts/envCheck": {
548
622
  capability: SCRIPTS_CAPABILITY,
@@ -1068,6 +1142,30 @@ var PipelineSchedule = external_exports.object({
1068
1142
  /** Also run when this other pipeline finishes successfully. */
1069
1143
  after: PipelineId.optional()
1070
1144
  });
1145
+ var DAY_NAMES = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
1146
+ var WEEK_ORDER = [1, 2, 3, 4, 5, 6, 0];
1147
+ function timetableText(s) {
1148
+ if (!s.enabled)
1149
+ return "\u5DF2\u6682\u505C";
1150
+ if (s.times.length === 0)
1151
+ return s.after === void 0 ? "\u6CA1\u6709\u8BBE\u65F6\u95F4" : `\u300C${s.after}\u300D\u8DD1\u5B8C\u540E`;
1152
+ const days = s.days.length === 0 || s.days.length === 7 ? "\u6BCF\u5929" : `\u6BCF\u5468${WEEK_ORDER.filter((d) => s.days.includes(d)).map((d) => DAY_NAMES[d]).join("\u3001")}`;
1153
+ return `${days} ${[...s.times].sort().join("\u3001")}`;
1154
+ }
1155
+ var ScheduleAgentSet = external_exports.object({
1156
+ kind: external_exports.enum(["task", "reminder"]),
1157
+ /** The timed task's id (`tasks/list`) or the reminder's (`reminders/list`), when known. */
1158
+ id: external_exports.string().optional(),
1159
+ /** Who set it (role id; `main`: 助手). */
1160
+ by: external_exports.string(),
1161
+ /** Who is handed it when it comes. */
1162
+ agent: external_exports.string(),
1163
+ title: external_exports.string(),
1164
+ /** When, in words (每天 09:00, 一次 …); empty when not known. */
1165
+ when: external_exports.string(),
1166
+ /** An existing one was changed, not a new one made. */
1167
+ changed: external_exports.boolean()
1168
+ });
1071
1169
  var PowerAction = external_exports.enum(["none", "sleep", "hibernate", "shutdown"]);
1072
1170
  var Pipeline = external_exports.object({
1073
1171
  id: PipelineId,
@@ -1328,6 +1426,8 @@ var PipelineNotifications = {
1328
1426
  "schedule/changed": external_exports.object({}),
1329
1427
  /** A timed task was saved, removed, or one of its runs started or ended. */
1330
1428
  "tasks/changed": external_exports.object({}),
1429
+ /** An agent set a timed task or a reminder with its tool (the 定时 page's own changes are not announced). */
1430
+ "schedule/agentSet": ScheduleAgentSet,
1331
1431
  /** Keeping awake started or stopped; a sleep / shutdown was asked for, began counting down, was cancelled or done. */
1332
1432
  "schedule/power": PowerStatus
1333
1433
  };
@@ -1392,6 +1492,26 @@ var InterveneNotifications = {
1392
1492
 
1393
1493
  // packages/protocol/lib/games.js
1394
1494
  var GAMES_CAPABILITY = "games";
1495
+ var GameNotice = external_exports.object({
1496
+ /** `<game>/<key>`. */
1497
+ id: external_exports.string(),
1498
+ game: external_exports.string(),
1499
+ title: external_exports.string(),
1500
+ /** `update`: a version update or patch notes; `notice`: an announcement; `news`: other news. */
1501
+ kind: external_exports.enum(["update", "notice", "news"]),
1502
+ publishedAt: external_exports.number().optional(),
1503
+ /** The version it is about ("v1.0.3"). */
1504
+ version: external_exports.string().optional(),
1505
+ summary: external_exports.string().optional(),
1506
+ url: external_exports.string().optional(),
1507
+ /** Its picture (https). */
1508
+ cover: external_exports.string().optional(),
1509
+ /** Stays relevant (a long-term notice): kept and listed first. */
1510
+ lasting: external_exports.boolean().optional(),
1511
+ source: external_exports.object({ id: external_exports.string(), name: external_exports.string() }),
1512
+ /** When it was read. */
1513
+ at: external_exports.number()
1514
+ });
1395
1515
  var Activity = external_exports.object({
1396
1516
  /** `<game>/<key>`; the key is the normalised name, so a site and the screen meet on it. */
1397
1517
  id: external_exports.string(),
@@ -1499,8 +1619,16 @@ var GameInfo = external_exports.object({
1499
1619
  builtin: external_exports.boolean(),
1500
1620
  /** The game pack's own picture (https; fetch it with `games/image`). */
1501
1621
  art: external_exports.string().optional(),
1622
+ /** The picture the user chose for the banner across the game's page (`own:…`, fetch it with `games/image`); none: the version's art. */
1623
+ banner: external_exports.string().optional(),
1502
1624
  /** Followed from the SRA public API without a Game Pack (no scripts, no screen reading): can be unfollowed. */
1503
1625
  followed: external_exports.boolean().optional(),
1626
+ /** The SRA public API's ids its sources read (to match it with the 技能库's packs for the game). */
1627
+ sra: external_exports.array(external_exports.string()).optional(),
1628
+ /** Made here (added by name, or by the agent): `games/remove` deletes it. */
1629
+ own: external_exports.boolean().optional(),
1630
+ /** A single-player game: its page leads with announcements (no timed events). */
1631
+ single: external_exports.boolean().optional(),
1504
1632
  /** The game's current version, from a data site that knows it. */
1505
1633
  version: external_exports.object({
1506
1634
  name: external_exports.string(),
@@ -1552,7 +1680,9 @@ var GamesSettings = external_exports.object({
1552
1680
  ai: external_exports.boolean()
1553
1681
  }),
1554
1682
  /** SRA game ids followed besides the Game Packs (`ys`, `zzz`…), see `games/catalog`. */
1555
- followed: external_exports.array(external_exports.string())
1683
+ followed: external_exports.array(external_exports.string()),
1684
+ /** Game packs (from the 技能库) the user took off the game page: still installed, not shown. */
1685
+ hidden: external_exports.array(external_exports.string()).optional()
1556
1686
  });
1557
1687
  var ReportInfo = external_exports.object({
1558
1688
  /** When today's (or the last) report went out. */
@@ -1569,13 +1699,13 @@ var GamesRequests = {
1569
1699
  "games/list": {
1570
1700
  capability: GAMES_CAPABILITY,
1571
1701
  params: external_exports.object({}),
1572
- result: external_exports.object({ games: external_exports.array(GameInfo), activities: external_exports.array(Activity), settings: GamesSettings, report: ReportInfo })
1702
+ result: external_exports.object({ games: external_exports.array(GameInfo), activities: external_exports.array(Activity), notices: external_exports.array(GameNotice).default([]), settings: GamesSettings, report: ReportInfo })
1573
1703
  },
1574
1704
  /** Read the data sites now (one game, or all). */
1575
1705
  "games/refresh": {
1576
1706
  capability: GAMES_CAPABILITY,
1577
1707
  params: external_exports.object({ game: external_exports.string().optional() }),
1578
- result: external_exports.object({ results: external_exports.array(external_exports.object({ game: external_exports.string(), ok: external_exports.boolean(), count: external_exports.number(), detail: external_exports.string().optional() })) })
1708
+ result: external_exports.object({ results: external_exports.array(external_exports.object({ game: external_exports.string(), ok: external_exports.boolean(), count: external_exports.number(), notices: external_exports.number().optional(), detail: external_exports.string().optional() })) })
1579
1709
  },
1580
1710
  /** Ask the agent to read the game screen; it works in a session of its own. */
1581
1711
  /**
@@ -1629,10 +1759,31 @@ var GamesRequests = {
1629
1759
  params: external_exports.object({ game: external_exports.string().min(1) }),
1630
1760
  result: external_exports.object({ icon: external_exports.object({ mediaType: external_exports.string(), data: external_exports.string() }).optional() })
1631
1761
  },
1632
- /** Ask the agent to find where a game's events can be read and add it (a game pack of the user's own). */
1762
+ /**
1763
+ * Put a game on the game page by its name, whatever is known about it: one
1764
+ * already there (or taken off it) is shown; one the SRA public API knows is
1765
+ * followed; any other is made empty, for the agent to find its sources from
1766
+ * its page (`games/discover`). Packs are not downloaded here.
1767
+ */
1768
+ "games/create": {
1769
+ capability: GAMES_CAPABILITY,
1770
+ params: external_exports.object({ name: external_exports.string().trim().min(1).max(60) }),
1771
+ result: external_exports.object({ game: external_exports.string() })
1772
+ },
1773
+ /**
1774
+ * Take a game off the game page: one followed from the SRA public API is no
1775
+ * longer followed, a game pack from the 技能库 is hidden (the pack stays
1776
+ * installed), one made here is deleted with its events.
1777
+ */
1778
+ "games/remove": {
1779
+ capability: GAMES_CAPABILITY,
1780
+ params: external_exports.object({ game: external_exports.string() }),
1781
+ result: external_exports.object({})
1782
+ },
1783
+ /** The agent finds where a game on the page can be read (its game pack's sources), from the game's page. */
1633
1784
  "games/discover": {
1634
1785
  capability: GAMES_CAPABILITY,
1635
- params: external_exports.object({ name: external_exports.string().min(1).max(60) }),
1786
+ params: external_exports.object({ game: external_exports.string() }),
1636
1787
  result: external_exports.object({ sessionId: external_exports.string() })
1637
1788
  },
1638
1789
  /**
@@ -1663,7 +1814,11 @@ var GamesRequests = {
1663
1814
  params: external_exports.object({}),
1664
1815
  result: external_exports.object({ games: external_exports.array(external_exports.object({ sra: external_exports.string(), name: external_exports.string(), followed: external_exports.boolean(), pack: external_exports.string().optional() })) })
1665
1816
  },
1666
- /** Follow (or stop following) an SRA game that has no Game Pack: its events come in with the daily refresh. */
1817
+ /**
1818
+ * Show (or stop showing) an SRA game on the game page: followed through the
1819
+ * API, or, when a game pack reads it, that game pack shown or hidden (the
1820
+ * pack is not downloaded or deleted). Its events come in with the daily refresh.
1821
+ */
1667
1822
  "games/follow": {
1668
1823
  capability: GAMES_CAPABILITY,
1669
1824
  params: external_exports.object({ sra: external_exports.string(), follow: external_exports.boolean() }),
@@ -1688,6 +1843,21 @@ var GamesRequests = {
1688
1843
  * (kept by the host, it becomes `cover`). A new one needs a `name`; one
1689
1844
  * with the same name already in the calendar is that one.
1690
1845
  */
1846
+ /**
1847
+ * The picture across the top of a game's page: one the user picked (`image`,
1848
+ * its bytes; or `path`, a file on the host's computer from a file dialog),
1849
+ * kept under the host's data folder; neither: the version's art again.
1850
+ */
1851
+ "games/banner/set": {
1852
+ capability: GAMES_CAPABILITY,
1853
+ params: external_exports.object({
1854
+ game: external_exports.string().min(1),
1855
+ image: ActivityImage.optional(),
1856
+ path: external_exports.string().trim().min(1).max(1e3).optional()
1857
+ }).refine((p) => p.image === void 0 || p.path === void 0, "\u56FE\u7247\u548C\u8DEF\u5F84\u53EA\u80FD\u7ED9\u4E00\u4E2A"),
1858
+ /** No `banner`: back to the version's art. */
1859
+ result: external_exports.object({ banner: external_exports.string().optional() })
1860
+ },
1691
1861
  "games/activity/save": {
1692
1862
  capability: GAMES_CAPABILITY,
1693
1863
  params: external_exports.object({
@@ -1740,13 +1910,13 @@ var PermissionMode = external_exports.enum(["ask", "full"]);
1740
1910
  var AreaPolicy = external_exports.enum(["default", "allow", "ask", "deny"]);
1741
1911
  var AGENT_AREAS = [
1742
1912
  { id: "pipelines-edit", title: "\u7F16\u8F91\u6D41\u6C34\u7EBF\u548C\u5B9A\u65F6", description: "\u8D77\u8349\u6D41\u6C34\u7EBF\uFF0C\u300C\u7F16\u6392\u300D\u76F4\u63A5\u4FEE\u6539\u3001\u4FDD\u5B58\u6D41\u6C34\u7EBF\uFF08pipeline_save\uFF09\uFF0C\u8BBE\u5B9A\u65F6\u95F4\uFF08schedule_set\uFF09\uFF0C\u4EE5\u53CA dsh \u81EA\u5DF1\u7684\u5B9A\u65F6\u4EFB\u52A1\u3002", tools: ["pipeline_draft", "pipeline_save", "schedule_set", "schedule_create", "schedule_edit"] },
1743
- { id: "run", title: "\u8FD0\u884C\u6D41\u6C34\u7EBF\u548C\u811A\u672C", description: "\u542F\u52A8\u3001\u505C\u6B62\u6D41\u6C34\u7EBF\u548C\u811A\u672C\u4EFB\u52A1\u3002", tools: ["pipeline_run", "script_run", "script_stop"] },
1913
+ { id: "run", title: "\u8FD0\u884C\u6D41\u6C34\u7EBF\u548C\u811A\u672C", description: "\u542F\u52A8\u3001\u505C\u6B62\u6D41\u6C34\u7EBF\u548C\u811A\u672C\u4EFB\u52A1\uFF0C\u901A\u8FC7\u811A\u672C\u81EA\u5E26\u7684 MCP \u670D\u52A1\u64CD\u63A7\u811A\u672C\u3002", tools: ["pipeline_run", "script_run", "script_stop", "script_mcp_call"] },
1744
1914
  { id: "scripts-config", title: "\u6539\u811A\u672C\u914D\u7F6E", description: "\u4FEE\u6539\u811A\u672C\u7684\u914D\u7F6E\u526F\u672C\u3001\u5BFC\u5165\u914D\u7F6E\u3001\u65B0\u5EFA\u9009\u9879\u3001\u6253\u5F00\u811A\u672C\u81EA\u5DF1\u7684\u8BBE\u7F6E\u754C\u9762\u3001\u8BBE\u7F6E\u6E38\u620F\u4F4D\u7F6E\u3002", tools: ["script_config_set", "script_config_import", "script_choice_create", "script_settings", "game_path_set"] },
1745
1915
  { id: "scripts-install", title: "\u5B89\u88C5\u3001\u66F4\u65B0\u3001\u5220\u9664\u811A\u672C", description: "\u4ECE GitHub \u5B89\u88C5\u3001\u66F4\u65B0\u3001\u56DE\u6EDA\u3001\u5220\u9664\u811A\u672C\uFF0C\u8FD0\u884C\u811A\u672C\u7684\u5B89\u88C5\u7A0B\u5E8F\uFF0C\u5BFC\u5165\u672C\u5730\u811A\u672C\uFF0C\u4FEE\u590D\u8FD0\u884C\u73AF\u5883\uFF0C\u5199\u3001\u6539\u811A\u672C\u5305\uFF08pack_propose\uFF0C\u76F4\u63A5\u751F\u6548\uFF09\u3002", tools: ["script_install", "script_update", "script_rollback", "script_remove", "script_setup_run", "script_import", "script_env_fix", "pack_propose"] },
1746
1916
  { id: "screen", title: "\u64CD\u4F5C\u5C4F\u5E55\u548C\u6A21\u62DF\u5668", description: "\u5728\u6E38\u620F\u7A97\u53E3\u6216\u6A21\u62DF\u5668\u91CC\u70B9\u51FB\u3001\u8F93\u5165\u3001\u6309\u952E\u3001\u6ED1\u52A8\u3001\u5207\u6362\u7A97\u53E3\uFF08\u622A\u56FE\u4E0D\u7B97\uFF09\u3002", tools: ["screen_tap", "screen_type", "screen_key", "screen_scroll", "screen_swipe", "window_focus"] },
1747
1917
  { id: "games", title: "\u542F\u52A8\u3001\u5173\u95ED\u6E38\u620F\u548C\u6A21\u62DF\u5668", description: "\u6253\u5F00\u3001\u5173\u6389\u6E38\u620F\uFF0C\u542F\u52A8\u3001\u5173\u95ED\u3001\u5B89\u88C5\u3001\u8BBE\u7F6E\u6A21\u62DF\u5668\u3002", tools: ["game_launch", "game_close", "emulator_start", "emulator_stop", "emulator_install", "emulator_configure"] },
1748
1918
  { id: "game-records", title: "\u8BB0\u5F55\u6D3B\u52A8\u3001\u6DFB\u52A0\u6E38\u620F", description: "\u628A\u8BFB\u5230\u7684\u6D3B\u52A8\u5199\u8FDB\u65E5\u5386\uFF0C\u66FF\u4F60\u6DFB\u52A0\u3001\u4FEE\u6539\u6216\u53BB\u6389\u6D3B\u52A8\uFF0C\u7ED9\u65B0\u6E38\u620F\u5EFA\u6E38\u620F\u5305\u3002", tools: ["game_record", "game_activity_save", "game_activity_remove", "game_add"] },
1749
- { id: "skills", title: "\u4FDD\u5B58\u6280\u80FD", description: "\u628A\u505A\u6CD5\u5B58\u6210\u6280\u80FD\uFF0C\u4EE5\u540E\u7684\u5BF9\u8BDD\u90FD\u4F1A\u7528\u5230\u3002", tools: ["skill_save"] },
1919
+ { id: "skills", title: "\u4FDD\u5B58\u6280\u80FD", description: "\u628A\u505A\u6CD5\u5B58\u6210\u6280\u80FD\uFF0C\u4EE5\u540E\u7684\u5BF9\u8BDD\u90FD\u4F1A\u7528\u5230\uFF1B\u628A\u811A\u672C\u81EA\u5E26\u7684\u6280\u80FD\u653E\u8FDB\u6280\u80FD\u5E93\u3002", tools: ["skill_save", "script_skills_import"] },
1750
1920
  { id: "web", title: "\u4E0A\u7F51\u67E5\u8D44\u6599", description: "\u8BFB\u7F51\u9875\u3001\u641C\u7D22\u3002", tools: ["web_fetch", "web_search"] },
1751
1921
  { id: "browser", title: "\u64CD\u4F5C\u5185\u7F6E\u6D4F\u89C8\u5668", description: "\u5728\u5185\u7F6E\u6D4F\u89C8\u5668\u91CC\u6253\u5F00\u7F51\u9875\u3001\u70B9\u51FB\u3001\u8F93\u5165\u3001\u6309\u952E\u3001\u6EDA\u52A8\u3001\u5207\u6362\u6807\u7B7E\u9875\uFF08\u8BFB\u9875\u9762\u548C\u622A\u56FE\u4E0D\u7B97\uFF09\u3002", tools: ["browser_navigate", "browser_click", "browser_type", "browser_press", "browser_scroll", "browser_tabs"] },
1752
1922
  { id: "shell", title: "\u8FD0\u884C\u547D\u4EE4\u3001\u6539\u6587\u4EF6", description: "dsh \u81EA\u5E26\u7684\u547D\u4EE4\u884C\u548C\u6587\u4EF6\u7F16\u8F91\u3002\u53EA\u5728\u5B83\u8BF7\u6C42\u786E\u8BA4\u65F6\u6309\u8FD9\u91CC\u7684\u8BBE\u7F6E\u5904\u7406\uFF08\u6C99\u7BB1\u91CC\u7684\u666E\u901A\u547D\u4EE4\u4E0D\u4F1A\u8BF7\u6C42\uFF09\u3002", tools: ["pwsh", "bash", "edit", "write"], approvalOnly: true }
@@ -1868,9 +2038,11 @@ var SkillInfo = external_exports.object({
1868
2038
  description: external_exports.string(),
1869
2039
  whenToUse: external_exports.string().optional(),
1870
2040
  /**
1871
- * Where it comes from: `bundled` (shipped with the app or a plugin), `custom`
1872
- * (packs and game packs the user added), `user-dsh` / `user-agents` (the
1873
- * user's own skill folders), `project-*` (a working folder), `runtime`.
2041
+ * Where it comes from: `bundled` (shipped with the app or a plugin: core,
2042
+ * cannot be changed), `hub` (downloaded from the 技能库), `custom` (packs and
2043
+ * game packs the user added, and the skills saved here), `runtime`. The
2044
+ * app's agents do not read the skill folders other agents share
2045
+ * (`~/.agents/skills`, `~/.dsh/skills`, a working folder's `.agents/skills`).
1874
2046
  */
1875
2047
  source: external_exports.string(),
1876
2048
  /** The plugin or provider that serves it. */
@@ -1887,7 +2059,13 @@ var SkillInfo = external_exports.object({
1887
2059
  */
1888
2060
  owner: SkillOwner.optional(),
1889
2061
  /** Kept in this app's skills folder (saved by the agent or made on the 技能 page): it can be changed and deleted. */
1890
- removable: external_exports.boolean().optional()
2062
+ removable: external_exports.boolean().optional(),
2063
+ /** A script pack's SKILL.md, or a game pack's guide (the 技能 page lists them as 脚本包 and 游戏包). */
2064
+ kind: external_exports.enum(["script-pack", "game-pack"]).optional(),
2065
+ /** A script pack's id (its SKILL.md is this skill). */
2066
+ pack: external_exports.string().optional(),
2067
+ /** A script pack of the user's own (the agent wrote it): `scripts/packs/remove` deletes it. */
2068
+ ownPack: external_exports.boolean().optional()
1891
2069
  });
1892
2070
  var SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
1893
2071
  var MAX_SKILL_NAME = 48;
@@ -1917,6 +2095,12 @@ var SkillsRequests = {
1917
2095
  }),
1918
2096
  result: external_exports.object({ name: external_exports.string(), replaced: external_exports.boolean() })
1919
2097
  },
2098
+ /** The scripts and games a session is working on (技能隔离's focus): the page offers their packs from the 技能库. */
2099
+ "skills/focus": {
2100
+ capability: SKILLS_CAPABILITY,
2101
+ params: external_exports.object({ sessionId: external_exports.string() }),
2102
+ result: SkillOwner.required()
2103
+ },
1920
2104
  /** Delete one of this app's skills folder (`removable`). */
1921
2105
  "skills/remove": {
1922
2106
  capability: SKILLS_CAPABILITY,
@@ -1926,7 +2110,9 @@ var SkillsRequests = {
1926
2110
  };
1927
2111
  var SkillsNotifications = {
1928
2112
  /** A skill was saved or deleted; re-read `skills/list`. */
1929
- "skills/changed": external_exports.object({})
2113
+ "skills/changed": external_exports.object({}),
2114
+ /** A session's focus changed (the agent turned to a script or game). */
2115
+ "skills/focused": external_exports.object({ sessionId: external_exports.string(), scripts: external_exports.array(external_exports.string()), games: external_exports.array(external_exports.string()) })
1930
2116
  };
1931
2117
 
1932
2118
  // packages/protocol/lib/handoff-notes.js
@@ -2155,8 +2341,20 @@ var CompactionSettings = external_exports.object({
2155
2341
  * prints enters their conversation, so polling a run or reading a long log costs a few lines, not every result
2156
2342
  * at every step. Off: they run the standard preset, one tool call per step. Read when the agent service starts.
2157
2343
  */
2158
- ptcSubagents: external_exports.boolean().default(true)
2344
+ ptcSubagents: external_exports.boolean().default(true),
2345
+ /**
2346
+ * The model that writes every summary (automatic, by hand, low-context mode); null: the model the conversation
2347
+ * is using (dsh's own choice). Another model reads the span without the conversation's prompt cache, and needs a
2348
+ * context window that holds it. `maxTokens`: the most the summary may be, the model's own output limit when its
2349
+ * route declares one (the host fills it in). Read when the agent service starts.
2350
+ */
2351
+ summarizer: external_exports.object({
2352
+ provider: external_exports.string().min(1).max(200),
2353
+ model: external_exports.string().min(1).max(200),
2354
+ maxTokens: external_exports.number().int().positive().optional()
2355
+ }).nullable().default(null)
2159
2356
  });
2357
+ var SUMMARY_MAX_TOKENS = 65536;
2160
2358
  var State = external_exports.object({ settings: CompactionSettings, applied: CompactionSettings });
2161
2359
  var CompactionRequests = {
2162
2360
  "compaction/get": {
@@ -2548,13 +2746,34 @@ var TurnEndReason = external_exports.object({
2548
2746
  kind: external_exports.string(),
2549
2747
  message: external_exports.string().optional()
2550
2748
  });
2749
+ var FallbackRoute = external_exports.object({
2750
+ provider: external_exports.string(),
2751
+ providerName: external_exports.string(),
2752
+ model: external_exports.string(),
2753
+ modelName: external_exports.string()
2754
+ });
2755
+ var ModelFallbackNotice = external_exports.object({
2756
+ from: FallbackRoute,
2757
+ to: FallbackRoute,
2758
+ /** Why it was switched, in a few words (余额不足, Key 无效, …). */
2759
+ reason: external_exports.string(),
2760
+ /** The model service's own error message. */
2761
+ error: external_exports.string(),
2762
+ /** dsh's failure code (QUOTA, AUTH, HTTP_402, …). */
2763
+ code: external_exports.string(),
2764
+ /** A sub-agent's model (the sub-agent list), else an agent's own conversation (the agent list). */
2765
+ sub: external_exports.boolean().optional()
2766
+ });
2767
+ var MODEL_FALLBACK_SOURCE = "adg-model-fallback";
2551
2768
  var MessageOrigin = external_exports.object({
2552
2769
  /** Upstream source kind: `user`, `user-rpc`, injected-context producers, goal rounds, ... */
2553
2770
  kind: external_exports.string(),
2554
2771
  /** True for a direct human prompt; false for injected context. */
2555
2772
  human: external_exports.boolean(),
2556
2773
  /** One-line account for `notice`-form injected context. */
2557
- summary: external_exports.string().optional()
2774
+ summary: external_exports.string().optional(),
2775
+ /** A model failed and the agent went on with the next of its fallback list (kind MODEL_FALLBACK_SOURCE). */
2776
+ fallback: ModelFallbackNotice.optional()
2558
2777
  });
2559
2778
  var base = { seq: external_exports.number(), time: external_exports.number() };
2560
2779
  var SessionEvent = external_exports.discriminatedUnion("type", [
@@ -2717,10 +2936,23 @@ var HubItem = external_exports.object({
2717
2936
  description: external_exports.string(),
2718
2937
  title: external_exports.string().optional(),
2719
2938
  kind: external_exports.enum(["game", "script", "general"]),
2939
+ /**
2940
+ * A script pack (its folder has `adg.script.yaml`: how the script installs,
2941
+ * its tasks; the pack id is the name) or a game pack (`game.yaml`: where the
2942
+ * game page reads events). Absent: a skill only.
2943
+ */
2944
+ pack: external_exports.enum(["script", "game"]).optional(),
2945
+ /** A game pack's game id, and the SRA public API's ids for it (the games page's 更多游戏 list). */
2946
+ game: external_exports.string().optional(),
2947
+ sra: external_exports.array(external_exports.string()).optional(),
2948
+ /** Offered ticked when the packs for its game are offered (the main ones); others unticked. */
2949
+ default: external_exports.boolean().optional(),
2720
2950
  /** Game ids and script / pack ids it is for: the page suggests it for the ones the user has. */
2721
2951
  games: external_exports.array(external_exports.string()),
2722
2952
  scripts: external_exports.array(external_exports.string()),
2723
2953
  repo: external_exports.string(),
2954
+ /** Who published it (a GitHub name): the 技能库 lists packs by game, script, then author. */
2955
+ author: external_exports.string().optional(),
2724
2956
  path: external_exports.string(),
2725
2957
  /** Fingerprint of its whole folder: a different one is another version. */
2726
2958
  hash: external_exports.string(),
@@ -2729,6 +2961,8 @@ var HubItem = external_exports.object({
2729
2961
  changes: external_exports.string().optional(),
2730
2962
  /** App versions it works with, e.g. `>=2.1.0`. */
2731
2963
  requires: external_exports.string().optional(),
2964
+ /** Earlier versions the repository keeps (git tags `<name>@<version>`), newest first: `skillhub/version` takes any. */
2965
+ history: external_exports.array(external_exports.object({ version: external_exports.string(), changes: external_exports.string().optional() })).optional(),
2732
2966
  installed: external_exports.object({
2733
2967
  at: external_exports.number(),
2734
2968
  /** The repository has a newer version (not one gone back from). */
@@ -2753,6 +2987,18 @@ var SkillHubRequests = {
2753
2987
  params: external_exports.object({ refresh: external_exports.boolean().optional() }),
2754
2988
  result: external_exports.object({ items: external_exports.array(HubItem), repos: external_exports.array(HubRepo), errors: external_exports.array(external_exports.string()), fetchedAt: external_exports.number().optional() })
2755
2989
  },
2990
+ /** A skill's SKILL.md as the repository has it, for one not downloaded yet. */
2991
+ "skillhub/preview": {
2992
+ capability: SKILLHUB_CAPABILITY,
2993
+ params: ByName,
2994
+ result: external_exports.object({ content: external_exports.string() })
2995
+ },
2996
+ /** Change a downloaded one's SKILL.md (its description and instructions); the next update replaces it like the rest. */
2997
+ "skillhub/save": {
2998
+ capability: SKILLHUB_CAPABILITY,
2999
+ params: ByName.extend({ description: external_exports.string().trim().min(10).max(400), content: external_exports.string().trim().min(20).max(2e4) }),
3000
+ result: external_exports.object({})
3001
+ },
2756
3002
  "skillhub/install": {
2757
3003
  capability: SKILLHUB_CAPABILITY,
2758
3004
  params: ByName.extend({ repo: GitHubRepo.optional() }),
@@ -2764,6 +3010,16 @@ var SkillHubRequests = {
2764
3010
  params: ByName,
2765
3011
  result: external_exports.object({ state: external_exports.enum(["current", "updated"]), item: HubItem })
2766
3012
  },
3013
+ /**
3014
+ * Take one version the repository keeps, forward or back: the current one
3015
+ * (`version`) or one of `history`. One not current is held (no update
3016
+ * offered until another); one of another kind (not a pack then) is refused.
3017
+ */
3018
+ "skillhub/version": {
3019
+ capability: SKILLHUB_CAPABILITY,
3020
+ params: ByName.extend({ version: external_exports.string().min(1).max(40) }),
3021
+ result: HubItem
3022
+ },
2767
3023
  /** Go back to the version the last update replaced. */
2768
3024
  "skillhub/rollback": {
2769
3025
  capability: SKILLHUB_CAPABILITY,
@@ -2846,7 +3102,7 @@ var QueuedPrompt = external_exports.object({
2846
3102
  requestId: external_exports.string().optional(),
2847
3103
  text: external_exports.string(),
2848
3104
  images: external_exports.number().int().optional(),
2849
- placement: external_exports.enum(["next-turn", "next-step"])
3105
+ placement: external_exports.enum(["next-turn", "next-step", "taken"])
2850
3106
  });
2851
3107
  var SessionContext = external_exports.object({
2852
3108
  contextWindow: external_exports.number().int().positive(),
@@ -2869,13 +3125,19 @@ var ModelSelection = external_exports.object({
2869
3125
  model: external_exports.string(),
2870
3126
  reasoningEffort: external_exports.string().optional()
2871
3127
  });
3128
+ var ModelFallbacks = external_exports.object({
3129
+ agents: external_exports.array(ModelSelection),
3130
+ subAgents: external_exports.array(ModelSelection)
3131
+ });
2872
3132
  var AgentModels = external_exports.object({
2873
3133
  /** Role agents' own models, by agent id. */
2874
3134
  agents: external_exports.record(external_exports.string(), ModelSelection),
2875
3135
  /** Every agent's sub-agents. */
2876
3136
  subAgents: ModelSelection.nullable(),
2877
3137
  /** One agent's sub-agents, by agent id (`main`: 助手's). */
2878
- subAgentsOf: external_exports.record(external_exports.string(), ModelSelection)
3138
+ subAgentsOf: external_exports.record(external_exports.string(), ModelSelection),
3139
+ /** The fallback lists; absent from a gateway that has none. */
3140
+ fallbacks: ModelFallbacks.optional()
2879
3141
  });
2880
3142
  var AGENTS_CAPABILITY = "agents";
2881
3143
  var ThreadMessage = external_exports.object({
@@ -3231,6 +3493,12 @@ var Requests = {
3231
3493
  params: external_exports.object({ agentId: external_exports.string().optional(), sub: external_exports.boolean().optional(), model: ModelSelection.nullable() }),
3232
3494
  result: external_exports.object({ warning: external_exports.string().optional() })
3233
3495
  },
3496
+ /** Set one fallback list (ModelFallbacks): the agents' (`sub` false) or the sub-agents'. Empty: no fallback. */
3497
+ "models/setFallbacks": {
3498
+ capability: "agent-models",
3499
+ params: external_exports.object({ sub: external_exports.boolean(), models: external_exports.array(ModelSelection) }),
3500
+ result: Empty2
3501
+ },
3234
3502
  "models/catalog": {
3235
3503
  capability: "models",
3236
3504
  params: Empty2,
@@ -3649,6 +3917,8 @@ function parseGitHubLink(text) {
3649
3917
  var UPDATE_RULE = "\u66F4\u65B0\u811A\u672C\u53EA\u8D70\u5B98\u65B9\u6E20\u9053\uFF1A\u5148\u7528 script_update\uFF08Mirror\u9171 \u6216\u5B98\u65B9\u53D1\u5E03\u5305\uFF0C\u914D\u7F6E\u4F1A\u63A5\u4E0A\uFF09\uFF1B\u5B83\u6CA1\u6709\u66F4\u65B0\u6765\u6E90\u6216\u5931\u8D25\u65F6\uFF0C\u7528\u811A\u672C\u81EA\u5DF1\u7684\u66F4\u65B0\u529F\u80FD\uFF08\u5B83\u7684\u66F4\u65B0\u7A0B\u5E8F\u3001\u542F\u52A8\u5668\u6216\u8BBE\u7F6E\u91CC\u7684\u300C\u68C0\u67E5\u66F4\u65B0\u300D\uFF09\u3002\u4E0D\u8981\u7528 git clone / pull / checkout \u62C9\u4EE3\u7801\uFF0C\u4E0D\u8981\u81EA\u5DF1\u4E0B\u8F7D\u6E90\u7801\u6216\u624B\u52A8\u89E3\u538B\u8986\u76D6\u6587\u4EF6\u2014\u2014\u9664\u975E\u6CA1\u6709\u4EFB\u4F55\u5B98\u65B9\u6E20\u9053\uFF0C\u5E76\u4E14\u7528\u6237\u540C\u610F\u3002";
3650
3918
 
3651
3919
  export {
3920
+ ModelFallbackNotice,
3921
+ MODEL_FALLBACK_SOURCE,
3652
3922
  EMULATORS_CAPABILITY,
3653
3923
  EmulatorSettings,
3654
3924
  SCRIPTS_CAPABILITY,
@@ -3684,6 +3954,7 @@ export {
3684
3954
  ClockTime,
3685
3955
  isMarker,
3686
3956
  withStartEnd,
3957
+ timetableText,
3687
3958
  PowerAction,
3688
3959
  Pipeline,
3689
3960
  PipelineRun,
@@ -3692,6 +3963,7 @@ export {
3692
3963
  AgentTaskRun,
3693
3964
  INTERVENE_CAPABILITY,
3694
3965
  GAMES_CAPABILITY,
3966
+ GameNotice,
3695
3967
  OWN_SOURCE,
3696
3968
  SCREEN_SOURCE,
3697
3969
  OWN_IMAGE,
@@ -3731,6 +4003,7 @@ export {
3731
4003
  MAX_ARCHIVE_DAYS,
3732
4004
  ARCHIVE_MARK,
3733
4005
  CompactionSettings,
4006
+ SUMMARY_MAX_TOKENS,
3734
4007
  MEMORY_CAPABILITY,
3735
4008
  SHARED_MEMORY,
3736
4009
  MemoryKind,