dsh-multigameassistant 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cordis.patch.yml +5 -9
- package/lib/analyzer.js +9 -9
- package/lib/{chunk-7EFZ5KR6.js → chunk-34VNH3YS.js} +57 -4
- package/lib/{chunk-VG32XPZH.js → chunk-4QXRDWGS.js} +22 -7
- package/lib/{chunk-X5YYRNYA.js → chunk-76UHR2GO.js} +74 -14
- package/lib/{chunk-TXW3NMBH.js → chunk-C7X2KJ5C.js} +1 -1
- package/lib/{chunk-AJMAUHPI.js → chunk-KW36B7DT.js} +124 -12
- package/lib/{chunk-Y3ZZBBLV.js → chunk-M7GNYL5B.js} +1 -1
- package/lib/{chunk-VBWSM7LF.js → chunk-QSETYM2Y.js} +634 -112
- package/lib/emulator.js +1 -1
- package/lib/feishu.js +4 -4
- package/lib/game-intel.js +52 -11
- package/lib/gateway.js +3 -3
- package/lib/guard.js +2 -2
- package/lib/intervene.js +5 -4
- package/lib/low-context.js +2 -2
- package/lib/monitor.js +3 -3
- package/lib/notify.js +4 -4
- package/lib/orchestrator.js +9 -8
- package/lib/qqbot.js +4 -4
- 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/pipeline-planning.md +2 -2
- package/skills/script-analysis.md +4 -3
- package/web/assets/index-O-2OxnhJ.css +1 -0
- package/web/assets/index-cNJNBRun.js +257 -0
- package/web/assets/index-cNJNBRun.js.map +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-CNGPsX3a.css +0 -1
- package/web/assets/index-mX8hPa2E.js +0 -256
- package/web/assets/index-mX8hPa2E.js.map +0 -1
- /package/lib/{chunk-AJMAUHPI.js.LEGAL.txt → chunk-KW36B7DT.js.LEGAL.txt} +0 -0
package/cordis.patch.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# dsh-multigameassistant 2.3.
|
|
1
|
+
# dsh-multigameassistant 2.3.1
|
|
2
2
|
# dsh-multigameassistant: the app's plugins (packages/bundle/cordis.patch.yml, each @adg/<plugin> as dsh-multigameassistant/<plugin>)
|
|
3
3
|
# sharing the dsh with the person's other chats, and the app's agent preset (dsh's standard one with the app's
|
|
4
4
|
# tools and prompts, and compaction as 设置 → 对话压缩 says). No row of dsh is restated.
|
|
@@ -186,12 +186,9 @@
|
|
|
186
186
|
- id: skill-filesystem
|
|
187
187
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
188
188
|
config:
|
|
189
|
-
# The app's agents read
|
|
190
|
-
# (~/.agents/skills, ~/.dsh/skills, a working folder's .agents/skills or .dsh/skills)
|
|
189
|
+
# The app's agents read the app's own skills only: not the folders other agents on the machine share
|
|
190
|
+
# (~/.agents/skills, ~/.dsh/skills, a working folder's .agents/skills or .dsh/skills), nor dsh's own.
|
|
191
191
|
includeDefaultRoots: false
|
|
192
|
-
bundledSkillDir: !!js "process.env.DSH_BUNDLED_SKILL_DIR || undefined"
|
|
193
|
-
customSkillDirs:
|
|
194
|
-
- !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
|
|
195
192
|
- id: tool-skill
|
|
196
193
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
197
194
|
- id: command-goal
|
|
@@ -343,10 +340,9 @@
|
|
|
343
340
|
- id: skill-filesystem
|
|
344
341
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
345
342
|
config:
|
|
346
|
-
# The app's agents read
|
|
347
|
-
# (~/.agents/skills, ~/.dsh/skills, a working folder's .agents/skills or .dsh/skills)
|
|
343
|
+
# The app's agents read the app's own skills only: not the folders other agents on the machine share
|
|
344
|
+
# (~/.agents/skills, ~/.dsh/skills, a working folder's .agents/skills or .dsh/skills), nor dsh's own.
|
|
348
345
|
includeDefaultRoots: false
|
|
349
|
-
bundledSkillDir: !!js "process.env.DSH_BUNDLED_SKILL_DIR || undefined"
|
|
350
346
|
- id: tool-skill
|
|
351
347
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
352
348
|
- id: command-goal
|
package/lib/analyzer.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
discoverMcp,
|
|
4
4
|
discoverSkills,
|
|
5
5
|
mcpEndpoints
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KW36B7DT.js";
|
|
7
7
|
import {
|
|
8
8
|
probeProject
|
|
9
9
|
} from "./chunk-B4UT4NYH.js";
|
|
@@ -19,16 +19,16 @@ import {
|
|
|
19
19
|
require_dist,
|
|
20
20
|
strayKeys,
|
|
21
21
|
stripJsonc
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-C7X2KJ5C.js";
|
|
23
|
+
import "./chunk-4QXRDWGS.js";
|
|
24
|
+
import "./chunk-QSETYM2Y.js";
|
|
25
|
+
import "./chunk-M7GNYL5B.js";
|
|
26
26
|
import "./chunk-RESS7WVY.js";
|
|
27
27
|
import {
|
|
28
28
|
BUILTIN_PACK_VERSION,
|
|
29
29
|
PACKS_CAPABILITY,
|
|
30
30
|
ScriptId
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-34VNH3YS.js";
|
|
32
32
|
import {
|
|
33
33
|
external_exports
|
|
34
34
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -715,7 +715,7 @@ function analyzerTools(deps) {
|
|
|
715
715
|
},
|
|
716
716
|
skills: skills.length === 0 ? null : {
|
|
717
717
|
items: skills.map((k) => ({ name: k.name, description: k.description, path: k.path, ...k.problem === void 0 ? {} : { problem: k.problem } })),
|
|
718
|
-
todo: "\u8FD9\u4E2A\u811A\u672C\u81EA\u5E26\u6280\u80FD\uFF1A\u8BFB\u4E00\u8BFB\u5B83\u4EEC\uFF0CSKILL.md \u91CC\u63D0\u4E00\u53E5\
|
|
718
|
+
todo: "\u8FD9\u4E2A\u811A\u672C\u81EA\u5E26\u6280\u80FD\uFF1A\u8F6F\u4EF6\u627E\u5230\u5C31\u81EA\u52A8\u653E\u8FDB\u6280\u80FD\u5E93\uFF08\u5F52\u5230\u8FD9\u4E2A\u811A\u672C\uFF09\uFF0C\u8BFB\u4E00\u8BFB\u5B83\u4EEC\uFF0CSKILL.md \u91CC\u63D0\u4E00\u53E5\uFF0C\u4E0D\u8981\u91CD\u5199\u6210\u53E6\u4E00\u4E2A\u6280\u80FD\uFF1Bscript_skills \u91CC\u8FD8\u6CA1\u653E\u8FDB\u53BB\u7684\u7528 script_skills_import \u653E"
|
|
719
719
|
},
|
|
720
720
|
readFirst: "\u5148\u8BFB\u6587\u6863\uFF08docs \u91CC\u7684\u6587\u4EF6\u3001readme\u3001docLinks \u91CC\u7684\u7F51\u9875\uFF09\uFF0C\u518D\u7ED3\u5408\u4EE3\u7801\u548C\u914D\u7F6E\u6838\u5BF9\u3001\u8865\u5168\uFF1B\u53EA\u6709\u5B8C\u5168\u627E\u4E0D\u5230\u6587\u6863\u65F6\u624D\u76F4\u63A5\u4ECE\u4EE3\u7801\u5206\u6790\u3002",
|
|
721
721
|
currentPack: pack === void 0 ? null : { id: pack.manifest.id, builtin: pack.builtin, manifest, skill: pack.skill }
|
|
@@ -724,7 +724,7 @@ function analyzerTools(deps) {
|
|
|
724
724
|
}),
|
|
725
725
|
tool({
|
|
726
726
|
name: "script_help",
|
|
727
|
-
description: "\u8FD0\u884C\u811A\u672C\u7A0B\u5E8F\u7684\u5E2E\u52A9\u53C2\u6570\uFF08\u9ED8\u8BA4 --help\uFF09\uFF0C\u62FF\u5230\u5B83\u81EA\u5DF1\u8BF4\u660E\u7684\u547D\u4EE4\u548C\u4EFB\u52A1\u3002\u6700\u591A\u8FD0\u884C 20 \u79D2\u540E\u7ED3\u675F\u3002\u6CA1\u6709\
|
|
727
|
+
description: "\u8FD0\u884C\u811A\u672C\u7A0B\u5E8F\u7684\u5E2E\u52A9\u53C2\u6570\uFF08\u9ED8\u8BA4 --help\uFF09\uFF0C\u62FF\u5230\u5B83\u81EA\u5DF1\u8BF4\u660E\u7684\u547D\u4EE4\u548C\u4EFB\u52A1\u3002\u6700\u591A\u8FD0\u884C 20 \u79D2\u540E\u7ED3\u675F\u3002\u8FD8\u6CA1\u6709\u811A\u672C\u5305\u7684\u811A\u672C\u4F1A\u5148\u8BF7\u7528\u6237\u786E\u8BA4\uFF0C\u56E0\u4E3A\u8FD9\u4F1A\u542F\u52A8\u4E00\u4E2A\u6CA1\u89C1\u8FC7\u7684\u7A0B\u5E8F\uFF1B\u5DF2\u7ECF\u6709\u811A\u672C\u5305\uFF08\u7528\u6237\u5728\u7528\u5B83\u8DD1\u4EFB\u52A1\uFF09\u7684\u76F4\u63A5\u8FD0\u884C\u3002.bat / .cmd / .ps1 \u542F\u52A8\u5668\u591A\u534A\u4E0D\u8BA4 --help\u3001\u4F1A\u76F4\u63A5\u5F00\u59CB\u8DD1\u4EFB\u52A1\uFF1A\u5148\u7528\u8BFB\u6587\u4EF6\u5DE5\u5177\u770B\u5B83\u91CC\u9762\u8C03\u7528\u7684\u771F\u6B63\u7A0B\u5E8F\u548C\u53C2\u6570\uFF08\u4F8B\u5982 runtime\\python.exe main.py\uFF09\uFF0C\u518D\u7528 exe \u548C args \u76F4\u63A5\u95EE\u90A3\u4E2A\u7A0B\u5E8F\u3002",
|
|
728
728
|
properties: {
|
|
729
729
|
id,
|
|
730
730
|
exe: { type: "string", description: "\u8981\u8FD0\u884C\u7684\u7A0B\u5E8F\uFF08\u76F8\u5BF9\u811A\u672C\u76EE\u5F55\uFF09\uFF0C\u4F8B\u5982 runtime\\node.exe \u6216 python\\python.exe\uFF1B\u7701\u7565\u65F6\u7528\u811A\u672C\u5305\u7684\u542F\u52A8\u7A0B\u5E8F\uFF0C\u6216\u627E\u5230\u7684\u7B2C\u4E00\u4E2A\u7A0B\u5E8F\uFF08.exe \u4F18\u5148\u4E8E .bat\uFF09\u3002" },
|
|
@@ -748,7 +748,7 @@ function analyzerTools(deps) {
|
|
|
748
748
|
throw new Error("exe \u5FC5\u987B\u662F\u811A\u672C\u76EE\u5F55\u91CC\u7684\u76F8\u5BF9\u8DEF\u5F84");
|
|
749
749
|
const helpArgs = a.args ?? ["--help"];
|
|
750
750
|
const launcher = isScriptLauncher(exe) ? `\uFF1B${exe} \u662F\u6279\u5904\u7406\u542F\u52A8\u5668\uFF0C\u5B83\u53EF\u80FD\u4E0D\u8BA4\u8FD9\u4E9B\u53C2\u6570\u3001\u76F4\u63A5\u5F00\u59CB\u8DD1\u4EFB\u52A1` : "";
|
|
751
|
-
if (pack
|
|
751
|
+
if (pack === void 0)
|
|
752
752
|
await deps.approve(exec, `\u4E3A\u4E86\u5206\u6790 ${script.name}\uFF0C\u8FD0\u884C ${exe} ${helpArgs.join(" ")}\uFF08\u6700\u591A 20 \u79D2\uFF0C\u53EA\u770B\u5B83\u7684\u5E2E\u52A9\u8F93\u51FA${launcher}\uFF09`);
|
|
753
753
|
return runHelp(join4(script.dir, exe), helpArgs, script.dir);
|
|
754
754
|
}
|
|
@@ -378,8 +378,11 @@ var ScriptSkillItem = external_exports.object({
|
|
|
378
378
|
/** Its folder in the script directory. */
|
|
379
379
|
path: external_exports.string(),
|
|
380
380
|
problem: external_exports.string().optional(),
|
|
381
|
-
/**
|
|
382
|
-
|
|
381
|
+
/**
|
|
382
|
+
* Among this app's skills: under which name, whether it is the script's current version, whether it was
|
|
383
|
+
* changed here, and whether the app put it there by itself (as soon as it was found).
|
|
384
|
+
*/
|
|
385
|
+
imported: external_exports.object({ name: external_exports.string(), current: external_exports.boolean(), changed: external_exports.boolean(), auto: external_exports.boolean().optional() }).optional()
|
|
383
386
|
});
|
|
384
387
|
var ById = external_exports.object({ id: ScriptId });
|
|
385
388
|
var ScriptRequests = {
|
|
@@ -2031,6 +2034,21 @@ var AGENT_AREAS = [
|
|
|
2031
2034
|
function areaOf(toolName) {
|
|
2032
2035
|
return AGENT_AREAS.find((a) => a.tools.includes(toolName));
|
|
2033
2036
|
}
|
|
2037
|
+
var DECISION_AREAS = [
|
|
2038
|
+
{ id: "scripts-install", title: "\u5B89\u88C5\u3001\u66F4\u65B0\u3001\u5220\u9664\u811A\u672C\uFF0C\u5199\u811A\u672C\u5305", tools: ["script_install", "script_update", "script_rollback", "script_remove", "script_setup_run", "script_import", "script_env_fix", "pack_propose"] },
|
|
2039
|
+
{ id: "scripts-config", title: "\u6539\u811A\u672C\u914D\u7F6E", tools: ["script_config_set", "script_config_import", "script_choice_create", "game_path_set", "monitor_stall_set"] },
|
|
2040
|
+
{ id: "pipelines-edit", title: "\u6539\u6D41\u6C34\u7EBF\u548C\u5B9A\u65F6", tools: ["pipeline_save", "schedule_set"] },
|
|
2041
|
+
{ id: "skills", title: "\u4FDD\u5B58\u6280\u80FD", tools: ["skill_save", "script_skills_import", "skill_hub_install"] },
|
|
2042
|
+
{ id: "games-setup", title: "\u6DFB\u52A0\u6E38\u620F\u3001\u52A0\u65E5\u5E38\u5468\u5E38\u3001\u5220\u6D3B\u52A8", tools: ["game_add", "game_routine", "game_activity_remove"] }
|
|
2043
|
+
];
|
|
2044
|
+
function decisionOf(toolName, args) {
|
|
2045
|
+
const area = DECISION_AREAS.find((a) => a.tools.includes(toolName));
|
|
2046
|
+
if (area === void 0)
|
|
2047
|
+
return void 0;
|
|
2048
|
+
if (toolName === "game_routine")
|
|
2049
|
+
return args?.action === "add" ? area : void 0;
|
|
2050
|
+
return area;
|
|
2051
|
+
}
|
|
2034
2052
|
var PermissionsState = external_exports.object({
|
|
2035
2053
|
mode: PermissionMode,
|
|
2036
2054
|
/** When the mode last changed. */
|
|
@@ -2235,6 +2253,33 @@ var THREAD_LINE = /^(这件事的线索是 (\S+):做的过程中要问清楚
|
|
|
2235
2253
|
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`;
|
|
2236
2254
|
var PAST_LINE = /^(你和.{1,20}之前的来往,/;
|
|
2237
2255
|
var PAST_END = "\uFF09";
|
|
2256
|
+
var BRIEF_LIMITS = "\u8FB9\u754C";
|
|
2257
|
+
var BRIEF_DONE_WHEN = "\u5B8C\u6210\u6807\u51C6";
|
|
2258
|
+
var BRIEF_ALLOW = "\u5141\u8BB8\u76F4\u63A5\u505A\u7684\u6539\u52A8";
|
|
2259
|
+
function briefText(task, parts) {
|
|
2260
|
+
const allowed = DECISION_AREAS.filter((area) => parts.allow?.includes(area.id) === true);
|
|
2261
|
+
const lines = [
|
|
2262
|
+
...parts.limits?.trim() ? [`${BRIEF_LIMITS}\uFF1A${parts.limits.trim()}`] : [],
|
|
2263
|
+
...allowed.length > 0 ? [`${BRIEF_ALLOW}\uFF1A${allowed.map((area) => `${area.title}\uFF08${area.id}\uFF09`).join("\u3001")}`] : [],
|
|
2264
|
+
...parts.doneWhen?.trim() ? [`${BRIEF_DONE_WHEN}\uFF1A${parts.doneWhen.trim()}`] : []
|
|
2265
|
+
];
|
|
2266
|
+
return lines.length === 0 ? task.trim() : `${task.trim()}
|
|
2267
|
+
|
|
2268
|
+
${lines.join("\n")}`;
|
|
2269
|
+
}
|
|
2270
|
+
function grantsIn(brief) {
|
|
2271
|
+
if (brief.trimStart().startsWith(`\uFF08\u4F60\u5728\u8F6F\u4EF6\u91CC\u70B9\u7684\uFF1A`))
|
|
2272
|
+
return new Set(DECISION_AREAS.map((area) => area.id));
|
|
2273
|
+
const at = brief.search(new RegExp(`${BRIEF_ALLOW}[\uFF1A:]`));
|
|
2274
|
+
if (at === -1)
|
|
2275
|
+
return /* @__PURE__ */ new Set();
|
|
2276
|
+
const rest = brief.slice(at + BRIEF_ALLOW.length + 1).split("\n")[0];
|
|
2277
|
+
const stop = rest.search(new RegExp(`[\u3002\uFF1B;]|(${BRIEF_LIMITS}|${BRIEF_DONE_WHEN}|\u5E26\u56DE|\u8981\u4EA4\u56DE\u7684|\u76EE\u6807)[\uFF1A:]`));
|
|
2278
|
+
const named = stop === -1 ? rest : rest.slice(0, stop);
|
|
2279
|
+
if (/全部|所有/.test(named))
|
|
2280
|
+
return new Set(DECISION_AREAS.map((area) => area.id));
|
|
2281
|
+
return new Set(DECISION_AREAS.filter((area) => named.includes(area.id) || named.includes(area.title)).map((area) => area.id));
|
|
2282
|
+
}
|
|
2238
2283
|
function taskMessage(by, title, body, returns = false, thread, past) {
|
|
2239
2284
|
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`;
|
|
2240
2285
|
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`]];
|
|
@@ -3887,7 +3932,8 @@ function optimizeScriptPrompt(target, why, id) {
|
|
|
3887
3932
|
" \u65E5\u5E38\u5468\u5E38\uFF08routines\uFF0C\u6E38\u620F\u9875\u300C\u65E5\u5E38 \xB7 \u5468\u5E38\u300D\u9760\u5B83\u4EEC\u81EA\u52A8\u52FE\u9009\uFF09\uFF1A\u539F\u6765\u6709\u7684\u7167\u539F\u6837\u4FDD\u7559\uFF1B\u6BCF\u4E00\u9879\u7684 log \u7528\u8FD0\u884C\u65E5\u5FD7\u91CC\u5B83\u771F\u6B63\u505A\u5B8C\u65F6\u7684\u539F\u6587\u5199\uFF08\u4F8B\u5982\u300C\u5B8C\u6210\u4EFB\u52A1: \u57FA\u5EFA\u6362\u73ED\u300D\u300C\u6BCF\u65E5\u5B9E\u8BAD\u5DF2\u5B8C\u6210\u300D\u300C\u672C\u5468\u527F\u706D\u5DF2\u5B8C\u6210\uFF0C\u8DF3\u8FC7\u527F\u706D\u300D\uFF09\uFF0C\u770B\u4E0D\u51FA\u5355\u9879\u3001\u53EA\u6709\u4EFB\u52A1\u6210\u529F\u80FD\u8BC1\u660E\u7684\u5199 tasks\uFF1B\u5F00\u59CB\u3001\u8DF3\u8FC7\u4E0D\u4E86\u3001\u5931\u8D25\u7684\u884C\u4E0D\u8981\u5199\u6210\u5B8C\u6210\u3002\u5E38\u89C1\u95EE\u9898\u5199\u5728 guide.troubleshooting \u4E0B\uFF0C\u5199\u5728\u522B\u5904\u4F1A\u88AB\u4E22\u6389\uFF1B",
|
|
3888
3933
|
"2. \u6539\u5584\u76D1\u63A7\u65F6\u95F4\uFF1Amonitor_stall_check \u770B\u5B83\u6B63\u5E38\u8FD0\u884C\u65F6\u65E5\u5FD7\u7684\u8282\u594F\uFF0C\u6309\u5EFA\u8BAE\u503C\u548C\u4F60\u770B\u65E5\u5FD7\u7684\u5224\u65AD\u7528 monitor_stall_set \u8BBE\u5B83\u591A\u4E45\u6CA1\u65B0\u65E5\u5FD7\u7B97\u5361\u4F4F\uFF0Cnote \u5199\u660E\u4F9D\u636E\uFF08\u4F8B\u5982\u300C\u6218\u6597\u4E2D\u6700\u957F 70 \u79D2\u4E0D\u8F93\u51FA\u300D\uFF09\uFF1B",
|
|
3889
3934
|
"3. \u628A\u505A\u8FC7\u7684\u6B65\u9AA4\u603B\u7ED3\u6210\u6280\u80FD\uFF0C\u5206\u5230\u5BF9\u5E94\u7684\u6E38\u620F\u548C\u811A\u672C\uFF1A\u8FD0\u884C\u548C\u5904\u7406\u8FD9\u4E2A\u811A\u672C\u65F6\u53CD\u590D\u7528\u5230\u3001\u5DF2\u7ECF\u8D70\u901A\u7684\u505A\u6CD5\uFF08\u5E38\u89C1\u62A5\u9519\u600E\u4E48\u5904\u7406\u3001\u600E\u4E48\u786E\u8BA4\u8DD1\u5B8C\u3001\u914D\u7F6E\u600E\u4E48\u6539\uFF09\u7528 skill_save \u5B58\u6210\u6280\u80FD\uFF0Cscripts \u586B\u8FD9\u4E2A\u811A\u672C\u7684 id\uFF0C\u53EA\u7ED9\u5B83\u7528\uFF1B\u5176\u4E2D\u548C\u6E38\u620F\u672C\u8EAB\u6709\u5173\u3001\u522B\u7684\u811A\u672C\u4E5F\u7528\u5F97\u4E0A\u7684\uFF08\u6E38\u620F\u91CC\u7684\u64CD\u4F5C\u3001\u754C\u9762\u3001\u6D3B\u52A8\u3001\u673A\u5236\uFF09\u5355\u72EC\u5B58\uFF0Cgames \u586B\u5B83\u73A9\u7684\u6E38\u620F id\uFF08game_list \u67E5\uFF09\uFF0C\u4E0D\u586B scripts\uFF1B\u5DF2\u6709\u7684\u6280\u80FD\u5C31\u5408\u5E76\u66F4\u65B0\uFF08replace\uFF09\uFF0C\u4E0D\u8981\u91CD\u590D\u5B58\uFF0C\u6CA1\u6709\u503C\u5F97\u5B58\u7684\u5C31\u4E0D\u5B58\uFF1B",
|
|
3890
|
-
"4. \u4E0D\
|
|
3935
|
+
"4. \u505A\u4E0A\u9762\u51E0\u6B65\u65F6\uFF0C\u6587\u6863\u548C\u65E5\u5FD7\u8BF4\u4E0D\u6E05\u7684\uFF08\u67D0\u4E2A\u529F\u80FD\u5728\u754C\u9762\u54EA\u91CC\u5F00\u3001\u9009\u9879\u53EB\u4EC0\u4E48\u3001\u65B0\u7248\u672C\u754C\u9762\u53D8\u4E86\u6CA1\u6709\uFF09\uFF0C\u53EF\u4EE5\u81EA\u5DF1\u6253\u5F00\u811A\u672C\u7A0B\u5E8F\u770B\uFF1Ascript_settings \u6253\u5F00\u5B83\u7684\u8BBE\u7F6E\u754C\u9762\uFF08\u547D\u4EE4\u884C\u811A\u672C\u7528 script_help \u770B\u5E2E\u52A9\uFF09\uFF0Cwindow_list \u627E\u5230\u5B83\u7684\u7A97\u53E3\uFF0Cscreen_capture\uFF08target=window\uFF09\u622A\u56FE\u5BF9\u7167\uFF0C\u770B\u5B8C\u7528 script_stop \u5173\u6389\uFF08run_id \u662F script_settings \u8FD4\u56DE\u7684\uFF09\u3002\u4E0D\u8981\u8DD1\u4F1A\u64CD\u4F5C\u6E38\u620F\u7684\u4EFB\u52A1\uFF08\u4F1A\u5360\u7528\u6E38\u620F\u548C\u8D26\u53F7\uFF09\uFF0C\u4E5F\u4E0D\u8981\u6539\u5B83\u7684\u914D\u7F6E\uFF1B",
|
|
3936
|
+
"5. \u6700\u540E\u7528\u51E0\u53E5\u8BDD\u544A\u8BC9\u6211\uFF1A\u811A\u672C\u5305\u6539\u4E86\u4EC0\u4E48\uFF08\u5DF2\u7ECF\u76F4\u63A5\u751F\u6548\uFF09\u3001\u54EA\u4E9B\u65E5\u5E38\u5468\u5E38\u80FD\u81EA\u52A8\u52FE\u9009\u3001\u5361\u4F4F\u65F6\u95F4\u8BBE\u6210\u591A\u5C11\u3001\u5B58\u4E86\u6216\u66F4\u65B0\u4E86\u54EA\u4E9B\u6280\u80FD\uFF1B\u6253\u5F00\u8FC7\u811A\u672C\u754C\u9762\u7684\uFF0C\u8BF4\u4E00\u53E5\u770B\u5230\u4E86\u4EC0\u4E48\u3002"
|
|
3891
3937
|
].join("\n");
|
|
3892
3938
|
}
|
|
3893
3939
|
var COMMANDS = [
|
|
@@ -3918,7 +3964,7 @@ var COMMANDS = [
|
|
|
3918
3964
|
expand: (arg) => [
|
|
3919
3965
|
`\u5E2E\u6211\u628A\u811A\u672C\u7F16\u6392\u6210\u6D41\u6C34\u7EBF\uFF1A${arg === "" ? "\u628A\u6211\u88C5\u597D\u7684\u5404\u4E2A\u811A\u672C\u7684\u65E5\u5E38\u4EFB\u52A1\u6392\u6210\u6BCF\u5929\u80FD\u81EA\u52A8\u8DD1\u7684\u6D41\u7A0B" : arg}\u3002\u6309\u6280\u80FD pipeline-planning\uFF1A`,
|
|
3920
3966
|
"1. \u5148 system_info \u770B\u7535\u8111\u914D\u7F6E\uFF08\u80FD\u4E0D\u80FD\u540C\u65F6\u8DD1\u51E0\u4E2A\u6E38\u620F\uFF09\uFF0Cpipeline_list \u770B\u5DF2\u6709\u7684\u6D41\u6C34\u7EBF\uFF0Cscript_tasks \u770B\u5404\u811A\u672C\u6709\u54EA\u4E9B\u4EFB\u52A1\uFF1B",
|
|
3921
|
-
"2. \u6392\u597D\u540E\u4FDD\u5B58\uFF1A\u4F60\u662F\u300C\u7F16\u6392\u300D\u5C31\u7528 pipeline_save \u76F4\u63A5\u4FDD\u5B58\uFF1B\u4E0D\u662F\u5C31\u7528 pipeline_draft \u8D77\u8349\uFF08\u8349\u7A3F\uFF0C\u6211\u5728\u300C\u7F16\u6392\u300D\u9875\u4FDD\u5B58\u540E\u624D\u4F1A\u6309\u5B9A\u65F6\u8FD0\u884C\uFF09\
|
|
3967
|
+
"2. \u6392\u597D\u540E\u4FDD\u5B58\uFF1A\u4F60\u662F\u300C\u7F16\u6392\u300D\u5C31\u7528 pipeline_save \u76F4\u63A5\u4FDD\u5B58\uFF1B\u4E0D\u662F\u5C31\u6574\u4EF6\u4E8B\u4EA4\u7ED9\u300C\u7F16\u6392\u300D\uFF08agent_delegate\uFF09\u53BB\u6392\u548C\u4FDD\u5B58\uFF0C\u53EA\u6709\u6CA1\u6709\u300C\u7F16\u6392\u300D\u65F6\u624D\u7528 pipeline_draft \u8D77\u8349\uFF08\u8349\u7A3F\uFF0C\u6211\u5728\u300C\u7F16\u6392\u300D\u9875\u4FDD\u5B58\u540E\u624D\u4F1A\u6309\u5B9A\u65F6\u8FD0\u884C\uFF09\u3002\u6A21\u62DF\u5668\u548C\u524D\u53F0\u811A\u672C\u80FD\u5E76\u884C\u7684\u5E76\u884C\uFF0C\u5931\u8D25\u4E0D\u8981\u6321\u4F4F\u522B\u7684\uFF1B",
|
|
3922
3968
|
"3. \u8BF4\u6E05\u695A\u4E3A\u4EC0\u4E48\u8FD9\u6837\u6392\u3001\u54EA\u4E9B\u6B65\u9AA4\u5E76\u884C\u3001\u4F30\u8BA1\u591A\u4E45\u3001\u5EFA\u8BAE\u5B9A\u5728\u51E0\u70B9\u8DD1\u3002"
|
|
3923
3969
|
].join("\n")
|
|
3924
3970
|
},
|
|
@@ -4088,6 +4134,8 @@ export {
|
|
|
4088
4134
|
AreaPolicy,
|
|
4089
4135
|
AGENT_AREAS,
|
|
4090
4136
|
areaOf,
|
|
4137
|
+
DECISION_AREAS,
|
|
4138
|
+
decisionOf,
|
|
4091
4139
|
QUESTIONS_CAPABILITY,
|
|
4092
4140
|
INSTANCES_CAPABILITY,
|
|
4093
4141
|
SKILLS_CAPABILITY,
|
|
@@ -4096,6 +4144,11 @@ export {
|
|
|
4096
4144
|
SKILLHUB_CAPABILITY,
|
|
4097
4145
|
BY_YOU,
|
|
4098
4146
|
isQuiet,
|
|
4147
|
+
BRIEF_LIMITS,
|
|
4148
|
+
BRIEF_DONE_WHEN,
|
|
4149
|
+
BRIEF_ALLOW,
|
|
4150
|
+
briefText,
|
|
4151
|
+
grantsIn,
|
|
4099
4152
|
taskMessage,
|
|
4100
4153
|
parseTask,
|
|
4101
4154
|
threadMessage,
|
|
@@ -1,13 +1,15 @@
|
|
|
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-QSETYM2Y.js";
|
|
5
5
|
import {
|
|
6
6
|
writeFileAtomic
|
|
7
7
|
} from "./chunk-RESS7WVY.js";
|
|
8
8
|
import {
|
|
9
9
|
BY_YOU,
|
|
10
|
+
DECISION_AREAS,
|
|
10
11
|
NOTIFY_CAPABILITY,
|
|
12
|
+
briefText,
|
|
11
13
|
isQuiet,
|
|
12
14
|
parseRelay,
|
|
13
15
|
parseTask,
|
|
@@ -20,7 +22,7 @@ import {
|
|
|
20
22
|
threadMessage,
|
|
21
23
|
threadReminder,
|
|
22
24
|
threadsBetween
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-34VNH3YS.js";
|
|
24
26
|
import {
|
|
25
27
|
external_exports
|
|
26
28
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -755,6 +757,9 @@ var HANDED = (agent) => `\u5DF2\u4EA4\u7ED9\u300C${agent}\u300D\u3002\u5B83\u572
|
|
|
755
757
|
var Args2 = external_exports.object({
|
|
756
758
|
agent: external_exports.string().trim().min(1).max(40),
|
|
757
759
|
task: external_exports.string().trim().min(1).max(8e3),
|
|
760
|
+
limits: external_exports.string().trim().max(2e3).nullish(),
|
|
761
|
+
allow: external_exports.array(external_exports.string().trim()).max(DECISION_AREAS.length).nullish(),
|
|
762
|
+
done_when: external_exports.string().trim().min(1).max(2e3),
|
|
758
763
|
expecting: external_exports.string().trim().max(2e3).nullish()
|
|
759
764
|
});
|
|
760
765
|
function delegateTool(deps) {
|
|
@@ -771,17 +776,23 @@ function delegateTool(deps) {
|
|
|
771
776
|
description: [
|
|
772
777
|
"\u628A\u4E00\u4EF6\u4E8B\u4EA4\u7ED9\u53E6\u4E00\u4E2A agent \u53BB\u505A\u3002\u53EF\u4EE5\u4EA4\u7ED9\u8C01\u3001\u5404\u81EA\u505A\u4EC0\u4E48\uFF0C\u89C1\u7CFB\u7EDF\u63D0\u793A\u91CC\u7684\u300C\u56E2\u961F\u300D\u3002",
|
|
773
778
|
"\u4EA4\u51FA\u53BB\u5C31\u8FD4\u56DE\uFF0C\u4E0D\u7B49\u5B83\u505A\u5B8C\uFF1A\u5B83\u5728\u81EA\u5DF1\u7684\u5BF9\u8BDD\u91CC\u505A\uFF0C\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",
|
|
774
|
-
"
|
|
779
|
+
"\u5BF9\u65B9\u770B\u4E0D\u5230\u4F60\u7684\u5BF9\u8BDD\uFF0C\u53EA\u770B\u5230\u4F60\u5199\u7684\u8FD9\u51E0\u9879\uFF0C\u6240\u4EE5\u8981\u5199\u5B8C\u6574\uFF1B\u53EA\u5199\u8981\u4EC0\u4E48\u3001\u5230\u54EA\u4E3A\u6B62\uFF0C\u4E0D\u5199\u4E00\u6B65\u6B65\u600E\u4E48\u505A\u2014\u2014\u7528\u4EC0\u4E48\u5DE5\u5177\u3001\u600E\u4E48\u505A\u7531\u5BF9\u65B9\u51B3\u5B9A\uFF0C\u5B83\u6BD4\u4F60\u6E05\u695A\u81EA\u5DF1\u7684\u5DE5\u5177\u3002",
|
|
780
|
+
"task \u5199\u76EE\u6807\uFF1A\u8981\u505A\u6210\u4EC0\u4E48\u6837\uFF0C\u52A0\u4E0A\u4F60\u5DF2\u7ECF\u77E5\u9053\u7684\u60C5\u51B5\uFF08\u54EA\u4E2A\u6E38\u620F\u6216\u811A\u672C\u3001\u8FD0\u884C id\u3001\u7528\u6237\u7684\u539F\u8BDD\uFF09\u3002limits \u5199\u8FB9\u754C\uFF1A\u54EA\u4E9B\u4E0D\u80FD\u52A8\u3001\u505A\u5230\u54EA\u4E00\u6B65\u4E3A\u6B62\uFF08\u53EF\u9009\uFF09\u3002done_when \u5199\u5B8C\u6210\u6807\u51C6\uFF1A\u600E\u6837\u7B97\u505A\u5B8C\u3002expecting \u5199\u8981\u5B83\u5E26\u56DE\u7684\u8BC1\u636E\uFF1A\u8FD0\u884C id\u3001\u65E5\u5FD7\u539F\u6587\u3001\u6539\u4E86\u54EA\u4E9B\u8BBE\u7F6E\u6216\u6587\u4EF6\u3001\u7ED3\u679C\u72B6\u6001\uFF08\u53EF\u9009\uFF09\u3002",
|
|
781
|
+
"\u60C5\u51B5\u4E0D\u660E\u3001\u6216\u8005\u8981\u505A\u6536\u4E0D\u56DE\u7684\u4E8B\uFF08\u5220\u3001\u88C5\u3001\u6539\u8BBE\u7F6E\uFF09\u65F6\uFF0C\u5148\u8BA9\u5B83\u67E5\u6E05\u695A\u4EA4\u56DE\uFF0C\u7531\u4F60\u51B3\u5B9A\u4EE5\u540E\u518D\u4EA4\u5B83\u53BB\u505A\u3002",
|
|
782
|
+
`\u4F1A\u7559\u4E0B\u6765\u7684\u6539\u52A8\uFF08${DECISION_AREAS.map((a) => `${a.id}\uFF1A${a.title}`).join("\uFF1B")}\uFF09\u9ED8\u8BA4\u4E0D\u76F4\u63A5\u505A\uFF1A\u505A\u8FD9\u7C7B\u6539\u52A8\u65F6\u8F6F\u4EF6\u5148\u8BB0\u6210\u5F85\u5B9A\u6539\u52A8\uFF0C\u7531\u63A5\u624B\u7684 agent \u51B3\u5B9A\uFF0C\u5B83\u62FF\u4E0D\u51C6\u65F6\u4F1A\u56DE\u5934\u95EE\u4F60\u3002\u7528\u6237\u5DF2\u7ECF\u660E\u786E\u8981\u505A\u7684\u90A3\u7C7B\uFF0C\u5199\u8FDB allow\uFF0C\u5C31\u76F4\u63A5\u505A\u3002`,
|
|
775
783
|
`\u51E0\u4EF6\u4E92\u4E0D\u76F8\u5173\u7684\u4E8B\u53EF\u4EE5\u540C\u65F6\u4EA4\u51FA\u53BB\uFF0C\u4E00\u4E2A\u5BF9\u8BDD\u540C\u65F6\u6700\u591A ${MAX_OUT} \u4EF6\u3002\u5B83\u8981\u7528\u6237\u5BA1\u6279\u6216\u56DE\u7B54\u95EE\u9898\u65F6\u4F1A\u505C\u4E0B\u7B49\u7528\u6237\u3002`
|
|
776
784
|
].join(""),
|
|
777
785
|
parameters: {
|
|
778
786
|
type: "object",
|
|
779
787
|
properties: {
|
|
780
788
|
agent: { type: "string", description: "agent \u7684\u540D\u5B57\u6216 id\uFF0C\u4F8B\u5982\u300C\u6E38\u620F\u300D\u300C\u811A\u672C\u300D\u3002" },
|
|
781
|
-
task: { type: "string", description: "\u8981\
|
|
782
|
-
|
|
789
|
+
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
|
+
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
|
+
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" },
|
|
792
|
+
done_when: { type: "string", description: "\u5B8C\u6210\u6807\u51C6\uFF1A\u600E\u6837\u7B97\u505A\u5B8C\uFF0C\u4F8B\u5982\u300C\u5217\u51FA\u4ECA\u5929\u7ED3\u675F\u7684\u6D3B\u52A8\uFF0C\u6CA1\u6709\u5C31\u8BF4\u6CA1\u6709\u300D\u3002" },
|
|
793
|
+
expecting: { type: "string", description: "\u8981\u5B83\u5E26\u56DE\u7684\u8BC1\u636E\uFF1A\u8FD0\u884C id\u3001\u65E5\u5FD7\u539F\u6587\u3001\u6539\u4E86\u4EC0\u4E48\u3001\u7ED3\u679C\u72B6\u6001\uFF08\u53EF\u9009\uFF09\u3002" }
|
|
783
794
|
},
|
|
784
|
-
required: ["agent", "task"],
|
|
795
|
+
required: ["agent", "task", "done_when"],
|
|
785
796
|
additionalProperties: false
|
|
786
797
|
},
|
|
787
798
|
output: { schema: {}, render: (_args, value) => [{ type: "text", text: HANDED(value.agent) }] },
|
|
@@ -790,7 +801,11 @@ function delegateTool(deps) {
|
|
|
790
801
|
const parsed = Args2.safeParse(args ?? {});
|
|
791
802
|
if (!parsed.success)
|
|
792
803
|
throw new Error(`\u53C2\u6570\u65E0\u6548\uFF1A${parsed.error.issues.map((i) => `${i.path.join(".") || "(root)"} ${i.message}`).join("; ")}`);
|
|
793
|
-
const { agent: wanted, task, expecting } = parsed.data;
|
|
804
|
+
const { agent: wanted, task: goal, limits, allow, done_when: doneWhen, expecting } = parsed.data;
|
|
805
|
+
const unknownKinds = (allow ?? []).filter((kind) => !DECISION_AREAS.some((a) => a.id === kind));
|
|
806
|
+
if (unknownKinds.length > 0)
|
|
807
|
+
throw new Error(`allow \u91CC\u6CA1\u6709\u8FD9\u4E9B\u7C7B\u522B\uFF1A${unknownKinds.join("\u3001")}\u3002\u53EF\u4EE5\u5199\uFF1A${DECISION_AREAS.map((a) => a.id).join("\u3001")}`);
|
|
808
|
+
const task = briefText(goal, { limits: limits ?? void 0, doneWhen, allow: allow ?? void 0 });
|
|
794
809
|
const parent = exec.agent?.session.id;
|
|
795
810
|
if (parent === void 0)
|
|
796
811
|
throw new Error("\u53EA\u80FD\u5728\u4F1A\u8BDD\u91CC\u4EA4\u51FA\u53BB");
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
launchCommand,
|
|
6
6
|
renderTask,
|
|
7
7
|
require_dist
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C7X2KJ5C.js";
|
|
9
9
|
import {
|
|
10
10
|
RUNS_CAPABILITY,
|
|
11
11
|
ScriptId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-34VNH3YS.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports
|
|
15
15
|
} from "./chunk-6DSSLS7I.js";
|
|
@@ -1511,16 +1511,7 @@ var Runner = class {
|
|
|
1511
1511
|
*/
|
|
1512
1512
|
async readLog(runId, query = {}) {
|
|
1513
1513
|
const dir = join6(this.#options.dataDir, "runs", runId);
|
|
1514
|
-
|
|
1515
|
-
if (all === void 0) {
|
|
1516
|
-
const memory = this.#runs.get(runId);
|
|
1517
|
-
if (memory !== void 0 && (memory.archived !== true || memory.lines.length > 0))
|
|
1518
|
-
all = memory.lines;
|
|
1519
|
-
else if (await stat4(join6(dir, "run.json")).then(() => true, () => false))
|
|
1520
|
-
throw new Error(`${runId} \u7684\u65E5\u5FD7\u5DF2\u6309\u4FDD\u7559\u89C4\u5219\u6E05\u7406\uFF08\u6BCF\u4E2A\u811A\u672C\u53EA\u7559\u6700\u8FD1\u7EA6 ${SCRIPT_LOG_BUDGET / 1024 / 1024} MiB \u7684\u8FD0\u884C\u65E5\u5FD7\uFF09`);
|
|
1521
|
-
else
|
|
1522
|
-
throw new Error(`\u6CA1\u6709\u8FD0\u884C\u8BB0\u5F55 ${runId}`);
|
|
1523
|
-
}
|
|
1514
|
+
const all = await this.allLines(runId);
|
|
1524
1515
|
const file = await runLogFile(dir);
|
|
1525
1516
|
const pattern = query.search === void 0 || query.search === "" ? void 0 : toPattern(query.search);
|
|
1526
1517
|
const numbered = all.map((line, i) => ({ ...line, n: i + 1 })).filter((l) => (query.levels === void 0 || query.levels.length === 0 || l.level !== void 0 && query.levels.includes(l.level)) && (pattern === void 0 || pattern.test(l.text)));
|
|
@@ -1528,6 +1519,19 @@ var Runner = class {
|
|
|
1528
1519
|
const lines = query.fromLine === void 0 ? numbered.slice(-limit) : numbered.filter((l) => l.n >= query.fromLine).slice(0, limit);
|
|
1529
1520
|
return { file, total: all.length, matched: numbered.length, lines };
|
|
1530
1521
|
}
|
|
1522
|
+
/** Every line of a run's log: the saved one, or what is in memory for a run not saved yet. */
|
|
1523
|
+
async allLines(runId) {
|
|
1524
|
+
const dir = join6(this.#options.dataDir, "runs", runId);
|
|
1525
|
+
const saved = await readRunLog(dir);
|
|
1526
|
+
if (saved !== void 0)
|
|
1527
|
+
return saved;
|
|
1528
|
+
const memory = this.#runs.get(runId);
|
|
1529
|
+
if (memory !== void 0 && (memory.archived !== true || memory.lines.length > 0))
|
|
1530
|
+
return memory.lines;
|
|
1531
|
+
if (await stat4(join6(dir, "run.json")).then(() => true, () => false))
|
|
1532
|
+
throw new Error(`${runId} \u7684\u65E5\u5FD7\u5DF2\u6309\u4FDD\u7559\u89C4\u5219\u6E05\u7406\uFF08\u6BCF\u4E2A\u811A\u672C\u53EA\u7559\u6700\u8FD1\u7EA6 ${SCRIPT_LOG_BUDGET / 1024 / 1024} MiB \u7684\u8FD0\u884C\u65E5\u5FD7\uFF09`);
|
|
1533
|
+
throw new Error(`\u6CA1\u6709\u8FD0\u884C\u8BB0\u5F55 ${runId}`);
|
|
1534
|
+
}
|
|
1531
1535
|
/**
|
|
1532
1536
|
* Runs from before a restart, from their saved records; a run cut off by
|
|
1533
1537
|
* the restart is marked failed. Old run folders are removed.
|
|
@@ -2412,8 +2416,8 @@ async function writeConfig(library, profiles, dataDir, scriptId, file, path, val
|
|
|
2412
2416
|
const { manifest, dir } = packFor(library, scriptId);
|
|
2413
2417
|
allowed(manifest, file);
|
|
2414
2418
|
const profile = await profiles.resolve(scriptId, profileRef);
|
|
2415
|
-
const
|
|
2416
|
-
const historyDir = join7(dataDir, "config-history", scriptId, profile.id === DEFAULT_PROFILE ?
|
|
2419
|
+
const stamp2 = new Date(now).toISOString().replace(/[:.]/g, "-");
|
|
2420
|
+
const historyDir = join7(dataDir, "config-history", scriptId, profile.id === DEFAULT_PROFILE ? stamp2 : `${stamp2}-${profile.id}`);
|
|
2417
2421
|
await profiles.write(scriptId, dir, manifest, file, path, value, historyDir, profile.id);
|
|
2418
2422
|
return { file, backup: join7(historyDir, file), copy: "local", profile: profile.name };
|
|
2419
2423
|
}
|
|
@@ -2894,6 +2898,59 @@ function runnerTools(runner, config) {
|
|
|
2894
2898
|
];
|
|
2895
2899
|
}
|
|
2896
2900
|
|
|
2901
|
+
// packages/runner/lib/export.js
|
|
2902
|
+
import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
2903
|
+
import { join as join8 } from "node:path";
|
|
2904
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
2905
|
+
var stamp = (at) => {
|
|
2906
|
+
const d = new Date(at);
|
|
2907
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}_${pad(d.getHours())}-${pad(d.getMinutes())}-${pad(d.getSeconds())}`;
|
|
2908
|
+
};
|
|
2909
|
+
var full = (at) => {
|
|
2910
|
+
const d = new Date(at);
|
|
2911
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
2912
|
+
};
|
|
2913
|
+
var clock = (at) => {
|
|
2914
|
+
const d = new Date(at);
|
|
2915
|
+
return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
2916
|
+
};
|
|
2917
|
+
var safe = (name) => name.replace(/[\\/:*?"<>|]/g, "_");
|
|
2918
|
+
function runLogsPart(runner) {
|
|
2919
|
+
return {
|
|
2920
|
+
name: "runs",
|
|
2921
|
+
title: "\u811A\u672C\u8FD0\u884C\u65E5\u5FD7",
|
|
2922
|
+
async write({ since, until }, dir, { mask, signal }) {
|
|
2923
|
+
const runs = runner.list().filter((r) => r.startedAt >= since && r.startedAt < until).sort((a, b) => a.startedAt - b.startedAt);
|
|
2924
|
+
if (runs.length === 0)
|
|
2925
|
+
return { files: 0, summary: "\u8FD9\u6BB5\u65F6\u95F4\u6CA1\u6709\u811A\u672C\u8FD0\u884C" };
|
|
2926
|
+
await mkdir5(dir, { recursive: true });
|
|
2927
|
+
const gone = [];
|
|
2928
|
+
for (const run of runs) {
|
|
2929
|
+
signal.throwIfAborted();
|
|
2930
|
+
let lines = [];
|
|
2931
|
+
try {
|
|
2932
|
+
lines = await runner.allLines(run.id);
|
|
2933
|
+
} catch (error) {
|
|
2934
|
+
gone.push(`${run.id}\uFF08${error instanceof Error ? error.message : String(error)}\uFF09`);
|
|
2935
|
+
}
|
|
2936
|
+
const head = [
|
|
2937
|
+
`\u8FD0\u884C ${run.id}`,
|
|
2938
|
+
`\u811A\u672C ${run.scriptName}\uFF08${run.scriptId}\uFF09\uFF0C${run.kind === "settings" ? "\u8BBE\u7F6E\u754C\u9762" : `\u4EFB\u52A1 ${run.taskTitle}\uFF08${run.taskId}\uFF09`}`,
|
|
2939
|
+
`\u5F00\u59CB ${full(run.startedAt)}${run.endedAt === void 0 ? "\uFF0C\u8FD8\u5728\u8FD0\u884C" : `\uFF0C\u7ED3\u675F ${full(run.endedAt)}`}`,
|
|
2940
|
+
`\u7ED3\u679C ${run.state}${run.outcome === void 0 ? "" : `\uFF1A${mask(run.outcome)}`}${run.exitCode === void 0 ? "" : `\uFF08\u9000\u51FA\u7801 ${run.exitCode}\uFF09`}`,
|
|
2941
|
+
`\u65E5\u5FD7 ${lines.length} \u884C`,
|
|
2942
|
+
""
|
|
2943
|
+
];
|
|
2944
|
+
const body = lines.map((l) => `${clock(l.at)} [${l.source}]${l.level === void 0 ? "" : `[${l.level}]`} ${mask(l.text)}`);
|
|
2945
|
+
await writeFile5(join8(dir, safe(`${stamp(run.startedAt)}-${run.scriptId}-${run.taskId}-${run.state}.log`)), `${[...head, ...body].join("\n")}
|
|
2946
|
+
`, "utf8");
|
|
2947
|
+
}
|
|
2948
|
+
const scripts = [...new Set(runs.map((r) => r.scriptName))];
|
|
2949
|
+
return { files: runs.length, summary: `${runs.length} \u6B21\u8FD0\u884C\uFF08${scripts.join("\u3001")}\uFF09${gone.length === 0 ? "" : `\uFF1B\u5176\u4E2D ${gone.length} \u6B21\u7684\u65E5\u5FD7\u62FF\u4E0D\u5230\uFF1A${gone.join("\uFF1B")}`}` };
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2897
2954
|
// packages/runner/lib/index.js
|
|
2898
2955
|
var ConfigSchema = external_exports.object({
|
|
2899
2956
|
/** Run records, logs and config backups: `<dataDir>/runs/<id>/`. */
|
|
@@ -2956,6 +3013,9 @@ var AdgRunner = class extends Service {
|
|
|
2956
3013
|
dispose();
|
|
2957
3014
|
};
|
|
2958
3015
|
}));
|
|
3016
|
+
ctx.inject(["adgGateway"], (scoped) => {
|
|
3017
|
+
scoped.effect(() => scoped.adgGateway.exportPart(runLogsPart(runner)), "adg-runner run logs export");
|
|
3018
|
+
});
|
|
2959
3019
|
ctx.inject(["adgGateway"], (scoped) => {
|
|
2960
3020
|
scoped.adgGateway.register({
|
|
2961
3021
|
id: RUNS_CAPABILITY,
|