@agentforge/skills 0.15.0

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.
@@ -0,0 +1,682 @@
1
+ import { z } from 'zod';
2
+ import { Tool } from '@agentforge/core';
3
+
4
+ /**
5
+ * Skill System Types
6
+ *
7
+ * Core type definitions for the AgentForge Agent Skills system.
8
+ * These types align with the Agent Skills specification (https://agentskills.io/specification).
9
+ */
10
+ /**
11
+ * Trust level for a skill root directory.
12
+ *
13
+ * - `workspace` — Skills from the project workspace (highest trust, scripts allowed)
14
+ * - `trusted` — Explicitly trusted skill roots (scripts allowed)
15
+ * - `untrusted` — Untrusted roots like community packs (scripts blocked by default)
16
+ */
17
+ type TrustLevel = 'workspace' | 'trusted' | 'untrusted';
18
+ /**
19
+ * Configuration for a skill root with an explicit trust level.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const roots: SkillRootConfig[] = [
24
+ * { path: '.agentskills', trust: 'workspace' },
25
+ * { path: '~/.agentskills', trust: 'trusted' },
26
+ * { path: '/shared/community-skills', trust: 'untrusted' },
27
+ * ];
28
+ * ```
29
+ */
30
+ interface SkillRootConfig {
31
+ /** Directory path to scan for skills */
32
+ path: string;
33
+ /** Trust level assigned to all skills discovered from this root */
34
+ trust: TrustLevel;
35
+ }
36
+ /**
37
+ * Policy decision returned by trust enforcement checks.
38
+ */
39
+ interface TrustPolicyDecision {
40
+ /** Whether the action is allowed */
41
+ allowed: boolean;
42
+ /** Machine-readable reason code for auditing */
43
+ reason: TrustPolicyReason;
44
+ /** Human-readable explanation */
45
+ message: string;
46
+ }
47
+ /**
48
+ * Reason codes for trust policy decisions.
49
+ *
50
+ * Used for structured logging and auditing of guardrail behavior.
51
+ */
52
+ declare enum TrustPolicyReason {
53
+ /** Resource is not a script — no trust check needed */
54
+ NOT_SCRIPT = "not-script",
55
+ /** Skill root has workspace trust — scripts allowed */
56
+ WORKSPACE_TRUST = "workspace-trust",
57
+ /** Skill root has explicit trusted status — scripts allowed */
58
+ TRUSTED_ROOT = "trusted-root",
59
+ /** Skill root is untrusted — scripts denied by default */
60
+ UNTRUSTED_SCRIPT_DENIED = "untrusted-script-denied",
61
+ /** Untrusted script access was explicitly allowed via config override */
62
+ UNTRUSTED_SCRIPT_ALLOWED = "untrusted-script-allowed-override",
63
+ /** Trust level is unknown — treated as untrusted for security */
64
+ UNKNOWN_TRUST_LEVEL = "unknown-trust-level"
65
+ }
66
+ /**
67
+ * Parsed metadata from a SKILL.md frontmatter block.
68
+ *
69
+ * Required fields: `name`, `description`.
70
+ * All other fields are optional per the Agent Skills spec.
71
+ */
72
+ interface SkillMetadata {
73
+ /** Skill name (1-64 chars, lowercase alphanumeric + hyphens, must match parent dir name) */
74
+ name: string;
75
+ /** Human-readable description (1-1024 chars) */
76
+ description: string;
77
+ /** SPDX license identifier */
78
+ license?: string;
79
+ /** List of compatible agent frameworks / tool hosts */
80
+ compatibility?: string[];
81
+ /** Arbitrary key-value metadata (author, version, etc.) */
82
+ metadata?: Record<string, unknown>;
83
+ /** Tools that this skill is allowed to use */
84
+ allowedTools?: string[];
85
+ }
86
+ /**
87
+ * A fully resolved skill entry in the registry.
88
+ *
89
+ * Contains parsed metadata plus internal tracking fields
90
+ * that are not part of the SKILL.md frontmatter.
91
+ */
92
+ interface Skill {
93
+ /** Parsed frontmatter metadata */
94
+ metadata: SkillMetadata;
95
+ /** Absolute path to the skill directory */
96
+ skillPath: string;
97
+ /** Which configured skill root this was discovered from */
98
+ rootPath: string;
99
+ /** Trust level assigned to this skill (inherited from root config) */
100
+ trustLevel: TrustLevel;
101
+ }
102
+ /**
103
+ * Configuration for the SkillRegistry.
104
+ */
105
+ interface SkillRegistryConfig {
106
+ /**
107
+ * Array of directory paths to scan for skills.
108
+ *
109
+ * Each entry can be a plain string (defaults to `'untrusted'` trust level)
110
+ * or a `SkillRootConfig` object with an explicit trust level.
111
+ *
112
+ * Paths may be absolute or relative (resolved against `cwd`).
113
+ * The `~` prefix is expanded to `$HOME`.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * // Simple string roots (default to 'untrusted')
118
+ * skillRoots: ['.agentskills', '~/.agentskills']
119
+ *
120
+ * // Trust-aware roots
121
+ * skillRoots: [
122
+ * { path: '.agentskills', trust: 'workspace' },
123
+ * { path: '~/.agentskills', trust: 'trusted' },
124
+ * { path: '/shared/community', trust: 'untrusted' },
125
+ * ]
126
+ * ```
127
+ */
128
+ skillRoots: Array<string | SkillRootConfig>;
129
+ /**
130
+ * Feature flag to enable Agent Skills in system prompts.
131
+ *
132
+ * When `false` (default), `generatePrompt()` returns an empty string
133
+ * so agents operate with unmodified system prompts.
134
+ *
135
+ * @default false
136
+ */
137
+ enabled?: boolean;
138
+ /**
139
+ * Maximum number of skills to include in generated prompts.
140
+ *
141
+ * Caps prompt token usage when many skills are discovered.
142
+ * Skills are included in discovery order (first root first).
143
+ * When undefined, all discovered skills are included.
144
+ */
145
+ maxDiscoveredSkills?: number;
146
+ /**
147
+ * Allow script resources from untrusted roots.
148
+ *
149
+ * When `true`, scripts from `scripts/` directories in untrusted
150
+ * skill roots are returned instead of being denied. This disables
151
+ * the default-deny policy for untrusted scripts.
152
+ *
153
+ * **Security warning:** Only enable when you have reviewed all
154
+ * skill packs from untrusted roots.
155
+ *
156
+ * @default false
157
+ */
158
+ allowUntrustedScripts?: boolean;
159
+ }
160
+ /**
161
+ * Options for `SkillRegistry.generatePrompt()`.
162
+ */
163
+ interface SkillPromptOptions {
164
+ /**
165
+ * Subset of skill names to include in the generated prompt.
166
+ *
167
+ * When provided, only skills matching these names appear in the
168
+ * `<available_skills>` XML block. This enables creating focused
169
+ * agents with different skill sets from the same registry.
170
+ *
171
+ * When omitted or empty, all discovered skills are included.
172
+ *
173
+ * @example ['code-review', 'testing-strategy']
174
+ */
175
+ skills?: string[];
176
+ }
177
+ /**
178
+ * Events emitted by the SkillRegistry during discovery and usage.
179
+ */
180
+ declare enum SkillRegistryEvent {
181
+ /** Emitted when a valid skill is discovered during scanning */
182
+ SKILL_DISCOVERED = "skill:discovered",
183
+ /** Emitted when a skill parse or validation issue is encountered */
184
+ SKILL_WARNING = "skill:warning",
185
+ /** Emitted when a skill is activated (full body loaded) */
186
+ SKILL_ACTIVATED = "skill:activated",
187
+ /** Emitted when a skill resource file is loaded */
188
+ SKILL_RESOURCE_LOADED = "skill:resource-loaded",
189
+ /** Emitted when a trust policy denies access to a resource */
190
+ TRUST_POLICY_DENIED = "trust:policy-denied",
191
+ /** Emitted when a trust policy allows access (for auditing) */
192
+ TRUST_POLICY_ALLOWED = "trust:policy-allowed"
193
+ }
194
+ /**
195
+ * Event handler type for skill registry events.
196
+ */
197
+ type SkillEventHandler = (data: unknown) => void;
198
+ /**
199
+ * Result of parsing a single SKILL.md file.
200
+ */
201
+ interface SkillParseResult {
202
+ /** Whether parsing and validation succeeded */
203
+ success: boolean;
204
+ /** Parsed metadata (present when success is true) */
205
+ metadata?: SkillMetadata;
206
+ /** The raw markdown body below the frontmatter (present when success is true) */
207
+ body?: string;
208
+ /** Error description (present when success is false) */
209
+ error?: string;
210
+ }
211
+ /**
212
+ * Validation error detail.
213
+ */
214
+ interface SkillValidationError {
215
+ /** Which field failed validation */
216
+ field: string;
217
+ /** Human-readable error message */
218
+ message: string;
219
+ }
220
+
221
+ /**
222
+ * SKILL.md Frontmatter Parser
223
+ *
224
+ * Parses YAML frontmatter from SKILL.md files and validates
225
+ * against the Agent Skills specification constraints.
226
+ *
227
+ * @see https://agentskills.io/specification
228
+ */
229
+
230
+ /**
231
+ * Validate the `name` field per the Agent Skills spec.
232
+ *
233
+ * @param name - The name value from frontmatter
234
+ * @returns Array of validation errors (empty = valid)
235
+ */
236
+ declare function validateSkillName(name: unknown): SkillValidationError[];
237
+ /**
238
+ * Validate the `description` field per the Agent Skills spec.
239
+ *
240
+ * @param description - The description value from frontmatter
241
+ * @returns Array of validation errors (empty = valid)
242
+ */
243
+ declare function validateSkillDescription(description: unknown): SkillValidationError[];
244
+ /**
245
+ * Validate that the skill name matches its parent directory name (per spec).
246
+ *
247
+ * @param name - The name from frontmatter
248
+ * @param dirName - The parent directory name
249
+ * @returns Array of validation errors (empty = valid)
250
+ */
251
+ declare function validateSkillNameMatchesDir(name: string, dirName: string): SkillValidationError[];
252
+ /**
253
+ * Parse and validate a SKILL.md file's raw content.
254
+ *
255
+ * Extracts YAML frontmatter using gray-matter, then validates
256
+ * required and optional fields against spec constraints.
257
+ *
258
+ * @param content - Raw file content of the SKILL.md
259
+ * @param dirName - Parent directory name for name-match validation
260
+ * @returns Parse result with metadata or error
261
+ */
262
+ declare function parseSkillContent(content: string, dirName: string): SkillParseResult;
263
+
264
+ /**
265
+ * Skill Directory Scanner
266
+ *
267
+ * Scans configured skill roots for directories containing valid SKILL.md files.
268
+ * Returns a list of candidate skill paths for the parser to process.
269
+ */
270
+ /**
271
+ * Discovered skill candidate — a directory containing a SKILL.md file.
272
+ */
273
+ interface SkillCandidate {
274
+ /** Absolute path to the skill directory */
275
+ skillPath: string;
276
+ /** The parent directory name (expected to match the skill name) */
277
+ dirName: string;
278
+ /** Raw content of the SKILL.md file */
279
+ content: string;
280
+ /** Which configured root this came from */
281
+ rootPath: string;
282
+ }
283
+ /**
284
+ * Expand `~` prefix to the user's home directory.
285
+ */
286
+ declare function expandHome(p: string): string;
287
+ /**
288
+ * Scan a single skill root for directories containing SKILL.md.
289
+ *
290
+ * @param rootPath - The root directory to scan (may not exist)
291
+ * @returns Array of valid skill candidates found under this root
292
+ */
293
+ declare function scanSkillRoot(rootPath: string): SkillCandidate[];
294
+ /**
295
+ * Scan multiple skill roots for directories containing SKILL.md.
296
+ *
297
+ * @param skillRoots - Array of root paths to scan
298
+ * @returns Array of all skill candidates found across all roots
299
+ */
300
+ declare function scanAllSkillRoots(skillRoots: string[]): SkillCandidate[];
301
+
302
+ /**
303
+ * Skill Activation Tools
304
+ *
305
+ * Provides `activate-skill` and `read-skill-resource` tools built with
306
+ * the AgentForge tool builder API. These tools enable agents to load
307
+ * skill instructions on demand and access skill resources at runtime.
308
+ *
309
+ * @see https://agentskills.io/specification
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * const [activateSkill, readSkillResource] = createSkillActivationTools(registry);
314
+ * // activateSkill — load full SKILL.md body
315
+ * // readSkillResource — load a resource file from a skill
316
+ *
317
+ * // Or use the convenience method:
318
+ * const [activateSkill, readSkillResource] = registry.toActivationTools();
319
+ * ```
320
+ */
321
+
322
+ declare const activateSkillSchema: z.ZodObject<{
323
+ name: z.ZodString;
324
+ }, "strip", z.ZodTypeAny, {
325
+ name: string;
326
+ }, {
327
+ name: string;
328
+ }>;
329
+ declare const readSkillResourceSchema: z.ZodObject<{
330
+ name: z.ZodString;
331
+ path: z.ZodString;
332
+ }, "strip", z.ZodTypeAny, {
333
+ name: string;
334
+ path: string;
335
+ }, {
336
+ name: string;
337
+ path: string;
338
+ }>;
339
+ /**
340
+ * Resolve a resource path within a skill root, blocking path traversal.
341
+ *
342
+ * @param skillPath - Absolute path to the skill directory
343
+ * @param resourcePath - Relative path to the resource file
344
+ * @returns Absolute path to the resource, or an error string
345
+ */
346
+ declare function resolveResourcePath(skillPath: string, resourcePath: string): {
347
+ success: true;
348
+ resolvedPath: string;
349
+ } | {
350
+ success: false;
351
+ error: string;
352
+ };
353
+ /**
354
+ * Create the `activate-skill` tool bound to a registry instance.
355
+ *
356
+ * Resolves the skill by name, reads the full SKILL.md file, and returns
357
+ * the body content (below frontmatter).
358
+ *
359
+ * @param registry - The SkillRegistry to resolve skills from
360
+ * @returns An AgentForge Tool
361
+ */
362
+ declare function createActivateSkillTool(registry: SkillRegistry): Tool<z.infer<typeof activateSkillSchema>, string>;
363
+ /**
364
+ * Create the `read-skill-resource` tool bound to a registry instance.
365
+ *
366
+ * Resolves the skill by name, validates the resource path (blocking
367
+ * traversal), and returns the file content.
368
+ *
369
+ * @param registry - The SkillRegistry to resolve skills from
370
+ * @returns An AgentForge Tool
371
+ */
372
+ declare function createReadSkillResourceTool(registry: SkillRegistry): Tool<z.infer<typeof readSkillResourceSchema>, string>;
373
+ /**
374
+ * Create both skill activation tools bound to a registry instance.
375
+ *
376
+ * @param registry - The SkillRegistry to bind tools to
377
+ * @returns Array of both tools [activate-skill, read-skill-resource]
378
+ */
379
+ declare function createSkillActivationTools(registry: SkillRegistry): [Tool<z.infer<typeof activateSkillSchema>, string>, Tool<z.infer<typeof readSkillResourceSchema>, string>];
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
+ declare class SkillRegistry {
422
+ private skills;
423
+ private eventHandlers;
424
+ private readonly config;
425
+ private scanErrors;
426
+ /** Maps resolved root paths → trust levels for skill trust assignment */
427
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ size(): number;
501
+ /**
502
+ * Get all skill names.
503
+ *
504
+ * @returns Array of skill names
505
+ */
506
+ 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
+ getScanErrors(): ReadonlyArray<{
515
+ path: string;
516
+ error: string;
517
+ }>;
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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ toActivationTools(): ReturnType<typeof createSkillActivationTools>;
632
+ }
633
+
634
+ /**
635
+ * Skill Trust Policy Engine
636
+ *
637
+ * Enforces trust-level-based access control for skill resources.
638
+ * Scripts from untrusted roots are denied by default unless explicitly allowed.
639
+ *
640
+ * Trust levels:
641
+ * - `workspace` — Project-local skills, highest trust. Scripts always allowed.
642
+ * - `trusted` — Explicitly trusted roots. Scripts allowed.
643
+ * - `untrusted` — Community or third-party skills. Scripts denied by default.
644
+ *
645
+ * @see https://agentskills.io/specification
646
+ */
647
+
648
+ /**
649
+ * Normalize a skill root config entry.
650
+ *
651
+ * String entries default to `'untrusted'` trust level for safe defaults.
652
+ *
653
+ * @param root - A string path or SkillRootConfig object
654
+ * @returns Normalized SkillRootConfig with explicit trust level
655
+ */
656
+ declare function normalizeRootConfig(root: string | SkillRootConfig): SkillRootConfig;
657
+ /**
658
+ * Check whether a resource path refers to a script.
659
+ *
660
+ * A resource is considered a script if its relative path starts with
661
+ * `scripts/` or is exactly `scripts`, after normalizing path separators,
662
+ * stripping leading "./" segments, and ignoring case.
663
+ *
664
+ * @param resourcePath - Relative path within the skill directory
665
+ * @returns True if the resource is in the scripts/ directory
666
+ */
667
+ declare function isScriptResource(resourcePath: string): boolean;
668
+ /**
669
+ * Evaluate the trust policy for a resource access request.
670
+ *
671
+ * Non-script resources are always allowed regardless of trust level.
672
+ * Script resources require `workspace` or `trusted` trust, or the
673
+ * `allowUntrustedScripts` override to be enabled.
674
+ *
675
+ * @param resourcePath - Relative path to the resource within the skill directory
676
+ * @param trustLevel - Trust level of the skill's root directory
677
+ * @param allowUntrustedScripts - Override flag to permit untrusted scripts
678
+ * @returns Policy decision with allow/deny, reason code, and message
679
+ */
680
+ declare function evaluateTrustPolicy(resourcePath: string, trustLevel: TrustLevel, allowUntrustedScripts?: boolean): TrustPolicyDecision;
681
+
682
+ export { type Skill, type SkillCandidate, type SkillEventHandler, type SkillMetadata, type SkillParseResult, type SkillPromptOptions, SkillRegistry, type SkillRegistryConfig, SkillRegistryEvent, type SkillRootConfig, type SkillValidationError, type TrustLevel, type TrustPolicyDecision, TrustPolicyReason, createActivateSkillTool, createReadSkillResourceTool, createSkillActivationTools, evaluateTrustPolicy, expandHome, isScriptResource, normalizeRootConfig, parseSkillContent, resolveResourcePath, scanAllSkillRoots, scanSkillRoot, validateSkillDescription, validateSkillName, validateSkillNameMatchesDir };