dsh-multigameassistant 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/cordis.patch.yml +3 -1
- package/lib/analyzer.js +3 -3
- package/lib/{chunk-FLQD3DKB.js → chunk-I5AFAEXG.js} +471 -75
- package/lib/{chunk-7XMNAHZ2.js → chunk-NWM5ZN7E.js} +1 -1
- package/lib/{chunk-2DZ75ANX.js → chunk-OPV336S5.js} +380 -58
- package/lib/{chunk-BL6OSR2I.js → chunk-QAP7IYBS.js} +248 -29
- package/lib/{chunk-KIAOFNCB.js → chunk-YG4B5G7F.js} +38 -5
- package/lib/{chunk-5WTH2CYW.js → chunk-ZR74PFWR.js} +2 -2
- package/lib/emulator.js +2 -2
- package/lib/feishu.js +3 -3
- package/lib/game-intel.js +583 -37
- package/lib/gateway.js +2 -2
- package/lib/guard.js +1 -1
- package/lib/intervene.js +8 -6
- package/lib/monitor.js +3 -3
- package/lib/notify.js +3 -3
- package/lib/orchestrator.js +5 -5
- package/lib/qqbot.js +3 -3
- package/lib/runner.js +3 -3
- package/lib/scheduler.js +1 -1
- package/lib/script-registry.js +42 -9
- package/package.json +4 -3
- package/skills/game-intel.md +10 -0
- package/web/assets/index-9SCfW_a1.js +241 -0
- package/web/assets/index-9SCfW_a1.js.map +1 -0
- package/web/assets/index-BodAAefM.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-B8Gy9VoQ.css +0 -1
- package/web/assets/index-DAKeB3Cw.js +0 -235
- package/web/assets/index-DAKeB3Cw.js.map +0 -1
|
@@ -14755,7 +14755,7 @@ var SetupAgent = external_exports.object({ sessionId: external_exports.string(),
|
|
|
14755
14755
|
var PendingSetupInfo = external_exports.object({
|
|
14756
14756
|
scriptId: external_exports.string(),
|
|
14757
14757
|
name: external_exports.string(),
|
|
14758
|
-
kind: external_exports.enum(["nsis", "inno"]),
|
|
14758
|
+
kind: external_exports.enum(["nsis", "inno", "kachina"]),
|
|
14759
14759
|
version: external_exports.string(),
|
|
14760
14760
|
/** Where it installs (prefilled in its window): a new version folder, or a local import's own. */
|
|
14761
14761
|
dir: external_exports.string(),
|
|
@@ -14775,7 +14775,7 @@ var ScriptJob = external_exports.object({
|
|
|
14775
14775
|
version: external_exports.string().optional(),
|
|
14776
14776
|
error: external_exports.string().optional(),
|
|
14777
14777
|
/** The release was a setup program (not an archive), left for the agent to run into `dir`; in that conversation when the app started one. */
|
|
14778
|
-
setup: external_exports.object({ kind: external_exports.enum(["nsis", "inno"]), dir: external_exports.string(), sessionId: external_exports.string().optional() }).optional(),
|
|
14778
|
+
setup: external_exports.object({ kind: external_exports.enum(["nsis", "inno", "kachina"]), dir: external_exports.string(), sessionId: external_exports.string().optional() }).optional(),
|
|
14779
14779
|
startedAt: external_exports.number(),
|
|
14780
14780
|
endedAt: external_exports.number().optional()
|
|
14781
14781
|
});
|
|
@@ -15829,12 +15829,32 @@ var Activity = external_exports.object({
|
|
|
15829
15829
|
kind: external_exports.string().optional(),
|
|
15830
15830
|
/** What it is about, from the data site. */
|
|
15831
15831
|
description: external_exports.string().optional(),
|
|
15832
|
-
/**
|
|
15832
|
+
/**
|
|
15833
|
+
* Its picture (fetch it with `games/image`). Unless the user chose a source
|
|
15834
|
+
* (`chosen`), by rank: what the user set, then what a source gives (data
|
|
15835
|
+
* sites, then web pages), then the screenshot the agent read it from.
|
|
15836
|
+
*/
|
|
15833
15837
|
cover: external_exports.string().optional(),
|
|
15834
15838
|
/** The source whose dates are shown: a data site, else the newest web page the agent read. */
|
|
15835
15839
|
site: external_exports.object({ source: external_exports.string(), name: external_exports.string(), at: external_exports.number() }).optional(),
|
|
15836
|
-
/** Every source that lists it (data sites, web pages the agent read), with
|
|
15837
|
-
sources: external_exports.array(external_exports.object({
|
|
15840
|
+
/** Every source that lists it (data sites, web pages the agent read), with what each says. */
|
|
15841
|
+
sources: external_exports.array(external_exports.object({
|
|
15842
|
+
id: external_exports.string(),
|
|
15843
|
+
name: external_exports.string(),
|
|
15844
|
+
at: external_exports.number(),
|
|
15845
|
+
web: external_exports.boolean(),
|
|
15846
|
+
startsAt: external_exports.number().optional(),
|
|
15847
|
+
endsAt: external_exports.number().optional(),
|
|
15848
|
+
shopEndsAt: external_exports.number().optional(),
|
|
15849
|
+
cover: external_exports.string().optional()
|
|
15850
|
+
})).optional(),
|
|
15851
|
+
/**
|
|
15852
|
+
* The source the user picked for the picture and the dates (`games/activity/source`):
|
|
15853
|
+
* a source's id, `OWN_SOURCE` or `SCREEN_SOURCE`. Absent: the default order.
|
|
15854
|
+
*/
|
|
15855
|
+
chosen: external_exports.string().optional(),
|
|
15856
|
+
/** Which source each shown value comes from, in the same ids as `chosen`. */
|
|
15857
|
+
shown: external_exports.object({ cover: external_exports.string().optional(), startsAt: external_exports.string().optional(), endsAt: external_exports.string().optional() }).optional(),
|
|
15838
15858
|
/** Read from the game screen by the agent. */
|
|
15839
15859
|
screen: external_exports.object({
|
|
15840
15860
|
at: external_exports.number(),
|
|
@@ -15843,6 +15863,12 @@ var Activity = external_exports.object({
|
|
|
15843
15863
|
endsAt: external_exports.number().optional(),
|
|
15844
15864
|
/** A screenshot was kept (`games/evidence`). */
|
|
15845
15865
|
evidence: external_exports.boolean(),
|
|
15866
|
+
/**
|
|
15867
|
+
* The screenshot it was read from (`shot:…`, fetch it with `games/image`),
|
|
15868
|
+
* also the activity's `cover` when no source and not the user gives one.
|
|
15869
|
+
* Kept from an earlier reading when the last one saved none.
|
|
15870
|
+
*/
|
|
15871
|
+
image: external_exports.string().optional(),
|
|
15846
15872
|
sessionId: external_exports.string().optional()
|
|
15847
15873
|
}).optional(),
|
|
15848
15874
|
/** Still to do, as read from the game ("活动商店还剩 3 项没换"). */
|
|
@@ -15852,8 +15878,29 @@ var Activity = external_exports.object({
|
|
|
15852
15878
|
/** The user said they are done with it (or took it back): their word beats the lists. */
|
|
15853
15879
|
finished: external_exports.object({ at: external_exports.number() }).optional(),
|
|
15854
15880
|
/** The game and the data site disagree on when it ends. */
|
|
15855
|
-
mismatch: external_exports.string().optional()
|
|
15881
|
+
mismatch: external_exports.string().optional(),
|
|
15882
|
+
/**
|
|
15883
|
+
* What the user (or the agent for them) wrote themselves (`games/activity/save`):
|
|
15884
|
+
* those fields beat every source, and a refresh never changes or drops them.
|
|
15885
|
+
* An activity with no `sources` and no `screen` is one the user added.
|
|
15886
|
+
*/
|
|
15887
|
+
own: external_exports.object({
|
|
15888
|
+
at: external_exports.number(),
|
|
15889
|
+
fields: external_exports.array(external_exports.enum(["name", "startsAt", "endsAt", "kind", "description", "url", "cover"])),
|
|
15890
|
+
startsAt: external_exports.number().optional(),
|
|
15891
|
+
endsAt: external_exports.number().optional(),
|
|
15892
|
+
cover: external_exports.string().optional()
|
|
15893
|
+
}).optional()
|
|
15856
15894
|
});
|
|
15895
|
+
var OWN_SOURCE = "@own";
|
|
15896
|
+
var SCREEN_SOURCE = "@screen";
|
|
15897
|
+
var MAX_ACTIVITY_IMAGE_BASE64 = 112e5;
|
|
15898
|
+
var ActivityImage = external_exports.object({
|
|
15899
|
+
mediaType: external_exports.enum(["image/png", "image/jpeg", "image/gif", "image/webp", "image/avif"]),
|
|
15900
|
+
data: external_exports.string().min(1).max(MAX_ACTIVITY_IMAGE_BASE64).regex(/^[A-Za-z0-9+/]+={0,2}$/, "base64 without a data: prefix")
|
|
15901
|
+
});
|
|
15902
|
+
var OWN_IMAGE = /^own:[0-9a-f]{32}\.(?:png|jpg|gif|webp|avif)$/;
|
|
15903
|
+
var SHOT_IMAGE = /^shot:[0-9a-f]{32}\.(?:png|jpg|gif|webp|avif)$/;
|
|
15857
15904
|
var GameSourceInfo = external_exports.object({
|
|
15858
15905
|
id: external_exports.string(),
|
|
15859
15906
|
name: external_exports.string(),
|
|
@@ -15992,7 +16039,8 @@ var GamesRequests = {
|
|
|
15992
16039
|
*/
|
|
15993
16040
|
"games/image": {
|
|
15994
16041
|
capability: GAMES_CAPABILITY,
|
|
15995
|
-
|
|
16042
|
+
/** A data site's https address, a picture the user added (`own:…`), or a kept screenshot (`shot:…`). */
|
|
16043
|
+
params: external_exports.object({ url: external_exports.string().refine((u) => OWN_IMAGE.test(u) || SHOT_IMAGE.test(u) || /^https?:\/\/\S+$/.test(u), "\u4E0D\u662F\u56FE\u7247\u5730\u5740") }),
|
|
15996
16044
|
result: external_exports.object({ mediaType: external_exports.string(), data: external_exports.string() })
|
|
15997
16045
|
},
|
|
15998
16046
|
/** Ask the agent to find where a game's events can be read and add it (a game pack of the user's own). */
|
|
@@ -16046,6 +16094,48 @@ var GamesRequests = {
|
|
|
16046
16094
|
}),
|
|
16047
16095
|
result: Activity
|
|
16048
16096
|
},
|
|
16097
|
+
/**
|
|
16098
|
+
* Add an event of the user's own, or write the user's word on one
|
|
16099
|
+
* (`activityId`): each field set beats what the sources say, `null` takes
|
|
16100
|
+
* the user's value back (the sources' shows again), absent leaves it. A
|
|
16101
|
+
* field equal to what the sources say is not kept. `image`: a new picture
|
|
16102
|
+
* (kept by the host, it becomes `cover`). A new one needs a `name`; one
|
|
16103
|
+
* with the same name already in the calendar is that one.
|
|
16104
|
+
*/
|
|
16105
|
+
"games/activity/save": {
|
|
16106
|
+
capability: GAMES_CAPABILITY,
|
|
16107
|
+
params: external_exports.object({
|
|
16108
|
+
game: external_exports.string(),
|
|
16109
|
+
activityId: external_exports.string().optional(),
|
|
16110
|
+
name: external_exports.string().trim().min(1).max(60).nullable().optional(),
|
|
16111
|
+
startsAt: external_exports.number().nullable().optional(),
|
|
16112
|
+
endsAt: external_exports.number().nullable().optional(),
|
|
16113
|
+
kind: external_exports.string().trim().max(20).nullable().optional(),
|
|
16114
|
+
description: external_exports.string().trim().max(500).nullable().optional(),
|
|
16115
|
+
url: external_exports.string().trim().refine((u) => u === "" || /^https?:\/\/\S+$/.test(u), "\u53EA\u80FD\u662F http \u6216 https \u7F51\u5740").nullable().optional(),
|
|
16116
|
+
/** null: drop the user's picture (the sources' shows again). */
|
|
16117
|
+
cover: external_exports.null().optional(),
|
|
16118
|
+
image: ActivityImage.optional(),
|
|
16119
|
+
todo: external_exports.array(external_exports.string().min(1).max(80)).max(30).optional()
|
|
16120
|
+
}),
|
|
16121
|
+
result: Activity
|
|
16122
|
+
},
|
|
16123
|
+
/**
|
|
16124
|
+
* Which source an event's picture and dates come from: a source's id,
|
|
16125
|
+
* `OWN_SOURCE` or `SCREEN_SOURCE`; `null` goes back to the default order.
|
|
16126
|
+
* What that source does not say still comes from the default order.
|
|
16127
|
+
*/
|
|
16128
|
+
"games/activity/source": {
|
|
16129
|
+
capability: GAMES_CAPABILITY,
|
|
16130
|
+
params: external_exports.object({ activityId: external_exports.string(), source: external_exports.string().nullable() }),
|
|
16131
|
+
result: Activity
|
|
16132
|
+
},
|
|
16133
|
+
/** Take back everything the user wrote on an event: the sources' word shows again; one only the user added goes. */
|
|
16134
|
+
"games/activity/reset": {
|
|
16135
|
+
capability: GAMES_CAPABILITY,
|
|
16136
|
+
params: external_exports.object({ activityId: external_exports.string() }),
|
|
16137
|
+
result: external_exports.object({ activity: Activity.optional() })
|
|
16138
|
+
},
|
|
16049
16139
|
/** Forget an event (wrongly read, or no longer wanted). */
|
|
16050
16140
|
"games/activity/remove": {
|
|
16051
16141
|
capability: GAMES_CAPABILITY,
|
|
@@ -16069,7 +16159,7 @@ var AGENT_AREAS = [
|
|
|
16069
16159
|
{ 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\u8D77\u8349\u811A\u672C\u5305\u3002", tools: ["script_install", "script_update", "script_rollback", "script_remove", "script_setup_run", "script_import", "script_env_fix", "pack_propose"] },
|
|
16070
16160
|
{ 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"] },
|
|
16071
16161
|
{ 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"] },
|
|
16072
|
-
{ 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\u7ED9\u65B0\u6E38\u620F\u5EFA\u6E38\u620F\u5305\u3002", tools: ["game_record", "game_add"] },
|
|
16162
|
+
{ 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"] },
|
|
16073
16163
|
{ 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"] },
|
|
16074
16164
|
{ id: "web", title: "\u4E0A\u7F51\u67E5\u8D44\u6599", description: "\u8BFB\u7F51\u9875\u3001\u641C\u7D22\u3002", tools: ["web_fetch", "web_search"] },
|
|
16075
16165
|
{ 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 }
|
|
@@ -16255,26 +16345,39 @@ var SkillsNotifications = {
|
|
|
16255
16345
|
// packages/protocol/lib/persona.js
|
|
16256
16346
|
var PERSONA_CAPABILITY = "persona";
|
|
16257
16347
|
var PersonaStyle = external_exports.enum(["default", "concise", "patient", "lively", "buddy", "butler"]);
|
|
16348
|
+
var PeerStyle = external_exports.enum(["plain", "same"]);
|
|
16258
16349
|
var Persona = external_exports.object({
|
|
16259
16350
|
style: PersonaStyle,
|
|
16260
|
-
/** What the agent calls itself. */
|
|
16261
|
-
name: external_exports.string().max(20).optional(),
|
|
16262
16351
|
/** How it addresses the user ("主人", "指挥官"…). */
|
|
16263
16352
|
callUser: external_exports.string().max(20).optional(),
|
|
16264
16353
|
/** Anything else, in the user's words. */
|
|
16265
|
-
custom: external_exports.string().optional()
|
|
16354
|
+
custom: external_exports.string().optional(),
|
|
16355
|
+
peerStyle: PeerStyle.optional()
|
|
16356
|
+
});
|
|
16357
|
+
var PersonaOverride = Persona.partial().extend({
|
|
16358
|
+
/** What the agent calls itself. */
|
|
16359
|
+
name: external_exports.string().max(20).optional()
|
|
16360
|
+
});
|
|
16361
|
+
var PersonaSettings = external_exports.object({
|
|
16362
|
+
persona: Persona,
|
|
16363
|
+
agents: external_exports.record(external_exports.string(), PersonaOverride)
|
|
16364
|
+
});
|
|
16365
|
+
var PersonaAnswer = PersonaSettings.extend({
|
|
16366
|
+
/** The text added to the system prompt with nothing of an agent's own, for the settings page to show. */
|
|
16367
|
+
prompt: external_exports.string(),
|
|
16368
|
+
/** The same, as it is for each agent, by id. */
|
|
16369
|
+
prompts: external_exports.record(external_exports.string(), external_exports.string())
|
|
16266
16370
|
});
|
|
16267
16371
|
var PersonaRequests = {
|
|
16268
16372
|
"persona/get": {
|
|
16269
16373
|
capability: PERSONA_CAPABILITY,
|
|
16270
16374
|
params: external_exports.object({}),
|
|
16271
|
-
|
|
16272
|
-
result: external_exports.object({ persona: Persona, prompt: external_exports.string() })
|
|
16375
|
+
result: PersonaAnswer
|
|
16273
16376
|
},
|
|
16274
16377
|
"persona/set": {
|
|
16275
16378
|
capability: PERSONA_CAPABILITY,
|
|
16276
|
-
params:
|
|
16277
|
-
result:
|
|
16379
|
+
params: PersonaSettings,
|
|
16380
|
+
result: PersonaAnswer
|
|
16278
16381
|
}
|
|
16279
16382
|
};
|
|
16280
16383
|
|
|
@@ -16859,6 +16962,7 @@ var CredentialInfo = external_exports.object({
|
|
|
16859
16962
|
/** False when a read-only layer (the launch environment) shadows the reference. */
|
|
16860
16963
|
writable: external_exports.boolean()
|
|
16861
16964
|
});
|
|
16965
|
+
var DEEPSEEK_API_KEY = "DEEPSEEK_API_KEY";
|
|
16862
16966
|
var Capability = external_exports.object({
|
|
16863
16967
|
id: external_exports.string(),
|
|
16864
16968
|
version: external_exports.number().int().positive()
|
|
@@ -16922,8 +17026,22 @@ var ModelSelection = external_exports.object({
|
|
|
16922
17026
|
reasoningEffort: external_exports.string().optional()
|
|
16923
17027
|
});
|
|
16924
17028
|
var AGENTS_CAPABILITY = "agents";
|
|
17029
|
+
var ThreadMessage = external_exports.object({
|
|
17030
|
+
/** Who said it, by name. */
|
|
17031
|
+
from: external_exports.string(),
|
|
17032
|
+
/** `question` waits for an answer; `update` only informs, and reaches the other side at once; `done` is the conclusion. */
|
|
17033
|
+
kind: external_exports.enum(["question", "answer", "update", "done"]),
|
|
17034
|
+
text: external_exports.string(),
|
|
17035
|
+
at: external_exports.number()
|
|
17036
|
+
});
|
|
16925
17037
|
var HandOff = external_exports.object({
|
|
16926
17038
|
id: external_exports.string(),
|
|
17039
|
+
/** What the two have said since the work was handed over (docs/design/agent-roles.md §14.3). */
|
|
17040
|
+
messages: external_exports.array(ThreadMessage).optional(),
|
|
17041
|
+
/** The agents the work has passed through, first asker first (ids); a chain does not come back on itself. */
|
|
17042
|
+
chain: external_exports.array(external_exports.string()).optional(),
|
|
17043
|
+
/** The hand-off this one was opened from inside of. */
|
|
17044
|
+
parent: external_exports.string().optional(),
|
|
16927
17045
|
/** The conversation that asked, where the reply goes back. */
|
|
16928
17046
|
fromSession: external_exports.string(),
|
|
16929
17047
|
/** 助手's `agent_delegate` call that asked; absent: the app asked (`by`). */
|
|
@@ -16936,7 +17054,8 @@ var HandOff = external_exports.object({
|
|
|
16936
17054
|
title: external_exports.string(),
|
|
16937
17055
|
task: external_exports.string(),
|
|
16938
17056
|
expecting: external_exports.string().optional(),
|
|
16939
|
-
|
|
17057
|
+
/** `waiting`: the agent doing it asked something and waits for the answer. */
|
|
17058
|
+
state: external_exports.enum(["running", "waiting", "done", "failed"]),
|
|
16940
17059
|
/** Its reply; for a failure, why. */
|
|
16941
17060
|
reply: external_exports.string().optional(),
|
|
16942
17061
|
startedAt: external_exports.number(),
|
|
@@ -17003,6 +17122,16 @@ var ProviderProfile = external_exports.object({
|
|
|
17003
17122
|
/** Configuration diagnostic reported by the adapter. */
|
|
17004
17123
|
error: external_exports.string().optional()
|
|
17005
17124
|
});
|
|
17125
|
+
var ProviderBalance = external_exports.object({
|
|
17126
|
+
/** False when the balance is too low for API calls. */
|
|
17127
|
+
available: external_exports.boolean(),
|
|
17128
|
+
balances: external_exports.array(external_exports.object({
|
|
17129
|
+
currency: external_exports.string(),
|
|
17130
|
+
total: external_exports.string(),
|
|
17131
|
+
granted: external_exports.string(),
|
|
17132
|
+
toppedUp: external_exports.string()
|
|
17133
|
+
}))
|
|
17134
|
+
});
|
|
17006
17135
|
var MAX_IMAGE_BASE64 = 35e5;
|
|
17007
17136
|
var PromptImage = external_exports.object({
|
|
17008
17137
|
mediaType: external_exports.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
|
|
@@ -17062,7 +17191,19 @@ var Requests = {
|
|
|
17062
17191
|
params: external_exports.object({ sessionId: external_exports.string() }),
|
|
17063
17192
|
result: external_exports.object({ items: external_exports.array(HandOff) })
|
|
17064
17193
|
},
|
|
17194
|
+
/** Stop a sub-agent's current work (the parent's own turn goes on). */
|
|
17195
|
+
"subagents/stop": {
|
|
17196
|
+
capability: AGENTS_CAPABILITY,
|
|
17197
|
+
params: external_exports.object({ sessionId: external_exports.string() }),
|
|
17198
|
+
result: Accepted
|
|
17199
|
+
},
|
|
17065
17200
|
/** One hand-off, for the page that shows what the two agents said. */
|
|
17201
|
+
/** All that two agents have said to each other, oldest first: one conversation, whatever each thread was about. */
|
|
17202
|
+
"handoffs/between": {
|
|
17203
|
+
capability: AGENTS_CAPABILITY,
|
|
17204
|
+
params: external_exports.object({ a: external_exports.string(), b: external_exports.string() }),
|
|
17205
|
+
result: external_exports.object({ items: external_exports.array(HandOff) })
|
|
17206
|
+
},
|
|
17066
17207
|
"handoffs/get": {
|
|
17067
17208
|
capability: AGENTS_CAPABILITY,
|
|
17068
17209
|
params: external_exports.object({ id: external_exports.string() }),
|
|
@@ -17258,6 +17399,12 @@ var Requests = {
|
|
|
17258
17399
|
}),
|
|
17259
17400
|
result: external_exports.object({ models: external_exports.array(ProviderModel) })
|
|
17260
17401
|
},
|
|
17402
|
+
"providers/balance": {
|
|
17403
|
+
capability: "providers",
|
|
17404
|
+
params: external_exports.object({ provider: external_exports.string().min(1) }),
|
|
17405
|
+
/** Null when the route is not served by DeepSeek's own API or has no key; a failed query is an error, never a zero. */
|
|
17406
|
+
result: external_exports.object({ balance: ProviderBalance.nullable() })
|
|
17407
|
+
},
|
|
17261
17408
|
"providers/save": {
|
|
17262
17409
|
capability: "providers",
|
|
17263
17410
|
params: external_exports.object({
|
|
@@ -17404,15 +17551,24 @@ function classify(value) {
|
|
|
17404
17551
|
// packages/protocol/lib/handoff-notes.js
|
|
17405
17552
|
var BY_YOU = "\u4F60";
|
|
17406
17553
|
var QUIET = "\uFF08\u4E0D\u7528\u544A\u8BC9\u7528\u6237\uFF09";
|
|
17554
|
+
var wordsOf = (text) => text.replace(/[^\p{Script=Han}a-zA-Z0-9]/gu, "");
|
|
17407
17555
|
function isQuiet(text) {
|
|
17408
|
-
return text
|
|
17409
|
-
}
|
|
17410
|
-
var RETURNS = "\uFF08\
|
|
17411
|
-
|
|
17556
|
+
return wordsOf(text) === wordsOf(QUIET);
|
|
17557
|
+
}
|
|
17558
|
+
var RETURNS = "\uFF08\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4F1A\u4F5C\u4E3A\u7ED3\u8BBA\u4EA4\u56DE\u53BB\u3002\u5728\u90A3\u4E4B\u524D\u8981\u8BA9\u5BF9\u65B9\u77E5\u9053\u7684\uFF0C\u7528 agent_message \u7684 update \u8BF4\uFF0C\u9A6C\u4E0A\u9001\u5230\uFF0C\u8BF4\u51E0\u6B21\u90FD\u884C\uFF1B\u4EA4\u56DE\u7ED3\u8BBA\u4EE5\u540E\u8FD8\u6709\u8BDD\uFF0C\u540C\u6837\u53D1\u5230\u8FD9\u6761\u7EBF\u7D22\uFF1A\u4F60\u7684\u666E\u901A\u56DE\u590D\u5BF9\u65B9\u770B\u4E0D\u5230\u3002\uFF09";
|
|
17559
|
+
var RETURNS_BEFORE = "\uFF08\u505A\u5B8C\u540E\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4F1A\u539F\u6837\u4EA4\u56DE\u53BB\uFF1A\u628A\u7ED3\u8BBA\u5199\u5728\u90A3\u91CC\u3002\uFF09";
|
|
17560
|
+
var THREAD_LINE = /^(这件事的线索是 (\S+):做的过程中要问清楚什么,用 agent_message 问,thread 填它;不要猜。)$/;
|
|
17561
|
+
var PAST_HEAD = (who) => `\uFF08\u4F60\u548C${who}\u4E4B\u524D\u7684\u6765\u5F80\uFF0C\u4ECE\u65E7\u5230\u65B0\u3002\u53EF\u80FD\u5DF2\u7ECF\u8FC7\u65F6\uFF1B\u8981\u770B\u5B8C\u6574\u7684\uFF0C\u7528 agent_threads \u5E26 id\uFF1A`;
|
|
17562
|
+
var PAST_LINE = /^(你和.{1,20}之前的来往,/;
|
|
17563
|
+
var PAST_END = "\uFF09";
|
|
17564
|
+
function taskMessage(by, title, body, returns = false, thread, past) {
|
|
17412
17565
|
const head = by === BY_YOU ? `\uFF08\u4F60\u5728\u8F6F\u4EF6\u91CC\u70B9\u7684\uFF1A${oneLine(title)}\uFF09` : `\uFF08${by}\u4EA4\u7ED9\u4F60\u7684\u4E8B\uFF1A${oneLine(title)}\uFF09`;
|
|
17566
|
+
const notes = [...returns ? [RETURNS] : [], ...thread === void 0 ? [] : [`\uFF08\u8FD9\u4EF6\u4E8B\u7684\u7EBF\u7D22\u662F ${thread}\uFF1A\u505A\u7684\u8FC7\u7A0B\u4E2D\u8981\u95EE\u6E05\u695A\u4EC0\u4E48\uFF0C\u7528 agent_message \u95EE\uFF0Cthread \u586B\u5B83\uFF1B\u4E0D\u8981\u731C\u3002\uFF09`]];
|
|
17567
|
+
if (past !== void 0 && past.lines.length > 0)
|
|
17568
|
+
notes.push([PAST_HEAD(past.who), ...past.lines, PAST_END].join("\n"));
|
|
17413
17569
|
return `${head}
|
|
17414
|
-
${
|
|
17415
|
-
`
|
|
17570
|
+
${notes.map((n) => `${n}
|
|
17571
|
+
`).join("")}
|
|
17416
17572
|
${body}`;
|
|
17417
17573
|
}
|
|
17418
17574
|
function parseTask(text) {
|
|
@@ -17421,23 +17577,69 @@ function parseTask(text) {
|
|
|
17421
17577
|
const theirs = mine === null ? /^(([^():]{1,20})交给你的事:(.*))$/.exec(first) : null;
|
|
17422
17578
|
if (mine === null && theirs === null)
|
|
17423
17579
|
return void 0;
|
|
17424
|
-
const returns = rest[0] === RETURNS;
|
|
17580
|
+
const returns = rest[0] === RETURNS || rest[0] === RETURNS_BEFORE;
|
|
17581
|
+
const after = returns ? rest.slice(1) : rest;
|
|
17582
|
+
const thread = THREAD_LINE.exec(after[0] ?? "")?.[1];
|
|
17583
|
+
const next = thread === void 0 ? after : after.slice(1);
|
|
17584
|
+
const pastEnd = PAST_LINE.test(next[0] ?? "") ? next.indexOf(PAST_END) : -1;
|
|
17425
17585
|
return {
|
|
17426
17586
|
by: mine !== null ? BY_YOU : theirs[1],
|
|
17427
17587
|
title: mine !== null ? mine[1] : theirs[2],
|
|
17428
17588
|
returns,
|
|
17429
|
-
|
|
17430
|
-
|
|
17589
|
+
...thread === void 0 ? {} : { thread },
|
|
17590
|
+
body: next.slice(pastEnd + 1).join("\n").trim()
|
|
17591
|
+
};
|
|
17592
|
+
}
|
|
17593
|
+
var THREAD_WORDS = { question: "\u95EE\u4F60", answer: "\u56DE\u7B54\u4E86\u4F60", update: "\u544A\u8BC9\u4F60" };
|
|
17594
|
+
function threadTail(kind, thread, reader, closed) {
|
|
17595
|
+
const person = `\u770B\u60C5\u51B5\u544A\u8BC9\u7528\u6237\uFF1A\u6709\u7528\u6237\u8BE5\u77E5\u9053\u7684\uFF0C\u4E00\u4E24\u53E5\u8BDD\u8BF4\u8981\u70B9\uFF1B\u6CA1\u6709\u7684\u8BDD\u6574\u6BB5\u56DE\u590D\u53EA\u5199\u300C${QUIET}\u300D\u3002`;
|
|
17596
|
+
if (closed) {
|
|
17597
|
+
if (kind === "question")
|
|
17598
|
+
return `\uFF08\u8FD9\u4EF6\u4E8B\u5DF2\u7ECF\u4EA4\u56DE\u4E86\uFF0C\u8FD9\u662F\u540E\u9762\u7684\u8BDD\u3002\u8981\u56DE\u7B54\u7684\u8BDD\u7528 agent_message\uFF1Athread \u586B ${thread}\uFF0Ckind \u586B answer\uFF0C\u4F60\u7684\u666E\u901A\u56DE\u590D\u5BF9\u65B9\u770B\u4E0D\u5230\u3002\uFF09`;
|
|
17599
|
+
return reader === "main" ? `\uFF08\u8FD9\u4EF6\u4E8B\u5DF2\u7ECF\u4EA4\u56DE\u4E86\uFF0C\u8FD9\u662F\u540E\u9762\u8865\u7684\u8BDD\uFF0C\u4E0D\u7528\u56DE\u5B83\u3002${person}\uFF09` : "\uFF08\u8FD9\u4EF6\u4E8B\u5DF2\u7ECF\u4EA4\u56DE\u4E86\uFF0C\u8FD9\u662F\u540E\u9762\u8865\u7684\u8BDD\uFF0C\u4E0D\u7528\u56DE\u5B83\u3002\uFF09";
|
|
17600
|
+
}
|
|
17601
|
+
if (kind === "question")
|
|
17602
|
+
return `\uFF08\u5BF9\u65B9\u5728\u7B49\uFF1A\u5148\u56DE\u7B54\u5B83\uFF0C\u518D\u63A5\u7740\u505A\u624B\u4E0A\u7684\u4E8B\u3002\u7528 agent_message \u56DE\u7B54\uFF1Athread \u586B ${thread}\uFF0Ckind \u586B answer\u3002\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4E5F\u7B97\u56DE\u7B54\u3002\u8981\u7B49\u7528\u6237\u51B3\u5B9A\u7684\u8BDD\uFF0C\u5148\u7528 kind: update \u8BF4\u4E00\u58F0\uFF0C\u7B49\u6709\u4E86\u7ED3\u679C\u518D\u56DE\u7B54\u3002\uFF09`;
|
|
17603
|
+
if (kind === "answer" || reader === "worker")
|
|
17604
|
+
return "\uFF08\u63A5\u7740\u505A\u8FD9\u4EF6\u4E8B\u3002\uFF09";
|
|
17605
|
+
return reader === "main" ? `\uFF08\u5B83\u8FD8\u5728\u505A\uFF0C\u8FD9\u662F\u8FC7\u7A0B\u4E2D\u544A\u8BC9\u4F60\u7684\uFF0C\u4E0D\u7528\u56DE\u5B83\u3002${person}\uFF09` : "\uFF08\u5B83\u8FD8\u5728\u505A\uFF0C\u8FD9\u662F\u8FC7\u7A0B\u4E2D\u544A\u8BC9\u4F60\u7684\uFF0C\u4E0D\u7528\u56DE\u5B83\uFF1A\u63A5\u7740\u505A\u4F60\u624B\u4E0A\u7684\u4E8B\u3002\uFF09";
|
|
17606
|
+
}
|
|
17607
|
+
function threadMessage(input) {
|
|
17608
|
+
const head = `\uFF08\u300C${input.from}\u300D\u5728\u7EBF\u7D22 ${input.thread} \u91CC${THREAD_WORDS[input.kind]}\uFF1A${oneLine(input.title)}\uFF09`;
|
|
17609
|
+
return `${head}
|
|
17610
|
+
|
|
17611
|
+
${input.text.trim()}
|
|
17612
|
+
|
|
17613
|
+
${threadTail(input.kind, input.thread, input.reader ?? "worker", input.closed === true)}`;
|
|
17614
|
+
}
|
|
17615
|
+
function parseThreadNote(text) {
|
|
17616
|
+
const [first = "", ...rest] = text.split("\n");
|
|
17617
|
+
const head = /^(「([^」]+)」在线索 (\S+) 里(问你|回答了你|告诉你):(.*))$/.exec(first);
|
|
17618
|
+
if (head === null)
|
|
17619
|
+
return void 0;
|
|
17620
|
+
const body = rest.join("\n").trim();
|
|
17621
|
+
const end = body.lastIndexOf("\n\n\uFF08");
|
|
17622
|
+
return { from: head[1], thread: head[2], kind: head[3] === "\u95EE\u4F60" ? "question" : head[3] === "\u544A\u8BC9\u4F60" ? "update" : "answer", title: head[4], text: (end === -1 ? body : body.slice(0, end)).trim() };
|
|
17431
17623
|
}
|
|
17432
17624
|
function relayMessage(input) {
|
|
17433
17625
|
const head = `\uFF08\u300C${input.agent}\u300D${input.ok ? "\u4EA4\u56DE\u4E86" : "\u6CA1\u6709\u505A\u5B8C"}${input.asker}\u4EA4\u7ED9\u5B83\u7684\u4E8B\uFF1A${oneLine(input.title)}\uFF09`;
|
|
17434
|
-
const tail = input.ok ? `\uFF08\u770B\u60C5\u51B5\u544A\u8BC9\u7528\u6237\uFF1A\u6709\u7528\u6237\u8BE5\u77E5\u9053\u6216\u8981\u505A\u7684\uFF0C\u7528\u4E00\u4E24\u53E5\u8BDD\u8BF4\u8981\u70B9\uFF0C\u5B8C\u6574\u8FC7\u7A0B\u5728\u300C${input.agent}\u300D\u7684\u5BF9\u8BDD\u91CC\uFF1B\u6CA1\u6709\u7684\u8BDD\u6574\u6BB5\u56DE\u590D\u53EA\u5199\u300C${QUIET}\u300D\u3002\u8FD8\u8981\u522B\u7684 agent \u63A5\u7740\u505A\u7684\uFF0C\u53EF\u4EE5\u518D\u4EA4\u3002\uFF09` : `\uFF08\u544A\u8BC9\u7528\u6237\u54EA\u91CC\u6CA1\u505A\u6210\u3001\u4E3A\u4EC0\u4E48\uFF1B\u9700\u8981\u7684\u8BDD\u6362\u4E2A\u8BF4\u6CD5\u518D\u4EA4\u4E00\u6B21\uFF0C\u6216\u8005\u95EE\u7528\u6237\u3002\uFF09`;
|
|
17626
|
+
const tail = input.toLead === true ? input.ok ? "\uFF08\u8FD9\u662F\u4F60\u95EE\u5B83\u7684\u7ED3\u679C\uFF1A\u63A5\u7740\u505A\u4F60\u624B\u4E0A\u7684\u4E8B\uFF0C\u628A\u5B83\u7528\u5230\u4F60\u7684\u7ED3\u8BBA\u91CC\u3002\uFF09" : "\uFF08\u5B83\u6CA1\u505A\u6210\uFF1A\u63A5\u7740\u505A\u4F60\u624B\u4E0A\u7684\u4E8B\uFF0C\u80FD\u7ED5\u8FC7\u53BB\u5C31\u7ED5\u8FC7\u53BB\uFF0C\u7ED5\u4E0D\u8FC7\u53BB\u5C31\u5728\u4F60\u7684\u7ED3\u8BBA\u91CC\u8BF4\u6E05\u695A\u3002\uFF09" : input.ok ? `\uFF08\u770B\u60C5\u51B5\u544A\u8BC9\u7528\u6237\uFF1A\u6709\u7528\u6237\u8BE5\u77E5\u9053\u6216\u8981\u505A\u7684\uFF0C\u7528\u4E00\u4E24\u53E5\u8BDD\u8BF4\u8981\u70B9\uFF0C\u5B8C\u6574\u8FC7\u7A0B\u5728\u300C${input.agent}\u300D\u7684\u5BF9\u8BDD\u91CC\uFF1B\u6CA1\u6709\u7684\u8BDD\u6574\u6BB5\u56DE\u590D\u53EA\u5199\u300C${QUIET}\u300D\u3002\u8FD8\u8981\u522B\u7684 agent \u63A5\u7740\u505A\u7684\uFF0C\u53EF\u4EE5\u518D\u4EA4\u3002\uFF09` : `\uFF08\u544A\u8BC9\u7528\u6237\u54EA\u91CC\u6CA1\u505A\u6210\u3001\u4E3A\u4EC0\u4E48\uFF1B\u9700\u8981\u7684\u8BDD\u6362\u4E2A\u8BF4\u6CD5\u518D\u4EA4\u4E00\u6B21\uFF0C\u6216\u8005\u95EE\u7528\u6237\u3002\uFF09`;
|
|
17627
|
+
const asked = input.consulted !== void 0 && input.consulted.length > 0 ? `
|
|
17628
|
+
|
|
17629
|
+
\uFF08\u505A\u8FD9\u4EF6\u4E8B\u65F6\u5B83\u8FD8\u95EE\u4E86\uFF1A${input.consulted.join("\u3001")}\u3002\uFF09` : "";
|
|
17435
17630
|
return `${head}
|
|
17436
17631
|
|
|
17437
|
-
${input.reply.trim()}
|
|
17632
|
+
${input.reply.trim()}${asked}
|
|
17438
17633
|
|
|
17439
17634
|
${tail}`;
|
|
17440
17635
|
}
|
|
17636
|
+
function threadsBetween(all, a, b) {
|
|
17637
|
+
return all.filter((h) => {
|
|
17638
|
+
const from = h.chain?.at(-2);
|
|
17639
|
+
const to = h.chain?.at(-1);
|
|
17640
|
+
return from === a && to === b || from === b && to === a;
|
|
17641
|
+
});
|
|
17642
|
+
}
|
|
17441
17643
|
function parseRelay(text) {
|
|
17442
17644
|
const [first = "", ...rest] = text.split("\n");
|
|
17443
17645
|
const head = /^(「([^」]+)」(交回了|没有做完)([^()]{1,20}?)交给它的事:(.*))$/.exec(first);
|
|
@@ -17450,16 +17652,22 @@ function parseRelay(text) {
|
|
|
17450
17652
|
function oneLine(text) {
|
|
17451
17653
|
return text.replace(/\s+/g, " ").replace(/[()]/g, (m) => m === "\uFF08" ? "(" : ")").trim();
|
|
17452
17654
|
}
|
|
17655
|
+
var REMINDER_NOTE = /\n\n(这是你在线索 \S+ 上定的提醒:[^)]*)$/;
|
|
17656
|
+
function threadReminder(prompt, thread, by) {
|
|
17657
|
+
return `${prompt}
|
|
17658
|
+
|
|
17659
|
+
\uFF08\u8FD9\u662F\u4F60\u5728\u7EBF\u7D22 ${thread} \u4E0A\u5B9A\u7684\u63D0\u9192\uFF1A\u8981\u8BA9${by}\u77E5\u9053\u7684\uFF0C\u5230\u70B9\u540E\u7528 agent_message \u53D1\u7ED9\u5B83\uFF0Cthread \u586B ${thread}\uFF0Ckind \u586B update\uFF1B\u4F60\u7684\u666E\u901A\u56DE\u590D\u5B83\u770B\u4E0D\u5230\u3002\uFF09`;
|
|
17660
|
+
}
|
|
17453
17661
|
function reminderPrompts(text) {
|
|
17454
17662
|
const single = /^\[SCHEDULE REMINDER\]\n[\s\S]*?^reminder_prompt_json: (.*)$/m.exec(text);
|
|
17455
17663
|
if (single !== null)
|
|
17456
|
-
return [jsonString(single[1])];
|
|
17664
|
+
return [jsonString(single[1]).replace(REMINDER_NOTE, "")];
|
|
17457
17665
|
const batch = /^\[SCHEDULE REMINDER BATCH\]\n[\s\S]*?^reminders_json: (.*)$/m.exec(text);
|
|
17458
17666
|
if (batch === null)
|
|
17459
17667
|
return void 0;
|
|
17460
17668
|
try {
|
|
17461
17669
|
const items = JSON.parse(batch[1]);
|
|
17462
|
-
return items.map((item) => String(item.reminder_prompt ?? "")).filter((p) => p !== "");
|
|
17670
|
+
return items.map((item) => String(item.reminder_prompt ?? "").replace(REMINDER_NOTE, "")).filter((p) => p !== "");
|
|
17463
17671
|
} catch {
|
|
17464
17672
|
return [];
|
|
17465
17673
|
}
|
|
@@ -17696,6 +17904,10 @@ export {
|
|
|
17696
17904
|
AgentTaskRun,
|
|
17697
17905
|
INTERVENE_CAPABILITY,
|
|
17698
17906
|
GAMES_CAPABILITY,
|
|
17907
|
+
OWN_SOURCE,
|
|
17908
|
+
SCREEN_SOURCE,
|
|
17909
|
+
OWN_IMAGE,
|
|
17910
|
+
SHOT_IMAGE,
|
|
17699
17911
|
GamesSettings,
|
|
17700
17912
|
PERMISSIONS_CAPABILITY,
|
|
17701
17913
|
AreaPolicy,
|
|
@@ -17709,10 +17921,12 @@ export {
|
|
|
17709
17921
|
SKILLHUB_CAPABILITY,
|
|
17710
17922
|
PERSONA_CAPABILITY,
|
|
17711
17923
|
Persona,
|
|
17924
|
+
PersonaSettings,
|
|
17712
17925
|
COMPACTION_CAPABILITY,
|
|
17713
17926
|
DEFAULT_COMPACTION_THRESHOLD,
|
|
17714
17927
|
CompactionSettings,
|
|
17715
17928
|
RUNS_CAPABILITY,
|
|
17929
|
+
DEEPSEEK_API_KEY,
|
|
17716
17930
|
AGENTS_CAPABILITY,
|
|
17717
17931
|
ProviderApi,
|
|
17718
17932
|
Requests,
|
|
@@ -17724,11 +17938,16 @@ export {
|
|
|
17724
17938
|
expandSlash,
|
|
17725
17939
|
parseGitHubLink,
|
|
17726
17940
|
BY_YOU,
|
|
17941
|
+
QUIET,
|
|
17727
17942
|
isQuiet,
|
|
17728
17943
|
taskMessage,
|
|
17729
17944
|
parseTask,
|
|
17945
|
+
threadMessage,
|
|
17946
|
+
parseThreadNote,
|
|
17730
17947
|
relayMessage,
|
|
17948
|
+
threadsBetween,
|
|
17731
17949
|
parseRelay,
|
|
17950
|
+
threadReminder,
|
|
17732
17951
|
reminderPrompts,
|
|
17733
17952
|
reminderLine,
|
|
17734
17953
|
UPDATE_RULE
|
|
@@ -1382,10 +1382,26 @@ function mirrored(mirror, url) {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
var IntegrityError = class extends DownloadError {
|
|
1384
1384
|
};
|
|
1385
|
+
var StalePartError = class extends DownloadError {
|
|
1386
|
+
};
|
|
1385
1387
|
async function downloadFrom(url, options2) {
|
|
1388
|
+
try {
|
|
1389
|
+
return await downloadOnce(url, options2);
|
|
1390
|
+
} catch (error) {
|
|
1391
|
+
if (!(error instanceof StalePartError))
|
|
1392
|
+
throw error;
|
|
1393
|
+
await rm(`${options2.dest}.part`, { force: true });
|
|
1394
|
+
return downloadOnce(url, options2);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
async function downloadOnce(url, options2) {
|
|
1386
1398
|
const part = `${options2.dest}.part`;
|
|
1387
1399
|
await mkdir(dirname(options2.dest), { recursive: true });
|
|
1388
|
-
|
|
1400
|
+
let have = await stat(part).then((s) => s.size, () => 0);
|
|
1401
|
+
if (options2.expectedSize !== void 0 && have > options2.expectedSize) {
|
|
1402
|
+
await rm(part, { force: true });
|
|
1403
|
+
have = 0;
|
|
1404
|
+
}
|
|
1389
1405
|
const fetchImpl = options2.fetch ?? globalThis.fetch;
|
|
1390
1406
|
const response = await fetchImpl(url, {
|
|
1391
1407
|
headers: { "user-agent": options2.userAgent ?? "MultiGameAssistant", ...have > 0 ? { range: `bytes=${have}-` } : {} },
|
|
@@ -1397,6 +1413,12 @@ async function downloadFrom(url, options2) {
|
|
|
1397
1413
|
const resumed = response.status === 206 && have > 0;
|
|
1398
1414
|
if (response.status === 416 && have > 0 && have === options2.expectedSize) {
|
|
1399
1415
|
await response.body?.cancel();
|
|
1416
|
+
} else if (response.status === 416 && have > 0) {
|
|
1417
|
+
await response.body?.cancel();
|
|
1418
|
+
throw new StalePartError(`${host(url)} \u4E0D\u63A5\u53D7\u4ECE\u7B2C ${have} \u5B57\u8282\u7EED\u4F20`);
|
|
1419
|
+
} else if (resumed && rangeStart(response.headers.get("content-range")) !== have) {
|
|
1420
|
+
await response.body?.cancel();
|
|
1421
|
+
throw new StalePartError(`${host(url)} \u7EED\u4F20\u7684\u4F4D\u7F6E\u4E0D\u5BF9`);
|
|
1400
1422
|
} else if (!response.ok || response.body === null) {
|
|
1401
1423
|
await response.body?.cancel();
|
|
1402
1424
|
throw new DownloadError(`${host(url)} \u8FD4\u56DE ${response.status}`);
|
|
@@ -1428,18 +1450,26 @@ async function downloadFrom(url, options2) {
|
|
|
1428
1450
|
const bytes = (await stat(part)).size;
|
|
1429
1451
|
if (options2.expectedSize !== void 0 && bytes !== options2.expectedSize) {
|
|
1430
1452
|
await rm(part, { force: true });
|
|
1453
|
+
if (have > 0)
|
|
1454
|
+
throw new StalePartError(`\u7EED\u4F20\u540E\u6587\u4EF6\u5927\u5C0F\u4E0D\u7B26\uFF1A\u5E94\u4E3A ${options2.expectedSize} \u5B57\u8282\uFF0C\u5B9E\u9645 ${bytes} \u5B57\u8282`);
|
|
1431
1455
|
throw new DownloadError(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u7B26\uFF1A\u5E94\u4E3A ${options2.expectedSize} \u5B57\u8282\uFF0C\u5B9E\u9645 ${bytes} \u5B57\u8282`);
|
|
1432
1456
|
}
|
|
1433
1457
|
const sha256 = await hashFile(part);
|
|
1434
1458
|
const expected = parseDigest(options2.digest);
|
|
1435
1459
|
if (expected !== void 0 && expected !== sha256) {
|
|
1436
1460
|
await rm(part, { force: true });
|
|
1461
|
+
if (have > 0)
|
|
1462
|
+
throw new StalePartError(`\u7EED\u4F20\u540E\u6821\u9A8C\u5931\u8D25\uFF1ASHA-256 \u5E94\u4E3A ${expected}\uFF0C\u5B9E\u9645 ${sha256}`);
|
|
1437
1463
|
throw new IntegrityError(`\u6821\u9A8C\u5931\u8D25\uFF1ASHA-256 \u5E94\u4E3A ${expected}\uFF0C\u5B9E\u9645 ${sha256}\uFF1B\u6587\u4EF6\u5DF2\u5220\u9664`);
|
|
1438
1464
|
}
|
|
1439
1465
|
await rm(options2.dest, { force: true });
|
|
1440
1466
|
await rename(part, options2.dest);
|
|
1441
1467
|
return { path: options2.dest, bytes, sha256, via: url, finalUrl: response.url || url, resumed };
|
|
1442
1468
|
}
|
|
1469
|
+
function rangeStart(header) {
|
|
1470
|
+
const match = header === null ? null : /^bytes\s+(\d+)-/i.exec(header.trim());
|
|
1471
|
+
return match === null ? void 0 : Number(match[1]);
|
|
1472
|
+
}
|
|
1443
1473
|
function parseDigest(digest) {
|
|
1444
1474
|
if (digest === void 0)
|
|
1445
1475
|
return void 0;
|
|
@@ -1823,7 +1853,9 @@ var MARKERS = [
|
|
|
1823
1853
|
{ kind: "nsis", text: "Nullsoft.NSIS.exehead" },
|
|
1824
1854
|
{ kind: "nsis", text: "NullsoftInst" },
|
|
1825
1855
|
{ kind: "inno", text: "JR.Inno.Setup" },
|
|
1826
|
-
{ kind: "inno", text: "Inno Setup Setup Data" }
|
|
1856
|
+
{ kind: "inno", text: "Inno Setup Setup Data" },
|
|
1857
|
+
// Kachina Installer (BetterGI's BetterGI.Install.*.exe) writes it over the DOS stub's text (native/builder/pack.rs).
|
|
1858
|
+
{ kind: "kachina", text: "!KachinaInstaller!" }
|
|
1827
1859
|
];
|
|
1828
1860
|
async function setupKind(file) {
|
|
1829
1861
|
const handle = await open2(file, "r").catch(() => void 0);
|
|
@@ -1841,9 +1873,9 @@ async function setupKind(file) {
|
|
|
1841
1873
|
await handle.close();
|
|
1842
1874
|
}
|
|
1843
1875
|
}
|
|
1844
|
-
var SETUP_NAMES = { nsis: "NSIS", inno: "Inno Setup" };
|
|
1876
|
+
var SETUP_NAMES = { nsis: "NSIS", inno: "Inno Setup", kachina: "Kachina" };
|
|
1845
1877
|
function setupCommandLine(kind, dir, quiet) {
|
|
1846
|
-
if (kind === "nsis")
|
|
1878
|
+
if (kind === "nsis" || kind === "kachina")
|
|
1847
1879
|
return `${quiet ? "/S " : ""}/D=${dir}`;
|
|
1848
1880
|
return `${quiet ? "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- " : ""}/DIR="${dir}"`;
|
|
1849
1881
|
}
|
|
@@ -1852,7 +1884,8 @@ function setupExitText(kind, code) {
|
|
|
1852
1884
|
return "\u5B89\u88C5\u5B8C\u6210";
|
|
1853
1885
|
const nsis = { 1: "\u5B89\u88C5\u88AB\u53D6\u6D88\u4E86", 2: "\u5B89\u88C5\u4E2D\u9014\u51FA\u9519" };
|
|
1854
1886
|
const inno = { 1: "\u5B89\u88C5\u7A0B\u5E8F\u6CA1\u80FD\u542F\u52A8", 2: "\u5B89\u88C5\u8FD8\u6CA1\u5F00\u59CB\u5C31\u88AB\u53D6\u6D88\u4E86", 3: "\u51C6\u5907\u5B89\u88C5\u65F6\u51FA\u9519", 4: "\u5B89\u88C5\u4E2D\u9014\u51FA\u9519", 5: "\u5B89\u88C5\u88AB\u53D6\u6D88\u4E86", 6: "\u5B89\u88C5\u7A0B\u5E8F\u88AB\u5F3A\u884C\u7ED3\u675F", 7: "\u5B89\u88C5\u524D\u68C0\u67E5\u6CA1\u901A\u8FC7", 8: "\u5B89\u88C5\u524D\u68C0\u67E5\u6CA1\u901A\u8FC7\uFF0C\u9700\u8981\u91CD\u542F\u7535\u8111" };
|
|
1855
|
-
|
|
1887
|
+
const kachina = { 1: "\u5B89\u88C5\u6CA1\u6709\u5B8C\u6210" };
|
|
1888
|
+
return { nsis, inno, kachina }[kind][code] ?? `\u5B89\u88C5\u7A0B\u5E8F\u9000\u51FA\u7801 ${code}`;
|
|
1856
1889
|
}
|
|
1857
1890
|
function runSetup(file, options2) {
|
|
1858
1891
|
const commandLine = setupCommandLine(options2.kind, options2.dir, options2.quiet);
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
globToRegExp,
|
|
4
4
|
renderTask,
|
|
5
5
|
require_dist
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NWM5ZN7E.js";
|
|
7
7
|
import {
|
|
8
8
|
RUNS_CAPABILITY,
|
|
9
9
|
ScriptId,
|
|
10
10
|
external_exports
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QAP7IYBS.js";
|
|
12
12
|
import {
|
|
13
13
|
__toESM
|
|
14
14
|
} from "./chunk-2UFLGPDY.js";
|
package/lib/emulator.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire as __adgCreateRequire } from 'node:module'; import { dirn
|
|
|
2
2
|
import {
|
|
3
3
|
download,
|
|
4
4
|
runElevated
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YG4B5G7F.js";
|
|
6
6
|
import {
|
|
7
7
|
writeFileAtomic
|
|
8
8
|
} from "./chunk-CCAB6XXZ.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
EMULATORS_CAPABILITY,
|
|
11
11
|
EmulatorSettings,
|
|
12
12
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QAP7IYBS.js";
|
|
14
14
|
import "./chunk-2UFLGPDY.js";
|
|
15
15
|
|
|
16
16
|
// packages/emulator/lib/index.js
|
package/lib/feishu.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire as __adgCreateRequire } from 'node:module'; import { dirn
|
|
|
2
2
|
import {
|
|
3
3
|
replyMarkdown,
|
|
4
4
|
replyPlain
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-I5AFAEXG.js";
|
|
6
6
|
import {
|
|
7
7
|
require_extension,
|
|
8
8
|
require_permessage_deflate,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
require_subprotocol,
|
|
13
13
|
require_websocket,
|
|
14
14
|
require_websocket_server
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OPV336S5.js";
|
|
16
16
|
import {
|
|
17
17
|
writeFileAtomic
|
|
18
18
|
} from "./chunk-CCAB6XXZ.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
FeishuPending,
|
|
23
23
|
FeishuSettings,
|
|
24
24
|
external_exports
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-QAP7IYBS.js";
|
|
26
26
|
import {
|
|
27
27
|
__commonJS,
|
|
28
28
|
__require,
|