@theglitchking/semantic-memory 1.6.1 → 1.7.1
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +81 -0
- package/LICENSES/Apache-2.0.txt +202 -0
- package/README.md +19 -2
- package/THIRD_PARTY_NOTICES.md +17 -0
- package/commands/jev-mode.md +18 -0
- package/commands/skill-loop.md +23 -0
- package/dist/chunk-2BFG4IBC.js +295 -0
- package/dist/chunk-2BFG4IBC.js.map +1 -0
- package/dist/chunk-2OMDSTSS.js +118 -0
- package/dist/chunk-2OMDSTSS.js.map +1 -0
- package/dist/{chunk-TMMTOFHI.js → chunk-34VN47IW.js} +2 -2
- package/dist/chunk-3ML5ESXI.js +224 -0
- package/dist/chunk-3ML5ESXI.js.map +1 -0
- package/dist/{chunk-ZLIHQZ4C.js → chunk-6TIKWOY4.js} +5 -5
- package/dist/{chunk-KSH2QO6V.js → chunk-7UAVDOI6.js} +5 -5
- package/dist/chunk-ACZKDSMP.js +123 -0
- package/dist/chunk-ACZKDSMP.js.map +1 -0
- package/dist/{chunk-PGVIBUL3.js → chunk-AIXQFTSB.js} +5 -5
- package/dist/chunk-BSXIGPDY.js +137 -0
- package/dist/chunk-BSXIGPDY.js.map +1 -0
- package/dist/{chunk-HZ7B5KHY.js → chunk-EXAUVIGW.js} +4 -4
- package/dist/chunk-GYR7U6KA.js +80 -0
- package/dist/chunk-GYR7U6KA.js.map +1 -0
- package/dist/chunk-M2PC64DB.js +195 -0
- package/dist/chunk-M2PC64DB.js.map +1 -0
- package/dist/chunk-MTLYF357.js +130 -0
- package/dist/chunk-MTLYF357.js.map +1 -0
- package/dist/chunk-N77YCMSX.js +113 -0
- package/dist/chunk-N77YCMSX.js.map +1 -0
- package/dist/chunk-PJXYCCI2.js +177 -0
- package/dist/chunk-PJXYCCI2.js.map +1 -0
- package/dist/chunk-PMOZKUEM.js +170 -0
- package/dist/chunk-PMOZKUEM.js.map +1 -0
- package/dist/chunk-R6GNP7DS.js +87 -0
- package/dist/chunk-R6GNP7DS.js.map +1 -0
- package/dist/chunk-TKHWVISV.js +71 -0
- package/dist/chunk-TKHWVISV.js.map +1 -0
- package/dist/chunk-V6PSK4Y4.js +186 -0
- package/dist/chunk-V6PSK4Y4.js.map +1 -0
- package/dist/{chunk-GYBUBJYM.js → chunk-VBLCUWT4.js} +17 -8
- package/dist/chunk-VBLCUWT4.js.map +1 -0
- package/dist/chunk-VQCNWRTL.js +121 -0
- package/dist/chunk-VQCNWRTL.js.map +1 -0
- package/dist/{chunk-HUG7E25D.js → chunk-Y7H76Q7F.js} +1 -1
- package/dist/chunk-Y7H76Q7F.js.map +1 -0
- package/dist/chunk-ZSWI3Y4Y.js +232 -0
- package/dist/chunk-ZSWI3Y4Y.js.map +1 -0
- package/dist/cli/index.js +381 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/core/features.d.ts +38 -0
- package/dist/core/features.js +28 -0
- package/dist/core/index.d.ts +285 -2
- package/dist/core/index.js +170 -21
- package/dist/core/index.js.map +1 -1
- package/dist/core/jev.d.ts +35 -0
- package/dist/core/jev.js +20 -0
- package/dist/core/skill-curator.d.ts +1 -0
- package/dist/core/skill-curator.js +41 -0
- package/dist/core/skill-evidence.d.ts +25 -0
- package/dist/core/skill-evidence.js +23 -0
- package/dist/core/skill-queue.d.ts +46 -0
- package/dist/core/skill-queue.js +42 -0
- package/dist/core/skill-review.d.ts +3 -0
- package/dist/core/skill-review.js +29 -0
- package/dist/core/skill-worker.d.ts +21 -0
- package/dist/core/skill-worker.js +70 -0
- package/dist/core/skill-worker.js.map +1 -0
- package/dist/{dossier-EN26WDKC.js → dossier-RXBLQOXC.js} +3 -3
- package/dist/failure-eval-IUJO47UC.js +18 -0
- package/dist/failure-eval-IUJO47UC.js.map +1 -0
- package/dist/{healthcheck-53OVXUQQ.js → healthcheck-S7D6YNTA.js} +7 -7
- package/dist/healthcheck-S7D6YNTA.js.map +1 -0
- package/dist/{lexicon-XNA5IFIA.js → lexicon-SEJSLBHO.js} +4 -4
- package/dist/lexicon-SEJSLBHO.js.map +1 -0
- package/dist/{lint-O4RQ47NX.js → lint-3JNLRM5U.js} +6 -6
- package/dist/lint-3JNLRM5U.js.map +1 -0
- package/dist/mcp/server.js +19 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/{profile-SIWAVD7O.js → profile-SNULTJ27.js} +4 -4
- package/dist/profile-SNULTJ27.js.map +1 -0
- package/dist/{schema-UJNYYRZZ.js → schema-RDYUK6CC.js} +2 -2
- package/dist/schema-RDYUK6CC.js.map +1 -0
- package/dist/skill-curator-D7HHZaUI.d.ts +71 -0
- package/dist/skill-land-EHXZW47F.js +31 -0
- package/dist/skill-land-EHXZW47F.js.map +1 -0
- package/dist/skill-ledger-AYXVNFX7.js +18 -0
- package/dist/skill-ledger-AYXVNFX7.js.map +1 -0
- package/dist/skill-merge-HBZBALZX.js +24 -0
- package/dist/skill-merge-HBZBALZX.js.map +1 -0
- package/dist/skill-review-BNvHipn9.d.ts +182 -0
- package/dist/skill-schema-RVB3EHEF.js +30 -0
- package/dist/skill-schema-RVB3EHEF.js.map +1 -0
- package/hooks/hooks.json +26 -1
- package/hooks/jev-bridge.py +109 -0
- package/hooks/session-start.js +5 -0
- package/hooks/skill-loop.js +65 -0
- package/hooks/vault-context.js +104 -6
- package/package.json +4 -2
- package/dist/chunk-5F5ZIAW2.js +0 -79
- package/dist/chunk-5F5ZIAW2.js.map +0 -1
- package/dist/chunk-GYBUBJYM.js.map +0 -1
- package/dist/chunk-HUG7E25D.js.map +0 -1
- package/dist/failure-eval-37JRNTIW.js +0 -10
- /package/dist/{chunk-TMMTOFHI.js.map → chunk-34VN47IW.js.map} +0 -0
- /package/dist/{chunk-ZLIHQZ4C.js.map → chunk-6TIKWOY4.js.map} +0 -0
- /package/dist/{chunk-KSH2QO6V.js.map → chunk-7UAVDOI6.js.map} +0 -0
- /package/dist/{chunk-PGVIBUL3.js.map → chunk-AIXQFTSB.js.map} +0 -0
- /package/dist/{chunk-HZ7B5KHY.js.map → chunk-EXAUVIGW.js.map} +0 -0
- /package/dist/{dossier-EN26WDKC.js.map → core/features.js.map} +0 -0
- /package/dist/{failure-eval-37JRNTIW.js.map → core/jev.js.map} +0 -0
- /package/dist/{healthcheck-53OVXUQQ.js.map → core/skill-curator.js.map} +0 -0
- /package/dist/{lexicon-XNA5IFIA.js.map → core/skill-evidence.js.map} +0 -0
- /package/dist/{lint-O4RQ47NX.js.map → core/skill-queue.js.map} +0 -0
- /package/dist/{profile-SIWAVD7O.js.map → core/skill-review.js.map} +0 -0
- /package/dist/{schema-UJNYYRZZ.js.map → dossier-RXBLQOXC.js.map} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type Feature = "skill_loop" | "jev";
|
|
2
|
+
interface FeatureState {
|
|
3
|
+
feature: Feature;
|
|
4
|
+
on: boolean;
|
|
5
|
+
/** Where the on/off came from. */
|
|
6
|
+
why: "default" | "env" | "repo";
|
|
7
|
+
/** jev only: whether jev-loop, the key and python are present. Always true for the skill loop. */
|
|
8
|
+
available: boolean;
|
|
9
|
+
/** Why it is unavailable, when it is on but cannot run. */
|
|
10
|
+
reason?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ENV: Record<Feature, string>;
|
|
13
|
+
declare const repoConfigPath: (projectRoot: string) => string;
|
|
14
|
+
/** `<repo>/.claude/.semantic-memory/config` as an object ({} when missing or unparseable). */
|
|
15
|
+
declare function readRepoConfig(projectRoot: string): Record<string, unknown>;
|
|
16
|
+
declare const jevLoopDir: (env?: NodeJS.ProcessEnv) => string;
|
|
17
|
+
declare const claudeSettingsPath: (env?: NodeJS.ProcessEnv) => string;
|
|
18
|
+
/** Whether jev mode could run: jev-loop's router, the TypeSafe key (env or settings, never read out), python3. */
|
|
19
|
+
declare function jevAvailable(env?: NodeJS.ProcessEnv): {
|
|
20
|
+
available: boolean;
|
|
21
|
+
reason?: string;
|
|
22
|
+
};
|
|
23
|
+
declare function featureState(feature: Feature, projectRoot?: string, env?: NodeJS.ProcessEnv): FeatureState;
|
|
24
|
+
/** On and able to run. The check every hook path makes first. */
|
|
25
|
+
declare const featureOn: (feature: Feature, projectRoot?: string, env?: NodeJS.ProcessEnv) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Set (true / false) or clear (undefined) one env key in ~/.claude/settings.json, touching nothing else.
|
|
28
|
+
* Keeps a `.bak` of the previous file. Refuses (throws, writes nothing) when the file is not valid JSON.
|
|
29
|
+
*/
|
|
30
|
+
declare function setSettingsEnv(key: string, value: string | undefined, env?: NodeJS.ProcessEnv): {
|
|
31
|
+
path: string;
|
|
32
|
+
backup?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Set or clear `<key>: <value>` in the repo config, keeping the other keys. */
|
|
35
|
+
declare function setRepoConfig(projectRoot: string, key: string, value: string | boolean | undefined): string;
|
|
36
|
+
declare function describeFeature(s: FeatureState): string;
|
|
37
|
+
|
|
38
|
+
export { ENV, type Feature, type FeatureState, claudeSettingsPath, describeFeature, featureOn, featureState, jevAvailable, jevLoopDir, readRepoConfig, repoConfigPath, setRepoConfig, setSettingsEnv };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ENV,
|
|
3
|
+
claudeSettingsPath,
|
|
4
|
+
describeFeature,
|
|
5
|
+
featureOn,
|
|
6
|
+
featureState,
|
|
7
|
+
jevAvailable,
|
|
8
|
+
jevLoopDir,
|
|
9
|
+
readRepoConfig,
|
|
10
|
+
repoConfigPath,
|
|
11
|
+
setRepoConfig,
|
|
12
|
+
setSettingsEnv
|
|
13
|
+
} from "../chunk-VQCNWRTL.js";
|
|
14
|
+
import "../chunk-PZ5AY32C.js";
|
|
15
|
+
export {
|
|
16
|
+
ENV,
|
|
17
|
+
claudeSettingsPath,
|
|
18
|
+
describeFeature,
|
|
19
|
+
featureOn,
|
|
20
|
+
featureState,
|
|
21
|
+
jevAvailable,
|
|
22
|
+
jevLoopDir,
|
|
23
|
+
readRepoConfig,
|
|
24
|
+
repoConfigPath,
|
|
25
|
+
setRepoConfig,
|
|
26
|
+
setSettingsEnv
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=features.js.map
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ import Graph from 'graphology';
|
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
export { REDACTED, RedactMode, RedactResult, redact, redactDeep } from './redact.js';
|
|
4
4
|
export { commandVerbs, errorSignal, failureQuery } from './failure-query.js';
|
|
5
|
+
export { Feature, FeatureState, describeFeature, featureOn, featureState, jevAvailable } from './features.js';
|
|
6
|
+
import { P as ParsedSkill, D as DraftRecord, S as SkillLoopMeta } from '../skill-review-BNvHipn9.js';
|
|
7
|
+
export { a as SKILL_SCOPES, b as SKILL_SECTIONS, c as SKILL_STATUSES, d as SkillFile, e as SkillFinding, f as SkillScope, g as SkillStatus, h as buildBrief, i as decideScope, j as draftsDir, k as findSkills, l as lintSkill, m as lintSkills, n as listDrafts, p as parseSkill, r as renderSkill, o as reviewSession } from '../skill-review-BNvHipn9.js';
|
|
8
|
+
import { L as LedgerEntry } from '../skill-curator-D7HHZaUI.js';
|
|
9
|
+
export { c as curate, r as readLedger, a as restore, b as rollback, v as verifySkills } from '../skill-curator-D7HHZaUI.js';
|
|
10
|
+
export { JEV_BAR, JevAnswer, JevCaller, JevQuestion, askJev, failureState, jevSpendToday, jevVerdict, relevanceQuestion } from './jev.js';
|
|
11
|
+
import './skill-queue.js';
|
|
12
|
+
import './skill-worker.js';
|
|
5
13
|
|
|
6
14
|
interface IndexedDocument {
|
|
7
15
|
path: string;
|
|
@@ -261,7 +269,7 @@ interface VaultSchema {
|
|
|
261
269
|
type Severity$1 = "warn" | "error";
|
|
262
270
|
interface LintFinding {
|
|
263
271
|
path: string;
|
|
264
|
-
rule: "missing_provenance" | "stale" | "schema_violations" | "broken_links" | "code_symbols" | "decay_candidates" | "alias_conflicts" | "decoys" | "secrets";
|
|
272
|
+
rule: "missing_provenance" | "stale" | "schema_violations" | "broken_links" | "code_symbols" | "decay_candidates" | "alias_conflicts" | "decoys" | "secrets" | "skills";
|
|
265
273
|
severity: Severity$1;
|
|
266
274
|
message: string;
|
|
267
275
|
}
|
|
@@ -543,6 +551,8 @@ interface LintReport {
|
|
|
543
551
|
decoys: LintFinding[];
|
|
544
552
|
/** only present when the opt-in secrets check ran */
|
|
545
553
|
secrets?: LintFinding[];
|
|
554
|
+
/** only present when the opt-in skills check ran */
|
|
555
|
+
skills?: LintFinding[];
|
|
546
556
|
};
|
|
547
557
|
counts: {
|
|
548
558
|
errors: number;
|
|
@@ -593,6 +603,8 @@ declare function lintVault(notesPath: string, opts?: {
|
|
|
593
603
|
* git history if the note was ever committed.
|
|
594
604
|
*/
|
|
595
605
|
checkSecrets?: boolean;
|
|
606
|
+
/** When true, lint the skill loop's learned skills this repo loads (v1.7): format, evidence, cites, clashes. Opt-in. */
|
|
607
|
+
checkSkills?: boolean;
|
|
596
608
|
}): Promise<LintReport>;
|
|
597
609
|
declare function formatLintReport(report: LintReport, opts?: {
|
|
598
610
|
rule?: keyof LintReport["byRule"];
|
|
@@ -874,5 +886,276 @@ declare function evaluateFailures(results: CaseResult[], judgments: Judgment[],
|
|
|
874
886
|
thresholds?: number[];
|
|
875
887
|
}): FailureEvalReport;
|
|
876
888
|
declare function formatFailureEval(report: FailureEvalReport, label?: string): string;
|
|
889
|
+
/** jev-loop's adoption bar: right >= 95% of the time over >= 40 picks, with at most 2 wrong. */
|
|
890
|
+
declare const meetsBar: (picks: number, wrong: number) => boolean;
|
|
891
|
+
interface JevJudgment {
|
|
892
|
+
case: string;
|
|
893
|
+
path: string;
|
|
894
|
+
p: number | null;
|
|
895
|
+
}
|
|
896
|
+
interface JudgeCalibration {
|
|
897
|
+
/** labelled pairs Jev answered */
|
|
898
|
+
pairs: number;
|
|
899
|
+
/** label relevant / not relevant: picks Jev made (>= bar yes, <= 1-bar no), how many disagree, unsure */
|
|
900
|
+
relevant: {
|
|
901
|
+
pairs: number;
|
|
902
|
+
yes: number;
|
|
903
|
+
no: number;
|
|
904
|
+
unsure: number;
|
|
905
|
+
};
|
|
906
|
+
notRelevant: {
|
|
907
|
+
pairs: number;
|
|
908
|
+
yes: number;
|
|
909
|
+
no: number;
|
|
910
|
+
unsure: number;
|
|
911
|
+
};
|
|
912
|
+
/** every pick (yes or no): agreement with the labels */
|
|
913
|
+
picks: number;
|
|
914
|
+
wrong: number;
|
|
915
|
+
agreement: number | null;
|
|
916
|
+
unsureRate: number;
|
|
917
|
+
/** yes picks alone (the side that would inject) */
|
|
918
|
+
yesPicks: number;
|
|
919
|
+
yesWrong: number;
|
|
920
|
+
/** no picks alone (the side that would filter) */
|
|
921
|
+
noPicks: number;
|
|
922
|
+
noWrong: number;
|
|
923
|
+
/**
|
|
924
|
+
* "jev": Jev alone may judge (its yes picks and its no picks each meet the bar);
|
|
925
|
+
* "hybrid": its no picks meet the bar — Jev filters, the rest (yes and unsure) go to Claude;
|
|
926
|
+
* "claude": neither side does.
|
|
927
|
+
*/
|
|
928
|
+
verdict: "jev" | "hybrid" | "claude";
|
|
929
|
+
}
|
|
930
|
+
declare function calibrateJudge(labels: Judgment[], jev: JevJudgment[], bar?: number): JudgeCalibration;
|
|
931
|
+
interface GateRow {
|
|
932
|
+
threshold: number;
|
|
933
|
+
/** cases with a candidate fact (first fact in the top hits scoring >= threshold) */
|
|
934
|
+
candidates: number;
|
|
935
|
+
/** candidates Jev has not answered yet (ask, then re-run) */
|
|
936
|
+
missing: number;
|
|
937
|
+
/** candidates Jev said yes to at >= the bar: would be injected */
|
|
938
|
+
injected: number;
|
|
939
|
+
judged: number;
|
|
940
|
+
correct: number;
|
|
941
|
+
precision: number | null;
|
|
942
|
+
coverage: number;
|
|
943
|
+
meetsBar: boolean;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* The failure hook's Jev gate, replayed: per threshold T, the candidate is the first fact among the top
|
|
947
|
+
* `topK` hits scoring >= T. `confirm` injects it only when Jev scores it >= the bar; `veto` injects it unless
|
|
948
|
+
* Jev scores it <= 1 - bar (a confident no). Precision is measured on the injected candidates that carry a label.
|
|
949
|
+
*/
|
|
950
|
+
declare function evaluateGate(results: CaseResult[], judgments: Judgment[], jev: JevJudgment[], opts?: {
|
|
951
|
+
thresholds?: number[];
|
|
952
|
+
topK?: number;
|
|
953
|
+
bar?: number;
|
|
954
|
+
isCandidate?: (path: string) => boolean;
|
|
955
|
+
mode?: "confirm" | "veto";
|
|
956
|
+
}): {
|
|
957
|
+
rows: GateRow[];
|
|
958
|
+
missing: {
|
|
959
|
+
case: string;
|
|
960
|
+
path: string;
|
|
961
|
+
}[];
|
|
962
|
+
};
|
|
963
|
+
declare function formatGate(rows: GateRow[], mode?: "confirm" | "veto"): string;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Adoption gate for learned skills (v1.7): turns eval scores into adopt / keep-draft / reject. Pure — no I/O.
|
|
967
|
+
* A new skill must trigger on its own evidence, stay quiet on near-misses and beat doing the task without it;
|
|
968
|
+
* a patch must not make any score worse. A failing draft stays a draft with its scores.
|
|
969
|
+
*/
|
|
970
|
+
/** A skill that fires on fewer than half its own held-out prompts is not findable. */
|
|
971
|
+
declare const GATE_MIN_POSITIVE_RATE = 0.5;
|
|
972
|
+
/** More than a quarter false triggers on near-misses means it would hijack unrelated work. */
|
|
973
|
+
declare const GATE_MAX_FALSE_TRIGGER_RATE = 0.25;
|
|
974
|
+
/** Held-out trigger rates and task pass rates, each 0..1 or null when not measured. */
|
|
975
|
+
interface SkillScores {
|
|
976
|
+
positiveRate: number | null;
|
|
977
|
+
falseTriggerRate: number | null;
|
|
978
|
+
taskWith: number | null;
|
|
979
|
+
taskWithout: number | null;
|
|
980
|
+
}
|
|
981
|
+
interface GateVerdict {
|
|
982
|
+
verdict: "adopt" | "keep-draft" | "reject";
|
|
983
|
+
reasons: string[];
|
|
984
|
+
}
|
|
985
|
+
declare function gateSkill(candidate: SkillScores, current?: SkillScores): GateVerdict;
|
|
986
|
+
|
|
987
|
+
interface CandidatePrompt {
|
|
988
|
+
session: string;
|
|
989
|
+
text: string;
|
|
990
|
+
}
|
|
991
|
+
interface EvalPrompt {
|
|
992
|
+
text: string;
|
|
993
|
+
should_trigger: boolean;
|
|
994
|
+
split: "train" | "heldout";
|
|
995
|
+
}
|
|
996
|
+
/** Same prompt, same side of the split, on every machine. */
|
|
997
|
+
declare const splitOf: (text: string) => EvalPrompt["split"];
|
|
998
|
+
declare function buildEvalSet(skill: ParsedSkill, candidates: CandidatePrompt[], opts?: {
|
|
999
|
+
maxNegatives?: number;
|
|
1000
|
+
}): EvalPrompt[];
|
|
1001
|
+
|
|
1002
|
+
type Verify = {
|
|
1003
|
+
kind: "command";
|
|
1004
|
+
command: string;
|
|
1005
|
+
} | {
|
|
1006
|
+
kind: "prose";
|
|
1007
|
+
text: string;
|
|
1008
|
+
} | {
|
|
1009
|
+
kind: "none";
|
|
1010
|
+
};
|
|
1011
|
+
/** The `## Verify` section as a command (fenced block, or a leading inline-backtick span) or as prose. */
|
|
1012
|
+
declare function parseVerify(body: string): Verify;
|
|
1013
|
+
interface TaskArm {
|
|
1014
|
+
passed: boolean;
|
|
1015
|
+
evidence: string;
|
|
1016
|
+
/** the run's final text */
|
|
1017
|
+
finalText: string;
|
|
1018
|
+
error?: string;
|
|
1019
|
+
}
|
|
1020
|
+
interface TaskReport {
|
|
1021
|
+
skill: string;
|
|
1022
|
+
verify: Verify;
|
|
1023
|
+
with: TaskArm;
|
|
1024
|
+
without: TaskArm;
|
|
1025
|
+
}
|
|
1026
|
+
interface TaskOptions {
|
|
1027
|
+
repoRoot: string;
|
|
1028
|
+
skillRaw: string;
|
|
1029
|
+
prompt: string;
|
|
1030
|
+
env?: NodeJS.ProcessEnv;
|
|
1031
|
+
maxTurns?: number;
|
|
1032
|
+
timeoutMs?: number;
|
|
1033
|
+
verifyTimeoutMs?: number;
|
|
1034
|
+
}
|
|
1035
|
+
declare function runTaskEval(o: TaskOptions): Promise<TaskReport>;
|
|
1036
|
+
|
|
1037
|
+
interface DraftView {
|
|
1038
|
+
id: string;
|
|
1039
|
+
kind: DraftRecord["kind"];
|
|
1040
|
+
name: string;
|
|
1041
|
+
scope: string;
|
|
1042
|
+
destination: string;
|
|
1043
|
+
scope_why?: string;
|
|
1044
|
+
provenance: SkillLoopMeta["provenance"] | null;
|
|
1045
|
+
warnings: string[];
|
|
1046
|
+
evals?: Record<string, unknown>;
|
|
1047
|
+
promotion?: DraftRecord["promotion"];
|
|
1048
|
+
global_candidate?: boolean;
|
|
1049
|
+
/** the Verify command a task eval would run, shown before anyone runs it */
|
|
1050
|
+
verify: ReturnType<typeof parseVerify>;
|
|
1051
|
+
text: string;
|
|
1052
|
+
diff?: string;
|
|
1053
|
+
}
|
|
1054
|
+
declare function describeDrafts(repo: string, env?: NodeJS.ProcessEnv): DraftView[];
|
|
1055
|
+
declare function approveDraft(repo: string, id: string, opts?: {
|
|
1056
|
+
promote?: boolean;
|
|
1057
|
+
override?: string;
|
|
1058
|
+
env?: NodeJS.ProcessEnv;
|
|
1059
|
+
}): LedgerEntry;
|
|
1060
|
+
declare function rejectDraft(repo: string, id: string, why?: string): LedgerEntry;
|
|
1061
|
+
/** Run the evals on a draft and store the scores and the gate's verdict in its record. */
|
|
1062
|
+
declare function evalDraft(repo: string, id: string, opts?: {
|
|
1063
|
+
task?: boolean;
|
|
1064
|
+
env?: NodeJS.ProcessEnv;
|
|
1065
|
+
}): Promise<{
|
|
1066
|
+
at: string;
|
|
1067
|
+
prompts: number;
|
|
1068
|
+
runs: number;
|
|
1069
|
+
heldout: Rates;
|
|
1070
|
+
train: Rates;
|
|
1071
|
+
task: unknown;
|
|
1072
|
+
gate: GateVerdict;
|
|
1073
|
+
}>;
|
|
1074
|
+
|
|
1075
|
+
declare function proposeMerges(repo: string, env?: NodeJS.ProcessEnv): Promise<{
|
|
1076
|
+
drafted: string[];
|
|
1077
|
+
skipped: string[];
|
|
1078
|
+
}>;
|
|
1079
|
+
|
|
1080
|
+
declare const MAX_TRIGGER_RUNS = 3;
|
|
1081
|
+
declare const evalCachePath: (env?: NodeJS.ProcessEnv) => string;
|
|
1082
|
+
interface PromptTrigger extends EvalPrompt {
|
|
1083
|
+
triggers: number;
|
|
1084
|
+
runs: number;
|
|
1085
|
+
/** a majority of the runs called the skill */
|
|
1086
|
+
triggered: boolean;
|
|
1087
|
+
cached: boolean;
|
|
1088
|
+
error?: string;
|
|
1089
|
+
}
|
|
1090
|
+
interface Rates {
|
|
1091
|
+
n: number;
|
|
1092
|
+
/** share of should-trigger prompts that triggered; null when there are none */
|
|
1093
|
+
positiveRate: number | null;
|
|
1094
|
+
/** share of near-miss prompts that triggered; null when there are none */
|
|
1095
|
+
falseTriggerRate: number | null;
|
|
1096
|
+
/** prompts that behaved as expected / n */
|
|
1097
|
+
accuracy: number | null;
|
|
1098
|
+
}
|
|
1099
|
+
interface TriggerReport {
|
|
1100
|
+
skill: string;
|
|
1101
|
+
results: PromptTrigger[];
|
|
1102
|
+
train: Rates;
|
|
1103
|
+
heldout: Rates;
|
|
1104
|
+
/** claude runs started (0 when everything was cached) */
|
|
1105
|
+
runs: number;
|
|
1106
|
+
}
|
|
1107
|
+
declare function ratesOf(rs: PromptTrigger[]): Rates;
|
|
1108
|
+
/** A scratch dir with the skill under test and copies of the repo's other project skills. The caller removes it. */
|
|
1109
|
+
declare function makeScratch(repoRoot: string, name: string, skillRaw: string): string;
|
|
1110
|
+
interface TriggerOptions {
|
|
1111
|
+
repoRoot: string;
|
|
1112
|
+
/** the skill file as it is on disk (or a candidate version of it) */
|
|
1113
|
+
skillRaw: string;
|
|
1114
|
+
env?: NodeJS.ProcessEnv;
|
|
1115
|
+
timeoutMs?: number;
|
|
1116
|
+
}
|
|
1117
|
+
declare function runTrigger(prompts: EvalPrompt[], o: TriggerOptions): Promise<TriggerReport>;
|
|
1118
|
+
|
|
1119
|
+
declare const MAX_TUNE_ITERATIONS = 3;
|
|
1120
|
+
interface TuneCandidate {
|
|
1121
|
+
description: string;
|
|
1122
|
+
train: number | null;
|
|
1123
|
+
heldout: number | null;
|
|
1124
|
+
}
|
|
1125
|
+
interface TuneReport {
|
|
1126
|
+
original: TuneCandidate;
|
|
1127
|
+
best: TuneCandidate;
|
|
1128
|
+
/** the best candidate is not the original */
|
|
1129
|
+
improved: boolean;
|
|
1130
|
+
candidates: TuneCandidate[];
|
|
1131
|
+
}
|
|
1132
|
+
/** The skill file with its frontmatter description replaced and nothing else changed. */
|
|
1133
|
+
declare function withDescription(raw: string, description: string): string;
|
|
1134
|
+
declare function tuneDescription(o: {
|
|
1135
|
+
repoRoot: string;
|
|
1136
|
+
skillRaw: string;
|
|
1137
|
+
prompts: EvalPrompt[];
|
|
1138
|
+
env?: NodeJS.ProcessEnv;
|
|
1139
|
+
maxIterations?: number;
|
|
1140
|
+
}): Promise<TuneReport>;
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Skill-creator's `evals/evals.json` (references/schemas.md), read and written as-is so evals made here
|
|
1144
|
+
* open in skill-creator and the other way round.
|
|
1145
|
+
*/
|
|
1146
|
+
interface EvalCase {
|
|
1147
|
+
id: number;
|
|
1148
|
+
prompt: string;
|
|
1149
|
+
expected_output: string;
|
|
1150
|
+
/** input file paths, relative to the skill root */
|
|
1151
|
+
files?: string[];
|
|
1152
|
+
expectations: string[];
|
|
1153
|
+
}
|
|
1154
|
+
interface EvalsFile {
|
|
1155
|
+
skill_name: string;
|
|
1156
|
+
evals: EvalCase[];
|
|
1157
|
+
}
|
|
1158
|
+
declare function parseEvals(text: string): EvalsFile;
|
|
1159
|
+
declare const renderEvals: (f: EvalsFile) => string;
|
|
877
1160
|
|
|
878
|
-
export { type ApplyPatchOptions, type ApplyPatchResult, type CaseResult, type ChangeSet, type DriftFinding, Embedder, type FailureCase, type FailureEvalReport, FrontmatterManager, GraphBuilder, type GraphEdge, type GraphNode, type HealthcheckOptions, type HealthcheckResult, type Severity as HealthcheckSeverity, type Tier as HealthcheckTier, INDEX_FILE, INDEX_OVERFLOW_THRESHOLD, type IndexEntry, type IndexedDocument, Indexer, type IngestInput, type IngestPreview, type IngestSource, type IngestUnit, type Judgment, type LintFinding, type LintReport, type LogEntry, type LogEventInput, type LogQueryOptions, type ModeSummary, NoteCrud, type PromoteInput, type PromotePreview, type RegenResult, type RegenerateContractOptions, type RegenerateContractResult, type SearchResult, type SessionFinishInput, SessionManager, type SessionStartOptions, type SessionState, type SessionStatus, type Severity$1 as Severity, type SynthesizeNoteInput, type SynthesizePreview, TagManager, TextSearch, type ThresholdRow, type ToolSummary, type VaultSchema, type VaultStats, VectorIndex, type VerificationRecord, Watcher, applyPatch, buildIngestChangeSet, buildPromoteChangeSet, buildSynthesizeChangeSet, deriveProjectRoot, deriveSessionDir, evaluateFailures, filterToDrift, formatDriftBanner, formatFailureEval, formatLintReport, inspectAgentsContract, installDefaultSchema, lintVault, loadSchema, logEvent, logQuery, regenDirectoryIndex, regenIndexesForPaths, regenerateAgentsContract, runHealthcheck, validateNote };
|
|
1161
|
+
export { type ApplyPatchOptions, type ApplyPatchResult, type CandidatePrompt, type CaseResult, type ChangeSet, DraftRecord, type DriftFinding, Embedder, type EvalCase, type EvalPrompt, type EvalsFile, type FailureCase, type FailureEvalReport, FrontmatterManager, GATE_MAX_FALSE_TRIGGER_RATE, GATE_MIN_POSITIVE_RATE, type GateRow, type GateVerdict, GraphBuilder, type GraphEdge, type GraphNode, type HealthcheckOptions, type HealthcheckResult, type Severity as HealthcheckSeverity, type Tier as HealthcheckTier, INDEX_FILE, INDEX_OVERFLOW_THRESHOLD, type IndexEntry, type IndexedDocument, Indexer, type IngestInput, type IngestPreview, type IngestSource, type IngestUnit, type JevJudgment, type JudgeCalibration, type Judgment, type LintFinding, type LintReport, type LogEntry, type LogEventInput, type LogQueryOptions, MAX_TRIGGER_RUNS, MAX_TUNE_ITERATIONS, type ModeSummary, NoteCrud, ParsedSkill, type PromoteInput, type PromotePreview, type PromptTrigger, type Rates, type RegenResult, type RegenerateContractOptions, type RegenerateContractResult, type SearchResult, type SessionFinishInput, SessionManager, type SessionStartOptions, type SessionState, type SessionStatus, type Severity$1 as Severity, SkillLoopMeta, type SkillScores, type SynthesizeNoteInput, type SynthesizePreview, TagManager, type TaskArm, type TaskOptions, type TaskReport, TextSearch, type ThresholdRow, type ToolSummary, type TriggerOptions, type TriggerReport, type TuneCandidate, type TuneReport, type VaultSchema, type VaultStats, VectorIndex, type VerificationRecord, type Verify, Watcher, applyPatch, approveDraft, buildEvalSet, buildIngestChangeSet, buildPromoteChangeSet, buildSynthesizeChangeSet, calibrateJudge, deriveProjectRoot, deriveSessionDir, describeDrafts, evalCachePath, evalDraft, evaluateFailures, evaluateGate, filterToDrift, formatDriftBanner, formatFailureEval, formatGate, formatLintReport, gateSkill, inspectAgentsContract, installDefaultSchema, lintVault, loadSchema, logEvent, logQuery, makeScratch, meetsBar, parseEvals, parseVerify, proposeMerges, ratesOf, regenDirectoryIndex, regenIndexesForPaths, regenerateAgentsContract, rejectDraft, renderEvals, runHealthcheck, runTaskEval, runTrigger, splitOf, tuneDescription, validateNote, withDescription };
|
package/dist/core/index.js
CHANGED
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
import {
|
|
2
|
+
calibrateJudge,
|
|
2
3
|
evaluateFailures,
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
evaluateGate,
|
|
5
|
+
formatFailureEval,
|
|
6
|
+
formatGate,
|
|
7
|
+
meetsBar
|
|
8
|
+
} from "../chunk-PJXYCCI2.js";
|
|
9
|
+
import {
|
|
10
|
+
GATE_MAX_FALSE_TRIGGER_RATE,
|
|
11
|
+
GATE_MIN_POSITIVE_RATE,
|
|
12
|
+
approveDraft,
|
|
13
|
+
describeDrafts,
|
|
14
|
+
evalDraft,
|
|
15
|
+
gateSkill,
|
|
16
|
+
rejectDraft
|
|
17
|
+
} from "../chunk-3ML5ESXI.js";
|
|
18
|
+
import {
|
|
19
|
+
proposeMerges
|
|
20
|
+
} from "../chunk-2OMDSTSS.js";
|
|
5
21
|
import {
|
|
6
22
|
filterToDrift,
|
|
7
23
|
formatDriftBanner,
|
|
8
24
|
runHealthcheck
|
|
9
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-34VN47IW.js";
|
|
10
26
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
buildBrief,
|
|
28
|
+
draftsDir,
|
|
29
|
+
listDrafts,
|
|
30
|
+
reviewSession
|
|
31
|
+
} from "../chunk-2BFG4IBC.js";
|
|
32
|
+
import {
|
|
33
|
+
curate,
|
|
34
|
+
restore,
|
|
35
|
+
verifySkills
|
|
36
|
+
} from "../chunk-V6PSK4Y4.js";
|
|
37
|
+
import {
|
|
38
|
+
readLedger,
|
|
39
|
+
rollback
|
|
40
|
+
} from "../chunk-TKHWVISV.js";
|
|
41
|
+
import {
|
|
42
|
+
decideScope
|
|
43
|
+
} from "../chunk-N77YCMSX.js";
|
|
15
44
|
import {
|
|
16
45
|
FrontmatterManager,
|
|
17
46
|
INDEX_FILE,
|
|
@@ -27,85 +56,205 @@ import {
|
|
|
27
56
|
regenDirectoryIndex,
|
|
28
57
|
regenIndexesForPaths,
|
|
29
58
|
regenerateAgentsContract
|
|
30
|
-
} from "../chunk-
|
|
59
|
+
} from "../chunk-AIXQFTSB.js";
|
|
31
60
|
import {
|
|
32
61
|
Embedder,
|
|
33
62
|
GraphBuilder,
|
|
34
63
|
TextSearch,
|
|
35
64
|
VectorIndex
|
|
36
65
|
} from "../chunk-SHSOCFJH.js";
|
|
37
|
-
import {
|
|
38
|
-
logEvent,
|
|
39
|
-
logQuery
|
|
40
|
-
} from "../chunk-XKGK643R.js";
|
|
41
66
|
import {
|
|
42
67
|
formatLintReport,
|
|
43
68
|
lintVault
|
|
44
|
-
} from "../chunk-
|
|
69
|
+
} from "../chunk-VBLCUWT4.js";
|
|
45
70
|
import {
|
|
46
71
|
installDefaultSchema,
|
|
47
72
|
loadSchema,
|
|
48
73
|
validateNote
|
|
49
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-Y7H76Q7F.js";
|
|
50
75
|
import "../chunk-5ZKNO6ZD.js";
|
|
51
76
|
import "../chunk-7M34JDTH.js";
|
|
52
|
-
import "../chunk-
|
|
53
|
-
import "../chunk-
|
|
77
|
+
import "../chunk-7UAVDOI6.js";
|
|
78
|
+
import "../chunk-EXAUVIGW.js";
|
|
54
79
|
import {
|
|
55
80
|
SessionManager,
|
|
56
81
|
deriveProjectRoot,
|
|
57
82
|
deriveSessionDir
|
|
58
83
|
} from "../chunk-EYVFC745.js";
|
|
59
84
|
import {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} from "../chunk-
|
|
85
|
+
MAX_TUNE_ITERATIONS,
|
|
86
|
+
tuneDescription,
|
|
87
|
+
withDescription
|
|
88
|
+
} from "../chunk-ACZKDSMP.js";
|
|
89
|
+
import {
|
|
90
|
+
MAX_TRIGGER_RUNS,
|
|
91
|
+
buildEvalSet,
|
|
92
|
+
evalCachePath,
|
|
93
|
+
makeScratch,
|
|
94
|
+
ratesOf,
|
|
95
|
+
runTrigger,
|
|
96
|
+
splitOf
|
|
97
|
+
} from "../chunk-BSXIGPDY.js";
|
|
98
|
+
import {
|
|
99
|
+
parseVerify,
|
|
100
|
+
runTaskEval
|
|
101
|
+
} from "../chunk-MTLYF357.js";
|
|
102
|
+
import "../chunk-PMOZKUEM.js";
|
|
103
|
+
import {
|
|
104
|
+
SKILL_SCOPES,
|
|
105
|
+
SKILL_SECTIONS,
|
|
106
|
+
SKILL_STATUSES,
|
|
107
|
+
findSkills,
|
|
108
|
+
lintSkill,
|
|
109
|
+
lintSkills,
|
|
110
|
+
parseSkill,
|
|
111
|
+
renderSkill
|
|
112
|
+
} from "../chunk-ZSWI3Y4Y.js";
|
|
64
113
|
import {
|
|
65
114
|
Indexer
|
|
66
115
|
} from "../chunk-CJUY55GG.js";
|
|
67
116
|
import "../chunk-J7LYDRML.js";
|
|
117
|
+
import {
|
|
118
|
+
logEvent,
|
|
119
|
+
logQuery
|
|
120
|
+
} from "../chunk-XKGK643R.js";
|
|
121
|
+
import {
|
|
122
|
+
commandVerbs,
|
|
123
|
+
errorSignal,
|
|
124
|
+
failureQuery
|
|
125
|
+
} from "../chunk-5LQIWCLK.js";
|
|
126
|
+
import {
|
|
127
|
+
describeFeature,
|
|
128
|
+
featureOn,
|
|
129
|
+
featureState,
|
|
130
|
+
jevAvailable
|
|
131
|
+
} from "../chunk-VQCNWRTL.js";
|
|
132
|
+
import {
|
|
133
|
+
JEV_BAR,
|
|
134
|
+
askJev,
|
|
135
|
+
failureState,
|
|
136
|
+
jevSpendToday,
|
|
137
|
+
jevVerdict,
|
|
138
|
+
relevanceQuestion
|
|
139
|
+
} from "../chunk-GYR7U6KA.js";
|
|
140
|
+
import "../chunk-M2PC64DB.js";
|
|
141
|
+
import "../chunk-R6GNP7DS.js";
|
|
142
|
+
import {
|
|
143
|
+
REDACTED,
|
|
144
|
+
redact,
|
|
145
|
+
redactDeep
|
|
146
|
+
} from "../chunk-H2BES6FU.js";
|
|
68
147
|
import "../chunk-PZ5AY32C.js";
|
|
148
|
+
|
|
149
|
+
// src/core/skill-eval/evals-json.ts
|
|
150
|
+
function parseEvals(text) {
|
|
151
|
+
const j = JSON.parse(text);
|
|
152
|
+
if (typeof j?.skill_name !== "string" || !Array.isArray(j.evals)) throw new Error("evals.json needs skill_name and an evals array");
|
|
153
|
+
const ids = /* @__PURE__ */ new Set();
|
|
154
|
+
for (const e of j.evals) {
|
|
155
|
+
if (!Number.isInteger(e?.id) || typeof e.prompt !== "string" || typeof e.expected_output !== "string" || !Array.isArray(e.expectations) || e.expectations.some((x) => typeof x !== "string"))
|
|
156
|
+
throw new Error(`evals.json: bad eval ${JSON.stringify(e?.id)}: id (integer), prompt, expected_output and expectations (strings) are required`);
|
|
157
|
+
if (e.files !== void 0 && (!Array.isArray(e.files) || e.files.some((x) => typeof x !== "string"))) throw new Error(`evals.json: eval ${e.id}: files must be strings`);
|
|
158
|
+
if (ids.has(e.id)) throw new Error(`evals.json: duplicate id ${e.id}`);
|
|
159
|
+
ids.add(e.id);
|
|
160
|
+
}
|
|
161
|
+
return j;
|
|
162
|
+
}
|
|
163
|
+
var renderEvals = (f) => JSON.stringify(f, null, 2) + "\n";
|
|
69
164
|
export {
|
|
70
165
|
Embedder,
|
|
71
166
|
FrontmatterManager,
|
|
167
|
+
GATE_MAX_FALSE_TRIGGER_RATE,
|
|
168
|
+
GATE_MIN_POSITIVE_RATE,
|
|
72
169
|
GraphBuilder,
|
|
73
170
|
INDEX_FILE,
|
|
74
171
|
INDEX_OVERFLOW_THRESHOLD,
|
|
75
172
|
Indexer,
|
|
173
|
+
JEV_BAR,
|
|
174
|
+
MAX_TRIGGER_RUNS,
|
|
175
|
+
MAX_TUNE_ITERATIONS,
|
|
76
176
|
NoteCrud,
|
|
77
177
|
REDACTED,
|
|
178
|
+
SKILL_SCOPES,
|
|
179
|
+
SKILL_SECTIONS,
|
|
180
|
+
SKILL_STATUSES,
|
|
78
181
|
SessionManager,
|
|
79
182
|
TagManager,
|
|
80
183
|
TextSearch,
|
|
81
184
|
VectorIndex,
|
|
82
185
|
Watcher,
|
|
83
186
|
applyPatch,
|
|
187
|
+
approveDraft,
|
|
188
|
+
askJev,
|
|
189
|
+
buildBrief,
|
|
190
|
+
buildEvalSet,
|
|
84
191
|
buildIngestChangeSet,
|
|
85
192
|
buildPromoteChangeSet,
|
|
86
193
|
buildSynthesizeChangeSet,
|
|
194
|
+
calibrateJudge,
|
|
87
195
|
commandVerbs,
|
|
196
|
+
curate,
|
|
197
|
+
decideScope,
|
|
88
198
|
deriveProjectRoot,
|
|
89
199
|
deriveSessionDir,
|
|
200
|
+
describeDrafts,
|
|
201
|
+
describeFeature,
|
|
202
|
+
draftsDir,
|
|
90
203
|
errorSignal,
|
|
204
|
+
evalCachePath,
|
|
205
|
+
evalDraft,
|
|
91
206
|
evaluateFailures,
|
|
207
|
+
evaluateGate,
|
|
92
208
|
failureQuery,
|
|
209
|
+
failureState,
|
|
210
|
+
featureOn,
|
|
211
|
+
featureState,
|
|
93
212
|
filterToDrift,
|
|
213
|
+
findSkills,
|
|
94
214
|
formatDriftBanner,
|
|
95
215
|
formatFailureEval,
|
|
216
|
+
formatGate,
|
|
96
217
|
formatLintReport,
|
|
218
|
+
gateSkill,
|
|
97
219
|
inspectAgentsContract,
|
|
98
220
|
installDefaultSchema,
|
|
221
|
+
jevAvailable,
|
|
222
|
+
jevSpendToday,
|
|
223
|
+
jevVerdict,
|
|
224
|
+
lintSkill,
|
|
225
|
+
lintSkills,
|
|
99
226
|
lintVault,
|
|
227
|
+
listDrafts,
|
|
100
228
|
loadSchema,
|
|
101
229
|
logEvent,
|
|
102
230
|
logQuery,
|
|
231
|
+
makeScratch,
|
|
232
|
+
meetsBar,
|
|
233
|
+
parseEvals,
|
|
234
|
+
parseSkill,
|
|
235
|
+
parseVerify,
|
|
236
|
+
proposeMerges,
|
|
237
|
+
ratesOf,
|
|
238
|
+
readLedger,
|
|
103
239
|
redact,
|
|
104
240
|
redactDeep,
|
|
105
241
|
regenDirectoryIndex,
|
|
106
242
|
regenIndexesForPaths,
|
|
107
243
|
regenerateAgentsContract,
|
|
244
|
+
rejectDraft,
|
|
245
|
+
relevanceQuestion,
|
|
246
|
+
renderEvals,
|
|
247
|
+
renderSkill,
|
|
248
|
+
restore,
|
|
249
|
+
reviewSession,
|
|
250
|
+
rollback,
|
|
108
251
|
runHealthcheck,
|
|
109
|
-
|
|
252
|
+
runTaskEval,
|
|
253
|
+
runTrigger,
|
|
254
|
+
splitOf,
|
|
255
|
+
tuneDescription,
|
|
256
|
+
validateNote,
|
|
257
|
+
verifySkills,
|
|
258
|
+
withDescription
|
|
110
259
|
};
|
|
111
260
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/skill-eval/evals-json.ts"],"sourcesContent":["/**\n * Skill-creator's `evals/evals.json` (references/schemas.md), read and written as-is so evals made here\n * open in skill-creator and the other way round.\n */\nexport interface EvalCase {\n id: number;\n prompt: string;\n expected_output: string;\n /** input file paths, relative to the skill root */\n files?: string[];\n expectations: string[];\n}\n\nexport interface EvalsFile {\n skill_name: string;\n evals: EvalCase[];\n}\n\nexport function parseEvals(text: string): EvalsFile {\n const j = JSON.parse(text);\n if (typeof j?.skill_name !== \"string\" || !Array.isArray(j.evals)) throw new Error(\"evals.json needs skill_name and an evals array\");\n const ids = new Set<number>();\n for (const e of j.evals) {\n if (!Number.isInteger(e?.id) || typeof e.prompt !== \"string\" || typeof e.expected_output !== \"string\" || !Array.isArray(e.expectations) || e.expectations.some((x: unknown) => typeof x !== \"string\"))\n throw new Error(`evals.json: bad eval ${JSON.stringify(e?.id)}: id (integer), prompt, expected_output and expectations (strings) are required`);\n if (e.files !== undefined && (!Array.isArray(e.files) || e.files.some((x: unknown) => typeof x !== \"string\"))) throw new Error(`evals.json: eval ${e.id}: files must be strings`);\n if (ids.has(e.id)) throw new Error(`evals.json: duplicate id ${e.id}`);\n ids.add(e.id);\n }\n return j as EvalsFile;\n}\n\nexport const renderEvals = (f: EvalsFile): string => JSON.stringify(f, null, 2) + \"\\n\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,SAAS,WAAW,MAAyB;AAClD,QAAM,IAAI,KAAK,MAAM,IAAI;AACzB,MAAI,OAAO,GAAG,eAAe,YAAY,CAAC,MAAM,QAAQ,EAAE,KAAK,EAAG,OAAM,IAAI,MAAM,gDAAgD;AAClI,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,KAAK,EAAE,OAAO;AACvB,QAAI,CAAC,OAAO,UAAU,GAAG,EAAE,KAAK,OAAO,EAAE,WAAW,YAAY,OAAO,EAAE,oBAAoB,YAAY,CAAC,MAAM,QAAQ,EAAE,YAAY,KAAK,EAAE,aAAa,KAAK,CAAC,MAAe,OAAO,MAAM,QAAQ;AAClM,YAAM,IAAI,MAAM,wBAAwB,KAAK,UAAU,GAAG,EAAE,CAAC,iFAAiF;AAChJ,QAAI,EAAE,UAAU,WAAc,CAAC,MAAM,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAC,MAAe,OAAO,MAAM,QAAQ,GAAI,OAAM,IAAI,MAAM,oBAAoB,EAAE,EAAE,yBAAyB;AAChL,QAAI,IAAI,IAAI,EAAE,EAAE,EAAG,OAAM,IAAI,MAAM,4BAA4B,EAAE,EAAE,EAAE;AACrE,QAAI,IAAI,EAAE,EAAE;AAAA,EACd;AACA,SAAO;AACT;AAEO,IAAM,cAAc,CAAC,MAAyB,KAAK,UAAU,GAAG,MAAM,CAAC,IAAI;","names":[]}
|