@agentforge/skills 0.16.41 → 0.16.43
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/dist/index.cjs +200 -349
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -227
- package/dist/index.d.ts +1 -227
- package/dist/index.js +200 -349
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -378,257 +378,31 @@ declare function createReadSkillResourceTool(registry: SkillRegistry): Tool<z.in
|
|
|
378
378
|
*/
|
|
379
379
|
declare function createSkillActivationTools(registry: SkillRegistry): [Tool<z.infer<typeof activateSkillSchema>, string>, Tool<z.infer<typeof readSkillResourceSchema>, string>];
|
|
380
380
|
|
|
381
|
-
/**
|
|
382
|
-
* Skill Registry
|
|
383
|
-
*
|
|
384
|
-
* Central registry for discovering, storing, and querying Agent Skills.
|
|
385
|
-
* Mirrors ToolRegistry but uses folder-based auto-discovery instead
|
|
386
|
-
* of programmatic registration.
|
|
387
|
-
*
|
|
388
|
-
* @see https://agentskills.io/specification
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* ```ts
|
|
392
|
-
* const registry = new SkillRegistry({
|
|
393
|
-
* skillRoots: ['.agentskills', '~/.agentskills'],
|
|
394
|
-
* });
|
|
395
|
-
*
|
|
396
|
-
* // Query discovered skills
|
|
397
|
-
* const skill = registry.get('code-review');
|
|
398
|
-
* const allSkills = registry.getAll();
|
|
399
|
-
*
|
|
400
|
-
* // Listen for events
|
|
401
|
-
* registry.on(SkillRegistryEvent.SKILL_DISCOVERED, (skill) => {
|
|
402
|
-
* console.log('Found skill:', skill.metadata.name);
|
|
403
|
-
* });
|
|
404
|
-
* ```
|
|
405
|
-
*/
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Skill Registry — auto-discovers skills from configured folder paths.
|
|
409
|
-
*
|
|
410
|
-
* Parallel to ToolRegistry:
|
|
411
|
-
* | ToolRegistry | SkillRegistry |
|
|
412
|
-
* |--------------------------|------------------------------------------|
|
|
413
|
-
* | registry.register(tool) | new SkillRegistry({ skillRoots }) |
|
|
414
|
-
* | registry.get('name') | skillRegistry.get('name') |
|
|
415
|
-
* | registry.getAll() | skillRegistry.getAll() |
|
|
416
|
-
* | registry.has('name') | skillRegistry.has('name') |
|
|
417
|
-
* | registry.size() | skillRegistry.size() |
|
|
418
|
-
* | registry.generatePrompt()| skillRegistry.generatePrompt() |
|
|
419
|
-
* | registry.toLangChainTools()| skillRegistry.toActivationTools() |
|
|
420
|
-
*/
|
|
421
381
|
declare class SkillRegistry {
|
|
422
382
|
private skills;
|
|
423
383
|
private eventHandlers;
|
|
424
384
|
private readonly config;
|
|
425
385
|
private scanErrors;
|
|
426
|
-
/** Maps resolved root paths → trust levels for skill trust assignment */
|
|
427
386
|
private rootTrustMap;
|
|
428
|
-
/**
|
|
429
|
-
* Create a SkillRegistry and immediately scan configured roots for skills.
|
|
430
|
-
*
|
|
431
|
-
* @param config - Registry configuration with skill root paths
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* ```ts
|
|
435
|
-
* const registry = new SkillRegistry({
|
|
436
|
-
* skillRoots: ['.agentskills', '~/.agentskills', './project-skills'],
|
|
437
|
-
* });
|
|
438
|
-
* console.log(`Discovered ${registry.size()} skills`);
|
|
439
|
-
* ```
|
|
440
|
-
*/
|
|
441
387
|
constructor(config: SkillRegistryConfig);
|
|
442
|
-
/**
|
|
443
|
-
* Scan all configured roots and populate the registry.
|
|
444
|
-
*
|
|
445
|
-
* Called automatically during construction. Can be called again
|
|
446
|
-
* to re-scan (clears existing skills first).
|
|
447
|
-
*/
|
|
448
388
|
discover(): void;
|
|
449
|
-
/**
|
|
450
|
-
* Get a skill by name.
|
|
451
|
-
*
|
|
452
|
-
* @param name - The skill name
|
|
453
|
-
* @returns The skill, or undefined if not found
|
|
454
|
-
*
|
|
455
|
-
* @example
|
|
456
|
-
* ```ts
|
|
457
|
-
* const skill = registry.get('code-review');
|
|
458
|
-
* if (skill) {
|
|
459
|
-
* console.log(skill.metadata.description);
|
|
460
|
-
* }
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
389
|
get(name: string): Skill | undefined;
|
|
464
|
-
/**
|
|
465
|
-
* Get all discovered skills.
|
|
466
|
-
*
|
|
467
|
-
* @returns Array of all skills
|
|
468
|
-
*
|
|
469
|
-
* @example
|
|
470
|
-
* ```ts
|
|
471
|
-
* const allSkills = registry.getAll();
|
|
472
|
-
* console.log(`Total skills: ${allSkills.length}`);
|
|
473
|
-
* ```
|
|
474
|
-
*/
|
|
475
390
|
getAll(): Skill[];
|
|
476
|
-
/**
|
|
477
|
-
* Check if a skill exists in the registry.
|
|
478
|
-
*
|
|
479
|
-
* @param name - The skill name
|
|
480
|
-
* @returns True if the skill exists
|
|
481
|
-
*
|
|
482
|
-
* @example
|
|
483
|
-
* ```ts
|
|
484
|
-
* if (registry.has('code-review')) {
|
|
485
|
-
* console.log('Skill available!');
|
|
486
|
-
* }
|
|
487
|
-
* ```
|
|
488
|
-
*/
|
|
489
391
|
has(name: string): boolean;
|
|
490
|
-
/**
|
|
491
|
-
* Get the number of discovered skills.
|
|
492
|
-
*
|
|
493
|
-
* @returns Number of skills in the registry
|
|
494
|
-
*
|
|
495
|
-
* @example
|
|
496
|
-
* ```ts
|
|
497
|
-
* console.log(`Registry has ${registry.size()} skills`);
|
|
498
|
-
* ```
|
|
499
|
-
*/
|
|
500
392
|
size(): number;
|
|
501
|
-
/**
|
|
502
|
-
* Get all skill names.
|
|
503
|
-
*
|
|
504
|
-
* @returns Array of skill names
|
|
505
|
-
*/
|
|
506
393
|
getNames(): string[];
|
|
507
|
-
/**
|
|
508
|
-
* Get errors/warnings from the last scan.
|
|
509
|
-
*
|
|
510
|
-
* Useful for diagnostics and observability.
|
|
511
|
-
*
|
|
512
|
-
* @returns Array of scan errors with paths
|
|
513
|
-
*/
|
|
514
394
|
getScanErrors(): ReadonlyArray<{
|
|
515
395
|
path: string;
|
|
516
396
|
error: string;
|
|
517
397
|
}>;
|
|
518
|
-
/**
|
|
519
|
-
* Check whether untrusted script access is allowed via config override.
|
|
520
|
-
*
|
|
521
|
-
* Used by activation tools to pass the override flag to trust policy checks.
|
|
522
|
-
*
|
|
523
|
-
* @returns True if `allowUntrustedScripts` is set in config
|
|
524
|
-
*/
|
|
525
398
|
getAllowUntrustedScripts(): boolean;
|
|
526
|
-
/**
|
|
527
|
-
* Get the `allowed-tools` list for a skill.
|
|
528
|
-
*
|
|
529
|
-
* Returns the `allowedTools` array from the skill's frontmatter metadata,
|
|
530
|
-
* enabling agents to filter their tool set based on what the skill expects.
|
|
531
|
-
*
|
|
532
|
-
* @param name - The skill name
|
|
533
|
-
* @returns Array of allowed tool names, or undefined if skill not found or field not set
|
|
534
|
-
*
|
|
535
|
-
* @example
|
|
536
|
-
* ```ts
|
|
537
|
-
* const allowed = registry.getAllowedTools('code-review');
|
|
538
|
-
* if (allowed) {
|
|
539
|
-
* const filteredTools = allTools.filter(t => allowed.includes(t.name));
|
|
540
|
-
* }
|
|
541
|
-
* ```
|
|
542
|
-
*/
|
|
543
399
|
getAllowedTools(name: string): string[] | undefined;
|
|
544
|
-
/**
|
|
545
|
-
* Generate an `<available_skills>` XML block for system prompt injection.
|
|
546
|
-
*
|
|
547
|
-
* Returns an empty string when:
|
|
548
|
-
* - `config.enabled` is `false` (default) — agents operate with unmodified prompts
|
|
549
|
-
* - No skills match the filter criteria
|
|
550
|
-
*
|
|
551
|
-
* The output composes naturally with `toolRegistry.generatePrompt()` —
|
|
552
|
-
* simply concatenate both into the system prompt.
|
|
553
|
-
*
|
|
554
|
-
* @param options - Optional filtering (subset of skill names)
|
|
555
|
-
* @returns XML string or empty string
|
|
556
|
-
*
|
|
557
|
-
* @example
|
|
558
|
-
* ```ts
|
|
559
|
-
* // All skills
|
|
560
|
-
* const xml = registry.generatePrompt();
|
|
561
|
-
*
|
|
562
|
-
* // Subset for a focused agent
|
|
563
|
-
* const xml = registry.generatePrompt({ skills: ['code-review', 'testing'] });
|
|
564
|
-
*
|
|
565
|
-
* // Compose with tool prompt
|
|
566
|
-
* const systemPrompt = [
|
|
567
|
-
* toolRegistry.generatePrompt(),
|
|
568
|
-
* skillRegistry.generatePrompt(),
|
|
569
|
-
* ].filter(Boolean).join('\n\n');
|
|
570
|
-
* ```
|
|
571
|
-
*/
|
|
572
400
|
generatePrompt(options?: SkillPromptOptions): string;
|
|
573
|
-
/**
|
|
574
|
-
* Register an event handler.
|
|
575
|
-
*
|
|
576
|
-
* @param event - The event to listen for
|
|
577
|
-
* @param handler - The handler function
|
|
578
|
-
*
|
|
579
|
-
* @example
|
|
580
|
-
* ```ts
|
|
581
|
-
* registry.on(SkillRegistryEvent.SKILL_DISCOVERED, (skill) => {
|
|
582
|
-
* console.log('Found skill:', skill.metadata.name);
|
|
583
|
-
* });
|
|
584
|
-
* ```
|
|
585
|
-
*/
|
|
586
401
|
on(event: SkillRegistryEvent, handler: SkillEventHandler): void;
|
|
587
|
-
/**
|
|
588
|
-
* Unregister an event handler.
|
|
589
|
-
*
|
|
590
|
-
* @param event - The event to stop listening for
|
|
591
|
-
* @param handler - The handler function to remove
|
|
592
|
-
*/
|
|
593
402
|
off(event: SkillRegistryEvent, handler: SkillEventHandler): void;
|
|
594
|
-
/**
|
|
595
|
-
* Emit an event to all registered handlers.
|
|
596
|
-
*
|
|
597
|
-
* @param event - The event to emit
|
|
598
|
-
* @param data - The event data
|
|
599
|
-
* @private
|
|
600
|
-
*/
|
|
601
|
-
private emit;
|
|
602
|
-
/**
|
|
603
|
-
* Emit an event (public API for activation tools).
|
|
604
|
-
*
|
|
605
|
-
* Used by skill activation tools to emit `skill:activated` and
|
|
606
|
-
* `skill:resource-loaded` events through the registry's event system.
|
|
607
|
-
*
|
|
608
|
-
* @param event - The event to emit
|
|
609
|
-
* @param data - The event data
|
|
610
|
-
*/
|
|
611
403
|
emitEvent(event: SkillRegistryEvent, data: unknown): void;
|
|
612
|
-
/**
|
|
613
|
-
* Create activation tools pre-wired to this registry instance.
|
|
614
|
-
*
|
|
615
|
-
* Returns `activate-skill` and `read-skill-resource` tools that
|
|
616
|
-
* agents can use to load skill instructions and resources on demand.
|
|
617
|
-
*
|
|
618
|
-
* @returns Array of [activate-skill, read-skill-resource] tools
|
|
619
|
-
*
|
|
620
|
-
* @example
|
|
621
|
-
* ```ts
|
|
622
|
-
* const agent = createReActAgent({
|
|
623
|
-
* model: llm,
|
|
624
|
-
* tools: [
|
|
625
|
-
* ...toolRegistry.toLangChainTools(),
|
|
626
|
-
* ...skillRegistry.toActivationTools(),
|
|
627
|
-
* ],
|
|
628
|
-
* });
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
404
|
toActivationTools(): ReturnType<typeof createSkillActivationTools>;
|
|
405
|
+
private emit;
|
|
632
406
|
}
|
|
633
407
|
|
|
634
408
|
/**
|