@kodax-ai/kodax 0.7.57 → 0.7.59

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 (77) hide show
  1. package/CHANGELOG.md +2032 -1920
  2. package/README.md +1228 -1219
  3. package/README_CN.md +647 -638
  4. package/dist/chunks/agent-QQCRBU4C.js +2 -0
  5. package/dist/chunks/argument-completer-7Q2T4YWA.js +2 -0
  6. package/dist/chunks/{chunk-LZKGOR2C.js → chunk-2UUOFT3Z.js} +1 -1
  7. package/dist/chunks/chunk-5GPJ6MB5.js +405 -0
  8. package/dist/chunks/chunk-BEXLPFFB.js +7 -0
  9. package/dist/chunks/chunk-D6QVXQNI.js +1 -0
  10. package/dist/chunks/chunk-D7RENPQQ.js +322 -0
  11. package/dist/chunks/chunk-PRIBJN5E.js +683 -0
  12. package/dist/chunks/chunk-S4GVQO3W.js +31 -0
  13. package/dist/chunks/chunk-SDSLWDAZ.js +17 -0
  14. package/dist/chunks/chunk-SVEJFERZ.js +326 -0
  15. package/dist/chunks/chunk-TBXP7FEG.js +52 -0
  16. package/dist/chunks/chunk-UA744TZM.js +2 -0
  17. package/dist/chunks/{chunk-YSVPF6SN.js → chunk-UXQILGRX.js} +262 -259
  18. package/dist/chunks/{chunk-4SHP3M67.js → chunk-YADBB5GN.js} +1 -1
  19. package/dist/chunks/chunk-Z23LK3IV.js +310 -0
  20. package/dist/chunks/chunk-Z3ZXV3DZ.js +18 -0
  21. package/dist/chunks/compaction-config-GQIPCVFD.js +2 -0
  22. package/dist/chunks/{construction-bootstrap-55B7Q5RX.js → construction-bootstrap-YON4ZEMO.js} +1 -1
  23. package/dist/chunks/dist-73L4OYPD.js +2 -0
  24. package/dist/chunks/dist-EZXBR6NW.js +2 -0
  25. package/dist/chunks/host-LO6ZNTMV.js +2 -0
  26. package/dist/chunks/paste-4THGP5XW.js +2 -0
  27. package/dist/chunks/run-manager-HTLXKU66.js +2 -0
  28. package/dist/chunks/utils-5XVW33SY.js +2 -0
  29. package/dist/index.d.ts +15 -14
  30. package/dist/index.js +2 -2
  31. package/dist/kodax_cli.js +1222 -1047
  32. package/dist/provider-capabilities.json +971 -986
  33. package/dist/sdk-agent.d.ts +156 -14
  34. package/dist/sdk-agent.js +1 -1
  35. package/dist/sdk-coding.d.ts +253 -188
  36. package/dist/sdk-coding.js +1 -1
  37. package/dist/sdk-llm.d.ts +66 -43
  38. package/dist/sdk-llm.js +1 -1
  39. package/dist/sdk-mcp.js +1 -1
  40. package/dist/sdk-media.d.ts +18 -2
  41. package/dist/sdk-media.js +1 -1
  42. package/dist/sdk-repl.d.ts +21 -22
  43. package/dist/sdk-repl.js +2 -2
  44. package/dist/sdk-session.d.ts +8 -7
  45. package/dist/sdk-session.js +1 -1
  46. package/dist/sdk-skills.d.ts +4 -231
  47. package/dist/sdk-skills.js +1 -1
  48. package/dist/types-chunks/{base.d-BnjQrSVf.d.ts → base.d-BA9Doaj_.d.ts} +3 -3
  49. package/dist/types-chunks/{bash-prefix-extractor.d-BgvMbfq6.d.ts → bash-prefix-extractor.d-BNdpV4Cf.d.ts} +515 -69
  50. package/dist/types-chunks/capability-learning.d-DRV80ISB.d.ts +29 -0
  51. package/dist/types-chunks/{cost-tracker.d-wRtyEW9d.d.ts → cost-tracker.d-CBLk1fiD.d.ts} +24 -2
  52. package/dist/types-chunks/{guardrail.d-C1DhxnvC.d.ts → guardrail.d-CNdKuSD_.d.ts} +4 -4
  53. package/dist/types-chunks/{process.d-BZncyzEj.d.ts → process.d-BOrAxjvM.d.ts} +188 -15
  54. package/dist/types-chunks/{resolver.d-ZvKQgl0X.d.ts → resolver.d-DFAKKUvt.d.ts} +87 -4
  55. package/dist/types-chunks/{capsule.d-DwJp5r63.d.ts → run-manager.d-CsJC9zYf.d.ts} +113 -5
  56. package/dist/types-chunks/{sdk-session-DAScB0rW.d.ts → sdk-session-ByZlwgdM.d.ts} +83 -9
  57. package/dist/types-chunks/{storage.d-CPvn9qI0.d.ts → storage.d-DHL3XpAL.d.ts} +2 -2
  58. package/dist/types-chunks/{guardrail.d-BP3yyr6u.d.ts → types.d-CE_Ter29.d.ts} +125 -3
  59. package/dist/types-chunks/{types.d-6VOXvF88.d.ts → types.d-Ci5YPFEh.d.ts} +39 -5
  60. package/dist/types-chunks/types.d-vJExiRje.d.ts +232 -0
  61. package/dist/types-chunks/{utils.d-CpgVIjYZ.d.ts → utils.d-D9FHU4wB.d.ts} +84 -6
  62. package/package.json +2 -2
  63. package/dist/chunks/agent-EHWQZA4C.js +0 -2
  64. package/dist/chunks/argument-completer-AYDAYGKL.js +0 -2
  65. package/dist/chunks/chunk-3WWPJGPQ.js +0 -2
  66. package/dist/chunks/chunk-KN6IJMTB.js +0 -636
  67. package/dist/chunks/chunk-MJFPFRGK.js +0 -423
  68. package/dist/chunks/chunk-N2N2W3AQ.js +0 -584
  69. package/dist/chunks/chunk-PCPFLPS4.js +0 -5
  70. package/dist/chunks/chunk-TCLSPUTR.js +0 -31
  71. package/dist/chunks/chunk-VACH6QWN.js +0 -315
  72. package/dist/chunks/compaction-config-TLDMFMZO.js +0 -2
  73. package/dist/chunks/dist-IE4HVWP7.js +0 -2
  74. package/dist/chunks/dist-IKOK2MJQ.js +0 -2
  75. package/dist/chunks/paste-WTL2XN7P.js +0 -2
  76. package/dist/chunks/utils-EJ2VCRTC.js +0 -2
  77. package/dist/types-chunks/types.d-D8WcfrOD.d.ts +0 -143
@@ -1,232 +1,5 @@
1
- /**
2
- * Agent Skills Standard Type Definitions
3
- * Compliant with https://agentskills.io/ specification
4
- *
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; still invokable by explicit slash forms. */
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.
121
- *
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
141
- * ```ts
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
- * };
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
- }>;
1
+ import { l as SkillSource, S as Skill, e as SkillFile, i as SkillMetadata, f as SkillFrontmatter, j as SkillPathsConfig, a as IVariableResolver, c as SkillContext, I as ISkillRegistry, k as SkillResult } from './types-chunks/types.d-vJExiRje.js';
2
+ export { b as SkillArtifact, d as SkillDynamicContextExecutor, g as SkillHook, h as SkillHooks, m as getDefaultSkillPaths, n as getSkillPathsFlat } from './types-chunks/types.d-vJExiRje.js';
230
3
 
231
4
  declare function registerPluginSkillPath(skillPath: string): () => void;
232
5
  declare function unregisterPluginSkillPath(skillPath: string): boolean;
@@ -556,5 +329,5 @@ declare function expandSkillForLLM(skill: Skill, args: string, context: SkillCon
556
329
  */
557
330
  declare function formatSkillActivationMessage(skillName: string, args: string): string;
558
331
 
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 };
332
+ export { ISkillRegistry, IVariableResolver, Skill, SkillContext, SkillExecutor, SkillFile, SkillFrontmatter, SkillMetadata, SkillPathsConfig, SkillRegistry, SkillResult, SkillSource, 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,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{Cc as k,Dc as r,Ec as S,Fc as s,Gc as n,Hc as g,Ic as u,Jc as c,Kc as x,Lc as d,Mc as P,Nc as R,Oc as h,Pc as p,Qc as v,Rc as y,Sc as M,Tc as f,Uc as m,Vc as E,tc as l,uc as e,vc as i,wc as t,xc as a,yc as o}from"./chunks/chunk-N2N2W3AQ.js";import"./chunks/chunk-V4WSBIXB.js";export{y as SkillExecutor,R as SkillRegistry,x as VariableResolver,t as clearPluginSkillPaths,M as createExecutor,d as createResolver,n as discoverSkills,u as discoverSkillsWithMonorepo,f as executeSkill,m as expandSkillForLLM,E as formatSkillActivationMessage,a as getDefaultSkillPaths,g as getNestedSkillPaths,o 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{Ac as o,Ec as k,Fc as r,Gc as S,Hc as s,Ic as n,Jc as g,Kc as u,Lc as c,Mc as x,Nc as d,Oc as P,Pc as R,Qc as h,Rc as p,Sc as v,Tc as y,Uc as M,Vc as f,Wc as m,Xc as E,vc as l,wc as e,xc as i,yc as t,zc as a}from"./chunks/chunk-PRIBJN5E.js";import"./chunks/chunk-BEXLPFFB.js";import"./chunks/chunk-V4WSBIXB.js";export{y as SkillExecutor,R as SkillRegistry,x as VariableResolver,t as clearPluginSkillPaths,M as createExecutor,d as createResolver,n as discoverSkills,u as discoverSkillsWithMonorepo,f as executeSkill,m as expandSkillForLLM,E as formatSkillActivationMessage,a as getDefaultSkillPaths,g as getNestedSkillPaths,o 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};
@@ -1,9 +1,9 @@
1
- import { p as KodaXProviderConfig, j as KodaXMessage, _ as KodaXToolDefinition, G as KodaXReasoningRequest, x as KodaXProviderStreamOptions, M as KodaXStreamResult, a4 as KodaXVerifyCredentialResult, k as KodaXModelDescriptor, o as KodaXProviderCapabilityProfile, A as KodaXReasoningCapability, F as KodaXReasoningProfile, m as KodaXNormalizedReasoningRequest, a6 as KodaXWireReasoningEffort } from './types.d-6VOXvF88.js';
1
+ import { p as KodaXProviderConfig, j as KodaXMessage, _ as KodaXToolDefinition, G as KodaXReasoningRequest, x as KodaXProviderStreamOptions, M as KodaXStreamResult, a4 as KodaXVerifyCredentialResult, k as KodaXModelDescriptor, o as KodaXProviderCapabilityProfile, A as KodaXReasoningCapability, F as KodaXReasoningProfile, m as KodaXNormalizedReasoningRequest, a6 as KodaXWireReasoningEffort } from './types.d-Ci5YPFEh.js';
2
2
 
3
3
  /**
4
4
  * Retry-After header parsing — FEATURE_130 (v0.7.36).
5
5
  *
6
- * Handles the four forms KodaX's 12 provider adapters encounter when a
6
+ * Handles the four forms KodaX's built-in provider adapters encounter when a
7
7
  * model returns 429 (rate limit) or 503/529 (overloaded):
8
8
  *
9
9
  * 1. `Retry-After: 120` — integer seconds (HTTP 7231 standard)
@@ -277,7 +277,7 @@ declare abstract class KodaXBaseProvider {
277
277
  * Returns milliseconds, or undefined when no usable header is present.
278
278
  *
279
279
  * FEATURE_130 (v0.7.36): now delegates to the shared `parseRetryAfter`
280
- * helper so all 12 provider adapters get 4-form coverage without each
280
+ * helper so all built-in provider adapters get 4-form coverage without each
281
281
  * adapter rolling its own parser. The 4 forms supported are:
282
282
  * - `Retry-After: <integer-seconds>`
283
283
  * - `Retry-After: <HTTP-date>`