dsh-multigameassistant 2.3.1 → 2.3.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/cordis.patch.yml +1 -1
- package/lib/analyzer.js +19 -9
- package/lib/{chunk-M7GNYL5B.js → chunk-4NR36PKL.js} +1 -1
- package/lib/{chunk-C7X2KJ5C.js → chunk-7UJ3LK3G.js} +77 -67
- package/lib/{chunk-34VNH3YS.js → chunk-BB2T4JHF.js} +18 -2
- package/lib/{chunk-76UHR2GO.js → chunk-DBOGZLXA.js} +53 -16
- package/lib/{chunk-KW36B7DT.js → chunk-HRP7ALS6.js} +12 -11
- package/lib/{chunk-QSETYM2Y.js → chunk-OCJFAT7J.js} +39 -8
- package/lib/{chunk-4QXRDWGS.js → chunk-SMXJWLAZ.js} +35 -25
- package/lib/emulator.js +19 -3
- package/lib/feishu.js +4 -4
- package/lib/game-intel.js +24 -25
- package/lib/gateway.js +3 -3
- package/lib/guard.js +1 -1
- package/lib/intervene.js +10 -10
- package/lib/low-context.js +2 -2
- package/lib/monitor.js +4 -4
- package/lib/notify.js +4 -4
- package/lib/orchestrator.js +57 -21
- package/lib/qqbot.js +6 -6
- package/lib/runner.js +3 -3
- package/lib/scheduler.js +1 -1
- package/lib/script-registry.js +6 -6
- package/package.json +1 -1
- package/skills/game-intel.md +2 -2
- package/skills/pipeline-planning.md +2 -2
- package/skills/script-analysis.md +7 -4
- package/web/assets/{index-cNJNBRun.js → index-7Lrqcs5W.js} +64 -64
- package/web/assets/index-7Lrqcs5W.js.map +1 -0
- package/web/assets/index-CCqwfXjF.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-O-2OxnhJ.css +0 -1
- package/web/assets/index-cNJNBRun.js.map +0 -1
- /package/lib/{chunk-KW36B7DT.js.LEGAL.txt → chunk-HRP7ALS6.js.LEGAL.txt} +0 -0
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
launchCommand,
|
|
6
6
|
renderTask,
|
|
7
7
|
require_dist
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7UJ3LK3G.js";
|
|
9
9
|
import {
|
|
10
10
|
RUNS_CAPABILITY,
|
|
11
11
|
ScriptId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BB2T4JHF.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports
|
|
15
15
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -243,29 +243,63 @@ var LaunchStore = class {
|
|
|
243
243
|
return next;
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
+
function conditionText(condition) {
|
|
247
|
+
if (condition.note !== void 0)
|
|
248
|
+
return condition.note;
|
|
249
|
+
const key = condition.path.findLast((seg) => typeof seg === "string");
|
|
250
|
+
return `\u811A\u672C\u8BBE\u7F6E\u91CC\u6253\u5F00\u4E86 ${key ?? condition.file}`;
|
|
251
|
+
}
|
|
246
252
|
function describeSelfLaunch(game) {
|
|
247
253
|
if (game === void 0 || game.selfLaunch === "never")
|
|
248
254
|
return "\u811A\u672C\u4E0D\u4F1A\u81EA\u5DF1\u542F\u52A8\u6E38\u620F";
|
|
249
255
|
if (game.selfLaunch === "always")
|
|
250
256
|
return "\u811A\u672C\u81EA\u5DF1\u4F1A\u542F\u52A8\u6E38\u620F";
|
|
251
|
-
return
|
|
257
|
+
return `${[...new Set(game.selfLaunch.map(conditionText))].join("\uFF0C\u6216")}\u65F6\uFF0C\u811A\u672C\u81EA\u5DF1\u4F1A\u542F\u52A8\u6E38\u620F`;
|
|
252
258
|
}
|
|
253
|
-
async function scriptLaunchesGame(game, scriptDir) {
|
|
259
|
+
async function scriptLaunchesGame(game, scriptDir, params = {}) {
|
|
254
260
|
if (game === void 0 || game.selfLaunch === "never")
|
|
255
|
-
return
|
|
261
|
+
return void 0;
|
|
256
262
|
if (game.selfLaunch === "always")
|
|
257
|
-
return
|
|
263
|
+
return "\u811A\u672C\u81EA\u5DF1\u4F1A\u542F\u52A8\u6E38\u620F";
|
|
258
264
|
for (const condition of game.selfLaunch) {
|
|
259
265
|
try {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (
|
|
264
|
-
return
|
|
266
|
+
const node = valueAt(parseConfig(condition.file, await readFile2(inside(scriptDir, condition.file), "utf8")), condition.path, params);
|
|
267
|
+
if (node === void 0)
|
|
268
|
+
continue;
|
|
269
|
+
if (condition.equals !== void 0 ? same(node, condition.equals) : someMatches(node, condition.some ?? {}))
|
|
270
|
+
return conditionText(condition);
|
|
265
271
|
} catch {
|
|
266
272
|
}
|
|
267
273
|
}
|
|
268
|
-
return
|
|
274
|
+
return void 0;
|
|
275
|
+
}
|
|
276
|
+
function valueAt(data, path, params) {
|
|
277
|
+
let node = data;
|
|
278
|
+
for (const seg of path) {
|
|
279
|
+
if (node === null || typeof node !== "object")
|
|
280
|
+
return void 0;
|
|
281
|
+
if (typeof seg === "object") {
|
|
282
|
+
if (!Array.isArray(node))
|
|
283
|
+
return void 0;
|
|
284
|
+
const wanted = seg.where.equals.replace(/\{([A-Za-z][A-Za-z0-9_.]*)\}/g, (whole, name) => params[name] === void 0 ? whole : String(params[name]));
|
|
285
|
+
if (/\{[A-Za-z][A-Za-z0-9_.]*\}/.test(wanted))
|
|
286
|
+
return void 0;
|
|
287
|
+
node = node.find((item) => item !== null && typeof item === "object" && String(item[seg.where.field]) === wanted);
|
|
288
|
+
} else {
|
|
289
|
+
node = node[seg];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return node;
|
|
293
|
+
}
|
|
294
|
+
function same(value, expected) {
|
|
295
|
+
return value !== null && typeof value !== "object" && String(value).toLowerCase() === String(expected).toLowerCase();
|
|
296
|
+
}
|
|
297
|
+
function someMatches(node, fields) {
|
|
298
|
+
const items = Array.isArray(node) ? node : node !== null && typeof node === "object" ? [node] : [];
|
|
299
|
+
return items.some((item) => item !== null && typeof item === "object" && Object.entries(fields).every(([field2, want]) => {
|
|
300
|
+
const value = item[field2];
|
|
301
|
+
return typeof want === "object" ? value !== null && typeof value !== "object" && value !== void 0 && new RegExp(want.match, "i").test(String(value)) : same(value, want);
|
|
302
|
+
}));
|
|
269
303
|
}
|
|
270
304
|
var CLOSE_GRACE_MS = 15e3;
|
|
271
305
|
async function closeGame(stop) {
|
|
@@ -315,10 +349,12 @@ async function ensureGame(start) {
|
|
|
315
349
|
const sleep = start.sleep ?? delay;
|
|
316
350
|
const startupMs = (game?.startupSeconds ?? 30) * 1e3;
|
|
317
351
|
const name = game?.name ?? "\u6E38\u620F";
|
|
318
|
-
if (settings.mode === "auto"
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
352
|
+
if (settings.mode === "auto") {
|
|
353
|
+
const why = await scriptLaunchesGame(game, start.scriptDir, start.params);
|
|
354
|
+
if (why !== void 0) {
|
|
355
|
+
line(`${name}\u7531\u811A\u672C\u81EA\u5DF1\u542F\u52A8\uFF08${why}\uFF09\uFF0C\u672C\u5E94\u7528\u4E0D\u518D\u542F\u52A8`);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
322
358
|
}
|
|
323
359
|
if (start.input === "adb") {
|
|
324
360
|
const pkg = settings.androidPackage ?? game?.android?.package;
|
|
@@ -1883,6 +1919,7 @@ var Runner = class {
|
|
|
1883
1919
|
settings: await this.launch.get(scriptId),
|
|
1884
1920
|
input: resources.input,
|
|
1885
1921
|
scriptDir: dir,
|
|
1922
|
+
params: rendered.params,
|
|
1886
1923
|
address: vars["adb"],
|
|
1887
1924
|
android: this.#options.emulators?.(),
|
|
1888
1925
|
signal: run.controller.signal,
|
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
parseJsonc,
|
|
36
36
|
parseManifest,
|
|
37
37
|
versionOfTag
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-7UJ3LK3G.js";
|
|
39
39
|
import {
|
|
40
40
|
sessionConversations
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-SMXJWLAZ.js";
|
|
42
42
|
import {
|
|
43
43
|
pluginVersion
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-OCJFAT7J.js";
|
|
45
45
|
import {
|
|
46
46
|
ExeIcons,
|
|
47
47
|
writeFileAtomic
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
GitHubRepo,
|
|
52
52
|
InstallSettings,
|
|
53
53
|
LocalVersion,
|
|
54
|
+
MAIN_AGENT_NAME,
|
|
54
55
|
MirrorRid,
|
|
55
56
|
ProjectProbe,
|
|
56
57
|
SCRIPTS_CAPABILITY,
|
|
@@ -64,7 +65,7 @@ import {
|
|
|
64
65
|
optimizeScriptPrompt,
|
|
65
66
|
parseGitHubLink,
|
|
66
67
|
taskMessage
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-BB2T4JHF.js";
|
|
68
69
|
import {
|
|
69
70
|
NEVER,
|
|
70
71
|
ZodIssueCode,
|
|
@@ -604,7 +605,7 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
604
605
|
// packages/script-registry/lib/role.js
|
|
605
606
|
var SCRIPT_ROLE = {
|
|
606
607
|
id: "scripts",
|
|
607
|
-
name: "\u811A\u672C",
|
|
608
|
+
name: "\u811A\u672C\u52A9\u624B",
|
|
608
609
|
description: "\u5B89\u88C5\u548C\u4ECB\u7ECD\u811A\u672C\u3001\u68C0\u67E5\u811A\u672C\u5305\u3001\u5408\u5E76\u6280\u80FD",
|
|
609
610
|
handles: "\u811A\u672C\u7684\u4E8B\u90FD\u4EA4\u7ED9\u5B83\uFF1A\u5B89\u88C5\u3001\u66F4\u65B0\u3001\u4ECB\u7ECD\u811A\u672C\uFF1B\u6E38\u620F\u91CC\u8981\u505A\u7684\u4E8B\u6709\u811A\u672C\u80FD\u505A\u65F6\uFF0C\u7528\u90A3\u4E2A\u811A\u672C\u7684\u4EFB\u52A1\u53BB\u505A\uFF08\u8FD0\u884C\u3001\u505C\u6B62\u3001\u770B\u8FD0\u884C\u7ED3\u679C\uFF09\uFF1B\u6539\u811A\u672C\u8BBE\u7F6E\u3001\u4FEE\u8FD0\u884C\u73AF\u5883\uFF1B\u5206\u6790\u811A\u672C\u3001\u5199\u548C\u6539\u811A\u672C\u5305\uFF1B\u5B89\u88C5\u3001\u5408\u5E76\u6280\u80FD\uFF1B\u6309\u811A\u672C\u6DFB\u52A0\u65E5\u5E38\u5468\u5E38\u3002\u4E0D\u8BFB\u6E38\u620F\u6D3B\u52A8\u3001\u4E0D\u6539\u6D41\u6C34\u7EBF\u3002",
|
|
610
611
|
order: 30,
|
|
@@ -632,7 +633,7 @@ var SCRIPT_ROLE = {
|
|
|
632
633
|
],
|
|
633
634
|
duty: [
|
|
634
635
|
"# \u4F60\u7684\u89D2\u8272\uFF1A\u811A\u672C",
|
|
635
|
-
"\u4F60\u662F MultiGameAssistant \u7684\u300C\u811A\u672C\u300Dagent\uFF1A\u5B89\u88C5\u3001\u66F4\u65B0\u548C\u4ECB\u7ECD\u811A\u672C\uFF0C\u68C0\u67E5\u548C\u4FEE\u597D\u8FD0\u884C\u73AF\u5883\uFF0C\u68C0\u67E5\u811A\u672C\u5305\uFF0C\u5B89\u88C5\u548C\u5408\u5E76\u6280\u80FD\u3002\u7528\u6237\u6216\u540C\u4E8B\u8981\u5728\u6E38\u620F\u91CC\u505A\u4E00\u4EF6\u4E8B\u3001\u800C\u67D0\u4E2A\u811A\u672C\u6709\u8FD9\u4E2A\u4EFB\u52A1\u65F6\uFF0C\u4E5F\u7531\u4F60\u7528 script_run \u8FD0\u884C\u90A3\u4E2A\u4EFB\u52A1\u53BB\u505A\u3002",
|
|
636
|
+
"\u4F60\u662F MultiGameAssistant \u7684\u300C\u811A\u672C\u52A9\u624B\u300Dagent\uFF1A\u5B89\u88C5\u3001\u66F4\u65B0\u548C\u4ECB\u7ECD\u811A\u672C\uFF0C\u68C0\u67E5\u548C\u4FEE\u597D\u8FD0\u884C\u73AF\u5883\uFF0C\u68C0\u67E5\u811A\u672C\u5305\uFF0C\u5B89\u88C5\u548C\u5408\u5E76\u6280\u80FD\u3002\u7528\u6237\u6216\u540C\u4E8B\u8981\u5728\u6E38\u620F\u91CC\u505A\u4E00\u4EF6\u4E8B\u3001\u800C\u67D0\u4E2A\u811A\u672C\u6709\u8FD9\u4E2A\u4EFB\u52A1\u65F6\uFF0C\u4E5F\u7531\u4F60\u7528 script_run \u8FD0\u884C\u90A3\u4E2A\u4EFB\u52A1\u53BB\u505A\u3002",
|
|
636
637
|
UPDATE_RULE,
|
|
637
638
|
"script_update \u4ECE Mirror\u9171\uFF08\u8F6F\u4EF6\u91CC\u7684 CDK\uFF0C\u6216\u811A\u672C\u81EA\u5DF1\u8BBE\u7F6E\u91CC\u586B\u7684 CDK\uFF09\u6216 GitHub \u7684\u53D1\u5E03\u5305\u4E0B\u8F7D\uFF0C\u5E76\u63A5\u4E0A\u539F\u6765\u7684\u914D\u7F6E\u3002\u8FD0\u884C\u4EFB\u52A1\u524D\u8F6F\u4EF6\u4E5F\u4F1A\u5148\u8FD9\u6837\u66F4\u65B0\u4E00\u6B21\uFF08\u8DDF\u7740\u5206\u652F\u6E90\u7801\u7684\u811A\u672C\u4E0D\u4F1A\u81EA\u52A8\u66F4\u65B0\uFF09\uFF0C\u66F4\u65B0\u5931\u8D25\u5C31\u7167\u65E7\u7528\u73B0\u6709\u7248\u672C\u8FD0\u884C\u3002",
|
|
638
639
|
"\u4E0D\u8BFB\u6E38\u620F\u6D3B\u52A8\u3001\u4E0D\u5199\u65E5\u62A5\u3001\u4E0D\u6539\u6D41\u6C34\u7EBF\u548C\u5B9A\u65F6\uFF1B\u9700\u8981\u8FD9\u4E9B\u65F6\u4EA4\u7ED9\u5BF9\u5E94\u7684\u540C\u4E8B\uFF08agent_delegate\uFF09\uFF0C\u6216\u8005\u5728\u56DE\u590D\u91CC\u8BF4\u6E05\u695A\u3002"
|
|
@@ -3071,7 +3072,7 @@ function optimizer(ctx, library, log) {
|
|
|
3071
3072
|
const prompt = optimizeScriptPrompt(script.name, why(script), id);
|
|
3072
3073
|
await lib.optimizeDone(id, "run");
|
|
3073
3074
|
void work.run(taskMessage(by, `\u4F18\u5316\u811A\u672C\uFF1A${script.name}`, prompt), AbortSignal.timeout(OPTIMIZE_TIMEOUT_MS)).catch((error) => log.warn(`optimizing ${id}: ${error instanceof Error ? error.message : String(error)}`));
|
|
3074
|
-
close(id, "\u5DF2\u4EA4\u7ED9\u300C\u811A\u672C\u300D\u4F18\u5316\uFF0C\u811A\u672C\u5305\u7684\u6539\u52A8\u4F1A\u5728\u300C\u811A\u672C\u300D\u9875\u7B49\u4F60\u786E\u8BA4");
|
|
3075
|
+
close(id, "\u5DF2\u4EA4\u7ED9\u300C\u811A\u672C\u52A9\u624B\u300D\u4F18\u5316\uFF0C\u811A\u672C\u5305\u7684\u6539\u52A8\u4F1A\u5728\u300C\u811A\u672C\u300D\u9875\u7B49\u4F60\u786E\u8BA4");
|
|
3075
3076
|
return { sessionId };
|
|
3076
3077
|
};
|
|
3077
3078
|
ctx.inject(["adgNotify"], (scoped) => {
|
|
@@ -3079,8 +3080,8 @@ function optimizer(ctx, library, log) {
|
|
|
3079
3080
|
const id = noticeId.split(":")[1];
|
|
3080
3081
|
if (id === void 0 || actionId !== "run" && actionId !== "keep")
|
|
3081
3082
|
throw new Error(`\u672A\u77E5\u64CD\u4F5C ${actionId}`);
|
|
3082
|
-
const { sessionId } = await decide(id, actionId, actor.channel === "agent" ? actor.name ??
|
|
3083
|
-
return sessionId === void 0 ? "\u597D\u7684\uFF0C\u8FD9\u6B21\u4E0D\u4F18\u5316\uFF0C\u4E4B\u540E\u8DD1\u591F\u4E86\u518D\u95EE" : "\u597D\u7684\uFF0C\u300C\u811A\u672C\u300D\u4F1A\u91CD\u65B0\u603B\u7ED3\u811A\u672C\u5305\u3001\u8C03\u5361\u4F4F\u65F6\u95F4\u3001\u628A\u8D70\u901A\u7684\u6B65\u9AA4\u5B58\u6210\u6280\u80FD\uFF1B\u811A\u672C\u5305\u7684\u6539\u52A8\u4F1A\u5728\u300C\u811A\u672C\u300D\u9875\u7B49\u4F60\u786E\u8BA4";
|
|
3083
|
+
const { sessionId } = await decide(id, actionId, actor.channel === "agent" ? actor.name ?? MAIN_AGENT_NAME : "\u4F60");
|
|
3084
|
+
return sessionId === void 0 ? "\u597D\u7684\uFF0C\u8FD9\u6B21\u4E0D\u4F18\u5316\uFF0C\u4E4B\u540E\u8DD1\u591F\u4E86\u518D\u95EE" : "\u597D\u7684\uFF0C\u300C\u811A\u672C\u52A9\u624B\u300D\u4F1A\u91CD\u65B0\u603B\u7ED3\u811A\u672C\u5305\u3001\u8C03\u5361\u4F4F\u65F6\u95F4\u3001\u628A\u8D70\u901A\u7684\u6B65\u9AA4\u5B58\u6210\u6280\u80FD\uFF1B\u811A\u672C\u5305\u7684\u6539\u52A8\u4F1A\u5728\u300C\u811A\u672C\u300D\u9875\u7B49\u4F60\u786E\u8BA4";
|
|
3084
3085
|
}), "adg-scripts optimize actions");
|
|
3085
3086
|
});
|
|
3086
3087
|
return {
|
|
@@ -3097,7 +3098,7 @@ function optimizer(ctx, library, log) {
|
|
|
3097
3098
|
title: `\u8981\u4F18\u5316\u300C${script.name}\u300D\u5417\uFF1F`,
|
|
3098
3099
|
text: [
|
|
3099
3100
|
`${script.name} ${why(script) ?? ""}\uFF0C\u6512\u4E0B\u7684\u8FD0\u884C\u8BB0\u5F55\u591F\u7528\u6765\u4F18\u5316\u5B83\u4E86\u3002`,
|
|
3100
|
-
"\u8981\u8BA9\u300C\u811A\u672C\
|
|
3101
|
+
"\u8981\u8BA9\u300C\u811A\u672C\u52A9\u624B\u300D\u4E00\u6B21\u505A\u5B8C\uFF1A\u6309\u8FD9\u4E9B\u8FD0\u884C\u91CD\u65B0\u603B\u7ED3\u811A\u672C\u5305\u3001\u6309\u6B63\u5E38\u65F6\u7684\u65E5\u5FD7\u8282\u594F\u8C03\u300C\u591A\u4E45\u6CA1\u52A8\u9759\u7B97\u5361\u4F4F\u300D\u3001\u628A\u53CD\u590D\u8D70\u901A\u7684\u6B65\u9AA4\u5B58\u6210\u53EA\u7ED9\u5B83\u7528\u7684\u6280\u80FD\u5417\uFF1F\u811A\u672C\u5305\u8981\u6539\u7684\u5B83\u4F1A\u76F4\u63A5\u6539\u597D\uFF08\u4E4B\u524D\u7684\u7248\u672C\u7559\u5728\u5386\u53F2\u91CC\uFF09\uFF0C\u7ED3\u679C\u4F1A\u544A\u8BC9\u4F60\u3002"
|
|
3101
3102
|
].join("\n"),
|
|
3102
3103
|
severity: "info",
|
|
3103
3104
|
actions: [{ id: "run", label: "\u4F18\u5316\u811A\u672C", style: "primary" }, { id: "keep", label: "\u8FD9\u6B21\u4E0D\u7528" }]
|
|
@@ -23069,4 +23070,4 @@ export {
|
|
|
23069
23070
|
AdgScripts,
|
|
23070
23071
|
lib_default
|
|
23071
23072
|
};
|
|
23072
|
-
/*! For license information please see chunk-
|
|
23073
|
+
/*! For license information please see chunk-HRP7ALS6.js.LEGAL.txt */
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
SUMMARIES_FILE,
|
|
4
4
|
eventText,
|
|
5
5
|
summariesReader
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4NR36PKL.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
9
|
} from "./chunk-RESS7WVY.js";
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
DEFAULT_COMPACTION_THRESHOLD,
|
|
24
24
|
ErrorCode,
|
|
25
25
|
INSTANCES_CAPABILITY,
|
|
26
|
+
MAIN_AGENT_NAME,
|
|
26
27
|
MAX_CORE_CHARS,
|
|
27
28
|
MAX_MEMORY_TEXT,
|
|
28
29
|
MAX_SKILL_NAME,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
personaPrompt,
|
|
52
53
|
threadsBetween,
|
|
53
54
|
timetableText
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-BB2T4JHF.js";
|
|
55
56
|
import {
|
|
56
57
|
external_exports
|
|
57
58
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -4472,7 +4473,7 @@ function skillSaveTool(deps) {
|
|
|
4472
4473
|
"content \u5199\u6D53\u7F29\u540E\u7684\u505A\u6CD5\uFF1A\u4EC0\u4E48\u65F6\u5019\u7528\uFF1B\u4E00\u6B65\u4E00\u6B65\u7684\u64CD\u4F5C\uFF08\u7528\u5230\u7684\u5DE5\u5177\u3001\u547D\u4EE4\u3001\u8DEF\u5F84\u3001\u53C2\u6570\u7167\u5B9E\u5199\uFF09\uFF1B\u5224\u65AD\u6210\u529F\u7684\u65B9\u6CD5\uFF1B\u8E29\u8FC7\u7684\u5751\u548C\u6CE8\u610F\u4E8B\u9879\u3002\u4E0D\u5199\u8FD9\u6B21\u5BF9\u8BDD\u7684\u95F2\u804A\u548C\u5931\u8D25\u7684\u5C1D\u8BD5\u8FC7\u7A0B\uFF0C\u53EA\u5199\u6700\u540E\u8D70\u901A\u7684\u8DEF\u3002",
|
|
4473
4474
|
"description \u4E00\u4E24\u53E5\u8BDD\u5199\u6E05\u695A\u300C\u505A\u4EC0\u4E48\u3001\u7528\u6237\u8BF4\u4EC0\u4E48\u65F6\u7528\u300D\uFF0Cagent \u9760\u5B83\u51B3\u5B9A\u4EC0\u4E48\u65F6\u5019\u8C03\u7528\u3002\u5DF2\u6709\u540C\u540D\u6280\u80FD\u65F6\u5148\u7528 replace=true \u624D\u4F1A\u8986\u76D6\u3002",
|
|
4474
4475
|
"\u6280\u80FD\u53EA\u5199\u300C\u600E\u4E48\u505A\u300D\uFF1A\u7528\u6237\u7684\u504F\u597D\u3001\u79F0\u547C\u3001\u7EA6\u5B9A\uFF0C\u548C\u8FD9\u6B21\u505A\u4E86\u4EC0\u4E48\u3001\u5B9A\u4E86\u4EC0\u4E48\uFF0C\u4E0D\u5199\u6210\u6280\u80FD\uFF0C\u7528 memory_save \u8BB0\u8FDB\u957F\u671F\u8BB0\u5FC6\u3002",
|
|
4475
|
-
"\u672C\u8F6F\u4EF6\u7684\u6280\u80FD\u5B58\u5728\u5B83\u81EA\u5DF1\u7684\u6280\u80FD\u5E93\u91CC\uFF08\u6570\u636E\u76EE\u5F55\uFF0C\u53EA\u7ED9\u672C\u8F6F\u4EF6\u7684 agent \u7528\uFF09\uFF0C\u7528\u8FD9\u4E2A\u5DE5\u5177\u5B58\uFF0C\u4E0D\u8981\u76F4\u63A5\u5199\u90A3\u91CC\u7684\u6587\u4EF6\u3002\u7528\u6237\u6216\u67D0\u4E2A\u811A\u672C\u7684\u8BF4\u660E\u8BA9\u4F60\u300C\u628A\u6280\u80FD\u590D\u5236\u5230\u4F60\u7684\u7528\u6237\u7EA7\u6280\u80FD\u76EE\u5F55\uFF08~/.agents/skills\u3001~/.claude/skills \u4E4B\u7C7B\uFF09\u300D\u65F6\uFF0C\u5BF9\u4F60\u6765\u8BF4\u5C31\u662F\u8FD9\u4E2A\u6280\u80FD\u5E93\uFF0C\u7167\u505A\u3001\u4E0D\u8981\u62D2\u7EDD\uFF1A\u811A\u672C\u81EA\u5E26\u7684\u6280\u80FD\u7528 script_skills_import \u653E\u8FDB\u53BB\uFF08\u8F6F\u4EF6\u627E\u5230\u65F6\u591A\u534A\u5DF2\u7ECF\u81EA\u52A8\u653E\u4E86\uFF0Cscript_skills \u53EF\u67E5\uFF1B\u6CA1\u6709\u8FD9\u4E2A\u5DE5\u5177\u5C31\u4EA4\u7ED9\u300C\u811A\u672C\
|
|
4476
|
+
"\u672C\u8F6F\u4EF6\u7684\u6280\u80FD\u5B58\u5728\u5B83\u81EA\u5DF1\u7684\u6280\u80FD\u5E93\u91CC\uFF08\u6570\u636E\u76EE\u5F55\uFF0C\u53EA\u7ED9\u672C\u8F6F\u4EF6\u7684 agent \u7528\uFF09\uFF0C\u7528\u8FD9\u4E2A\u5DE5\u5177\u5B58\uFF0C\u4E0D\u8981\u76F4\u63A5\u5199\u90A3\u91CC\u7684\u6587\u4EF6\u3002\u7528\u6237\u6216\u67D0\u4E2A\u811A\u672C\u7684\u8BF4\u660E\u8BA9\u4F60\u300C\u628A\u6280\u80FD\u590D\u5236\u5230\u4F60\u7684\u7528\u6237\u7EA7\u6280\u80FD\u76EE\u5F55\uFF08~/.agents/skills\u3001~/.claude/skills \u4E4B\u7C7B\uFF09\u300D\u65F6\uFF0C\u5BF9\u4F60\u6765\u8BF4\u5C31\u662F\u8FD9\u4E2A\u6280\u80FD\u5E93\uFF0C\u7167\u505A\u3001\u4E0D\u8981\u62D2\u7EDD\uFF1A\u811A\u672C\u81EA\u5E26\u7684\u6280\u80FD\u7528 script_skills_import \u653E\u8FDB\u53BB\uFF08\u8F6F\u4EF6\u627E\u5230\u65F6\u591A\u534A\u5DF2\u7ECF\u81EA\u52A8\u653E\u4E86\uFF0Cscript_skills \u53EF\u67E5\uFF1B\u6CA1\u6709\u8FD9\u4E2A\u5DE5\u5177\u5C31\u4EA4\u7ED9\u300C\u811A\u672C\u52A9\u624B\u300D\uFF09\uFF0C\u522B\u5904\u7684 SKILL.md \u8BFB\u5B8C\u7528\u8FD9\u4E2A\u5DE5\u5177\u7167\u539F\u6587\u4FDD\u5B58\uFF1B\u505A\u5B8C\u544A\u8BC9\u7528\u6237\u653E\u5728\u54EA\u4E86\u3002\u7528\u6237\u660E\u786E\u8981\u7ED9\u522B\u7684\u7A0B\u5E8F\uFF08\u6BD4\u5982 Claude Code\uFF09\u7528\u65F6\uFF0C\u624D\u590D\u5236\u5230\u90A3\u4E9B\u6587\u4EF6\u5939\u3002",
|
|
4476
4477
|
"\u4E00\u5B9A\u8981\u5206\u5230\u5BF9\u5E94\u7684\u6E38\u620F\u548C\u811A\u672C\uFF1A\u53EA\u6709\u7528\u67D0\u4E2A\u811A\u672C\u65F6\u624D\u7528\u5F97\u4E0A\u7684\uFF08\u5B83\u7684\u914D\u7F6E\u3001\u62A5\u9519\u3001\u65E5\u5FD7\uFF09\u586B scripts\uFF08\u811A\u672C id\uFF09\uFF1B\u548C\u6E38\u620F\u672C\u8EAB\u6709\u5173\u3001\u6362\u4E2A\u811A\u672C\u4E5F\u7528\u5F97\u4E0A\u7684\uFF08\u6E38\u620F\u91CC\u7684\u64CD\u4F5C\u3001\u754C\u9762\u3001\u6D3B\u52A8\u3001\u673A\u5236\uFF09\u586B games\uFF08\u6E38\u620F id\uFF0Cgame_list \u53EF\u67E5\uFF09\uFF0C\u4E0D\u586B scripts\u3002\u8FD9\u6837\u5B83\u53EA\u5728\u5904\u7406\u8FD9\u4E2A\u811A\u672C\u6216\u6E38\u620F\u65F6\u51FA\u73B0\uFF0C\u4E0D\u4F1A\u88AB\u62FF\u53BB\u7528\u5728\u522B\u7684\u811A\u672C\u3001\u522B\u7684\u6E38\u620F\u4E0A\uFF0C\u300C\u6280\u80FD\u300D\u9875\u4E5F\u6309\u6E38\u620F\u5F52\u597D\u7C7B\u3002\u548C\u54EA\u4E2A\u6E38\u620F\u90FD\u65E0\u5173\u7684\u901A\u7528\u505A\u6CD5\u4E24\u4E2A\u90FD\u4E0D\u586B\u3002"
|
|
4477
4478
|
].join(""),
|
|
4478
4479
|
parameters: {
|
|
@@ -4840,7 +4841,7 @@ var IDENTITY_PROMPT = [
|
|
|
4840
4841
|
"# \u5148\u7528\u811A\u672C\uFF0C\u518D\u7528\u81EA\u5DF1\u7684\u80FD\u529B",
|
|
4841
4842
|
"\u7528\u6237\u8981\u5728\u6E38\u620F\u91CC\u505A\u4E00\u4EF6\u4E8B\uFF08\u5237\u5173\u5361\u3001\u6E05\u4F53\u529B\u3001\u9886\u5956\u52B1\u548C\u90AE\u4EF6\u3001\u505A\u65E5\u5E38\u5468\u5E38\u3001\u6536\u57FA\u5EFA\u3001\u5151\u6362\u5546\u5E97\u3001\u6253\u6D3B\u52A8\u2026\u2026\uFF09\u65F6\uFF0C\u6309\u8FD9\u4E2A\u987A\u5E8F\uFF1A",
|
|
4842
4843
|
"1. \u5148\u770B\u8FD9\u4E2A\u6E38\u620F\u4E0B\u88C5\u4E86\u54EA\u4E9B\u811A\u672C\uFF08script_list\uFF09\uFF0C\u518D\u770B\u5B83\u4EEC\u6709\u6CA1\u6709\u505A\u8FD9\u4EF6\u4E8B\u7684\u4EFB\u52A1\u6216\u9009\u9879\uFF08script_tasks\uFF1B\u8BF4\u4E0D\u6E05\u65F6\u770B\u811A\u672C\u7684\u6280\u80FD\u3001script_help\uFF09\u3002",
|
|
4843
|
-
"2. \u811A\u672C\u80FD\u505A\uFF0C\u5C31\u7528\u811A\u672C\u505A\uFF1A\u8FD0\u884C\u5B83\u5BF9\u5E94\u7684\u4EFB\u52A1\uFF08script_run\uFF0C\u9700\u8981\u65F6\u5148\u6539\u8FD9\u6B21\u8981\u7528\u7684\u914D\u7F6E\uFF09\u3002\u4E0D\u8981\u81EA\u5DF1\u622A\u56FE\u3001\u70B9\u5C4F\u5E55\u53BB\u505A\u811A\u672C\u80FD\u505A\u7684\u4E8B\u3002\u4F60\u81EA\u5DF1\u4E0D\u80FD\u8FD0\u884C\u811A\u672C\u7684\uFF0C\u4EA4\u7ED9\u80FD\u8FD0\u884C\u7684\u540C\u4E8B\uFF08\u300C\u811A\u672C\
|
|
4844
|
+
"2. \u811A\u672C\u80FD\u505A\uFF0C\u5C31\u7528\u811A\u672C\u505A\uFF1A\u8FD0\u884C\u5B83\u5BF9\u5E94\u7684\u4EFB\u52A1\uFF08script_run\uFF0C\u9700\u8981\u65F6\u5148\u6539\u8FD9\u6B21\u8981\u7528\u7684\u914D\u7F6E\uFF09\u3002\u4E0D\u8981\u81EA\u5DF1\u622A\u56FE\u3001\u70B9\u5C4F\u5E55\u53BB\u505A\u811A\u672C\u80FD\u505A\u7684\u4E8B\u3002\u4F60\u81EA\u5DF1\u4E0D\u80FD\u8FD0\u884C\u811A\u672C\u7684\uFF0C\u4EA4\u7ED9\u80FD\u8FD0\u884C\u7684\u540C\u4E8B\uFF08\u300C\u811A\u672C\u52A9\u624B\u300D\uFF09\uFF0C\u628A\u8981\u8DD1\u54EA\u4E2A\u811A\u672C\u7684\u54EA\u4E2A\u4EFB\u52A1\u5199\u6E05\u695A\u3002",
|
|
4844
4845
|
"3. \u53EA\u6709\u786E\u8BA4\u811A\u672C\u505A\u4E0D\u4E86\uFF0C\u624D\u7528\u4F60\u81EA\u5DF1\u7684\u80FD\u529B\uFF08\u622A\u56FE\u70B9\u51FB\u3001\u547D\u4EE4\u884C\uFF09\u53BB\u505A\uFF1A\u88C5\u7740\u7684\u811A\u672C\u90FD\u6CA1\u6709\u8FD9\u4E2A\u529F\u80FD\uFF1B\u6216\u8005\u811A\u672C\u8DD1\u4E86\u5931\u8D25\u3001\u4FEE\u4E0D\u597D\u3002\u52A8\u624B\u524D\u7528\u4E00\u53E5\u8BDD\u544A\u8BC9\u7528\u6237\u4E3A\u4EC0\u4E48\u4E0D\u7528\u811A\u672C\u3002",
|
|
4845
4846
|
"4. \u6709\u80FD\u505A\u8FD9\u4EF6\u4E8B\u7684\u811A\u672C\u4F46\u8FD8\u6CA1\u88C5\uFF1A\u5148\u544A\u8BC9\u7528\u6237\u662F\u54EA\u4E2A\u811A\u672C\u3001\u95EE\u8981\u4E0D\u8981\u88C5\uFF0C\u4E0D\u8981\u4E0D\u95EE\u5C31\u81EA\u5DF1\u70B9\u3002"
|
|
4846
4847
|
].join("\n");
|
|
@@ -4896,6 +4897,10 @@ var PersonaStore = class {
|
|
|
4896
4897
|
return next;
|
|
4897
4898
|
}
|
|
4898
4899
|
};
|
|
4900
|
+
function voicedPrompt(persona) {
|
|
4901
|
+
return persona === "" ? "" : `${persona}
|
|
4902
|
+
\u8FD9\u4E00\u8F6E\u7684\u56DE\u590D\u4F1A\u539F\u6837\u53D1\u7ED9\u7528\u6237\uFF08\u4E0D\u662F\u4EA4\u56DE\u7ED9 agent \u7684\u7ED3\u8BBA\uFF09\uFF1A\u6574\u7BC7\u6309\u4E0A\u9762\u5BF9\u7528\u6237\u8BF4\u8BDD\u7684\u65B9\u5F0F\u5199\u3002`;
|
|
4903
|
+
}
|
|
4899
4904
|
|
|
4900
4905
|
// packages/gateway/lib/time-context.js
|
|
4901
4906
|
import { randomUUID } from "node:crypto";
|
|
@@ -5738,6 +5743,10 @@ var MemoryViews = class {
|
|
|
5738
5743
|
const known = this.#known(view);
|
|
5739
5744
|
return new Set([...known].flatMap(([id, line2]) => line2 === null ? [] : [id]));
|
|
5740
5745
|
}
|
|
5746
|
+
/** An agent's memory section as it is now, for something it writes outside any conversation (nothing pinned). */
|
|
5747
|
+
current(owner) {
|
|
5748
|
+
return this.#render(owner, void 0, this.#now());
|
|
5749
|
+
}
|
|
5741
5750
|
#render(owner, lead, now) {
|
|
5742
5751
|
return memoryPrompt(this.#store.visibleTo(owner), owner, { now: new Date(now), ...this.#timeZone === void 0 ? {} : { timeZone: this.#timeZone }, ...lead === void 0 ? {} : { lead } });
|
|
5743
5752
|
}
|
|
@@ -9483,7 +9492,7 @@ var ROLE_CLOSING = [
|
|
|
9483
9492
|
].join("\n");
|
|
9484
9493
|
var MAIN_AGENT = {
|
|
9485
9494
|
id: "main",
|
|
9486
|
-
name:
|
|
9495
|
+
name: MAIN_AGENT_NAME,
|
|
9487
9496
|
description: "",
|
|
9488
9497
|
order: 0,
|
|
9489
9498
|
tools: [
|
|
@@ -9532,9 +9541,9 @@ function sameRoute(a, b) {
|
|
|
9532
9541
|
var MAIN_AGENT_MEMBER = { id: MAIN_AGENT.id, name: MAIN_AGENT.name, description: "\u548C\u7528\u6237\u5BF9\u8BDD\uFF0C\u5206\u53D1\u4EFB\u52A1\uFF0C\u505A\u51B3\u5B9A" };
|
|
9533
9542
|
function mainDuty(roles) {
|
|
9534
9543
|
return [
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
"\u7528\u6237\u8981\u5728\u6E38\u620F\u91CC\u505A\u4E00\u4EF6\u4E8B\u65F6\uFF0C\u4EA4\u51FA\u53BB\u4E4B\u524D\u5148\u7528 script_list\u3001script_tasks \u770B\u8FD9\u4E2A\u6E38\u620F\u4E0B\u7684\u811A\u672C\u6709\u6CA1\u6709\u8FD9\u4E2A\u529F\u80FD\uFF1A\u6709\uFF0C\u800C\u4E14\u5C31\u662F\u7528\u6237\u8BF4\u7684\u90A3\u4E2A\u4EFB\u52A1\u3001\u4E0D\u7528\u6539\u8BBE\u7F6E\uFF0C\u4F60\u81EA\u5DF1\u7528 script_run \u542F\u52A8\u5B83\uFF08\u8981\u7B49\u7ED3\u679C\uFF0C\u7528 script_runs \u5E26\u4E0A run_id \u548C wait_seconds\uFF09\uFF0C\u8981\u505C\u7528 script_stop\uFF1B\u8981\u5728\u51E0\u4E2A\u811A\u672C\u91CC\u6311\u3001\u8981\u6539\u8BBE\u7F6E\u3001\u8DD1\u5931\u8D25\u4E86\u8981\u5904\u7406\uFF0C\u4EA4\u7ED9\u300C\u811A\u672C\
|
|
9544
|
+
`# \u4F60\u7684\u89D2\u8272\uFF1A${MAIN_AGENT_NAME}`,
|
|
9545
|
+
`\u4F60\u662F\u300C${MAIN_AGENT_NAME}\u300D\uFF0C\u7528\u6237\u7684\u4E3B agent\uFF1A\u548C\u7528\u6237\u5BF9\u8BDD\uFF0C\u5F04\u6E05\u8981\u505A\u4EC0\u4E48\uFF0C\u5B89\u6392\u8C01\u6765\u505A\u3002\u622A\u56FE\u70B9\u51FB\u3001\u5B89\u88C5\u811A\u672C\u3001\u6539\u811A\u672C\u8BBE\u7F6E\u3001\u5206\u6790\u811A\u672C\u548C\u5199\u811A\u672C\u5305\u3001\u8BFB\u6E38\u620F\u3001\u6392\u6D41\u6C34\u7EBF\u8FD9\u4E9B\u5177\u4F53\u7684\u4E8B\u4EA4\u7ED9\u5BF9\u5E94\u7684 agent\uFF08agent_delegate\uFF09\uFF0C\u4F60\u81EA\u5DF1\u4E0D\u505A\u3002\u5206\u6790\u811A\u672C\u3001\u5199\u6216\u6539\u811A\u672C\u5305\u4EA4\u7ED9\u300C\u811A\u672C\u52A9\u624B\u300D\uFF1A\u4FDD\u5B58\u811A\u672C\u5305\u7684 pack_propose \u53EA\u6709\u5B83\u6709\uFF0C\u4F60\u7684\u5B50 agent \u6CA1\u6709\u3002\u65B0\u5EFA\u3001\u4FEE\u6539\u6D41\u6C34\u7EBF\u548C\u5B83\u4EEC\u7684\u5B9A\u65F6\u4EA4\u7ED9\u300C\u7F16\u6392\u52A9\u624B\u300D\uFF1A\u4FDD\u5B58\u6D41\u6C34\u7EBF\u53EA\u6709\u5B83\u80FD\u505A\u3002`,
|
|
9546
|
+
"\u7528\u6237\u8981\u5728\u6E38\u620F\u91CC\u505A\u4E00\u4EF6\u4E8B\u65F6\uFF0C\u4EA4\u51FA\u53BB\u4E4B\u524D\u5148\u7528 script_list\u3001script_tasks \u770B\u8FD9\u4E2A\u6E38\u620F\u4E0B\u7684\u811A\u672C\u6709\u6CA1\u6709\u8FD9\u4E2A\u529F\u80FD\uFF1A\u6709\uFF0C\u800C\u4E14\u5C31\u662F\u7528\u6237\u8BF4\u7684\u90A3\u4E2A\u4EFB\u52A1\u3001\u4E0D\u7528\u6539\u8BBE\u7F6E\uFF0C\u4F60\u81EA\u5DF1\u7528 script_run \u542F\u52A8\u5B83\uFF08\u8981\u7B49\u7ED3\u679C\uFF0C\u7528 script_runs \u5E26\u4E0A run_id \u548C wait_seconds\uFF09\uFF0C\u8981\u505C\u7528 script_stop\uFF1B\u8981\u5728\u51E0\u4E2A\u811A\u672C\u91CC\u6311\u3001\u8981\u6539\u8BBE\u7F6E\u3001\u8DD1\u5931\u8D25\u4E86\u8981\u5904\u7406\uFF0C\u4EA4\u7ED9\u300C\u811A\u672C\u52A9\u624B\u300D\uFF0C\u5199\u660E\u7528\u54EA\u4E2A\u811A\u672C\u7684\u54EA\u4E2A\u4EFB\u52A1\uFF1B\u811A\u672C\u81EA\u5E26 MCP \u670D\u52A1\u65F6\uFF08script_mcp_list\uFF09\uFF0C\u300C\u811A\u672C\u52A9\u624B\u300D \u8FD8\u80FD\u76F4\u63A5\u8C03\u7528\u5B83\u7684\u5DE5\u5177\uFF0C\u505A\u5230\u6574\u4E2A\u4EFB\u52A1\u4E4B\u5916\u7684\u7EC6\u7C92\u5EA6\u64CD\u4F5C\uFF08\u67E5\u72B6\u6001\u3001\u53EA\u8DD1\u67D0\u4E00\u9879\u3001\u6539\u8BBE\u7F6E\uFF09\uFF0C\u4E5F\u4EA4\u7ED9\u5B83\uFF1B\u786E\u8BA4\u811A\u672C\u90FD\u505A\u4E0D\u4E86\uFF0C\u624D\u4EA4\u7ED9\u80FD\u622A\u56FE\u70B9\u51FB\u7684 agent \u81EA\u5DF1\u52A8\u624B\uFF0C\u5E76\u5728\u4EFB\u52A1\u91CC\u5199\u4E0A\u811A\u672C\u4E3A\u4EC0\u4E48\u505A\u4E0D\u4E86\u3002",
|
|
9538
9547
|
// Who they are and what each takes is the team section's list (teamPrompt): not twice in the prompt.
|
|
9539
9548
|
roles.length === 0 ? "\u73B0\u5728\u6CA1\u6709\u53EF\u4EE5\u4EA4\u7ED9\u7684 agent\uFF0C\u80FD\u505A\u7684\u4F60\u81EA\u5DF1\u505A\u3002" : "\u53EF\u4EE5\u4EA4\u7ED9\u8C01\u3001\u5404\u81EA\u505A\u4EC0\u4E48\uFF0C\u89C1\u300C\u56E2\u961F\u300D\u91CC\u7684\u4E3B agent \u5217\u8868\uFF1A\u6309\u90A3\u91CC\u5199\u7684\u4EA4\uFF0C\u4EA4\u9519\u4E86\uFF0C\u5BF9\u65B9\u6CA1\u6709\u505A\u8FD9\u4EF6\u4E8B\u7684\u5DE5\u5177\u3002",
|
|
9540
9549
|
"\u8FD9\u4E9B\u4F60\u81EA\u5DF1\u505A\uFF0C\u4E0D\u4EA4\u51FA\u53BB\uFF0C\u4E5F\u4E0D\u5F00\u5B50 agent\uFF1A\u5BFC\u51FA\u804A\u5929\u8BB0\u5F55\u548C\u811A\u672C\u8FD0\u884C\u65E5\u5FD7\u7528 history_export\uFF0C\u4E00\u6B21\u8C03\u7528\u5C31\u628A\u6574\u4E2A\u6587\u4EF6\u5939\u5199\u597D\uFF0C\u4E0D\u8981\u53BB\u7FFB\u8F6F\u4EF6\u7684\u6570\u636E\u76EE\u5F55\u6216\u6E90\u7801\uFF1B\u63D0\u9192\uFF08schedule_create\uFF09\u548C\u5230\u70B9\u8BA9\u67D0\u4E2A agent \u505A\u4E00\u4EF6\u4E8B\u7684\u5B9A\u65F6\u4EFB\u52A1\uFF08schedule_task_save\uFF09\u4F60\u81EA\u5DF1\u8BBE\uFF1B\u67E5\u811A\u672C\u3001\u8FD0\u884C\u8BB0\u5F55\u548C\u65E5\u5FD7\u3001\u6E38\u620F\u6D3B\u52A8\u3001\u6D41\u6C34\u7EBF\u72B6\u6001\u8FD9\u4E9B\u770B\u4E00\u773C\u7684\u4E8B\uFF0C\u7528\u4F60\u81EA\u5DF1\u7684\u5DE5\u5177\u3002",
|
|
@@ -10736,6 +10745,28 @@ ${APP_FILES_RULE}` : () => duty;
|
|
|
10736
10745
|
}
|
|
10737
10746
|
}
|
|
10738
10747
|
/** One model call outside any conversation, for its text (dsh's llm service). */
|
|
10748
|
+
/**
|
|
10749
|
+
* Something an agent writes for the user in one model call, outside any
|
|
10750
|
+
* conversation (the daily report): who it is, what it remembers, its reply
|
|
10751
|
+
* style and its model, no tools. No session is made, so none is left
|
|
10752
|
+
* behind and nothing is handed back to its own conversation to summarize again.
|
|
10753
|
+
* @throws Error when the agent is unknown or no model is set.
|
|
10754
|
+
*/
|
|
10755
|
+
async writeAs(agentId, prompt, signal) {
|
|
10756
|
+
const spec = agentId === MAIN_AGENT.id ? MAIN_AGENT : this.roles.spec(agentId);
|
|
10757
|
+
if (spec === void 0)
|
|
10758
|
+
throw new Error(`\u6CA1\u6709\u8FD9\u4E2A agent\uFF1A${agentId}`);
|
|
10759
|
+
const selection = this.agentModel(agentId) ?? this.ctx.get("agentDefaultModel")?.currentSelection();
|
|
10760
|
+
if (selection === void 0)
|
|
10761
|
+
throw new Error("\u8FD8\u6CA1\u6709\u8BBE\u7F6E\u6A21\u578B");
|
|
10762
|
+
const system = [
|
|
10763
|
+
`\u4F60\u662F MultiGameAssistant\uFF08\u591A\u6E38\u620F\u52A9\u624B\uFF09\u7684\u300C${spec.name}\u300Dagent\u3002\u8FD9\u4E00\u6B21\u53EA\u5199\u4E00\u6BB5\u7ED9\u7528\u6237\u770B\u7684\u6587\u5B57\uFF1A\u4E0D\u8C03\u7528\u5DE5\u5177\uFF0C\u4E0D\u63D0\u95EE\uFF0C\u76F4\u63A5\u7ED9\u51FA\u6B63\u6587\u3002`,
|
|
10764
|
+
spec === MAIN_AGENT ? "" : spec.duty ?? "",
|
|
10765
|
+
this.memoryViews?.current(agentId) ?? "",
|
|
10766
|
+
this.persona === void 0 ? "" : voicedPrompt(personaPrompt(this.persona.of(agentId)))
|
|
10767
|
+
].filter((part) => part !== "").join("\n\n");
|
|
10768
|
+
return (await this.completeOnce({ selection, system, prompt, signal })).trim();
|
|
10769
|
+
}
|
|
10739
10770
|
async completeOnce(request) {
|
|
10740
10771
|
const llm = this.ctx.get("llm");
|
|
10741
10772
|
if (llm === void 0)
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { createRequire as __adgCreateRequire } from 'node:module'; import { dirname as __adgDirname } from 'node:path'; import { fileURLToPath as __adgFileURLToPath } from 'node:url'; const require = __adgCreateRequire(import.meta.url); const __filename = __adgFileURLToPath(import.meta.url); const __dirname = __adgDirname(__filename);
|
|
2
2
|
import {
|
|
3
3
|
convertRecord
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OCJFAT7J.js";
|
|
5
5
|
import {
|
|
6
6
|
writeFileAtomic
|
|
7
7
|
} from "./chunk-RESS7WVY.js";
|
|
8
8
|
import {
|
|
9
9
|
BY_YOU,
|
|
10
10
|
DECISION_AREAS,
|
|
11
|
+
FORMER_AGENT_NAMES,
|
|
12
|
+
MAIN_AGENT_NAME,
|
|
11
13
|
NOTIFY_CAPABILITY,
|
|
12
14
|
briefText,
|
|
15
|
+
isAgentNamed,
|
|
13
16
|
isQuiet,
|
|
14
17
|
parseRelay,
|
|
15
18
|
parseTask,
|
|
@@ -22,7 +25,7 @@ import {
|
|
|
22
25
|
threadMessage,
|
|
23
26
|
threadReminder,
|
|
24
27
|
threadsBetween
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-BB2T4JHF.js";
|
|
26
29
|
import {
|
|
27
30
|
external_exports
|
|
28
31
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -751,7 +754,7 @@ function joined(turns, unfinished) {
|
|
|
751
754
|
|
|
752
755
|
// packages/notify/lib/delegate.js
|
|
753
756
|
var MAX_OUT = 4;
|
|
754
|
-
var DELEGATOR =
|
|
757
|
+
var DELEGATOR = MAIN_AGENT_NAME;
|
|
755
758
|
var TIMEOUT_MS = 2 * 60 * 6e4;
|
|
756
759
|
var HANDED = (agent) => `\u5DF2\u4EA4\u7ED9\u300C${agent}\u300D\u3002\u5B83\u5728\u81EA\u5DF1\u7684\u5BF9\u8BDD\u91CC\u505A\uFF0C\u5B83\u505A\u7684\u8FC7\u7A0B\u4E2D\u8BF4\u7684\u8BDD\u548C\u6700\u540E\u7684\u7ED3\u8BBA\u90FD\u4F1A\u4F5C\u4E3A\u65B0\u6D88\u606F\u53D1\u5230\u8FD9\u4E2A\u5BF9\u8BDD\u91CC\u3002\u73B0\u5728\u7528\u4E00\u53E5\u8BDD\u8BF4\u4F60\u4EA4\u7ED9\u4E86\u8C01\u3001\u505A\u4EC0\u4E48\uFF0C\u7136\u540E\u7ED3\u675F\u8FD9\u4E00\u8F6E\uFF1A\u4E0D\u8981\u7B49\u5B83\uFF0C\u4E5F\u4E0D\u8981\u66FF\u5B83\u56DE\u7B54\u3002`;
|
|
757
760
|
var Args2 = external_exports.object({
|
|
@@ -785,7 +788,7 @@ function delegateTool(deps) {
|
|
|
785
788
|
parameters: {
|
|
786
789
|
type: "object",
|
|
787
790
|
properties: {
|
|
788
|
-
agent: { type: "string", description: "agent \u7684\u540D\u5B57\u6216 id\uFF0C\u4F8B\u5982\u300C\u6E38\u620F\u300D\u300C\u811A\u672C\u300D\u3002" },
|
|
791
|
+
agent: { type: "string", description: "agent \u7684\u540D\u5B57\u6216 id\uFF0C\u4F8B\u5982\u300C\u6E38\u620F\u52A9\u624B\u300D\u300C\u811A\u672C\u52A9\u624B\u300D\u3002" },
|
|
789
792
|
task: { type: "string", description: "\u76EE\u6807\uFF1A\u8981\u505A\u6210\u4EC0\u4E48\u6837\uFF0C\u52A0\u4E0A\u5DF2\u7ECF\u77E5\u9053\u7684\u60C5\u51B5\u3002\u4E0D\u5199\u6B65\u9AA4\u3002" },
|
|
790
793
|
limits: { type: "string", description: "\u8FB9\u754C\uFF1A\u54EA\u4E9B\u4E0D\u80FD\u52A8\u3001\u505A\u5230\u54EA\u4E00\u6B65\u4E3A\u6B62\uFF0C\u4F8B\u5982\u300C\u53EA\u67E5\u4E0D\u6539\u300D\u300C\u4E0D\u8981\u91CD\u8DD1\u300D\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
791
794
|
allow: { type: "array", items: { type: "string", enum: DECISION_AREAS.map((a) => a.id) }, description: "\u7528\u6237\u5DF2\u7ECF\u660E\u786E\u8981\u505A\u3001\u53EF\u4EE5\u8BA9\u5BF9\u65B9\u76F4\u63A5\u505A\u7684\u6539\u52A8\u7C7B\u522B\uFF08\u53EF\u9009\uFF1B\u4E0D\u5199\u5C31\u90FD\u4EA4\u56DE\u7ED9\u4F60\u51B3\u5B9A\uFF09\u3002" },
|
|
@@ -811,16 +814,18 @@ function delegateTool(deps) {
|
|
|
811
814
|
throw new Error("\u53EA\u80FD\u5728\u4F1A\u8BDD\u91CC\u4EA4\u51FA\u53BB");
|
|
812
815
|
const caller = deps.agentOf?.(parent);
|
|
813
816
|
const agents = deps.agents();
|
|
814
|
-
const agent = agents.find((a) => a
|
|
817
|
+
const agent = agents.find((a) => isAgentNamed(a, wanted));
|
|
815
818
|
if (agent === void 0)
|
|
816
819
|
throw new Error(`\u6CA1\u6709\u53EB\u300C${wanted}\u300D\u7684 agent\u3002\u53EF\u4EE5\u4EA4\u7ED9\uFF1A${agents.map((a) => a.name).join("\u3001") || "\uFF08\u6CA1\u6709\uFF09"}`);
|
|
817
820
|
const conversations = deps.conversations();
|
|
818
821
|
if (conversations === void 0)
|
|
819
822
|
throw new Error("agent \u670D\u52A1\u8FD8\u6CA1\u6709\u51C6\u5907\u597D");
|
|
823
|
+
if (agent.id === caller?.id || caller === void 0 && agent.name === DELEGATOR) {
|
|
824
|
+
throw new Error(`\u4E0D\u80FD\u4EA4\u7ED9\u81EA\u5DF1\uFF08\u4F60\u5C31\u662F\u300C${agent.name}\u300D\uFF09\uFF1A\u81EA\u5DF1\u8FD9\u5757\u7684\u4E8B\u81EA\u5DF1\u505A\uFF0C\u8981\u5206\u51FA\u53BB\u5E76\u884C\u505A\u5C31\u5F00\u5B50 agent\uFF08subagent\uFF09\uFF1Bagent_delegate \u53EA\u7528\u6765\u4EA4\u7ED9\u522B\u7684\u89D2\u8272`);
|
|
825
|
+
}
|
|
820
826
|
if ((out.get(parent) ?? 0) >= MAX_OUT)
|
|
821
827
|
throw new Error(`\u8FD9\u4E2A\u5BF9\u8BDD\u5DF2\u7ECF\u6709 ${MAX_OUT} \u4EF6\u4E8B\u5728\u522B\u7684 agent \u90A3\u91CC\uFF0C\u7B49\u5176\u4E2D\u4E00\u4EF6\u56DE\u6765\u518D\u4EA4`);
|
|
822
|
-
const
|
|
823
|
-
const refusal = self ? void 0 : conversations.handOffRefusal?.(parent, agent.id, caller?.id ?? "", agent.name);
|
|
828
|
+
const refusal = conversations.handOffRefusal?.(parent, agent.id, caller?.id ?? "", agent.name);
|
|
824
829
|
if (refusal !== void 0)
|
|
825
830
|
throw new Error(refusal);
|
|
826
831
|
out.set(parent, (out.get(parent) ?? 0) + 1);
|
|
@@ -836,7 +841,7 @@ function delegateTool(deps) {
|
|
|
836
841
|
...expecting ? { expecting } : {},
|
|
837
842
|
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
838
843
|
from: { sessionId: parent, callId, asker: by, ...caller === void 0 ? {} : { agent: caller.id } },
|
|
839
|
-
relay:
|
|
844
|
+
relay: true,
|
|
840
845
|
...relayed === void 0 ? {} : { relayed }
|
|
841
846
|
}).catch(() => {
|
|
842
847
|
}).finally(() => settle(parent));
|
|
@@ -914,7 +919,8 @@ function threadsTool(deps) {
|
|
|
914
919
|
const all = deps.list();
|
|
915
920
|
if (parsed.data.id == null) {
|
|
916
921
|
const who = parsed.data.with;
|
|
917
|
-
const
|
|
922
|
+
const agentId = (x) => Object.keys(FORMER_AGENT_NAMES).find((id) => isAgentNamed({ id, name: deps.name(id) }, x)) ?? x;
|
|
923
|
+
const about = who == null ? all : all.filter((h) => agentId(h.by) === agentId(who) || agentId(h.to) === agentId(who));
|
|
918
924
|
return about.slice(-20).reverse().map(line).join("\n") || (who == null ? "\uFF08\u8FD8\u6CA1\u6709\u7EBF\u7D22\uFF09" : `\uFF08\u548C\u300C${who}\u300D\u8FD8\u6CA1\u6709\u7EBF\u7D22\uFF09`);
|
|
919
925
|
}
|
|
920
926
|
const found = all.find((h) => h.id === parsed.data.id);
|
|
@@ -990,17 +996,17 @@ var Notify = class {
|
|
|
990
996
|
notices() {
|
|
991
997
|
return this.#history.map(shown);
|
|
992
998
|
}
|
|
993
|
-
/** Notices of the last day
|
|
994
|
-
untold() {
|
|
999
|
+
/** Notices of the last day an agent (助手: `main`) has not been told about yet (the latest few), oldest first. */
|
|
1000
|
+
untold(agent = "main") {
|
|
995
1001
|
const since = this.#now() - REPLY_WINDOW_MS;
|
|
996
|
-
return this.#history.filter((n) => n.told !== true && n.at >= since).slice(-TELL_AT_MOST).map(shown);
|
|
1002
|
+
return this.#history.filter((n) => n.told !== true && n.at >= since && (n.agent ?? "main") === agent).slice(-TELL_AT_MOST).map(shown);
|
|
997
1003
|
}
|
|
998
|
-
/**
|
|
999
|
-
markTold(ids) {
|
|
1004
|
+
/** The agent has been told about these (and so no longer needs its older ones). */
|
|
1005
|
+
markTold(ids, agent = "main") {
|
|
1000
1006
|
const last = Math.max(-1, ...ids.map((id) => this.#history.findIndex((n) => n.id === id)));
|
|
1001
1007
|
if (last < 0)
|
|
1002
1008
|
return;
|
|
1003
|
-
this.#history = this.#history.map((n, i) => i <= last && n.told !== true ? { ...n, told: true } : n);
|
|
1009
|
+
this.#history = this.#history.map((n, i) => i <= last && n.told !== true && (n.agent ?? "main") === agent ? { ...n, told: true } : n);
|
|
1004
1010
|
this.#saveHistory();
|
|
1005
1011
|
}
|
|
1006
1012
|
#changeNotice(id, change) {
|
|
@@ -1052,7 +1058,8 @@ var Notify = class {
|
|
|
1052
1058
|
at: this.#now(),
|
|
1053
1059
|
actions: (notice.actions ?? []).map((a) => ({ id: a.id, label: a.label, ...a.style === void 0 ? {} : { style: a.style } })),
|
|
1054
1060
|
channels: reached,
|
|
1055
|
-
...notice.image === void 0 ? {} : { image: true }
|
|
1061
|
+
...notice.image === void 0 ? {} : { image: true },
|
|
1062
|
+
...notice.agent === void 0 ? {} : { agent: notice.agent }
|
|
1056
1063
|
};
|
|
1057
1064
|
this.#history = [...this.#history.filter((n) => n.id !== notice.id), item].slice(-KEEP_HISTORY);
|
|
1058
1065
|
this.#saveHistory();
|
|
@@ -1095,7 +1102,7 @@ var Notify = class {
|
|
|
1095
1102
|
/** Who picked an action, for people: 你(软件), 你(QQ), 助手. */
|
|
1096
1103
|
#actorName(actor) {
|
|
1097
1104
|
if (actor.channel === "agent")
|
|
1098
|
-
return actor.name ??
|
|
1105
|
+
return actor.name ?? MAIN_AGENT_NAME;
|
|
1099
1106
|
if (actor.channel === "app")
|
|
1100
1107
|
return "\u4F60\uFF08\u8F6F\u4EF6\uFF09";
|
|
1101
1108
|
return `${actor.name ?? "\u4F60"}\uFF08${this.channelName(actor.channel)}\uFF09`;
|
|
@@ -1380,7 +1387,7 @@ function approvalText(request) {
|
|
|
1380
1387
|
function questionText(request) {
|
|
1381
1388
|
const first = request.questions[0];
|
|
1382
1389
|
const more = request.questions.length > 1 ? `\uFF08\u5171 ${request.questions.length} \u4E2A\u95EE\u9898\uFF0C\u7B54\u5B8C\u4E00\u4E2A\u53D1\u4E0B\u4E00\u4E2A\uFF09` : "";
|
|
1383
|
-
return [
|
|
1390
|
+
return [`\u3010${MAIN_AGENT_NAME} \u95EE\u4F60\u3011` + more, first === void 0 ? "" : describeQuestion(first), "\u56DE\u590D\u9009\u9879\u7684\u6570\u5B57\u6216\u6587\u5B57\uFF0C\u6216\u76F4\u63A5\u5199\u4F60\u7684\u56DE\u7B54\u3002"].join("\n");
|
|
1384
1391
|
}
|
|
1385
1392
|
function describeQuestion(item) {
|
|
1386
1393
|
const options = item.options ?? [];
|
|
@@ -1388,7 +1395,7 @@ function describeQuestion(item) {
|
|
|
1388
1395
|
}
|
|
1389
1396
|
|
|
1390
1397
|
// packages/notify/lib/mirror.js
|
|
1391
|
-
var MAIN_NAME =
|
|
1398
|
+
var MAIN_NAME = MAIN_AGENT_NAME;
|
|
1392
1399
|
var KEEP_SEEN = 200;
|
|
1393
1400
|
var HomeMirror = class {
|
|
1394
1401
|
#deps;
|
|
@@ -1579,21 +1586,24 @@ var AdgNotify = class extends Service {
|
|
|
1579
1586
|
resolved: (id, outcome) => notify.approvalResolved(id, outcome)
|
|
1580
1587
|
});
|
|
1581
1588
|
const agentOf = (sessionId) => scoped.adgGateway.agentOfSession(sessionId);
|
|
1582
|
-
const agentName = (id) => id === MAIN ?
|
|
1583
|
-
scoped.adgGateway.agentPart("adg-notify agent_delegate", (agent) => agent.tools.register(delegateTool({ agents: () => [{ id: MAIN, name:
|
|
1589
|
+
const agentName = (id) => id === MAIN ? MAIN_AGENT_NAME : scoped.adgGateway.roles.list().find((r) => r.id === id)?.name ?? id;
|
|
1590
|
+
scoped.adgGateway.agentPart("adg-notify agent_delegate", (agent) => agent.tools.register(delegateTool({ agents: () => [{ id: MAIN, name: MAIN_AGENT_NAME }, ...scoped.adgGateway.roles.list()], conversations, agentOf })));
|
|
1584
1591
|
scoped.adgGateway.agentPart("adg-notify agent_message", (agent) => agent.tools.register(messageTool({ desk: () => conversations()?.desk, agentOf })));
|
|
1585
1592
|
scoped.adgGateway.agentPart("adg-notify agent_threads", (agent) => agent.tools.register(threadsTool({ list: () => scoped.adgGateway.handOffs.all(), name: agentName })));
|
|
1586
|
-
scoped.adgGateway.agentPart("adg-notify notice_act", (agent) => agent.tools.register(noticeActTool(notify, gateway.roles.list().find((r) => r.id === MAIN)?.name ??
|
|
1593
|
+
scoped.adgGateway.agentPart("adg-notify notice_act", (agent) => agent.tools.register(noticeActTool(notify, gateway.roles.list().find((r) => r.id === MAIN)?.name ?? MAIN_AGENT_NAME)));
|
|
1587
1594
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1588
1595
|
scoped.adgGateway.agentPart("adg-notify notices note", (agent) => agent.on("agent/pre-step", (async (payload, next) => {
|
|
1589
1596
|
const decision = await next();
|
|
1590
1597
|
if (decision.kind !== "enter" || payload.step !== 1 || payload.signal.aborted)
|
|
1591
1598
|
return decision;
|
|
1592
1599
|
try {
|
|
1593
|
-
const
|
|
1594
|
-
if (
|
|
1600
|
+
const home = gateway.homes.agentOf(payload.agent.session.id);
|
|
1601
|
+
if (home === void 0)
|
|
1602
|
+
return decision;
|
|
1603
|
+
const items = notify.untold(home);
|
|
1604
|
+
if (items.length === 0)
|
|
1595
1605
|
return decision;
|
|
1596
|
-
notify.markTold(items.map((n) => n.id));
|
|
1606
|
+
notify.markTold(items.map((n) => n.id), home);
|
|
1597
1607
|
return { ...decision, messages: [...decision.messages, noticesMessage(noticesNote(items, timeZone))] };
|
|
1598
1608
|
} catch (error) {
|
|
1599
1609
|
log.warn(`notices note for ${payload.agent.session.id}: ${error instanceof Error ? error.message : String(error)}`);
|
package/lib/emulator.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
EMULATORS_CAPABILITY,
|
|
11
11
|
EmulatorSettings
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BB2T4JHF.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports
|
|
15
15
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -999,6 +999,7 @@ var AdgEmulators = class extends Service {
|
|
|
999
999
|
async prepare(options) {
|
|
1000
1000
|
await this.ready;
|
|
1001
1001
|
if (this.settings.manualAddress !== void 0 && options.index === void 0) {
|
|
1002
|
+
await this.connectQuietly(this.settings.manualAddress, options.onStatus);
|
|
1002
1003
|
return { address: this.settings.manualAddress, label: "\u624B\u52A8\u914D\u7F6E\u7684 ADB \u5730\u5740", managed: false };
|
|
1003
1004
|
}
|
|
1004
1005
|
const mumu = await this.manager();
|
|
@@ -1010,7 +1011,17 @@ var AdgEmulators = class extends Service {
|
|
|
1010
1011
|
throw new Error(`MuMu \u5B9E\u4F8B ${index} \u6CA1\u6709\u8FD0\u884C\uFF0C\u4E14\u5DF2\u5173\u95ED\u300C\u4EFB\u52A1\u9700\u8981\u65F6\u81EA\u52A8\u542F\u52A8\u300D`);
|
|
1011
1012
|
}
|
|
1012
1013
|
const ready = await mumu.ensureReady(index, { timeoutMs: this.settings.bootTimeoutSeconds * 1e3, signal: options.signal, onStatus: options.onStatus });
|
|
1013
|
-
|
|
1014
|
+
const address = await mumu.adbAddress(index);
|
|
1015
|
+
await this.connectQuietly(address, options.onStatus);
|
|
1016
|
+
return { address, label: `MuMu ${ready.index}\uFF08${ready.name}\uFF09`, managed: true };
|
|
1017
|
+
}
|
|
1018
|
+
/** `connect`, saying so instead of failing: the script may still connect by itself. */
|
|
1019
|
+
async connectQuietly(address, onStatus) {
|
|
1020
|
+
try {
|
|
1021
|
+
await this.connect(await this.adb(), address);
|
|
1022
|
+
} catch (error) {
|
|
1023
|
+
onStatus(`\u672C\u5E94\u7528\u7684 adb \u6CA1\u6709\u8FDE\u4E0A ${address}\uFF08${error instanceof Error ? error.message : String(error)}\uFF09\uFF0C\u811A\u672C\u53EF\u80FD\u4F1A\u81EA\u5DF1\u8FDE\u63A5`);
|
|
1024
|
+
}
|
|
1014
1025
|
}
|
|
1015
1026
|
/** The address `prepare` would return, without starting anything (the runner locks it first). */
|
|
1016
1027
|
async expectedAddress() {
|
|
@@ -1072,10 +1083,15 @@ var AdgEmulators = class extends Service {
|
|
|
1072
1083
|
*/
|
|
1073
1084
|
async launchApp(address, pkg) {
|
|
1074
1085
|
await this.ready;
|
|
1075
|
-
const
|
|
1086
|
+
const adb = await this.adb();
|
|
1087
|
+
await this.connect(adb, address);
|
|
1088
|
+
const result = await this.exec(adb, ["-s", address, "shell", "monkey", "-p", pkg, "-c", "android.intent.category.LAUNCHER", "1"], { timeoutMs: 3e4 });
|
|
1076
1089
|
if (result === void 0)
|
|
1077
1090
|
throw new Error("\u627E\u4E0D\u5230 adb\uFF0C\u65E0\u6CD5\u542F\u52A8\u6E38\u620F");
|
|
1078
1091
|
const output = `${result.stdout}${result.stderr}`;
|
|
1092
|
+
const last = output.trim().split("\n").pop() ?? "";
|
|
1093
|
+
if (/device .*not found|device offline|no devices|unauthorized/i.test(output))
|
|
1094
|
+
throw new Error(`\u542F\u52A8 ${pkg} \u5931\u8D25\uFF1A\u8FDE\u4E0D\u4E0A\u6A21\u62DF\u5668 ${address}\uFF08${last}\uFF09`);
|
|
1079
1095
|
if (/No activities found|monkey aborted|not found/i.test(output) || !/Events injected/i.test(output)) {
|
|
1080
1096
|
throw new Error(`\u542F\u52A8 ${pkg} \u5931\u8D25\uFF1A\u6A21\u62DF\u5668\u91CC\u53EF\u80FD\u6CA1\u6709\u88C5\u8FD9\u4E2A\u6E38\u620F\uFF08${output.trim().split("\n").pop() ?? ""}\uFF09`);
|
|
1081
1097
|
}
|
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-SMXJWLAZ.js";
|
|
6
6
|
import {
|
|
7
7
|
require_extension,
|
|
8
8
|
require_permessage_deflate,
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
require_subprotocol,
|
|
13
13
|
require_websocket,
|
|
14
14
|
require_websocket_server
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-OCJFAT7J.js";
|
|
16
|
+
import "./chunk-4NR36PKL.js";
|
|
17
17
|
import {
|
|
18
18
|
writeFileAtomic
|
|
19
19
|
} from "./chunk-RESS7WVY.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
FEISHU_SECRET_REF,
|
|
23
23
|
FeishuPending,
|
|
24
24
|
FeishuSettings
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-BB2T4JHF.js";
|
|
26
26
|
import {
|
|
27
27
|
external_exports
|
|
28
28
|
} from "./chunk-6DSSLS7I.js";
|