@keel_flow/reflect 0.2.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/LICENSE +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/list.d.ts +10 -0
- package/dist/list.d.ts.map +1 -0
- package/dist/list.js +34 -0
- package/dist/list.js.map +1 -0
- package/dist/parse-suggestions.d.ts +18 -0
- package/dist/parse-suggestions.d.ts.map +1 -0
- package/dist/parse-suggestions.js +90 -0
- package/dist/parse-suggestions.js.map +1 -0
- package/dist/read-diff.d.ts +16 -0
- package/dist/read-diff.d.ts.map +1 -0
- package/dist/read-diff.js +67 -0
- package/dist/read-diff.js.map +1 -0
- package/dist/read-session.d.ts +19 -0
- package/dist/read-session.d.ts.map +1 -0
- package/dist/read-session.js +82 -0
- package/dist/read-session.js.map +1 -0
- package/dist/reflect.d.ts +22 -0
- package/dist/reflect.d.ts.map +1 -0
- package/dist/reflect.js +228 -0
- package/dist/reflect.js.map +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jglasskatz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { readSessionTrace, mostRecentSessionId, listSessionIds, sessionFilePath, sessionsRoot, } from "./read-session.js";
|
|
2
|
+
export type { SessionTrace } from "./read-session.js";
|
|
3
|
+
export { readDiff, parseUnifiedDiff, findShaAtOrBeforeTimestamp } from "./read-diff.js";
|
|
4
|
+
export type { DiffResult, DiffFile } from "./read-diff.js";
|
|
5
|
+
export { generateReflection, getReflectionPaths } from "./reflect.js";
|
|
6
|
+
export type { ReflectInput, ReflectResult, ReflectionPaths, } from "./reflect.js";
|
|
7
|
+
export { listReflections } from "./list.js";
|
|
8
|
+
export type { ReflectionSummary } from "./list.js";
|
|
9
|
+
export { parseSuggestionsFromMarkdown, parseProposalsFromMarkdown, proposalFromSuggestion, } from "./parse-suggestions.js";
|
|
10
|
+
export type { ParsedSuggestion } from "./parse-suggestions.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AACxF,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { readSessionTrace, mostRecentSessionId, listSessionIds, sessionFilePath, sessionsRoot, } from "./read-session.js";
|
|
2
|
+
export { readDiff, parseUnifiedDiff, findShaAtOrBeforeTimestamp } from "./read-diff.js";
|
|
3
|
+
export { generateReflection, getReflectionPaths } from "./reflect.js";
|
|
4
|
+
export { listReflections } from "./list.js";
|
|
5
|
+
export { parseSuggestionsFromMarkdown, parseProposalsFromMarkdown, proposalFromSuggestion, } from "./parse-suggestions.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAGxF,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOtE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
package/dist/list.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ReflectionSummary {
|
|
2
|
+
path: string;
|
|
3
|
+
fileName: string;
|
|
4
|
+
date: string;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
suggestionCount: number;
|
|
7
|
+
mtimeMs: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function listReflections(cwd: string): Promise<ReflectionSummary[]>;
|
|
10
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAuB/E"}
|
package/dist/list.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { parseProposalsFromMarkdown } from "./parse-suggestions.js";
|
|
5
|
+
function reflectionsRoot(cwd) {
|
|
6
|
+
return join(resolve(cwd), ".keel", "reflections");
|
|
7
|
+
}
|
|
8
|
+
export async function listReflections(cwd) {
|
|
9
|
+
const root = reflectionsRoot(cwd);
|
|
10
|
+
if (!existsSync(root))
|
|
11
|
+
return [];
|
|
12
|
+
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
13
|
+
const out = [];
|
|
14
|
+
for (const entry of entries) {
|
|
15
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
16
|
+
continue;
|
|
17
|
+
const full = join(root, entry.name);
|
|
18
|
+
const stat = await fs.stat(full);
|
|
19
|
+
const content = await fs.readFile(full, "utf-8");
|
|
20
|
+
const proposals = parseProposalsFromMarkdown(content);
|
|
21
|
+
const match = /^(\d{4}-\d{2}-\d{2})-(.+)\.md$/.exec(entry.name);
|
|
22
|
+
out.push({
|
|
23
|
+
path: full,
|
|
24
|
+
fileName: entry.name,
|
|
25
|
+
date: match ? match[1] ?? "" : "",
|
|
26
|
+
sessionId: match ? match[2] ?? "" : "",
|
|
27
|
+
suggestionCount: proposals.length,
|
|
28
|
+
mtimeMs: stat.mtimeMs,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
out.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=list.js.map
|
package/dist/list.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAWpE,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAC/C,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,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C,OAAO,CAAC,CAAC;IAC1C,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LearningProposal, LearningSeverity, LearningTarget } from "@keel_flow/schema";
|
|
2
|
+
export interface ParsedSuggestion {
|
|
3
|
+
title: string;
|
|
4
|
+
target: LearningTarget;
|
|
5
|
+
severity: LearningSeverity;
|
|
6
|
+
rationale: string;
|
|
7
|
+
change: string;
|
|
8
|
+
raw: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseSuggestionsFromMarkdown(markdown: string): ParsedSuggestion[];
|
|
11
|
+
export declare function proposalFromSuggestion(suggestion: ParsedSuggestion, opts: {
|
|
12
|
+
sessionIds: string[];
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
}): LearningProposal;
|
|
15
|
+
export declare function parseProposalsFromMarkdown(markdown: string, opts?: {
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
}): LearningProposal[];
|
|
18
|
+
//# sourceMappingURL=parse-suggestions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-suggestions.d.ts","sourceRoot":"","sources":["../src/parse-suggestions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgB5F,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAKD,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE,CA0DjF;AAMD,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD,gBAAgB,CAalB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAChC,gBAAgB,EAAE,CAKpB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const TARGETS = new Set([
|
|
3
|
+
"skill-global",
|
|
4
|
+
"skill-local",
|
|
5
|
+
"principle-pack",
|
|
6
|
+
"architecture",
|
|
7
|
+
"memory",
|
|
8
|
+
]);
|
|
9
|
+
const SEVERITIES = new Set([
|
|
10
|
+
"low",
|
|
11
|
+
"medium",
|
|
12
|
+
"high",
|
|
13
|
+
]);
|
|
14
|
+
const SUGGESTION_RE = /^### Suggestion:\s*(.+)$/;
|
|
15
|
+
const FIELD_RE = /^\s*-\s*(target|severity|rationale|change)\s*:\s*(.+)$/;
|
|
16
|
+
export function parseSuggestionsFromMarkdown(markdown) {
|
|
17
|
+
const lines = markdown.split("\n");
|
|
18
|
+
const out = [];
|
|
19
|
+
let current = null;
|
|
20
|
+
function flush() {
|
|
21
|
+
if (!current)
|
|
22
|
+
return;
|
|
23
|
+
const target = current.fields.get("target") ?? "";
|
|
24
|
+
const severity = current.fields.get("severity") ?? "";
|
|
25
|
+
if (!TARGETS.has(target)) {
|
|
26
|
+
current = null;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!SEVERITIES.has(severity)) {
|
|
30
|
+
current = null;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
out.push({
|
|
34
|
+
title: current.title,
|
|
35
|
+
target: target,
|
|
36
|
+
severity: severity,
|
|
37
|
+
rationale: current.fields.get("rationale") ?? "",
|
|
38
|
+
change: current.fields.get("change") ?? "",
|
|
39
|
+
raw: current.rawLines.join("\n"),
|
|
40
|
+
});
|
|
41
|
+
current = null;
|
|
42
|
+
}
|
|
43
|
+
for (const line of lines) {
|
|
44
|
+
const suggestionMatch = SUGGESTION_RE.exec(line);
|
|
45
|
+
if (suggestionMatch) {
|
|
46
|
+
flush();
|
|
47
|
+
current = {
|
|
48
|
+
title: (suggestionMatch[1] ?? "").trim(),
|
|
49
|
+
rawLines: [line],
|
|
50
|
+
fields: new Map(),
|
|
51
|
+
};
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (!current)
|
|
55
|
+
continue;
|
|
56
|
+
current.rawLines.push(line);
|
|
57
|
+
if (line.startsWith("### ") || line.startsWith("## ")) {
|
|
58
|
+
flush();
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const fieldMatch = FIELD_RE.exec(line);
|
|
62
|
+
if (fieldMatch && fieldMatch[1]) {
|
|
63
|
+
current.fields.set(fieldMatch[1], (fieldMatch[2] ?? "").trim());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
flush();
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
function sha256Short(value) {
|
|
70
|
+
return createHash("sha256").update(value, "utf-8").digest("hex").slice(0, 16);
|
|
71
|
+
}
|
|
72
|
+
export function proposalFromSuggestion(suggestion, opts) {
|
|
73
|
+
const idSource = `${suggestion.title}|${suggestion.target}|${suggestion.change}`;
|
|
74
|
+
const id = sha256Short(idSource);
|
|
75
|
+
return {
|
|
76
|
+
id,
|
|
77
|
+
source: opts.sessionIds,
|
|
78
|
+
severity: suggestion.severity,
|
|
79
|
+
target: suggestion.target,
|
|
80
|
+
rationale: suggestion.rationale,
|
|
81
|
+
proposedDiff: "",
|
|
82
|
+
status: "pending",
|
|
83
|
+
createdAt: opts.createdAt ?? new Date().toISOString(),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function parseProposalsFromMarkdown(markdown, opts = {}) {
|
|
87
|
+
const sessions = opts.sessionId ? [opts.sessionId] : [];
|
|
88
|
+
return parseSuggestionsFromMarkdown(markdown).map((s) => proposalFromSuggestion(s, { sessionIds: sessions }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=parse-suggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-suggestions.js","sourceRoot":"","sources":["../src/parse-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,OAAO,GAAgC,IAAI,GAAG,CAAC;IACnD,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,QAAQ;CACT,CAAC,CAAC;AAEH,MAAM,UAAU,GAAkC,IAAI,GAAG,CAAC;IACxD,KAAK;IACL,QAAQ;IACR,MAAM;CACP,CAAC,CAAC;AAWH,MAAM,aAAa,GAAG,0BAA0B,CAAC;AACjD,MAAM,QAAQ,GAAG,wDAAwD,CAAC;AAE1E,MAAM,UAAU,4BAA4B,CAAC,QAAgB;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,GAAG,GAAuB,EAAE,CAAC;IAEnC,IAAI,OAAO,GAIA,IAAI,CAAC;IAEhB,SAAS,KAAK;QACZ,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACtD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAwB,CAAC,EAAE,CAAC;YAC3C,OAAO,GAAG,IAAI,CAAC;YACf,OAAO;QACT,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAA4B,CAAC,EAAE,CAAC;YAClD,OAAO,GAAG,IAAI,CAAC;YACf,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC;YACP,KAAK,EAAE,OA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+
export interface DiffFile {
|
|
2
|
+
path: string;
|
|
3
|
+
hunks: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface DiffResult {
|
|
6
|
+
baseRef: string | null;
|
|
7
|
+
rawDiff: string;
|
|
8
|
+
files: DiffFile[];
|
|
9
|
+
}
|
|
10
|
+
export declare function findShaAtOrBeforeTimestamp(ts: string, cwd: string): string | null;
|
|
11
|
+
export declare function parseUnifiedDiff(raw: string): DiffFile[];
|
|
12
|
+
export declare function readDiff(opts: {
|
|
13
|
+
baseRef?: string | null;
|
|
14
|
+
cwd: string;
|
|
15
|
+
}): Promise<DiffResult>;
|
|
16
|
+
//# sourceMappingURL=read-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-diff.d.ts","sourceRoot":"","sources":["../src/read-diff.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAQD,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAQf;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAoCxD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAAC,UAAU,CAAC,CAgBtB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
function runGit(args, cwd) {
|
|
3
|
+
const res = spawnSync("git", args, { cwd, encoding: "utf-8" });
|
|
4
|
+
if (res.status !== 0)
|
|
5
|
+
return { stdout: "", ok: false };
|
|
6
|
+
return { stdout: res.stdout ?? "", ok: true };
|
|
7
|
+
}
|
|
8
|
+
export function findShaAtOrBeforeTimestamp(ts, cwd) {
|
|
9
|
+
if (!ts)
|
|
10
|
+
return null;
|
|
11
|
+
const before = runGit(["log", "-1", `--before=${ts}`, "--format=%H"], cwd);
|
|
12
|
+
if (before.ok) {
|
|
13
|
+
const sha = before.stdout.trim();
|
|
14
|
+
if (sha.length > 0)
|
|
15
|
+
return sha;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
export function parseUnifiedDiff(raw) {
|
|
20
|
+
if (raw.length === 0)
|
|
21
|
+
return [];
|
|
22
|
+
const files = [];
|
|
23
|
+
const lines = raw.split("\n");
|
|
24
|
+
let currentFile = null;
|
|
25
|
+
let currentHunk = null;
|
|
26
|
+
function flushHunk() {
|
|
27
|
+
if (currentFile && currentHunk && currentHunk.length > 0) {
|
|
28
|
+
currentFile.hunks.push(currentHunk.join("\n"));
|
|
29
|
+
}
|
|
30
|
+
currentHunk = null;
|
|
31
|
+
}
|
|
32
|
+
for (const line of lines) {
|
|
33
|
+
if (line.startsWith("diff --git ")) {
|
|
34
|
+
flushHunk();
|
|
35
|
+
const match = /^diff --git a\/(.+?) b\/(.+)$/.exec(line);
|
|
36
|
+
const path = match ? match[2] ?? match[1] ?? "" : "";
|
|
37
|
+
currentFile = { path, hunks: [] };
|
|
38
|
+
files.push(currentFile);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (line.startsWith("@@")) {
|
|
42
|
+
flushHunk();
|
|
43
|
+
currentHunk = [line];
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (currentHunk !== null) {
|
|
47
|
+
currentHunk.push(line);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
flushHunk();
|
|
51
|
+
return files;
|
|
52
|
+
}
|
|
53
|
+
export async function readDiff(opts) {
|
|
54
|
+
const cwd = opts.cwd;
|
|
55
|
+
let baseRef = opts.baseRef ?? null;
|
|
56
|
+
if (!baseRef) {
|
|
57
|
+
const head = runGit(["rev-parse", "HEAD"], cwd);
|
|
58
|
+
baseRef = head.ok ? head.stdout.trim() : null;
|
|
59
|
+
}
|
|
60
|
+
if (!baseRef) {
|
|
61
|
+
return { baseRef: null, rawDiff: "", files: [] };
|
|
62
|
+
}
|
|
63
|
+
const diff = runGit(["diff", `${baseRef}..HEAD`], cwd);
|
|
64
|
+
const raw = diff.ok ? diff.stdout : "";
|
|
65
|
+
return { baseRef, rawDiff: raw, files: parseUnifiedDiff(raw) };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=read-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-diff.js","sourceRoot":"","sources":["../src/read-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAa/C,SAAS,MAAM,CAAC,IAAc,EAAE,GAAW;IACzC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/D,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvD,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,EAAU,EACV,GAAW;IAEX,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3E,IAAI,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Event } from "@keel_flow/schema";
|
|
2
|
+
export interface SessionTrace {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
startTs: string | null;
|
|
5
|
+
endTs: string | null;
|
|
6
|
+
events: AgentEvent[];
|
|
7
|
+
decompositions: AgentEvent[];
|
|
8
|
+
toolCalls: AgentEvent[];
|
|
9
|
+
verifyOutcomes: AgentEvent[];
|
|
10
|
+
subAgentDispatches: AgentEvent[];
|
|
11
|
+
buildEvents: AgentEvent[];
|
|
12
|
+
byParent: Map<string | null, AgentEvent[]>;
|
|
13
|
+
}
|
|
14
|
+
export declare function sessionsRoot(cwd: string): string;
|
|
15
|
+
export declare function sessionFilePath(sessionId: string, cwd: string): string;
|
|
16
|
+
export declare function listSessionIds(cwd: string): Promise<string[]>;
|
|
17
|
+
export declare function mostRecentSessionId(cwd: string): Promise<string | null>;
|
|
18
|
+
export declare function readSessionTrace(sessionId: string, cwd: string): Promise<SessionTrace>;
|
|
19
|
+
//# sourceMappingURL=read-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-session.d.ts","sourceRoot":"","sources":["../src/read-session.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,cAAc,EAAE,UAAU,EAAE,CAAC;IAC7B,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,cAAc,EAAE,UAAU,EAAE,CAAC;IAC7B,kBAAkB,EAAE,UAAU,EAAE,CAAC;IACjC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,QAAQ,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;CAC5C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOnE;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgB7E;AAUD,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,YAAY,CAAC,CA6CvB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
export function sessionsRoot(cwd) {
|
|
5
|
+
return join(resolve(cwd), ".keel", "sessions");
|
|
6
|
+
}
|
|
7
|
+
export function sessionFilePath(sessionId, cwd) {
|
|
8
|
+
return join(sessionsRoot(cwd), `${sessionId}.jsonl`);
|
|
9
|
+
}
|
|
10
|
+
export async function listSessionIds(cwd) {
|
|
11
|
+
const root = sessionsRoot(cwd);
|
|
12
|
+
if (!existsSync(root))
|
|
13
|
+
return [];
|
|
14
|
+
const entries = await fs.readdir(root);
|
|
15
|
+
return entries
|
|
16
|
+
.filter((e) => e.endsWith(".jsonl"))
|
|
17
|
+
.map((e) => e.slice(0, -".jsonl".length));
|
|
18
|
+
}
|
|
19
|
+
export async function mostRecentSessionId(cwd) {
|
|
20
|
+
const root = sessionsRoot(cwd);
|
|
21
|
+
if (!existsSync(root))
|
|
22
|
+
return null;
|
|
23
|
+
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
24
|
+
const stats = await Promise.all(entries
|
|
25
|
+
.filter((e) => e.isFile() && e.name.endsWith(".jsonl"))
|
|
26
|
+
.map(async (e) => {
|
|
27
|
+
const full = join(root, e.name);
|
|
28
|
+
const stat = await fs.stat(full);
|
|
29
|
+
return { name: e.name, mtime: stat.mtimeMs };
|
|
30
|
+
}));
|
|
31
|
+
if (stats.length === 0)
|
|
32
|
+
return null;
|
|
33
|
+
stats.sort((a, b) => b.mtime - a.mtime);
|
|
34
|
+
return stats[0].name.slice(0, -".jsonl".length);
|
|
35
|
+
}
|
|
36
|
+
function safeParse(line) {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(line);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export async function readSessionTrace(sessionId, cwd) {
|
|
45
|
+
const path = sessionFilePath(sessionId, cwd);
|
|
46
|
+
if (!existsSync(path)) {
|
|
47
|
+
throw new Error(`No session file at ${path}`);
|
|
48
|
+
}
|
|
49
|
+
const raw = await fs.readFile(path, "utf-8");
|
|
50
|
+
const events = [];
|
|
51
|
+
for (const line of raw.split("\n")) {
|
|
52
|
+
if (line.trim().length === 0)
|
|
53
|
+
continue;
|
|
54
|
+
const ev = safeParse(line);
|
|
55
|
+
if (ev)
|
|
56
|
+
events.push(ev);
|
|
57
|
+
}
|
|
58
|
+
const byParent = new Map();
|
|
59
|
+
for (const ev of events) {
|
|
60
|
+
const key = ev.parentEventId ?? null;
|
|
61
|
+
const bucket = byParent.get(key) ?? [];
|
|
62
|
+
bucket.push(ev);
|
|
63
|
+
byParent.set(key, bucket);
|
|
64
|
+
}
|
|
65
|
+
const startEvent = events.find((e) => e.kind === "session.start") ?? null;
|
|
66
|
+
const endEvent = [...events].reverse().find((e) => e.kind === "session.end") ?? null;
|
|
67
|
+
return {
|
|
68
|
+
sessionId,
|
|
69
|
+
startTs: startEvent?.ts ?? null,
|
|
70
|
+
endTs: endEvent?.ts ?? null,
|
|
71
|
+
events,
|
|
72
|
+
decompositions: events.filter((e) => e.kind === "orchestrator.decompose"),
|
|
73
|
+
toolCalls: events.filter((e) => e.kind === "tool.call" || e.kind === "tool.result" || e.kind === "tool.error"),
|
|
74
|
+
verifyOutcomes: events.filter((e) => e.kind === "verify.run" || e.kind === "verify.check"),
|
|
75
|
+
subAgentDispatches: events.filter((e) => e.kind === "sub-agent.start" ||
|
|
76
|
+
e.kind === "sub-agent.complete" ||
|
|
77
|
+
e.kind === "sub-agent.fail"),
|
|
78
|
+
buildEvents: events.filter((e) => e.kind.startsWith("build.")),
|
|
79
|
+
byParent,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=read-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-session.js","sourceRoot":"","sources":["../src/read-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgB1C,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,GAAW;IAC5D,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,QAAQ,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QA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KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ModelProvider } from "@keel_flow/runtime";
|
|
2
|
+
import type { TelemetryEmitter } from "@keel_flow/telemetry";
|
|
3
|
+
export interface ReflectionPaths {
|
|
4
|
+
dir: string;
|
|
5
|
+
file: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ReflectInput {
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
cwd: string;
|
|
10
|
+
provider: ModelProvider;
|
|
11
|
+
model?: string;
|
|
12
|
+
telemetry?: TelemetryEmitter;
|
|
13
|
+
groundInPriorReflections?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ReflectResult {
|
|
16
|
+
reflectionPath: string;
|
|
17
|
+
markdown: string;
|
|
18
|
+
sessionId: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function getReflectionPaths(sessionId: string, cwd: string, date: string): ReflectionPaths;
|
|
21
|
+
export declare function generateReflection(input: ReflectInput): Promise<ReflectResult>;
|
|
22
|
+
//# sourceMappingURL=reflect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.d.ts","sourceRoot":"","sources":["../src/reflect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAyC7D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,eAAe,CAGjB;AAoID,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAyEpF"}
|
package/dist/reflect.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { readSessionTrace, mostRecentSessionId, } from "./read-session.js";
|
|
5
|
+
import { findShaAtOrBeforeTimestamp, readDiff } from "./read-diff.js";
|
|
6
|
+
import { listReflections } from "./list.js";
|
|
7
|
+
import { parseSuggestionsFromMarkdown } from "./parse-suggestions.js";
|
|
8
|
+
const REFLECT_SYSTEM_PROMPT = `You are the reflection assistant for Keel.
|
|
9
|
+
|
|
10
|
+
You read a session trace (decompositions, tool calls, verify outcomes, sub-agent dispatches), the diff that shipped, and any build artifacts touched. You produce an end-of-session retrospective.
|
|
11
|
+
|
|
12
|
+
Output a single markdown document with these sections, in this order:
|
|
13
|
+
|
|
14
|
+
# Reflection: <sessionId>
|
|
15
|
+
|
|
16
|
+
## What worked
|
|
17
|
+
- bullets
|
|
18
|
+
|
|
19
|
+
## Friction
|
|
20
|
+
- bullets describing where the orchestrator lost time, retried unnecessarily, or hit dead ends
|
|
21
|
+
|
|
22
|
+
## Verify-gate calibration
|
|
23
|
+
- did verify catch the right things? false positives? false negatives?
|
|
24
|
+
|
|
25
|
+
## Suggested updates
|
|
26
|
+
For each suggestion, emit one block in EXACTLY this shape (no extra markers, no code fences):
|
|
27
|
+
|
|
28
|
+
### Suggestion: <one-line summary>
|
|
29
|
+
- target: <skill-global | skill-local | principle-pack | architecture | memory>
|
|
30
|
+
- severity: <low | medium | high>
|
|
31
|
+
- rationale: <why this matters>
|
|
32
|
+
- change: <what to add/remove/edit, specific enough to draft a diff>
|
|
33
|
+
|
|
34
|
+
Hard constraints:
|
|
35
|
+
- Be specific. Quote tool names, file paths, command outputs from the trace.
|
|
36
|
+
- Do not invent events that aren't in the trace.
|
|
37
|
+
- No preamble, no closing remarks — just the document.`;
|
|
38
|
+
function reflectionsRoot(cwd) {
|
|
39
|
+
return join(resolve(cwd), ".keel", "reflections");
|
|
40
|
+
}
|
|
41
|
+
export function getReflectionPaths(sessionId, cwd, date) {
|
|
42
|
+
const dir = reflectionsRoot(cwd);
|
|
43
|
+
return { dir, file: join(dir, `${date}-${sessionId}.md`) };
|
|
44
|
+
}
|
|
45
|
+
async function atomicWrite(path, content) {
|
|
46
|
+
await fs.mkdir(dirname(path), { recursive: true });
|
|
47
|
+
const tmpFile = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
48
|
+
await fs.writeFile(tmpFile, content, "utf-8");
|
|
49
|
+
await fs.rename(tmpFile, path);
|
|
50
|
+
}
|
|
51
|
+
function summarizeTrace(trace) {
|
|
52
|
+
const lines = [];
|
|
53
|
+
lines.push(`Session ${trace.sessionId}`);
|
|
54
|
+
lines.push(`Start: ${trace.startTs ?? "(unknown)"}`);
|
|
55
|
+
lines.push(`End: ${trace.endTs ?? "(unknown)"}`);
|
|
56
|
+
lines.push(`Total events: ${trace.events.length}`);
|
|
57
|
+
lines.push(`Decompositions: ${trace.decompositions.length}`);
|
|
58
|
+
lines.push(`Tool calls (incl. result/error): ${trace.toolCalls.length}`);
|
|
59
|
+
lines.push(`Verify outcomes: ${trace.verifyOutcomes.length}`);
|
|
60
|
+
lines.push(`Sub-agent dispatches: ${trace.subAgentDispatches.length}`);
|
|
61
|
+
lines.push(`Build events: ${trace.buildEvents.length}`);
|
|
62
|
+
if (trace.toolCalls.length > 0) {
|
|
63
|
+
lines.push("");
|
|
64
|
+
lines.push("Tool-call timeline (first 50):");
|
|
65
|
+
for (const ev of trace.toolCalls.slice(0, 50)) {
|
|
66
|
+
const name = ev.payload["name"] ??
|
|
67
|
+
ev.payload["tool"] ??
|
|
68
|
+
"?";
|
|
69
|
+
lines.push(`- ${ev.ts} ${ev.kind} ${String(name)}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (trace.verifyOutcomes.length > 0) {
|
|
73
|
+
lines.push("");
|
|
74
|
+
lines.push("Verify outcomes:");
|
|
75
|
+
for (const ev of trace.verifyOutcomes) {
|
|
76
|
+
lines.push(`- ${ev.ts} ${ev.kind} ${JSON.stringify(ev.payload).slice(0, 240)}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (trace.buildEvents.length > 0) {
|
|
80
|
+
lines.push("");
|
|
81
|
+
lines.push("Build events:");
|
|
82
|
+
for (const ev of trace.buildEvents) {
|
|
83
|
+
lines.push(`- ${ev.ts} ${ev.kind} ${JSON.stringify(ev.payload).slice(0, 240)}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return lines.join("\n");
|
|
87
|
+
}
|
|
88
|
+
function summarizeDiff(diff) {
|
|
89
|
+
if (diff.files.length === 0) {
|
|
90
|
+
return `No file changes detected (baseRef=${diff.baseRef ?? "?"}).`;
|
|
91
|
+
}
|
|
92
|
+
const lines = [`Base ref: ${diff.baseRef ?? "?"}`];
|
|
93
|
+
lines.push(`Files changed: ${diff.files.length}`);
|
|
94
|
+
for (const f of diff.files.slice(0, 50)) {
|
|
95
|
+
lines.push(`- ${f.path} (${f.hunks.length} hunks)`);
|
|
96
|
+
}
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
async function collectTouchedBuildArtifacts(trace, cwd) {
|
|
100
|
+
const slugs = new Set();
|
|
101
|
+
for (const ev of trace.buildEvents) {
|
|
102
|
+
const slug = ev.payload["slug"];
|
|
103
|
+
if (typeof slug === "string" && slug.length > 0)
|
|
104
|
+
slugs.add(slug);
|
|
105
|
+
}
|
|
106
|
+
if (slugs.size === 0)
|
|
107
|
+
return "(no build artifacts touched in this session)";
|
|
108
|
+
const blocks = [];
|
|
109
|
+
for (const slug of slugs) {
|
|
110
|
+
const dir = join(resolve(cwd), ".keel", "builds", slug);
|
|
111
|
+
if (!existsSync(dir))
|
|
112
|
+
continue;
|
|
113
|
+
blocks.push(`Build: ${slug}`);
|
|
114
|
+
for (const name of ["summary.md", "spec.md", "result.md"]) {
|
|
115
|
+
const path = join(dir, name);
|
|
116
|
+
if (existsSync(path)) {
|
|
117
|
+
const content = await fs.readFile(path, "utf-8");
|
|
118
|
+
blocks.push(`### ${slug}/${name}\n\n${content.slice(0, 4000)}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return blocks.length === 0 ? "(no build artifacts found on disk)" : blocks.join("\n\n");
|
|
123
|
+
}
|
|
124
|
+
function extractFriction(markdown) {
|
|
125
|
+
const lines = markdown.split("\n");
|
|
126
|
+
const start = lines.findIndex((l) => /^##\s+Friction\s*$/.test(l));
|
|
127
|
+
if (start === -1)
|
|
128
|
+
return "";
|
|
129
|
+
const body = [];
|
|
130
|
+
for (let i = start + 1; i < lines.length; i++) {
|
|
131
|
+
const line = lines[i] ?? "";
|
|
132
|
+
if (/^##\s+/.test(line))
|
|
133
|
+
break;
|
|
134
|
+
body.push(line);
|
|
135
|
+
}
|
|
136
|
+
return body.join("\n").trim();
|
|
137
|
+
}
|
|
138
|
+
async function collectPriorReflections(cwd, excludeSessionId) {
|
|
139
|
+
const summaries = (await listReflections(cwd))
|
|
140
|
+
.filter((s) => s.sessionId !== excludeSessionId)
|
|
141
|
+
.slice(0, 3);
|
|
142
|
+
if (summaries.length === 0)
|
|
143
|
+
return "";
|
|
144
|
+
const blocks = [];
|
|
145
|
+
for (const s of summaries) {
|
|
146
|
+
const content = await fs.readFile(s.path, "utf-8");
|
|
147
|
+
const friction = extractFriction(content);
|
|
148
|
+
const suggestions = parseSuggestionsFromMarkdown(content)
|
|
149
|
+
.map((sug) => sug.raw)
|
|
150
|
+
.join("\n\n");
|
|
151
|
+
const parts = [`### ${s.date} ${s.sessionId}`];
|
|
152
|
+
if (friction.length > 0)
|
|
153
|
+
parts.push(`#### Friction\n${friction}`);
|
|
154
|
+
if (suggestions.length > 0)
|
|
155
|
+
parts.push(suggestions);
|
|
156
|
+
if (parts.length > 1)
|
|
157
|
+
blocks.push(parts.join("\n\n"));
|
|
158
|
+
}
|
|
159
|
+
return blocks.join("\n\n");
|
|
160
|
+
}
|
|
161
|
+
function todayDateUtc() {
|
|
162
|
+
const d = new Date();
|
|
163
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
164
|
+
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
|
|
165
|
+
}
|
|
166
|
+
export async function generateReflection(input) {
|
|
167
|
+
const cwd = resolve(input.cwd);
|
|
168
|
+
const sessionId = input.sessionId ?? (await mostRecentSessionId(cwd));
|
|
169
|
+
if (!sessionId) {
|
|
170
|
+
throw new Error(`No session id provided and no .keel/sessions/*.jsonl found under ${cwd}`);
|
|
171
|
+
}
|
|
172
|
+
const trace = await readSessionTrace(sessionId, cwd);
|
|
173
|
+
const baseSha = trace.startTs ? findShaAtOrBeforeTimestamp(trace.startTs, cwd) : null;
|
|
174
|
+
const diff = await readDiff({ baseRef: baseSha, cwd });
|
|
175
|
+
const buildArtifacts = await collectTouchedBuildArtifacts(trace, cwd);
|
|
176
|
+
const priorReflections = input.groundInPriorReflections === false
|
|
177
|
+
? ""
|
|
178
|
+
: await collectPriorReflections(cwd, sessionId);
|
|
179
|
+
const userPrompt = `Session id: ${sessionId}\n\n` +
|
|
180
|
+
`## Session trace\n\n${summarizeTrace(trace)}\n\n` +
|
|
181
|
+
`## Diff summary\n\n${summarizeDiff(diff)}\n\n` +
|
|
182
|
+
`## Diff (first 12k chars)\n\n\`\`\`\n${diff.rawDiff.slice(0, 12000)}\n\`\`\`\n\n` +
|
|
183
|
+
`## Build artifacts\n\n${buildArtifacts}\n\n` +
|
|
184
|
+
(priorReflections.length > 0
|
|
185
|
+
? `## Prior reflections (do not repeat resolved items; flag anything recurring)\n\n${priorReflections}\n\n`
|
|
186
|
+
: "") +
|
|
187
|
+
`Produce the reflection now.`;
|
|
188
|
+
const startedAt = Date.now();
|
|
189
|
+
const res = await input.provider.generate({
|
|
190
|
+
system: REFLECT_SYSTEM_PROMPT,
|
|
191
|
+
messages: [
|
|
192
|
+
{
|
|
193
|
+
role: "user",
|
|
194
|
+
content: [{ type: "text", text: userPrompt }],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
maxTokens: 2048,
|
|
198
|
+
model: input.model ?? input.provider.defaultModel,
|
|
199
|
+
});
|
|
200
|
+
const markdown = res.content
|
|
201
|
+
.map((b) => (b.type === "text" ? b.text : ""))
|
|
202
|
+
.join("")
|
|
203
|
+
.trim();
|
|
204
|
+
if (markdown.length === 0) {
|
|
205
|
+
throw new Error(`Reflection produced no text (session=${sessionId})`);
|
|
206
|
+
}
|
|
207
|
+
const paths = getReflectionPaths(sessionId, cwd, todayDateUtc());
|
|
208
|
+
await atomicWrite(paths.file, markdown + "\n");
|
|
209
|
+
input.telemetry?.emit({
|
|
210
|
+
sessionId,
|
|
211
|
+
parentEventId: null,
|
|
212
|
+
workspaceId: null,
|
|
213
|
+
triggeredBy: { kind: "user" },
|
|
214
|
+
kind: "reflect.generated",
|
|
215
|
+
payload: {
|
|
216
|
+
reflectionPath: paths.file,
|
|
217
|
+
sessionEventCount: trace.events.length,
|
|
218
|
+
diffFiles: diff.files.length,
|
|
219
|
+
chars: markdown.length,
|
|
220
|
+
},
|
|
221
|
+
latencyMs: Date.now() - startedAt,
|
|
222
|
+
inputTokens: res.usage.inputTokens,
|
|
223
|
+
outputTokens: res.usage.outputTokens,
|
|
224
|
+
model: input.model ?? input.provider.defaultModel,
|
|
225
|
+
});
|
|
226
|
+
return { reflectionPath: paths.file,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module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@keel_flow/schema": "0.2.0",
|
|
23
|
+
"@keel_flow/runtime": "0.2.0",
|
|
24
|
+
"@keel_flow/telemetry": "0.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^25.9.1",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
29
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
30
|
+
"eslint": "^9.0.0",
|
|
31
|
+
"typescript": "^5.5.0",
|
|
32
|
+
"vitest": "^2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"lint": "eslint src"
|
|
39
|
+
}
|
|
40
|
+
}
|