claude-code-session-manager 0.144.0 → 0.145.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/assets/{AppSettings-Z68gQiVE.js → AppSettings-BR5b6oof.js} +2 -2
- package/dist/assets/{History-C3E6y_7t.js → History-B4U0mCdK.js} +1 -1
- package/dist/assets/HomeClaudeConfig-DQqG7lFE.js +5 -0
- package/dist/assets/{Panel-CnfWs46Z.js → Panel-CwsOJ0nI.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-CP0Wsg-H.js → ProjectClaudeConfig-BzRowu8x.js} +1 -1
- package/dist/assets/{Scheduler-D8un7N3B.js → Scheduler-dr7CNOcL.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-DRtZV1Al.js → SkillReferenceGraph-CroBPY4C.js} +1 -1
- package/dist/assets/{Skills-Bg5O2Hyn.js → Skills-BiW2lCnD.js} +1 -1
- package/dist/assets/{TiptapBody-BdzoBmqu.js → TiptapBody-CYTkQiva.js} +1 -1
- package/dist/assets/{Toggle-Dt5K1OXt.js → Toggle-WFBYo8JI.js} +1 -1
- package/dist/assets/{VoiceButton-CTLyRgdF.js → VoiceButton-DZu8dTpO.js} +1 -1
- package/dist/assets/{historyTotals-B2_KWBga.js → historyTotals-B7KeXLSE.js} +1 -1
- package/dist/assets/{index-446b69rr.js → index-hXRNm0UJ.js} +128 -128
- package/dist/index.html +1 -1
- package/dist-web/app.js +394 -394
- package/package.json +1 -1
- package/plugins/session-manager-dev/skills/develop/SKILL.md +11 -6
- package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +1 -1
- package/plugins/session-manager-dev/skills/maintaining-md-network/weekly-consolidation.md +8 -4
- package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +9 -6
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +35 -5
- package/src/main/config.cjs +12 -0
- package/src/main/index.cjs +2 -2
- package/src/main/ipcSchemas.cjs +5 -0
- package/src/main/lib/claude/headlessMcpServers.cjs +1 -1
- package/src/main/lib/claude/personaToolScope.cjs +23 -8
- package/src/main/lib/demo-video-kit/resumableRun.cjs +21 -14
- package/src/main/lib/demo-video-kit/seedKit.cjs +2 -2
- package/src/main/lib/epic/epicOutsideRead.cjs +43 -8
- package/src/main/lib/epic/planReviewInput.cjs +2 -0
- package/src/main/lib/epic/scriptStartedBy.cjs +19 -4
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +84 -12
- package/src/main/lib/feedback-remote/localAdminHttp.cjs +5 -1
- package/src/main/lib/feedback-remote/serviceMcpSession.cjs +6 -3
- package/src/main/lib/feedback-remote/servicePairings.cjs +48 -0
- package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +11 -6
- package/src/main/lib/mcpToolCatalog.cjs +4 -2
- package/src/main/lib/opsOwnership.cjs +2 -0
- package/src/main/lib/prd/prdCreate.cjs +2 -1
- package/src/main/lib/prd/prdMcpReachWarnings.cjs +3 -1
- package/src/main/lib/prd/prdSandboxWarnings.cjs +1 -1
- package/src/main/lib/scheduler/planReviewStore.cjs +24 -2
- package/src/main/lib/scheduler/reviewNotice.cjs +3 -1
- package/src/main/lib/tasks/memoryConsolidation.cjs +21 -12
- package/src/main/lib/tasks/weeklyConsolidationInputs.cjs +131 -11
- package/src/main/runVerify.cjs +77 -3
- package/src/main/scheduler/gitTreeGuard.cjs +6 -0
- package/src/main/scheduler/planReviewHold.cjs +11 -5
- package/src/main/scheduler/prdPaths.cjs +10 -1
- package/src/main/scheduler.cjs +170 -18
- package/src/main/templates/PRD_AUTHORING.md +2 -2
- package/src/main/webRemote.cjs +22 -0
- package/src/preload/api.d.ts +8 -0
- package/src/preload/apiSurface.json +11 -0
- package/src/preload/index.cjs +2 -0
- package/dist/assets/HomeClaudeConfig-Yd1vXzBn.js +0 -5
|
@@ -18,6 +18,65 @@ const MAX_TRANSCRIPTS = 200;
|
|
|
18
18
|
const MAX_LESSON_LINES = 3;
|
|
19
19
|
const MAX_LESSON_CHARS = 200;
|
|
20
20
|
const HEAD_BYTES = 64 * 1024;
|
|
21
|
+
const HISTORY_CHUNK = 256 * 1024;
|
|
22
|
+
const HISTORY_SLACK_ROWS = 200;
|
|
23
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Read a JSONL history file backwards in fixed chunks (bounded memory) and
|
|
27
|
+
* return parsed rows newest-first, stopping at the first row finished before
|
|
28
|
+
* sinceMs (after a bounded slack of HISTORY_SLACK_ROWS further rows, so a few
|
|
29
|
+
* out-of-order rows are still collected), or the file start. No row/byte cap
|
|
30
|
+
* can stop inside the window. Returns { rows, partial }; partial = a read error
|
|
31
|
+
* cut the scan short.
|
|
32
|
+
*/
|
|
33
|
+
function readHistorySince(file, sinceMs, chunkBytes = HISTORY_CHUNK) {
|
|
34
|
+
const out = [];
|
|
35
|
+
let partial = false;
|
|
36
|
+
let slack = -1; // -1 = no pre-window row seen yet
|
|
37
|
+
let fd;
|
|
38
|
+
try {
|
|
39
|
+
fd = fs.openSync(file, 'r');
|
|
40
|
+
let pos = fs.fstatSync(fd).size;
|
|
41
|
+
let carry = Buffer.alloc(0);
|
|
42
|
+
let done = false;
|
|
43
|
+
const take = (line) => {
|
|
44
|
+
const t = line.trim();
|
|
45
|
+
if (!t) return;
|
|
46
|
+
let row;
|
|
47
|
+
try { row = JSON.parse(t); } catch { return; }
|
|
48
|
+
if (!row || typeof row !== 'object') return;
|
|
49
|
+
const f = toMs(row.finishedAt);
|
|
50
|
+
if (slack >= 0) {
|
|
51
|
+
if (slack-- <= 0) { done = true; return; }
|
|
52
|
+
}
|
|
53
|
+
if (f !== null && f < sinceMs) { if (slack < 0) slack = HISTORY_SLACK_ROWS; return; }
|
|
54
|
+
out.push(row);
|
|
55
|
+
};
|
|
56
|
+
while (pos > 0 && !done) {
|
|
57
|
+
const len = Math.min(chunkBytes, pos);
|
|
58
|
+
pos -= len;
|
|
59
|
+
const chunk = Buffer.alloc(len);
|
|
60
|
+
fs.readSync(fd, chunk, 0, len, pos);
|
|
61
|
+
const buf = Buffer.concat([chunk, carry]);
|
|
62
|
+
let end = buf.length;
|
|
63
|
+
let nl = buf.lastIndexOf(0x0a, end - 1);
|
|
64
|
+
while (nl >= 0 && !done) {
|
|
65
|
+
take(buf.toString('utf8', nl + 1, end));
|
|
66
|
+
end = nl;
|
|
67
|
+
nl = end > 0 ? buf.lastIndexOf(0x0a, end - 1) : -1;
|
|
68
|
+
}
|
|
69
|
+
carry = Buffer.from(buf.subarray(0, end));
|
|
70
|
+
}
|
|
71
|
+
if (!done && pos === 0 && carry.length) take(carry.toString('utf8'));
|
|
72
|
+
} catch (e) {
|
|
73
|
+
// A missing history file is just empty; any other error is a partial read.
|
|
74
|
+
if (!(e && e.code === 'ENOENT')) partial = true;
|
|
75
|
+
} finally {
|
|
76
|
+
if (fd !== undefined) try { fs.closeSync(fd); } catch { /* ignore */ }
|
|
77
|
+
}
|
|
78
|
+
return { rows: out, partial };
|
|
79
|
+
}
|
|
21
80
|
|
|
22
81
|
function toMs(v) {
|
|
23
82
|
if (typeof v === 'number' && Number.isFinite(v)) return v;
|
|
@@ -51,6 +110,17 @@ function defaultDeps() {
|
|
|
51
110
|
},
|
|
52
111
|
mainRootOf: (cwd) => require('../cwdClassify.cjs').worktreeMainRootOf(cwd),
|
|
53
112
|
readJobs: () => require('../scheduler/queueStore.cjs').readMergedSync().jobs,
|
|
113
|
+
// Finished jobs leave the queue for the per-project history shard.
|
|
114
|
+
readHistory: (cwd, sinceMs) => {
|
|
115
|
+
const { projectHistoryPath } = require('../scheduler/queueStore.cjs');
|
|
116
|
+
return readHistorySince(projectHistoryPath(cwd), sinceMs);
|
|
117
|
+
},
|
|
118
|
+
// The project key gitWorktree mints into <root>/<key>/<name> (same function).
|
|
119
|
+
worktreeKeyOf: (cwd) => {
|
|
120
|
+
const { worktreeDirFor } = require('../git/gitWorktree.cjs');
|
|
121
|
+
return path.basename(path.dirname(worktreeDirFor('epic', cwd, 'x')));
|
|
122
|
+
},
|
|
123
|
+
runsDir: () => require('../scheduler/schedulerPaths.cjs').runsDir(),
|
|
54
124
|
readResultText: (logPath) => require('../../scheduler.cjs').extractResultTextFromLog(logPath),
|
|
55
125
|
readStructured: (logPath) => require('../../scheduler.cjs').extractStructuredOutputFromLog(logPath),
|
|
56
126
|
};
|
|
@@ -67,7 +137,18 @@ function belongsToProject(sessionCwd, root, d) {
|
|
|
67
137
|
if (norm(sessionCwd) === norm(root)) return true;
|
|
68
138
|
let main = null;
|
|
69
139
|
try { main = d.mainRootOf(sessionCwd); } catch { main = null; }
|
|
70
|
-
|
|
140
|
+
if (main && norm(main) === norm(root)) return true;
|
|
141
|
+
return deadWorktreeOf(sessionCwd, root, d);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Dead managed worktree (git admin gone): match the project key in its path. */
|
|
145
|
+
function deadWorktreeOf(sessionCwd, root, d) {
|
|
146
|
+
const parts = path.resolve(sessionCwd).split(path.sep);
|
|
147
|
+
const i = parts.findIndex((p) => p === 'session-manager-epic-worktrees' || p === 'session-manager-job-worktrees');
|
|
148
|
+
if (i < 0 || !parts[i + 1]) return false;
|
|
149
|
+
let key = null;
|
|
150
|
+
try { key = d.worktreeKeyOf(root); } catch { key = null; }
|
|
151
|
+
return !!key && parts[i + 1] === key;
|
|
71
152
|
}
|
|
72
153
|
|
|
73
154
|
/**
|
|
@@ -78,7 +159,7 @@ function listProjectTranscripts({ cwd, sinceMs, untilMs, deps } = {}) {
|
|
|
78
159
|
const d = withDefaults(deps);
|
|
79
160
|
const range = { since: sinceMs, until: untilMs };
|
|
80
161
|
const found = [];
|
|
81
|
-
if (!cwd || typeof cwd !== 'string') return { transcripts: [], truncated: 0, total: 0, range };
|
|
162
|
+
if (!cwd || typeof cwd !== 'string') return { transcripts: [], truncated: 0, total: 0, perDay: [], range };
|
|
82
163
|
const enc = encodeCwd(cwd);
|
|
83
164
|
for (const folder of d.readdir(d.projectsDir) || []) {
|
|
84
165
|
// Cheap name filter first: the project's own folder (or a sibling sharing its
|
|
@@ -102,8 +183,30 @@ function listProjectTranscripts({ cwd, sinceMs, untilMs, deps } = {}) {
|
|
|
102
183
|
for (const f of inWin) found.push({ path: f.file, sessionId: f.name.slice(0, -'.jsonl'.length), mtimeMs: f.mtimeMs, cwd: sessionCwd });
|
|
103
184
|
}
|
|
104
185
|
found.sort((a, b) => b.mtimeMs - a.mtimeMs || (a.path < b.path ? -1 : 1));
|
|
105
|
-
|
|
106
|
-
|
|
186
|
+
// Spread the cap over the window's days: round-robin one transcript per day
|
|
187
|
+
// (newest day first, newest first within a day) so unused share passes on.
|
|
188
|
+
const days = new Map();
|
|
189
|
+
for (const f of found) {
|
|
190
|
+
const k = Math.floor((f.mtimeMs - sinceMs) / DAY_MS);
|
|
191
|
+
if (!days.has(k)) days.set(k, []);
|
|
192
|
+
days.get(k).push(f);
|
|
193
|
+
}
|
|
194
|
+
const order = [...days.keys()].sort((a, b) => b - a);
|
|
195
|
+
const kept = new Map(order.map((k) => [k, 0]));
|
|
196
|
+
let n = 0;
|
|
197
|
+
for (let round = 0; n < MAX_TRANSCRIPTS; round++) {
|
|
198
|
+
let any = false;
|
|
199
|
+
for (const k of order) {
|
|
200
|
+
if (n >= MAX_TRANSCRIPTS) break;
|
|
201
|
+
if (round < days.get(k).length) { kept.set(k, round + 1); n++; any = true; }
|
|
202
|
+
}
|
|
203
|
+
if (!any) break;
|
|
204
|
+
}
|
|
205
|
+
const transcripts = [];
|
|
206
|
+
for (const k of order) transcripts.push(...days.get(k).slice(0, kept.get(k)));
|
|
207
|
+
transcripts.sort((a, b) => b.mtimeMs - a.mtimeMs || (a.path < b.path ? -1 : 1));
|
|
208
|
+
const perDay = order.map((k) => ({ dayStartMs: sinceMs + k * DAY_MS, total: days.get(k).length, kept: kept.get(k) }));
|
|
209
|
+
return { transcripts, truncated: found.length - transcripts.length, total: found.length, perDay, range };
|
|
107
210
|
}
|
|
108
211
|
|
|
109
212
|
function clip(s) {
|
|
@@ -144,17 +247,34 @@ function collectLessons({ cwd, sinceMs, untilMs, deps } = {}) {
|
|
|
144
247
|
const range = { since: sinceMs, until: untilMs };
|
|
145
248
|
const lessons = [];
|
|
146
249
|
if (!cwd || typeof cwd !== 'string') return { lessons, range };
|
|
147
|
-
let
|
|
148
|
-
try {
|
|
250
|
+
let live = [];
|
|
251
|
+
try { live = d.readJobs(cwd) || []; } catch { live = []; }
|
|
252
|
+
let hist = [];
|
|
253
|
+
let lessonsPartial = false;
|
|
254
|
+
try {
|
|
255
|
+
const h = d.readHistory(cwd, sinceMs);
|
|
256
|
+
if (Array.isArray(h)) hist = h;
|
|
257
|
+
else if (h && Array.isArray(h.rows)) { hist = h.rows; lessonsPartial = !!h.partial; }
|
|
258
|
+
} catch { hist = []; lessonsPartial = true; }
|
|
259
|
+
const seen = new Set();
|
|
260
|
+
const jobs = [];
|
|
261
|
+
for (const j of [...live, ...hist]) {
|
|
262
|
+
if (!j || typeof j !== 'object') continue;
|
|
263
|
+
const id = j.id ?? j.runId;
|
|
264
|
+
if (id != null) { if (seen.has(id)) continue; seen.add(id); }
|
|
265
|
+
jobs.push(j);
|
|
266
|
+
}
|
|
149
267
|
for (const job of jobs) {
|
|
150
|
-
if (!job || typeof job !== 'object' || !job.finishedAt) continue;
|
|
268
|
+
if (!job || typeof job !== 'object' || !job.finishedAt || !job.runId || !job.slug) continue;
|
|
151
269
|
if (!belongsToProject(job.cwd, cwd, d)) continue;
|
|
152
270
|
if (!inWindow(toMs(job.finishedAt), sinceMs, untilMs)) continue;
|
|
153
271
|
const jobId = job.id ?? job.runId ?? null;
|
|
154
272
|
const slug = job.slug ?? null;
|
|
273
|
+
let logPath = null;
|
|
274
|
+
try { logPath = path.join(d.runsDir(), String(job.runId), `${job.slug}.log`); } catch { continue; }
|
|
155
275
|
if (job.agentType === 'validator') {
|
|
156
276
|
let so = null;
|
|
157
|
-
try { so = d.readStructured(
|
|
277
|
+
try { so = d.readStructured(logPath); } catch { so = null; }
|
|
158
278
|
if (!so || typeof so !== 'object') continue;
|
|
159
279
|
const top = lessonsFromField(so.lessons);
|
|
160
280
|
if (top.length) lessons.push({ slug, jobId, source: 'validator', lines: top });
|
|
@@ -164,15 +284,15 @@ function collectLessons({ cwd, sinceMs, untilMs, deps } = {}) {
|
|
|
164
284
|
}
|
|
165
285
|
} else {
|
|
166
286
|
let text = null;
|
|
167
|
-
try { text = d.readResultText(
|
|
287
|
+
try { text = d.readResultText(logPath); } catch { text = null; }
|
|
168
288
|
const lines = parseLessonsBlock(text);
|
|
169
289
|
if (lines.length) lessons.push({ slug, jobId, source: 'dev-lead', lines });
|
|
170
290
|
}
|
|
171
291
|
}
|
|
172
|
-
return { lessons, range };
|
|
292
|
+
return lessonsPartial ? { lessons, range, lessonsPartial: true } : { lessons, range };
|
|
173
293
|
}
|
|
174
294
|
|
|
175
295
|
module.exports = {
|
|
176
|
-
listProjectTranscripts, collectLessons, parseLessonsBlock, inWindow,
|
|
296
|
+
listProjectTranscripts, collectLessons, readHistorySince, HISTORY_SLACK_ROWS, parseLessonsBlock, inWindow,
|
|
177
297
|
MAX_TRANSCRIPTS, MAX_LESSON_LINES, MAX_LESSON_CHARS,
|
|
178
298
|
};
|
package/src/main/runVerify.cjs
CHANGED
|
@@ -99,14 +99,15 @@ function extractContent(item) {
|
|
|
99
99
|
*
|
|
100
100
|
* O(N) where N = log line count.
|
|
101
101
|
*
|
|
102
|
-
* @returns {{ events: object[], resultEvent: object|null, error: string|null }}
|
|
102
|
+
* @returns {{ events: object[], resultEvent: object|null, error: string|null, transcriptCommitLanded?: boolean, transcriptCommitShas: string[], transcriptCommitOutputShas: string[] }}
|
|
103
|
+
* transcriptCommitOutputShas: SHAs git printed in the tool_result of a Bash `git commit` call (a claim, not proof).
|
|
103
104
|
*/
|
|
104
105
|
function parseLog(logPath) {
|
|
105
106
|
let text;
|
|
106
107
|
try {
|
|
107
108
|
text = fs.readFileSync(logPath, 'utf8');
|
|
108
109
|
} catch (e) {
|
|
109
|
-
return { events: [], resultEvent: null, error: e.message, transcriptCommitShas: [] };
|
|
110
|
+
return { events: [], resultEvent: null, error: e.message, transcriptCommitShas: [], transcriptCommitOutputShas: [] };
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
const events = [];
|
|
@@ -192,7 +193,79 @@ function parseLog(logPath) {
|
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
events,
|
|
198
|
+
resultEvent,
|
|
199
|
+
error: null,
|
|
200
|
+
transcriptCommitLanded,
|
|
201
|
+
transcriptCommitShas: [...transcriptCommitShaSet],
|
|
202
|
+
transcriptCommitOutputShas: collectCommitOutputShas(events),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const GIT_COMMIT_CMD_RE = /\bgit\s+(?:-C\s+\S+\s+)?commit\b/;
|
|
207
|
+
const COMMIT_SUMMARY_RE = /^\[[^\]\s]+(?: \(root-commit\))? ([0-9a-f]{7,40})\]/i;
|
|
208
|
+
const SHA_SUBJECT_RE = /^([0-9a-f]{7,40}) (.+)$/i;
|
|
209
|
+
|
|
210
|
+
const COMMIT_MESSAGE_ARG_RE = /(?:^|\s)(?:-[abd-su-zABDEG-Z]*m|--message)(?:=|\s+|(?=["']))(?:"?\$\(cat <<-?\s*['"]?(\w+)['"]?\n([\s\S]*?)\n\s*\1\s*\)"?|"((?:[^"\\]|\\.)*)"|'([^']*)')/g;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* First lines (trimmed) of every commit-message argument in a git command.
|
|
214
|
+
* Accepted forms: `-m` / `--message` with a space or `=` before the value;
|
|
215
|
+
* short-flag clusters ending in m (e.g. `-am`, `-qam`), excluding clusters with a
|
|
216
|
+
* value-taking letter (C, c, F, t) before the m, so `-Cm` is not a message flag;
|
|
217
|
+
* a value attached to the flag (`-m"subj"`, `-m'subj'`); and `$(cat <<EOF ... EOF)`
|
|
218
|
+
* heredoc values (first non-empty line).
|
|
219
|
+
* @param {string} command
|
|
220
|
+
* @returns {string[]}
|
|
221
|
+
*/
|
|
222
|
+
function commitMessageSubjects(command) {
|
|
223
|
+
/** @type {string[]} */
|
|
224
|
+
const out = [];
|
|
225
|
+
if (typeof command !== 'string') return out;
|
|
226
|
+
for (const m of command.matchAll(COMMIT_MESSAGE_ARG_RE)) {
|
|
227
|
+
let body = m[2] !== undefined ? m[2] : m[3] !== undefined ? m[3].replace(/\\(.)/g, '$1') : (m[4] || '');
|
|
228
|
+
const first = body.split('\n').map((l) => l.trim()).find((l) => l.length > 0);
|
|
229
|
+
if (first) out.push(first);
|
|
230
|
+
}
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* SHAs git printed in the tool_result of a Bash call running `git commit`.
|
|
236
|
+
* A CLAIM only — the scheduler must check it against the run's own HEAD range.
|
|
237
|
+
* @param {any[]} events
|
|
238
|
+
* @returns {string[]}
|
|
239
|
+
*/
|
|
240
|
+
function collectCommitOutputShas(events) {
|
|
241
|
+
/** @type {Map<string, string>} */
|
|
242
|
+
const commitCmds = new Map();
|
|
243
|
+
for (const ev of events) {
|
|
244
|
+
if (ev.kind === 'tool_use' && ev.toolName === 'Bash' && ev.toolUseId
|
|
245
|
+
&& typeof ev.command === 'string' && GIT_COMMIT_CMD_RE.test(ev.command)) {
|
|
246
|
+
commitCmds.set(ev.toolUseId, ev.command);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/** @type {Set<string>} */
|
|
250
|
+
const shas = new Set();
|
|
251
|
+
if (commitCmds.size === 0) return [];
|
|
252
|
+
for (const ev of events) {
|
|
253
|
+
if (ev.kind !== 'tool_result') continue;
|
|
254
|
+
const cmd = commitCmds.get(ev.toolUseId);
|
|
255
|
+
if (cmd === undefined || typeof ev.content !== 'string') continue;
|
|
256
|
+
const subjects = commitMessageSubjects(cmd);
|
|
257
|
+
for (const raw of ev.content.split('\n')) {
|
|
258
|
+
const ln = raw.trim();
|
|
259
|
+
const m1 = COMMIT_SUMMARY_RE.exec(ln);
|
|
260
|
+
if (m1) { shas.add(m1[1].toLowerCase()); continue; }
|
|
261
|
+
const m2 = SHA_SUBJECT_RE.exec(ln);
|
|
262
|
+
if (m2) {
|
|
263
|
+
const subject = m2[2].trim();
|
|
264
|
+
if (subject.length >= 8 && subjects.includes(subject)) shas.add(m2[1].toLowerCase());
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return [...shas];
|
|
196
269
|
}
|
|
197
270
|
|
|
198
271
|
// Stable, narrow substrings of the harness's auto-background tool_result text
|
|
@@ -1060,6 +1133,7 @@ module.exports = {
|
|
|
1060
1133
|
isPolicyDenial,
|
|
1061
1134
|
checkDeps,
|
|
1062
1135
|
parseLog,
|
|
1136
|
+
commitMessageSubjects,
|
|
1063
1137
|
scanSentinel,
|
|
1064
1138
|
scanHaltLine,
|
|
1065
1139
|
scanSentinelReason,
|
|
@@ -473,6 +473,12 @@ function strandedCommitVerdict({ worktreeHead, landedCommit } = {}) {
|
|
|
473
473
|
* main checkout with concurrent jobs, so a HEAD move there may be someone else's
|
|
474
474
|
* integration — credit comes only from this run's own integration result. An
|
|
475
475
|
* in-place run keeps the HEAD-delta / time-window behaviour.
|
|
476
|
+
*
|
|
477
|
+
* `transcriptCommitShas` carries two evidence sources, unioned by the caller:
|
|
478
|
+
* the harness-reported commit shas (parseLog `transcriptCommitShas`) and the
|
|
479
|
+
* shas git printed for the run's own `git commit` call (parseLog
|
|
480
|
+
* `transcriptCommitOutputShas`). Both are claims: credit goes only to a commit
|
|
481
|
+
* inside `rangeCommits` (headBefore..headAtExit).
|
|
476
482
|
*/
|
|
477
483
|
function resolveRunCommitAttribution({
|
|
478
484
|
ranInWorktree, integratedSha, headBefore, headAtExit, committedInWindow,
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Record fields read (all optional): `release` (non-null object, as planReviewStore.recordPlanRelease writes it = released),
|
|
11
11
|
* `firstReviewAt` / `reviews[0].at` (hold start when a review exists).
|
|
12
|
+
* Hold-start fields, in order: review record, then validator row `queuedAt`
|
|
13
|
+
* (stamped at enqueue), `planReviewHeldAt`, `createdAt`.
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
const { bareSlug } = require('../lib/prd/depSlugResolve.cjs');
|
|
@@ -78,11 +80,15 @@ function isReleased(record) {
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
function holdStartMs(validateRow, record) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
const candidates = [
|
|
84
|
+
record?.firstReviewAt, record?.reviews?.[0]?.at,
|
|
85
|
+
validateRow?.queuedAt, validateRow?.planReviewHeldAt, validateRow?.createdAt,
|
|
86
|
+
];
|
|
87
|
+
for (const c of candidates) {
|
|
88
|
+
const t = Date.parse(c ?? '');
|
|
89
|
+
if (Number.isFinite(t)) return t;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
/**
|
|
@@ -322,6 +322,14 @@ async function resolveBareSlugFile(slug, cwd) {
|
|
|
322
322
|
* regular `.md` files are read. Never rejects. Returns Map<inputSlug, text>.
|
|
323
323
|
*/
|
|
324
324
|
async function readEpicPrdTexts(cwd, epicId, slugs) {
|
|
325
|
+
const files = await readEpicPrdFiles(cwd, epicId, slugs);
|
|
326
|
+
const out = new Map();
|
|
327
|
+
for (const [k, v] of files) out.set(k, v.text);
|
|
328
|
+
return out;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** Same lookup as readEpicPrdTexts, but Map<inputSlug, { text, path }> so path and text cannot disagree. */
|
|
332
|
+
async function readEpicPrdFiles(cwd, epicId, slugs) {
|
|
325
333
|
const out = new Map();
|
|
326
334
|
try {
|
|
327
335
|
if (typeof cwd !== 'string' || !cwd || !Array.isArray(slugs) || slugs.length === 0) return out;
|
|
@@ -360,7 +368,7 @@ async function readEpicPrdTexts(cwd, epicId, slugs) {
|
|
|
360
368
|
}
|
|
361
369
|
}
|
|
362
370
|
if (!file) continue;
|
|
363
|
-
try { out.set(slug, await fsp.readFile(file, 'utf8')); } catch { /* unreadable — no entry */ }
|
|
371
|
+
try { out.set(slug, { text: await fsp.readFile(file, 'utf8'), path: file }); } catch { /* unreadable — no entry */ }
|
|
364
372
|
}
|
|
365
373
|
} catch { /* never rejects */ }
|
|
366
374
|
return out;
|
|
@@ -622,6 +630,7 @@ module.exports = {
|
|
|
622
630
|
safeSlugPath,
|
|
623
631
|
resolveBareSlugFile,
|
|
624
632
|
readEpicPrdTexts,
|
|
633
|
+
readEpicPrdFiles,
|
|
625
634
|
resolveSlugOrReason,
|
|
626
635
|
jobMatchesSlugAndCwd,
|
|
627
636
|
unknownSlugMessage,
|