@kodax-ai/kodax 0.7.76 → 0.7.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +758 -371
- package/LICENSE +158 -158
- package/README.md +1702 -1508
- package/README_CN.md +1019 -869
- package/config-templates/config.example.jsonc +86 -4
- package/config-templates/integrations/a2a.example.jsonc +98 -98
- package/config-templates/integrations/extensions.example.jsonc +7 -7
- package/config-templates/integrations/mcp.example.jsonc +16 -16
- package/dist/builtin/code-review/SKILL.md +22 -22
- package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -62
- package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -33
- package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -73
- package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -23
- package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -14
- package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -29
- package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -38
- package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -8
- package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -66
- package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -49
- package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -58
- package/dist/chunks/agent-ASP4MS3X.js +2 -0
- package/dist/chunks/argument-completer-JYQ7FX3W.js +2 -0
- package/dist/chunks/chunk-2CFHBKRE.js +5 -0
- package/dist/chunks/chunk-35PPHOQ2.js +292 -0
- package/dist/chunks/chunk-43QNNDHR.js +29 -0
- package/dist/chunks/chunk-5BNQXXGY.js +1 -0
- package/dist/chunks/chunk-5GO6FH7L.js +458 -0
- package/dist/chunks/chunk-5NDCSFOP.js +78 -0
- package/dist/chunks/chunk-6FOJVETH.js +22 -0
- package/dist/chunks/chunk-6XM4B6K2.js +48 -0
- package/dist/chunks/chunk-6YZUE6NC.js +240 -0
- package/dist/chunks/{chunk-RDXRM3UI.js → chunk-7OEBJGHK.js} +1 -1
- package/dist/chunks/chunk-KQLQYHWU.js +386 -0
- package/dist/chunks/chunk-NXO6GWSY.js +46 -0
- package/dist/chunks/chunk-T2XZTLYE.js +316 -0
- package/dist/chunks/chunk-TQDBTTIM.js +348 -0
- package/dist/chunks/{chunk-SMT2JSM3.js → chunk-UID7BLAB.js} +9 -9
- package/dist/chunks/chunk-VAT2QYXM.js +765 -0
- package/dist/chunks/chunk-YAZQTC2L.js +5 -0
- package/dist/chunks/chunk-YVRYHC4C.js +655 -0
- package/dist/chunks/{chunk-PXKSE54E.js → chunk-Z3KFRTSB.js} +1 -1
- package/dist/chunks/compaction-config-BQSSIWK5.js +2 -0
- package/dist/chunks/{construction-bootstrap-5F5KF2BZ.js → construction-bootstrap-VQLQGWPY.js} +1 -1
- package/dist/chunks/dist-BFT5YIGU.js +2 -0
- package/dist/chunks/dist-PCFE24YP.js +2 -0
- package/dist/chunks/host-UTFXCYYM.js +2 -0
- package/dist/chunks/run-manager-PJU3WIFJ.js +2 -0
- package/dist/chunks/utils-SID4HW2Q.js +2 -0
- package/dist/index.d.ts +21 -19
- package/dist/index.js +6 -6
- package/dist/kodax_bootstrap.js +25 -25
- package/dist/kodax_cli.js +1787 -1341
- package/dist/kodax_resume.js +17 -17
- package/dist/provider-capabilities.json +392 -362
- package/dist/runtime-worker.js +1707 -1279
- package/dist/sandbox-workspace-session.js +563 -0
- package/dist/sdk-a2a.d.ts +18 -17
- package/dist/sdk-a2a.js +8 -8
- package/dist/sdk-agent.d.ts +320 -70
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +135 -168
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +14 -597
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +219 -6
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +70 -27
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +212 -149
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +93 -0
- package/dist/sdk-sandbox.js +2 -0
- package/dist/sdk-session.d.ts +8 -8
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +2 -2
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +15 -15
- package/dist/types-chunks/{base.d-ChvpaKjZ.d.ts → base.d-4e74xDdy.d.ts} +13 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-r1beOESM.d.ts → bash-prefix-extractor.d-uAe2Oqda.d.ts} +319 -9
- package/dist/types-chunks/{capability-learning.d-DPrYxRjF.d.ts → capability-learning.d-CVsdHw4j.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-zeqV4IQX.d.ts → capsule.d-BlSv9l3V.d.ts} +2 -2
- package/dist/types-chunks/{guardrail.d-CWYD1bdL.d.ts → guardrail.d-BRE_ErEj.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-qjuKJZ31.d.ts → guardrail.d-CXDYRgZ3.d.ts} +201 -35
- package/dist/types-chunks/{history-retrieval.d-BKTJIrVd.d.ts → history-retrieval.d-DtCy7x64.d.ts} +2 -2
- package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts} +23 -8
- package/dist/types-chunks/{public-api.d-CX4B11qY.d.ts → public-api.d-B3AohsxN.d.ts} +37 -8
- package/dist/types-chunks/{commands.d-DUxnK2TU.d.ts → repl.d-Ie_ZXb_U.d.ts} +89 -78
- package/dist/types-chunks/{side-query.d-DWTMsndP.d.ts → resolver.d-iAQ9ocLB.d.ts} +23 -74
- package/dist/types-chunks/{run-manager.d-B9fEIjZk.d.ts → run-manager.d-D1twIhF9.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-B0fhAOPa.d.ts → sdk-session-DB9KksIx.d.ts} +3 -3
- package/dist/types-chunks/side-query.d-DTuLPcC5.d.ts +77 -0
- package/dist/types-chunks/types-D3g6XUQr.d.ts +662 -0
- package/dist/types-chunks/{types.d-sRLugmjy.d.ts → types.d-BA-Jwpfs.d.ts} +506 -11
- package/dist/types-chunks/{types.d-DEctY20M.d.ts → types.d-BH0ZkTGf.d.ts} +2 -2
- package/dist/types-chunks/{types.d-DCQVBqVn.d.ts → types.d-BbtGlKZu.d.ts} +25 -3
- package/dist/types-chunks/{types.d-CSmF0t0n.d.ts → types.d-DIpZJKUl.d.ts} +15 -0
- package/dist/types-chunks/{types.d-Bm_y6YuM.d.ts → types.d-DVDTIfB_.d.ts} +4 -4
- package/dist/types-chunks/{utils.d-D0wPxz8y.d.ts → utils.d-CVp6bFl9.d.ts} +23 -7
- package/docs/SDK_EMBEDDER_GUIDE.md +592 -119
- package/package.json +9 -1
- package/scripts/kodax-bin.cjs +28 -28
- package/scripts/production-env.cjs +25 -25
- package/dist/chunks/agent-7X5CFET2.js +0 -2
- package/dist/chunks/argument-completer-3NHIKB4N.js +0 -2
- package/dist/chunks/chunk-4PWPNCNK.js +0 -158
- package/dist/chunks/chunk-7FJNLJLF.js +0 -369
- package/dist/chunks/chunk-COQYLD4U.js +0 -5
- package/dist/chunks/chunk-D3T24FJW.js +0 -78
- package/dist/chunks/chunk-EI4JBQKL.js +0 -46
- package/dist/chunks/chunk-HGT6WQ24.js +0 -321
- package/dist/chunks/chunk-HS3XHF3R.js +0 -622
- package/dist/chunks/chunk-IDCGNQ4H.js +0 -5
- package/dist/chunks/chunk-KAY2XLCP.js +0 -74
- package/dist/chunks/chunk-OD6LVXU6.js +0 -329
- package/dist/chunks/chunk-OSF3H4RR.js +0 -22
- package/dist/chunks/chunk-TGMBHGZO.js +0 -427
- package/dist/chunks/chunk-VWSLC2WO.js +0 -770
- package/dist/chunks/chunk-Y3AMP22L.js +0 -37
- package/dist/chunks/compaction-config-7J2XE35D.js +0 -2
- package/dist/chunks/dist-2RA7LSH3.js +0 -2
- package/dist/chunks/dist-URKXBOC6.js +0 -2
- package/dist/chunks/host-RKZ2OGFT.js +0 -2
- package/dist/chunks/run-manager-7RM4HEH6.js +0 -2
- package/dist/chunks/utils-X3TEH6IO.js +0 -2
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +0 -91
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
export interface SkillEvalAssertion {
|
|
2
|
-
text: string;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export interface SkillEvalItem {
|
|
6
|
-
id?: string | number;
|
|
7
|
-
name?: string;
|
|
8
|
-
prompt?: string;
|
|
9
|
-
query?: string;
|
|
10
|
-
expected_output?: string;
|
|
11
|
-
files?: string[];
|
|
12
|
-
assertions?: Array<string | SkillEvalAssertion>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SkillEvalExecution {
|
|
16
|
-
result: {
|
|
17
|
-
success: boolean;
|
|
18
|
-
lastText: string;
|
|
19
|
-
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
20
|
-
signalReason?: string;
|
|
21
|
-
messages: Array<Record<string, unknown>>;
|
|
22
|
-
sessionId: string;
|
|
23
|
-
interrupted?: boolean;
|
|
24
|
-
limitReached?: boolean;
|
|
25
|
-
};
|
|
26
|
-
totalTokens: number;
|
|
27
|
-
durationMs: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface RunEvalWorkspaceOptions {
|
|
31
|
-
skillPath: string;
|
|
32
|
-
evalsPath: string;
|
|
33
|
-
workspaceDir: string;
|
|
34
|
-
provider?: string;
|
|
35
|
-
model?: string;
|
|
36
|
-
runsPerConfig?: number;
|
|
37
|
-
maxIter?: number;
|
|
38
|
-
reasoningMode?: string;
|
|
39
|
-
cwd?: string;
|
|
40
|
-
configs?: string[];
|
|
41
|
-
output?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function buildEvalPrompt(
|
|
45
|
-
evalItem: SkillEvalItem,
|
|
46
|
-
options: Pick<RunEvalWorkspaceOptions, 'evalsPath' | 'cwd'>
|
|
47
|
-
): Promise<string>;
|
|
48
|
-
|
|
49
|
-
export function runEvalWorkspace(
|
|
50
|
-
options: RunEvalWorkspaceOptions,
|
|
51
|
-
runner?: (
|
|
52
|
-
prompt: string,
|
|
53
|
-
options: RunEvalWorkspaceOptions & {
|
|
54
|
-
configName: string;
|
|
55
|
-
evalItem: SkillEvalItem;
|
|
56
|
-
runIndex: number;
|
|
57
|
-
}
|
|
58
|
-
) => Promise<SkillEvalExecution>
|
|
59
|
-
): Promise<{
|
|
60
|
-
workspace: string;
|
|
61
|
-
skill_name: string;
|
|
62
|
-
eval_count: number;
|
|
63
|
-
configs: string[];
|
|
64
|
-
runs_per_config: number;
|
|
65
|
-
reports: Array<Record<string, unknown>>;
|
|
66
|
-
}>;
|
|
1
|
+
export interface SkillEvalAssertion {
|
|
2
|
+
text: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface SkillEvalItem {
|
|
6
|
+
id?: string | number;
|
|
7
|
+
name?: string;
|
|
8
|
+
prompt?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
expected_output?: string;
|
|
11
|
+
files?: string[];
|
|
12
|
+
assertions?: Array<string | SkillEvalAssertion>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SkillEvalExecution {
|
|
16
|
+
result: {
|
|
17
|
+
success: boolean;
|
|
18
|
+
lastText: string;
|
|
19
|
+
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
20
|
+
signalReason?: string;
|
|
21
|
+
messages: Array<Record<string, unknown>>;
|
|
22
|
+
sessionId: string;
|
|
23
|
+
interrupted?: boolean;
|
|
24
|
+
limitReached?: boolean;
|
|
25
|
+
};
|
|
26
|
+
totalTokens: number;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RunEvalWorkspaceOptions {
|
|
31
|
+
skillPath: string;
|
|
32
|
+
evalsPath: string;
|
|
33
|
+
workspaceDir: string;
|
|
34
|
+
provider?: string;
|
|
35
|
+
model?: string;
|
|
36
|
+
runsPerConfig?: number;
|
|
37
|
+
maxIter?: number;
|
|
38
|
+
reasoningMode?: string;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
configs?: string[];
|
|
41
|
+
output?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function buildEvalPrompt(
|
|
45
|
+
evalItem: SkillEvalItem,
|
|
46
|
+
options: Pick<RunEvalWorkspaceOptions, 'evalsPath' | 'cwd'>
|
|
47
|
+
): Promise<string>;
|
|
48
|
+
|
|
49
|
+
export function runEvalWorkspace(
|
|
50
|
+
options: RunEvalWorkspaceOptions,
|
|
51
|
+
runner?: (
|
|
52
|
+
prompt: string,
|
|
53
|
+
options: RunEvalWorkspaceOptions & {
|
|
54
|
+
configName: string;
|
|
55
|
+
evalItem: SkillEvalItem;
|
|
56
|
+
runIndex: number;
|
|
57
|
+
}
|
|
58
|
+
) => Promise<SkillEvalExecution>
|
|
59
|
+
): Promise<{
|
|
60
|
+
workspace: string;
|
|
61
|
+
skill_name: string;
|
|
62
|
+
eval_count: number;
|
|
63
|
+
configs: string[];
|
|
64
|
+
runs_per_config: number;
|
|
65
|
+
reports: Array<Record<string, unknown>>;
|
|
66
|
+
}>;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import type { ImproveDescriptionOptions, ImproveDescriptionResult } from './improve-description.js';
|
|
2
|
-
import type { TriggerEvalOptions, TriggerEvalReport } from './run-trigger-eval.js';
|
|
3
|
-
|
|
4
|
-
export interface DescriptionLoopRecord {
|
|
5
|
-
iteration: number;
|
|
6
|
-
description: string;
|
|
7
|
-
score: string;
|
|
8
|
-
train: TriggerEvalReport['summary'];
|
|
9
|
-
test: TriggerEvalReport['summary'] | null;
|
|
10
|
-
train_results: TriggerEvalReport['results'];
|
|
11
|
-
test_results: TriggerEvalReport['results'];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface DescriptionLoopReport {
|
|
15
|
-
skill_name: string;
|
|
16
|
-
original_description: string;
|
|
17
|
-
final_description: string;
|
|
18
|
-
best_description: string;
|
|
19
|
-
history: DescriptionLoopRecord[];
|
|
20
|
-
train_size: number;
|
|
21
|
-
test_size: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface DescriptionLoopOptions extends TriggerEvalOptions {
|
|
25
|
-
workspaceDir: string;
|
|
26
|
-
maxIterations: number;
|
|
27
|
-
holdout?: number;
|
|
28
|
-
seed?: number;
|
|
29
|
-
writeBest?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function splitEvalSet(
|
|
33
|
-
evals: Array<Record<string, unknown> & { should_trigger?: boolean }>,
|
|
34
|
-
holdout?: number,
|
|
35
|
-
seed?: number
|
|
36
|
-
): {
|
|
37
|
-
train: Array<Record<string, unknown> & { should_trigger?: boolean }>;
|
|
38
|
-
test: Array<Record<string, unknown> & { should_trigger?: boolean }>;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export function runDescriptionLoop(
|
|
42
|
-
options: DescriptionLoopOptions,
|
|
43
|
-
dependencies?: {
|
|
44
|
-
runTriggerEvalFn?: (options: TriggerEvalOptions) => Promise<TriggerEvalReport>;
|
|
45
|
-
improveDescriptionFn?: (
|
|
46
|
-
options: ImproveDescriptionOptions
|
|
47
|
-
) => Promise<ImproveDescriptionResult>;
|
|
48
|
-
}
|
|
49
|
-
): Promise<DescriptionLoopReport>;
|
|
1
|
+
import type { ImproveDescriptionOptions, ImproveDescriptionResult } from './improve-description.js';
|
|
2
|
+
import type { TriggerEvalOptions, TriggerEvalReport } from './run-trigger-eval.js';
|
|
3
|
+
|
|
4
|
+
export interface DescriptionLoopRecord {
|
|
5
|
+
iteration: number;
|
|
6
|
+
description: string;
|
|
7
|
+
score: string;
|
|
8
|
+
train: TriggerEvalReport['summary'];
|
|
9
|
+
test: TriggerEvalReport['summary'] | null;
|
|
10
|
+
train_results: TriggerEvalReport['results'];
|
|
11
|
+
test_results: TriggerEvalReport['results'];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DescriptionLoopReport {
|
|
15
|
+
skill_name: string;
|
|
16
|
+
original_description: string;
|
|
17
|
+
final_description: string;
|
|
18
|
+
best_description: string;
|
|
19
|
+
history: DescriptionLoopRecord[];
|
|
20
|
+
train_size: number;
|
|
21
|
+
test_size: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface DescriptionLoopOptions extends TriggerEvalOptions {
|
|
25
|
+
workspaceDir: string;
|
|
26
|
+
maxIterations: number;
|
|
27
|
+
holdout?: number;
|
|
28
|
+
seed?: number;
|
|
29
|
+
writeBest?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function splitEvalSet(
|
|
33
|
+
evals: Array<Record<string, unknown> & { should_trigger?: boolean }>,
|
|
34
|
+
holdout?: number,
|
|
35
|
+
seed?: number
|
|
36
|
+
): {
|
|
37
|
+
train: Array<Record<string, unknown> & { should_trigger?: boolean }>;
|
|
38
|
+
test: Array<Record<string, unknown> & { should_trigger?: boolean }>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function runDescriptionLoop(
|
|
42
|
+
options: DescriptionLoopOptions,
|
|
43
|
+
dependencies?: {
|
|
44
|
+
runTriggerEvalFn?: (options: TriggerEvalOptions) => Promise<TriggerEvalReport>;
|
|
45
|
+
improveDescriptionFn?: (
|
|
46
|
+
options: ImproveDescriptionOptions
|
|
47
|
+
) => Promise<ImproveDescriptionResult>;
|
|
48
|
+
}
|
|
49
|
+
): Promise<DescriptionLoopReport>;
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
export interface TriggerEvalAttempt {
|
|
2
|
-
trigger: boolean;
|
|
3
|
-
reason: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface TriggerEvalItemResult {
|
|
7
|
-
query: string;
|
|
8
|
-
should_trigger: boolean;
|
|
9
|
-
triggers: number;
|
|
10
|
-
runs: number;
|
|
11
|
-
trigger_rate: number;
|
|
12
|
-
predicted_trigger: boolean;
|
|
13
|
-
pass: boolean;
|
|
14
|
-
attempts: TriggerEvalAttempt[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface TriggerEvalSummary {
|
|
18
|
-
passed: number;
|
|
19
|
-
failed: number;
|
|
20
|
-
total: number;
|
|
21
|
-
pass_rate: number;
|
|
22
|
-
precision: number;
|
|
23
|
-
recall: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface TriggerEvalReport {
|
|
27
|
-
skill_name: string;
|
|
28
|
-
description: string;
|
|
29
|
-
results: TriggerEvalItemResult[];
|
|
30
|
-
summary: TriggerEvalSummary;
|
|
31
|
-
meta: {
|
|
32
|
-
provider?: string;
|
|
33
|
-
model?: string | null;
|
|
34
|
-
runs_per_query: number;
|
|
35
|
-
trigger_threshold: number;
|
|
36
|
-
note: string;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface TriggerEvalOptions {
|
|
41
|
-
skillPath: string;
|
|
42
|
-
evalsPath: string;
|
|
43
|
-
provider?: string;
|
|
44
|
-
model?: string;
|
|
45
|
-
output?: string;
|
|
46
|
-
runsPerQuery?: number;
|
|
47
|
-
triggerThreshold?: number;
|
|
48
|
-
maxIter?: number;
|
|
49
|
-
reasoningMode?: string;
|
|
50
|
-
descriptionOverride?: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function parseTriggerDecision(text: string): TriggerEvalAttempt;
|
|
54
|
-
export function summarizeTriggerResults(results: TriggerEvalItemResult[]): TriggerEvalSummary;
|
|
55
|
-
export function runTriggerEval(
|
|
56
|
-
options: TriggerEvalOptions,
|
|
57
|
-
runner?: (prompt: string, options: TriggerEvalOptions) => Promise<string>
|
|
58
|
-
): Promise<TriggerEvalReport>;
|
|
1
|
+
export interface TriggerEvalAttempt {
|
|
2
|
+
trigger: boolean;
|
|
3
|
+
reason: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface TriggerEvalItemResult {
|
|
7
|
+
query: string;
|
|
8
|
+
should_trigger: boolean;
|
|
9
|
+
triggers: number;
|
|
10
|
+
runs: number;
|
|
11
|
+
trigger_rate: number;
|
|
12
|
+
predicted_trigger: boolean;
|
|
13
|
+
pass: boolean;
|
|
14
|
+
attempts: TriggerEvalAttempt[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface TriggerEvalSummary {
|
|
18
|
+
passed: number;
|
|
19
|
+
failed: number;
|
|
20
|
+
total: number;
|
|
21
|
+
pass_rate: number;
|
|
22
|
+
precision: number;
|
|
23
|
+
recall: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface TriggerEvalReport {
|
|
27
|
+
skill_name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
results: TriggerEvalItemResult[];
|
|
30
|
+
summary: TriggerEvalSummary;
|
|
31
|
+
meta: {
|
|
32
|
+
provider?: string;
|
|
33
|
+
model?: string | null;
|
|
34
|
+
runs_per_query: number;
|
|
35
|
+
trigger_threshold: number;
|
|
36
|
+
note: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TriggerEvalOptions {
|
|
41
|
+
skillPath: string;
|
|
42
|
+
evalsPath: string;
|
|
43
|
+
provider?: string;
|
|
44
|
+
model?: string;
|
|
45
|
+
output?: string;
|
|
46
|
+
runsPerQuery?: number;
|
|
47
|
+
triggerThreshold?: number;
|
|
48
|
+
maxIter?: number;
|
|
49
|
+
reasoningMode?: string;
|
|
50
|
+
descriptionOverride?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function parseTriggerDecision(text: string): TriggerEvalAttempt;
|
|
54
|
+
export function summarizeTriggerResults(results: TriggerEvalItemResult[]): TriggerEvalSummary;
|
|
55
|
+
export function runTriggerEval(
|
|
56
|
+
options: TriggerEvalOptions,
|
|
57
|
+
runner?: (prompt: string, options: TriggerEvalOptions) => Promise<string>
|
|
58
|
+
): Promise<TriggerEvalReport>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
+
import{Ja as g,La as h,Ya as i,a as c,cb as j,ra as d,sa as e,ta as f}from"./chunk-TQDBTTIM.js";import"./chunk-Z3KFRTSB.js";import"./chunk-KQLQYHWU.js";import"./chunk-YAZQTC2L.js";import"./chunk-5NDCSFOP.js";import{qb as a,rb as b}from"./chunk-VAT2QYXM.js";import"./chunk-6XM4B6K2.js";import"./chunk-2CFHBKRE.js";import"./chunk-NXO6GWSY.js";import"./chunk-ONUPGMER.js";export{e as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,f as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,c as emitResilienceDebug,d as estimateProviderPayloadBytes,j as runKodaX,i as saveSessionSnapshot,a as validateAndFixToolHistory};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
+
import{Ua as a,Va as b}from"./chunk-YVRYHC4C.js";import"./chunk-6YZUE6NC.js";import"./chunk-7OEBJGHK.js";import"./chunk-5GO6FH7L.js";import"./chunk-TQDBTTIM.js";import"./chunk-UID7BLAB.js";import"./chunk-Z3KFRTSB.js";import"./chunk-6FOJVETH.js";import"./chunk-KQLQYHWU.js";import"./chunk-YAZQTC2L.js";import"./chunk-5NDCSFOP.js";import"./chunk-VAT2QYXM.js";import"./chunk-6XM4B6K2.js";import"./chunk-2CFHBKRE.js";import"./chunk-NXO6GWSY.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
+
import{g as R,h as _}from"./chunk-NXO6GWSY.js";import{a as r}from"./chunk-ONUPGMER.js";var g={user:0,background:1};function Z(t,e){return g[t]<=g[e]}r(Z,"priorityWithinMax");function O(t,e){return!(t.agentId!==e.agentId||!Z(t.priority,e.maxPriority)||e.mode!==void 0&&t.mode!==e.mode||e.id!==void 0&&t.id!==e.id||e.predicate&&!e.predicate(t))}r(O,"matchesFilter");var E=class{static{r(this,"MessageQueue")}messages=[];nextSeq=1;listeners=new Set;snapshotRef=Object.freeze([]);notify(e){this.snapshotRef=Object.freeze([...this.messages]);for(let i of this.listeners)try{i(e)}catch{}}subscribe=r(e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),"subscribe");getSnapshot=r(()=>this.snapshotRef,"getSnapshot");enqueue(e){let i=`msg-${this.nextSeq++}`,o={id:i,priority:e.priority,mode:e.mode,content:e.content,agentId:e.agentId,inputArtifacts:e.inputArtifacts,taskResult:e.taskResult,enqueuedAt:Date.now()};return this.messages=[...this.messages,o],this.notify({kind:"enqueued",message:o}),i}dequeue(e){let i=[];for(let s=0;s<this.messages.length;s++){let m=this.messages[s];m&&O(m,e)&&i.push({originalIndex:s,message:m})}i.sort((s,m)=>{let l=g[s.message.priority]-g[m.message.priority];return l!==0?l:s.originalIndex-m.originalIndex});let o=e.limit,n=typeof o=="number"&&i.length>o?i.slice(0,o):i;if(n.length===0)return[];let a=new Set(n.map(s=>s.originalIndex));this.messages=this.messages.filter((s,m)=>!a.has(m));let d=n.map(s=>s.message);return this.notify({kind:"dequeued",messages:d}),d}peek(e){let i=[];for(let a=0;a<this.messages.length;a++){let d=this.messages[a];d&&O(d,e)&&i.push({originalIndex:a,message:d})}i.sort((a,d)=>{let s=g[a.message.priority]-g[d.message.priority];return s!==0?s:a.originalIndex-d.originalIndex});let o=e.limit;return(typeof o=="number"&&i.length>o?i.slice(0,o):i).map(a=>a.message)}size(){return this.messages.length}count(e){return this.peek(e).length}has(e){return this.count(e)>0}clear(){if(this.messages.length===0)return;let e=this.messages;this.messages=[],this.notify({kind:"cleared",messages:e})}},w;function h(){return w||(w=new E),w}r(h,"getMessageQueue");function ee(){w=void 0}r(ee,"_resetMessageQueueForTests");function A(t,e){return t?`actor:${t}:${e}`:e==="/root"?void 0:e}r(A,"actorQueueId");var f=new Map;function te(t){f.set(t,(f.get(t)??0)+1);let e=!1;return()=>{if(e)return;e=!0;let i=f.get(t);i===void 0||i<=1?f.delete(t):f.set(t,i-1)}}r(te,"registerActiveRootQueueRoute");function x(){if(f.size!==0){if(f.size===1)return f.keys().next().value;throw new Error("Cannot infer queued follow-up target: multiple Actor root sessions are active. Pass sessionId or agentId explicitly.")}}r(x,"resolveActiveRootQueueRoute");function ie(){f.clear()}r(ie,"_resetActiveRootQueueRoutesForTests");var N=new Set(["wait_agent"]);function $(t){return t.some(i=>N.has(i))?"background":"user"}r($,"midTurnDrainPriority");function re(t){let e=$(t.lastTurnToolNames);return h().dequeue({agentId:t.agentId,maxPriority:e,limit:t.limit})}r(re,"maybeDrainMidTurn");var u=class extends Error{static{r(this,"KodaXMediaError")}code;detail;cause;constructor(e,i,o={}){super(i),this.name="KodaXMediaError",this.code=e,this.detail=o.detail,this.cause=o.cause}},p=class extends u{static{r(this,"ImageResizeError")}constructor(e,i={}){super(i.code??"IMAGE_TOO_LARGE",e,i),this.name="ImageResizeError"}};import F from"node:path";var ne={".gif":"image/gif",".jpeg":"image/jpeg",".jpg":"image/jpeg",".png":"image/png",".webp":"image/webp"},oe={".3gp":"video/3gpp",".3gpp":"video/3gpp",".avi":"video/x-msvideo",".flv":"video/x-flv",".mov":"video/quicktime",".mp4":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".webm":"video/webm",".wmv":"video/x-ms-wmv"};function C(t){return ne[F.extname(t).toLowerCase()]}r(C,"inferImageMediaType");function U(t){return oe[F.extname(t).toLowerCase()]}r(U,"inferVideoMediaType");function ae(t,e={}){let i=e.mediaType??C(t);return{kind:"image",path:t,...i?{mediaType:i}:{},...e.source?{source:e.source}:{},...e.description?{description:e.description}:{}}}r(ae,"createImageArtifactFromPath");function se(t,e={}){if(e.mediaType!==void 0&&e.mimeType!==void 0&&e.mediaType!==e.mimeType)throw new u("UNSUPPORTED_MEDIA_TYPE",`File artifact mediaType and mimeType disagree: ${e.mediaType} != ${e.mimeType}.`);return{kind:"file",path:t,...e.mediaType?{mediaType:e.mediaType}:{},...e.mimeType?{mimeType:e.mimeType}:{},...e.name?{name:e.name}:{},...e.source?{source:e.source}:{},...e.description?{description:e.description}:{}}}r(se,"createFileArtifactFromPath");function de(t,e={}){let i=e.mediaType??U(t);if(!i)throw new u("UNSUPPORTED_MEDIA_TYPE",`Cannot infer video media type from path: ${t}.`);return{kind:"video",path:t,mediaType:i,...e.name?{name:e.name}:{},...e.source?{source:e.source}:{},...e.description?{description:e.description}:{}}}r(de,"createVideoArtifactFromPath");import{Jimp as me}from"jimp";var K=2e3,L=Math.floor(3.75*1024*1024),ue=[80,60,40];async function k(t,e={}){let i=e.maxDimension??K,o=e.targetBytes??L;if(t.length===0)throw new p("Empty image buffer.",{code:"IMAGE_DECODE_FAILED"});let n;try{n=await me.read(t)}catch(c){let I=c instanceof Error?c.message:String(c);throw new p(`Failed to decode image: ${I}`,{code:"IMAGE_DECODE_FAILED",cause:c})}let{width:a,height:d}=n.bitmap,s=Math.max(a,d);if(s>i){let c=i/s;n.resize({w:Math.max(1,Math.round(a*c)),h:Math.max(1,Math.round(d*c))})}let m=n.bitmap.width,l=n.bitmap.height;if(e.preferMediaType!=="image/jpeg"){let c=await n.getBuffer("image/png");if(c.length<=o)return{buffer:Buffer.from(c),mediaType:"image/png",width:m,height:l}}for(let c of ue){let I=await n.getBuffer("image/jpeg",{quality:c});if(I.length<=o)return{buffer:Buffer.from(I),mediaType:"image/jpeg",width:m,height:l}}if(e.preferMediaType==="image/jpeg"){let c=await n.getBuffer("image/png");if(c.length<=o)return{buffer:Buffer.from(c),mediaType:"image/png",width:m,height:l}}throw new p(`Image still exceeds budget (${o} bytes raw) after PNG and JPEG q40 compression. Try a smaller image or take a fresh screenshot of a smaller region.`,{code:"IMAGE_TOO_LARGE"})}r(k,"normalizePastedImage");import{spawn as j}from"node:child_process";import{mkdtemp as ce,readFile as fe,rm as pe}from"node:fs/promises";import{tmpdir as le}from"node:os";import q from"node:path";var B=5e3;async function G(){switch(process.platform){case"darwin":return he();case"win32":return Te();case"linux":return ye();default:throw new u("UNSUPPORTED_PLATFORM",`Clipboard image fallback is not supported on platform "${process.platform}".`)}}r(G,"readClipboardImage");async function ge(t={}){let e=await G();return e?k(e,t):null}r(ge,"readAndNormalizeClipboardImage");async function Y(t){let e=await ce(q.join(le(),"kodax-clip-")),i=q.join(e,"clip.png");try{return await t(i)}finally{await pe(e,{recursive:!0,force:!0}).catch(o=>{})}}r(Y,"runWithTempPng");async function he(){return Y(async t=>{let e=`set png_data to (the clipboard as \xABclass PNGf\xBB)
|
|
3
|
+
set fh to open for access POSIX file "${t.replace(/"/g,'\\"')}" with write permission
|
|
4
|
+
write png_data to fh
|
|
5
|
+
close access fh`;return await Q("osascript",["-e",e])?z(t):null})}r(he,"readMacClipboard");async function Te(){return Y(async t=>{let e=["Add-Type -AssemblyName System.Drawing | Out-Null","$img = Get-Clipboard -Format Image","if ($null -eq $img) { exit 1 }",`$img.Save('${t.replace(/'/g,"''")}', [System.Drawing.Imaging.ImageFormat]::Png)`].join("; ");return await Q("powershell",["-NoProfile","-Command",e])?z(t):null})}r(Te,"readWinClipboard");async function ye(){return await X("wl-paste",["--type","image/png"])??X("xclip",["-selection","clipboard","-t","image/png","-o"])}r(ye,"readLinuxClipboard");async function z(t){try{let e=await fe(t);return e.length>0?e:null}catch(e){return null}}r(z,"readNonEmptyFile");function Q(t,e){return new Promise(i=>{let o=!1,n=j(t,[...e],{stdio:"ignore",windowsHide:!0}),a=setTimeout(()=>{o||(o=!0,n.kill(),i(!1))},B);n.once("error",()=>{o||(o=!0,clearTimeout(a),i(!1))}),n.once("exit",d=>{o||(o=!0,clearTimeout(a),i(d===0))})})}r(Q,"runCommand");function X(t,e){return new Promise(i=>{let o=!1,n=[],a=j(t,[...e],{stdio:["ignore","pipe","ignore"],windowsHide:!0}),d=setTimeout(()=>{o||(o=!0,a.kill(),i(null))},B);a.stdout?.on("data",s=>n.push(s)),a.once("error",()=>{o||(o=!0,clearTimeout(d),i(null))}),a.once("exit",s=>{if(o)return;if(o=!0,clearTimeout(d),s!==0){i(null);return}let m=Buffer.concat(n);i(m.length>0?m:null)})})}r(X,"collectStdoutBytes");import{createHash as Ie}from"node:crypto";import{mkdir as we,readdir as Ee,stat as _e,unlink as Ae,writeFile as xe}from"node:fs/promises";import{tmpdir as ke}from"node:os";import M from"node:path";var V="KODAX_PASTE_TMP_DIR",W=1440*60*1e3;function H(){return process.env[V]??M.join(ke(),"kodax-paste")}r(H,"resolvePasteTmpDir");function Me(t){let e=t?.trim().replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return e&&e.length>0?e:"paste"}r(Me,"sanitizeFileNamePrefix");async function De(t,e={}){let i=e.directory??H();await we(i,{recursive:!0});let o=t.mediaType==="image/jpeg"?".jpg":".png",n=Ie("sha256").update(t.buffer).digest("hex").slice(0,16),a=`${Me(e.fileNamePrefix)}-${n}${o}`,d=M.join(i,a);return await xe(d,t.buffer),{type:"image",path:d,mediaType:t.mediaType}}r(De,"persistImageAsBlock");async function Pe(t=Date.now()){let e=H(),i;try{i=await Ee(e)}catch(a){return 0}let o=t-W,n=0;return await Promise.all(i.filter(a=>/-[0-9a-f]{16}\.(?:png|jpg)$/.test(a)).map(async a=>{let d=M.join(e,a);try{(await _e(d)).mtimeMs<o&&(await Ae(d),n+=1)}catch(s){}})),n}r(Pe,"prunePasteTmpDir");var T=["image/png","image/jpeg","image/webp","image/gif"],y=["video/mp4","video/mpeg","video/quicktime","video/x-msvideo","video/x-flv","video/webm","video/x-ms-wmv","video/3gpp"],ve=[],Se=new Set(["anthropic","openai"]),be=new Set(["ark-coding/doubao-seed-2.0-code","ark-coding/doubao-seed-2.0-pro","ark-coding/kimi-k2.6","ark-coding/kimi-k2.7-code","ark-coding/minimax-m3","kimi-code/k3-256k","qwen-token-plan/qwen3.8-max-preview","qwen-token-plan/qwen3.7-plus","qwen-token-plan/qwen3.6-flash"]),Re=new Set(["kimi-code/kimi-for-coding","kimi-code/kimi-for-coding-highspeed","kimi-code/k3","kimi/kimi-k3","kimi/kimi-k2.5","kimi/kimi-k2.6","kimi/kimi-k2.7-code","kimi/kimi-k2.7-code-highspeed","minimax-coding/minimax-m3","minimax/minimax-m3","mimo-coding/mimo-v2.5","mimo/mimo-v2.5"]);function D(t){return{nativeSupported:!1,sdkSupported:!1,status:"unsupported",mediaTypes:[],maxCount:0,reason:t}}r(D,"unsupported");function Oe(t){return{nativeSupported:!0,sdkSupported:!0,status:"supported",mediaTypes:T,nativeMediaTypes:T,reason:t}}r(Oe,"supportedImage");function Ne(t){return{nativeSupported:!0,sdkSupported:!1,status:"provider-native-unwired",mediaTypes:[],nativeMediaTypes:y,maxCount:0,reason:t}}r(Ne,"nativeVideoUnwired");function $e(t){return t.trim().toLowerCase()}r($e,"normalizeProvider");function Fe(t){return _[t]?.model}r(Fe,"resolveProviderDefaultModel");function J(t,e){if(!e)return;let i=e.trim().toLowerCase();if(t==="kimi"){if(i==="k2.5")return"kimi-k2.5";if(i==="k2.6")return"kimi-k2.6";if(i==="k2.7-code")return"kimi-k2.7-code";if(i==="k2.7-code-highspeed")return"kimi-k2.7-code-highspeed"}return(t==="minimax-coding"||t==="minimax")&&i==="minimax-m3"?"minimax-m3":i}r(J,"normalizeModel");function Ce(t){if(!Se.has(t))return!1;let e=_[t];return e?R(e.capabilityProfile).multimodalSupport!=="none":!1}r(Ce,"hasOfficialImageSupport");function Ue(t,e){let i=J(t,e);if(!i)return!1;let o=`${t}/${i}`;return Re.has(o)}r(Ue,"hasSourceBackedNativeMedia");function Ke(t,e){let i=J(t,e);return i?be.has(`${t}/${i}`):!1}r(Ke,"hasSourceBackedImage");function Le(t,e,i){if(i)return"source-backed";if(e){if(t==="openai")return"openai-official";if(t==="anthropic")return"anthropic-official"}}r(Le,"resolveImageCapabilityRoute");function qe(t){switch(t){case"openai-official":return"Model route supports KodaX image input. Direct-path image/gif is sent as image/gif, but OpenAI requires non-animated GIF semantics.";case"anthropic-official":return"Model route supports KodaX image input. Direct-path image/gif is sent as image/gif, but Anthropic uses only the first frame of animated GIFs.";case"source-backed":return"Model route supports KodaX image input. Direct-path image/gif is sent as image/gif; animated-GIF interpretation is provider-owned."}}r(qe,"imageCapabilityReason");function P(t){let e=$e(t.provider),i=t.model?.trim()||Fe(e),o=Ce(e),n=Ue(e,i),a=n||Ke(e,i),d=Le(e,o,a),s=d!==void 0,m=n;return{text:!0,image:s?Oe(qe(d)):D("No verified KodaX image-input route for this provider/model."),video:m?Ne("Model route is native-video capable, but KodaX SDK video sending is not wired yet. Reject or downgrade before send."):D("No verified native video route for this provider/model."),file:D("File artifact contract is stable, but KodaX SDK file sending/extraction is not wired yet. Reject or downgrade before send.")}}r(P,"getModelInputCapabilities");function Xe(t){return T.includes(t)}r(Xe,"isKnownImageMediaType");function je(t){return y.includes(t)}r(je,"isKnownVideoMediaType");function v(t){return`${t.provider}${t.model?`/${t.model}`:""}`}r(v,"routeLabel");function S(t){return t.reason?`${t.status}: ${t.reason}`:t.status}r(S,"capabilityDetail");function b(t,e){if(t.length===0)return;let i=P(e);for(let o of t){let n=o;if(n.kind==="image"){if(!i.image.nativeSupported||!i.image.sdkSupported)throw new u("MODEL_INPUT_UNSUPPORTED",`Provider/model cannot consume image artifacts: ${v(e)}.`,{detail:S(i.image)});if(typeof n.mediaType=="string"&&!Xe(n.mediaType))throw new u("UNSUPPORTED_MEDIA_TYPE",`Unsupported image media type: ${n.mediaType}.`);continue}throw n.kind==="video"?typeof n.mediaType!="string"||!je(n.mediaType)?new u("UNSUPPORTED_MEDIA_TYPE",`Unsupported video media type: ${String(n.mediaType)}.`,{detail:`Supported video media types: ${y.join(", ")}`}):new u("MODEL_INPUT_UNSUPPORTED",`Provider/model cannot consume video artifacts through this SDK runtime: ${v(e)}.`,{detail:S(i.video)}):n.kind==="file"?typeof n.mediaType=="string"&&typeof n.mimeType=="string"&&n.mediaType!==n.mimeType?new u("UNSUPPORTED_MEDIA_TYPE",`File artifact mediaType and mimeType disagree: ${n.mediaType} != ${n.mimeType}.`):new u("MODEL_INPUT_UNSUPPORTED",`Provider/model cannot consume file artifacts through this SDK runtime: ${v(e)}.`,{detail:S(i.file)}):new u("MODEL_INPUT_UNSUPPORTED",`Unsupported input artifact kind: ${String(n.kind)}.`)}}r(b,"validateInputArtifactsForModel");function Be(t){if(b(t.inputArtifacts??[],t),t.agentId!==void 0&&t.sessionId!==void 0)throw new Error("enqueueWithArtifacts accepts either agentId or sessionId, not both.");if(t.sessionId!==void 0&&t.sessionId.trim().length===0)throw new Error("enqueueWithArtifacts sessionId must not be empty.");let e=t.agentId??(t.sessionId!==void 0?A(t.sessionId,"/root"):x());return h().enqueue({priority:t.priority??"user",mode:"prompt",content:t.content,agentId:e,inputArtifacts:t.inputArtifacts})}r(Be,"enqueueWithArtifacts");export{E as a,h as b,ee as c,A as d,te as e,x as f,ie as g,N as h,$ as i,re as j,u as k,p as l,C as m,U as n,ae as o,se as p,de as q,K as r,L as s,k as t,G as u,ge as v,V as w,W as x,De as y,Pe as z,T as A,y as B,ve as C,P as D,b as E,Be as F};
|