@kodax-ai/kodax 0.7.92 → 0.7.94

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 (81) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +63 -18
  3. package/README_CN.md +31 -0
  4. package/dist/builtin/skill-creator/SKILL.md +5 -0
  5. package/dist/builtin/skill-creator/scripts/init-skill.js +5 -4
  6. package/dist/chunks/{agent-YHHFIH7N.js → agent-Q3FB3GNZ.js} +1 -1
  7. package/dist/chunks/argument-completer-SS2Q2ZKT.js +2 -0
  8. package/dist/chunks/chunk-56CIZI5I.js +418 -0
  9. package/dist/chunks/{chunk-QPBN3J4E.js → chunk-6BATYA47.js} +2 -2
  10. package/dist/chunks/chunk-77PNP27P.js +92 -0
  11. package/dist/chunks/chunk-7CKGNNTU.js +383 -0
  12. package/dist/chunks/{chunk-X75UGXP3.js → chunk-7QBWHCIZ.js} +1 -1
  13. package/dist/chunks/{chunk-FBL7IVMK.js → chunk-BHE66SP3.js} +14 -14
  14. package/dist/chunks/{chunk-YVG6OKN7.js → chunk-BVV3IA5W.js} +1 -1
  15. package/dist/chunks/chunk-EASGM7W7.js +687 -0
  16. package/dist/chunks/{chunk-GRWUC6H7.js → chunk-IIIAUDGW.js} +1 -1
  17. package/dist/chunks/{chunk-GH3KBC2H.js → chunk-N7HIJNJH.js} +1 -1
  18. package/dist/chunks/{chunk-THZVJ6R7.js → chunk-NGOPE4KK.js} +10 -10
  19. package/dist/chunks/chunk-NK5AWGNW.js +319 -0
  20. package/dist/chunks/{chunk-7XSZVOG7.js → chunk-UNRHTOT5.js} +134 -133
  21. package/dist/chunks/{chunk-5CIKWSCA.js → chunk-YMNFQ7SQ.js} +2 -2
  22. package/dist/chunks/{chunk-AGZNXFHZ.js → chunk-ZGZLSKN6.js} +214 -213
  23. package/dist/chunks/{chunk-PKPBII4F.js → chunk-ZKEXHAXA.js} +238 -239
  24. package/dist/chunks/{chunk-OSQIYUGD.js → chunk-ZMGATMXN.js} +121 -122
  25. package/dist/chunks/{client-OVYKC3ND.js → client-4IOUU4U3.js} +1 -1
  26. package/dist/chunks/compaction-config-2DTN3OHT.js +2 -0
  27. package/dist/chunks/{construction-bootstrap-QVLJPFTL.js → construction-bootstrap-BL56XTNW.js} +1 -1
  28. package/dist/chunks/dist-B4CB7KHY.js +2 -0
  29. package/dist/chunks/{dist-WNMK42WE.js → dist-ITTXQHRJ.js} +1 -1
  30. package/dist/chunks/host-7747QS3X.js +2 -0
  31. package/dist/chunks/run-manager-NLNMI3P2.js +2 -0
  32. package/dist/chunks/{utils-HPVZCR2J.js → utils-CGGQLMJS.js} +1 -1
  33. package/dist/index.d.ts +10 -10
  34. package/dist/index.js +2 -2
  35. package/dist/kodax_bootstrap.js +1 -1
  36. package/dist/kodax_cli.js +1554 -1384
  37. package/dist/runtime-worker.js +1562 -1392
  38. package/dist/sandbox-workspace-session.js +429 -260
  39. package/dist/sdk-a2a.d.ts +6 -6
  40. package/dist/sdk-a2a.js +1 -1
  41. package/dist/sdk-agent.d.ts +17 -6
  42. package/dist/sdk-agent.js +1 -1
  43. package/dist/sdk-coding.d.ts +32 -15
  44. package/dist/sdk-coding.js +1 -1
  45. package/dist/sdk-experimental-memory.js +1 -1
  46. package/dist/sdk-llm.js +1 -1
  47. package/dist/sdk-mcp.js +1 -1
  48. package/dist/sdk-media.js +1 -1
  49. package/dist/sdk-repl.d.ts +32 -14
  50. package/dist/sdk-repl.js +2 -2
  51. package/dist/sdk-runtime.d.ts +31 -8
  52. package/dist/sdk-runtime.js +1 -1
  53. package/dist/sdk-sandbox.d.ts +7 -0
  54. package/dist/sdk-sandbox.js +1 -1
  55. package/dist/sdk-session.d.ts +4 -4
  56. package/dist/sdk-session.js +1 -1
  57. package/dist/sdk-skills.d.ts +2 -333
  58. package/dist/sdk-skills.js +1 -1
  59. package/dist/semantic-worker.js +61 -60
  60. package/dist/types-chunks/{bash-prefix-extractor.d-BMi_TJIY.d.ts → bash-prefix-extractor.d-AOJdvO4r.d.ts} +53 -3
  61. package/dist/types-chunks/{guardrail.d-CKkoea7y.d.ts → guardrail.d-D8RyuTrv.d.ts} +1 -1
  62. package/dist/types-chunks/{public-api.d-BsZWOq3P.d.ts → public-api.d-BNmLxGnR.d.ts} +1 -1
  63. package/dist/types-chunks/{repl.d-DxD0Olm0.d.ts → repl.d-Q6Z3lV2-.d.ts} +4 -4
  64. package/dist/types-chunks/{sdk-session-BTzblJTQ.d.ts → sdk-session-BwC_i6JB.d.ts} +1 -1
  65. package/dist/types-chunks/sdk-skills-Bg1yL4i4.d.ts +335 -0
  66. package/dist/types-chunks/{shell-command-sets.d-C2cc9Hwi.d.ts → shell-command-sets.d-hkYPr4Dy.d.ts} +1 -1
  67. package/dist/types-chunks/{types.d-Dc3kwcjC.d.ts → types.d-Bdv2JoiC.d.ts} +12 -1
  68. package/dist/types-chunks/{types.d-DrtP1ceI.d.ts → types.d-CzrUifXB.d.ts} +1 -1
  69. package/dist/types-chunks/{types.d-BEMcUOng.d.ts → types.d-ssh6zRaf.d.ts} +5 -4
  70. package/dist/types-chunks/{utils.d-50Q24Few.d.ts → utils.d-Buv_Gxhi.d.ts} +3 -3
  71. package/package.json +1 -1
  72. package/dist/chunks/argument-completer-6ZTRBNZM.js +0 -2
  73. package/dist/chunks/chunk-A6GNPNGB.js +0 -383
  74. package/dist/chunks/chunk-BV3SVH36.js +0 -519
  75. package/dist/chunks/chunk-QFV6YCIH.js +0 -92
  76. package/dist/chunks/chunk-QKLS4BYA.js +0 -320
  77. package/dist/chunks/chunk-RJIYXB62.js +0 -415
  78. package/dist/chunks/compaction-config-2TVSYSB4.js +0 -2
  79. package/dist/chunks/dist-XC5M7UYX.js +0 -2
  80. package/dist/chunks/host-B3TK2U43.js +0 -2
  81. package/dist/chunks/run-manager-5AV3MR4W.js +0 -2
@@ -1,333 +1,2 @@
1
- import { R as ResolvedSkillSource, c as Skill, f as SkillFile, S as SkillMetadata, g as SkillFrontmatter, j as SkillPathsConfig, b as IVariableResolver, e as SkillContext, I as ISkillRegistry, k as SkillResult } from './types-chunks/types.d-BEMcUOng.js';
2
- export { d as SkillArtifact, a as SkillDynamicContextExecutor, h as SkillHook, i as SkillHooks, l as SkillSource, m as getDefaultSkillPaths, n as getSkillPathsFlat } from './types-chunks/types.d-BEMcUOng.js';
3
-
4
- declare function registerPluginSkillPath(skillPath: string): () => void;
5
- declare function unregisterPluginSkillPath(skillPath: string): boolean;
6
- declare function listPluginSkillPaths(): string[];
7
- declare function clearPluginSkillPaths(): void;
8
-
9
- /**
10
- * Skill Loader - YAML Frontmatter Parsing and Skill Loading
11
- *
12
- * Parses SKILL.md files with YAML frontmatter and loads skill content.
13
- * Implements fallback sanitization for non-standard YAML formats.
14
- */
15
-
16
- /**
17
- * Parse SKILL.md file with YAML frontmatter
18
- */
19
- declare function parseSkillMarkdown(content: string): {
20
- frontmatter: SkillFrontmatter;
21
- body: string;
22
- };
23
- /**
24
- * Load skill metadata from SKILL.md file
25
- */
26
- declare function loadSkillMetadata(skillDir: string, source: ResolvedSkillSource): Promise<SkillMetadata | null>;
27
- /**
28
- * Load full skill content
29
- */
30
- declare function loadFullSkill(skillDir: string, source: ResolvedSkillSource): Promise<Skill | null>;
31
- /**
32
- * Load a specific support file's content
33
- */
34
- declare function loadSkillFileContent(file: SkillFile): Promise<string>;
35
-
36
- /**
37
- * Skill Discovery - Multi-path skill scanning
38
- *
39
- * Discovers skills from multiple paths with priority handling.
40
- * Supports nested directory discovery for monorepos.
41
- */
42
-
43
- /**
44
- * Result of skill discovery
45
- */
46
- interface DiscoveryResult {
47
- skills: Map<string, SkillMetadata>;
48
- errors: Array<{
49
- path: string;
50
- error: string;
51
- }>;
52
- }
53
- /**
54
- * Discover all skills from configured paths
55
- */
56
- declare function discoverSkills(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>): Promise<DiscoveryResult>;
57
- /**
58
- * Get nested skill paths for monorepo support
59
- * When in a subdirectory, also check parent directories for skills
60
- */
61
- declare function getNestedSkillPaths(currentDir: string, projectRoot: string): string[];
62
- /**
63
- * Discover skills with monorepo support
64
- */
65
- declare function discoverSkillsWithMonorepo(currentDir: string, projectRoot: string): Promise<DiscoveryResult>;
66
-
67
- /**
68
- * Skill Resolver - Variable Replacement System
69
- *
70
- * Handles variable replacement in skill content:
71
- * - $ARGUMENTS - All arguments
72
- * - $0, $1, $2... - Positional arguments
73
- * - ${VAR_NAME} - Environment variables
74
- * - !`command` - Dynamic context injection
75
- */
76
-
77
- /**
78
- * Split arguments string into positional arguments
79
- * Handles quoted strings correctly
80
- */
81
- declare function parseArguments(args: string): string[];
82
- /**
83
- * Variable resolver implementation
84
- */
85
- declare class VariableResolver implements IVariableResolver {
86
- private context;
87
- constructor(context: SkillContext);
88
- /**
89
- * Resolve all variables in content
90
- */
91
- resolve(content: string, args: string): Promise<string>;
92
- /**
93
- * Replace $0, $1, $2... with positional arguments
94
- */
95
- private resolvePositionalArgs;
96
- /**
97
- * Replace $ARGUMENTS with all arguments
98
- */
99
- private resolveArguments;
100
- /**
101
- * Replace ${VAR_NAME} with environment variables
102
- */
103
- private resolveEnvVars;
104
- /**
105
- * Replace !`command` with command output (dynamic context).
106
- *
107
- * Three-tier dispatch (v0.7.42):
108
- * 1. `context.disableDynamicContext === true` → throw immediately,
109
- * surfaced to the LLM as `[Error: …]`. Host-level kill switch.
110
- * 2. `context.executeDynamicContext` provided → route there. Embedder
111
- * mediates shell execution (broker, audit, deny).
112
- * 3. else → legacy built-in path (`isSafeDynamicContextCommand`
113
- * whitelist + `execSync` with 5s timeout).
114
- *
115
- * The resolver inlines an `[Error: …]` placeholder for any thrown
116
- * exception so a single bad token doesn't poison the whole skill load.
117
- */
118
- private resolveDynamicContext;
119
- /**
120
- * Execute a dynamic context command via the appropriate dispatch tier.
121
- * See `resolveDynamicContext` JSDoc for the 3-tier ordering rationale.
122
- */
123
- private executeDynamicCommand;
124
- }
125
- /**
126
- * Create a variable resolver for a given context
127
- */
128
- declare function createResolver(context: SkillContext): IVariableResolver;
129
- /**
130
- * Resolve skill content with arguments and context
131
- */
132
- declare function resolveSkillContent(content: string, args: string, context: SkillContext): Promise<string>;
133
-
134
- /**
135
- * Skill Registry - Progressive Disclosure and Skill Management
136
- *
137
- * Manages skill discovery, loading, and invocation with progressive disclosure:
138
- * - Level 1: Metadata preloaded at startup (name, description)
139
- * - Level 2: Full content loaded on invoke
140
- * - Level 3: Support files loaded on demand
141
- */
142
-
143
- /**
144
- * Skill Registry implementation
145
- */
146
- declare class SkillRegistry implements ISkillRegistry {
147
- private readonly skillsByName;
148
- private readonly fullSkillsByName;
149
- private readonly projectRoot?;
150
- private readonly customPaths?;
151
- constructor(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>);
152
- /**
153
- * Discover skills from all configured paths
154
- */
155
- discover(): Promise<void>;
156
- /**
157
- * Get skill metadata by name
158
- */
159
- get skills(): ReadonlyMap<string, SkillMetadata>;
160
- /**
161
- * Get skill metadata by name
162
- */
163
- get(name: string): SkillMetadata | undefined;
164
- /**
165
- * Load full skill content
166
- */
167
- loadFull(name: string): Promise<Skill>;
168
- /**
169
- * Invoke a skill with arguments
170
- */
171
- invoke(name: string, args: string, context: SkillContext): Promise<SkillResult>;
172
- /**
173
- * Reload skills from disk
174
- */
175
- reload(): Promise<void>;
176
- /**
177
- * List all available skills
178
- */
179
- list(): SkillMetadata[];
180
- /**
181
- * List user-invocable skills (for / menu)
182
- */
183
- listUserInvocable(): SkillMetadata[];
184
- /**
185
- * Get skills formatted for system prompt injection.
186
- *
187
- * FEATURE_143 (v0.7.36): manifest wording hardened toward Claude
188
- * Code-style strong constraints. The previous wording ("when a user
189
- * request matches a skill description, use read to load the skill")
190
- * was too soft — the LLM treated skill invocation as one option among
191
- * many and frequently authored its own answer instead of loading the
192
- * SKILL.md instructions. Aligns with the
193
- * `c:/Works/claudecode/src/tools/SkillTool/prompt.ts` ruleset:
194
- * BLOCKING REQUIREMENT to load the relevant skill BEFORE generating
195
- * any other response when a skill matches.
196
- *
197
- * Filters out skills with disableModelInvocation=true (Issue 056).
198
- */
199
- getSystemPromptSnippet(): string;
200
- /**
201
- * Check if a name is a valid skill
202
- */
203
- has(name: string): boolean;
204
- /**
205
- * Get the count of discovered skills
206
- */
207
- get size(): number;
208
- }
209
- /**
210
- * Get the global skill registry instance
211
- *
212
- * IMPORTANT: If projectRoot is undefined, returns existing instance without reset.
213
- * This prevents accidental singleton reset when called without arguments.
214
- */
215
- declare function getSkillRegistry(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>): SkillRegistry;
216
- /**
217
- * Initialize the skill registry and discover skills
218
- */
219
- declare function initializeSkillRegistry(projectRoot?: string, customPaths?: Partial<SkillPathsConfig>): Promise<SkillRegistry>;
220
- /**
221
- * Reset the global registry (for testing or hot reload)
222
- */
223
- declare function resetSkillRegistry(): void;
224
-
225
- /**
226
- * Skill Executor - Execution Engine
227
- *
228
- * Handles skill execution with support for:
229
- * - Inline execution (default)
230
- * - Fork execution (sub-agent)
231
- * - Tool restrictions
232
- */
233
-
234
- /**
235
- * Execution mode
236
- */
237
- type ExecutionMode = 'inline' | 'fork';
238
- /**
239
- * Execution options
240
- */
241
- interface ExecutionOptions {
242
- /** Force a specific execution mode */
243
- mode?: ExecutionMode;
244
- /** Override model */
245
- model?: string;
246
- /** Override agent type (for fork mode) */
247
- agent?: string;
248
- /** Override allowed tools */
249
- allowedTools?: string[];
250
- /** Callback for inline execution */
251
- onExecute?: (content: string, skill: Skill) => Promise<string>;
252
- }
253
- /**
254
- * Skill executor class
255
- */
256
- declare class SkillExecutor {
257
- private context;
258
- constructor(context: SkillContext);
259
- /**
260
- * Execute a skill
261
- */
262
- execute(skillName: string, args: string, options?: ExecutionOptions): Promise<SkillResult>;
263
- /**
264
- * Execute skill inline (in current context)
265
- */
266
- private executeInline;
267
- /**
268
- * Execute skill in fork mode (sub-agent)
269
- */
270
- private executeFork;
271
- /**
272
- * Build the execution prompt
273
- */
274
- private buildPrompt;
275
- /**
276
- * Parse allowed tools string into array
277
- */
278
- private parseAllowedTools;
279
- }
280
- /**
281
- * Create a skill executor
282
- */
283
- declare function createExecutor(context: SkillContext): SkillExecutor;
284
- /**
285
- * Execute a skill with default context
286
- */
287
- declare function executeSkill(skillName: string, args: string, context: SkillContext, options?: ExecutionOptions): Promise<SkillResult>;
288
-
289
- /**
290
- * Skill Expander - Expand skill commands for LLM context injection
291
- *
292
- * Takes a skill invocation and produces content that can be injected
293
- * into the user message for LLM execution.
294
- *
295
- * Design based on pi-mono's _expandSkillCommand:
296
- * - Wraps content in XML blocks for clear context
297
- * - Includes skill metadata (name, location)
298
- * - Resolves all variables ($ARGUMENTS, $0, etc.)
299
- * - Handles dynamic context (!`command`)
300
- */
301
-
302
- /**
303
- * Result of skill expansion
304
- */
305
- interface SkillExpansionResult {
306
- /** The expanded skill content ready for LLM injection */
307
- content: string;
308
- /** Whether the skill has model invocation disabled */
309
- disableModelInvocation: boolean;
310
- /** Original skill metadata */
311
- skill: Skill;
312
- }
313
- /**
314
- * Expand a skill into LLM-ready content
315
- *
316
- * This function:
317
- * 1. Resolves all variables in the skill content ($ARGUMENTS, $0, $1, etc.)
318
- * 2. Executes dynamic context commands (!`command`)
319
- * 3. Wraps the content in an XML block for clear context boundaries
320
- *
321
- * @param skill - The full skill object with content
322
- * @param args - Raw arguments string from user input
323
- * @param context - Execution context (working directory, session ID, etc.)
324
- * @returns Expansion result with content ready for LLM injection
325
- */
326
- declare function expandSkillForLLM(skill: Skill, args: string, context: SkillContext): Promise<SkillExpansionResult>;
327
- /**
328
- * Format skill activation message for user display
329
- */
330
- declare function formatSkillActivationMessage(skillName: string, args: string): string;
331
-
332
- export { ISkillRegistry, IVariableResolver, ResolvedSkillSource, Skill, SkillContext, SkillExecutor, SkillFile, SkillFrontmatter, SkillMetadata, SkillPathsConfig, SkillRegistry, SkillResult, VariableResolver, clearPluginSkillPaths, createExecutor, createResolver, discoverSkills, discoverSkillsWithMonorepo, executeSkill, expandSkillForLLM, formatSkillActivationMessage, getNestedSkillPaths, getSkillRegistry, initializeSkillRegistry, listPluginSkillPaths, loadFullSkill, loadSkillFileContent, loadSkillMetadata, parseArguments, parseSkillMarkdown, registerPluginSkillPath, resetSkillRegistry, resolveSkillContent, unregisterPluginSkillPath };
333
- export type { DiscoveryResult, ExecutionMode, ExecutionOptions, SkillExpansionResult };
1
+ export { I as ISkillRegistry, c as IVariableResolver, R as ResolvedSkillSource, d as Skill, e as SkillArtifact, b as SkillContext, a as SkillDynamicContextExecutor, f as SkillFile, g as SkillFrontmatter, h as SkillHook, i as SkillHooks, S as SkillMetadata, j as SkillPathsConfig, k as SkillResult, l as SkillSource, m as getDefaultSkillPaths, n as getSkillPathsFlat } from './types-chunks/types.d-ssh6zRaf.js';
2
+ export { D as DiscoveryResult, E as ExecutionMode, a as ExecutionOptions, S as SkillExecutor, b as SkillExpansionResult, c as SkillRegistry, V as VariableResolver, d as clearPluginSkillPaths, e as createExecutor, f as createResolver, g as discoverSkills, h as discoverSkillsWithMonorepo, i as executeSkill, j as expandSkillForLLM, k as formatSkillActivationMessage, m as getNestedSkillPaths, n as getSkillRegistry, o as initializeSkillRegistry, p as listPluginSkillPaths, q as loadFullSkill, r as loadSkillFileContent, s as loadSkillMetadata, t as parseArguments, u as parseSkillMarkdown, v as registerPluginSkillPath, w as resetSkillRegistry, x as resolveSkillContent, y as unregisterPluginSkillPath } from './types-chunks/sdk-skills-Bg1yL4i4.js';
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{Ad as g,Bd as u,Cd as c,Dd as d,Ed as x,Fd as P,Gd as R,Hd as h,Id as p,Jd as v,Kd as y,Ld as M,Md as f,Nd as m,Od as E,gc as l,hc as e,ic as i,jc as t,kc as o,lc as a,pc as k,qc as r,rc as S,sc as s,zd as n}from"./chunks/chunk-7XSZVOG7.js";import"./chunks/chunk-QFV6YCIH.js";import"./chunks/chunk-ONUPGMER.js";export{y as SkillExecutor,R as SkillRegistry,d as VariableResolver,t as clearPluginSkillPaths,M as createExecutor,x as createResolver,n as discoverSkills,u as discoverSkillsWithMonorepo,f as executeSkill,m as expandSkillForLLM,E as formatSkillActivationMessage,o as getDefaultSkillPaths,g as getNestedSkillPaths,a as getSkillPathsFlat,h as getSkillRegistry,p as initializeSkillRegistry,i as listPluginSkillPaths,S as loadFullSkill,s as loadSkillFileContent,r as loadSkillMetadata,c as parseArguments,k as parseSkillMarkdown,l as registerPluginSkillPath,v as resetSkillRegistry,P as resolveSkillContent,e as unregisterPluginSkillPath};
2
+ import{Ad as g,Bd as u,Cd as c,Dd as d,Ed as x,Fd as P,Hd as R,Id as h,Jd as p,Kd as v,Ld as y,Md as M,Nd as f,Od as m,Pd as E,gc as l,hc as e,ic as i,jc as t,kc as o,lc as a,pc as k,qc as r,rc as S,sc as s,zd as n}from"./chunks/chunk-UNRHTOT5.js";import"./chunks/chunk-77PNP27P.js";import"./chunks/chunk-ONUPGMER.js";export{y as SkillExecutor,R as SkillRegistry,d as VariableResolver,t as clearPluginSkillPaths,M as createExecutor,x as createResolver,n as discoverSkills,u as discoverSkillsWithMonorepo,f as executeSkill,m as expandSkillForLLM,E as formatSkillActivationMessage,o as getDefaultSkillPaths,g as getNestedSkillPaths,a as getSkillPathsFlat,h as getSkillRegistry,p as initializeSkillRegistry,i as listPluginSkillPaths,S as loadFullSkill,s as loadSkillFileContent,r as loadSkillMetadata,c as parseArguments,k as parseSkillMarkdown,l as registerPluginSkillPath,v as resetSkillRegistry,P as resolveSkillContent,e as unregisterPluginSkillPath};