dsh-multigameassistant 2.0.3 → 2.0.5
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 +132 -25
- package/lib/{chunk-AWZ4O7BY.js → chunk-4Q4EH73S.js} +5 -2
- package/lib/{chunk-IH3K4QPN.js → chunk-BTT2GBTQ.js} +373 -162
- package/lib/chunk-IOBYH4RN.js +530 -0
- package/lib/{chunk-OQZ2XZVP.js → chunk-KHO3SRUJ.js} +289 -5
- package/lib/{chunk-C6HSCWNE.js → chunk-PAJOD6LV.js} +16 -6
- package/lib/{chunk-ZXD4IYZP.js → chunk-TD4YFQWE.js} +1980 -286
- package/lib/emulator.js +1 -1
- package/lib/feishu.js +4 -3
- package/lib/game-intel.js +7 -5
- package/lib/gateway.js +3 -2
- package/lib/guard.js +1 -1
- package/lib/intervene.js +4 -3
- package/lib/low-context.js +73 -0
- package/lib/monitor.js +3 -3
- package/lib/notify.js +4 -3
- package/lib/orchestrator.js +89 -23
- package/lib/packs/maa/adg.script.yaml +119 -1
- package/lib/packs/maaend/adg.script.yaml +74 -4
- package/lib/packs/march7th/adg.script.yaml +116 -0
- package/lib/qqbot.js +4 -3
- package/lib/runner.js +3 -3
- package/lib/scheduler.js +1 -1
- package/lib/script-registry.js +19 -12
- package/package.json +2 -1
- package/skills/pipeline-planning.md +8 -5
- package/skills/script-analysis.md +70 -10
- package/web/assets/index-BuStplKb.js +242 -0
- package/web/assets/index-BuStplKb.js.map +1 -0
- package/web/assets/index-CSB3B28L.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-BVPmzXp6.js +0 -241
- package/web/assets/index-BVPmzXp6.js.map +0 -1
- package/web/assets/index-Dwlpk_7H.css +0 -1
package/cordis.patch.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# dsh-multigameassistant 2.0.
|
|
1
|
+
# dsh-multigameassistant 2.0.5
|
|
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.
|
|
@@ -203,7 +203,12 @@
|
|
|
203
203
|
config:
|
|
204
204
|
# 设置 → 对话压缩 (compaction.json in the app's data); read when the agent service starts.
|
|
205
205
|
auto: !!js "(() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().auto !== false"
|
|
206
|
-
thresholdRatio: !!js "Math.min(
|
|
206
|
+
thresholdRatio: !!js "(Math.min(100, Math.max(5, Number((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().threshold) || 80)) / 100)"
|
|
207
|
+
retainRatio: !!js "Math.min(0.16, (Math.min(100, Math.max(5, Number((() => { try { return JSON.parse(process.getBuiltinModule('node:fs').readFileSync((process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json', 'utf8')) } catch { return {} } })().threshold) || 80)) / 100) / 2)"
|
|
208
|
+
- id: adg-low-context
|
|
209
|
+
name: 'dsh-multigameassistant/low-context'
|
|
210
|
+
config:
|
|
211
|
+
file: !!js "(process.env.ADG_DATA_DIR || dshHomePath('adg/data')) + '/compaction.json'"
|
|
207
212
|
- id: command-compact
|
|
208
213
|
name: '@deepseek-ai/dsh-command-compact'
|
|
209
214
|
- id: tool-result-pruner
|
package/lib/analyzer.js
CHANGED
|
@@ -5,14 +5,16 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
MANIFEST_FILE,
|
|
7
7
|
SKILL_FILE,
|
|
8
|
+
guideIssues,
|
|
8
9
|
parseManifest,
|
|
9
10
|
require_dist
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KHO3SRUJ.js";
|
|
11
12
|
import {
|
|
13
|
+
BUILTIN_PACK_VERSION,
|
|
12
14
|
PACKS_CAPABILITY,
|
|
13
15
|
ScriptId,
|
|
14
16
|
external_exports
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BTT2GBTQ.js";
|
|
16
18
|
import {
|
|
17
19
|
__toESM
|
|
18
20
|
} from "./chunk-2UFLGPDY.js";
|
|
@@ -360,6 +362,7 @@ async function isFile(path) {
|
|
|
360
362
|
// packages/analyzer/lib/drafts.js
|
|
361
363
|
import { cp, mkdir, readdir as readdir2, readFile as readFile3, rename, rm, writeFile } from "node:fs/promises";
|
|
362
364
|
import { join as join3 } from "node:path";
|
|
365
|
+
var WHEN = /^(\d{4}-\d{2}-\d{2}T\d{2})-(\d{2})-(\d{2})-(\d{3})Z$/;
|
|
363
366
|
var DraftStore = class {
|
|
364
367
|
#root;
|
|
365
368
|
#packs;
|
|
@@ -391,6 +394,16 @@ var DraftStore = class {
|
|
|
391
394
|
`);
|
|
392
395
|
return { tasks: parsed.tasks.map((t) => ({ id: t.id, title: t.title })) };
|
|
393
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Validate a pack and put it in use: the user's pack from now on, with no draft left waiting.
|
|
399
|
+
* @returns `replaced`: a user pack of this id was there before (now in the history).
|
|
400
|
+
* @throws PackError naming every problem; the pack in use is then untouched.
|
|
401
|
+
*/
|
|
402
|
+
async save(meta, manifest, skill, now = Date.now()) {
|
|
403
|
+
const { tasks } = await this.propose(meta, manifest, skill);
|
|
404
|
+
const { dir, replaced } = await this.accept(meta.packId, now);
|
|
405
|
+
return { dir, tasks, replaced };
|
|
406
|
+
}
|
|
394
407
|
async list() {
|
|
395
408
|
const out = [];
|
|
396
409
|
for (const id of await readdir2(this.#root).catch(() => [])) {
|
|
@@ -405,22 +418,64 @@ var DraftStore = class {
|
|
|
405
418
|
const meta = JSON.parse(await readFile3(join3(dir, "draft.json"), "utf8"));
|
|
406
419
|
return { ...meta, manifest: await readFile3(join3(dir, MANIFEST_FILE), "utf8"), skill: await readFile3(join3(dir, SKILL_FILE), "utf8").catch(() => "") };
|
|
407
420
|
}
|
|
408
|
-
/** Install the draft as the user's pack. @returns the pack directory. */
|
|
421
|
+
/** Install the draft as the user's pack. @returns the pack directory, and whether a user pack was there before. */
|
|
409
422
|
async accept(packId, now = Date.now()) {
|
|
410
423
|
const draft = await this.get(packId);
|
|
411
424
|
parseManifest(draft.manifest);
|
|
412
425
|
const target = join3(this.#packs, packId);
|
|
413
|
-
const previous = await
|
|
414
|
-
if (previous) {
|
|
415
|
-
const aside = join3(this.#history, packId, new Date(now).toISOString().replace(/[:.]/g, "-"));
|
|
416
|
-
await mkdir(join3(this.#history, packId), { recursive: true });
|
|
417
|
-
await cp(target, aside, { recursive: true });
|
|
418
|
-
await rm(target, { recursive: true, force: true });
|
|
419
|
-
}
|
|
426
|
+
const previous = await this.#aside(packId, now);
|
|
420
427
|
await mkdir(this.#packs, { recursive: true });
|
|
421
428
|
await rename(join3(this.#root, packId), target);
|
|
422
429
|
await rm(join3(target, "draft.json"), { force: true });
|
|
423
|
-
return { dir: target, meta: draft };
|
|
430
|
+
return { dir: target, meta: draft, replaced: previous };
|
|
431
|
+
}
|
|
432
|
+
/** Move the user pack in use, if there is one, into the history. @returns whether there was one. */
|
|
433
|
+
async #aside(packId, now) {
|
|
434
|
+
const target = join3(this.#packs, packId);
|
|
435
|
+
if (!await readdir2(target).then(() => true, () => false))
|
|
436
|
+
return false;
|
|
437
|
+
const aside = join3(this.#history, packId, new Date(now).toISOString().replace(/[:.]/g, "-"));
|
|
438
|
+
await mkdir(join3(this.#history, packId), { recursive: true });
|
|
439
|
+
await cp(target, aside, { recursive: true });
|
|
440
|
+
await rm(target, { recursive: true, force: true });
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
/** The versions of a user pack that were replaced, the last replaced first. */
|
|
444
|
+
async history(packId) {
|
|
445
|
+
const out = [];
|
|
446
|
+
for (const id of await readdir2(join3(this.#history, packId)).catch(() => [])) {
|
|
447
|
+
const when = WHEN.exec(id);
|
|
448
|
+
const manifest = when === null ? void 0 : await readFile3(join3(this.#history, packId, id, MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
449
|
+
if (when !== null && manifest !== void 0)
|
|
450
|
+
out.push({ id, at: Date.parse(`${when[1]}:${when[2]}:${when[3]}.${when[4]}Z`), manifest });
|
|
451
|
+
}
|
|
452
|
+
return out.sort((a, b) => b.at - a.at);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Put a replaced version back in use. The pack in use now goes into the
|
|
456
|
+
* history in its place, so this can be undone the same way.
|
|
457
|
+
* @throws Error when there is no such version, or it no longer fits the schema (nothing is changed then).
|
|
458
|
+
*/
|
|
459
|
+
async restore(packId, versionId, now = Date.now()) {
|
|
460
|
+
const from = join3(this.#history, packId, versionId);
|
|
461
|
+
const manifest = WHEN.test(versionId) ? await readFile3(join3(from, MANIFEST_FILE), "utf8").catch(() => void 0) : void 0;
|
|
462
|
+
if (manifest === void 0)
|
|
463
|
+
throw new Error(`\u5386\u53F2\u91CC\u6CA1\u6709\u811A\u672C\u5305 ${packId} \u7684\u8FD9\u4E2A\u7248\u672C\uFF1A${versionId}`);
|
|
464
|
+
parseManifest(manifest, `\u5386\u53F2\u7248\u672C ${packId}/${MANIFEST_FILE}`);
|
|
465
|
+
const target = join3(this.#packs, packId);
|
|
466
|
+
await this.#aside(packId, now);
|
|
467
|
+
await mkdir(this.#packs, { recursive: true });
|
|
468
|
+
await rename(from, target);
|
|
469
|
+
return { dir: target };
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Stop using the user pack: it goes into the history, and the built-in pack
|
|
473
|
+
* of the same id (when there is one) is the pack again.
|
|
474
|
+
* @throws Error when there is no user pack of this id.
|
|
475
|
+
*/
|
|
476
|
+
async discard(packId, now = Date.now()) {
|
|
477
|
+
if (!await this.#aside(packId, now))
|
|
478
|
+
throw new Error(`\u6CA1\u6709\u81EA\u5DF1\u5199\u7684\u811A\u672C\u5305 ${packId}`);
|
|
424
479
|
}
|
|
425
480
|
async reject(packId) {
|
|
426
481
|
await rm(join3(this.#root, packId), { recursive: true, force: true });
|
|
@@ -467,6 +522,17 @@ var AdgAnalyzer = class extends Service {
|
|
|
467
522
|
this.drafts = new DraftStore(library.dataDir);
|
|
468
523
|
const drafts = this.drafts;
|
|
469
524
|
const changed = (packId) => ctx.get("adgGateway")?.broadcast("packs/changed", packId === void 0 ? {} : { packId });
|
|
525
|
+
const use = async (packId, scriptId) => {
|
|
526
|
+
await library.reloadPacks();
|
|
527
|
+
try {
|
|
528
|
+
await library.attachPack(scriptId, packId);
|
|
529
|
+
return void 0;
|
|
530
|
+
} catch (error) {
|
|
531
|
+
const problem = error instanceof Error ? error.message : String(error);
|
|
532
|
+
log.warn(`pack ${packId} saved but could not attach it to ${scriptId}: ${problem}`);
|
|
533
|
+
return problem;
|
|
534
|
+
}
|
|
535
|
+
};
|
|
470
536
|
ctx.inject(["skills", "adgGateway"], (scoped) => {
|
|
471
537
|
let disposers = [];
|
|
472
538
|
const register = async () => {
|
|
@@ -513,7 +579,7 @@ var AdgAnalyzer = class extends Service {
|
|
|
513
579
|
};
|
|
514
580
|
ctx.inject(["adgGateway"], (gateway) => gateway.adgGateway.agentPart("adg-analyzer tools", (agent) => {
|
|
515
581
|
const registered = [];
|
|
516
|
-
for (const tool of analyzerTools({ library, drafts, approve, ready: scripts.ready, changed }))
|
|
582
|
+
for (const tool of analyzerTools({ library, drafts, approve, ready: scripts.ready, changed, use }))
|
|
517
583
|
registered.push(agent.tools.register({ ...tool, execute: async (args, exec) => {
|
|
518
584
|
await ctx.get("adgGateway")?.guardTool(exec);
|
|
519
585
|
return tool.execute(args, exec);
|
|
@@ -538,12 +604,7 @@ var AdgAnalyzer = class extends Service {
|
|
|
538
604
|
await scripts.ready;
|
|
539
605
|
const { packId } = params;
|
|
540
606
|
const { dir, meta } = await drafts.accept(packId);
|
|
541
|
-
await
|
|
542
|
-
try {
|
|
543
|
-
await library.attachPack(meta.scriptId, packId);
|
|
544
|
-
} catch (error) {
|
|
545
|
-
log.warn(`accepted pack ${packId} but could not attach it to ${meta.scriptId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
546
|
-
}
|
|
607
|
+
await use(packId, meta.scriptId);
|
|
547
608
|
changed(packId);
|
|
548
609
|
return { packId, dir };
|
|
549
610
|
},
|
|
@@ -552,6 +613,39 @@ var AdgAnalyzer = class extends Service {
|
|
|
552
613
|
await drafts.reject(packId);
|
|
553
614
|
changed(packId);
|
|
554
615
|
return {};
|
|
616
|
+
},
|
|
617
|
+
"packs/history": async (params) => {
|
|
618
|
+
await scripts.ready;
|
|
619
|
+
const { packId } = params;
|
|
620
|
+
const tasksOf = (manifest) => {
|
|
621
|
+
try {
|
|
622
|
+
return parseManifest(manifest).tasks.map((t) => ({ id: t.id, title: t.title }));
|
|
623
|
+
} catch {
|
|
624
|
+
return [];
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
const items = (await drafts.history(packId)).map((v) => ({ id: v.id, at: v.at, tasks: tasksOf(v.manifest) }));
|
|
628
|
+
const over = library.pack(packId)?.over;
|
|
629
|
+
if (over !== void 0)
|
|
630
|
+
items.push({ id: BUILTIN_PACK_VERSION, builtin: true, tasks: over.manifest.tasks.map((t) => ({ id: t.id, title: t.title })) });
|
|
631
|
+
return { items };
|
|
632
|
+
},
|
|
633
|
+
"packs/restore": async (params) => {
|
|
634
|
+
await scripts.ready;
|
|
635
|
+
const { packId, version } = params;
|
|
636
|
+
if (version === BUILTIN_PACK_VERSION) {
|
|
637
|
+
if (library.pack(packId)?.over === void 0)
|
|
638
|
+
throw new Error(`${packId} \u6CA1\u6709\u5185\u7F6E\u7684\u811A\u672C\u5305\u53EF\u4EE5\u6062\u590D`);
|
|
639
|
+
await drafts.discard(packId);
|
|
640
|
+
} else {
|
|
641
|
+
await drafts.restore(packId, version);
|
|
642
|
+
}
|
|
643
|
+
await library.reloadPacks();
|
|
644
|
+
for (const script of library.list().scripts)
|
|
645
|
+
if (script.packId === packId)
|
|
646
|
+
await use(packId, script.id);
|
|
647
|
+
changed(packId);
|
|
648
|
+
return {};
|
|
555
649
|
}
|
|
556
650
|
}
|
|
557
651
|
});
|
|
@@ -676,7 +770,7 @@ function analyzerTools(deps) {
|
|
|
676
770
|
}),
|
|
677
771
|
tool({
|
|
678
772
|
name: "pack_reviewed",
|
|
679
|
-
description: "\u811A\u672C\u66F4\u65B0\u540E\u68C0\u67E5\u8FC7\u811A\u672C\u5305\u3001\u786E\u8BA4\u4E0D\u7528\u6539\u65F6\u8C03\u7528\uFF1A\u8BB0\u4E0B\u811A\u672C\u5305\u5DF2\u7ECF\u5BF9\u7167\u73B0\u5728\u7684\u7248\u672C\u68C0\u67E5\u8FC7\uFF0C\u4E0D\u518D\u63D0\u9192\u3002\u8981\u6539\u5C31\u7528 pack_propose \
|
|
773
|
+
description: "\u811A\u672C\u66F4\u65B0\u540E\u68C0\u67E5\u8FC7\u811A\u672C\u5305\u3001\u786E\u8BA4\u4E0D\u7528\u6539\u65F6\u8C03\u7528\uFF1A\u8BB0\u4E0B\u811A\u672C\u5305\u5DF2\u7ECF\u5BF9\u7167\u73B0\u5728\u7684\u7248\u672C\u68C0\u67E5\u8FC7\uFF0C\u4E0D\u518D\u63D0\u9192\u3002\u8981\u6539\u5C31\u7528 pack_propose \u4FDD\u5B58\uFF0C\u4FDD\u5B58\u65F6\u4F1A\u81EA\u52A8\u8BB0\u4E0B\uFF0C\u4E0D\u7528\u8C03\u7528\u8FD9\u4E2A\u3002",
|
|
680
774
|
properties: {
|
|
681
775
|
id,
|
|
682
776
|
reason: { type: "string", description: "\u4E3A\u4EC0\u4E48\u4E0D\u7528\u6539\uFF08\u4F1A\u544A\u8BC9\u7528\u6237\uFF09\uFF0C\u4F8B\u5982\u300C\u8FD9\u51E0\u4E2A\u7248\u672C\u53EA\u4FEE\u4E86\u8BC6\u522B\u95EE\u9898\uFF0C\u4EFB\u52A1\u3001\u914D\u7F6E\u548C\u65E5\u5FD7\u90FD\u6CA1\u53D8\u300D\u3002" }
|
|
@@ -692,12 +786,12 @@ function analyzerTools(deps) {
|
|
|
692
786
|
}),
|
|
693
787
|
tool({
|
|
694
788
|
name: "pack_propose",
|
|
695
|
-
description: "\
|
|
789
|
+
description: "\u4FDD\u5B58\u811A\u672C\u5305\uFF08adg.script.yaml \u548C SKILL.md\uFF09\uFF0C\u76F4\u63A5\u751F\u6548\uFF0C\u4E0D\u7528\u7528\u6237\u518D\u786E\u8BA4\uFF1A\u65B0\u5199\u4E00\u4EFD\uFF0C\u6216\u8005\u7528\u539F\u6765\u7684 id \u6539\u5DF2\u6709\u7684\u4E00\u4EFD\uFF08\u5185\u7F6E\u7684\u3001\u7528\u6237\u786E\u8BA4\u8FC7\u7684\u90FD\u53EF\u4EE5\uFF1B\u88AB\u66FF\u6362\u7684\u90A3\u4E00\u7248\u7559\u5728\u5386\u53F2\u91CC\uFF09\u3002\u4F1A\u6309 schema \u6821\u9A8C\uFF0C\u5E76\u68C0\u67E5 manifest \u91CC\u7ED9\u7528\u6237\u770B\u7684\u4F7F\u7528\u8BF4\u660E\uFF08guide\u3001\u4EFB\u52A1\u548C\u53C2\u6570\u7684 description\u3001\u4E34\u65F6\u4FEE\u6539\u7684 note\uFF09\uFF1A\u7F3A\u4E86\u6216\u6DF7\u8FDB\u4E86\u7ED9 agent \u7684\u5185\u5BB9\uFF08\u5DE5\u5177\u540D\u3001\u811A\u672C\u5305\u5B57\u6BB5\u3001\u5360\u4F4D\u7B26\u3001\u6838\u9A8C\u4F9D\u636E\u3001\u5F85\u786E\u8BA4\uFF09\u90FD\u4F1A\u5931\u8D25\u5E76\u8FD4\u56DE\u5177\u4F53\u4F4D\u7F6E\uFF0C\u811A\u672C\u5305\u4FDD\u6301\u539F\u6837\uFF0C\u4FEE\u6B63\u540E\u91CD\u65B0\u63D0\u4EA4\uFF1B\u901A\u8FC7\u540E\u8FD9\u4E2A\u811A\u672C\u9A6C\u4E0A\u7528\u65B0\u7684\u811A\u672C\u5305\uFF0C\u4E4B\u540E\u7684 script_run\u3001script_tasks \u90FD\u6309\u5B83\u6765\u3002\u4E0D\u4F1A\u4FEE\u6539\u811A\u672C\u672C\u8EAB\u3002",
|
|
696
790
|
properties: {
|
|
697
791
|
pack_id: { type: "string", description: "\u811A\u672C\u5305 id\uFF08\u4E0E manifest \u91CC\u7684 id \u76F8\u540C\uFF1B\u6539\u8FDB\u5DF2\u6709\u811A\u672C\u5305\u65F6\u7528\u539F id\uFF09\u3002" },
|
|
698
792
|
script_id: { type: "string", description: "\u8FD9\u4E2A\u5305\u63CF\u8FF0\u7684\u811A\u672C\u5E93\u91CC\u7684\u811A\u672C id\u3002" },
|
|
699
|
-
manifest: { type: "string", description: "adg.script.yaml \u7684\u5B8C\u6574\u5185\u5BB9\u3002" },
|
|
700
|
-
skill: { type: "string", description: "SKILL.md \u7684\u5B8C\u6574\u5185\u5BB9\uFF08\u4EE5 name / description frontmatter \u5F00\u5934\uFF09\u3002" },
|
|
793
|
+
manifest: { type: "string", description: "adg.script.yaml \u7684\u5B8C\u6574\u5185\u5BB9\uFF0C\u5305\u62EC guide\uFF08\u7ED9\u7528\u6237\u770B\u7684\u4F7F\u7528\u8BF4\u660E\uFF0C\u811A\u672C\u9875\u663E\u793A\uFF09\u3002" },
|
|
794
|
+
skill: { type: "string", description: "SKILL.md \u7684\u5B8C\u6574\u5185\u5BB9\uFF08\u4EE5 name / description frontmatter \u5F00\u5934\uFF09\uFF1A\u53EA\u7ED9 agent \u770B\u7684\u5907\u6CE8\u2014\u2014\u7528\u6237\u8BF4\u6CD5\u600E\u4E48\u5BF9\u5E94\u4EFB\u52A1\u3001\u64CD\u4F5C\u8981\u70B9\u3001\u6838\u9A8C\u4F9D\u636E\u3001\u9650\u5236\u3001\u5F85\u786E\u8BA4\u3002" },
|
|
701
795
|
summary: { type: "string", description: "\u7ED9\u7528\u6237\u770B\u7684\u4E00\u6BB5\u8BDD\uFF1A\u505A\u4E86\u4EC0\u4E48\u3001\u4F9D\u636E\u662F\u4EC0\u4E48\u3001\u54EA\u4E9B\u8FD8\u5F85\u786E\u8BA4\u3002" },
|
|
702
796
|
docs: {
|
|
703
797
|
type: "array",
|
|
@@ -708,7 +802,7 @@ function analyzerTools(deps) {
|
|
|
708
802
|
},
|
|
709
803
|
required: ["pack_id", "script_id", "manifest", "skill", "summary", "docs"],
|
|
710
804
|
kind: "edit",
|
|
711
|
-
title: (a) => `\
|
|
805
|
+
title: (a) => `\u4FDD\u5B58\u811A\u672C\u5305\uFF1A${String(a["pack_id"] ?? "")}`,
|
|
712
806
|
execute: async (args, exec) => {
|
|
713
807
|
const a = parse(external_exports.object({
|
|
714
808
|
pack_id: ScriptId,
|
|
@@ -724,7 +818,11 @@ function analyzerTools(deps) {
|
|
|
724
818
|
throw new Error("\u5148\u8BFB\u9879\u76EE\u7684\u6587\u6863\u518D\u5199\u811A\u672C\u5305\uFF1Adocs \u91CC\u5199\u51FA\u8BFB\u8FC7\u7684\u6587\u6863\uFF08\u51FA\u5904\u548C\u5F97\u5230\u4E86\u4EC0\u4E48\uFF09\uFF1B\u786E\u5B9E\u627E\u4E0D\u5230\u6587\u6863\u65F6\u7528 no_docs \u8BF4\u660E\u627E\u8FC7\u54EA\u4E9B\u5730\u65B9\uFF08\u811A\u672C\u76EE\u5F55\u3001\u4ED3\u5E93 README\u3001Wiki\u3001\u6587\u6863\u7AD9\uFF09");
|
|
725
819
|
}
|
|
726
820
|
deps.library.get(a.script_id);
|
|
727
|
-
const
|
|
821
|
+
const issues = guideIssues(parseManifest(a.manifest, `${a.pack_id}/${MANIFEST_FILE}`));
|
|
822
|
+
if (issues.length > 0)
|
|
823
|
+
throw new Error(`\u4F7F\u7528\u8BF4\u660E\u8FD8\u8981\u6539\uFF08\u6309 script-analysis \u6280\u80FD\u300C\u4F7F\u7528\u8BF4\u660E\u300D\u4E00\u8282\uFF09\uFF1A
|
|
824
|
+
- ${issues.join("\n- ")}`);
|
|
825
|
+
const saved = await deps.drafts.save({
|
|
728
826
|
packId: a.pack_id,
|
|
729
827
|
scriptId: a.script_id,
|
|
730
828
|
proposedAt: Date.now(),
|
|
@@ -733,8 +831,17 @@ function analyzerTools(deps) {
|
|
|
733
831
|
...docs.length > 0 || a.no_docs == null ? {} : { noDocs: a.no_docs.trim() },
|
|
734
832
|
...exec.agent === void 0 ? {} : { sessionId: exec.agent.session.id }
|
|
735
833
|
}, a.manifest, a.skill);
|
|
834
|
+
const problem = await deps.use(a.pack_id, a.script_id);
|
|
736
835
|
deps.changed(a.pack_id);
|
|
737
|
-
return {
|
|
836
|
+
return {
|
|
837
|
+
ok: true,
|
|
838
|
+
pack_id: a.pack_id,
|
|
839
|
+
tasks: saved.tasks,
|
|
840
|
+
in_use: problem === void 0,
|
|
841
|
+
replaced: saved.replaced,
|
|
842
|
+
...problem === void 0 ? {} : { problem },
|
|
843
|
+
next: problem === void 0 ? `\u811A\u672C\u5305\u5DF2\u7ECF\u4FDD\u5B58\u5E76\u751F\u6548${saved.replaced ? "\uFF08\u4E4B\u524D\u7684\u7248\u672C\u7559\u5728\u5386\u53F2\u91CC\uFF09" : ""}\uFF0C\u4E0D\u7528\u7528\u6237\u786E\u8BA4\u3002\u56DE\u590D\u91CC\u544A\u8BC9\u7528\u6237\u6539\u4E86\u4EC0\u4E48\u3001\u4F9D\u636E\u4E86\u54EA\u4E9B\u6587\u6863\u3001\u54EA\u4E9B\u8FD8\u5F85\u786E\u8BA4\u3002` : `\u811A\u672C\u5305\u5DF2\u7ECF\u4FDD\u5B58\uFF0C\u4F46\u6CA1\u80FD\u63A5\u5230\u811A\u672C ${a.script_id} \u4E0A\uFF1A${problem}\u3002\u628A\u8FD9\u4E2A\u539F\u56E0\u544A\u8BC9\u7528\u6237\u3002`
|
|
844
|
+
};
|
|
738
845
|
}
|
|
739
846
|
})
|
|
740
847
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
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-TD4YFQWE.js";
|
|
5
5
|
import {
|
|
6
6
|
writeFileAtomic
|
|
7
7
|
} from "./chunk-CCAB6XXZ.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
threadMessage,
|
|
22
22
|
threadReminder,
|
|
23
23
|
threadsBetween
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BTT2GBTQ.js";
|
|
25
25
|
|
|
26
26
|
// packages/notify/lib/index.js
|
|
27
27
|
import { readFile } from "node:fs/promises";
|
|
@@ -206,6 +206,9 @@ function createHandOffDesk(deps) {
|
|
|
206
206
|
return `\u8FD9\u4EF6\u4E8B\u7684\u6765\u56DE\u5DF2\u7ECF\u591F\u591A\u4E86\uFF08${MAX_CHAIN_MESSAGES} \u6761\uFF09\uFF1A\u7528\u4F60\u624B\u4E0A\u7684\u4FE1\u606F\u505A\u5B8C\uFF0C\u5728\u7ED3\u8BBA\u91CC\u8BF4\u6E05\u695A\u7F3A\u4EC0\u4E48`;
|
|
207
207
|
return void 0;
|
|
208
208
|
},
|
|
209
|
+
waitingOn(sessionId) {
|
|
210
|
+
return [...live.values()].some((t) => t.item.fromSession === sessionId && t.conclusion === void 0);
|
|
211
|
+
},
|
|
209
212
|
askRefusal(sessionId) {
|
|
210
213
|
const thread = workingOn(sessionId);
|
|
211
214
|
if (thread?.item.callId === void 0 || thread.item.fromSession === "")
|