@kodax-ai/kodax 0.7.40 → 0.7.42

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +146 -1
  2. package/README.md +129 -232
  3. package/README_CN.md +128 -253
  4. package/dist/chunks/chunk-3RKBXWZS.js +2 -0
  5. package/dist/chunks/chunk-7JLYVWAF.js +1033 -0
  6. package/dist/chunks/chunk-CD3R5YBH.js +16 -0
  7. package/dist/chunks/chunk-DKXUY5F2.js +209 -0
  8. package/dist/chunks/chunk-HMYEQJGT.js +31 -0
  9. package/dist/chunks/{chunk-FAVPT4P7.js → chunk-IYJ5EPRV.js} +1 -1
  10. package/dist/chunks/chunk-KUX5LRPP.js +2 -0
  11. package/dist/chunks/{chunk-EQ5DGS2W.js → chunk-OWSKU55I.js} +5 -6
  12. package/dist/chunks/chunk-ZZ4KRK2B.js +465 -0
  13. package/dist/chunks/compaction-config-FIFFP4FT.js +2 -0
  14. package/dist/chunks/{construction-bootstrap-OFPUZTXQ.js → construction-bootstrap-J2WOCYEK.js} +1 -1
  15. package/dist/chunks/dist-2ZHWDXMQ.js +2 -0
  16. package/dist/chunks/dist-W4CJWLIH.js +2 -0
  17. package/dist/chunks/utils-A5MWDTWZ.js +2 -0
  18. package/dist/index.d.ts +237 -7
  19. package/dist/index.js +5 -5
  20. package/dist/kodax_cli.js +935 -917
  21. package/dist/sdk-agent.d.ts +1375 -10
  22. package/dist/sdk-agent.js +1 -1
  23. package/dist/sdk-coding.d.ts +4608 -14
  24. package/dist/sdk-coding.js +1 -1
  25. package/dist/sdk-llm.d.ts +210 -10
  26. package/dist/sdk-llm.js +1 -1
  27. package/dist/sdk-mcp.d.ts +17 -0
  28. package/dist/sdk-mcp.js +2 -0
  29. package/dist/sdk-repl.d.ts +3026 -13
  30. package/dist/sdk-repl.js +2 -1
  31. package/dist/sdk-session.d.ts +164 -0
  32. package/dist/sdk-session.js +2 -0
  33. package/dist/sdk-skills.d.ts +553 -9
  34. package/dist/sdk-skills.js +1 -1
  35. package/dist/types-chunks/bash-prefix-extractor.d-CkhaqKkg.d.ts +2571 -0
  36. package/dist/types-chunks/capability.d-3C62G8Eq.d.ts +39 -0
  37. package/dist/types-chunks/config.d-BfJUXxC0.d.ts +41 -0
  38. package/dist/types-chunks/cost-tracker.d-B6vMoLLF.d.ts +360 -0
  39. package/dist/types-chunks/history-cleanup.d-DznrzEiU.d.ts +1475 -0
  40. package/dist/types-chunks/instance-discovery.d-BsKnIwpg.d.ts +990 -0
  41. package/dist/types-chunks/resolver.d-DX9au4NJ.d.ts +263 -0
  42. package/dist/types-chunks/session-storage.d-Cci897iM.d.ts +68 -0
  43. package/dist/types-chunks/storage.d-Bc5DoAwp.d.ts +532 -0
  44. package/dist/types-chunks/transport.d-DuyjG30t.d.ts +180 -0
  45. package/dist/types-chunks/types.d-B1uGoVTE.d.ts +400 -0
  46. package/dist/types-chunks/types.d-C5mHR87z.d.ts +119 -0
  47. package/dist/types-chunks/types.d-mM8vqvhT.d.ts +254 -0
  48. package/package.json +16 -3
  49. package/dist/acp_events.d.ts +0 -109
  50. package/dist/acp_logger.d.ts +0 -20
  51. package/dist/acp_server.d.ts +0 -92
  52. package/dist/chunks/chunk-6QO6HWGU.js +0 -30
  53. package/dist/chunks/chunk-CLS57NPX.js +0 -460
  54. package/dist/chunks/chunk-NDNILSTR.js +0 -2
  55. package/dist/chunks/chunk-QZEDWITG.js +0 -1226
  56. package/dist/chunks/chunk-Z5EBDA6R.js +0 -15
  57. package/dist/chunks/compaction-config-A7XZ6H5Y.js +0 -2
  58. package/dist/chunks/dist-M57GIWR4.js +0 -2
  59. package/dist/chunks/dist-OTUF22DA.js +0 -2
  60. package/dist/chunks/utils-DFMYJUTE.js +0 -2
  61. package/dist/cli_commands.d.ts +0 -17
  62. package/dist/cli_option_helpers.d.ts +0 -49
  63. package/dist/cli_option_helpers.test.d.ts +0 -1
  64. package/dist/constructed_cli.d.ts +0 -82
  65. package/dist/constructed_cli.test.d.ts +0 -1
  66. package/dist/kodax_cli.d.ts +0 -7
  67. package/dist/self_modify_cli.d.ts +0 -81
  68. package/dist/self_modify_cli.test.d.ts +0 -9
  69. package/dist/skill_cli.d.ts +0 -15
  70. package/dist/skill_cli.test.d.ts +0 -1
@@ -1,16 +1,560 @@
1
1
  /**
2
- * SDK subpath entry `@kodax-ai/kodax/skills`
2
+ * Agent Skills Standard Type Definitions
3
+ * Compliant with https://agentskills.io/ specification
3
4
  *
4
- * Re-exports the entire `@kodax-ai/skills` public API skill loader,
5
- * resolver, registry, frontmatter parser, etc. The `@kodax-ai/skills`
6
- * package has zero external dependencies, making it the cheapest
7
- * subpath for SDK consumers to pull in.
5
+ * Also supports Claude Code extension fields for compatibility
6
+ */
7
+ /**
8
+ * Skill frontmatter as defined in SKILL.md YAML header
9
+ */
10
+ interface SkillFrontmatter {
11
+ /** Skill name in kebab-case, max 64 characters */
12
+ name: string;
13
+ /** Skill description, max 1024 characters, should include trigger conditions */
14
+ description: string;
15
+ /** Whether to disable automatic model invocation (default: false) */
16
+ disableModelInvocation?: boolean;
17
+ /** Whether skill appears in / menu (default: true) */
18
+ userInvocable?: boolean;
19
+ /** Tool restrictions, e.g., "Read, Grep, Bash(python:*)" */
20
+ allowedTools?: string;
21
+ /** Execution context - 'fork' for sub-agent execution */
22
+ context?: 'fork';
23
+ /** Sub-agent type: Explore, Plan, general-purpose, etc. */
24
+ agent?: string;
25
+ /** Argument hint for UI, e.g., "[file] [format]" */
26
+ argumentHint?: string;
27
+ /** Model preference: haiku, sonnet, opus, or a provider-specific model id */
28
+ model?: string;
29
+ /** Hooks scoped to this skill's lifecycle */
30
+ hooks?: SkillHooks;
31
+ license?: string;
32
+ compatibility?: string;
33
+ metadata?: Record<string, unknown>;
34
+ }
35
+ interface SkillHook {
36
+ matcher?: string;
37
+ command: string;
38
+ }
39
+ interface SkillHooks {
40
+ SessionStart?: SkillHook[];
41
+ UserPromptSubmit?: SkillHook[];
42
+ PreToolUse?: SkillHook[];
43
+ PostToolUse?: SkillHook[];
44
+ Stop?: SkillHook[];
45
+ SubagentStop?: SkillHook[];
46
+ Notification?: SkillHook[];
47
+ }
48
+ /**
49
+ * Lightweight skill metadata for system prompt injection
50
+ * Loaded at startup for progressive disclosure
51
+ */
52
+ interface SkillMetadata {
53
+ name: string;
54
+ description: string;
55
+ userInvocable: boolean;
56
+ argumentHint?: string;
57
+ path: string;
58
+ source: SkillSource;
59
+ /** If true, exclude from system prompt (only invokable via /skill:name) */
60
+ disableModelInvocation: boolean;
61
+ }
62
+ /**
63
+ * Complete skill definition with all content loaded
64
+ */
65
+ interface Skill extends SkillFrontmatter {
66
+ /** Skill directory absolute path */
67
+ path: string;
68
+ /** SKILL.md absolute path */
69
+ skillFilePath: string;
70
+ /** Markdown content (with variables resolved) */
71
+ content: string;
72
+ /** Raw markdown content (before variable resolution) */
73
+ rawContent: string;
74
+ /** Support files */
75
+ scripts?: SkillFile[];
76
+ references?: SkillFile[];
77
+ assets?: SkillFile[];
78
+ templates?: SkillFile[];
79
+ resources?: SkillFile[];
80
+ /** Runtime state */
81
+ loaded: boolean;
82
+ source: SkillSource;
83
+ }
84
+ /**
85
+ * File within a skill directory
86
+ */
87
+ interface SkillFile {
88
+ name: string;
89
+ path: string;
90
+ relativePath: string;
91
+ content?: string;
92
+ }
93
+ type SkillSource = 'project' | 'user' | 'plugin' | 'builtin';
94
+ /**
95
+ * Skill registry interface for managing discovered skills
96
+ */
97
+ interface ISkillRegistry {
98
+ /** Read-only view of discovered skill metadata */
99
+ readonly skills: ReadonlyMap<string, SkillMetadata>;
100
+ /** Discover skills from all configured paths */
101
+ discover(): Promise<void>;
102
+ /** Get skill metadata by name */
103
+ get(name: string): SkillMetadata | undefined;
104
+ /** Load full skill content */
105
+ loadFull(name: string): Promise<Skill>;
106
+ /** Invoke a skill with arguments */
107
+ invoke(name: string, args: string, context: SkillContext): Promise<SkillResult>;
108
+ /** Reload skills from disk */
109
+ reload(): Promise<void>;
110
+ /** List all discovered skills */
111
+ list(): ReadonlyArray<SkillMetadata>;
112
+ /** List skills that can be invoked directly by users */
113
+ listUserInvocable(): ReadonlyArray<SkillMetadata>;
114
+ /** Check whether a skill exists */
115
+ has(name: string): boolean;
116
+ /** Number of discovered skills */
117
+ readonly size: number;
118
+ }
119
+ /**
120
+ * v0.7.42 — SDK-embedder hook for `!`cmd`` dynamic context resolution.
8
121
  *
9
- * Usage:
122
+ * Receives the literal command string and the working directory the resolver
123
+ * would have used. Must return the command's text output (which the resolver
124
+ * splices into the skill markdown in place of the `!`cmd`` token), or throw
125
+ * to deny.
126
+ *
127
+ * **Trust boundary**: when the KodaX SDK is embedded inside a host app
128
+ * (e.g. KodaX Space, IDE extensions), the host typically mediates shell
129
+ * execution through a permission broker so the end user can approve / deny
130
+ * each command. Without this hook, `VariableResolver` directly `execSync`s
131
+ * commands using its own built-in whitelist — bypassing the host's broker
132
+ * and producing OS side-effects the user never saw.
133
+ *
134
+ * Embedders should route here to:
135
+ * - prompt the user via their own UI,
136
+ * - log execution to their audit trail,
137
+ * - apply policy (e.g. block network commands),
138
+ * - or refuse outright (throw).
139
+ *
140
+ * @example
10
141
  * ```ts
11
- * import { loadSkill, SkillRegistry } from '@kodax-ai/kodax/skills';
142
+ * const context: SkillContext = {
143
+ * workingDirectory: '/repo',
144
+ * executeDynamicContext: async (cmd, cwd) => {
145
+ * const approved = await brokerAskUser({ kind: 'skill-cmd', command: cmd, cwd });
146
+ * if (!approved) throw new Error('user denied');
147
+ * return await brokerExecute(cmd, cwd);
148
+ * },
149
+ * };
12
150
  * ```
151
+ */
152
+ type SkillDynamicContextExecutor = (command: string, cwd: string) => Promise<string>;
153
+ interface SkillContext {
154
+ workingDirectory: string;
155
+ projectRoot?: string;
156
+ /**
157
+ * Optional. Used to substitute `${CLAUDE_SESSION_ID}` / `${KODAX_SESSION_ID}`
158
+ * template variables in skill markdown. Tool-invocation callers (e.g. the
159
+ * `skill` tool) may not have a session bound — in that case the resolver
160
+ * falls back to an empty replacement so the substitution doesn't leak the
161
+ * literal `${...}` to the LLM.
162
+ */
163
+ sessionId?: string;
164
+ environment?: Record<string, string>;
165
+ messages?: unknown[];
166
+ /**
167
+ * v0.7.42 — SDK-embedder hook for `!`cmd`` dynamic-context resolution.
168
+ * See {@link SkillDynamicContextExecutor} for the trust-boundary rationale.
169
+ * When present, completely replaces the built-in `execSync`-based path
170
+ * (whitelist + 5s timeout). When absent, the legacy whitelist path runs.
171
+ */
172
+ executeDynamicContext?: SkillDynamicContextExecutor;
173
+ /**
174
+ * v0.7.42 — hard-disable `!`cmd`` resolution.
175
+ * When `true`, encountering a `!`cmd`` token throws
176
+ * `[Dynamic context disabled by host]` regardless of any hook. Useful for
177
+ * embedders that want a single-flag kill switch without writing a hook.
178
+ * `executeDynamicContext` is ignored when this is `true`.
179
+ */
180
+ disableDynamicContext?: boolean;
181
+ }
182
+ interface SkillResult {
183
+ success: boolean;
184
+ /** Processed prompt content */
185
+ content: string;
186
+ /** Generated artifacts */
187
+ artifacts?: SkillArtifact[];
188
+ error?: string;
189
+ }
190
+ interface SkillArtifact {
191
+ type: 'file' | 'code' | 'text';
192
+ name: string;
193
+ content: string;
194
+ path?: string;
195
+ }
196
+ interface IVariableResolver {
197
+ /** Resolve all variables in content */
198
+ resolve(content: string, args: string, context: SkillContext): Promise<string>;
199
+ }
200
+ interface SkillPathsConfig {
201
+ projectPaths: string[];
202
+ userPaths: string[];
203
+ pluginPaths: string[];
204
+ builtinPath: string;
205
+ }
206
+ /**
207
+ * Get default skill discovery paths
208
+ *
209
+ * Priority order (highest first):
210
+ * 1. Project - <projectRoot>/.kodax/skills/
211
+ * 2. User - ~/.kodax/skills/
212
+ * 3. User - ~/.agents/skills/ (AgentSkills standard)
213
+ * 4. Plugin - (dynamic)
214
+ * 5. Builtin - packages/skills/src/builtin/
215
+ */
216
+ declare function getDefaultSkillPaths(projectRoot?: string): SkillPathsConfig;
217
+ /**
218
+ * All skill paths in priority order (highest to lowest)
219
+ *
220
+ * Priority: Project > User > Plugin > Builtin
221
+ * - Project: Project-specific skills override everything else
222
+ * - User: User preferences (~/.kodax/ and ~/.agents/)
223
+ * - Plugin: Third-party plugins
224
+ * - Builtin: Default skills shipped with KodaX
225
+ */
226
+ declare function getSkillPathsFlat(config: SkillPathsConfig): Array<{
227
+ path: string;
228
+ source: SkillSource;
229
+ }>;
230
+
231
+ declare function registerPluginSkillPath(skillPath: string): () => void;
232
+ declare function unregisterPluginSkillPath(skillPath: string): boolean;
233
+ declare function listPluginSkillPaths(): string[];
234
+ declare function clearPluginSkillPaths(): void;
235
+
236
+ /**
237
+ * Skill Loader - YAML Frontmatter Parsing and Skill Loading
238
+ *
239
+ * Parses SKILL.md files with YAML frontmatter and loads skill content.
240
+ * Implements fallback sanitization for non-standard YAML formats.
241
+ */
242
+
243
+ /**
244
+ * Parse SKILL.md file with YAML frontmatter
245
+ */
246
+ declare function parseSkillMarkdown(content: string): {
247
+ frontmatter: SkillFrontmatter;
248
+ body: string;
249
+ };
250
+ /**
251
+ * Load skill metadata from SKILL.md file
252
+ */
253
+ declare function loadSkillMetadata(skillDir: string, source: SkillSource): Promise<SkillMetadata | null>;
254
+ /**
255
+ * Load full skill content
256
+ */
257
+ declare function loadFullSkill(skillDir: string, source: SkillSource): Promise<Skill | null>;
258
+ /**
259
+ * Load a specific support file's content
260
+ */
261
+ declare function loadSkillFileContent(file: SkillFile): Promise<string>;
262
+
263
+ /**
264
+ * Skill Discovery - Multi-path skill scanning
265
+ *
266
+ * Discovers skills from multiple paths with priority handling.
267
+ * Supports nested directory discovery for monorepos.
268
+ */
269
+
270
+ /**
271
+ * Result of skill discovery
272
+ */
273
+ interface DiscoveryResult {
274
+ skills: Map<string, SkillMetadata>;
275
+ errors: Array<{
276
+ path: string;
277
+ error: string;
278
+ }>;
279
+ }
280
+ /**
281
+ * Discover all skills from configured paths
282
+ */
283
+ declare function discoverSkills(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>): Promise<DiscoveryResult>;
284
+ /**
285
+ * Get nested skill paths for monorepo support
286
+ * When in a subdirectory, also check parent directories for skills
287
+ */
288
+ declare function getNestedSkillPaths(currentDir: string, projectRoot: string): string[];
289
+ /**
290
+ * Discover skills with monorepo support
291
+ */
292
+ declare function discoverSkillsWithMonorepo(currentDir: string, projectRoot: string): Promise<DiscoveryResult>;
293
+
294
+ /**
295
+ * Skill Resolver - Variable Replacement System
13
296
  *
14
- * See docs/ADR.md ADR-024 for the SDK formalization decision.
297
+ * Handles variable replacement in skill content:
298
+ * - $ARGUMENTS - All arguments
299
+ * - $0, $1, $2... - Positional arguments
300
+ * - ${VAR_NAME} - Environment variables
301
+ * - !`command` - Dynamic context injection
302
+ */
303
+
304
+ /**
305
+ * Split arguments string into positional arguments
306
+ * Handles quoted strings correctly
307
+ */
308
+ declare function parseArguments(args: string): string[];
309
+ /**
310
+ * Variable resolver implementation
311
+ */
312
+ declare class VariableResolver implements IVariableResolver {
313
+ private context;
314
+ constructor(context: SkillContext);
315
+ /**
316
+ * Resolve all variables in content
317
+ */
318
+ resolve(content: string, args: string): Promise<string>;
319
+ /**
320
+ * Replace $0, $1, $2... with positional arguments
321
+ */
322
+ private resolvePositionalArgs;
323
+ /**
324
+ * Replace $ARGUMENTS with all arguments
325
+ */
326
+ private resolveArguments;
327
+ /**
328
+ * Replace ${VAR_NAME} with environment variables
329
+ */
330
+ private resolveEnvVars;
331
+ /**
332
+ * Replace !`command` with command output (dynamic context).
333
+ *
334
+ * Three-tier dispatch (v0.7.42):
335
+ * 1. `context.disableDynamicContext === true` → throw immediately,
336
+ * surfaced to the LLM as `[Error: …]`. Host-level kill switch.
337
+ * 2. `context.executeDynamicContext` provided → route there. Embedder
338
+ * mediates shell execution (broker, audit, deny).
339
+ * 3. else → legacy built-in path (`isSafeDynamicContextCommand`
340
+ * whitelist + `execSync` with 5s timeout).
341
+ *
342
+ * The resolver inlines an `[Error: …]` placeholder for any thrown
343
+ * exception so a single bad token doesn't poison the whole skill load.
344
+ */
345
+ private resolveDynamicContext;
346
+ /**
347
+ * Execute a dynamic context command via the appropriate dispatch tier.
348
+ * See `resolveDynamicContext` JSDoc for the 3-tier ordering rationale.
349
+ */
350
+ private executeDynamicCommand;
351
+ }
352
+ /**
353
+ * Create a variable resolver for a given context
354
+ */
355
+ declare function createResolver(context: SkillContext): IVariableResolver;
356
+ /**
357
+ * Resolve skill content with arguments and context
358
+ */
359
+ declare function resolveSkillContent(content: string, args: string, context: SkillContext): Promise<string>;
360
+
361
+ /**
362
+ * Skill Registry - Progressive Disclosure and Skill Management
363
+ *
364
+ * Manages skill discovery, loading, and invocation with progressive disclosure:
365
+ * - Level 1: Metadata preloaded at startup (name, description)
366
+ * - Level 2: Full content loaded on invoke
367
+ * - Level 3: Support files loaded on demand
368
+ */
369
+
370
+ /**
371
+ * Skill Registry implementation
372
+ */
373
+ declare class SkillRegistry implements ISkillRegistry {
374
+ private readonly skillsByName;
375
+ private readonly fullSkillsByName;
376
+ private readonly projectRoot?;
377
+ private readonly customPaths?;
378
+ constructor(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>);
379
+ /**
380
+ * Discover skills from all configured paths
381
+ */
382
+ discover(): Promise<void>;
383
+ /**
384
+ * Get skill metadata by name
385
+ */
386
+ get skills(): ReadonlyMap<string, SkillMetadata>;
387
+ /**
388
+ * Get skill metadata by name
389
+ */
390
+ get(name: string): SkillMetadata | undefined;
391
+ /**
392
+ * Load full skill content
393
+ */
394
+ loadFull(name: string): Promise<Skill>;
395
+ /**
396
+ * Invoke a skill with arguments
397
+ */
398
+ invoke(name: string, args: string, context: SkillContext): Promise<SkillResult>;
399
+ /**
400
+ * Reload skills from disk
401
+ */
402
+ reload(): Promise<void>;
403
+ /**
404
+ * List all available skills
405
+ */
406
+ list(): SkillMetadata[];
407
+ /**
408
+ * List user-invocable skills (for / menu)
409
+ */
410
+ listUserInvocable(): SkillMetadata[];
411
+ /**
412
+ * Get skills formatted for system prompt injection.
413
+ *
414
+ * FEATURE_143 (v0.7.36): manifest wording hardened toward Claude
415
+ * Code-style strong constraints. The previous wording ("when a user
416
+ * request matches a skill description, use read to load the skill")
417
+ * was too soft — the LLM treated skill invocation as one option among
418
+ * many and frequently authored its own answer instead of loading the
419
+ * SKILL.md instructions. Aligns with the
420
+ * `c:/Works/claudecode/src/tools/SkillTool/prompt.ts` ruleset:
421
+ * BLOCKING REQUIREMENT to load the relevant skill BEFORE generating
422
+ * any other response when a skill matches.
423
+ *
424
+ * Filters out skills with disableModelInvocation=true (Issue 056).
425
+ */
426
+ getSystemPromptSnippet(): string;
427
+ /**
428
+ * Check if a name is a valid skill
429
+ */
430
+ has(name: string): boolean;
431
+ /**
432
+ * Get the count of discovered skills
433
+ */
434
+ get size(): number;
435
+ }
436
+ /**
437
+ * Get the global skill registry instance
438
+ *
439
+ * IMPORTANT: If projectRoot is undefined, returns existing instance without reset.
440
+ * This prevents accidental singleton reset when called without arguments.
441
+ */
442
+ declare function getSkillRegistry(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>): SkillRegistry;
443
+ /**
444
+ * Initialize the skill registry and discover skills
445
+ */
446
+ declare function initializeSkillRegistry(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>): Promise<SkillRegistry>;
447
+ /**
448
+ * Reset the global registry (for testing or hot reload)
449
+ */
450
+ declare function resetSkillRegistry(): void;
451
+
452
+ /**
453
+ * Skill Executor - Execution Engine
454
+ *
455
+ * Handles skill execution with support for:
456
+ * - Inline execution (default)
457
+ * - Fork execution (sub-agent)
458
+ * - Tool restrictions
459
+ */
460
+
461
+ /**
462
+ * Execution mode
463
+ */
464
+ type ExecutionMode = 'inline' | 'fork';
465
+ /**
466
+ * Execution options
467
+ */
468
+ interface ExecutionOptions {
469
+ /** Force a specific execution mode */
470
+ mode?: ExecutionMode;
471
+ /** Override model */
472
+ model?: string;
473
+ /** Override agent type (for fork mode) */
474
+ agent?: string;
475
+ /** Override allowed tools */
476
+ allowedTools?: string[];
477
+ /** Callback for inline execution */
478
+ onExecute?: (content: string, skill: Skill) => Promise<string>;
479
+ }
480
+ /**
481
+ * Skill executor class
482
+ */
483
+ declare class SkillExecutor {
484
+ private context;
485
+ constructor(context: SkillContext);
486
+ /**
487
+ * Execute a skill
488
+ */
489
+ execute(skillName: string, args: string, options?: ExecutionOptions): Promise<SkillResult>;
490
+ /**
491
+ * Execute skill inline (in current context)
492
+ */
493
+ private executeInline;
494
+ /**
495
+ * Execute skill in fork mode (sub-agent)
496
+ */
497
+ private executeFork;
498
+ /**
499
+ * Build the execution prompt
500
+ */
501
+ private buildPrompt;
502
+ /**
503
+ * Parse allowed tools string into array
504
+ */
505
+ private parseAllowedTools;
506
+ }
507
+ /**
508
+ * Create a skill executor
509
+ */
510
+ declare function createExecutor(context: SkillContext): SkillExecutor;
511
+ /**
512
+ * Execute a skill with default context
513
+ */
514
+ declare function executeSkill(skillName: string, args: string, context: SkillContext, options?: ExecutionOptions): Promise<SkillResult>;
515
+
516
+ /**
517
+ * Skill Expander - Expand skill commands for LLM context injection
518
+ *
519
+ * Takes a skill invocation and produces content that can be injected
520
+ * into the user message for LLM execution.
521
+ *
522
+ * Design based on pi-mono's _expandSkillCommand:
523
+ * - Wraps content in XML blocks for clear context
524
+ * - Includes skill metadata (name, location)
525
+ * - Resolves all variables ($ARGUMENTS, $0, etc.)
526
+ * - Handles dynamic context (!`command`)
527
+ */
528
+
529
+ /**
530
+ * Result of skill expansion
531
+ */
532
+ interface SkillExpansionResult {
533
+ /** The expanded skill content ready for LLM injection */
534
+ content: string;
535
+ /** Whether the skill has model invocation disabled */
536
+ disableModelInvocation: boolean;
537
+ /** Original skill metadata */
538
+ skill: Skill;
539
+ }
540
+ /**
541
+ * Expand a skill into LLM-ready content
542
+ *
543
+ * This function:
544
+ * 1. Resolves all variables in the skill content ($ARGUMENTS, $0, $1, etc.)
545
+ * 2. Executes dynamic context commands (!`command`)
546
+ * 3. Wraps the content in an XML block for clear context boundaries
547
+ *
548
+ * @param skill - The full skill object with content
549
+ * @param args - Raw arguments string from user input
550
+ * @param context - Execution context (working directory, session ID, etc.)
551
+ * @returns Expansion result with content ready for LLM injection
552
+ */
553
+ declare function expandSkillForLLM(skill: Skill, args: string, context: SkillContext): Promise<SkillExpansionResult>;
554
+ /**
555
+ * Format skill activation message for user display
15
556
  */
16
- export * from '@kodax-ai/skills';
557
+ declare function formatSkillActivationMessage(skillName: string, args: string): string;
558
+
559
+ export { SkillExecutor, SkillRegistry, VariableResolver, clearPluginSkillPaths, createExecutor, createResolver, discoverSkills, discoverSkillsWithMonorepo, executeSkill, expandSkillForLLM, formatSkillActivationMessage, getDefaultSkillPaths, getNestedSkillPaths, getSkillPathsFlat, getSkillRegistry, initializeSkillRegistry, listPluginSkillPaths, loadFullSkill, loadSkillFileContent, loadSkillMetadata, parseArguments, parseSkillMarkdown, registerPluginSkillPath, resetSkillRegistry, resolveSkillContent, unregisterPluginSkillPath };
560
+ export type { DiscoveryResult, ExecutionMode, ExecutionOptions, ISkillRegistry, IVariableResolver, Skill, SkillArtifact, SkillContext, SkillDynamicContextExecutor, SkillExpansionResult, SkillFile, SkillFrontmatter, SkillHook, SkillHooks, SkillMetadata, SkillPathsConfig, SkillResult, SkillSource };
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{A as w,B as y,C as z,a as o,b as r,c as e,d as f,e as m,f as p,j as t,k as x,l as a,m as b,n as c,o as d,p as g,q as h,r as i,s as j,t as k,u as l,v as n,w as q,x as s,y as u,z as v}from"./chunks/chunk-EQ5DGS2W.js";import"./chunks/chunk-V4WSBIXB.js";export{u as SkillExecutor,l as SkillRegistry,i as VariableResolver,f as clearPluginSkillPaths,v as createExecutor,j as createResolver,c as discoverSkills,g as discoverSkillsWithMonorepo,w as executeSkill,y as expandSkillForLLM,z as formatSkillActivationMessage,m as getDefaultSkillPaths,d as getNestedSkillPaths,p as getSkillPathsFlat,n as getSkillRegistry,q as initializeSkillRegistry,e as listPluginSkillPaths,a as loadFullSkill,b as loadSkillFileContent,x as loadSkillMetadata,h as parseArguments,t as parseSkillMarkdown,o as registerPluginSkillPath,s as resetSkillRegistry,k as resolveSkillContent,r as unregisterPluginSkillPath};
2
+ import{A as w,B as y,C as z,a as o,b as r,c as e,d as f,e as m,f as p,j as t,k as x,l as a,m as b,n as c,o as d,p as g,q as h,r as i,s as j,t as k,u as l,v as n,w as q,x as s,y as u,z as v}from"./chunks/chunk-OWSKU55I.js";import"./chunks/chunk-V4WSBIXB.js";export{u as SkillExecutor,l as SkillRegistry,i as VariableResolver,f as clearPluginSkillPaths,v as createExecutor,j as createResolver,c as discoverSkills,g as discoverSkillsWithMonorepo,w as executeSkill,y as expandSkillForLLM,z as formatSkillActivationMessage,m as getDefaultSkillPaths,d as getNestedSkillPaths,p as getSkillPathsFlat,n as getSkillRegistry,q as initializeSkillRegistry,e as listPluginSkillPaths,a as loadFullSkill,b as loadSkillFileContent,x as loadSkillMetadata,h as parseArguments,t as parseSkillMarkdown,o as registerPluginSkillPath,s as resetSkillRegistry,k as resolveSkillContent,r as unregisterPluginSkillPath};