agent-lyceum 0.46.0 → 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +8 -0
- package/dist/decision-log.d.ts +15 -0
- package/dist/decision-log.js +78 -0
- package/dist/policy.d.ts +2 -0
- package/dist/policy.js +4 -0
- package/dist/records.d.ts +2 -0
- package/dist/records.js +13 -1
- package/dist/web-console.d.ts +35 -1
- package/dist/web-console.js +121 -1
- package/package.json +1 -1
- package/web/dist/public/assets/index-B8vglxAK.js +86 -0
- package/web/dist/public/assets/index-C9JUgWik.css +2 -0
- package/web/dist/public/index.html +2 -2
- package/web/dist/server/api.js +33 -0
- package/web/dist/public/assets/index-C8HSRh87.js +0 -10
- package/web/dist/public/assets/index-DGBtVh9L.css +0 -2
package/dist/cli.js
CHANGED
|
@@ -34,6 +34,7 @@ import { onlyAgent, soloProject } from "./solo.js";
|
|
|
34
34
|
import { DEMO_PROJECT, DEMO_TASK, defaultDemoDir, detectRuntime, prepareDemo } from "./demo.js";
|
|
35
35
|
import { claudeQuota, codexQuota, cursorQuota } from "./quota.js";
|
|
36
36
|
import { summarizeProgress } from "./summarize.js";
|
|
37
|
+
import { saveRunDecisions } from "./decision-log.js";
|
|
37
38
|
import { createConsoleDeps } from "./web-console.js";
|
|
38
39
|
const program = new Command();
|
|
39
40
|
program
|
|
@@ -537,6 +538,7 @@ program
|
|
|
537
538
|
const plan = planRunCleanup(pr, full, { keepWorktrees: opts.keepWorktrees });
|
|
538
539
|
console.log("Dry run: nothing is deleted.");
|
|
539
540
|
showPlan(plan);
|
|
541
|
+
console.log(" would keep the run's ## Decisions in the project's decision log (shared/common/decision-log/)");
|
|
540
542
|
if (plan.refusals.length)
|
|
541
543
|
refuse(plan);
|
|
542
544
|
return;
|
|
@@ -547,6 +549,12 @@ program
|
|
|
547
549
|
if (plan.refusals.length)
|
|
548
550
|
refuse(plan);
|
|
549
551
|
showPlan(plan);
|
|
552
|
+
// The run folder (and its report) is about to go: keep the decisions first, and stop if they cannot be kept.
|
|
553
|
+
const kept = saveRunDecisions(pr, full);
|
|
554
|
+
if (kept.status === "saved")
|
|
555
|
+
console.log(` kept decisions -> ${kept.file}`);
|
|
556
|
+
else if (kept.status === "none")
|
|
557
|
+
console.log(` no decisions to keep (${kept.reason})`);
|
|
550
558
|
const report = executeRunCleanup(plan);
|
|
551
559
|
if (report.failed.length) {
|
|
552
560
|
for (const f of report.failed)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResolvedProject } from "./config.js";
|
|
2
|
+
export type DecisionLogResult = {
|
|
3
|
+
status: "saved" | "exists" | "none";
|
|
4
|
+
id?: string;
|
|
5
|
+
file?: string;
|
|
6
|
+
reason?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Where the entry for a run goes: one stable file per run, so saving twice is harmless. */
|
|
9
|
+
export declare function decisionLogId(runId: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Keep what a run decided before `clear` deletes the run folder: its `## Decisions` (and `## Not done` as consequences) with the
|
|
12
|
+
* task as context. Never overwrites an existing entry. Returns `none` when the run reported no decision.
|
|
13
|
+
* Throws when the entry cannot be written, so the caller can stop before deleting anything.
|
|
14
|
+
*/
|
|
15
|
+
export declare function saveRunDecisions(project: ResolvedProject, runId: string): DecisionLogResult;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { decisionLogDir } from "./policy.js";
|
|
4
|
+
/** Body of the `## <name>` section of a done report, up to the next `## ` heading. */
|
|
5
|
+
function section(text, name) {
|
|
6
|
+
const m = new RegExp(`^##[ \\t]+${name}[ \\t]*\\r?\\n([\\s\\S]*?)(?=^##[ \\t]|(?![\\s\\S]))`, "m").exec(text);
|
|
7
|
+
return (m?.[1] ?? "").trim();
|
|
8
|
+
}
|
|
9
|
+
/** "None", "無" and the like are not a decision. */
|
|
10
|
+
function isEmpty(body) {
|
|
11
|
+
return body === "" || /^(none|n\/a|無|没有|沒有)[.。]?$/i.test(body.replace(/^[-*]\s*/, "").trim());
|
|
12
|
+
}
|
|
13
|
+
const oneLine = (s) => s.replace(/\s+/g, " ").trim();
|
|
14
|
+
/** Where the entry for a run goes: one stable file per run, so saving twice is harmless. */
|
|
15
|
+
export function decisionLogId(runId) {
|
|
16
|
+
return `run-${runId.toLowerCase().replace(/[^a-z0-9-]/g, "").slice(0, 28)}`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Keep what a run decided before `clear` deletes the run folder: its `## Decisions` (and `## Not done` as consequences) with the
|
|
20
|
+
* task as context. Never overwrites an existing entry. Returns `none` when the run reported no decision.
|
|
21
|
+
* Throws when the entry cannot be written, so the caller can stop before deleting anything.
|
|
22
|
+
*/
|
|
23
|
+
export function saveRunDecisions(project, runId) {
|
|
24
|
+
const runDir = path.join(project.paths.runs, runId);
|
|
25
|
+
let result;
|
|
26
|
+
try {
|
|
27
|
+
result = fs.readFileSync(path.join(runDir, "result.md"), "utf8");
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return { status: "none", reason: "no result.md" };
|
|
31
|
+
}
|
|
32
|
+
const decisions = section(result, "Decisions");
|
|
33
|
+
if (isEmpty(decisions))
|
|
34
|
+
return { status: "none", reason: "the report lists no decisions" };
|
|
35
|
+
let summary = "";
|
|
36
|
+
let started = "";
|
|
37
|
+
try {
|
|
38
|
+
const state = JSON.parse(fs.readFileSync(path.join(runDir, "state.json"), "utf8"));
|
|
39
|
+
summary = state.task_summary ?? "";
|
|
40
|
+
started = state.started_at ?? "";
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// The report is enough to keep.
|
|
44
|
+
}
|
|
45
|
+
const heading = /^#\s+(.+)$/m.exec(result)?.[1]?.trim();
|
|
46
|
+
const title = oneLine(heading || summary || runId).slice(0, 200);
|
|
47
|
+
const date = /^\d{4}-\d{2}-\d{2}/.exec(started)?.[0] ?? new Date().toISOString().slice(0, 10);
|
|
48
|
+
const outcome = /^\*\*Outcome:\*\*\s*(\S+)/m.exec(result)?.[1];
|
|
49
|
+
const notDone = section(result, "Not done");
|
|
50
|
+
const id = decisionLogId(runId);
|
|
51
|
+
const file = path.join(decisionLogDir(project), `${id}.md`);
|
|
52
|
+
const text = [
|
|
53
|
+
"---",
|
|
54
|
+
"status: active",
|
|
55
|
+
`date: ${date}`,
|
|
56
|
+
`title: ${JSON.stringify(title)}`,
|
|
57
|
+
`run: ${JSON.stringify(runId)}`,
|
|
58
|
+
...(outcome ? [`outcome: ${outcome}`] : []),
|
|
59
|
+
"---",
|
|
60
|
+
"## Context",
|
|
61
|
+
summary.trim() || title,
|
|
62
|
+
"",
|
|
63
|
+
"## Decision",
|
|
64
|
+
decisions,
|
|
65
|
+
...(isEmpty(notDone) ? [] : ["", "## Consequences", notDone]),
|
|
66
|
+
"",
|
|
67
|
+
].join("\n");
|
|
68
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
69
|
+
try {
|
|
70
|
+
fs.writeFileSync(file, text, { flag: "wx" });
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
if (e.code === "EEXIST")
|
|
74
|
+
return { status: "exists", id, file };
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
return { status: "saved", id, file };
|
|
78
|
+
}
|
package/dist/policy.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface WritePolicy {
|
|
|
25
25
|
export declare function commonFile(project: ResolvedProject): string;
|
|
26
26
|
/** Durable decisions and lessons of the project, one file per entry. Only the lead may write them. `.archive/` is tidy's output, never shown in prompts. */
|
|
27
27
|
export declare function recordsDir(project: ResolvedProject): string;
|
|
28
|
+
/** Decisions kept from cleared runs (see decision-log.ts). Not a record kind: never shown in prompts and not counted against the records budget. */
|
|
29
|
+
export declare function decisionLogDir(project: ResolvedProject): string;
|
|
28
30
|
export declare function recordsKindDir(project: ResolvedProject, kind: "decisions" | "lessons"): string;
|
|
29
31
|
/**
|
|
30
32
|
* Proposals of lessons and decisions written by agents that run alone (spec 30). A sibling of `shared/`, not under `records/`:
|
package/dist/policy.js
CHANGED
|
@@ -9,6 +9,10 @@ export function commonFile(project) {
|
|
|
9
9
|
export function recordsDir(project) {
|
|
10
10
|
return path.join(project.paths.shared, "common", "records");
|
|
11
11
|
}
|
|
12
|
+
/** Decisions kept from cleared runs (see decision-log.ts). Not a record kind: never shown in prompts and not counted against the records budget. */
|
|
13
|
+
export function decisionLogDir(project) {
|
|
14
|
+
return path.join(project.paths.shared, "common", "decision-log");
|
|
15
|
+
}
|
|
12
16
|
export function recordsKindDir(project, kind) {
|
|
13
17
|
return path.join(recordsDir(project), kind);
|
|
14
18
|
}
|
package/dist/records.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface ProjectRecord {
|
|
|
19
19
|
}
|
|
20
20
|
/** Every `*.md` entry of one kind, sorted by id. Entries that cannot be parsed are listed with `invalid` set; a missing folder is an empty list. */
|
|
21
21
|
export declare function listRecords(project: ResolvedProject, kind: RecordKind): ProjectRecord[];
|
|
22
|
+
/** Decisions kept from cleared runs, same file format as a record. A missing or symlinked folder is an empty list. */
|
|
23
|
+
export declare function listDecisionLog(project: ResolvedProject): ProjectRecord[];
|
|
22
24
|
/** Entries shown in prompts: `status: active` and not named in another entry's `supersedes`. */
|
|
23
25
|
export declare function effectiveActive(records: ProjectRecord[]): ProjectRecord[];
|
|
24
26
|
/** The kinds whose effective-active entries take more than the budget: what `done` and `proposals review` refuse to leave behind. */
|
package/dist/records.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { parse as parseYaml } from "yaml";
|
|
4
4
|
import { readRegularFileNoFollow } from "./fs-util.js";
|
|
5
|
-
import { recordsDir, recordsKindDir } from "./policy.js";
|
|
5
|
+
import { decisionLogDir, recordsDir, recordsKindDir } from "./policy.js";
|
|
6
6
|
export const RECORD_KINDS = ["decisions", "lessons"];
|
|
7
7
|
/** Cap of one kind's effective-active entries in a prompt (and, for `done`, the most they may add up to). */
|
|
8
8
|
export const RECORDS_BUDGET = 12 * 1024;
|
|
@@ -83,6 +83,18 @@ export function listRecords(project, kind) {
|
|
|
83
83
|
.sort()
|
|
84
84
|
.map((n) => parseEntry(kind, path.join(dir, n)));
|
|
85
85
|
}
|
|
86
|
+
/** Decisions kept from cleared runs, same file format as a record. A missing or symlinked folder is an empty list. */
|
|
87
|
+
export function listDecisionLog(project) {
|
|
88
|
+
const dir = decisionLogDir(project);
|
|
89
|
+
try {
|
|
90
|
+
if (!fs.lstatSync(dir).isDirectory())
|
|
91
|
+
return [];
|
|
92
|
+
return fs.readdirSync(dir).filter((n) => n.endsWith(".md")).sort().map((n) => parseEntry("decisions", path.join(dir, n)));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
86
98
|
/** Entries shown in prompts: `status: active` and not named in another entry's `supersedes`. */
|
|
87
99
|
export function effectiveActive(records) {
|
|
88
100
|
const replaced = new Set();
|
package/dist/web-console.d.ts
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
export type ReportItem = {
|
|
2
|
+
id: string;
|
|
3
|
+
kind: "result" | "done" | "agent";
|
|
4
|
+
title: string;
|
|
5
|
+
agent?: string;
|
|
6
|
+
outcome?: string;
|
|
7
|
+
created?: string;
|
|
8
|
+
};
|
|
9
|
+
export type DecisionItem = {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
status: "active" | "superseded";
|
|
13
|
+
date: string;
|
|
14
|
+
run?: string;
|
|
15
|
+
supersedes: string[];
|
|
16
|
+
supersededBy: string[];
|
|
17
|
+
invalid?: string;
|
|
18
|
+
};
|
|
19
|
+
export type DecisionGroup = {
|
|
20
|
+
project: string;
|
|
21
|
+
decisions: DecisionItem[];
|
|
22
|
+
error?: string;
|
|
23
|
+
};
|
|
24
|
+
export type DecisionDoc = DecisionItem & {
|
|
25
|
+
markdown: string;
|
|
26
|
+
};
|
|
2
27
|
export declare function createConsoleDeps(home: string, cliFile: string): {
|
|
3
28
|
home: string;
|
|
4
29
|
cli: {
|
|
@@ -21,6 +46,15 @@ export declare function createConsoleDeps(home: string, cliFile: string): {
|
|
|
21
46
|
delivered: boolean;
|
|
22
47
|
}[];
|
|
23
48
|
} | undefined;
|
|
49
|
+
listReports(project: string, runId: string): ReportItem[] | undefined;
|
|
50
|
+
readReport(project: string, runId: string, id: string): {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
markdown: string;
|
|
54
|
+
} | undefined;
|
|
55
|
+
/** Decisions of every registered project, read-only. They live outside the run folders, so they survive `clear`. */
|
|
56
|
+
listDecisions(): DecisionGroup[];
|
|
57
|
+
readDecision(project: string, id: string): DecisionDoc | undefined;
|
|
24
58
|
saveAnswers(project: string, runId: string, answers: Record<string, string>, assumeDefaults: boolean): {
|
|
25
59
|
complete: boolean;
|
|
26
60
|
problems: string[];
|
package/dist/web-console.js
CHANGED
|
@@ -2,9 +2,67 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { prepareAnswers } from "./ask-answer.js";
|
|
4
4
|
import { readAskReply, writeAskReply } from "./ask-reply.js";
|
|
5
|
-
import { listProjects } from "./config.js";
|
|
5
|
+
import { listProjects, resolveProject } from "./config.js";
|
|
6
|
+
import { parseRaw } from "./mailbox.js";
|
|
6
7
|
import { NAME_RE, projectPaths } from "./paths.js";
|
|
8
|
+
import { listDecisionLog, listRecords } from "./records.js";
|
|
9
|
+
const DECISION_ID_RE = /^[a-z0-9-]{1,120}$/;
|
|
10
|
+
const REPORT_ID_RE = /^(result|done-\d{1,4}|mail-[0-9a-f]{8})$/;
|
|
11
|
+
const AGENT_MAIL_TYPES = new Set(["reply", "done", "failure"]);
|
|
12
|
+
function headingOf(text) {
|
|
13
|
+
return /^#\s+(.+)$/m.exec(text)?.[1]?.trim();
|
|
14
|
+
}
|
|
15
|
+
function outcomeOf(text) {
|
|
16
|
+
return /^\*\*Outcome:\*\*\s*(\S+)/m.exec(text)?.[1];
|
|
17
|
+
}
|
|
18
|
+
/** Every mail an agent sent (reply, done, failure) under the run's inbox folders, read or not. */
|
|
19
|
+
function agentMails(runDir) {
|
|
20
|
+
const inbox = path.join(runDir, "mail", "inbox");
|
|
21
|
+
const out = [];
|
|
22
|
+
const dirs = (dir) => (fs.existsSync(dir) ? fs.readdirSync(dir, { withFileTypes: true }) : []);
|
|
23
|
+
for (const agent of dirs(inbox)) {
|
|
24
|
+
if (!agent.isDirectory())
|
|
25
|
+
continue;
|
|
26
|
+
for (const folder of [path.join(inbox, agent.name), path.join(inbox, agent.name, "read")]) {
|
|
27
|
+
for (const entry of dirs(folder)) {
|
|
28
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
29
|
+
continue;
|
|
30
|
+
const file = path.join(folder, entry.name);
|
|
31
|
+
try {
|
|
32
|
+
const { data } = parseRaw(fs.readFileSync(file, "utf8"));
|
|
33
|
+
const id = String(data.id ?? "");
|
|
34
|
+
if (!/^[0-9a-f]{8}$/.test(id) || !AGENT_MAIL_TYPES.has(String(data.type)))
|
|
35
|
+
continue;
|
|
36
|
+
out.push({ id, file, from: String(data.from ?? ""), subject: String(data.subject ?? ""), ...(data.created ? { created: String(data.created) } : {}) });
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// A mail that does not parse is not a report.
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
7
46
|
/** What the web page's command console needs from this side of the package (`web/` cannot import `src/`). Same shape as `ConsoleDeps` in `web/src/server/api.ts`. */
|
|
47
|
+
/** An entry is "active" only while its own status says so and no other entry supersedes it. */
|
|
48
|
+
function allDecisions(project) {
|
|
49
|
+
const records = listRecords(project, "decisions");
|
|
50
|
+
const seen = new Set(records.map((r) => r.id));
|
|
51
|
+
return [...records, ...listDecisionLog(project).filter((r) => !seen.has(r.id))];
|
|
52
|
+
}
|
|
53
|
+
function decisionItems(records) {
|
|
54
|
+
const by = new Map();
|
|
55
|
+
for (const r of records)
|
|
56
|
+
for (const id of r.supersedes)
|
|
57
|
+
if (id !== r.id)
|
|
58
|
+
by.set(id, [...(by.get(id) ?? []), r.id]);
|
|
59
|
+
return records
|
|
60
|
+
.map((r) => {
|
|
61
|
+
const supersededBy = by.get(r.id) ?? [];
|
|
62
|
+
return { id: r.id, title: r.title, status: r.status === "active" && supersededBy.length === 0 ? "active" : "superseded", date: r.date, ...(r.run ? { run: r.run } : {}), supersedes: r.supersedes, supersededBy, ...(r.invalid ? { invalid: r.invalid } : {}) };
|
|
63
|
+
})
|
|
64
|
+
.sort((a, b) => b.date.localeCompare(a.date) || b.id.localeCompare(a.id));
|
|
65
|
+
}
|
|
8
66
|
export function createConsoleDeps(home, cliFile) {
|
|
9
67
|
const projectDir = (name) => listProjects(home).find((p) => p.name === name)?.dir;
|
|
10
68
|
const runDirOf = (project, runId) => {
|
|
@@ -35,6 +93,68 @@ export function createConsoleDeps(home, cliFile) {
|
|
|
35
93
|
})),
|
|
36
94
|
};
|
|
37
95
|
},
|
|
96
|
+
listReports(project, runId) {
|
|
97
|
+
const dir = runDirOf(project, runId);
|
|
98
|
+
if (!dir)
|
|
99
|
+
return undefined;
|
|
100
|
+
const items = [];
|
|
101
|
+
const files = fs.readdirSync(dir).filter((f) => f === "result.md" || /^done-\d{1,4}\.md$/.test(f));
|
|
102
|
+
for (const f of files) {
|
|
103
|
+
const text = fs.readFileSync(path.join(dir, f), "utf8");
|
|
104
|
+
const id = f.slice(0, -3);
|
|
105
|
+
const outcome = outcomeOf(text);
|
|
106
|
+
items.push({ id, kind: id === "result" ? "result" : "done", title: headingOf(text) ?? f, ...(outcome ? { outcome } : {}), created: fs.statSync(path.join(dir, f)).mtime.toISOString() });
|
|
107
|
+
}
|
|
108
|
+
// Newest final report first: result.md, then done-N from the highest N.
|
|
109
|
+
items.sort((a, b) => (a.id === "result" ? -1 : b.id === "result" ? 1 : Number(b.id.slice(5)) - Number(a.id.slice(5))));
|
|
110
|
+
const mails = agentMails(dir).sort((a, b) => (b.created ?? "").localeCompare(a.created ?? ""));
|
|
111
|
+
for (const m of mails)
|
|
112
|
+
items.push({ id: `mail-${m.id}`, kind: "agent", title: m.subject || m.id, agent: m.from, ...(m.created ? { created: m.created } : {}) });
|
|
113
|
+
return items;
|
|
114
|
+
},
|
|
115
|
+
readReport(project, runId, id) {
|
|
116
|
+
const dir = runDirOf(project, runId);
|
|
117
|
+
if (!dir || !REPORT_ID_RE.test(id))
|
|
118
|
+
return undefined;
|
|
119
|
+
if (id.startsWith("mail-")) {
|
|
120
|
+
const mail = agentMails(dir).find((m) => `mail-${m.id}` === id);
|
|
121
|
+
if (!mail)
|
|
122
|
+
return undefined;
|
|
123
|
+
return { id, title: mail.subject || mail.id, markdown: parseRaw(fs.readFileSync(mail.file, "utf8")).body };
|
|
124
|
+
}
|
|
125
|
+
const file = path.join(dir, `${id}.md`);
|
|
126
|
+
if (!fs.existsSync(file))
|
|
127
|
+
return undefined;
|
|
128
|
+
const markdown = fs.readFileSync(file, "utf8");
|
|
129
|
+
return { id, title: headingOf(markdown) ?? id, markdown };
|
|
130
|
+
},
|
|
131
|
+
/** Decisions of every registered project, read-only. They live outside the run folders, so they survive `clear`. */
|
|
132
|
+
listDecisions() {
|
|
133
|
+
return listProjects(home)
|
|
134
|
+
.map((p) => p.name)
|
|
135
|
+
.sort((a, b) => a.localeCompare(b))
|
|
136
|
+
.map((project) => {
|
|
137
|
+
try {
|
|
138
|
+
return { project, decisions: decisionItems(allDecisions(resolveProject(home, project))) };
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return { project, decisions: [], error: "讀不到這個專案的設定。" };
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
readDecision(project, id) {
|
|
146
|
+
if (!NAME_RE.test(project) || !DECISION_ID_RE.test(id) || !projectDir(project))
|
|
147
|
+
return undefined;
|
|
148
|
+
try {
|
|
149
|
+
const records = allDecisions(resolveProject(home, project));
|
|
150
|
+
const item = decisionItems(records).find((d) => d.id === id);
|
|
151
|
+
const record = records.find((r) => r.id === id);
|
|
152
|
+
return item && record ? { ...item, markdown: record.body } : undefined;
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
38
158
|
saveAnswers(project, runId, answers, assumeDefaults) {
|
|
39
159
|
const dir = runDirOf(project, runId);
|
|
40
160
|
const reply = dir ? readAskReply(dir) : undefined;
|