@multileaf/ai-workflow 0.15.0 → 0.16.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/CHANGELOG.md +10 -0
- package/README.md +11 -0
- package/dist/adapter.js +3 -3
- package/dist/artifact-paths.d.ts +16 -0
- package/dist/artifact-paths.js +51 -0
- package/dist/completion-report.d.ts +17 -0
- package/dist/completion-report.js +42 -0
- package/dist/dashboard.js +7 -1
- package/dist/decision.d.ts +15 -0
- package/dist/decision.js +63 -0
- package/dist/eval/brief.d.ts +7 -0
- package/dist/eval/brief.js +28 -0
- package/dist/eval/generated.d.ts +17 -0
- package/dist/eval/generated.js +41 -0
- package/dist/eval/git.d.ts +13 -0
- package/dist/eval/git.js +70 -0
- package/dist/eval/monitor.d.ts +32 -0
- package/dist/eval/monitor.js +66 -0
- package/dist/eval/policy.d.ts +8 -0
- package/dist/eval/policy.js +9 -0
- package/dist/eval/proposals.d.ts +48 -0
- package/dist/eval/proposals.js +202 -0
- package/dist/eval/signals.d.ts +21 -0
- package/dist/eval/signals.js +155 -0
- package/dist/eval/types.d.ts +38 -0
- package/dist/eval/types.js +1 -0
- package/dist/eval/validate.d.ts +28 -0
- package/dist/eval/validate.js +66 -0
- package/dist/generator.d.ts +8 -1
- package/dist/generator.js +24 -1
- package/dist/risk-assess.d.ts +1 -1
- package/dist/risk-assess.js +26 -2
- package/dist/semantic.d.ts +19 -0
- package/dist/semantic.js +57 -0
- package/dist/services.d.ts +3 -0
- package/dist/telemetry.d.ts +6 -0
- package/dist/telemetry.js +14 -7
- package/dist/workflow.js +471 -67
- package/docs/backlog.md +12 -2
- package/docs/decision-model-evaluation.md +7 -2
- package/docs/opportunities/OPP-007-decision-findings-triage-scope-watch.md +1 -1
- package/docs/opportunities/OPP-008-embedding-covering-tests-judge-context.md +1 -1
- package/docs/semantic-mapping.md +9 -0
- package/package.json +1 -1
- package/resources/evals/scenarios/evaluator-draft-contract.yml +65 -0
- package/resources/package.yaml +1 -0
- package/resources/skills/resource-evaluator.md +24 -0
- package/resources/skills/review-judge-a.md +4 -0
- package/resources/skills/review-judge-b.md +4 -0
- package/resources/skills/review-refuter.md +4 -0
- package/resources/skills/ticket.md +1 -1
package/dist/semantic.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export declare function isExcludedIndexFile(file: string): boolean;
|
|
|
46
46
|
export declare function parseSemanticMapping(raw: unknown): SemanticConfig;
|
|
47
47
|
export declare function serializeSemanticConfig(config: SemanticConfig): string;
|
|
48
48
|
export declare function loadSemanticConfig(fs: FileSystem, aiwPath: string): SemanticConfig | undefined;
|
|
49
|
+
/** FRIC-001: semantic retrieval is usable when mapping is enabled and an index exists. */
|
|
50
|
+
export declare function semanticRetrievalAvailable(fs: FileSystem, aiwPath: string): boolean;
|
|
49
51
|
export declare function parseSemanticConfig(text: string): SemanticConfig;
|
|
50
52
|
type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
|
|
51
53
|
export declare function createOllamaEmbeddingProvider(config: SemanticConfig, fetchImpl?: FetchLike, env?: Readonly<Record<string, string | undefined>>): EmbeddingProvider;
|
|
@@ -56,4 +58,21 @@ export declare function serializeSemanticIndex(index: SemanticIndex): string;
|
|
|
56
58
|
export declare function parseSemanticIndex(text: string): SemanticIndex;
|
|
57
59
|
export declare function querySemanticIndex(index: SemanticIndex, query: string, provider: EmbeddingProvider, config: SemanticConfig): Promise<SemanticMatch[]>;
|
|
58
60
|
export declare function rerankSemanticMatches(matches: SemanticMatch[], query: string, reranker: DecisionReranker): Promise<RerankOutcome>;
|
|
61
|
+
/** OPP-008: path-semantics-only query for covering tests (no symbol parsing). */
|
|
62
|
+
export declare function buildCoveringTestQuery(path: string): string;
|
|
63
|
+
export type CoveringEvidence = {
|
|
64
|
+
covering: string[];
|
|
65
|
+
degraded: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* OPP-008 REQ-001: retrieval-aided covering-test detection. `undefined` keeps
|
|
69
|
+
* the deterministic sibling heuristic byte-identical (no config/index).
|
|
70
|
+
* Provider failures degrade to empty coverage (REQ-004: fail safe).
|
|
71
|
+
*/
|
|
72
|
+
export declare function semanticCoveringEvidence(fs: FileSystem, aiwPath: string, paths: string[], provider?: EmbeddingProvider): Promise<CoveringEvidence | undefined>;
|
|
73
|
+
/** OPP-008 REQ-003: diff first, retrieved chunks fill the remaining budget, labeled as aids. */
|
|
74
|
+
export declare function renderJudgeContext(diff: string, chunks: {
|
|
75
|
+
file: string;
|
|
76
|
+
excerpt: string;
|
|
77
|
+
}[], budget: number): string;
|
|
59
78
|
export {};
|
package/dist/semantic.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseDocument } from "yaml";
|
|
2
|
+
import { join } from "path";
|
|
2
3
|
import { loadSettings } from "./settings.js";
|
|
3
4
|
export const SEMANTIC_CONFIG_PATH = "semantic.yml";
|
|
4
5
|
export const SEMANTIC_INDEX_PATH = "semantic/index.json";
|
|
@@ -83,6 +84,11 @@ export function loadSemanticConfig(fs, aiwPath) {
|
|
|
83
84
|
return undefined;
|
|
84
85
|
return parseSemanticConfig(fs.read(configPath));
|
|
85
86
|
}
|
|
87
|
+
/** FRIC-001: semantic retrieval is usable when mapping is enabled and an index exists. */
|
|
88
|
+
export function semanticRetrievalAvailable(fs, aiwPath) {
|
|
89
|
+
const config = loadSemanticConfig(fs, aiwPath);
|
|
90
|
+
return config?.enabled === true && fs.exists(join(aiwPath, SEMANTIC_INDEX_PATH));
|
|
91
|
+
}
|
|
86
92
|
function parseSemanticDocument(text) {
|
|
87
93
|
const document = parseDocument(text);
|
|
88
94
|
const node = document.get("semantic");
|
|
@@ -273,3 +279,54 @@ export async function rerankSemanticMatches(matches, query, reranker) {
|
|
|
273
279
|
changedPositions += 1;
|
|
274
280
|
return { matches: reranked, changedPositions };
|
|
275
281
|
}
|
|
282
|
+
/** OPP-008: path-semantics-only query for covering tests (no symbol parsing). */
|
|
283
|
+
export function buildCoveringTestQuery(path) {
|
|
284
|
+
const generic = new Set(["src", "lib", "app", "index", "main", "test", "tests", "spec"]);
|
|
285
|
+
const terms = path
|
|
286
|
+
.split(/[/.-]/)
|
|
287
|
+
.filter((segment) => segment && !generic.has(segment.toLowerCase()));
|
|
288
|
+
return `tests exercising ${terms.join(" ") || path}`;
|
|
289
|
+
}
|
|
290
|
+
const TEST_FILE_PATTERN = /(\.test\.|\.spec\.|(^|\/)tests?\/)/;
|
|
291
|
+
/**
|
|
292
|
+
* OPP-008 REQ-001: retrieval-aided covering-test detection. `undefined` keeps
|
|
293
|
+
* the deterministic sibling heuristic byte-identical (no config/index).
|
|
294
|
+
* Provider failures degrade to empty coverage (REQ-004: fail safe).
|
|
295
|
+
*/
|
|
296
|
+
export async function semanticCoveringEvidence(fs, aiwPath, paths, provider) {
|
|
297
|
+
const config = loadSemanticConfig(fs, aiwPath);
|
|
298
|
+
if (!config?.enabled)
|
|
299
|
+
return undefined;
|
|
300
|
+
const indexPath = join(aiwPath, SEMANTIC_INDEX_PATH);
|
|
301
|
+
if (!fs.exists(indexPath))
|
|
302
|
+
return undefined;
|
|
303
|
+
try {
|
|
304
|
+
const index = parseSemanticIndex(fs.read(indexPath));
|
|
305
|
+
const embed = provider ?? createOllamaEmbeddingProvider(config);
|
|
306
|
+
if (!(await embed.available()))
|
|
307
|
+
return { covering: [], degraded: true };
|
|
308
|
+
const covering = [];
|
|
309
|
+
for (const path of paths) {
|
|
310
|
+
const matches = await querySemanticIndex(index, buildCoveringTestQuery(path), embed, config);
|
|
311
|
+
if (matches.some((match) => TEST_FILE_PATTERN.test(match.file)))
|
|
312
|
+
covering.push(path);
|
|
313
|
+
}
|
|
314
|
+
return { covering, degraded: false };
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return { covering: [], degraded: true };
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/** OPP-008 REQ-003: diff first, retrieved chunks fill the remaining budget, labeled as aids. */
|
|
321
|
+
export function renderJudgeContext(diff, chunks, budget) {
|
|
322
|
+
const lines = [diff];
|
|
323
|
+
let used = diff.length;
|
|
324
|
+
for (const chunk of chunks) {
|
|
325
|
+
const block = `\n- ${chunk.file} (context aid (retrieval — not a confirmed fact)): ${chunk.excerpt}`;
|
|
326
|
+
if (used + block.length > budget)
|
|
327
|
+
break;
|
|
328
|
+
lines.push(block);
|
|
329
|
+
used += block.length;
|
|
330
|
+
}
|
|
331
|
+
return lines.join("");
|
|
332
|
+
}
|
package/dist/services.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProjectProfile } from "./profile.js";
|
|
2
|
+
import type { ShellRunner } from "./eval/scenarios.js";
|
|
2
3
|
import type { EmbeddingProvider } from "./semantic.js";
|
|
3
4
|
import type { ProjectScan } from "./scanner.js";
|
|
4
5
|
import type { CapabilityRecommendation } from "./recommendations.js";
|
|
@@ -40,6 +41,8 @@ export interface WorkflowDependencies {
|
|
|
40
41
|
embeddingProvider?: EmbeddingProvider;
|
|
41
42
|
aiProvider?: AiProvider;
|
|
42
43
|
decisionProvider?: DecisionProvider;
|
|
44
|
+
/** Overrides shell execution for git signal collection in `aiw evaluate`. */
|
|
45
|
+
runShell?: ShellRunner;
|
|
43
46
|
}
|
|
44
47
|
export interface WorkflowService {
|
|
45
48
|
execute(args: string[], root: string, fs: FileSystem): Promise<CommandResult>;
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ export interface TelemetryClient {
|
|
|
16
16
|
export declare const DEFAULT_TELEMETRY_CONFIG: TelemetryConfig;
|
|
17
17
|
export declare const TELEMETRY_CONSENT_PROMPT = "Enable anonymous telemetry? Each event contains only the command name and its outcome (success or failure) - never arguments, file paths, or file contents. [y/N] ";
|
|
18
18
|
export declare function offerTelemetryConsent(fs: FileSystem, aiwPath: string, answer: (question: string) => Promise<string>): Promise<boolean>;
|
|
19
|
+
export declare function isTelemetryConfigured(fs: FileSystem, aiwPath: string): boolean;
|
|
20
|
+
/** FRIC-004: prompt once (interactive only) when telemetry consent is unset. */
|
|
21
|
+
export declare function maybeOfferTelemetryConsent(fs: FileSystem, aiwPath: string, isTty: boolean, answer: (question: string) => Promise<string>): Promise<{
|
|
22
|
+
prompted: boolean;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
}>;
|
|
19
25
|
export declare function parseTelemetryMapping(raw: unknown): TelemetryConfig;
|
|
20
26
|
export declare function serializeTelemetryMapping(config: TelemetryConfig): unknown;
|
|
21
27
|
export declare function loadTelemetryConfig(fs: FileSystem, aiwPath: string): TelemetryConfig;
|
package/dist/telemetry.js
CHANGED
|
@@ -20,6 +20,18 @@ export async function offerTelemetryConsent(fs, aiwPath, answer) {
|
|
|
20
20
|
}));
|
|
21
21
|
return enabled;
|
|
22
22
|
}
|
|
23
|
+
export function isTelemetryConfigured(fs, aiwPath) {
|
|
24
|
+
const settings = loadSettings(fs, aiwPath);
|
|
25
|
+
return ((settings !== undefined && "telemetry" in settings) || fs.exists(`${aiwPath}/telemetry.yml`));
|
|
26
|
+
}
|
|
27
|
+
/** FRIC-004: prompt once (interactive only) when telemetry consent is unset. */
|
|
28
|
+
export async function maybeOfferTelemetryConsent(fs, aiwPath, isTty, answer) {
|
|
29
|
+
if (isTelemetryConfigured(fs, aiwPath))
|
|
30
|
+
return { prompted: false, enabled: loadTelemetryConfig(fs, aiwPath).enabled };
|
|
31
|
+
if (!isTty)
|
|
32
|
+
return { prompted: false, enabled: false };
|
|
33
|
+
return { prompted: true, enabled: await offerTelemetryConsent(fs, aiwPath, answer) };
|
|
34
|
+
}
|
|
23
35
|
const TELEMETRY_COMMANDS = new Set([
|
|
24
36
|
"adr",
|
|
25
37
|
"audit-package",
|
|
@@ -159,10 +171,7 @@ export async function recordConfiguredTelemetry(fs, aiwPath, client, command, re
|
|
|
159
171
|
if (!client) {
|
|
160
172
|
try {
|
|
161
173
|
const config = loadTelemetryConfig(fs, aiwPath);
|
|
162
|
-
|
|
163
|
-
const configured = (settings !== undefined && "telemetry" in settings) ||
|
|
164
|
-
fs.exists(`${aiwPath}/telemetry.yml`);
|
|
165
|
-
if (configured) {
|
|
174
|
+
if (isTelemetryConfigured(fs, aiwPath)) {
|
|
166
175
|
const event = createTelemetryEvent(command, result, config);
|
|
167
176
|
if (event)
|
|
168
177
|
appendTelemetryBuffer(fs, aiwPath, event);
|
|
@@ -175,9 +184,7 @@ export async function recordConfiguredTelemetry(fs, aiwPath, client, command, re
|
|
|
175
184
|
}
|
|
176
185
|
try {
|
|
177
186
|
const config = loadTelemetryConfig(fs, aiwPath);
|
|
178
|
-
|
|
179
|
-
const configured = (settings !== undefined && "telemetry" in settings) || fs.exists(`${aiwPath}/telemetry.yml`);
|
|
180
|
-
if (!configured)
|
|
187
|
+
if (!isTelemetryConfigured(fs, aiwPath))
|
|
181
188
|
return;
|
|
182
189
|
const event = createTelemetryEvent(command, result, config);
|
|
183
190
|
if (event)
|