dsh-multigameassistant 2.0.2 → 2.0.4
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 +7 -2
- package/lib/analyzer.js +2 -2
- package/lib/{chunk-I5AFAEXG.js → chunk-4PNYIZVU.js} +5 -2
- package/lib/{chunk-OPV336S5.js → chunk-IZENRXQ6.js} +1205 -174
- package/lib/{chunk-QAP7IYBS.js → chunk-SA72K6M2.js} +294 -155
- package/lib/{chunk-ZR74PFWR.js → chunk-UOVFYP7C.js} +5 -3
- package/lib/{chunk-NWM5ZN7E.js → chunk-XHP3SLMO.js} +1 -1
- package/lib/emulator.js +1 -1
- package/lib/feishu.js +3 -3
- package/lib/game-intel.js +5 -5
- package/lib/gateway.js +2 -2
- package/lib/guard.js +1 -1
- package/lib/intervene.js +3 -3
- package/lib/low-context.js +100 -0
- 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 +73 -15
- package/package.json +2 -1
- package/web/assets/index-BqeCz6LB.css +1 -0
- package/web/assets/index-CCaVm9ks.js +242 -0
- package/web/assets/index-CCaVm9ks.js.map +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-9SCfW_a1.js +0 -241
- package/web/assets/index-9SCfW_a1.js.map +0 -1
- package/web/assets/index-BodAAefM.css +0 -1
|
@@ -14779,6 +14779,7 @@ var ScriptJob = external_exports.object({
|
|
|
14779
14779
|
startedAt: external_exports.number(),
|
|
14780
14780
|
endedAt: external_exports.number().optional()
|
|
14781
14781
|
});
|
|
14782
|
+
var ScriptUpdatePolicy = external_exports.enum(["auto", "ask", "off"]);
|
|
14782
14783
|
var InstallSettings = external_exports.object({
|
|
14783
14784
|
/** GitHub REST API base. */
|
|
14784
14785
|
apiBase: external_exports.url({ protocol: /^https?$/ }),
|
|
@@ -14796,7 +14797,9 @@ var InstallSettings = external_exports.object({
|
|
|
14796
14797
|
/** Offer pre-releases when no stable release exists. */
|
|
14797
14798
|
includePrereleases: external_exports.boolean(),
|
|
14798
14799
|
/** Credential holding the user's Mirror酱 CDK: scripts published there update from it (incremental when possible). */
|
|
14799
|
-
cdkRef: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/)
|
|
14800
|
+
cdkRef: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),
|
|
14801
|
+
/** What happens when a script has a newer version. */
|
|
14802
|
+
autoUpdate: ScriptUpdatePolicy
|
|
14800
14803
|
});
|
|
14801
14804
|
var Empty = external_exports.object({});
|
|
14802
14805
|
var ById = external_exports.object({ id: ScriptId });
|
|
@@ -16342,6 +16345,142 @@ var SkillsNotifications = {
|
|
|
16342
16345
|
"skills/changed": external_exports.object({})
|
|
16343
16346
|
};
|
|
16344
16347
|
|
|
16348
|
+
// packages/protocol/lib/handoff-notes.js
|
|
16349
|
+
var BY_YOU = "\u4F60";
|
|
16350
|
+
var QUIET = "\uFF08\u4E0D\u7528\u544A\u8BC9\u7528\u6237\uFF09";
|
|
16351
|
+
var wordsOf = (text) => text.replace(/[^\p{Script=Han}a-zA-Z0-9]/gu, "");
|
|
16352
|
+
function isQuiet(text) {
|
|
16353
|
+
return wordsOf(text) === wordsOf(QUIET);
|
|
16354
|
+
}
|
|
16355
|
+
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";
|
|
16356
|
+
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";
|
|
16357
|
+
var THREAD_LINE = /^(这件事的线索是 (\S+):做的过程中要问清楚什么,用 agent_message 问,thread 填它;不要猜。)$/;
|
|
16358
|
+
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`;
|
|
16359
|
+
var PAST_LINE = /^(你和.{1,20}之前的来往,/;
|
|
16360
|
+
var PAST_END = "\uFF09";
|
|
16361
|
+
function taskMessage(by, title, body, returns = false, thread, past) {
|
|
16362
|
+
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`;
|
|
16363
|
+
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`]];
|
|
16364
|
+
if (past !== void 0 && past.lines.length > 0)
|
|
16365
|
+
notes.push([PAST_HEAD(past.who), ...past.lines, PAST_END].join("\n"));
|
|
16366
|
+
return `${head}
|
|
16367
|
+
${notes.map((n) => `${n}
|
|
16368
|
+
`).join("")}
|
|
16369
|
+
${body}`;
|
|
16370
|
+
}
|
|
16371
|
+
function parseTask(text) {
|
|
16372
|
+
const [first = "", ...rest] = text.split("\n");
|
|
16373
|
+
const mine = /^(你在软件里点的:(.*))$/.exec(first);
|
|
16374
|
+
const theirs = mine === null ? /^(([^():]{1,20})交给你的事:(.*))$/.exec(first) : null;
|
|
16375
|
+
if (mine === null && theirs === null)
|
|
16376
|
+
return void 0;
|
|
16377
|
+
const returns = rest[0] === RETURNS || rest[0] === RETURNS_BEFORE;
|
|
16378
|
+
const after = returns ? rest.slice(1) : rest;
|
|
16379
|
+
const thread = THREAD_LINE.exec(after[0] ?? "")?.[1];
|
|
16380
|
+
const next = thread === void 0 ? after : after.slice(1);
|
|
16381
|
+
const pastEnd = PAST_LINE.test(next[0] ?? "") ? next.indexOf(PAST_END) : -1;
|
|
16382
|
+
return {
|
|
16383
|
+
by: mine !== null ? BY_YOU : theirs[1],
|
|
16384
|
+
title: mine !== null ? mine[1] : theirs[2],
|
|
16385
|
+
returns,
|
|
16386
|
+
...thread === void 0 ? {} : { thread },
|
|
16387
|
+
body: next.slice(pastEnd + 1).join("\n").trim()
|
|
16388
|
+
};
|
|
16389
|
+
}
|
|
16390
|
+
var THREAD_WORDS = { question: "\u95EE\u4F60", answer: "\u56DE\u7B54\u4E86\u4F60", update: "\u544A\u8BC9\u4F60" };
|
|
16391
|
+
function threadTail(kind, thread, reader, closed) {
|
|
16392
|
+
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`;
|
|
16393
|
+
if (closed) {
|
|
16394
|
+
if (kind === "question")
|
|
16395
|
+
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`;
|
|
16396
|
+
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";
|
|
16397
|
+
}
|
|
16398
|
+
if (kind === "question")
|
|
16399
|
+
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`;
|
|
16400
|
+
if (kind === "answer" || reader === "worker")
|
|
16401
|
+
return "\uFF08\u63A5\u7740\u505A\u8FD9\u4EF6\u4E8B\u3002\uFF09";
|
|
16402
|
+
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";
|
|
16403
|
+
}
|
|
16404
|
+
function threadMessage(input) {
|
|
16405
|
+
const head = `\uFF08\u300C${input.from}\u300D\u5728\u7EBF\u7D22 ${input.thread} \u91CC${THREAD_WORDS[input.kind]}\uFF1A${oneLine(input.title)}\uFF09`;
|
|
16406
|
+
return `${head}
|
|
16407
|
+
|
|
16408
|
+
${input.text.trim()}
|
|
16409
|
+
|
|
16410
|
+
${threadTail(input.kind, input.thread, input.reader ?? "worker", input.closed === true)}`;
|
|
16411
|
+
}
|
|
16412
|
+
function parseThreadNote(text) {
|
|
16413
|
+
const [first = "", ...rest] = text.split("\n");
|
|
16414
|
+
const head = /^(「([^」]+)」在线索 (\S+) 里(问你|回答了你|告诉你):(.*))$/.exec(first);
|
|
16415
|
+
if (head === null)
|
|
16416
|
+
return void 0;
|
|
16417
|
+
const body = rest.join("\n").trim();
|
|
16418
|
+
const end = body.lastIndexOf("\n\n\uFF08");
|
|
16419
|
+
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() };
|
|
16420
|
+
}
|
|
16421
|
+
function relayMessage(input) {
|
|
16422
|
+
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`;
|
|
16423
|
+
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`;
|
|
16424
|
+
const asked = input.consulted !== void 0 && input.consulted.length > 0 ? `
|
|
16425
|
+
|
|
16426
|
+
\uFF08\u505A\u8FD9\u4EF6\u4E8B\u65F6\u5B83\u8FD8\u95EE\u4E86\uFF1A${input.consulted.join("\u3001")}\u3002\uFF09` : "";
|
|
16427
|
+
return `${head}
|
|
16428
|
+
|
|
16429
|
+
${input.reply.trim()}${asked}
|
|
16430
|
+
|
|
16431
|
+
${tail}`;
|
|
16432
|
+
}
|
|
16433
|
+
function threadsBetween(all, a, b) {
|
|
16434
|
+
return all.filter((h) => {
|
|
16435
|
+
const from = h.chain?.at(-2);
|
|
16436
|
+
const to = h.chain?.at(-1);
|
|
16437
|
+
return from === a && to === b || from === b && to === a;
|
|
16438
|
+
});
|
|
16439
|
+
}
|
|
16440
|
+
function parseRelay(text) {
|
|
16441
|
+
const [first = "", ...rest] = text.split("\n");
|
|
16442
|
+
const head = /^(「([^」]+)」(交回了|没有做完)([^()]{1,20}?)交给它的事:(.*))$/.exec(first);
|
|
16443
|
+
if (head === null)
|
|
16444
|
+
return void 0;
|
|
16445
|
+
const body = rest.join("\n").trim();
|
|
16446
|
+
const end = body.lastIndexOf("\n\n\uFF08");
|
|
16447
|
+
return { agent: head[1], ok: head[2] === "\u4EA4\u56DE\u4E86", asker: head[3], title: head[4], reply: (end === -1 ? body : body.slice(0, end)).trim() };
|
|
16448
|
+
}
|
|
16449
|
+
function oneLine(text) {
|
|
16450
|
+
return text.replace(/\s+/g, " ").replace(/[()]/g, (m) => m === "\uFF08" ? "(" : ")").trim();
|
|
16451
|
+
}
|
|
16452
|
+
var REMINDER_NOTE = /\n\n(这是你在线索 \S+ 上定的提醒:[^)]*)$/;
|
|
16453
|
+
function threadReminder(prompt, thread, by) {
|
|
16454
|
+
return `${prompt}
|
|
16455
|
+
|
|
16456
|
+
\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`;
|
|
16457
|
+
}
|
|
16458
|
+
function reminderPrompts(text) {
|
|
16459
|
+
const single = /^\[SCHEDULE REMINDER\]\n[\s\S]*?^reminder_prompt_json: (.*)$/m.exec(text);
|
|
16460
|
+
if (single !== null)
|
|
16461
|
+
return [jsonString(single[1]).replace(REMINDER_NOTE, "")];
|
|
16462
|
+
const batch = /^\[SCHEDULE REMINDER BATCH\]\n[\s\S]*?^reminders_json: (.*)$/m.exec(text);
|
|
16463
|
+
if (batch === null)
|
|
16464
|
+
return void 0;
|
|
16465
|
+
try {
|
|
16466
|
+
const items = JSON.parse(batch[1]);
|
|
16467
|
+
return items.map((item) => String(item.reminder_prompt ?? "").replace(REMINDER_NOTE, "")).filter((p) => p !== "");
|
|
16468
|
+
} catch {
|
|
16469
|
+
return [];
|
|
16470
|
+
}
|
|
16471
|
+
}
|
|
16472
|
+
function reminderLine(prompts) {
|
|
16473
|
+
return prompts.length === 0 ? "\u5B9A\u65F6\u63D0\u9192" : `\u5B9A\u65F6\u63D0\u9192\uFF1A${prompts.map((p) => oneLine(p)).join("\uFF1B")}`;
|
|
16474
|
+
}
|
|
16475
|
+
function jsonString(json2) {
|
|
16476
|
+
try {
|
|
16477
|
+
const value = JSON.parse(json2);
|
|
16478
|
+
return typeof value === "string" ? value : json2;
|
|
16479
|
+
} catch {
|
|
16480
|
+
return json2;
|
|
16481
|
+
}
|
|
16482
|
+
}
|
|
16483
|
+
|
|
16345
16484
|
// packages/protocol/lib/persona.js
|
|
16346
16485
|
var PERSONA_CAPABILITY = "persona";
|
|
16347
16486
|
var PersonaStyle = external_exports.enum(["default", "concise", "patient", "lively", "buddy", "butler"]);
|
|
@@ -16368,6 +16507,34 @@ var PersonaAnswer = PersonaSettings.extend({
|
|
|
16368
16507
|
/** The same, as it is for each agent, by id. */
|
|
16369
16508
|
prompts: external_exports.record(external_exports.string(), external_exports.string())
|
|
16370
16509
|
});
|
|
16510
|
+
var STYLE_TEXT = {
|
|
16511
|
+
default: "",
|
|
16512
|
+
concise: "\u56DE\u7B54\u7B80\u77ED\u76F4\u63A5\uFF1A\u5148\u7ED9\u7ED3\u8BBA\uFF0C\u518D\u7ED9\u5FC5\u8981\u7684\u7EC6\u8282\uFF1B\u5C11\u5BD2\u6684\uFF0C\u4E0D\u7528\u8868\u60C5\u3002",
|
|
16513
|
+
patient: "\u8010\u5FC3\u3001\u8BB2\u6E05\u695A\uFF1A\u6BCF\u4E00\u6B65\u8BF4\u660E\u4E3A\u4EC0\u4E48\u8FD9\u4E48\u505A\uFF0C\u7528\u5BF9\u65B9\u542C\u5F97\u61C2\u7684\u8BDD\uFF0C\u50CF\u6559\u4E00\u4E2A\u521A\u63A5\u89E6\u7684\u4EBA\u3002",
|
|
16514
|
+
lively: "\u8BED\u6C14\u8F7B\u677E\u6D3B\u6CFC\uFF0C\u53EF\u4EE5\u7528\u4E00\u70B9\u8BED\u6C14\u8BCD\u548C\u8868\u60C5\uFF0C\u4F46\u4FE1\u606F\u8981\u51C6\u786E\u3001\u4E0D\u5570\u55E6\u3002",
|
|
16515
|
+
buddy: "\u50CF\u4E00\u8D77\u73A9\u6E38\u620F\u7684\u8001\u670B\u53CB\u90A3\u6837\u8BF4\u8BDD\uFF1A\u719F\u6089\u6E38\u620F\u91CC\u7684\u8BF4\u6CD5\uFF0C\u53EF\u4EE5\u9002\u5F53\u5410\u69FD\u548C\u9F13\u52B1\uFF0C\u4F46\u4E0D\u5938\u5F20\u3001\u4E0D\u6CB9\u817B\u3002",
|
|
16516
|
+
butler: "\u50CF\u4E00\u4F4D\u7A33\u91CD\u5468\u5230\u7684\u7BA1\u5BB6\uFF1A\u793C\u8C8C\u3001\u6761\u7406\u6E05\u695A\uFF0C\u4E3B\u52A8\u6C47\u62A5\u8FDB\u5EA6\u548C\u9700\u8981\u5BF9\u65B9\u51B3\u5B9A\u7684\u4E8B\u3002"
|
|
16517
|
+
};
|
|
16518
|
+
function personaOf(settings, agentId) {
|
|
16519
|
+
const own = Object.entries(settings.agents[agentId] ?? {}).filter(([, value]) => value !== void 0);
|
|
16520
|
+
return { ...settings.persona, ...Object.fromEntries(own) };
|
|
16521
|
+
}
|
|
16522
|
+
function personaPrompt(p) {
|
|
16523
|
+
const lines = [];
|
|
16524
|
+
if (p.name !== void 0 && p.name.trim() !== "")
|
|
16525
|
+
lines.push(`\u4F60\u7684\u540D\u5B57\u662F\u300C${p.name.trim()}\u300D\uFF0C\u81EA\u79F0\u65F6\u7528\u8FD9\u4E2A\u540D\u5B57\u3002`);
|
|
16526
|
+
if (p.callUser !== void 0 && p.callUser.trim() !== "")
|
|
16527
|
+
lines.push(`\u79F0\u547C\u7528\u6237\u4E3A\u300C${p.callUser.trim()}\u300D\u3002`);
|
|
16528
|
+
if (STYLE_TEXT[p.style] !== "")
|
|
16529
|
+
lines.push(STYLE_TEXT[p.style]);
|
|
16530
|
+
if (p.custom !== void 0 && p.custom.trim() !== "")
|
|
16531
|
+
lines.push(`\u7528\u6237\u5BF9\u4F60\u8BF4\u8BDD\u65B9\u5F0F\u7684\u8981\u6C42\uFF1A${p.custom.trim()}`);
|
|
16532
|
+
if (lines.length === 0)
|
|
16533
|
+
return "";
|
|
16534
|
+
lines.push(p.peerStyle === "same" ? "\u548C\u5176\u4ED6 agent \u8BF4\u8BDD\u65F6\u4E5F\u7528\u8FD9\u4E2A\u65B9\u5F0F\u3002" : "\u4E0A\u9762\u662F\u5BF9\u7528\u6237\u8BF4\u8BDD\u7684\u65B9\u5F0F\u3002\u548C\u5176\u4ED6 agent \u8BF4\u8BDD\uFF08agent_delegate\u3001agent_message\u3001\u4EA4\u56DE\u53BB\u7684\u7ED3\u8BBA\uFF09\u7528\u5E73\u5B9E\u7684\u8BDD\uFF0C\u76F4\u63A5\u8BF4\u4E8B\uFF0C\u4E0D\u7528\u4EBA\u8BBE\u548C\u79F0\u547C\uFF1A\u5B83\u4EEC\u8981\u8BFB\u7684\u662F\u5185\u5BB9\u3002");
|
|
16535
|
+
lines.push(`\u8F6F\u4EF6\u7EA6\u5B9A\u7684\u56FA\u5B9A\u5199\u6CD5\uFF08\u6BD4\u5982\u300C${QUIET}\u300D\u8FD9\u4E00\u53E5\u3001\u7EBF\u7D22\u7F16\u53F7\u3001\u5DE5\u5177\u7684\u53C2\u6570\uFF09\u4E00\u5B57\u4E0D\u5DEE\u7167\u5199\uFF0C\u4E0D\u52A0\u8BED\u6C14\u8BCD\u548C\u8868\u60C5\u3002`);
|
|
16536
|
+
return ["# \u56DE\u590D\u98CE\u683C", ...lines, "\u8FD9\u4E9B\u53EA\u5F71\u54CD\u4F60\u8BF4\u8BDD\u7684\u65B9\u5F0F\uFF0C\u4E0D\u6539\u53D8\u505A\u4E8B\u7684\u89C4\u5219\uFF1A\u786E\u8BA4\u3001\u5B89\u5168\u9650\u5236\u548C\u4E0D\u80FD\u505A\u7684\u4E8B\u90FD\u7167\u65E7\uFF1B\u5728\u98DE\u4E66\u91CC\u56DE\u590D\u4E5F\u4E00\u6837\u3002"].join("\n");
|
|
16537
|
+
}
|
|
16371
16538
|
var PersonaRequests = {
|
|
16372
16539
|
"persona/get": {
|
|
16373
16540
|
capability: PERSONA_CAPABILITY,
|
|
@@ -16384,13 +16551,16 @@ var PersonaRequests = {
|
|
|
16384
16551
|
// packages/protocol/lib/compaction.js
|
|
16385
16552
|
var COMPACTION_CAPABILITY = "compaction";
|
|
16386
16553
|
var DEFAULT_COMPACTION_THRESHOLD = 80;
|
|
16387
|
-
var MIN_COMPACTION_THRESHOLD =
|
|
16388
|
-
var MAX_COMPACTION_THRESHOLD =
|
|
16554
|
+
var MIN_COMPACTION_THRESHOLD = 5;
|
|
16555
|
+
var MAX_COMPACTION_THRESHOLD = 100;
|
|
16556
|
+
var LOW_CONTEXT_WINDOW_MS = 12 * 60 * 6e4;
|
|
16389
16557
|
var CompactionSettings = external_exports.object({
|
|
16390
16558
|
/** Compact by itself when the conversation is long; off: a too-long conversation fails until compacted by hand. */
|
|
16391
16559
|
auto: external_exports.boolean(),
|
|
16392
16560
|
/** How full the context window gets before compacting, in percent. */
|
|
16393
|
-
threshold: external_exports.number().int().min(MIN_COMPACTION_THRESHOLD).max(MAX_COMPACTION_THRESHOLD)
|
|
16561
|
+
threshold: external_exports.number().int().min(MIN_COMPACTION_THRESHOLD).max(MAX_COMPACTION_THRESHOLD),
|
|
16562
|
+
/** Low-context mode: keep only the last 12 hours and the summary in the context. */
|
|
16563
|
+
lowContext: external_exports.boolean()
|
|
16394
16564
|
});
|
|
16395
16565
|
var State = external_exports.object({ settings: CompactionSettings, applied: CompactionSettings });
|
|
16396
16566
|
var CompactionRequests = {
|
|
@@ -16406,6 +16576,68 @@ var CompactionRequests = {
|
|
|
16406
16576
|
}
|
|
16407
16577
|
};
|
|
16408
16578
|
|
|
16579
|
+
// packages/protocol/lib/memory.js
|
|
16580
|
+
var MEMORY_CAPABILITY = "memory";
|
|
16581
|
+
var SHARED_MEMORY = "shared";
|
|
16582
|
+
var MemoryKind = external_exports.enum(["profile", "journal"]);
|
|
16583
|
+
var MAX_MEMORY_TEXT = 600;
|
|
16584
|
+
var MemoryEntry = external_exports.object({
|
|
16585
|
+
id: external_exports.string(),
|
|
16586
|
+
kind: MemoryKind,
|
|
16587
|
+
/** `shared`, or the id of the agent whose own it is. */
|
|
16588
|
+
scope: external_exports.string(),
|
|
16589
|
+
text: external_exports.string(),
|
|
16590
|
+
/** ISO time it was written, and last changed. */
|
|
16591
|
+
createdAt: external_exports.string(),
|
|
16592
|
+
updatedAt: external_exports.string(),
|
|
16593
|
+
/** Who wrote it: an agent id, `user` (设置 → 记忆), or `auto` (read back from a conversation). */
|
|
16594
|
+
by: external_exports.string()
|
|
16595
|
+
});
|
|
16596
|
+
var MemoryAutoSettings = external_exports.object({
|
|
16597
|
+
auto: external_exports.boolean(),
|
|
16598
|
+
/** Same shape as ModelSelection (methods.ts), which imports this file. */
|
|
16599
|
+
model: external_exports.object({ provider: external_exports.string(), model: external_exports.string(), reasoningEffort: external_exports.string().optional() }).nullable()
|
|
16600
|
+
});
|
|
16601
|
+
var MemoryText = external_exports.string().trim().min(1).max(MAX_MEMORY_TEXT);
|
|
16602
|
+
var MemoryRequests = {
|
|
16603
|
+
"memory/list": {
|
|
16604
|
+
capability: MEMORY_CAPABILITY,
|
|
16605
|
+
params: external_exports.object({}),
|
|
16606
|
+
/** Newest first. */
|
|
16607
|
+
result: external_exports.object({ items: external_exports.array(MemoryEntry) })
|
|
16608
|
+
},
|
|
16609
|
+
"memory/add": {
|
|
16610
|
+
capability: MEMORY_CAPABILITY,
|
|
16611
|
+
params: external_exports.object({ kind: MemoryKind, scope: external_exports.string().min(1).max(64), text: MemoryText }),
|
|
16612
|
+
result: external_exports.object({ item: MemoryEntry })
|
|
16613
|
+
},
|
|
16614
|
+
"memory/update": {
|
|
16615
|
+
capability: MEMORY_CAPABILITY,
|
|
16616
|
+
params: external_exports.object({ id: external_exports.string(), text: MemoryText, kind: MemoryKind.optional(), scope: external_exports.string().min(1).max(64).optional() }),
|
|
16617
|
+
result: external_exports.object({ item: MemoryEntry })
|
|
16618
|
+
},
|
|
16619
|
+
"memory/auto/get": {
|
|
16620
|
+
capability: MEMORY_CAPABILITY,
|
|
16621
|
+
params: external_exports.object({}),
|
|
16622
|
+
/** `forced`: on whatever `auto` says, because low-context mode is on (compaction.ts). */
|
|
16623
|
+
result: MemoryAutoSettings.extend({ forced: external_exports.boolean().optional() })
|
|
16624
|
+
},
|
|
16625
|
+
"memory/auto/set": {
|
|
16626
|
+
capability: MEMORY_CAPABILITY,
|
|
16627
|
+
params: MemoryAutoSettings,
|
|
16628
|
+
result: MemoryAutoSettings
|
|
16629
|
+
},
|
|
16630
|
+
"memory/remove": {
|
|
16631
|
+
capability: MEMORY_CAPABILITY,
|
|
16632
|
+
params: external_exports.object({ id: external_exports.string() }),
|
|
16633
|
+
result: external_exports.object({ removed: external_exports.boolean() })
|
|
16634
|
+
}
|
|
16635
|
+
};
|
|
16636
|
+
var MemoryNotifications = {
|
|
16637
|
+
/** An entry was written, changed or forgotten; re-read `memory/list`. */
|
|
16638
|
+
"memory/changed": external_exports.object({})
|
|
16639
|
+
};
|
|
16640
|
+
|
|
16409
16641
|
// packages/protocol/lib/runs.js
|
|
16410
16642
|
var RUNS_CAPABILITY = "runs";
|
|
16411
16643
|
var RunState = external_exports.enum(["starting", "running", "stopping", "succeeded", "failed", "cancelled"]);
|
|
@@ -17138,6 +17370,16 @@ var PromptImage = external_exports.object({
|
|
|
17138
17370
|
data: external_exports.string().min(1).max(MAX_IMAGE_BASE64).regex(/^[A-Za-z0-9+/]+={0,2}$/, "base64 without a data: prefix"),
|
|
17139
17371
|
name: external_exports.string().max(200).optional()
|
|
17140
17372
|
});
|
|
17373
|
+
var ReleaseNote = external_exports.object({
|
|
17374
|
+
version: external_exports.string(),
|
|
17375
|
+
/** The release's own title, when it has one. */
|
|
17376
|
+
title: external_exports.string().optional(),
|
|
17377
|
+
publishedAt: external_exports.string().optional(),
|
|
17378
|
+
/** Its page on GitHub. */
|
|
17379
|
+
url: external_exports.string(),
|
|
17380
|
+
/** Markdown. */
|
|
17381
|
+
body: external_exports.string()
|
|
17382
|
+
});
|
|
17141
17383
|
var Empty2 = external_exports.object({});
|
|
17142
17384
|
var Accepted = external_exports.object({ accepted: external_exports.literal(true) });
|
|
17143
17385
|
var Requests = {
|
|
@@ -17374,6 +17616,30 @@ var Requests = {
|
|
|
17374
17616
|
params: external_exports.object({ ref: CredentialRef }),
|
|
17375
17617
|
result: Empty2
|
|
17376
17618
|
},
|
|
17619
|
+
/**
|
|
17620
|
+
* Which build serves this host, for 设置 → 关于: `plugin` is the dsh plugin package (dsh-multigameassistant),
|
|
17621
|
+
* with its version; anything else (the desktop app, a checkout) says so through its own means.
|
|
17622
|
+
*/
|
|
17623
|
+
"about/info": {
|
|
17624
|
+
capability: "about",
|
|
17625
|
+
params: Empty2,
|
|
17626
|
+
result: external_exports.object({ edition: external_exports.enum(["plugin", "other"]), version: external_exports.string().optional() })
|
|
17627
|
+
},
|
|
17628
|
+
/**
|
|
17629
|
+
* The plugin package's newest release on GitHub, if newer than this one (a pre-release only for a
|
|
17630
|
+
* pre-release). `onNpm`: npm already serves it under the plugin's name (a release is live there only
|
|
17631
|
+
* once approved); undefined when npm could not be asked. `notes`: what each release from this one up
|
|
17632
|
+
* to it brings (its GitHub Release text), newest first. Only the plugin package checks here.
|
|
17633
|
+
*/
|
|
17634
|
+
"about/checkUpdate": {
|
|
17635
|
+
capability: "about",
|
|
17636
|
+
params: Empty2,
|
|
17637
|
+
result: external_exports.object({
|
|
17638
|
+
current: external_exports.string(),
|
|
17639
|
+
latest: external_exports.object({ version: external_exports.string(), prerelease: external_exports.boolean(), notesUrl: external_exports.string(), onNpm: external_exports.boolean().optional(), notes: external_exports.array(ReleaseNote).optional() }).optional(),
|
|
17640
|
+
checkedAt: external_exports.number()
|
|
17641
|
+
})
|
|
17642
|
+
},
|
|
17377
17643
|
"providers/list": {
|
|
17378
17644
|
capability: "providers",
|
|
17379
17645
|
params: Empty2,
|
|
@@ -17451,7 +17717,8 @@ var Requests = {
|
|
|
17451
17717
|
...SkillsRequests,
|
|
17452
17718
|
...SkillHubRequests,
|
|
17453
17719
|
...PersonaRequests,
|
|
17454
|
-
...CompactionRequests
|
|
17720
|
+
...CompactionRequests,
|
|
17721
|
+
...MemoryRequests
|
|
17455
17722
|
};
|
|
17456
17723
|
var SessionsChanged = external_exports.discriminatedUnion("kind", [
|
|
17457
17724
|
external_exports.object({ kind: external_exports.literal("upsert"), item: SessionItem.partial().extend({ id: external_exports.string() }) }),
|
|
@@ -17507,7 +17774,8 @@ var Notifications = {
|
|
|
17507
17774
|
...GamesNotifications,
|
|
17508
17775
|
...PermissionsNotifications,
|
|
17509
17776
|
...QuestionsNotifications,
|
|
17510
|
-
...InstancesNotifications
|
|
17777
|
+
...InstancesNotifications,
|
|
17778
|
+
...MemoryNotifications
|
|
17511
17779
|
};
|
|
17512
17780
|
var ErrorCode = {
|
|
17513
17781
|
ParseError: -32700,
|
|
@@ -17548,142 +17816,6 @@ function classify(value) {
|
|
|
17548
17816
|
return "invalid";
|
|
17549
17817
|
}
|
|
17550
17818
|
|
|
17551
|
-
// packages/protocol/lib/handoff-notes.js
|
|
17552
|
-
var BY_YOU = "\u4F60";
|
|
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, "");
|
|
17555
|
-
function isQuiet(text) {
|
|
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) {
|
|
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"));
|
|
17569
|
-
return `${head}
|
|
17570
|
-
${notes.map((n) => `${n}
|
|
17571
|
-
`).join("")}
|
|
17572
|
-
${body}`;
|
|
17573
|
-
}
|
|
17574
|
-
function parseTask(text) {
|
|
17575
|
-
const [first = "", ...rest] = text.split("\n");
|
|
17576
|
-
const mine = /^(你在软件里点的:(.*))$/.exec(first);
|
|
17577
|
-
const theirs = mine === null ? /^(([^():]{1,20})交给你的事:(.*))$/.exec(first) : null;
|
|
17578
|
-
if (mine === null && theirs === null)
|
|
17579
|
-
return void 0;
|
|
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;
|
|
17585
|
-
return {
|
|
17586
|
-
by: mine !== null ? BY_YOU : theirs[1],
|
|
17587
|
-
title: mine !== null ? mine[1] : theirs[2],
|
|
17588
|
-
returns,
|
|
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() };
|
|
17623
|
-
}
|
|
17624
|
-
function relayMessage(input) {
|
|
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`;
|
|
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` : "";
|
|
17630
|
-
return `${head}
|
|
17631
|
-
|
|
17632
|
-
${input.reply.trim()}${asked}
|
|
17633
|
-
|
|
17634
|
-
${tail}`;
|
|
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
|
-
}
|
|
17643
|
-
function parseRelay(text) {
|
|
17644
|
-
const [first = "", ...rest] = text.split("\n");
|
|
17645
|
-
const head = /^(「([^」]+)」(交回了|没有做完)([^()]{1,20}?)交给它的事:(.*))$/.exec(first);
|
|
17646
|
-
if (head === null)
|
|
17647
|
-
return void 0;
|
|
17648
|
-
const body = rest.join("\n").trim();
|
|
17649
|
-
const end = body.lastIndexOf("\n\n\uFF08");
|
|
17650
|
-
return { agent: head[1], ok: head[2] === "\u4EA4\u56DE\u4E86", asker: head[3], title: head[4], reply: (end === -1 ? body : body.slice(0, end)).trim() };
|
|
17651
|
-
}
|
|
17652
|
-
function oneLine(text) {
|
|
17653
|
-
return text.replace(/\s+/g, " ").replace(/[()]/g, (m) => m === "\uFF08" ? "(" : ")").trim();
|
|
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
|
-
}
|
|
17661
|
-
function reminderPrompts(text) {
|
|
17662
|
-
const single = /^\[SCHEDULE REMINDER\]\n[\s\S]*?^reminder_prompt_json: (.*)$/m.exec(text);
|
|
17663
|
-
if (single !== null)
|
|
17664
|
-
return [jsonString(single[1]).replace(REMINDER_NOTE, "")];
|
|
17665
|
-
const batch = /^\[SCHEDULE REMINDER BATCH\]\n[\s\S]*?^reminders_json: (.*)$/m.exec(text);
|
|
17666
|
-
if (batch === null)
|
|
17667
|
-
return void 0;
|
|
17668
|
-
try {
|
|
17669
|
-
const items = JSON.parse(batch[1]);
|
|
17670
|
-
return items.map((item) => String(item.reminder_prompt ?? "").replace(REMINDER_NOTE, "")).filter((p) => p !== "");
|
|
17671
|
-
} catch {
|
|
17672
|
-
return [];
|
|
17673
|
-
}
|
|
17674
|
-
}
|
|
17675
|
-
function reminderLine(prompts) {
|
|
17676
|
-
return prompts.length === 0 ? "\u5B9A\u65F6\u63D0\u9192" : `\u5B9A\u65F6\u63D0\u9192\uFF1A${prompts.map((p) => oneLine(p)).join("\uFF1B")}`;
|
|
17677
|
-
}
|
|
17678
|
-
function jsonString(json2) {
|
|
17679
|
-
try {
|
|
17680
|
-
const value = JSON.parse(json2);
|
|
17681
|
-
return typeof value === "string" ? value : json2;
|
|
17682
|
-
} catch {
|
|
17683
|
-
return json2;
|
|
17684
|
-
}
|
|
17685
|
-
}
|
|
17686
|
-
|
|
17687
17819
|
// packages/protocol/lib/tools.js
|
|
17688
17820
|
function summarizeToolArgs(args) {
|
|
17689
17821
|
try {
|
|
@@ -17919,12 +18051,32 @@ export {
|
|
|
17919
18051
|
SKILL_NAME,
|
|
17920
18052
|
MAX_SKILL_NAME,
|
|
17921
18053
|
SKILLHUB_CAPABILITY,
|
|
18054
|
+
BY_YOU,
|
|
18055
|
+
isQuiet,
|
|
18056
|
+
taskMessage,
|
|
18057
|
+
parseTask,
|
|
18058
|
+
threadMessage,
|
|
18059
|
+
parseThreadNote,
|
|
18060
|
+
relayMessage,
|
|
18061
|
+
threadsBetween,
|
|
18062
|
+
parseRelay,
|
|
18063
|
+
threadReminder,
|
|
18064
|
+
reminderPrompts,
|
|
18065
|
+
reminderLine,
|
|
17922
18066
|
PERSONA_CAPABILITY,
|
|
17923
18067
|
Persona,
|
|
17924
18068
|
PersonaSettings,
|
|
18069
|
+
personaOf,
|
|
18070
|
+
personaPrompt,
|
|
17925
18071
|
COMPACTION_CAPABILITY,
|
|
17926
18072
|
DEFAULT_COMPACTION_THRESHOLD,
|
|
18073
|
+
LOW_CONTEXT_WINDOW_MS,
|
|
17927
18074
|
CompactionSettings,
|
|
18075
|
+
MEMORY_CAPABILITY,
|
|
18076
|
+
SHARED_MEMORY,
|
|
18077
|
+
MemoryKind,
|
|
18078
|
+
MAX_MEMORY_TEXT,
|
|
18079
|
+
MemoryEntry,
|
|
17928
18080
|
RUNS_CAPABILITY,
|
|
17929
18081
|
DEEPSEEK_API_KEY,
|
|
17930
18082
|
AGENTS_CAPABILITY,
|
|
@@ -17937,18 +18089,5 @@ export {
|
|
|
17937
18089
|
optimizeScriptPrompt,
|
|
17938
18090
|
expandSlash,
|
|
17939
18091
|
parseGitHubLink,
|
|
17940
|
-
BY_YOU,
|
|
17941
|
-
QUIET,
|
|
17942
|
-
isQuiet,
|
|
17943
|
-
taskMessage,
|
|
17944
|
-
parseTask,
|
|
17945
|
-
threadMessage,
|
|
17946
|
-
parseThreadNote,
|
|
17947
|
-
relayMessage,
|
|
17948
|
-
threadsBetween,
|
|
17949
|
-
parseRelay,
|
|
17950
|
-
threadReminder,
|
|
17951
|
-
reminderPrompts,
|
|
17952
|
-
reminderLine,
|
|
17953
18092
|
UPDATE_RULE
|
|
17954
18093
|
};
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
globToRegExp,
|
|
4
4
|
renderTask,
|
|
5
5
|
require_dist
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XHP3SLMO.js";
|
|
7
7
|
import {
|
|
8
8
|
RUNS_CAPABILITY,
|
|
9
9
|
ScriptId,
|
|
10
10
|
external_exports
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SA72K6M2.js";
|
|
12
12
|
import {
|
|
13
13
|
__toESM
|
|
14
14
|
} from "./chunk-2UFLGPDY.js";
|
|
@@ -1698,7 +1698,9 @@ var Runner = class {
|
|
|
1698
1698
|
this.#line(run, "adg", `\u5DF2\u66F4\u65B0\u5230 ${result.version}`);
|
|
1699
1699
|
else if (result.state === "current")
|
|
1700
1700
|
this.#line(run, "adg", "\u5DF2\u662F\u6700\u65B0\u7248\u672C");
|
|
1701
|
-
else if (result.state === "
|
|
1701
|
+
else if (result.state === "available") {
|
|
1702
|
+
this.#line(run, "adg", result.policy === "ask" ? `\u6709\u65B0\u7248\u672C ${result.version}\uFF1A\u8BBE\u7F6E\u4E3A\u5148\u95EE\u4F60\u518D\u66F4\u65B0\uFF0C\u8FD9\u6B21\u7528\u73B0\u6709\u7248\u672C\u8FD0\u884C` : `\u6709\u65B0\u7248\u672C ${result.version}\uFF1A\u8BBE\u7F6E\u4E3A\u4E0D\u81EA\u52A8\u66F4\u65B0\uFF0C\u8FD9\u6B21\u7528\u73B0\u6709\u7248\u672C\u8FD0\u884C`);
|
|
1703
|
+
} else if (result.state === "failed") {
|
|
1702
1704
|
const text = `\u66F4\u65B0\u5931\u8D25\uFF0C\u5148\u7528\u73B0\u6709\u7248\u672C${script.current === void 0 ? "" : ` ${script.current} `}\u8FD0\u884C\uFF1A${result.error}`;
|
|
1703
1705
|
run.info.warnings.push(text);
|
|
1704
1706
|
this.#line(run, "adg", text);
|
package/lib/emulator.js
CHANGED
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-4PNYIZVU.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-IZENRXQ6.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-SA72K6M2.js";
|
|
26
26
|
import {
|
|
27
27
|
__commonJS,
|
|
28
28
|
__require,
|
package/lib/game-intel.js
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
GAME_MANIFEST_FILE,
|
|
8
8
|
GameManifest,
|
|
9
9
|
parseGameManifest
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XHP3SLMO.js";
|
|
11
11
|
import {
|
|
12
12
|
sessionConversations
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-4PNYIZVU.js";
|
|
14
|
+
import "./chunk-IZENRXQ6.js";
|
|
15
15
|
import {
|
|
16
16
|
writeFileAtomic
|
|
17
17
|
} from "./chunk-CCAB6XXZ.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
SHOT_IMAGE,
|
|
25
25
|
external_exports,
|
|
26
26
|
taskMessage
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SA72K6M2.js";
|
|
28
28
|
import "./chunk-2UFLGPDY.js";
|
|
29
29
|
|
|
30
30
|
// packages/game-intel/lib/index.js
|
|
@@ -1622,7 +1622,7 @@ var GAME_ROLE = {
|
|
|
1622
1622
|
order: 20,
|
|
1623
1623
|
titles: ["\u6E38\u620F\u4FE1\u606F", "\u6E38\u620F\u8D44\u8BAF", "\u6DFB\u52A0\u6E38\u620F", "\u65E5\u62A5"],
|
|
1624
1624
|
// Games and their screens, and what scripts ran (for the daily report); no installing, runs or pipelines.
|
|
1625
|
-
tools: ["game_*", "screen_*", "window_*", "emulator_status", "emulator_start", "script_list", "script_runs", "system_info", "skill_focus", "skill_save"],
|
|
1625
|
+
tools: ["game_*", "screen_*", "window_*", "emulator_status", "emulator_start", "script_list", "script_tasks", "script_runs", "system_info", "skill_focus", "skill_save"],
|
|
1626
1626
|
duty: [
|
|
1627
1627
|
"# \u4F60\u7684\u89D2\u8272\uFF1A\u6E38\u620F",
|
|
1628
1628
|
"\u4F60\u662F MultiGameAssistant \u7684\u300C\u6E38\u620F\u300Dagent\uFF1A\u8BFB\u6E38\u620F\u7684\u6D3B\u52A8\u3001\u8D44\u8BAF\u548C\u8FDB\u5EA6\u5E76\u8BB0\u4E0B\u6765\uFF08game_record\uFF09\uFF0C\u5199\u65E5\u62A5\uFF0C\u6DFB\u52A0\u6E38\u620F\u3002",
|