@verevoir/recipes 0.2.0 → 0.3.0
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/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/plan.d.ts +88 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +224 -0
- package/dist/plan.js.map +1 -0
- package/dist/provisioning.d.ts +77 -0
- package/dist/provisioning.d.ts.map +1 -0
- package/dist/provisioning.js +266 -0
- package/dist/provisioning.js.map +1 -0
- package/dist/retrieval.d.ts +52 -0
- package/dist/retrieval.d.ts.map +1 -0
- package/dist/retrieval.js +181 -0
- package/dist/retrieval.js.map +1 -0
- package/package.json +13 -1
package/dist/index.d.ts
CHANGED
|
@@ -110,4 +110,7 @@ export declare function parseCapability(idHint: string, raw: string): Capability
|
|
|
110
110
|
* followed by the supplied argument values. Only non-empty args are included,
|
|
111
111
|
* so optional arguments left blank don't clutter the prompt. */
|
|
112
112
|
export declare function renderSkillPrompt(skill: SkillDescriptor, args: Record<string, string | undefined>): string;
|
|
113
|
+
export * from './retrieval';
|
|
114
|
+
export * from './provisioning';
|
|
115
|
+
export * from './plan';
|
|
113
116
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C;6EAC6E;AAC7E,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,YAAY,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElF,MAAM,WAAW,UAAU;IACzB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3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AAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;8EAC8E;AAC9E,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,wDAAwD;IACxD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,wEAAwE;IACxE,IAAI,EAAE,cAAc,CAAC;IACrB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,yEAAyE;IACzE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;gDAC4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwDD;;2DAE2D;AAC3D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,oBAAoB,CA0EjF;AAED;;gEAEgE;AAChE,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACvC,MAAM,CAUR;AAKD,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -332,4 +332,10 @@ export function renderSkillPrompt(skill, args) {
|
|
|
332
332
|
const inputBlock = supplied.map(({ input, value }) => `### ${input.name}\n${value}`).join('\n\n');
|
|
333
333
|
return `${skill.instructions}\n\n---\n\n## Inputs\n\n${inputBlock}`;
|
|
334
334
|
}
|
|
335
|
+
// ---------------------------------------------------------------------------
|
|
336
|
+
// Capability / practice engine — front-half (retrieval, planning, provisioning)
|
|
337
|
+
// ---------------------------------------------------------------------------
|
|
338
|
+
export * from './retrieval';
|
|
339
|
+
export * from './provisioning';
|
|
340
|
+
export * from './plan';
|
|
335
341
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,qEAAqE;AACrE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,yDAAyD;AACzD,EAAE;AACF,sBAAsB;AACtB,EAAE;AACF,QAAQ;AACR,oBAAoB;AACpB,sBAAsB;AACtB,mDAAmD;AACnD,2BAA2B;AAC3B,2BAA2B;AAC3B,YAAY;AACZ,6DAA6D;AAC7D,8DAA8D;AAC9D,mEAAmE;AACnE,QAAQ;AACR,wBAAwB;AAExB,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AA6C7C,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAU,CAAC;AAC7D,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IAC/C,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;CACT,CAAC,CAAC;AAOH,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;QAC/B,MAAM,IAAI,eAAe,CAAC,0CAA0C,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,eAAe,CAAC,6CAA6C,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AAG,KAAK,CAAC,YAAY,2BAA2B,UAAU,EAAE,CAAC;AACtE,CAAC;AAED,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC"}
|
package/dist/plan.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ModelClass } from '@verevoir/llm';
|
|
2
|
+
import type { CapabilityDescriptor } from './index';
|
|
3
|
+
import type { RetrievedCapability } from './retrieval';
|
|
4
|
+
/** One capability in the plan, with the practices that govern it and the
|
|
5
|
+
* in-plan capabilities it depends on (its resolvable `composes` edges). */
|
|
6
|
+
export interface PlanNode {
|
|
7
|
+
capability: string;
|
|
8
|
+
/** Practice ids provisioned for this node (slice 2). */
|
|
9
|
+
practices: string[];
|
|
10
|
+
/** In-plan capability types this one builds on — runs after all of them. */
|
|
11
|
+
dependsOn: string[];
|
|
12
|
+
/** Whether the request addressed this capability directly (`retrieved`) or it
|
|
13
|
+
* was pulled in as a prerequisite (`composed`). */
|
|
14
|
+
source: 'retrieved' | 'composed';
|
|
15
|
+
}
|
|
16
|
+
export interface ExecutionPlan {
|
|
17
|
+
request: string;
|
|
18
|
+
/** Entry capability types the request directly called for (post-narrowing). */
|
|
19
|
+
entry: string[];
|
|
20
|
+
/** All capabilities to run, in dependency order — prerequisites first. */
|
|
21
|
+
nodes: PlanNode[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* PURE. From a set of entry capability types and the corpus, build the ordered
|
|
25
|
+
* plan graph: close over `composes` to pull in every resolvable prerequisite,
|
|
26
|
+
* wire each node's `dependsOn`, and topologically sort so prerequisites come
|
|
27
|
+
* first. Deterministic — ties broken alphabetically. No practices here (that's
|
|
28
|
+
* the IO half in `planExecution`); this is the graph the tests pin down.
|
|
29
|
+
*
|
|
30
|
+
* Unknown entry types (not in the corpus) are ignored. A `composes` cycle
|
|
31
|
+
* (shouldn't occur — the corpus test forbids dangling edges) is broken by
|
|
32
|
+
* appending the unresolved remainder in a stable order rather than looping.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildPlanGraph(entryTypes: string[], corpus: CapabilityDescriptor[]): Array<{
|
|
35
|
+
capability: string;
|
|
36
|
+
dependsOn: string[];
|
|
37
|
+
source: 'retrieved' | 'composed';
|
|
38
|
+
}>;
|
|
39
|
+
/** System prompt for the entry-capability narrowing call — the capability-side
|
|
40
|
+
* mirror of practice-provisioning's concern tagger. */
|
|
41
|
+
export declare const NARROW_SYSTEM_PROMPT = "You are routing a request to the capabilities that will fulfil it. You are given a request and a CANDIDATE LIST of capabilities, each with an id and what it produces. Your job is to pick the capabilities the request GENUINELY calls for.\n\nRules:\n- A single request often calls for several capabilities \u2014 select every one the request actually asks for, in substance.\n- Do NOT select a capability merely because it is adjacent or could conceivably relate. If the request does not ask for what a capability produces, leave it out.\n- Prerequisites are added automatically downstream \u2014 select only the capabilities the request directly asks for, not the steps they depend on.\n- Use the capability ids exactly as written in the candidate list.\n\nReply with ONLY the selected ids, one per line, each prefixed with \"- \". No commentary.";
|
|
42
|
+
/** Parse selected ids out of a model reply, matching only against the supplied
|
|
43
|
+
* id set, order preserved by the candidate list. Word-boundary anchored so a
|
|
44
|
+
* hyphenated id doesn't fire its substrings (same rule as parseConcernTags). */
|
|
45
|
+
export declare function parseSelectedIds(text: string, ids: string[]): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Narrow the high-recall retrieved candidates to the capabilities the request
|
|
48
|
+
* genuinely calls for, with a reasoning-model call. Returns the selected types
|
|
49
|
+
* (a subset of the candidates). The model sees each candidate's id + what it
|
|
50
|
+
* produces (description ?? postcondition) — never the practice or edge detail.
|
|
51
|
+
* The caller passes the API key directly — no project-aware key resolution here.
|
|
52
|
+
*/
|
|
53
|
+
export declare function selectEntryCapabilities(request: string, candidates: RetrievedCapability[], corpus: CapabilityDescriptor[], apiKey: string | null, modelClass?: ModelClass): Promise<string[]>;
|
|
54
|
+
/** Injection seam so `planExecution` is testable without the embedder or any
|
|
55
|
+
* model call — a test supplies fakes; production uses the real retriever +
|
|
56
|
+
* reasoning calls. */
|
|
57
|
+
export interface PlanDeps {
|
|
58
|
+
/** REQUIRED — the host builds the index with its embedder and passes this. */
|
|
59
|
+
retrieve: (prose: string) => Promise<RetrievedCapability[]>;
|
|
60
|
+
/** Anthropic API key, passed directly by the caller. */
|
|
61
|
+
apiKey: string | null;
|
|
62
|
+
selectEntry?: (request: string, candidates: RetrievedCapability[], corpus: CapabilityDescriptor[]) => Promise<string[]>;
|
|
63
|
+
classifyConcerns?: (prose: string) => Promise<string[]>;
|
|
64
|
+
/** Top-K candidates to retrieve before narrowing. Defaults to the retriever's
|
|
65
|
+
* high-recall default. */
|
|
66
|
+
k?: number;
|
|
67
|
+
/** Model tier for the coordinator calls (narrow + concern-tag). Defaults to
|
|
68
|
+
* `reasoning` — production never changes it; the slice-5 matrix sweeps it to
|
|
69
|
+
* demonstrate the discrimination floor. Ignored when `selectEntry` /
|
|
70
|
+
* `classifyConcerns` are injected directly. */
|
|
71
|
+
coordinatorTier?: ModelClass;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Plan the execution of a request: retrieve high-recall candidates, narrow them
|
|
75
|
+
* to the entry capabilities the request genuinely calls for, close over
|
|
76
|
+
* `composes` for prerequisites, order by dependency, and provision a practice
|
|
77
|
+
* bucket per node. Returns the ordered plan — nothing is enacted.
|
|
78
|
+
*
|
|
79
|
+
* The corpus is an explicit parameter — recipes never loads a corpus from disk.
|
|
80
|
+
* The caller supplies `deps.retrieve` (the host-built index over that corpus)
|
|
81
|
+
* and `deps.apiKey`.
|
|
82
|
+
*
|
|
83
|
+
* The request's concerns are classified once and reused for every node that
|
|
84
|
+
* doesn't carry declared concern tags; declared tags (when the corpus has them)
|
|
85
|
+
* specialise a node's practices without a further model call.
|
|
86
|
+
*/
|
|
87
|
+
export declare function planExecution(request: string, corpus: CapabilityDescriptor[], deps: PlanDeps):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AAmB,EAAE,EACjC,MAAM,EAAE,oBAAoB,EAAE,EAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,UAAU,GAAE,UAAwB,GACnC,OAAO,CAAC,MAAM,EAAE,CAAC,CA2BnB;AAED;;sBAEsB;AACtB,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC5D,wDAAwD;IACxD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,mBAAmB,EAAE,EACjC,MAAM,EAAE,oBAAoB,EAAE,KAC3B,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACxD;8BAC0B;IAC1B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;mDAG+C;IAC/C,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,oBAAoB,EAAE,EAC9B,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,aAAa,CAAC,CAwCxB"}
|
package/dist/plan.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// CAPABILITY PLAN — stage 3 of the capability pipeline. Turns a request into an
|
|
2
|
+
// ordered, dependency-wired plan of capability nodes, each carrying the practice
|
|
3
|
+
// bucket (slice 2) that governs it. PURE of side effects: corpus + request in,
|
|
4
|
+
// plan out — no enactment, no DB writes, no on-screen objectives. The executor
|
|
5
|
+
// (slice 4) drives `enactCapability` over this plan, adds per-capability tier
|
|
6
|
+
// routing, and adds the LAZY refinement (re-running the retriever on a node's
|
|
7
|
+
// post-enactment prose) that only carries information once a parent has run —
|
|
8
|
+
// which is why it lives there, not here.
|
|
9
|
+
//
|
|
10
|
+
// HOW A PLAN IS BUILT
|
|
11
|
+
// 1. Retrieve (slice 1, embedding): the request prose ranks the corpus; the
|
|
12
|
+
// top-K are HIGH-RECALL candidates — deliberately over-inclusive, "the
|
|
13
|
+
// downstream model narrows".
|
|
14
|
+
// 2. Narrow (reasoning): a reasoning model picks, from those candidates, the
|
|
15
|
+
// capabilities the request GENUINELY calls for — the entry set. A single
|
|
16
|
+
// line of prose routinely calls for several ("evaluate this contract's
|
|
17
|
+
// risks and write me a board report" → three). This is the capability-side
|
|
18
|
+
// twin of slice 2's concern tagger: high-recall retrieval, reasoning-tier
|
|
19
|
+
// precision. Discrimination is reasoning-tier.
|
|
20
|
+
// 3. Close over `composes`: each entry capability builds on the outcomes it
|
|
21
|
+
// `composes` (discover-product-need ← define-what-product-means ← …). We
|
|
22
|
+
// walk those edges, pulling every resolvable prerequisite into the plan.
|
|
23
|
+
// Edges that don't resolve to a known capability are skipped — they name
|
|
24
|
+
// produced artifacts, not sub-capabilities (mirrors capability-tree.ts).
|
|
25
|
+
// `nextSteps` are NOT expanded — forward/optional follow-ons offered later,
|
|
26
|
+
// not planned now (same rule as capability-tree.ts).
|
|
27
|
+
// 4. Order: a node depends on its in-plan `composes` entries; a topological
|
|
28
|
+
// sort (alphabetical tie-break, so the plan is deterministic) puts
|
|
29
|
+
// prerequisites before the capabilities that need them.
|
|
30
|
+
// 5. Provision (slice 2): the request's concerns are classified ONCE, then each
|
|
31
|
+
// node provisions FOUNDATIONAL ∪ its concern-practices — using the
|
|
32
|
+
// capability's DECLARED concern tags when the corpus carries them (dormant
|
|
33
|
+
// until the corpus is tagged), else the request-level classification.
|
|
34
|
+
import { chat } from '@verevoir/llm/anthropic';
|
|
35
|
+
import { selectConcernTags, provisionPractices, declaredConcernsOf } from './provisioning';
|
|
36
|
+
/** The capability type of a `composes` edge, with any `@fanKey` suffix
|
|
37
|
+
* stripped (the planner doesn't fan — it plans one node per capability type). */
|
|
38
|
+
function edgeType(entry) {
|
|
39
|
+
const at = entry.indexOf('@');
|
|
40
|
+
return at === -1 ? entry : entry.slice(0, at);
|
|
41
|
+
}
|
|
42
|
+
/** The resolvable `composes` prerequisites of a capability: edge types that
|
|
43
|
+
* name a known capability. Unresolvable edges (produced artifacts like
|
|
44
|
+
* `repository-agent-documentation`) are dropped — same rule as
|
|
45
|
+
* capability-tree.ts. */
|
|
46
|
+
function composesOf(type, byType) {
|
|
47
|
+
const cap = byType.get(type);
|
|
48
|
+
if (!cap)
|
|
49
|
+
return [];
|
|
50
|
+
const deps = [];
|
|
51
|
+
for (const e of cap.composes) {
|
|
52
|
+
const t = edgeType(e);
|
|
53
|
+
if (t !== type && byType.has(t) && !deps.includes(t))
|
|
54
|
+
deps.push(t);
|
|
55
|
+
}
|
|
56
|
+
return deps;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* PURE. From a set of entry capability types and the corpus, build the ordered
|
|
60
|
+
* plan graph: close over `composes` to pull in every resolvable prerequisite,
|
|
61
|
+
* wire each node's `dependsOn`, and topologically sort so prerequisites come
|
|
62
|
+
* first. Deterministic — ties broken alphabetically. No practices here (that's
|
|
63
|
+
* the IO half in `planExecution`); this is the graph the tests pin down.
|
|
64
|
+
*
|
|
65
|
+
* Unknown entry types (not in the corpus) are ignored. A `composes` cycle
|
|
66
|
+
* (shouldn't occur — the corpus test forbids dangling edges) is broken by
|
|
67
|
+
* appending the unresolved remainder in a stable order rather than looping.
|
|
68
|
+
*/
|
|
69
|
+
export function buildPlanGraph(entryTypes, corpus) {
|
|
70
|
+
const byType = new Map(corpus.map((c) => [c.type, c]));
|
|
71
|
+
const entry = new Set(entryTypes.filter((t) => byType.has(t)));
|
|
72
|
+
// Closure: walk composes from every entry capability.
|
|
73
|
+
const inPlan = new Set(entry);
|
|
74
|
+
const stack = [...entry];
|
|
75
|
+
while (stack.length > 0) {
|
|
76
|
+
const t = stack.pop();
|
|
77
|
+
for (const dep of composesOf(t, byType)) {
|
|
78
|
+
if (!inPlan.has(dep)) {
|
|
79
|
+
inPlan.add(dep);
|
|
80
|
+
stack.push(dep);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// dependsOn for every node, restricted to what's in the plan.
|
|
85
|
+
const deps = new Map();
|
|
86
|
+
for (const t of inPlan)
|
|
87
|
+
deps.set(t, composesOf(t, byType).filter((d) => inPlan.has(d)));
|
|
88
|
+
// Kahn topological sort, alphabetical tie-break for determinism.
|
|
89
|
+
const indeg = new Map();
|
|
90
|
+
for (const t of inPlan)
|
|
91
|
+
indeg.set(t, deps.get(t).length);
|
|
92
|
+
const dependents = new Map();
|
|
93
|
+
for (const t of inPlan) {
|
|
94
|
+
for (const d of deps.get(t)) {
|
|
95
|
+
(dependents.get(d) ?? dependents.set(d, []).get(d)).push(t);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const ready = [...inPlan].filter((t) => indeg.get(t) === 0).sort();
|
|
99
|
+
const order = [];
|
|
100
|
+
const seen = new Set();
|
|
101
|
+
while (ready.length > 0) {
|
|
102
|
+
ready.sort();
|
|
103
|
+
const t = ready.shift();
|
|
104
|
+
if (seen.has(t))
|
|
105
|
+
continue;
|
|
106
|
+
seen.add(t);
|
|
107
|
+
order.push(t);
|
|
108
|
+
for (const dependent of (dependents.get(t) ?? []).slice().sort()) {
|
|
109
|
+
indeg.set(dependent, (indeg.get(dependent) ?? 0) - 1);
|
|
110
|
+
if (indeg.get(dependent) === 0)
|
|
111
|
+
ready.push(dependent);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Cycle guard: append any unvisited node deterministically rather than drop it.
|
|
115
|
+
for (const t of [...inPlan].sort())
|
|
116
|
+
if (!seen.has(t))
|
|
117
|
+
order.push(t);
|
|
118
|
+
return order.map((capability) => ({
|
|
119
|
+
capability,
|
|
120
|
+
dependsOn: deps.get(capability),
|
|
121
|
+
source: entry.has(capability) ? 'retrieved' : 'composed',
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
/** System prompt for the entry-capability narrowing call — the capability-side
|
|
125
|
+
* mirror of practice-provisioning's concern tagger. */
|
|
126
|
+
export const NARROW_SYSTEM_PROMPT = `You are routing a request to the capabilities that will fulfil it. You are given a request and a CANDIDATE LIST of capabilities, each with an id and what it produces. Your job is to pick the capabilities the request GENUINELY calls for.
|
|
127
|
+
|
|
128
|
+
Rules:
|
|
129
|
+
- A single request often calls for several capabilities — select every one the request actually asks for, in substance.
|
|
130
|
+
- Do NOT select a capability merely because it is adjacent or could conceivably relate. If the request does not ask for what a capability produces, leave it out.
|
|
131
|
+
- Prerequisites are added automatically downstream — select only the capabilities the request directly asks for, not the steps they depend on.
|
|
132
|
+
- Use the capability ids exactly as written in the candidate list.
|
|
133
|
+
|
|
134
|
+
Reply with ONLY the selected ids, one per line, each prefixed with "- ". No commentary.`;
|
|
135
|
+
/** Parse selected ids out of a model reply, matching only against the supplied
|
|
136
|
+
* id set, order preserved by the candidate list. Word-boundary anchored so a
|
|
137
|
+
* hyphenated id doesn't fire its substrings (same rule as parseConcernTags). */
|
|
138
|
+
export function parseSelectedIds(text, ids) {
|
|
139
|
+
const out = [];
|
|
140
|
+
for (const id of ids) {
|
|
141
|
+
const re = new RegExp(`(?<![a-z-])${id}(?![a-z-])`);
|
|
142
|
+
if (re.test(text) && !out.includes(id))
|
|
143
|
+
out.push(id);
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Narrow the high-recall retrieved candidates to the capabilities the request
|
|
149
|
+
* genuinely calls for, with a reasoning-model call. Returns the selected types
|
|
150
|
+
* (a subset of the candidates). The model sees each candidate's id + what it
|
|
151
|
+
* produces (description ?? postcondition) — never the practice or edge detail.
|
|
152
|
+
* The caller passes the API key directly — no project-aware key resolution here.
|
|
153
|
+
*/
|
|
154
|
+
export async function selectEntryCapabilities(request, candidates, corpus, apiKey, modelClass = 'reasoning') {
|
|
155
|
+
if (candidates.length === 0)
|
|
156
|
+
return [];
|
|
157
|
+
const byType = new Map(corpus.map((c) => [c.type, c]));
|
|
158
|
+
const ids = candidates.map((c) => c.type).filter((t) => byType.has(t));
|
|
159
|
+
const menu = ids
|
|
160
|
+
.map((t) => {
|
|
161
|
+
const c = byType.get(t);
|
|
162
|
+
return `- ${t}: ${c.description ?? c.postcondition ?? ''}`;
|
|
163
|
+
})
|
|
164
|
+
.join('\n');
|
|
165
|
+
const res = await chat({
|
|
166
|
+
systemPrompt: NARROW_SYSTEM_PROMPT,
|
|
167
|
+
turns: [
|
|
168
|
+
{
|
|
169
|
+
role: 'user',
|
|
170
|
+
content: `REQUEST:\n${request}\n\n` +
|
|
171
|
+
`CANDIDATE CAPABILITIES:\n${menu}\n\n` +
|
|
172
|
+
`Select the capabilities this request directly calls for.`,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
modelClass,
|
|
176
|
+
apiKey,
|
|
177
|
+
});
|
|
178
|
+
return parseSelectedIds(res.content, ids);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Plan the execution of a request: retrieve high-recall candidates, narrow them
|
|
182
|
+
* to the entry capabilities the request genuinely calls for, close over
|
|
183
|
+
* `composes` for prerequisites, order by dependency, and provision a practice
|
|
184
|
+
* bucket per node. Returns the ordered plan — nothing is enacted.
|
|
185
|
+
*
|
|
186
|
+
* The corpus is an explicit parameter — recipes never loads a corpus from disk.
|
|
187
|
+
* The caller supplies `deps.retrieve` (the host-built index over that corpus)
|
|
188
|
+
* and `deps.apiKey`.
|
|
189
|
+
*
|
|
190
|
+
* The request's concerns are classified once and reused for every node that
|
|
191
|
+
* doesn't carry declared concern tags; declared tags (when the corpus has them)
|
|
192
|
+
* specialise a node's practices without a further model call.
|
|
193
|
+
*/
|
|
194
|
+
export async function planExecution(request, corpus, deps) {
|
|
195
|
+
const coordinatorTier = deps.coordinatorTier ?? 'reasoning';
|
|
196
|
+
const retrieve = deps.retrieve;
|
|
197
|
+
const selectEntry = deps.selectEntry ??
|
|
198
|
+
((req, cands, corp) => selectEntryCapabilities(req, cands, corp, deps.apiKey, coordinatorTier));
|
|
199
|
+
const classifyConcerns = deps.classifyConcerns ??
|
|
200
|
+
((prose) => selectConcernTags(prose, deps.apiKey, coordinatorTier));
|
|
201
|
+
const byType = new Map(corpus.map((c) => [c.type, c]));
|
|
202
|
+
const candidates = await retrieve(request);
|
|
203
|
+
const entry = await selectEntry(request, candidates, corpus);
|
|
204
|
+
const graph = buildPlanGraph(entry, corpus);
|
|
205
|
+
// Classify the request's concerns once; nodes with declared tags override.
|
|
206
|
+
const requestTags = await classifyConcerns(request);
|
|
207
|
+
const nodes = [];
|
|
208
|
+
for (const g of graph) {
|
|
209
|
+
const declared = declaredConcernsOf(byType.get(g.capability));
|
|
210
|
+
const practices = await provisionPractices({ prose: request, declaredTags: declared ?? requestTags }, deps.apiKey, coordinatorTier);
|
|
211
|
+
nodes.push({
|
|
212
|
+
capability: g.capability,
|
|
213
|
+
practices,
|
|
214
|
+
dependsOn: g.dependsOn,
|
|
215
|
+
source: g.source,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
request,
|
|
220
|
+
entry: graph.filter((g) => g.source === 'retrieved').map((g) => g.capability),
|
|
221
|
+
nodes,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=plan.js.map
|
package/dist/plan.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,yCAAyC;AACzC,EAAE;AACF,sBAAsB;AACtB,6EAA6E;AAC7E,2EAA2E;AAC3E,iCAAiC;AACjC,8EAA8E;AAC9E,6EAA6E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AC,MAAM,EACX,eAAe,CAChB,CAAC;QACF,KAAK,CAAC,IAAI,CAAC;YACT,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,SAAS;YACT,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,MAAM,EAAE,CAAC,CAAC,MAAM;SACjB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,OAAO;QACP,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAC7E,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ModelClass } from '@verevoir/llm';
|
|
2
|
+
import type { CapabilityDescriptor } from './index';
|
|
3
|
+
/** One concern the reasoning model classifies the work against: an id plus the
|
|
4
|
+
* one-line "is this your area?" descriptor. The model sees ONLY this menu — no
|
|
5
|
+
* practice names — so tag-selection happens at the concern tier and practices
|
|
6
|
+
* resolve deterministically afterwards. */
|
|
7
|
+
export interface Concern {
|
|
8
|
+
id: string;
|
|
9
|
+
descriptor: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* INTERIM. The ~10-concern menu (ported from eval/practice-nav/taxonomy.ts
|
|
13
|
+
* CONCERNS — ids + descriptors only). See the interim banner at the top of the
|
|
14
|
+
* file: this belongs in the corpus.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CONCERN_MENU: Concern[];
|
|
17
|
+
/**
|
|
18
|
+
* INTERIM. concern id → real practice ids homed under it (ported from
|
|
19
|
+
* eval/practice-nav/taxonomy.ts CONCERNS). The `find_practices` map. See the
|
|
20
|
+
* interim banner: this belongs in the corpus.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CONCERN_PRACTICES: Record<string, string[]>;
|
|
23
|
+
/**
|
|
24
|
+
* INTERIM. The always-on foundational practices — provisioned for essentially
|
|
25
|
+
* all code work, never "selected". Testing discipline + boundary
|
|
26
|
+
* input-validation + failure-legibility + error-tracking are the universal code
|
|
27
|
+
* hygiene the corpus treats as table-stakes (mirrors FOUNDATIONAL in
|
|
28
|
+
* eval/practice-nav/run-tags.ts). See the interim banner: this belongs in the
|
|
29
|
+
* corpus.
|
|
30
|
+
*/
|
|
31
|
+
export declare const FOUNDATIONAL: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Parse selected concern ids out of the model's reply. Word-boundary anchored
|
|
34
|
+
* so a hyphenated id (`apis-and-contracts`) doesn't also fire its single-word
|
|
35
|
+
* substrings, AND so a single-word id (`security`, `testing`, `observability`)
|
|
36
|
+
* is matched on its own — run-tags.ts had a parser bug here, so the boundary is
|
|
37
|
+
* `[a-z-]` on both sides (not whitespace), letting bare single-word ids match.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseConcernTags(text: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a set of concern tags to a deduped union of their practice ids.
|
|
42
|
+
* Unknown tags contribute nothing (they're skipped, not an error) — a stray tag
|
|
43
|
+
* from a future corpus shouldn't break provisioning.
|
|
44
|
+
*/
|
|
45
|
+
export declare function findPractices(tags: string[]): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Ask the reasoning model which concerns apply to the request prose. Returns
|
|
48
|
+
* the selected concern ids (a subset of CONCERN_MENU ids). The caller passes
|
|
49
|
+
* the API key directly — no project-aware key resolution here.
|
|
50
|
+
*/
|
|
51
|
+
export declare function selectConcernTags(prose: string, apiKey: string | null, modelClass?: ModelClass): Promise<string[]>;
|
|
52
|
+
/** A request, the concerns chosen for it, and the provisioned practice ids. */
|
|
53
|
+
export interface ProvisionInput {
|
|
54
|
+
/** The work described in plain prose — what the model classifies. */
|
|
55
|
+
prose: string;
|
|
56
|
+
/** Concern tags already declared (e.g. read off a corpus-tagged capability).
|
|
57
|
+
* When present, the model call is SKIPPED and these are used directly. */
|
|
58
|
+
declaredTags?: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Provision the practice bucket for a piece of work: the dedup-union of the
|
|
62
|
+
* FOUNDATIONAL floor and the practices homed under the applicable concerns.
|
|
63
|
+
*
|
|
64
|
+
* Concerns come from `declaredTags` when supplied (no LLM call), otherwise from
|
|
65
|
+
* a reasoning-model classification of the prose. Returns practice IDS only —
|
|
66
|
+
* bodies are loaded at execution time (slice 4), not here.
|
|
67
|
+
*/
|
|
68
|
+
export declare function provisionPractices(input: ProvisionInput, apiKey: string | null, modelClass?: ModelClass): Promise<string[]>;
|
|
69
|
+
/**
|
|
70
|
+
* A capability descriptor MAY one day declare its concern tags directly (so the
|
|
71
|
+
* corpus, not a guess, drives the practices a capability pulls). That field is
|
|
72
|
+
* absent from CapabilityDescriptor today — this reads it defensively so the
|
|
73
|
+
* wire is in place the moment the corpus is tagged. Until then it returns
|
|
74
|
+
* undefined and provisioning falls through to the model guess.
|
|
75
|
+
*/
|
|
76
|
+
export declare function declaredConcernsOf(cap: CapabilityDescriptor | undefined): string[] | undefined;
|
|
77
|
+
//# sourceMappingURL=provisioning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../src/provisioning.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD;;;2CAG2C;AAC3C,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,EAmDjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiEtD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,EAchC,CAAC;AAmBF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAOvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAMtD;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,UAAU,GAAE,UAAwB,GACnC,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBnB;AAED,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd;8EAC0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,UAAU,GAAE,UAAwB,GACnC,OAAO,CAAC,MAAM,EAAE,CAAC,CAKnB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,oBAAoB,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAK9F"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
// PRACTICE PROVISIONING — stage 2 of the capability pipeline. Given a request
|
|
2
|
+
// (and the capabilities retrieved for it), it provisions the *practice* set
|
|
3
|
+
// that governs the work: a foundational always-on floor ∪ the practices homed
|
|
4
|
+
// under the concerns that genuinely apply.
|
|
5
|
+
//
|
|
6
|
+
// THE MECHANISM (validated, not invented here). The eval at
|
|
7
|
+
// eval/practice-nav/run-tags.ts proved — 93% recall, clean — that the right way
|
|
8
|
+
// to reach practices is NOT embedding. Practices sit at a conceptual tier the
|
|
9
|
+
// sentence-embedder can't bridge (a "flaky CI suite" request shares no surface
|
|
10
|
+
// vocabulary with "test-determinism"), so the embedder used for capabilities
|
|
11
|
+
// (slice 1) is deliberately NOT used here. Instead a *reasoning* model tags the
|
|
12
|
+
// work against a fixed ~10-concern MENU (ids + one-line descriptors only, never
|
|
13
|
+
// the practice list), and `concern → practice-ids` resolves the bucket
|
|
14
|
+
// deterministically. A foundational set covers the universal code-hygiene
|
|
15
|
+
// practices that apply to essentially all code work and are never "selected".
|
|
16
|
+
// This module ports run-tags.ts to production.
|
|
17
|
+
//
|
|
18
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
19
|
+
// INTERIM CONFIG — READ THIS.
|
|
20
|
+
//
|
|
21
|
+
// CONCERN_MENU, CONCERN_PRACTICES and FOUNDATIONAL below are an INTERIM,
|
|
22
|
+
// hand-maintained copy of the concern taxonomy. The single source of truth for
|
|
23
|
+
// which practices live under which concern MUST become the corpus itself — the
|
|
24
|
+
// practice `.md` files carry their concern tag (folder placement and/or
|
|
25
|
+
// frontmatter), and this config is then *read* from the corpus rather than
|
|
26
|
+
// duplicated here. Until aigency-guardrails is tagged, this table stands in for
|
|
27
|
+
// that read. When you tag the corpus: delete these three constants, load the
|
|
28
|
+
// concern→practice map from the corpus, and keep only the model-call + union
|
|
29
|
+
// logic. Do not let this table drift into a second source of truth.
|
|
30
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
import { chat } from '@verevoir/llm/anthropic';
|
|
32
|
+
/**
|
|
33
|
+
* INTERIM. The ~10-concern menu (ported from eval/practice-nav/taxonomy.ts
|
|
34
|
+
* CONCERNS — ids + descriptors only). See the interim banner at the top of the
|
|
35
|
+
* file: this belongs in the corpus.
|
|
36
|
+
*/
|
|
37
|
+
export const CONCERN_MENU = [
|
|
38
|
+
{
|
|
39
|
+
id: 'architecture-and-docs',
|
|
40
|
+
descriptor: 'How the system is structured and whether that structure and its decisions are written down and stay current — boundaries, ADRs, agent/onboarding context, deferring commitments.',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'apis-and-contracts',
|
|
44
|
+
descriptor: 'The shape of interfaces a caller depends on: stable contracts, machine-readable schemas, consistent representations, stable identifiers, and how the same entity reads in and out.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'errors-and-resilience',
|
|
48
|
+
descriptor: 'Behaving correctly when things fail or run at once: retry-safe and atomic operations, legible failures, concurrency and async correctness, validating untrusted input.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'security',
|
|
52
|
+
descriptor: 'Keeping the system safe from abuse: threat modelling, secret handling, validating untrusted input, vulnerability scanning, and supply-chain integrity.',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'delivery-and-deploy',
|
|
56
|
+
descriptor: 'Getting a build safely into production and back out: infrastructure as code, drift detection, gradual deploy, rollback, schema migration safety, post-deploy smoke gating.',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'observability',
|
|
60
|
+
descriptor: 'Seeing what the running system is doing: traces/metrics/logs, structured logging, and capturing production errors as actionable, aggregated data.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'change-and-review',
|
|
64
|
+
descriptor: 'How a change is made legible and judged: pull-request structure, commit/change traceability, pre-commit gates, static analysis.',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'dependencies-and-build',
|
|
68
|
+
descriptor: 'Managing third-party code and the build: keeping dependencies current, reproducible builds, supply-chain integrity, scanning for known vulnerabilities.',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'testing',
|
|
72
|
+
descriptor: 'Whether behaviour is genuinely verified: automated tests, the test pyramid, testing through the public interface, integration against real dependencies, determinism, coverage honesty, tests-as-spec, regression tests from escaped defects.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'performance-and-ux',
|
|
76
|
+
descriptor: 'What the end user experiences: accessibility of the interface and the size/weight of what gets shipped to the client.',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
/**
|
|
80
|
+
* INTERIM. concern id → real practice ids homed under it (ported from
|
|
81
|
+
* eval/practice-nav/taxonomy.ts CONCERNS). The `find_practices` map. See the
|
|
82
|
+
* interim banner: this belongs in the corpus.
|
|
83
|
+
*/
|
|
84
|
+
export const CONCERN_PRACTICES = {
|
|
85
|
+
'architecture-and-docs': [
|
|
86
|
+
'architecture-boundaries',
|
|
87
|
+
'architecture-documented',
|
|
88
|
+
'agent-context-file-maintained',
|
|
89
|
+
'deliberate-deferral',
|
|
90
|
+
'local-dev-onboarding',
|
|
91
|
+
'user-journeys-documented',
|
|
92
|
+
'solutions-meet-platform-standards',
|
|
93
|
+
],
|
|
94
|
+
'apis-and-contracts': [
|
|
95
|
+
'api-contract-stability',
|
|
96
|
+
'declarative-contract',
|
|
97
|
+
'contract-symmetry',
|
|
98
|
+
'addressability',
|
|
99
|
+
'input-validation',
|
|
100
|
+
],
|
|
101
|
+
'errors-and-resilience': [
|
|
102
|
+
'atomicity-and-idempotency',
|
|
103
|
+
'failure-legibility',
|
|
104
|
+
'concurrency',
|
|
105
|
+
'input-validation',
|
|
106
|
+
],
|
|
107
|
+
security: [
|
|
108
|
+
'threat-modelling',
|
|
109
|
+
'secret-handling',
|
|
110
|
+
'input-validation',
|
|
111
|
+
'vulnerability-scanning',
|
|
112
|
+
'supply-chain-integrity',
|
|
113
|
+
],
|
|
114
|
+
'delivery-and-deploy': [
|
|
115
|
+
'infrastructure-as-code',
|
|
116
|
+
'iac-drift-detection',
|
|
117
|
+
'deploy-safety',
|
|
118
|
+
'rollback-readiness',
|
|
119
|
+
'schema-migration-safety',
|
|
120
|
+
'journey-smoke-coverage',
|
|
121
|
+
'build-reproducibility',
|
|
122
|
+
],
|
|
123
|
+
observability: ['observability', 'structured-logging', 'error-tracking'],
|
|
124
|
+
'change-and-review': [
|
|
125
|
+
'pull-request-structure',
|
|
126
|
+
'change-traceability',
|
|
127
|
+
'pre-commit-gates',
|
|
128
|
+
'static-analysis',
|
|
129
|
+
],
|
|
130
|
+
'dependencies-and-build': [
|
|
131
|
+
'dependency-currency',
|
|
132
|
+
'build-reproducibility',
|
|
133
|
+
'supply-chain-integrity',
|
|
134
|
+
'vulnerability-scanning',
|
|
135
|
+
],
|
|
136
|
+
testing: [
|
|
137
|
+
'automated-testing',
|
|
138
|
+
'test-pyramid',
|
|
139
|
+
'test-through-the-public-interface',
|
|
140
|
+
'integration-tested-against-real-dependencies',
|
|
141
|
+
'test-determinism',
|
|
142
|
+
'coverage-honesty',
|
|
143
|
+
'cover-deliberate-behaviour',
|
|
144
|
+
'tests-read-as-specification',
|
|
145
|
+
'one-reason-to-fail',
|
|
146
|
+
'escaped-defects-become-regression-tests',
|
|
147
|
+
],
|
|
148
|
+
'performance-and-ux': ['accessibility', 'bundle-size-discipline'],
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* INTERIM. The always-on foundational practices — provisioned for essentially
|
|
152
|
+
* all code work, never "selected". Testing discipline + boundary
|
|
153
|
+
* input-validation + failure-legibility + error-tracking are the universal code
|
|
154
|
+
* hygiene the corpus treats as table-stakes (mirrors FOUNDATIONAL in
|
|
155
|
+
* eval/practice-nav/run-tags.ts). See the interim banner: this belongs in the
|
|
156
|
+
* corpus.
|
|
157
|
+
*/
|
|
158
|
+
export const FOUNDATIONAL = [
|
|
159
|
+
'automated-testing',
|
|
160
|
+
'test-pyramid',
|
|
161
|
+
'test-determinism',
|
|
162
|
+
'coverage-honesty',
|
|
163
|
+
'test-through-the-public-interface',
|
|
164
|
+
'tests-read-as-specification',
|
|
165
|
+
'one-reason-to-fail',
|
|
166
|
+
'cover-deliberate-behaviour',
|
|
167
|
+
'escaped-defects-become-regression-tests',
|
|
168
|
+
'integration-tested-against-real-dependencies',
|
|
169
|
+
'input-validation',
|
|
170
|
+
'failure-legibility',
|
|
171
|
+
'error-tracking',
|
|
172
|
+
];
|
|
173
|
+
/** The system prompt for the concern-tagging call — ported verbatim from
|
|
174
|
+
* eval/practice-nav/run-tags.ts (the validated wording). */
|
|
175
|
+
const TAG_SYSTEM_PROMPT = `You are an engineering reviewer. You are given a software task and a fixed MENU of engineering CONCERNS (areas of quality), each with a one-line descriptor. Your job is to tag the task with the concerns that genuinely apply to it.
|
|
176
|
+
|
|
177
|
+
Rules:
|
|
178
|
+
- Pick every concern the task plausibly touches, but only those a careful engineer would actually pull for THIS task — do not select a concern just because it could conceivably relate. Selecting all of them is wrong.
|
|
179
|
+
- A universal foundation of testing and basic input/error hygiene is ALREADY provisioned for every task; you do NOT need to select concerns merely to cover ordinary unit testing or routine validation. Select a concern only when the task's substance lands in that area.
|
|
180
|
+
- Use the concern ids exactly as written in the menu.
|
|
181
|
+
|
|
182
|
+
Reply with ONLY the selected concern ids, one per line, each prefixed with "- ". No commentary.`;
|
|
183
|
+
/** Render the concern menu the model classifies against — ids + descriptors
|
|
184
|
+
* only, never the practice list. */
|
|
185
|
+
function concernMenuText() {
|
|
186
|
+
return CONCERN_MENU.map((c) => `- ${c.id}: ${c.descriptor}`).join('\n');
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Parse selected concern ids out of the model's reply. Word-boundary anchored
|
|
190
|
+
* so a hyphenated id (`apis-and-contracts`) doesn't also fire its single-word
|
|
191
|
+
* substrings, AND so a single-word id (`security`, `testing`, `observability`)
|
|
192
|
+
* is matched on its own — run-tags.ts had a parser bug here, so the boundary is
|
|
193
|
+
* `[a-z-]` on both sides (not whitespace), letting bare single-word ids match.
|
|
194
|
+
*/
|
|
195
|
+
export function parseConcernTags(text) {
|
|
196
|
+
const found = [];
|
|
197
|
+
for (const c of CONCERN_MENU) {
|
|
198
|
+
const re = new RegExp(`(?<![a-z-])${c.id}(?![a-z-])`);
|
|
199
|
+
if (re.test(text) && !found.includes(c.id))
|
|
200
|
+
found.push(c.id);
|
|
201
|
+
}
|
|
202
|
+
return found;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Resolve a set of concern tags to a deduped union of their practice ids.
|
|
206
|
+
* Unknown tags contribute nothing (they're skipped, not an error) — a stray tag
|
|
207
|
+
* from a future corpus shouldn't break provisioning.
|
|
208
|
+
*/
|
|
209
|
+
export function findPractices(tags) {
|
|
210
|
+
const set = new Set();
|
|
211
|
+
for (const tag of tags) {
|
|
212
|
+
for (const pid of CONCERN_PRACTICES[tag] ?? [])
|
|
213
|
+
set.add(pid);
|
|
214
|
+
}
|
|
215
|
+
return [...set];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Ask the reasoning model which concerns apply to the request prose. Returns
|
|
219
|
+
* the selected concern ids (a subset of CONCERN_MENU ids). The caller passes
|
|
220
|
+
* the API key directly — no project-aware key resolution here.
|
|
221
|
+
*/
|
|
222
|
+
export async function selectConcernTags(prose, apiKey, modelClass = 'reasoning') {
|
|
223
|
+
const res = await chat({
|
|
224
|
+
systemPrompt: TAG_SYSTEM_PROMPT,
|
|
225
|
+
turns: [
|
|
226
|
+
{
|
|
227
|
+
role: 'user',
|
|
228
|
+
content: `TASK:\n${prose}\n\n` +
|
|
229
|
+
`CONCERN MENU:\n${concernMenuText()}\n\n` +
|
|
230
|
+
`Select the concern ids that apply.`,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
modelClass,
|
|
234
|
+
apiKey,
|
|
235
|
+
});
|
|
236
|
+
return parseConcernTags(res.content);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Provision the practice bucket for a piece of work: the dedup-union of the
|
|
240
|
+
* FOUNDATIONAL floor and the practices homed under the applicable concerns.
|
|
241
|
+
*
|
|
242
|
+
* Concerns come from `declaredTags` when supplied (no LLM call), otherwise from
|
|
243
|
+
* a reasoning-model classification of the prose. Returns practice IDS only —
|
|
244
|
+
* bodies are loaded at execution time (slice 4), not here.
|
|
245
|
+
*/
|
|
246
|
+
export async function provisionPractices(input, apiKey, modelClass = 'reasoning') {
|
|
247
|
+
const tags = input.declaredTags ?? (await selectConcernTags(input.prose, apiKey, modelClass));
|
|
248
|
+
const set = new Set(FOUNDATIONAL);
|
|
249
|
+
for (const pid of findPractices(tags))
|
|
250
|
+
set.add(pid);
|
|
251
|
+
return [...set];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A capability descriptor MAY one day declare its concern tags directly (so the
|
|
255
|
+
* corpus, not a guess, drives the practices a capability pulls). That field is
|
|
256
|
+
* absent from CapabilityDescriptor today — this reads it defensively so the
|
|
257
|
+
* wire is in place the moment the corpus is tagged. Until then it returns
|
|
258
|
+
* undefined and provisioning falls through to the model guess.
|
|
259
|
+
*/
|
|
260
|
+
export function declaredConcernsOf(cap) {
|
|
261
|
+
const concerns = cap?.concerns;
|
|
262
|
+
return Array.isArray(concerns) && concerns.every((c) => typeof c === 'string')
|
|
263
|
+
? concerns
|
|
264
|
+
: undefined;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=provisioning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provisioning.js","sourceRoot":"","sources":["../src/provisioning.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,2CAA2C;AAC3C,EAAE;AACF,4DAA4D;AAC5D,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,gFAAgF;AAChF,uEAAuE;AACvE,0EAA0E;AAC1E,8EAA8E;AAC9E,+CAA+C;AAC/C,EAAE;AACF,gFAAgF;AAChF,8BAA8B;AAC9B,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,+EAA+E;AAC/E,wEAAwE;AACxE,2EAA2E;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,gFAAgF;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAa/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC;QACE,EAAE,EAAE,uBAAuB;QAC3B,UAAU,EACR,kLAAkL;KACrL;IACD;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G,CAAC,GAAG,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAqC;IACtE,MAAM,QAAQ,GAAI,GAA0C,EAAE,QAAQ,CAAC;IACvE,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;QAC5E,CAAC,CAAE,QAAqB;QACxB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CapabilityDescriptor } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* A text→vectors embedder. The retriever depends only on this surface, so the
|
|
4
|
+
* local bge model can be swapped for a hosted embedder later without touching
|
|
5
|
+
* callers. `id` participates in the cache key, so swapping models (or model
|
|
6
|
+
* versions) invalidates persisted vectors automatically.
|
|
7
|
+
*/
|
|
8
|
+
export interface Embedder {
|
|
9
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The text the embedder indexes a capability by: its request-side addressing
|
|
14
|
+
* (`description ?? postcondition`) plus the first paragraph of the guidance
|
|
15
|
+
* body, which carries concrete request vocabulary the one-liner lacks. Mirrors
|
|
16
|
+
* the eval's baseline addressing (description/postcondition) augmented with the
|
|
17
|
+
* body lede.
|
|
18
|
+
*/
|
|
19
|
+
export declare function addressingText(c: CapabilityDescriptor): string;
|
|
20
|
+
/** Cosine similarity. Vectors are L2-normalised, so this is a dot product. */
|
|
21
|
+
export declare function cosine(a: number[], b: number[]): number;
|
|
22
|
+
/** A built, queryable capability index: the embedder plus one vector per
|
|
23
|
+
* capability type, ready for cosine ranking. */
|
|
24
|
+
export interface CapabilityIndex {
|
|
25
|
+
embedder: Embedder;
|
|
26
|
+
types: string[];
|
|
27
|
+
vectors: Map<string, number[]>;
|
|
28
|
+
/** retrieve(prose, k): embed the prose, cosine vs every capability vector,
|
|
29
|
+
* return the top-k capability `type`s ranked by descending score. */
|
|
30
|
+
retrieve(prose: string, k?: number): Promise<RetrievedCapability[]>;
|
|
31
|
+
}
|
|
32
|
+
export interface RetrievedCapability {
|
|
33
|
+
type: string;
|
|
34
|
+
score: number;
|
|
35
|
+
}
|
|
36
|
+
/** Generous default — slice 1's job is high recall; the downstream model
|
|
37
|
+
* narrows. Matches the eval's K=20 recall@20 operating point. */
|
|
38
|
+
export declare const DEFAULT_K = 20;
|
|
39
|
+
/**
|
|
40
|
+
* Build a queryable index over a capability corpus. Embeds every capability's
|
|
41
|
+
* addressing text once, caching the vectors:
|
|
42
|
+
* - in-memory, keyed by `embedder.id + sha256(addressing texts)` — a warm
|
|
43
|
+
* process never re-embeds or touches disk;
|
|
44
|
+
* - on disk under `.cache/capability-embeddings-<hash>.json` (gitignored) —
|
|
45
|
+
* a cold start is a disk read, not a re-embed.
|
|
46
|
+
* The caller supplies the embedder — recipes does not bundle one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildCapabilityIndex(corpus: CapabilityDescriptor[], embedder: Embedder): Promise<CapabilityIndex>;
|
|
49
|
+
/** Test seam: drop the in-memory index cache so a test can rebuild with a
|
|
50
|
+
* different embedder/corpus. Does not touch the disk cache. */
|
|
51
|
+
export declare function clearCapabilityIndexCache(): void;
|
|
52
|
+
//# sourceMappingURL=retrieval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval.d.ts","sourceRoot":"","sources":["../src/retrieval.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAIpD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAgBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAO9D;AAED,8EAA8E;AAC9E,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAIvD;AAED;gDACgD;AAChD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B;yEACqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;iEACiE;AACjE,eAAO,MAAM,SAAS,KAAK,CAAC;AA8G5B;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,oBAAoB,EAAE,EAC9B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,eAAe,CAAC,CA0B1B;AAED;+DAC+D;AAC/D,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// CAPABILITY RETRIEVAL — the high-recall coarse retriever of the capability
|
|
2
|
+
// pipeline (stage 1). Given request prose, it ranks the capability corpus by
|
|
3
|
+
// semantic similarity and hands the top-K capability `type`s to the downstream
|
|
4
|
+
// model. No LLM in the retriever itself: a local, in-process sentence embedder
|
|
5
|
+
// turns each capability's ADDRESSING TEXT into a vector once (cached), and the
|
|
6
|
+
// request prose into a vector at retrieve time; cosine ranks the catalogue.
|
|
7
|
+
//
|
|
8
|
+
// This promotes the proven eval embedder (eval/capability-nav/embed-bin.ts,
|
|
9
|
+
// recall@20 = 85% over ~150 capabilities) into production, behind a pluggable
|
|
10
|
+
// `Embedder` so the local model can later be swapped for a hosted one without
|
|
11
|
+
// touching callers.
|
|
12
|
+
//
|
|
13
|
+
// The heavy local embedder impl (@huggingface/transformers) is NOT in this
|
|
14
|
+
// module — it must stay in the host and be injected. The host builds the index
|
|
15
|
+
// with its embedder and passes the index's `.retrieve()` to the planner.
|
|
16
|
+
import { createHash } from 'node:crypto';
|
|
17
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
const CACHE_DIR = join(process.cwd(), '.cache');
|
|
20
|
+
/** Strip inline markdown markers (bold/italic/code) and collapse whitespace. */
|
|
21
|
+
function stripMd(s) {
|
|
22
|
+
return s.replace(/\*\*/g, '').replace(/[*_`]/g, '').replace(/\s+/g, ' ').trim();
|
|
23
|
+
}
|
|
24
|
+
/** The first paragraph of a capability's guidance body (blank-line delimited),
|
|
25
|
+
* markdown-stripped. Empty when the body is empty. */
|
|
26
|
+
function firstParagraph(body) {
|
|
27
|
+
const trimmed = (body ?? '').trim();
|
|
28
|
+
if (!trimmed)
|
|
29
|
+
return '';
|
|
30
|
+
const para = trimmed.split(/\n\s*\n/, 1)[0];
|
|
31
|
+
return stripMd(para);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The text the embedder indexes a capability by: its request-side addressing
|
|
35
|
+
* (`description ?? postcondition`) plus the first paragraph of the guidance
|
|
36
|
+
* body, which carries concrete request vocabulary the one-liner lacks. Mirrors
|
|
37
|
+
* the eval's baseline addressing (description/postcondition) augmented with the
|
|
38
|
+
* body lede.
|
|
39
|
+
*/
|
|
40
|
+
export function addressingText(c) {
|
|
41
|
+
const parts = [];
|
|
42
|
+
const lead = c.description ?? c.postcondition ?? '';
|
|
43
|
+
if (lead)
|
|
44
|
+
parts.push(stripMd(lead));
|
|
45
|
+
const para = firstParagraph(c.guidance);
|
|
46
|
+
if (para)
|
|
47
|
+
parts.push(para);
|
|
48
|
+
return parts.join(' ');
|
|
49
|
+
}
|
|
50
|
+
/** Cosine similarity. Vectors are L2-normalised, so this is a dot product. */
|
|
51
|
+
export function cosine(a, b) {
|
|
52
|
+
let dot = 0;
|
|
53
|
+
for (let i = 0; i < a.length; i++)
|
|
54
|
+
dot += a[i] * b[i];
|
|
55
|
+
return dot;
|
|
56
|
+
}
|
|
57
|
+
/** Generous default — slice 1's job is high recall; the downstream model
|
|
58
|
+
* narrows. Matches the eval's K=20 recall@20 operating point. */
|
|
59
|
+
export const DEFAULT_K = 20;
|
|
60
|
+
/** sha256 over the (type → addressing text) map, sorted by type. A corpus edit
|
|
61
|
+
* (new capability, changed description/body) changes the hash and invalidates
|
|
62
|
+
* the persisted cache. */
|
|
63
|
+
function corpusSignature(addressing) {
|
|
64
|
+
const h = createHash('sha256');
|
|
65
|
+
for (const type of [...addressing.keys()].sort()) {
|
|
66
|
+
h.update(type);
|
|
67
|
+
h.update(' ');
|
|
68
|
+
h.update(addressing.get(type));
|
|
69
|
+
h.update(' ');
|
|
70
|
+
}
|
|
71
|
+
return h.digest('hex');
|
|
72
|
+
}
|
|
73
|
+
function cachePathFor(embedderId, signature) {
|
|
74
|
+
// The hash already binds embedder + corpus; a short prefix keeps the
|
|
75
|
+
// filename readable. Slashes in a model id (e.g. Xenova/bge-...) would break
|
|
76
|
+
// the path, so derive the whole name from the signature hash.
|
|
77
|
+
const key = createHash('sha256')
|
|
78
|
+
.update(embedderId)
|
|
79
|
+
.update(' ')
|
|
80
|
+
.update(signature)
|
|
81
|
+
.digest('hex')
|
|
82
|
+
.slice(0, 32);
|
|
83
|
+
return join(CACHE_DIR, `capability-embeddings-${key}.json`);
|
|
84
|
+
}
|
|
85
|
+
function readDiskCache(path, embedderId, signature, types) {
|
|
86
|
+
if (!existsSync(path))
|
|
87
|
+
return null;
|
|
88
|
+
try {
|
|
89
|
+
const cached = JSON.parse(readFileSync(path, 'utf8'));
|
|
90
|
+
if (cached.embedderId !== embedderId || cached.signature !== signature) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const vectors = new Map();
|
|
94
|
+
for (const type of types) {
|
|
95
|
+
const v = cached.vectors[type];
|
|
96
|
+
if (!v)
|
|
97
|
+
return null; // partial cache — re-embed rather than serve gaps
|
|
98
|
+
vectors.set(type, v);
|
|
99
|
+
}
|
|
100
|
+
return vectors;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return null; // unreadable/corrupt — re-embed
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function writeDiskCache(path, embedderId, signature, vectors) {
|
|
107
|
+
try {
|
|
108
|
+
mkdirSync(CACHE_DIR, { recursive: true });
|
|
109
|
+
const payload = {
|
|
110
|
+
embedderId,
|
|
111
|
+
signature,
|
|
112
|
+
vectors: Object.fromEntries(vectors),
|
|
113
|
+
};
|
|
114
|
+
writeFileSync(path, JSON.stringify(payload));
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
// A cache that can't be written (read-only FS, etc.) must not break
|
|
118
|
+
// retrieval — the in-memory index still works for the process lifetime.
|
|
119
|
+
console.error(`capability-retrieval: failed to persist embedding cache — ${err instanceof Error ? err.message : String(err)}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// In-memory index cache, keyed by `embedderId + signature`. A cold start is a
|
|
123
|
+
// disk read; a warm process is a map hit (no disk, no re-embed).
|
|
124
|
+
const memo = new Map();
|
|
125
|
+
function makeIndex(embedder, types, vectors) {
|
|
126
|
+
return {
|
|
127
|
+
embedder,
|
|
128
|
+
types,
|
|
129
|
+
vectors,
|
|
130
|
+
async retrieve(prose, k = DEFAULT_K) {
|
|
131
|
+
const [qvec] = await embedder.embed([prose]);
|
|
132
|
+
if (!qvec)
|
|
133
|
+
return [];
|
|
134
|
+
const scored = types.map((type) => ({
|
|
135
|
+
type,
|
|
136
|
+
score: cosine(qvec, vectors.get(type)),
|
|
137
|
+
}));
|
|
138
|
+
scored.sort((a, b) => b.score - a.score);
|
|
139
|
+
return k >= 0 ? scored.slice(0, k) : scored;
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Build a queryable index over a capability corpus. Embeds every capability's
|
|
145
|
+
* addressing text once, caching the vectors:
|
|
146
|
+
* - in-memory, keyed by `embedder.id + sha256(addressing texts)` — a warm
|
|
147
|
+
* process never re-embeds or touches disk;
|
|
148
|
+
* - on disk under `.cache/capability-embeddings-<hash>.json` (gitignored) —
|
|
149
|
+
* a cold start is a disk read, not a re-embed.
|
|
150
|
+
* The caller supplies the embedder — recipes does not bundle one.
|
|
151
|
+
*/
|
|
152
|
+
export async function buildCapabilityIndex(corpus, embedder) {
|
|
153
|
+
// Deterministic order: sort by type so the signature + vector layout are
|
|
154
|
+
// stable across loads.
|
|
155
|
+
const sorted = [...corpus].sort((a, b) => a.type.localeCompare(b.type));
|
|
156
|
+
const types = sorted.map((c) => c.type);
|
|
157
|
+
const addressing = new Map(sorted.map((c) => [c.type, addressingText(c)]));
|
|
158
|
+
const signature = corpusSignature(addressing);
|
|
159
|
+
const memoKey = `${embedder.id} ${signature}`;
|
|
160
|
+
const hit = memo.get(memoKey);
|
|
161
|
+
if (hit)
|
|
162
|
+
return hit;
|
|
163
|
+
const path = cachePathFor(embedder.id, signature);
|
|
164
|
+
let vectors = readDiskCache(path, embedder.id, signature, types);
|
|
165
|
+
if (!vectors) {
|
|
166
|
+
const texts = types.map((t) => addressing.get(t));
|
|
167
|
+
const embedded = await embedder.embed(texts);
|
|
168
|
+
vectors = new Map();
|
|
169
|
+
types.forEach((t, i) => vectors.set(t, embedded[i]));
|
|
170
|
+
writeDiskCache(path, embedder.id, signature, vectors);
|
|
171
|
+
}
|
|
172
|
+
const index = makeIndex(embedder, types, vectors);
|
|
173
|
+
memo.set(memoKey, index);
|
|
174
|
+
return index;
|
|
175
|
+
}
|
|
176
|
+
/** Test seam: drop the in-memory index cache so a test can rebuild with a
|
|
177
|
+
* different embedder/corpus. Does not touch the disk cache. */
|
|
178
|
+
export function clearCapabilityIndexCache() {
|
|
179
|
+
memo.clear();
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=retrieval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval.js","sourceRoot":"","sources":["../src/retrieval.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,oBAAoB;AACpB,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,yEAAyE;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;AAahD,gFAAgF;AAChF,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAClF,CAAC;AAED;sDACsD;AACtD,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,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GAAG,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAClD,IAAI,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAEjE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;QACtC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;+DAC+D;AAC/D,MAAM,UAAU,yBAAyB;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verevoir/recipes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Recipe-descriptor format + zero-dependency parser: a flat-frontmatter .md describes a parameterised procedure (typed inputs → instructions → result) that a host compiles to a chat-time tool or an MCP prompt.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@anthropic-ai/sdk": "^0.95.2",
|
|
31
32
|
"@types/node": "^25.8.0",
|
|
32
33
|
"prettier": "^3",
|
|
33
34
|
"typescript": "^5",
|
|
@@ -42,5 +43,16 @@
|
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
|
44
45
|
"node": ">=20"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@verevoir/llm": "^0.9.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@anthropic-ai/sdk": "*"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"@anthropic-ai/sdk": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
45
57
|
}
|
|
46
58
|
}
|