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.
- package/cordis.patch.yml +16 -1
- package/lib/analyzer.js +37 -81
- package/lib/browser.js +1 -1
- package/lib/{chunk-FBDVN6Q2.js → chunk-52LYI7WP.js} +1 -1
- package/lib/{chunk-SHTX4AGU.js → chunk-6DSSLS7I.js} +26 -0
- package/lib/{chunk-VOTN4IHB.js → chunk-EOZKHLHK.js} +3 -3
- package/lib/{chunk-NM6H6WCQ.js → chunk-F7ZQE7BT.js} +291 -18
- package/lib/{chunk-5PDYWE24.js → chunk-IBPJC6DX.js} +153 -5
- package/lib/chunk-NOZCFSQP.js +22944 -0
- package/lib/chunk-NOZCFSQP.js.LEGAL.txt +8 -0
- package/lib/{chunk-MQG5FLOG.js → chunk-OFVGRKTD.js} +667 -39
- package/lib/{chunk-UQLHGLMP.js → chunk-YSTZL6HE.js} +11 -3
- package/lib/emulator.js +2 -2
- package/lib/feishu.js +5 -5
- package/lib/game-intel.js +531 -67
- package/lib/gateway.js +14 -6
- package/lib/guard.js +2 -2
- package/lib/intervene.js +8 -6
- package/lib/low-context.js +3 -3
- package/lib/monitor.js +4 -4
- package/lib/notify.js +5 -5
- package/lib/orchestrator.js +8 -8
- package/lib/qqbot.js +5 -5
- package/lib/runner.js +4 -4
- package/lib/scheduler.js +2 -2
- package/lib/script-registry.js +33 -3705
- package/lib/webapi-GDSF5EWP.js +2481 -0
- package/package.json +1 -1
- package/skills/game-intel.md +12 -3
- package/skills/script-analysis.md +30 -3
- package/skills/web-reading.md +52 -15
- package/web/assets/index-BBPTH2CM.css +1 -0
- package/web/assets/index-DRxvDcu6.js +245 -0
- package/web/assets/index-DRxvDcu6.js.map +1 -0
- package/web/index.html +2 -2
- package/lib/chunk-RFCFA5P5.js +0 -11
- package/lib/games/arknights/game.yaml +0 -36
- package/lib/games/endfield/game.yaml +0 -25
- package/lib/games/starrail/game.yaml +0 -33
- package/lib/packs/maa/adg.script.yaml +0 -220
- package/lib/packs/maaend/adg.script.yaml +0 -160
- package/lib/packs/march7th/adg.script.yaml +0 -216
- package/web/assets/index-CL3SeTW9.css +0 -1
- package/web/assets/index-GYwpGP3f.js +0 -244
- package/web/assets/index-GYwpGP3f.js.map +0 -1
package/lib/game-intel.js
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
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
|
-
GAMES_DIR
|
|
4
|
-
} from "./chunk-RFCFA5P5.js";
|
|
5
2
|
import {
|
|
6
3
|
GAME_GUIDE_FILE,
|
|
7
4
|
GAME_MANIFEST_FILE,
|
|
8
5
|
GameManifest,
|
|
9
6
|
parseGameManifest
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IBPJC6DX.js";
|
|
11
8
|
import {
|
|
12
9
|
sessionConversations
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-YSTZL6HE.js";
|
|
11
|
+
import "./chunk-OFVGRKTD.js";
|
|
12
|
+
import "./chunk-52LYI7WP.js";
|
|
16
13
|
import {
|
|
17
14
|
ExeIcons,
|
|
18
15
|
writeFileAtomic
|
|
19
16
|
} from "./chunk-RESS7WVY.js";
|
|
20
17
|
import {
|
|
21
18
|
GAMES_CAPABILITY,
|
|
19
|
+
GameNotice,
|
|
22
20
|
GamesSettings,
|
|
23
21
|
OWN_IMAGE,
|
|
24
22
|
OWN_SOURCE,
|
|
25
23
|
SCREEN_SOURCE,
|
|
26
24
|
SHOT_IMAGE,
|
|
27
25
|
taskMessage
|
|
28
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-F7ZQE7BT.js";
|
|
29
27
|
import {
|
|
30
28
|
external_exports
|
|
31
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-6DSSLS7I.js";
|
|
32
30
|
import "./chunk-2UFLGPDY.js";
|
|
33
31
|
|
|
34
32
|
// packages/game-intel/lib/index.js
|
|
35
|
-
import { createHash } from "node:crypto";
|
|
33
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
36
34
|
import { existsSync } from "node:fs";
|
|
37
|
-
import { mkdir as mkdir2, readdir, readFile as readFile2, rm, writeFile } from "node:fs/promises";
|
|
35
|
+
import { mkdir as mkdir2, readdir, readFile as readFile2, rm, stat, writeFile } from "node:fs/promises";
|
|
38
36
|
import { isAbsolute, join as join2, resolve } from "node:path";
|
|
39
37
|
import { Service } from "@deepseek-ai/cordis";
|
|
40
38
|
|
|
41
39
|
// packages/game-intel/lib/calendar.js
|
|
40
|
+
import { createHash } from "node:crypto";
|
|
42
41
|
import { mkdir, readFile } from "node:fs/promises";
|
|
43
42
|
import { join } from "node:path";
|
|
44
43
|
|
|
@@ -180,6 +179,10 @@ function saidBy(item, source) {
|
|
|
180
179
|
return item.screen === void 0 ? void 0 : { endsAt: item.screen.endsAt, cover: item.screen.image };
|
|
181
180
|
return item.facts[source];
|
|
182
181
|
}
|
|
182
|
+
var MAX_NOTICES = 40;
|
|
183
|
+
function noticeKey(url, title) {
|
|
184
|
+
return url !== void 0 && url !== "" ? `u:${url.trim().replace(/[?#].*$/, "").replace(/\/+$/, "").toLowerCase()}` : `t:${title.trim().replace(/\s+/g, " ").toLowerCase()}`;
|
|
185
|
+
}
|
|
183
186
|
var StoredSchema = external_exports.object({
|
|
184
187
|
activities: external_exports.array(external_exports.looseObject({ id: external_exports.string(), game: external_exports.string(), name: external_exports.string() })).default([]),
|
|
185
188
|
refreshed: external_exports.record(external_exports.string(), external_exports.object({ at: external_exports.number(), ok: external_exports.boolean(), count: external_exports.number(), detail: external_exports.string().optional() })).default({}),
|
|
@@ -187,14 +190,23 @@ var StoredSchema = external_exports.object({
|
|
|
187
190
|
report: external_exports.object({ lastSentAt: external_exports.number().optional(), lastDay: external_exports.string().optional(), lastResult: external_exports.string().optional(), lastText: external_exports.string().optional() }).default({}),
|
|
188
191
|
versions: external_exports.record(external_exports.string(), external_exports.object({ name: external_exports.string(), title: external_exports.string().optional(), startsAt: external_exports.number().optional(), endsAt: external_exports.number().optional(), cover: external_exports.string().optional(), source: external_exports.string(), at: external_exports.number() })).default({}),
|
|
189
192
|
pools: external_exports.record(external_exports.string(), external_exports.array(external_exports.object({ name: external_exports.string(), type: external_exports.string().optional(), startsAt: external_exports.number().optional(), endsAt: external_exports.number(), cover: external_exports.string().optional(), up: external_exports.array(external_exports.string()) }))).default({}),
|
|
190
|
-
settings: external_exports.object({
|
|
193
|
+
settings: external_exports.object({
|
|
194
|
+
report: GamesSettings.shape.report.partial().default({}),
|
|
195
|
+
followed: external_exports.array(external_exports.string()).default([]),
|
|
196
|
+
/** Game packs taken off the game page (the pack stays installed). */
|
|
197
|
+
hidden: external_exports.array(external_exports.string()).default([]),
|
|
198
|
+
/** The picture the user chose for a game's banner (`own:<file>`), by game. */
|
|
199
|
+
banners: external_exports.record(external_exports.string(), external_exports.string()).default({})
|
|
200
|
+
}).default({ report: {}, followed: [], hidden: [], banners: {} }),
|
|
191
201
|
/** Pages the user added to a game (games/source/add), by game. */
|
|
192
|
-
links: external_exports.record(external_exports.string(), external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), url: external_exports.string(), at: external_exports.number() }))).default({})
|
|
202
|
+
links: external_exports.record(external_exports.string(), external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), url: external_exports.string(), at: external_exports.number() }))).default({}),
|
|
203
|
+
/** Announcements (version updates, long-term notices, news), by game. */
|
|
204
|
+
notices: external_exports.record(external_exports.string(), external_exports.array(GameNotice)).default({})
|
|
193
205
|
});
|
|
194
206
|
var Calendar = class {
|
|
195
207
|
#dir;
|
|
196
208
|
#items = [];
|
|
197
|
-
#saved = { refreshed: {}, readings: {}, report: {}, settings: { report: {}, followed: [] }, versions: {}, pools: {}, links: {} };
|
|
209
|
+
#saved = { refreshed: {}, readings: {}, report: {}, settings: { report: {}, followed: [], hidden: [], banners: {} }, versions: {}, pools: {}, links: {}, notices: {} };
|
|
198
210
|
constructor(dir) {
|
|
199
211
|
this.#dir = dir;
|
|
200
212
|
}
|
|
@@ -205,7 +217,7 @@ var Calendar = class {
|
|
|
205
217
|
try {
|
|
206
218
|
const saved = StoredSchema.parse(JSON.parse(await readFile(this.file, "utf8")));
|
|
207
219
|
this.#items = saved.activities.map((a) => migrate({ todo: [], done: [], ...a, names: Array.isArray(a["names"]) ? a["names"] : [a.name] }));
|
|
208
|
-
this.#saved = { refreshed: saved.refreshed, readings: saved.readings, report: saved.report, settings: saved.settings, versions: saved.versions, pools: saved.pools, links: saved.links };
|
|
220
|
+
this.#saved = { refreshed: saved.refreshed, readings: saved.readings, report: saved.report, settings: saved.settings, versions: saved.versions, pools: saved.pools, links: saved.links, notices: saved.notices };
|
|
209
221
|
} catch {
|
|
210
222
|
}
|
|
211
223
|
}
|
|
@@ -225,7 +237,7 @@ var Calendar = class {
|
|
|
225
237
|
}
|
|
226
238
|
get settings() {
|
|
227
239
|
const saved = Object.fromEntries(Object.entries(this.#saved.settings.report).filter(([, v]) => v !== void 0));
|
|
228
|
-
return { report: { ...DEFAULT_SETTINGS.report, ...saved }, followed: [...this.#saved.settings.followed] };
|
|
240
|
+
return { report: { ...DEFAULT_SETTINGS.report, ...saved }, followed: [...this.#saved.settings.followed], hidden: [...this.#saved.settings.hidden] };
|
|
229
241
|
}
|
|
230
242
|
get report() {
|
|
231
243
|
return this.#saved.report;
|
|
@@ -255,6 +267,10 @@ var Calendar = class {
|
|
|
255
267
|
for (const p of list)
|
|
256
268
|
if (p.cover !== void 0)
|
|
257
269
|
out.add(p.cover);
|
|
270
|
+
for (const list of Object.values(this.#saved.notices))
|
|
271
|
+
for (const n of list)
|
|
272
|
+
if (n.cover !== void 0)
|
|
273
|
+
out.add(n.cover);
|
|
258
274
|
return out;
|
|
259
275
|
}
|
|
260
276
|
version(game) {
|
|
@@ -293,6 +309,93 @@ var Calendar = class {
|
|
|
293
309
|
await this.save();
|
|
294
310
|
return this.settings;
|
|
295
311
|
}
|
|
312
|
+
/** Take a game pack off the game page, or put it back (its events are kept for then). */
|
|
313
|
+
async hide(gameId, hidden) {
|
|
314
|
+
const list = this.#saved.settings.hidden.filter((id) => id !== gameId);
|
|
315
|
+
this.#saved.settings.hidden = hidden ? [...list, gameId] : list;
|
|
316
|
+
await this.save();
|
|
317
|
+
}
|
|
318
|
+
/** The picture the user chose for a game's banner (`own:<file>`); undefined: the version's art. */
|
|
319
|
+
banner(gameId) {
|
|
320
|
+
const image = this.#saved.settings.banners[gameId];
|
|
321
|
+
return image !== void 0 && OWN_IMAGE.test(image) ? image : void 0;
|
|
322
|
+
}
|
|
323
|
+
/** Show the user's picture on a game's banner (`own:<file>`), or the version's art again (undefined). */
|
|
324
|
+
async setBanner(gameId, image) {
|
|
325
|
+
if (image !== void 0 && !OWN_IMAGE.test(image))
|
|
326
|
+
throw new Error(`\u4E0D\u662F\u7528\u6237\u6DFB\u52A0\u7684\u56FE\u7247\uFF1A${image}`);
|
|
327
|
+
const { [gameId]: _, ...rest } = this.#saved.settings.banners;
|
|
328
|
+
this.#saved.settings.banners = image === void 0 ? rest : { ...rest, [gameId]: image };
|
|
329
|
+
await this.save();
|
|
330
|
+
}
|
|
331
|
+
/** Forget everything about a game (one made here that is deleted): its events, readings, version, pools and pages. */
|
|
332
|
+
async forget(gameId) {
|
|
333
|
+
this.#items = this.#items.filter((a) => a.game !== gameId);
|
|
334
|
+
for (const key of [gameId, `${gameId}#web`])
|
|
335
|
+
delete this.#saved.readings[key];
|
|
336
|
+
delete this.#saved.refreshed[gameId];
|
|
337
|
+
delete this.#saved.versions[gameId];
|
|
338
|
+
delete this.#saved.pools[gameId];
|
|
339
|
+
delete this.#saved.links[gameId];
|
|
340
|
+
delete this.#saved.notices[gameId];
|
|
341
|
+
this.#saved.settings.hidden = this.#saved.settings.hidden.filter((id) => id !== gameId);
|
|
342
|
+
delete this.#saved.settings.banners[gameId];
|
|
343
|
+
await this.save();
|
|
344
|
+
}
|
|
345
|
+
/** Announcements (of one game, or all): the long-term ones first, then the newest. */
|
|
346
|
+
notices(game) {
|
|
347
|
+
const all = game === void 0 ? Object.values(this.#saved.notices).flat() : this.#saved.notices[game] ?? [];
|
|
348
|
+
return [...all].sort((a, b) => Number(b.lasting === true) - Number(a.lasting === true) || (b.publishedAt ?? b.at) - (a.publishedAt ?? a.at));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Keep announcements a data site gives or the agent read. One already kept
|
|
352
|
+
* (the same address, else the same title) is brought up to date; besides
|
|
353
|
+
* the long-term ones, the newest ${MAX_NOTICES} are kept.
|
|
354
|
+
* @returns them as kept.
|
|
355
|
+
*/
|
|
356
|
+
async applyNotices(game, source, read, now) {
|
|
357
|
+
const list = [...this.#saved.notices[game] ?? []];
|
|
358
|
+
const out = [];
|
|
359
|
+
for (const n of read) {
|
|
360
|
+
const title = n.title.replace(/\s+/g, " ").trim();
|
|
361
|
+
if (title === "")
|
|
362
|
+
continue;
|
|
363
|
+
const url = n.url?.trim() || void 0;
|
|
364
|
+
const key = noticeKey(url, title);
|
|
365
|
+
const at = list.findIndex((x) => noticeKey(x.url, x.title) === key || url !== void 0 && x.url === void 0 && noticeKey(void 0, x.title) === noticeKey(void 0, title));
|
|
366
|
+
const before = at < 0 ? void 0 : list[at];
|
|
367
|
+
const keep = (value, old) => value ?? old;
|
|
368
|
+
const publishedAt = keep(n.publishedAt, before?.publishedAt);
|
|
369
|
+
const version = keep(n.version?.trim() || void 0, before?.version);
|
|
370
|
+
const summary = keep(n.summary?.trim() || void 0, before?.summary);
|
|
371
|
+
const cover = keep(n.cover?.trim() || void 0, before?.cover);
|
|
372
|
+
const lasting = n.lasting ?? before?.lasting;
|
|
373
|
+
const next = {
|
|
374
|
+
id: before?.id ?? `${game}/${createHash("sha1").update(key).digest("hex").slice(0, 12)}`,
|
|
375
|
+
game,
|
|
376
|
+
title,
|
|
377
|
+
kind: n.kind,
|
|
378
|
+
source,
|
|
379
|
+
at: now,
|
|
380
|
+
...publishedAt === void 0 ? {} : { publishedAt },
|
|
381
|
+
...version === void 0 ? {} : { version },
|
|
382
|
+
...summary === void 0 ? {} : { summary: summary.slice(0, 600) },
|
|
383
|
+
...(url ?? before?.url) === void 0 ? {} : { url: url ?? before?.url },
|
|
384
|
+
...cover === void 0 ? {} : { cover },
|
|
385
|
+
...lasting === true ? { lasting: true } : {}
|
|
386
|
+
};
|
|
387
|
+
if (at < 0)
|
|
388
|
+
list.push(next);
|
|
389
|
+
else
|
|
390
|
+
list[at] = next;
|
|
391
|
+
out.push(next);
|
|
392
|
+
}
|
|
393
|
+
const lastingOnes = list.filter((x) => x.lasting === true);
|
|
394
|
+
const rest = list.filter((x) => x.lasting !== true).sort((a, b) => (b.publishedAt ?? b.at) - (a.publishedAt ?? a.at)).slice(0, MAX_NOTICES);
|
|
395
|
+
this.#saved.notices[game] = [...lastingOnes, ...rest];
|
|
396
|
+
await this.save();
|
|
397
|
+
return out;
|
|
398
|
+
}
|
|
296
399
|
/** Follow or stop following an SRA game; stopping forgets its events. */
|
|
297
400
|
async follow(sra, follow, gameId) {
|
|
298
401
|
const list = this.#saved.settings.followed.filter((id) => id !== sra);
|
|
@@ -569,9 +672,9 @@ var Calendar = class {
|
|
|
569
672
|
this.#derive(item, timeZone(item.game));
|
|
570
673
|
await this.save();
|
|
571
674
|
}
|
|
572
|
-
/** The pictures the user added that an event still shows (`own:<file>`). */
|
|
675
|
+
/** The pictures the user added that an event or a game's banner still shows (`own:<file>`). */
|
|
573
676
|
ownImages() {
|
|
574
|
-
const out =
|
|
677
|
+
const out = new Set(Object.values(this.#saved.settings.banners).filter((b) => OWN_IMAGE.test(b)));
|
|
575
678
|
for (const a of this.#items)
|
|
576
679
|
if (a.mine?.cover?.startsWith("own:") === true)
|
|
577
680
|
out.add(a.mine.cover);
|
|
@@ -987,6 +1090,55 @@ function isLong(a) {
|
|
|
987
1090
|
}
|
|
988
1091
|
|
|
989
1092
|
// packages/game-intel/lib/sources.js
|
|
1093
|
+
var STEAM_CLAN_IMAGE = "https://clan.akamai.steamstatic.com/images";
|
|
1094
|
+
var UPDATE_WORDS = /patch|update|hotfix|bug ?fix|fixes|release notes|changelog|版本|更新|补丁|修复|热修/i;
|
|
1095
|
+
var VERSION_IN_TITLE = /\bv?\d+\.\d+(?:\.\d+){0,2}[a-z]?\b/i;
|
|
1096
|
+
function plainSteamText(text) {
|
|
1097
|
+
return text.replace(/\[img[^\]]*\][\s\S]*?\[\/img\]/gi, " ").replace(/\{STEAM_CLAN_IMAGE\}\S*/g, " ").replace(/\[\/?[a-z0-9*]+(?:[= ][^\]]*)?\]/gi, " ").replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/\s+/g, " ").trim();
|
|
1098
|
+
}
|
|
1099
|
+
function steamImage(text) {
|
|
1100
|
+
const raw = /\[img(?:\s+src="([^"]+)")?[^\]]*\]([^[]*)\[\/img\]/i.exec(text) ?? /<img[^>]+src="([^"]+)"/i.exec(text);
|
|
1101
|
+
const found = (raw?.[1] ?? raw?.[2])?.trim();
|
|
1102
|
+
if (found === void 0 || found === "")
|
|
1103
|
+
return void 0;
|
|
1104
|
+
const url = found.replace("{STEAM_CLAN_IMAGE}", STEAM_CLAN_IMAGE);
|
|
1105
|
+
return url.startsWith("https://") ? url : void 0;
|
|
1106
|
+
}
|
|
1107
|
+
function parseSteam(body) {
|
|
1108
|
+
const items = body?.appnews?.newsitems;
|
|
1109
|
+
if (!Array.isArray(items))
|
|
1110
|
+
throw new Error("Steam \u65B0\u95FB\u7684\u683C\u5F0F\u4E0D\u5BF9\uFF08\u6CA1\u6709 appnews.newsitems\uFF09");
|
|
1111
|
+
const out = [];
|
|
1112
|
+
for (const raw of items) {
|
|
1113
|
+
const item = raw;
|
|
1114
|
+
const title = typeof item["title"] === "string" ? item["title"].trim() : "";
|
|
1115
|
+
if (title === "")
|
|
1116
|
+
continue;
|
|
1117
|
+
const contents = typeof item["contents"] === "string" ? item["contents"] : "";
|
|
1118
|
+
const tags = Array.isArray(item["tags"]) ? item["tags"].filter((t) => typeof t === "string") : [];
|
|
1119
|
+
const summary = plainSteamText(contents);
|
|
1120
|
+
const cover = steamImage(contents);
|
|
1121
|
+
const version = VERSION_IN_TITLE.exec(title)?.[0];
|
|
1122
|
+
out.push({
|
|
1123
|
+
title,
|
|
1124
|
+
kind: tags.includes("patchnotes") || UPDATE_WORDS.test(title) ? "update" : "notice",
|
|
1125
|
+
...typeof item["date"] === "number" ? { publishedAt: item["date"] * 1e3 } : {},
|
|
1126
|
+
...typeof item["url"] === "string" && item["url"].startsWith("https://") ? { url: item["url"] } : {},
|
|
1127
|
+
...summary === "" ? {} : { summary: summary.length > 240 ? `${summary.slice(0, 240)}\u2026` : summary },
|
|
1128
|
+
...cover === void 0 ? {} : { cover },
|
|
1129
|
+
...version === void 0 ? {} : { version }
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
return out;
|
|
1133
|
+
}
|
|
1134
|
+
async function readSteam(steam, fetchImpl, signal) {
|
|
1135
|
+
const url = `https://api.steampowered.com/ISteamNews/GetNewsForApp/v2/?appid=${steam.appid}&count=20&feeds=steam_community_announcements&format=json`;
|
|
1136
|
+
const timeout = AbortSignal.timeout(TIMEOUT_MS);
|
|
1137
|
+
const response = await fetchImpl(url, { signal: signal === void 0 ? timeout : AbortSignal.any([signal, timeout]), headers: { "user-agent": USER_AGENT, accept: "application/json" } });
|
|
1138
|
+
if (!response.ok)
|
|
1139
|
+
throw new Error(response.status === 403 || response.status === 404 ? `Steam \u4E0A\u6CA1\u6709 app ${steam.appid} \u7684\u65B0\u95FB\uFF08HTTP ${response.status}\uFF09` : `HTTP ${response.status}`);
|
|
1140
|
+
return parseSteam(await response.json());
|
|
1141
|
+
}
|
|
990
1142
|
var USER_AGENT = "MultiGameAssistant/0.6 (game event calendar; +https://github.com/haaahhhis/MultiGameAssistant)";
|
|
991
1143
|
var TIMEOUT_MS = 25e3;
|
|
992
1144
|
var MAX_PAGES = 4;
|
|
@@ -1269,6 +1421,7 @@ function tool(spec) {
|
|
|
1269
1421
|
};
|
|
1270
1422
|
}
|
|
1271
1423
|
var GAME = { type: "string", description: "\u6E38\u620F id\uFF08game_list \u53EF\u67E5\uFF09\uFF0C\u4F8B\u5982 arknights\u3001starrail\u3001endfield\u3002" };
|
|
1424
|
+
var NOTICE_KIND = { update: "\u7248\u672C\u66F4\u65B0", notice: "\u516C\u544A", news: "\u8D44\u8BAF" };
|
|
1272
1425
|
function gameTools(deps) {
|
|
1273
1426
|
const known = (id) => {
|
|
1274
1427
|
const game = deps.games().find((g) => g.id === id || g.name === id || g.aliases.includes(id));
|
|
@@ -1301,7 +1454,7 @@ function gameTools(deps) {
|
|
|
1301
1454
|
return [
|
|
1302
1455
|
tool({
|
|
1303
1456
|
name: "game_add",
|
|
1304
|
-
description: "\u7ED9\u4E00\u4E2A\u8FD8\u6CA1\u6709\u6E38\u620F\u5305\u7684\u6E38\u620F\u5EFA\u4E00\u4E2A\uFF08\u7528\u6237\u81EA\u5DF1\u7684\u6E38\u620F\u5305\uFF09\uFF0C\u4E4B\u540E\u6E38\u620F\u9875\u5C31\u80FD\u663E\u793A\u5B83\u7684\u6D3B\u52A8\u3002\u6765\u6E90\
|
|
1457
|
+
description: "\u7ED9\u4E00\u4E2A\u8FD8\u6CA1\u6709\u6E38\u620F\u5305\u7684\u6E38\u620F\u5EFA\u4E00\u4E2A\uFF08\u7528\u6237\u81EA\u5DF1\u7684\u6E38\u620F\u5305\uFF0C\u540C\u4E00\u4E2A id \u518D\u5199\u5C31\u662F\u6539\u5B83\uFF09\uFF0C\u4E4B\u540E\u6E38\u620F\u9875\u5C31\u80FD\u663E\u793A\u5B83\u7684\u6D3B\u52A8\u548C\u516C\u544A\u3002\u6765\u6E90\u56DB\u79CD\uFF1Asra\uFF08SRA \u516C\u5171 API \u7684\u6E38\u620F id\uFF09\u3001smw\uFF08Semantic MediaWiki \u7684 api.php \u67E5\u8BE2\uFF0C\u80FD\u8BFB\u5230\u6D3B\u52A8\u8D77\u6B62\u65F6\u95F4\uFF09\u3001steam_appid\uFF08Steam \u4E0A\u7684\u5B98\u65B9\u516C\u544A\uFF1A\u7248\u672C\u66F4\u65B0\u3001\u8865\u4E01\u8BF4\u660E\uFF0C\u5355\u673A\u6E38\u620F\u7528\uFF09\u3001\u53EA\u6709 homepage\uFF08\u5B98\u7F51\u516C\u544A\u7B49\uFF0C\u7531 agent \u8BFB\uFF09\u3002\u5355\u673A\u6E38\u620F\uFF08\u6CA1\u6709\u9650\u65F6\u6D3B\u52A8\uFF09\u5199 single=true\uFF0C\u6E38\u620F\u9875\u5148\u5217\u516C\u544A\u3002\u80FD\u81EA\u52A8\u8BFB\u7684\u4F1A\u9A6C\u4E0A\u8BFB\u4E00\u6B21\u3002\u7528\u6237\u8BF4\u300C\u52A0\u4E00\u4E2A XX \u6E38\u620F\u300D\u6216\u6E38\u620F\u9875\u8BA9\u4F60\u627E\u6765\u6E90\u65F6\u7528\u3002",
|
|
1305
1458
|
properties: {
|
|
1306
1459
|
id: { type: "string", description: "\u5C0F\u5199\u82F1\u6587\u3001\u6570\u5B57\u548C\u77ED\u6A2A\u7EBF\uFF0C\u4F8B\u5982 wuthering-waves\u3002" },
|
|
1307
1460
|
name: { type: "string", description: "\u4E2D\u6587\u6B63\u5F0F\u540D\u3002" },
|
|
@@ -1318,15 +1471,19 @@ function gameTools(deps) {
|
|
|
1318
1471
|
name: { type: "string", description: "\u7ED9\u4EBA\u770B\u7684\u540D\u5B57\uFF0C\u4F8B\u5982\u300C\u5B98\u7F51\u65B0\u95FB\u300D\u3002" },
|
|
1319
1472
|
homepage: { type: "string", description: "\u4EBA\u80FD\u6253\u5F00\u7684\u9875\u9762\u5730\u5740\u3002" },
|
|
1320
1473
|
sra_game: { type: "string", description: "SRA \u516C\u5171 API \u7684\u6E38\u620F id\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
1321
|
-
smw: { type: "object", description: "Semantic MediaWiki \u67E5\u8BE2\uFF08\u53EF\u9009\uFF09\uFF1A{ api, conditions, title?, start, end, shopEnd?, dates: date|text, page? }\u3002" }
|
|
1474
|
+
smw: { type: "object", description: "Semantic MediaWiki \u67E5\u8BE2\uFF08\u53EF\u9009\uFF09\uFF1A{ api, conditions, title?, start, end, shopEnd?, dates: date|text, page? }\u3002" },
|
|
1475
|
+
steam_appid: { type: "number", description: "Steam \u7684 app id\uFF08\u53EF\u9009\uFF0C\u5546\u5E97\u9875 store.steampowered.com/app/<\u6570\u5B57> \u91CC\u7684\u6570\u5B57\uFF09\uFF1A\u63D2\u4EF6\u6BCF\u5929\u8BFB\u5B83\u5728 Steam \u7684\u5B98\u65B9\u516C\u544A\uFF08\u7248\u672C\u66F4\u65B0\u3001\u8865\u4E01\u8BF4\u660E\uFF09\u3002sra_game\u3001smw\u3001steam_appid \u4E00\u4E2A\u6765\u6E90\u53EA\u5199\u4E00\u4E2A\u3002" }
|
|
1322
1476
|
},
|
|
1323
1477
|
required: ["id", "name"],
|
|
1324
1478
|
additionalProperties: false
|
|
1325
1479
|
}
|
|
1326
1480
|
},
|
|
1481
|
+
single: { type: "boolean", description: "\u5355\u673A\u6E38\u620F\uFF08\u4E70\u65AD\u5236\u3001\u6CA1\u6709\u9650\u65F6\u6D3B\u52A8\uFF09\uFF1A\u6E38\u620F\u9875\u5148\u5217\u516C\u544A\u548C\u7248\u672C\u66F4\u65B0\u3002" },
|
|
1327
1482
|
guide: { type: "string", description: "GAME.md \u6B63\u6587\uFF08\u53EF\u9009\uFF09\uFF1A\u54EA\u4E9B\u6765\u6E90\u770B\u4EC0\u4E48\u3001\u516C\u544A\u9875\u600E\u4E48\u627E\u6D3B\u52A8\u3002" }
|
|
1328
1483
|
},
|
|
1329
1484
|
required: ["id", "name", "sources"],
|
|
1485
|
+
// The sources the plugin reads itself are read before it returns.
|
|
1486
|
+
timeoutMs: 12e4,
|
|
1330
1487
|
kind: "other",
|
|
1331
1488
|
title: (a) => `\u6DFB\u52A0\u6E38\u620F\uFF1A${String(a["name"] ?? a["id"] ?? "")}`,
|
|
1332
1489
|
execute: async (args) => {
|
|
@@ -1336,7 +1493,8 @@ function gameTools(deps) {
|
|
|
1336
1493
|
aliases: external_exports.array(external_exports.string()).nullish(),
|
|
1337
1494
|
timezone: external_exports.string().nullish(),
|
|
1338
1495
|
daily_reset: external_exports.string().nullish(),
|
|
1339
|
-
sources: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), homepage: external_exports.string().nullish(), sra_game: external_exports.string().nullish(), smw: external_exports.record(external_exports.string(), external_exports.unknown()).nullish() })).min(1),
|
|
1496
|
+
sources: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), homepage: external_exports.string().nullish(), sra_game: external_exports.string().nullish(), smw: external_exports.record(external_exports.string(), external_exports.unknown()).nullish(), steam_appid: external_exports.number().int().positive().nullish() })).min(1),
|
|
1497
|
+
single: external_exports.boolean().nullish(),
|
|
1340
1498
|
guide: external_exports.string().nullish()
|
|
1341
1499
|
}), args);
|
|
1342
1500
|
const manifest = {
|
|
@@ -1345,16 +1503,26 @@ function gameTools(deps) {
|
|
|
1345
1503
|
...a.aliases == null ? {} : { aliases: a.aliases },
|
|
1346
1504
|
...a.timezone == null ? {} : { timezone: a.timezone },
|
|
1347
1505
|
...a.daily_reset == null ? {} : { dailyReset: a.daily_reset },
|
|
1506
|
+
...a.single === true ? { single: true } : {},
|
|
1348
1507
|
sources: a.sources.map((s) => ({
|
|
1349
1508
|
id: s.id,
|
|
1350
1509
|
name: s.name,
|
|
1351
1510
|
...s.homepage == null ? {} : { homepage: s.homepage },
|
|
1352
1511
|
...s.sra_game == null ? {} : { sra: { game: s.sra_game } },
|
|
1353
|
-
...s.smw == null ? {} : { smw: s.smw }
|
|
1512
|
+
...s.smw == null ? {} : { smw: s.smw },
|
|
1513
|
+
...s.steam_appid == null ? {} : { steam: { appid: s.steam_appid } }
|
|
1354
1514
|
}))
|
|
1355
1515
|
};
|
|
1356
|
-
const game = await deps.add(manifest, a.guide ?? void 0);
|
|
1357
|
-
return {
|
|
1516
|
+
const { game, read } = await deps.add(manifest, a.guide ?? void 0);
|
|
1517
|
+
return {
|
|
1518
|
+
added: game.id,
|
|
1519
|
+
name: game.name,
|
|
1520
|
+
sources: game.sources.map((s) => `${s.name}\uFF08${s.auto ? "\u81EA\u52A8\u8BFB" : "agent \u8BFB"}\uFF09`),
|
|
1521
|
+
...read === void 0 ? { note: "\u5DF2\u52A0\u5230\u6E38\u620F\u9875\uFF1B\u6CA1\u6709\u80FD\u81EA\u52A8\u8BFB\u7684\u6765\u6E90\uFF0C\u516C\u544A\u548C\u6D3B\u52A8\u8981 agent \u8BFB" } : {
|
|
1522
|
+
read_now: { activities: read.count, notices: read.notices ?? 0, ...read.detail === void 0 ? {} : { failed: read.detail } },
|
|
1523
|
+
note: `\u5DF2\u52A0\u5230\u6E38\u620F\u9875\uFF0C\u80FD\u81EA\u52A8\u8BFB\u7684\u6765\u6E90\u5DF2\u7ECF\u8BFB\u4E86\u4E00\u6B21\uFF1A${read.count} \u4E2A\u6D3B\u52A8\u3001${read.notices ?? 0} \u6761\u516C\u544A\uFF08\u4EE5\u540E\u6BCF\u5929\u81EA\u52A8\u8BFB\uFF09\u3002\u8FD9\u4E9B\u4E0D\u7528\u518D\u7528 game_record / game_notice \u8BB0\uFF1B\u53EA\u8BFB agent \u8BFB\u7684\u6765\u6E90\u3002`
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1358
1526
|
}
|
|
1359
1527
|
}),
|
|
1360
1528
|
tool({
|
|
@@ -1380,7 +1548,7 @@ function gameTools(deps) {
|
|
|
1380
1548
|
}),
|
|
1381
1549
|
tool({
|
|
1382
1550
|
name: "game_activities",
|
|
1383
|
-
description: "\u6D3B\u52A8\u65E5\u5386\uFF1A\u5404\u6E38\u620F\u8FDB\u884C\u4E2D\u548C\u5373\u5C06\u5F00\u59CB\u7684\u6D3B\u52A8\u3001\u7ED3\u675F\u65F6\u95F4\u548C\u5269\u4F59\u5929\u6570\u3001\u5728\u6E38\u620F\u91CC\u8BFB\u5230\u7684\u672A\u5B8C\u6210\u9879\u3002\u7528\u6237\u95EE\u300C\u65B9\u821F\u6709\u4EC0\u4E48\u6D3B\u52A8\u300D\u300C\u8FD8\u5269\u51E0\u5929\u300D\u65F6\u5148\u770B\u8FD9\u4E2A\uFF1B\u592A\u4E45\u6CA1\u5237\u65B0\uFF08refreshed \u5F88\u65E7\uFF09\u5C31\u5148 game_sites_refresh\u3002",
|
|
1551
|
+
description: "\u6D3B\u52A8\u65E5\u5386\u548C\u516C\u544A\uFF1A\u5404\u6E38\u620F\u8FDB\u884C\u4E2D\u548C\u5373\u5C06\u5F00\u59CB\u7684\u6D3B\u52A8\u3001\u7ED3\u675F\u65F6\u95F4\u548C\u5269\u4F59\u5929\u6570\u3001\u5728\u6E38\u620F\u91CC\u8BFB\u5230\u7684\u672A\u5B8C\u6210\u9879\uFF0C\u4EE5\u53CA\u6700\u8FD1\u7684\u516C\u544A\uFF08\u7248\u672C\u66F4\u65B0\u3001\u957F\u671F\u516C\u544A\uFF1B\u5355\u673A\u6E38\u620F\u4E3B\u8981\u770B\u8FD9\u4E2A\uFF09\u3002\u7528\u6237\u95EE\u300C\u65B9\u821F\u6709\u4EC0\u4E48\u6D3B\u52A8\u300D\u300C\u8FD8\u5269\u51E0\u5929\u300D\u300CXX \u6700\u8FD1\u66F4\u65B0\u4E86\u4EC0\u4E48\u300D\u65F6\u5148\u770B\u8FD9\u4E2A\uFF1B\u592A\u4E45\u6CA1\u5237\u65B0\uFF08refreshed \u5F88\u65E7\uFF09\u5C31\u5148 game_sites_refresh\u3002",
|
|
1384
1552
|
properties: { game: { ...GAME, description: "\u53EA\u770B\u8FD9\u4E2A\u6E38\u620F\uFF08\u4E0D\u586B\u770B\u5168\u90E8\uFF09\u3002" } },
|
|
1385
1553
|
readOnly: true,
|
|
1386
1554
|
kind: "read",
|
|
@@ -1389,7 +1557,26 @@ function gameTools(deps) {
|
|
|
1389
1557
|
const a = parse(external_exports.object({ game: external_exports.string().nullish() }), args);
|
|
1390
1558
|
const games = a.game == null ? deps.games() : [known(a.game)];
|
|
1391
1559
|
return {
|
|
1392
|
-
games: games.map((g) =>
|
|
1560
|
+
games: games.map((g) => {
|
|
1561
|
+
const notices = deps.notices(g.id).slice(0, 10);
|
|
1562
|
+
return {
|
|
1563
|
+
game: g.id,
|
|
1564
|
+
name: g.name,
|
|
1565
|
+
...g.single === true ? { single_player: true } : {},
|
|
1566
|
+
activities: deps.activities(g.id).map((x) => brief(x, g.timezone)),
|
|
1567
|
+
...notices.length === 0 ? {} : { notices: notices.map((n) => ({
|
|
1568
|
+
id: n.id,
|
|
1569
|
+
title: n.title,
|
|
1570
|
+
kind: NOTICE_KIND[n.kind],
|
|
1571
|
+
...n.publishedAt === void 0 ? {} : { date: shortDate(n.publishedAt, g.timezone) },
|
|
1572
|
+
...n.version === void 0 ? {} : { version: n.version },
|
|
1573
|
+
...n.summary === void 0 ? {} : { summary: n.summary },
|
|
1574
|
+
...n.url === void 0 ? {} : { url: n.url },
|
|
1575
|
+
...n.lasting === true ? { lasting: true } : {},
|
|
1576
|
+
from: n.source.name
|
|
1577
|
+
})) }
|
|
1578
|
+
};
|
|
1579
|
+
})
|
|
1393
1580
|
};
|
|
1394
1581
|
}
|
|
1395
1582
|
}),
|
|
@@ -1474,6 +1661,76 @@ function gameTools(deps) {
|
|
|
1474
1661
|
};
|
|
1475
1662
|
}
|
|
1476
1663
|
}),
|
|
1664
|
+
tool({
|
|
1665
|
+
name: "game_notice",
|
|
1666
|
+
description: [
|
|
1667
|
+
"\u628A\u8BFB\u5230\u7684\u516C\u544A\u8BB0\u5230\u6E38\u620F\u9875\u7684\u300C\u516C\u544A\u300D\u91CC\uFF0C\u5B83\u4EEC\u4E0D\u662F\u6709\u8D77\u6B62\u65F6\u95F4\u7684\u9650\u65F6\u6D3B\u52A8\uFF08\u9650\u65F6\u6D3B\u52A8\u7528 game_record\uFF09\uFF1A",
|
|
1668
|
+
"kind=update \u7248\u672C\u66F4\u65B0\u3001\u8865\u4E01\u8BF4\u660E\uFF08\u5199\u4E0A\u7248\u672C\u53F7\uFF09\uFF1Bkind=notice \u516C\u544A\uFF0C\u957F\u671F\u6709\u6548\u7684\uFF08\u5E38\u9A7B\u89C4\u5219\u3001\u957F\u671F\u6D3B\u52A8\u8BF4\u660E\u3001\u505C\u670D / \u7EF4\u62A4\u5B89\u6392\uFF09\u5199 lasting=true\uFF0C\u4F1A\u4E00\u76F4\u7559\u5728\u6700\u524D\u9762\uFF1Bkind=news \u5176\u4ED6\u8D44\u8BAF\u3002",
|
|
1669
|
+
"\u5355\u673A\u6E38\u620F\u4E3B\u8981\u8BB0\u8FD9\u4E2A\u3002\u516C\u544A\u5217\u8868\u4E0A\u6700\u8FD1\u7684\u6BCF\u4E00\u7BC7\u90FD\u8BB0\uFF08\u6807\u9898\u3001\u65E5\u671F\u3001\u7F51\u5740\u7167\u5217\u8868\u5199\uFF09\uFF0C\u4E0D\u662F\u53EA\u8BB0\u70B9\u5F00\u8BFB\u8FC7\u7684\uFF1B\u8BFB\u8FC7\u5168\u6587\u7684\u5199 summary\uFF0C\u7528\u4E00\u4E24\u53E5\u4E2D\u6587\u5199\u6E05\u695A\u6539\u4E86\u4EC0\u4E48\u3002",
|
|
1670
|
+
"\u540C\u4E00\u4E2A\u7F51\u5740\uFF08\u6CA1\u6709\u7F51\u5740\u65F6\u540C\u4E00\u4E2A\u6807\u9898\uFF09\u518D\u8BB0\u5C31\u662F\u66F4\u65B0\u539F\u6765\u90A3\u6761\uFF1Blasting=false \u53EF\u4EE5\u628A\u957F\u671F\u516C\u544A\u6536\u56DE\u3002\u53EA\u8BB0\u6709\u51FA\u5904\u7684\u5185\u5BB9\u3002"
|
|
1671
|
+
].join(""),
|
|
1672
|
+
properties: {
|
|
1673
|
+
game: GAME,
|
|
1674
|
+
notices: {
|
|
1675
|
+
type: "array",
|
|
1676
|
+
description: "\u6BCF\u7BC7\u516C\u544A\u4E00\u6761\u3002",
|
|
1677
|
+
items: {
|
|
1678
|
+
type: "object",
|
|
1679
|
+
properties: {
|
|
1680
|
+
title: { type: "string", description: "\u516C\u544A\u6807\u9898\uFF08\u539F\u6587\uFF09\u3002" },
|
|
1681
|
+
kind: { type: "string", enum: ["update", "notice", "news"], description: "update\uFF1A\u7248\u672C\u66F4\u65B0 / \u8865\u4E01\uFF1Bnotice\uFF1A\u516C\u544A\uFF1Bnews\uFF1A\u5176\u4ED6\u8D44\u8BAF\u3002" },
|
|
1682
|
+
published_at: { type: "string", description: "\u53D1\u5E03\u65E5\u671F\uFF0C\u5199\u6210 2026/11/19 \u6216 2026/11/19 10:00\uFF08\u6E38\u620F\u670D\u52A1\u5668\u65F6\u95F4\uFF09\u3002" },
|
|
1683
|
+
version: { type: "string", description: "kind=update\uFF1A\u7248\u672C\u53F7\uFF0C\u4F8B\u5982 v1.0.3\u3002" },
|
|
1684
|
+
summary: { type: "string", description: "\u4E00\u4E24\u53E5\u8BDD\uFF1A\u6539\u4E86\u4EC0\u4E48\u3001\u8981\u6CE8\u610F\u4EC0\u4E48\u3002" },
|
|
1685
|
+
url: { type: "string", description: "\u516C\u544A\u7684\u7F51\u5740\u3002" },
|
|
1686
|
+
cover: { type: "string", description: "\u516C\u544A\u914D\u56FE\u7684\u5730\u5740\uFF08https\uFF0C\u53EF\u9009\uFF09\u3002" },
|
|
1687
|
+
lasting: { type: "boolean", description: "\u957F\u671F\u6709\u6548\u7684\u516C\u544A\uFF0C\u4E00\u76F4\u7559\u5728\u6700\u524D\u9762\uFF1Bfalse \u6536\u56DE\u3002" }
|
|
1688
|
+
},
|
|
1689
|
+
required: ["title", "kind"],
|
|
1690
|
+
additionalProperties: false
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
},
|
|
1694
|
+
required: ["game", "notices"],
|
|
1695
|
+
kind: "other",
|
|
1696
|
+
title: (a) => `\u8BB0\u5F55\u516C\u544A\uFF1A${String(a["game"] ?? "")}`,
|
|
1697
|
+
execute: async (args) => {
|
|
1698
|
+
const a = parse(external_exports.object({
|
|
1699
|
+
game: external_exports.string(),
|
|
1700
|
+
notices: external_exports.array(external_exports.object({
|
|
1701
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
1702
|
+
kind: external_exports.enum(["update", "notice", "news"]),
|
|
1703
|
+
published_at: external_exports.string().nullish(),
|
|
1704
|
+
version: external_exports.string().max(40).nullish(),
|
|
1705
|
+
summary: external_exports.string().max(600).nullish(),
|
|
1706
|
+
url: external_exports.string().nullish(),
|
|
1707
|
+
cover: external_exports.string().nullish(),
|
|
1708
|
+
lasting: external_exports.boolean().nullish()
|
|
1709
|
+
})).min(1).max(30)
|
|
1710
|
+
}), args);
|
|
1711
|
+
const game = known(a.game);
|
|
1712
|
+
const notices = a.notices.map((n) => {
|
|
1713
|
+
const at = n.published_at == null ? void 0 : parseDateText(n.published_at, game.timezone, deps.now());
|
|
1714
|
+
const url = n.url != null && /^https?:\/\//.test(n.url) ? n.url : void 0;
|
|
1715
|
+
const cover = n.cover != null && n.cover.startsWith("https://") ? n.cover : void 0;
|
|
1716
|
+
return {
|
|
1717
|
+
title: n.title,
|
|
1718
|
+
kind: n.kind,
|
|
1719
|
+
...at == null ? {} : { publishedAt: at },
|
|
1720
|
+
...n.version == null ? {} : { version: n.version },
|
|
1721
|
+
...n.summary == null ? {} : { summary: n.summary },
|
|
1722
|
+
...url === void 0 ? {} : { url },
|
|
1723
|
+
...cover === void 0 ? {} : { cover },
|
|
1724
|
+
...n.lasting == null ? {} : { lasting: n.lasting }
|
|
1725
|
+
};
|
|
1726
|
+
});
|
|
1727
|
+
const kept = await deps.recordNotices(game.id, notices);
|
|
1728
|
+
return {
|
|
1729
|
+
recorded: kept.map((n) => ({ id: n.id, title: n.title, kind: NOTICE_KIND[n.kind], ...n.publishedAt === void 0 ? {} : { date: shortDate(n.publishedAt, game.timezone) }, ...n.lasting === true ? { lasting: true } : {} })),
|
|
1730
|
+
next: "\u8BB0\u4E0B\u4E86\uFF0C\u6E38\u620F\u9875\u7684\u300C\u516C\u544A\u300D\u91CC\u80FD\u770B\u5230\u3002"
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
}),
|
|
1477
1734
|
tool({
|
|
1478
1735
|
name: "game_activity_save",
|
|
1479
1736
|
description: [
|
|
@@ -1614,10 +1871,15 @@ function gameTools(deps) {
|
|
|
1614
1871
|
}
|
|
1615
1872
|
|
|
1616
1873
|
// packages/game-intel/lib/index.js
|
|
1874
|
+
var readsItself = (s) => s.smw !== void 0 || s.sra !== void 0 || s.steam !== void 0;
|
|
1617
1875
|
var ConfigSchema = external_exports.object({
|
|
1618
1876
|
/** The calendar and screenshots: `<dataDir>/games/`; the user's Game Packs: `<dataDir>/games/<id>/game.yaml`. */
|
|
1619
1877
|
dataDir: external_exports.string().min(1),
|
|
1620
|
-
/**
|
|
1878
|
+
/**
|
|
1879
|
+
* The official Game Packs: the 技能库's downloads (`<dataDir>/skill-hub/skills/game-<id>/game.yaml`,
|
|
1880
|
+
* beside the guide the hub registers as a skill). The app ships none; deleting one there removes the game.
|
|
1881
|
+
* @default <dataDir>/skill-hub/skills
|
|
1882
|
+
*/
|
|
1621
1883
|
gamesDir: external_exports.string().optional()
|
|
1622
1884
|
});
|
|
1623
1885
|
var GAME_ROLE = {
|
|
@@ -1650,6 +1912,8 @@ var AdgGameIntel = class extends Service {
|
|
|
1650
1912
|
fetch = (url, init) => fetch(url, init);
|
|
1651
1913
|
clock = realClock;
|
|
1652
1914
|
games = [];
|
|
1915
|
+
/** Every game pack there is, the ones taken off the game page too (`games` is what the page shows). */
|
|
1916
|
+
allGames = [];
|
|
1653
1917
|
daily;
|
|
1654
1918
|
dir;
|
|
1655
1919
|
/** Game programs' icons (exe-icon.ts). */
|
|
@@ -1664,7 +1928,7 @@ var AdgGameIntel = class extends Service {
|
|
|
1664
1928
|
const log = ctx.logger("adg-game-intel");
|
|
1665
1929
|
this.log = log;
|
|
1666
1930
|
this.dir = join2(spec.dataDir, "games");
|
|
1667
|
-
this.builtinDir = spec.gamesDir ??
|
|
1931
|
+
this.builtinDir = spec.gamesDir ?? join2(spec.dataDir, "skill-hub", "skills");
|
|
1668
1932
|
this.calendar = new Calendar(this.dir);
|
|
1669
1933
|
this.icons = new ExeIcons(join2(this.dir, "icons"));
|
|
1670
1934
|
const calendar = this.calendar;
|
|
@@ -1708,7 +1972,7 @@ var AdgGameIntel = class extends Service {
|
|
|
1708
1972
|
}
|
|
1709
1973
|
try {
|
|
1710
1974
|
const owner = { games: [game.manifest.id, game.manifest.name] };
|
|
1711
|
-
disposers.push(scoped.adgGateway.skillScope.register({ ...skill, source: game.builtin ? "bundled" : "custom", path: join2(game.dir, GAME_GUIDE_FILE), resourceBase: { kind: "directory", path: game.dir }, owner }));
|
|
1975
|
+
disposers.push(scoped.adgGateway.skillScope.register({ ...skill, source: game.builtin ? "bundled" : "custom", path: join2(game.dir, GAME_GUIDE_FILE), resourceBase: { kind: "directory", path: game.dir }, owner, kind: "game-pack" }));
|
|
1712
1976
|
} catch (error) {
|
|
1713
1977
|
log.warn(`game ${game.manifest.id}: skill not registered: ${error instanceof Error ? error.message : String(error)}`);
|
|
1714
1978
|
}
|
|
@@ -1724,6 +1988,11 @@ var AdgGameIntel = class extends Service {
|
|
|
1724
1988
|
for (const tool2 of gameTools({
|
|
1725
1989
|
games: () => this.infos(),
|
|
1726
1990
|
activities: (game) => calendar.list(game),
|
|
1991
|
+
notices: (game) => calendar.notices(game),
|
|
1992
|
+
recordNotices: async (game, notices) => {
|
|
1993
|
+
await this.ready;
|
|
1994
|
+
return this.recordNotices(game, notices);
|
|
1995
|
+
},
|
|
1727
1996
|
refresh: async (game) => {
|
|
1728
1997
|
await this.ready;
|
|
1729
1998
|
return this.refresh(game);
|
|
@@ -1786,7 +2055,8 @@ var AdgGameIntel = class extends Service {
|
|
|
1786
2055
|
"games/list": async () => {
|
|
1787
2056
|
await this.ready;
|
|
1788
2057
|
await this.loadGames(log);
|
|
1789
|
-
|
|
2058
|
+
const shown = new Set(this.games.map((g) => g.manifest.id));
|
|
2059
|
+
return { games: this.infos(), activities: calendar.list().filter((a) => shown.has(a.game)), notices: calendar.notices().filter((n) => shown.has(n.game)), settings: calendar.settings, report: { ...calendar.report, ...this.daily.next() === void 0 ? {} : { next: this.daily.next() } } };
|
|
1790
2060
|
},
|
|
1791
2061
|
"games/refresh": async (params) => {
|
|
1792
2062
|
await this.ready;
|
|
@@ -1835,6 +2105,13 @@ var AdgGameIntel = class extends Service {
|
|
|
1835
2105
|
await this.ready;
|
|
1836
2106
|
return this.picture(params.url);
|
|
1837
2107
|
},
|
|
2108
|
+
"games/banner/set": async (params) => {
|
|
2109
|
+
await this.ready;
|
|
2110
|
+
const p = params;
|
|
2111
|
+
const image = p.image !== void 0 ? Buffer.from(p.image.data, "base64") : p.path !== void 0 ? await this.imageFile(p.path) : void 0;
|
|
2112
|
+
const banner = await this.setBanner(p.game, image);
|
|
2113
|
+
return banner === void 0 ? {} : { banner };
|
|
2114
|
+
},
|
|
1838
2115
|
"games/source/add": async (params) => {
|
|
1839
2116
|
await this.ready;
|
|
1840
2117
|
const p = params;
|
|
@@ -1852,15 +2129,25 @@ var AdgGameIntel = class extends Service {
|
|
|
1852
2129
|
},
|
|
1853
2130
|
"games/discover": async (params) => {
|
|
1854
2131
|
await this.ready;
|
|
1855
|
-
return { sessionId: await this.discover(params.
|
|
2132
|
+
return { sessionId: await this.discover(params.game) };
|
|
2133
|
+
},
|
|
2134
|
+
"games/create": async (params) => {
|
|
2135
|
+
await this.ready;
|
|
2136
|
+
return { game: await this.createGame(params.name) };
|
|
2137
|
+
},
|
|
2138
|
+
"games/remove": async (params) => {
|
|
2139
|
+
await this.ready;
|
|
2140
|
+
await this.removeGame(params.game);
|
|
2141
|
+
return {};
|
|
1856
2142
|
},
|
|
1857
2143
|
"games/catalog": async () => {
|
|
1858
2144
|
await this.ready;
|
|
1859
|
-
|
|
2145
|
+
await this.loadGames(log);
|
|
1860
2146
|
return {
|
|
1861
2147
|
games: SRA_GAMES.map((g) => {
|
|
1862
|
-
const
|
|
1863
|
-
|
|
2148
|
+
const shown = this.games.find((l) => l.manifest.sources.some((s) => s.sra?.game === g.sra));
|
|
2149
|
+
const pack = shown === void 0 || shown.followed === true ? void 0 : shown.manifest.id;
|
|
2150
|
+
return { sra: g.sra, name: g.name, followed: shown !== void 0, ...pack === void 0 ? {} : { pack } };
|
|
1864
2151
|
})
|
|
1865
2152
|
};
|
|
1866
2153
|
},
|
|
@@ -1869,11 +2156,7 @@ var AdgGameIntel = class extends Service {
|
|
|
1869
2156
|
const { sra, follow } = params;
|
|
1870
2157
|
if (!SRA_GAMES.some((g) => g.sra === sra))
|
|
1871
2158
|
throw new Error(`SRA \u516C\u5171 API \u6CA1\u6709\u6E38\u620F ${sra}`);
|
|
1872
|
-
await
|
|
1873
|
-
await this.loadGames(log);
|
|
1874
|
-
changed();
|
|
1875
|
-
if (follow && this.games.some((g) => g.manifest.id === followedId(sra)))
|
|
1876
|
-
void this.refresh(followedId(sra)).catch(() => []);
|
|
2159
|
+
await this.showSra(sra, follow);
|
|
1877
2160
|
return {};
|
|
1878
2161
|
},
|
|
1879
2162
|
"games/activity/progress": async (params) => {
|
|
@@ -1928,7 +2211,7 @@ var AdgGameIntel = class extends Service {
|
|
|
1928
2211
|
}
|
|
1929
2212
|
if (!this.calendar.pictures().has(url) && !this.games.some((g) => g.manifest.art === url))
|
|
1930
2213
|
throw new Error("\u8FD9\u5F20\u56FE\u7247\u4E0D\u662F\u6570\u636E\u7AD9\u6216\u6E38\u620F\u5305\u7ED9\u7684\u5730\u5740");
|
|
1931
|
-
const name =
|
|
2214
|
+
const name = createHash2("sha256").update(url).digest("hex").slice(0, 32);
|
|
1932
2215
|
const dir = join2(this.dir, "images");
|
|
1933
2216
|
for (const [ext2, mediaType2] of IMAGE_TYPES) {
|
|
1934
2217
|
const cached = await readFile2(join2(dir, `${name}.${ext2}`)).catch(() => void 0);
|
|
@@ -1970,12 +2253,15 @@ var AdgGameIntel = class extends Service {
|
|
|
1970
2253
|
try {
|
|
1971
2254
|
const manifest = parseGameManifest(text, `${id}/${GAME_MANIFEST_FILE}`);
|
|
1972
2255
|
const guide = await readFile2(join2(dir, GAME_GUIDE_FILE), "utf8").catch(() => void 0);
|
|
1973
|
-
found.set(manifest.id, { manifest, dir, builtin, ...guide === void 0 ? {} : { guide } });
|
|
2256
|
+
found.set(manifest.id, { manifest, dir, builtin, ...builtin ? {} : { own: true }, ...guide === void 0 ? {} : { guide } });
|
|
1974
2257
|
} catch (error) {
|
|
1975
2258
|
log.warn(`game pack ${id}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1976
2259
|
}
|
|
1977
2260
|
}
|
|
1978
2261
|
}
|
|
2262
|
+
this.allGames = [...found.values()];
|
|
2263
|
+
for (const id of this.calendar.settings.hidden ?? [])
|
|
2264
|
+
found.delete(id);
|
|
1979
2265
|
const covered = new Set([...found.values()].flatMap((g) => g.manifest.sources.map((s) => s.sra?.game).filter((s) => s !== void 0)));
|
|
1980
2266
|
for (const sra of this.calendar.settings.followed) {
|
|
1981
2267
|
const game = SRA_GAMES.find((g) => g.sra === sra);
|
|
@@ -2020,6 +2306,31 @@ var AdgGameIntel = class extends Service {
|
|
|
2020
2306
|
throw new Error("\u4EC0\u4E48\u90FD\u6CA1\u7559\u4E0B\uFF1A\u8FD9\u4E2A\u6D3B\u52A8\u53EA\u6709\u4F60\u586B\u7684\u5185\u5BB9\uFF0C\u6E05\u7A7A\u540E\u5C31\u4ECE\u65E5\u5386\u53BB\u6389\u4E86");
|
|
2021
2307
|
return activity;
|
|
2022
2308
|
}
|
|
2309
|
+
/**
|
|
2310
|
+
* The picture the user picked for a game's banner, kept under
|
|
2311
|
+
* `<data>/games/images/own/`; undefined: the version's art again (the old
|
|
2312
|
+
* picture is let go). @returns its address (`own:<hash>.<ext>`).
|
|
2313
|
+
*/
|
|
2314
|
+
async setBanner(gameId, image) {
|
|
2315
|
+
const { manifest } = this.game(gameId);
|
|
2316
|
+
const banner = image === void 0 ? void 0 : await this.keepImage(image);
|
|
2317
|
+
await this.calendar.setBanner(manifest.id, banner);
|
|
2318
|
+
await this.sweepImages();
|
|
2319
|
+
this.changed(manifest.id);
|
|
2320
|
+
return banner;
|
|
2321
|
+
}
|
|
2322
|
+
/** A picture file the user picked in a file dialog on this computer. @throws Error when it is not one, or too big. */
|
|
2323
|
+
async imageFile(path) {
|
|
2324
|
+
const full = path.replace(/^"|"$/g, "");
|
|
2325
|
+
if (!isAbsolute(full))
|
|
2326
|
+
throw new Error("\u56FE\u7247\u8DEF\u5F84\u8981\u662F\u5B8C\u6574\u8DEF\u5F84");
|
|
2327
|
+
const info = await stat(full).catch(() => void 0);
|
|
2328
|
+
if (info === void 0 || !info.isFile())
|
|
2329
|
+
throw new Error(`\u627E\u4E0D\u5230\u56FE\u7247\u6587\u4EF6\uFF1A${full}`);
|
|
2330
|
+
if (info.size > MAX_IMAGE_BYTES)
|
|
2331
|
+
throw new Error("\u56FE\u7247\u592A\u5927\uFF08\u6700\u591A 8 MB\uFF09");
|
|
2332
|
+
return readFile2(full);
|
|
2333
|
+
}
|
|
2023
2334
|
timezone(game) {
|
|
2024
2335
|
return this.games.find((g) => g.manifest.id === game)?.manifest.timezone ?? "Asia/Shanghai";
|
|
2025
2336
|
}
|
|
@@ -2095,7 +2406,7 @@ var AdgGameIntel = class extends Service {
|
|
|
2095
2406
|
const ext = imageType(bytes);
|
|
2096
2407
|
if (ext === void 0)
|
|
2097
2408
|
throw new Error("\u4E0D\u662F\u652F\u6301\u7684\u56FE\u7247\uFF08png\u3001jpg\u3001gif\u3001webp\u3001avif\uFF09");
|
|
2098
|
-
const file = `${
|
|
2409
|
+
const file = `${createHash2("sha256").update(bytes).digest("hex").slice(0, 32)}.${ext}`;
|
|
2099
2410
|
const dir = this.imageDir(kind);
|
|
2100
2411
|
await mkdir2(dir, { recursive: true });
|
|
2101
2412
|
await writeFile(join2(dir, file), bytes);
|
|
@@ -2244,12 +2555,14 @@ var AdgGameIntel = class extends Service {
|
|
|
2244
2555
|
}
|
|
2245
2556
|
infos() {
|
|
2246
2557
|
const scripts = this.scriptsByGame();
|
|
2247
|
-
return this.games.map(({ manifest: m, builtin, followed }) => {
|
|
2558
|
+
return this.games.map(({ manifest: m, builtin, followed, own }) => {
|
|
2559
|
+
const sra = m.sources.map((s) => s.sra?.game).filter((id) => id !== void 0);
|
|
2248
2560
|
const refreshed = this.calendar.refreshed(m.id);
|
|
2249
2561
|
const reading = this.calendar.reading(m.id);
|
|
2250
2562
|
const webReading = this.calendar.reading(`${m.id}#web`);
|
|
2251
2563
|
const version = this.calendar.version(m.id);
|
|
2252
2564
|
const pools = this.calendar.pools(m.id, this.clock.now());
|
|
2565
|
+
const banner = this.calendar.banner(m.id);
|
|
2253
2566
|
return {
|
|
2254
2567
|
id: m.id,
|
|
2255
2568
|
name: m.name,
|
|
@@ -2257,10 +2570,14 @@ var AdgGameIntel = class extends Service {
|
|
|
2257
2570
|
scripts: scripts.get(m.id) ?? m.scripts,
|
|
2258
2571
|
timezone: m.timezone,
|
|
2259
2572
|
...m.screen === void 0 ? {} : { screen: { target: m.screen.target, ...m.screen.window === void 0 ? {} : { window: m.screen.window } } },
|
|
2260
|
-
sources: m.sources.map((s) => ({ id: s.id, name: s.name, ...s.homepage === void 0 ? {} : { homepage: s.homepage }, auto: s
|
|
2573
|
+
sources: m.sources.map((s) => ({ id: s.id, name: s.name, ...s.homepage === void 0 ? {} : { homepage: s.homepage }, auto: readsItself(s), .../^link-\d+$/.test(s.id) && this.calendar.links(m.id).some((l) => l.id === s.id) ? { added: true } : {} })),
|
|
2261
2574
|
builtin,
|
|
2262
2575
|
...m.art === void 0 ? {} : { art: m.art },
|
|
2576
|
+
...banner === void 0 ? {} : { banner },
|
|
2263
2577
|
...followed === true ? { followed: true } : {},
|
|
2578
|
+
...sra.length === 0 ? {} : { sra },
|
|
2579
|
+
...own === true ? { own: true } : {},
|
|
2580
|
+
...m.single === true ? { single: true } : {},
|
|
2264
2581
|
...refreshed === void 0 ? {} : { refreshed },
|
|
2265
2582
|
...reading === void 0 ? {} : { reading },
|
|
2266
2583
|
...webReading === void 0 ? {} : { webReading },
|
|
@@ -2275,18 +2592,24 @@ var AdgGameIntel = class extends Service {
|
|
|
2275
2592
|
const games = gameId === void 0 ? this.games : [this.game(gameId)];
|
|
2276
2593
|
const results = [];
|
|
2277
2594
|
for (const { manifest } of games) {
|
|
2278
|
-
const sources = manifest.sources.filter(
|
|
2595
|
+
const sources = manifest.sources.filter(readsItself);
|
|
2279
2596
|
if (sources.length === 0) {
|
|
2280
|
-
|
|
2597
|
+
const where = manifest.sources.map((s) => s.homepage).filter(Boolean).join(" \u6216 ") || "\u5B98\u7F51\u516C\u544A";
|
|
2598
|
+
results.push({ game: manifest.id, ok: false, count: 0, detail: manifest.single === true ? `\u6CA1\u6709\u80FD\u76F4\u63A5\u8BFB\u7684\u516C\u544A\u6765\u6E90\uFF1A\u7528 web_fetch \u770B ${where}\uFF0C\u7248\u672C\u66F4\u65B0\u548C\u516C\u544A\u7528 game_notice \u8BB0\u4E0B` : `\u6CA1\u6709\u80FD\u76F4\u63A5\u8BFB\u7684\u6570\u636E\u7AD9\uFF1A\u7528 web_fetch\uFF08\u53EA\u62FF\u5230\u7A7A\u58F3\u65F6\u7528\u5185\u7F6E\u6D4F\u89C8\u5668\uFF09\u770B ${where}\uFF0C\u518D\u7528 game_record\uFF08source=site\uFF09\u8BB0\u4E0B` });
|
|
2281
2599
|
continue;
|
|
2282
2600
|
}
|
|
2283
2601
|
const failures = [];
|
|
2284
2602
|
let count = 0;
|
|
2603
|
+
let notices = 0;
|
|
2285
2604
|
let version;
|
|
2286
2605
|
let pools;
|
|
2287
2606
|
for (const source of sources) {
|
|
2288
2607
|
const now = this.clock.now();
|
|
2289
2608
|
try {
|
|
2609
|
+
if (source.steam !== void 0) {
|
|
2610
|
+
notices += (await this.calendar.applyNotices(manifest.id, { id: source.id, name: source.name }, await readSteam(source.steam, this.fetch), now)).length;
|
|
2611
|
+
continue;
|
|
2612
|
+
}
|
|
2290
2613
|
let events;
|
|
2291
2614
|
if (source.sra !== void 0) {
|
|
2292
2615
|
const read = await readSra(source.sra, manifest, now, this.fetch);
|
|
@@ -2303,17 +2626,28 @@ var AdgGameIntel = class extends Service {
|
|
|
2303
2626
|
failures.push(`${source.name}\uFF1A${error instanceof Error ? error.message : String(error)}`);
|
|
2304
2627
|
}
|
|
2305
2628
|
}
|
|
2306
|
-
if (failures.length > 0 && count === 0)
|
|
2629
|
+
if (failures.length > 0 && count + notices === 0)
|
|
2307
2630
|
await this.calendar.refreshFailed(manifest.id, failures.join("\uFF1B"), this.clock.now());
|
|
2308
2631
|
else
|
|
2309
2632
|
await this.calendar.refreshDone(manifest.id, this.calendar.list(manifest.id).filter((a) => a.sources?.some((s) => !s.web) === true).length, this.clock.now(), version, pools);
|
|
2310
|
-
results.push({ game: manifest.id, ok: failures.length === 0 || count > 0, count, ...failures.length === 0 ? {} : { detail: failures.join("\uFF1B") } });
|
|
2633
|
+
results.push({ game: manifest.id, ok: failures.length === 0 || count + notices > 0, count, ...notices === 0 ? {} : { notices }, ...failures.length === 0 ? {} : { detail: failures.join("\uFF1B") } });
|
|
2311
2634
|
this.changed(manifest.id);
|
|
2312
2635
|
}
|
|
2313
2636
|
await this.sweepImages();
|
|
2314
2637
|
return results;
|
|
2315
2638
|
}
|
|
2316
2639
|
// ── what the agent read ──
|
|
2640
|
+
/** Announcements the agent read (game_notice), each credited to the site it came from. */
|
|
2641
|
+
async recordNotices(gameId, notices) {
|
|
2642
|
+
this.game(gameId);
|
|
2643
|
+
const kept = [];
|
|
2644
|
+
for (const notice of notices) {
|
|
2645
|
+
const host = notice.url !== void 0 && URL.canParse(notice.url) ? hostName(notice.url) : void 0;
|
|
2646
|
+
kept.push(...await this.calendar.applyNotices(gameId, { id: "agent", name: host === void 0 ? "agent \u67E5\u5230" : `${host}\uFF08agent \u67E5\u5230\uFF09` }, [notice], this.clock.now()));
|
|
2647
|
+
}
|
|
2648
|
+
this.changed(gameId);
|
|
2649
|
+
return kept;
|
|
2650
|
+
}
|
|
2317
2651
|
async record(gameId, from, events, sessionId, keep) {
|
|
2318
2652
|
const { manifest } = this.game(gameId);
|
|
2319
2653
|
const shot = from === "screen" && keep && sessionId !== void 0 ? this.ctx.get("adgIntervene")?.lastShot(sessionId) : void 0;
|
|
@@ -2375,6 +2709,11 @@ var AdgGameIntel = class extends Service {
|
|
|
2375
2709
|
* sources. A built-in pack of the same id is not replaced.
|
|
2376
2710
|
* @returns the game as the board shows it. @throws Error with what is wrong in the manifest.
|
|
2377
2711
|
*/
|
|
2712
|
+
/**
|
|
2713
|
+
* Write a game pack of the user's own (game_add). The sources the plugin
|
|
2714
|
+
* reads itself are read before this returns, so the agent sees what they
|
|
2715
|
+
* gave (Steam's announcements, a site's events) and does not read them again.
|
|
2716
|
+
*/
|
|
2378
2717
|
async addGame(input, guide) {
|
|
2379
2718
|
const parsed = GameManifest.safeParse(input);
|
|
2380
2719
|
if (!parsed.success)
|
|
@@ -2382,7 +2721,7 @@ var AdgGameIntel = class extends Service {
|
|
|
2382
2721
|
const manifest = parsed.data;
|
|
2383
2722
|
const existing = this.games.find((g) => g.manifest.id === manifest.id);
|
|
2384
2723
|
if (existing !== void 0 && existing.builtin && existing.followed !== true)
|
|
2385
|
-
throw new Error(`\u5DF2\u7ECF\u6709\
|
|
2724
|
+
throw new Error(`\u5DF2\u7ECF\u6709\u6280\u80FD\u5E93\u7684\u6E38\u620F\u5305\u300C${existing.manifest.name}\u300D\uFF08${manifest.id}\uFF09\uFF0C\u6362\u4E00\u4E2A id\uFF0C\u6216\u8005\u76F4\u63A5\u7528\u5B83`);
|
|
2386
2725
|
const dir = join2(this.dir, manifest.id);
|
|
2387
2726
|
await mkdir2(dir, { recursive: true });
|
|
2388
2727
|
await writeFile(join2(dir, GAME_MANIFEST_FILE), `# \u7531 agent \u7528 game_add \u5199\u7684\u6E38\u620F\u5305\uFF1B\u53EF\u4EE5\u76F4\u63A5\u6539\uFF08JSON \u4E5F\u662F YAML\uFF09\u3002
|
|
@@ -2397,31 +2736,148 @@ description: ${JSON.stringify(`${manifest.name}\u7684\u6D3B\u52A8\u548C\u8D44\u8
|
|
|
2397
2736
|
${guide.trim()}
|
|
2398
2737
|
`);
|
|
2399
2738
|
}
|
|
2739
|
+
if (this.calendar.settings.hidden?.includes(manifest.id) === true)
|
|
2740
|
+
await this.calendar.hide(manifest.id, false);
|
|
2400
2741
|
await this.loadGames(this.log);
|
|
2401
2742
|
this.changed(manifest.id);
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
return
|
|
2743
|
+
const read = manifest.sources.some(readsItself) ? (await this.refresh(manifest.id).catch(() => []))[0] : void 0;
|
|
2744
|
+
const game = this.infos().find((g) => g.id === manifest.id);
|
|
2745
|
+
return read === void 0 ? { game } : { game, read: { count: read.count, ...read.notices === void 0 ? {} : { notices: read.notices }, ...read.detail === void 0 ? {} : { detail: read.detail } } };
|
|
2405
2746
|
}
|
|
2406
|
-
|
|
2407
|
-
|
|
2747
|
+
// ── which games are on the page (apart from the 技能库's packs) ──
|
|
2748
|
+
/**
|
|
2749
|
+
* Show an SRA game, or stop: a game pack that reads it (from the 技能库 or
|
|
2750
|
+
* made here) is shown or taken off with it, the pack staying installed;
|
|
2751
|
+
* without one the API is followed. @returns the game's id on the page.
|
|
2752
|
+
*/
|
|
2753
|
+
async showSra(sra, show) {
|
|
2754
|
+
const packs = this.allGames.filter((g) => g.manifest.sources.some((s) => s.sra?.game === sra));
|
|
2755
|
+
for (const pack of packs)
|
|
2756
|
+
await this.calendar.hide(pack.manifest.id, !show);
|
|
2757
|
+
await this.calendar.follow(sra, show && packs.length === 0, followedId(sra));
|
|
2758
|
+
await this.loadGames(this.log);
|
|
2759
|
+
this.changed();
|
|
2760
|
+
const id = packs[0]?.manifest.id ?? followedId(sra);
|
|
2761
|
+
if (show && this.games.some((g) => g.manifest.id === id))
|
|
2762
|
+
void this.refresh(id).catch(() => []);
|
|
2763
|
+
return id;
|
|
2764
|
+
}
|
|
2765
|
+
/**
|
|
2766
|
+
* Put a game on the page by its name: one there already is it; one taken
|
|
2767
|
+
* off comes back; one the SRA public API knows is followed; any other is
|
|
2768
|
+
* made here, empty (no sources yet), for the agent to find its sources from
|
|
2769
|
+
* its page. No pack is downloaded: the page offers the 技能库's for it.
|
|
2770
|
+
* @returns its id.
|
|
2771
|
+
*/
|
|
2772
|
+
async createGame(name) {
|
|
2773
|
+
const wanted = name.trim();
|
|
2774
|
+
if (wanted === "")
|
|
2775
|
+
throw new Error("\u5199\u4E00\u4E2A\u6E38\u620F\u540D");
|
|
2776
|
+
const key = wanted.toLowerCase();
|
|
2777
|
+
await this.loadGames(this.log);
|
|
2778
|
+
const named = (g) => [g.manifest.id, g.manifest.name, ...g.manifest.aliases].some((n) => n.toLowerCase() === key);
|
|
2779
|
+
const shown = this.games.find(named);
|
|
2780
|
+
if (shown !== void 0)
|
|
2781
|
+
return shown.manifest.id;
|
|
2782
|
+
const away = this.allGames.find(named);
|
|
2783
|
+
if (away !== void 0) {
|
|
2784
|
+
await this.calendar.hide(away.manifest.id, false);
|
|
2785
|
+
await this.loadGames(this.log);
|
|
2786
|
+
this.changed(away.manifest.id);
|
|
2787
|
+
return away.manifest.id;
|
|
2788
|
+
}
|
|
2789
|
+
const sra = SRA_GAMES.find((g) => g.sra === key || g.name.toLowerCase() === key || g.words.some((w) => w.toLowerCase() === key));
|
|
2790
|
+
if (sra !== void 0)
|
|
2791
|
+
return this.showSra(sra.sra, true);
|
|
2792
|
+
const id = await this.freeId(wanted);
|
|
2793
|
+
const dir = join2(this.dir, id);
|
|
2794
|
+
await mkdir2(dir, { recursive: true });
|
|
2795
|
+
await writeFile(join2(dir, GAME_MANIFEST_FILE), `# \u5728\u6E38\u620F\u9875\u6309\u540D\u5B57\u6DFB\u52A0\u7684\u6E38\u620F\uFF1A\u6765\u6E90\u7531 agent \u627E\uFF08\u6E38\u620F\u9875\u4E0A\u7684\u300C\u8BA9 agent \u53BB\u627E\u300D\uFF09\uFF0C\u4E5F\u53EF\u4EE5\u76F4\u63A5\u6539\uFF08JSON \u4E5F\u662F YAML\uFF09\u3002
|
|
2796
|
+
${JSON.stringify({ id, name: wanted, sources: [] }, null, 2)}
|
|
2797
|
+
`);
|
|
2798
|
+
await this.loadGames(this.log);
|
|
2799
|
+
this.changed(id);
|
|
2800
|
+
return id;
|
|
2801
|
+
}
|
|
2802
|
+
/** An id for a game made by name: its letters and digits, else a short fingerprint of the name; not one in use. */
|
|
2803
|
+
async freeId(name) {
|
|
2804
|
+
const slug = name.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2805
|
+
const base = slug.length >= 2 ? slug.slice(0, 40).replace(/-+$/, "") : `game-${createHash2("sha256").update(name).digest("hex").slice(0, 8)}`;
|
|
2806
|
+
const taken = /* @__PURE__ */ new Set([
|
|
2807
|
+
...this.allGames.map((g) => g.manifest.id),
|
|
2808
|
+
...SRA_GAMES.map((g) => followedId(g.sra)),
|
|
2809
|
+
// Folders the plugin keeps beside the packs.
|
|
2810
|
+
"images",
|
|
2811
|
+
"evidence",
|
|
2812
|
+
"icons",
|
|
2813
|
+
...await readdir(this.dir).catch(() => [])
|
|
2814
|
+
]);
|
|
2815
|
+
for (let n = 1; ; n++) {
|
|
2816
|
+
const id = n === 1 ? base : `${base}-${n}`;
|
|
2817
|
+
if (!taken.has(id))
|
|
2818
|
+
return id;
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
/**
|
|
2822
|
+
* Take a game off the page: an SRA game is no longer followed, a game pack
|
|
2823
|
+
* from the 技能库 is hidden (it stays installed, with its skills), one made
|
|
2824
|
+
* here is deleted with its events.
|
|
2825
|
+
*/
|
|
2826
|
+
async removeGame(gameId) {
|
|
2827
|
+
await this.loadGames(this.log);
|
|
2828
|
+
const game = this.game(gameId);
|
|
2829
|
+
const sras = game.manifest.sources.map((s) => s.sra?.game).filter((s) => s !== void 0);
|
|
2830
|
+
if (game.followed === true) {
|
|
2831
|
+
for (const sra of sras)
|
|
2832
|
+
await this.calendar.follow(sra, false, gameId);
|
|
2833
|
+
} else if (game.own === true) {
|
|
2834
|
+
await rm(game.dir, { recursive: true, force: true });
|
|
2835
|
+
await this.calendar.forget(gameId);
|
|
2836
|
+
} else {
|
|
2837
|
+
await this.calendar.hide(gameId, true);
|
|
2838
|
+
}
|
|
2839
|
+
for (const sra of sras)
|
|
2840
|
+
if (this.calendar.settings.followed.includes(sra))
|
|
2841
|
+
await this.calendar.follow(sra, false, followedId(sra));
|
|
2842
|
+
await this.loadGames(this.log);
|
|
2843
|
+
if (this.games.some((g) => g.manifest.id === gameId)) {
|
|
2844
|
+
await this.calendar.hide(gameId, true);
|
|
2845
|
+
await this.loadGames(this.log);
|
|
2846
|
+
}
|
|
2847
|
+
this.changed();
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* The agent finds where a game on the page can be read (one added by name
|
|
2851
|
+
* has no sources yet) and writes them into its game pack (game_add, the same
|
|
2852
|
+
* id), from the game's page, which shows it working (its web reading). An
|
|
2853
|
+
* official pack is not rewritten: the agent reads the web for it instead.
|
|
2854
|
+
*/
|
|
2855
|
+
async discover(gameId) {
|
|
2856
|
+
const game = this.game(gameId);
|
|
2857
|
+
if (game.builtin && game.followed !== true)
|
|
2858
|
+
return this.readWeb(gameId);
|
|
2859
|
+
const { manifest } = game;
|
|
2408
2860
|
const sessions = this.ctx.get("sessionController");
|
|
2409
2861
|
if (sessions === void 0)
|
|
2410
2862
|
throw new Error("agent \u73B0\u5728\u4E0D\u53EF\u7528\uFF08\u4F1A\u8BDD\u670D\u52A1\u6CA1\u6709\u52A0\u8F7D\uFF09");
|
|
2411
|
-
const conversations = sessionConversations(sessions, () => this.ctx.get("adgGateway")?.workspaceDir(),
|
|
2412
|
-
const sessionId = await conversations.home(GAME_ROLE.id);
|
|
2863
|
+
const conversations = sessionConversations(sessions, () => this.ctx.get("adgGateway")?.workspaceDir(), (id, f) => this.ctx.get("adgGateway")?.skillScope.setFocus(id, f) ?? Promise.resolve(), () => this.ctx.get("adgGateway"));
|
|
2864
|
+
const sessionId = await conversations.home(GAME_ROLE.id, { focus: { games: [manifest.id] } });
|
|
2865
|
+
await this.calendar.setReading(`${manifest.id}#web`, { state: "running", at: this.clock.now(), sessionId });
|
|
2866
|
+
this.changed(manifest.id);
|
|
2413
2867
|
const known = SRA_GAMES.map((g) => `${g.sra}\uFF08${g.name}\uFF09`).join("\u3001");
|
|
2868
|
+
const has = manifest.sources.length === 0 ? "\u8FD8\u6CA1\u6709\u4EFB\u4F55\u6765\u6E90" : `\u73B0\u5728\u7684\u6765\u6E90\uFF1A${manifest.sources.map((s) => s.name).join("\u3001")}`;
|
|
2414
2869
|
const prompt = [
|
|
2415
|
-
`\
|
|
2416
|
-
`1. SRA \u516C\u5171 API\uFF1A\u5DF2\u77E5\u7684\u6E38\u620F id \u6709 ${known}\u3002\u662F\u5176\u4E2D\u4E4B\u4E00\u5C31\
|
|
2870
|
+
`\u6E38\u620F\u9875\u4E0A\u6709\u300C${manifest.name}\u300D\uFF08\u6E38\u620F id\uFF1A${manifest.id}\uFF09\uFF0C${has}\u3002\u6309\u6280\u80FD web-reading \u627E\u80FD\u8BFB\u5230\u5B83\u6D3B\u52A8\u548C\u8D44\u8BAF\u7684\u6765\u6E90\uFF0C\u5199\u8FDB\u5B83\u7684\u6E38\u620F\u5305\uFF1A`,
|
|
2871
|
+
`1. SRA \u516C\u5171 API\uFF1A\u5DF2\u77E5\u7684\u6E38\u620F id \u6709 ${known}\u3002\u5B83\u662F\u5176\u4E2D\u4E4B\u4E00\uFF0C\u5C31\u5199\u4E00\u4E2A sra \u6765\u6E90\uFF1A{ "id": "sra", "name": "SRA \u516C\u5171 API", "sra": { "game": "<\u90A3\u4E2A id>" } }\u3002`,
|
|
2417
2872
|
"2. Wiki\uFF1AB \u7AD9\u6E38\u620F WIKI\uFF08wiki.biligame.com/<\u7F29\u5199>\uFF09\u6216\u5B98\u65B9 / \u73A9\u5BB6 Wiki\uFF0C\u8BD5\u5B83\u7684 api.php?action=ask \u80FD\u4E0D\u80FD\u67E5\u5230\u5E26\u5F00\u59CB\u3001\u7ED3\u675F\u65F6\u95F4\u7684\u6D3B\u52A8\u9875\uFF1B\u80FD\u7684\u8BDD\u5199\u6210 smw \u6765\u6E90\uFF08conditions\u3001start\u3001end \u7B49\u5C5E\u6027\u540D\u7167\u5B9E\u5199\uFF0Cdates \u6309\u5B58\u6CD5\u9009 date \u6216 text\uFF09\u3002",
|
|
2418
2873
|
"3. \u5B98\u7F51\u7684\u65B0\u95FB / \u516C\u544A\u5217\u8868\u9875\uFF1A\u5199\u6210\u53EA\u6709 homepage \u7684\u6765\u6E90\uFF08agent \u8BFB\uFF09\u3002",
|
|
2419
|
-
"
|
|
2420
|
-
|
|
2874
|
+
" \u5355\u673A\u6E38\u620F\uFF08\u4E70\u65AD\u5236\u3001\u6CA1\u6709\u9650\u65F6\u6D3B\u52A8\u7684\uFF09\uFF1A\u5728 Steam \u4E0A\u6709\u7684\uFF0C\u518D\u5199\u4E00\u4E2A Steam \u6765\u6E90\uFF08steam_appid \u662F\u5546\u5E97\u9875 store.steampowered.com/app/<\u6570\u5B57> \u91CC\u7684\u6570\u5B57\uFF09\uFF0C\u63D2\u4EF6\u6BCF\u5929\u81EA\u52A8\u8BFB\u5B83\u5728 Steam \u7684\u5B98\u65B9\u516C\u544A\uFF08\u7248\u672C\u66F4\u65B0\u3001\u8865\u4E01\u8BF4\u660E\uFF09\uFF1Bgame_add \u65F6\u5199 single=true\u3002",
|
|
2875
|
+
`4. \u7528 game_add \u5199\u5B83\u7684\u6E38\u620F\u5305\uFF1Aid \u4E00\u5B9A\u7528 ${manifest.id}\uFF08\u6362\u4E86 id \u6E38\u620F\u9875\u4E0A\u5C31\u6210\u4E86\u53E6\u4E00\u4E2A\u6E38\u620F\uFF09\uFF0Cname \u7528\u5B83\u7684\u4E2D\u6587\u6B63\u5F0F\u540D\uFF08\u7528\u6237\u5199\u7684\u540D\u5B57\u662F\u300C${manifest.name}\u300D\uFF09\uFF0Caliases \u5199\u5E38\u89C1\u7B80\u79F0\uFF0Ctimezone \u5199\u670D\u52A1\u5668\u65F6\u533A\uFF0Csources \u5199\u627E\u5230\u7684\uFF08\u539F\u6765\u6709\u7684\u4FDD\u7559\uFF09\uFF1Bguide \u5199\u51E0\u884C\uFF1A\u54EA\u4E9B\u6765\u6E90\u770B\u4EC0\u4E48\u3001\u516C\u544A\u9875\u600E\u4E48\u627E\u6D3B\u52A8\u3002`,
|
|
2876
|
+
"5. game_add \u7684\u7ED3\u679C\u91CC read_now \u662F\u80FD\u81EA\u52A8\u8BFB\u7684\u6765\u6E90\u521A\u8BFB\u5230\u7684\uFF08Steam \u516C\u544A\u3001\u6570\u636E\u7AD9\u6D3B\u52A8\uFF09\uFF0C\u8FD9\u4E9B\u4E0D\u7528\u518D\u8BB0\u3002\u53EA\u6709\u7F51\u9875\u6765\u6E90\u7684\uFF08\u6216\u53EA\u6709\u7F51\u9875\u624D\u6709\u7684\u6D88\u606F\uFF09\uFF1A\u6309\u6280\u80FD\u8BFB\u4E00\u6B21\u516C\u544A\u5217\u8868\uFF0C\u6709\u8D77\u6B62\u65F6\u95F4\u7684\u6D3B\u52A8\u7528 game_record\uFF08source=site\uFF09\u8BB0\u4E0B\uFF1B\u516C\u544A\u7528 game_notice \u8BB0\u4E0B\u2014\u2014\u5217\u8868\u4E0A\u6700\u8FD1\u4E09\u4E2A\u6708\u7684\u6BCF\u4E00\u7BC7\u90FD\u8BB0\uFF08\u6700\u591A 20 \u7BC7\uFF0C\u6807\u9898\u3001\u65E5\u671F\u3001\u7F51\u5740\u3001\u5217\u8868\u4E0A\u7684\u7F29\u7565\u56FE\uFF0C\u5217\u8868\u4E0A\u5C31\u6709\uFF0C\u4E0D\u7528\u6BCF\u7BC7\u70B9\u5F00\uFF09\uFF0C\u53EA\u70B9\u5F00\u6700\u65B0\u7684\u4E24\u4E09\u7BC7\uFF08\u6700\u8FD1\u7684\u7248\u672C\u66F4\u65B0\u3001\u957F\u671F\u516C\u544A\uFF09\u8BFB\u5168\u6587\u5199 summary\u3002",
|
|
2877
|
+
"6. \u627E\u4E0D\u5230\u8FD9\u4E2A\u6E38\u620F\uFF08\u540D\u5B57\u4E0D\u5BF9\u3001\u6CA1\u6709\u516C\u5F00\u7684\u6D3B\u52A8\u4FE1\u606F\uFF09\u5C31\u4E0D\u8981 game_add\uFF0C\u76F4\u63A5\u8BF4\u660E\u627E\u4E86\u54EA\u91CC\u3001\u4E3A\u4EC0\u4E48\u6CA1\u627E\u5230\u3002",
|
|
2421
2878
|
"\u4E0D\u8981\u5411\u7528\u6237\u63D0\u95EE\uFF1B\u6700\u540E\u544A\u8BC9\u7528\u6237\u52A0\u4E86\u4EC0\u4E48\u6765\u6E90\u3001\u54EA\u4E9B\u80FD\u81EA\u52A8\u8BFB\u3001\u73B0\u5728\u6709\u51E0\u4E2A\u6D3B\u52A8\u3002"
|
|
2422
2879
|
].join("\n");
|
|
2423
|
-
void conversations.ask(sessionId, taskMessage("\u4F60", `\
|
|
2424
|
-
}).finally(() => this.changed());
|
|
2880
|
+
void conversations.ask(sessionId, taskMessage("\u4F60", `\u627E\u6D3B\u52A8\u6765\u6E90\uFF1A${manifest.name}`, prompt), AbortSignal.timeout(READ_TIMEOUT_MS)).then((answer) => this.calendar.setReading(`${manifest.id}#web`, { state: "done", at: this.clock.now(), sessionId, summary: answer.slice(0, 400) }), (error) => this.calendar.setReading(`${manifest.id}#web`, { state: "failed", at: this.clock.now(), sessionId, summary: error instanceof Error ? error.message : String(error) })).finally(() => this.changed(manifest.id));
|
|
2425
2881
|
return sessionId;
|
|
2426
2882
|
}
|
|
2427
2883
|
async readWeb(gameId, sourceId) {
|
|
@@ -2429,7 +2885,7 @@ ${guide.trim()}
|
|
|
2429
2885
|
const sessions = this.ctx.get("sessionController");
|
|
2430
2886
|
if (sessions === void 0)
|
|
2431
2887
|
throw new Error("agent \u73B0\u5728\u4E0D\u53EF\u7528\uFF08\u4F1A\u8BDD\u670D\u52A1\u6CA1\u6709\u52A0\u8F7D\uFF09");
|
|
2432
|
-
const chosen = sourceId === void 0 ? manifest.sources.filter((s) => s
|
|
2888
|
+
const chosen = sourceId === void 0 ? manifest.sources.filter((s) => !readsItself(s)) : manifest.sources.filter((s) => s.id === sourceId);
|
|
2433
2889
|
if (sourceId !== void 0 && chosen.length === 0)
|
|
2434
2890
|
throw new Error(`${manifest.name}\u6CA1\u6709\u6765\u6E90\u300C${sourceId}\u300D`);
|
|
2435
2891
|
const conversations = sessionConversations(sessions, () => this.ctx.get("adgGateway")?.workspaceDir(), (id, f) => this.ctx.get("adgGateway")?.skillScope.setFocus(id, f) ?? Promise.resolve(), () => this.ctx.get("adgGateway"));
|
|
@@ -2437,13 +2893,19 @@ ${guide.trim()}
|
|
|
2437
2893
|
await this.calendar.setReading(`${manifest.id}#web`, { state: "running", at: this.clock.now(), sessionId });
|
|
2438
2894
|
this.changed(manifest.id);
|
|
2439
2895
|
const where = chosen.length === 0 ? "\u6E38\u620F\u5305\u91CC\u6CA1\u6709\u5199\u7F51\u9875\u6765\u6E90\uFF1A\u6309\u6280\u80FD web-reading \u7684\u987A\u5E8F\u81EA\u5DF1\u627E\uFF08\u5148 SRA \u516C\u5171 API \u548C Wiki \u63A5\u53E3\uFF0C\u518D\u5B98\u7F51\u516C\u544A\uFF0C\u6700\u540E web_search\uFF09\u3002" : `\u8981\u8BFB\u7684\u6765\u6E90\uFF1A${chosen.map((s) => `${s.name}${s.homepage === void 0 ? "" : `\uFF08${s.homepage}\uFF09`}`).join("\uFF1B")}\u3002`;
|
|
2440
|
-
const prompt = [
|
|
2896
|
+
const prompt = (manifest.single === true ? [
|
|
2897
|
+
`\u4E0A\u7F51\u67E5\u5355\u673A\u6E38\u620F\u300C${manifest.name}\u300D\u6700\u8FD1\u7684\u5B98\u65B9\u516C\u544A\uFF08\u6E38\u620F id\uFF1A${manifest.id}\uFF09\uFF0C\u6309\u6280\u80FD web-reading \u548C game-intel\uFF1A`,
|
|
2898
|
+
`1. \u5148 game_activities\uFF08game=${manifest.id}\uFF09\u770B\u5DF2\u7ECF\u8BB0\u4E86\u54EA\u4E9B\u516C\u544A\uFF0C\u4E0D\u7528\u91CD\u590D\u8BB0\u3002`,
|
|
2899
|
+
`2. ${where}\u770B\u5B98\u65B9\u7684\u66F4\u65B0\u65E5\u5FD7\u6216\u516C\u544A\u5217\u8868\uFF08Steam \u65B0\u95FB\u3001\u5B98\u7F51\u535A\u5BA2\u3001\u516C\u544A\u9875\uFF09\u3002`,
|
|
2900
|
+
"3. \u5217\u8868\u4E0A\u6700\u8FD1\u4E09\u4E2A\u6708\u7684\u516C\u544A\u6BCF\u4E00\u7BC7\u90FD\u7528 game_notice \u8BB0\u4E0B\uFF08\u6700\u591A 20 \u7BC7\uFF1B\u6807\u9898\u3001\u53D1\u5E03\u65E5\u671F\u3001\u7F51\u5740\u3001\u5217\u8868\u4E0A\u7684\u7F29\u7565\u56FE\u5199\u8FDB cover\u2014\u2014\u5217\u8868\u4E0A\u5C31\u6709\uFF0C\u4E0D\u7528\u6BCF\u7BC7\u70B9\u5F00\uFF09\uFF1A\u7248\u672C\u66F4\u65B0\u3001\u8865\u4E01\u8BF4\u660E kind=update\uFF08\u6807\u9898\u91CC\u6709\u7248\u672C\u53F7\u5C31\u5199\u4E0A\uFF09\uFF0C\u957F\u671F\u6709\u6548\u7684\u516C\u544A kind=notice\u3001lasting=true\uFF0C\u5176\u4ED6\u8D44\u8BAF kind=news\u3002\u53EA\u70B9\u5F00\u6700\u65B0\u7684\u4E24\u4E09\u7BC7\uFF08\u6700\u8FD1\u7684\u7248\u672C\u66F4\u65B0\u3001\u957F\u671F\u516C\u544A\uFF09\u8BFB\u5168\u6587\uFF0C\u5199\u4E00\u4E24\u53E5 summary\u3002\u5355\u673A\u6E38\u620F\u4E00\u822C\u6CA1\u6709\u9650\u65F6\u6D3B\u52A8\uFF0C\u771F\u6709\uFF08\u9650\u65F6\u6298\u6263\u3001\u8054\u52A8\u3001\u8282\u65E5\u6D3B\u52A8\uFF09\u624D\u7528 game_record\u3002",
|
|
2901
|
+
"4. \u4E0D\u6253\u5F00\u6E38\u620F\uFF0C\u4E0D\u5411\u7528\u6237\u63D0\u95EE\u3002\u6700\u540E\u7528\u4E24\u4E09\u53E5\u8BDD\u603B\u7ED3\uFF1A\u6700\u65B0\u7248\u672C\u662F\u4EC0\u4E48\u3001\u6539\u4E86\u4EC0\u4E48\u3001\u6709\u6CA1\u6709\u8981\u6CE8\u610F\u7684\u516C\u544A\u3002"
|
|
2902
|
+
] : [
|
|
2441
2903
|
`\u4E0A\u7F51\u67E5\u300C${manifest.name}\u300D\u73B0\u5728\u7684\u6D3B\u52A8\u548C\u6700\u65B0\u6D88\u606F\uFF08\u6E38\u620F id\uFF1A${manifest.id}\uFF09\uFF0C\u6309\u6280\u80FD web-reading \u548C game-intel\uFF1A`,
|
|
2442
2904
|
`1. \u5148 game_activities\uFF08game=${manifest.id}\uFF09\u770B\u65E5\u5386\u91CC\u5DF2\u7ECF\u6709\u4EC0\u4E48\uFF0C\u4E0D\u7528\u91CD\u590D\u67E5\u3002`,
|
|
2443
|
-
`2. ${where}\u5148\u8BFB\u5217\u8868\u9875\
|
|
2444
|
-
"3. \u6BCF\u4E2A\u627E\u5230\u8D77\u6B62\u65F6\u95F4\u7684\u6D3B\u52A8\u7528 game_record\uFF08source=site\uFF0C\u5199\u4E0A url\uFF1B\u516C\u544A\u91CC\u6709\u8FD9\u4E2A\u6D3B\u52A8\u7684\u914D\u56FE\u5C31\u628A\u56FE\u7247\u5730\u5740\u5199\u8FDB cover\uFF09\u8BB0\u4E0B\uFF1B\u53EA\u8BB0\u6709\u786E\u5207\u51FA\u5904\u7684\u65F6\u95F4\u3002",
|
|
2905
|
+
`2. ${where}\u5148\u8BFB\u5217\u8868\u9875\uFF1B\u8981\u8D77\u6B62\u65F6\u95F4\u3001\u8981\u7EC6\u8282\u7684\u624D\u70B9\u5F00\uFF08\u6700\u8FD1\u7684\u6D3B\u52A8\u3001\u7248\u672C\u548C\u7EF4\u62A4\u516C\u544A\uFF09\u3002`,
|
|
2906
|
+
"3. \u6BCF\u4E2A\u627E\u5230\u8D77\u6B62\u65F6\u95F4\u7684\u6D3B\u52A8\u7528 game_record\uFF08source=site\uFF0C\u5199\u4E0A url\uFF1B\u516C\u544A\u91CC\u6709\u8FD9\u4E2A\u6D3B\u52A8\u7684\u914D\u56FE\u5C31\u628A\u56FE\u7247\u5730\u5740\u5199\u8FDB cover\uFF09\u8BB0\u4E0B\uFF1B\u53EA\u8BB0\u6709\u786E\u5207\u51FA\u5904\u7684\u65F6\u95F4\u3002\u6CA1\u6709\u8D77\u6B62\u65F6\u95F4\u7684\u516C\u544A\u7528 game_notice \u8BB0\u4E0B\uFF1A\u5217\u8868\u4E0A\u6700\u8FD1\u4E00\u4E2A\u6708\u7684\u6BCF\u4E00\u7BC7\u90FD\u8BB0\uFF08\u6700\u591A 20 \u7BC7\uFF1B\u6807\u9898\u3001\u65E5\u671F\u3001\u7F51\u5740\u3001\u5217\u8868\u4E0A\u7684\u7F29\u7565\u56FE\uFF0C\u4E0D\u7528\u6BCF\u7BC7\u70B9\u5F00\uFF09\uFF0C\u7248\u672C\u66F4\u65B0 kind=update\uFF0C\u957F\u671F\u6709\u6548\u7684 kind=notice\u3001lasting=true\uFF0C\u5176\u4ED6 kind=news\uFF1B\u70B9\u5F00\u8BFB\u8FC7\u7684\u5199\u4E00\u4E24\u53E5 summary\u3002",
|
|
2445
2907
|
"4. \u4E0D\u6253\u5F00\u6E38\u620F\uFF0C\u4E0D\u5411\u7528\u6237\u63D0\u95EE\u3002\u6700\u540E\u7528\u4E24\u4E09\u53E5\u8BDD\u603B\u7ED3\uFF1A\u73B0\u5728\u6709\u54EA\u4E9B\u6D3B\u52A8\u3001\u54EA\u4E9B\u5FEB\u7ED3\u675F\u3001\u6709\u4EC0\u4E48\u65B0\u6D88\u606F\uFF08\u65B0\u7248\u672C\u3001\u7EF4\u62A4\u3001\u798F\u5229\uFF09\u3002"
|
|
2446
|
-
].join("\n");
|
|
2908
|
+
]).join("\n");
|
|
2447
2909
|
void conversations.ask(sessionId, taskMessage("\u4F60", `\u6E38\u620F\u8D44\u8BAF\uFF1A${manifest.name}`, prompt), AbortSignal.timeout(READ_TIMEOUT_MS)).then((answer) => this.calendar.setReading(`${manifest.id}#web`, { state: "done", at: this.clock.now(), sessionId, summary: answer.slice(0, 400) }), (error) => this.calendar.setReading(`${manifest.id}#web`, { state: "failed", at: this.clock.now(), sessionId, summary: error instanceof Error ? error.message : String(error) })).finally(() => this.changed(manifest.id));
|
|
2448
2910
|
return sessionId;
|
|
2449
2911
|
}
|
|
@@ -2609,8 +3071,10 @@ export {
|
|
|
2609
3071
|
parseDateText,
|
|
2610
3072
|
parseRemaining,
|
|
2611
3073
|
parseSra,
|
|
3074
|
+
parseSteam,
|
|
2612
3075
|
readSmw,
|
|
2613
3076
|
readSra,
|
|
3077
|
+
readSteam,
|
|
2614
3078
|
readValue,
|
|
2615
3079
|
realClock,
|
|
2616
3080
|
recentDigest,
|