MCPcopy Create free account
hub / github.com/antgroup/agent-aegis / enqueueFile

Method enqueueFile

src/scan-service.ts:537–724  ·  view source on GitHub ↗
(filePath: string, sourceRoot: string)

Source from the content-addressed store, hash-verified

535 }
536
537 private async enqueueFile(filePath: string, sourceRoot: string): Promise<SkillScanJobResult> {
538 const startedAt = this.now();
539 this.logSkillScanStart({
540 phase: "queue",
541 path: filePath,
542 sourceRoot,
543 });
544 this.clearCooldownIfElapsed();
545 if (this.isCooldownActive()) {
546 const durationMs = this.now() - startedAt;
547 this.params.logger.warn("claw-aegis: 冷却期间已跳过 skill 扫描", {
548 event: "skill_scan_skipped",
549 state: "cooldown",
550 path: filePath,
551 durationMs,
552 });
553 this.logSkillScanFinish({
554 phase: "queue",
555 path: filePath,
556 sourceRoot,
557 result: "skipped_cooldown",
558 durationMs,
559 });
560 return { status: "skipped-cooldown" };
561 }
562 if (path.basename(filePath) !== SKILL_SCAN_TARGET_FILENAME) {
563 const durationMs = this.now() - startedAt;
564 this.logSkillScanResult({
565 phase: "queue",
566 path: filePath,
567 sourceRoot,
568 result: "ignored_non_skill_file",
569 durationMs,
570 });
571 this.logSkillScanFinish({
572 phase: "queue",
573 path: filePath,
574 sourceRoot,
575 result: "ignored_non_skill_file",
576 durationMs,
577 });
578 return { status: "already-reviewed" };
579 }
580
581 let prepared: PreparedSkillFile | null;
582 try {
583 prepared = await this.prepareSkillFile(filePath, sourceRoot);
584 } catch {
585 prepared = null;
586 }
587 if (!prepared) {
588 const durationMs = this.now() - startedAt;
589 this.logSkillScanResult({
590 phase: "queue",
591 path: filePath,
592 sourceRoot,
593 result: "ignored_unreadable",
594 durationMs,

Callers 1

scanRootMethod · 0.95

Calls 10

nowMethod · 0.95
logSkillScanStartMethod · 0.95
isCooldownActiveMethod · 0.95
logSkillScanFinishMethod · 0.95
logSkillScanResultMethod · 0.95
prepareSkillFileMethod · 0.95
syncWorkerHealthMethod · 0.95
processNextMethod · 0.95
getSkillAssessmentMethod · 0.45

Tested by

no test coverage detected