@dzhechkov/harness-core 0.3.128 → 0.3.130
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/.dz-manifest.json +60 -32
- package/README.md +2 -1
- package/dist/agentdb-index.d.ts +11 -0
- package/dist/agentdb-index.d.ts.map +1 -1
- package/dist/agentdb-index.js +44 -0
- package/dist/agentdb-index.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/learning-backend.d.ts.map +1 -1
- package/dist/learning-backend.js +4 -0
- package/dist/learning-backend.js.map +1 -1
- package/dist/patterns.d.ts +74 -1
- package/dist/patterns.d.ts.map +1 -1
- package/dist/patterns.js +148 -9
- package/dist/patterns.js.map +1 -1
- package/dist/recall-hook-policy.d.ts +7 -0
- package/dist/recall-hook-policy.d.ts.map +1 -1
- package/dist/recall-hook-policy.js +6 -2
- package/dist/recall-hook-policy.js.map +1 -1
- package/dist/skills-verify.d.ts +158 -0
- package/dist/skills-verify.d.ts.map +1 -0
- package/dist/skills-verify.js +552 -0
- package/dist/skills-verify.js.map +1 -0
- package/dist/vector-tier.d.ts +5 -1
- package/dist/vector-tier.d.ts.map +1 -1
- package/dist/vector-tier.js +22 -6
- package/dist/vector-tier.js.map +1 -1
- package/package.json +3 -3
- package/sbom.json +101 -31
- package/src/agentdb-index.ts +46 -0
- package/src/index.ts +7 -3
- package/src/learning-backend.ts +4 -0
- package/src/patterns.ts +195 -11
- package/src/recall-hook-policy.ts +14 -2
- package/src/skills-verify.ts +710 -0
- package/src/vector-tier.ts +23 -5
|
@@ -74,12 +74,19 @@ export interface HookCandidate {
|
|
|
74
74
|
readonly pattern: string;
|
|
75
75
|
readonly score: number;
|
|
76
76
|
readonly domain?: string;
|
|
77
|
+
/** lesson-quarantine: an unproven hypothesis — the AUTO-INJECT surface excludes it (FR-5). */
|
|
78
|
+
readonly quarantined?: boolean;
|
|
77
79
|
}
|
|
78
80
|
export interface HookSelection {
|
|
79
81
|
readonly hits: readonly HookCandidate[];
|
|
80
82
|
/** The floor that was applied — reported so the hook's own output can explain its silence. */
|
|
81
83
|
readonly floor: number;
|
|
82
84
|
readonly lang: QueryLang;
|
|
85
|
+
/**
|
|
86
|
+
* lesson-quarantine AM-2: how many candidates were dropped for being quarantined — the
|
|
87
|
+
* exclusion is OBSERVABLE (the hook logs it), never a silent shrink of the context.
|
|
88
|
+
*/
|
|
89
|
+
readonly quarantinedExcluded: number;
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
85
92
|
* Apply the floor, the limit and the character budget. Returns an EMPTY hit list whenever nothing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recall-hook-policy.d.ts","sourceRoot":"","sources":["../src/recall-hook-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAqC,CAAC;AAE1E,2FAA2F;AAC3F,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,qHAAqH;AACrH,eAAO,MAAM,gCAAgC,OAAO,CAAC;AAIrD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAGxD;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,SAAS,GAAG,MAAM,CAKlG;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,2EAA2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,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAMtD;AAED,wGAAwG;AACxG,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,CAAC;IACxC,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,EACvD,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAClF,aAAa,CAwCf;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAIlE"}
|
|
@@ -90,8 +90,12 @@ export function selectHookHits(prompt, candidates, opts = {}) {
|
|
|
90
90
|
const budget = intOr(opts.budgetChars, DEFAULT_RECALL_HOOK_BUDGET_CHARS);
|
|
91
91
|
// A prompt with no intent gets no injection, whatever its cosine says.
|
|
92
92
|
if (!hasEnoughSignal(prompt))
|
|
93
|
-
return { hits: [], floor, lang };
|
|
93
|
+
return { hits: [], floor, lang, quarantinedExcluded: 0 };
|
|
94
|
+
// FR-5: the auto-inject surface is the STRICTEST — a quarantined lesson (unproven hypothesis)
|
|
95
|
+
// never rides into a prompt uninvited. Counted, not silent (AM-2).
|
|
96
|
+
const quarantinedExcluded = (candidates ?? []).filter((c) => c !== null && typeof c === 'object' && c.quarantined === true).length;
|
|
94
97
|
const clean = (candidates ?? [])
|
|
98
|
+
.filter((c) => !(c !== null && typeof c === 'object' && c.quarantined === true))
|
|
95
99
|
.filter((c) => c !== null &&
|
|
96
100
|
typeof c === 'object' &&
|
|
97
101
|
(c.dzId === undefined || typeof c.dzId === 'string') &&
|
|
@@ -114,7 +118,7 @@ export function selectHookHits(prompt, candidates, opts = {}) {
|
|
|
114
118
|
hits.push(c);
|
|
115
119
|
used += cost;
|
|
116
120
|
}
|
|
117
|
-
return { hits, floor, lang };
|
|
121
|
+
return { hits, floor, lang, quarantinedExcluded };
|
|
118
122
|
}
|
|
119
123
|
function intOr(v, fallback) {
|
|
120
124
|
return typeof v === 'number' && isFinite(v) && v > 0 ? Math.floor(v) : fallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recall-hook-policy.js","sourceRoot":"","sources":["../src/recall-hook-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAWH;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAE1E,2FAA2F;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,qHAAqH;AACrH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAErD,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,QAAQ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zC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAwB;IACxD,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACvH,OAAO,kEAAkE,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC/H,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dz skills-verify` — does a project's `.claude/skills/` actually REGISTER?
|
|
3
|
+
*
|
|
4
|
+
* Origin (feature skills-verify, ADR-001): `@dzhechkov/health-advisor` 1.2.0 shipped to npm with zero
|
|
5
|
+
* skills registering while its layout test was green — the test asserted a PROXY (files on disk), not
|
|
6
|
+
* the PROPERTY (registration). This module makes the property observable.
|
|
7
|
+
*
|
|
8
|
+
* Two layers:
|
|
9
|
+
* L1 `scanSkillsLayout` — instant, no Claude session: which names CAN register, plus the three
|
|
10
|
+
* layout shapes that produced the 1.2.0 defect.
|
|
11
|
+
* L2 `parseInitFacts` — the authoritative listing, parsed from the `system/init` event of
|
|
12
|
+
* + `classifyRegistration` `claude -p --output-format stream-json --verbose`. No model prose.
|
|
13
|
+
*
|
|
14
|
+
* FAIL-CLOSED: anything that prevents an honest observation yields `inconclusive`, never `pass`.
|
|
15
|
+
*/
|
|
16
|
+
/** The three non-registrable shapes, all observed in the health-advisor 1.2.0 defect. */
|
|
17
|
+
export type SkillIssueKind = 'no-skill-md' | 'buried-skill-md' | 'plugin-manifest-trap';
|
|
18
|
+
export interface SkillLayoutFinding {
|
|
19
|
+
readonly dir: string;
|
|
20
|
+
readonly kind: SkillIssueKind;
|
|
21
|
+
readonly detail: string;
|
|
22
|
+
}
|
|
23
|
+
export interface StaticScan {
|
|
24
|
+
/** The project this scan describes — evidence from another project must not be believed (QE4 #4). */
|
|
25
|
+
readonly projectDir: string;
|
|
26
|
+
readonly skillsRoot: string;
|
|
27
|
+
readonly exists: boolean;
|
|
28
|
+
/** Names that CAN register: a dir with SKILL.md exactly one level deep. */
|
|
29
|
+
readonly registrable: readonly string[];
|
|
30
|
+
/** Load-blocking problems: these make the verdict FAIL. */
|
|
31
|
+
readonly findings: readonly SkillLayoutFinding[];
|
|
32
|
+
/**
|
|
33
|
+
* Reported but NOT failing. A `.claude-plugin/plugin.json` under `.claude/skills` did not register
|
|
34
|
+
* in measured practice (MEASURED — reproducer: `dz skills-verify` against the published
|
|
35
|
+
* health-advisor 1.2.0, whose skills were absent from a live session listing), but the layout class
|
|
36
|
+
* may be supported under conditions this gate cannot observe (workspace trust). Telling the user is
|
|
37
|
+
* right; failing their build over it is over-claiming.
|
|
38
|
+
*/
|
|
39
|
+
readonly advisories: readonly SkillLayoutFinding[];
|
|
40
|
+
/**
|
|
41
|
+
* Plugin-shaped containers and the skill names they would provide. The layout alone cannot say
|
|
42
|
+
* whether such a container loads (that depends on client support and workspace trust), so the
|
|
43
|
+
* verdict ASKS THE SESSION: if none of a container's candidate names appear in the live listing,
|
|
44
|
+
* it did not register and that is a failure (QE4 #1 — without this, making the container advisory
|
|
45
|
+
* re-opened the vacuous pass and the gate stopped catching health-advisor 1.2.0).
|
|
46
|
+
*/
|
|
47
|
+
readonly containers: readonly {
|
|
48
|
+
readonly dir: string;
|
|
49
|
+
readonly candidates: readonly string[];
|
|
50
|
+
}[];
|
|
51
|
+
/**
|
|
52
|
+
* Set when the scan could not complete (unreadable dir, `.claude/skills` is a file, …). A failed
|
|
53
|
+
* scan must NOT read as "a clean empty project" — the classifier turns this into `inconclusive`
|
|
54
|
+
* (Codex QE #4).
|
|
55
|
+
*/
|
|
56
|
+
readonly scanError?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Walk `<projectDir>/.claude/skills/` and report what can register and what cannot.
|
|
60
|
+
* Deterministic, needs no Claude session — safe for CI.
|
|
61
|
+
*/
|
|
62
|
+
export declare function scanSkillsLayout(projectDir: string): StaticScan;
|
|
63
|
+
export interface InitPlugin {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly version?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface InitFacts {
|
|
68
|
+
/** Registered skill names. `null` means the key was ABSENT (schema drift) — never "none". */
|
|
69
|
+
readonly skills: readonly string[] | null;
|
|
70
|
+
readonly plugins: readonly InitPlugin[];
|
|
71
|
+
/** The project the session actually read — the built-in control. */
|
|
72
|
+
readonly cwd: string | null;
|
|
73
|
+
readonly clientVersion: string | null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse the `system/init` event out of a `--output-format stream-json` stream. PURE: takes the raw
|
|
77
|
+
* text, returns facts, does no IO. Returns `null` when no init event is present (→ inconclusive).
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* The first init event's facts. Use ONLY for "has the event arrived yet?" during streaming —
|
|
81
|
+
* `classifyRegistration` deliberately does NOT accept bare facts, because the count must travel
|
|
82
|
+
* with them (a caller that forgot to pass `initEventCount` got a free PASS — QE2 #2).
|
|
83
|
+
*/
|
|
84
|
+
export declare function parseInitFacts(streamText: string): InitFacts | null;
|
|
85
|
+
/**
|
|
86
|
+
* Every `system/init` event in the stream. More than one means the observations may CONTRADICT each
|
|
87
|
+
* other (Codex QE #7) — the classifier refuses to pick a winner and returns `inconclusive`.
|
|
88
|
+
*/
|
|
89
|
+
export declare function parseAllInitFacts(streamText: string): InitFacts[];
|
|
90
|
+
/** What a stream actually contained — facts, cardinality AND parse integrity, produced together. */
|
|
91
|
+
export interface StreamParse {
|
|
92
|
+
readonly events: InitFacts[];
|
|
93
|
+
/** A line that LOOKED like a JSON object but did not parse — possibly a truncated init (QE3 #2). */
|
|
94
|
+
readonly malformedObjectLines: number;
|
|
95
|
+
}
|
|
96
|
+
export type RegistrationVerdict = 'pass' | 'fail' | 'inconclusive';
|
|
97
|
+
export interface RegistrationControls {
|
|
98
|
+
/** Did the session read the target project? `null` when unknown (no init / no cwd). */
|
|
99
|
+
readonly cwdMatched: boolean | null;
|
|
100
|
+
/** Was the `skills` key present at all? A missing key is schema drift, not "nothing registered". */
|
|
101
|
+
readonly skillsListPresent: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface RegistrationResult {
|
|
104
|
+
readonly verdict: RegistrationVerdict;
|
|
105
|
+
readonly reason: string;
|
|
106
|
+
readonly expected: readonly string[];
|
|
107
|
+
readonly missing: readonly string[];
|
|
108
|
+
readonly registeredCount: number | null;
|
|
109
|
+
readonly clientVersion: string | null;
|
|
110
|
+
readonly plugins: readonly InitPlugin[];
|
|
111
|
+
readonly controls: RegistrationControls;
|
|
112
|
+
readonly layout: readonly SkillLayoutFinding[];
|
|
113
|
+
/** Reported, never fatal — see StaticScan.advisories. Rendering them is the policy (QE4 #5). */
|
|
114
|
+
readonly advisories: readonly SkillLayoutFinding[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The complete evidence bundle. Every piece is REQUIRED and travels together: the previous shape let
|
|
118
|
+
* a caller omit the scan error, the layout, the provenance check or the event count and get a free
|
|
119
|
+
* PASS (Codex QE3 #1/#2/#4/#5). There is exactly one door into the verdict, and it is this one.
|
|
120
|
+
*/
|
|
121
|
+
export interface RegistrationEvidence {
|
|
122
|
+
readonly projectDir: string;
|
|
123
|
+
/** The WHOLE static scan (carries its own scanError + findings) — not hand-picked fields. */
|
|
124
|
+
readonly scan: StaticScan;
|
|
125
|
+
/** The probe outcome: either the raw stream, or the reason there is none. */
|
|
126
|
+
readonly probe: {
|
|
127
|
+
readonly ok: true;
|
|
128
|
+
readonly stream: string;
|
|
129
|
+
} | {
|
|
130
|
+
readonly ok: false;
|
|
131
|
+
readonly error: string;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Did we actually look for same-named skills OUTSIDE this project, and what did we find?
|
|
135
|
+
* `checked: false` ⇒ inconclusive: unperformed provenance discovery is not evidence of uniqueness.
|
|
136
|
+
*/
|
|
137
|
+
readonly provenance: {
|
|
138
|
+
readonly checked: boolean;
|
|
139
|
+
readonly ambiguous: readonly string[];
|
|
140
|
+
};
|
|
141
|
+
/** Explicit `--expect` list; when absent the expectation is the scan's registrable set. */
|
|
142
|
+
readonly expected?: readonly string[];
|
|
143
|
+
}
|
|
144
|
+
export interface SkillsVerifyOptions {
|
|
145
|
+
/** Must CANONICALISE (realpath) so symlinked project paths compare equal; may throw. */
|
|
146
|
+
readonly resolvePath?: (p: string) => string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The single entry point. PURE apart from the injected resolver. Fail-closed by construction: `pass`
|
|
150
|
+
* is reachable only from a completed scan, a probe that produced EXACTLY ONE well-formed init event
|
|
151
|
+
* from THIS project, a fully-readable skills listing, a performed provenance check with no ambiguity,
|
|
152
|
+
* and zero load-blocking layout findings.
|
|
153
|
+
*/
|
|
154
|
+
export declare function verifyRegistration(evidence: RegistrationEvidence, options?: SkillsVerifyOptions): RegistrationResult;
|
|
155
|
+
/** Exit code contract: pass=0, fail=1, inconclusive=2 (distinct so CI can treat it separately). */
|
|
156
|
+
export declare function registrationExitCode(verdict: RegistrationVerdict, strict?: boolean): number;
|
|
157
|
+
export declare function renderRegistrationReport(result: RegistrationResult, scan?: Static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