crewly 1.20.418 → 1.20.420
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/config/skills/agent/core/record-learning/SKILL.md +12 -1
- package/config/skills/agent/core/record-learning/execute.sh +24 -2
- package/config/skills/team-leader/decide-correction/SKILL.md +65 -0
- package/config/skills/team-leader/decide-correction/execute.sh +63 -0
- package/config/skills/team-leader/handle-failure/SKILL.md +2 -0
- package/config/skills/team-leader/handle-failure/execute.sh +18 -0
- package/dist/backend/backend/src/constants.d.ts +38 -3
- package/dist/backend/backend/src/constants.d.ts.map +1 -1
- package/dist/backend/backend/src/constants.js +38 -3
- package/dist/backend/backend/src/constants.js.map +1 -1
- package/dist/backend/backend/src/controllers/memory/memory.controller.d.ts +42 -2
- package/dist/backend/backend/src/controllers/memory/memory.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/memory/memory.controller.js +111 -4
- package/dist/backend/backend/src/controllers/memory/memory.controller.js.map +1 -1
- package/dist/backend/backend/src/controllers/memory/memory.routes.d.ts +3 -0
- package/dist/backend/backend/src/controllers/memory/memory.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/memory/memory.routes.js +7 -1
- package/dist/backend/backend/src/controllers/memory/memory.routes.js.map +1 -1
- package/dist/backend/backend/src/controllers/team/team-export.controller.d.ts +3 -2
- package/dist/backend/backend/src/controllers/team/team-export.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/team/team-export.controller.js +5 -3
- package/dist/backend/backend/src/controllers/team/team-export.controller.js.map +1 -1
- package/dist/backend/backend/src/index.d.ts.map +1 -1
- package/dist/backend/backend/src/index.js +25 -0
- package/dist/backend/backend/src/index.js.map +1 -1
- package/dist/backend/backend/src/services/core/team-export.service.d.ts +58 -2
- package/dist/backend/backend/src/services/core/team-export.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/core/team-export.service.js +88 -3
- package/dist/backend/backend/src/services/core/team-export.service.js.map +1 -1
- package/dist/backend/backend/src/services/memory/correction-ladder.service.d.ts +225 -0
- package/dist/backend/backend/src/services/memory/correction-ladder.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/memory/correction-ladder.service.js +335 -0
- package/dist/backend/backend/src/services/memory/correction-ladder.service.js.map +1 -0
- package/dist/backend/build-info.json +2 -2
- package/dist/cli/backend/src/constants.d.ts +38 -3
- package/dist/cli/backend/src/constants.d.ts.map +1 -1
- package/dist/cli/backend/src/constants.js +38 -3
- package/dist/cli/backend/src/constants.js.map +1 -1
- package/dist/cli/cli/src/commands/team-export.d.ts +18 -1
- package/dist/cli/cli/src/commands/team-export.d.ts.map +1 -1
- package/dist/cli/cli/src/commands/team-export.js +25 -3
- package/dist/cli/cli/src/commands/team-export.js.map +1 -1
- package/dist/cli/cli/src/index.js +1 -0
- package/dist/cli/cli/src/index.js.map +1 -1
- package/frontend/dist/assets/{index-b5c4b66c.js → index-d15d21a9.js} +112 -112
- package/frontend/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correction ladder (#810, specs/2026-10-25-correction-ladder.md).
|
|
3
|
+
*
|
|
4
|
+
* When an agent is corrected, the correction lands in memory, an SOP or a
|
|
5
|
+
* prompt: prose that is read every turn and still lets the same mistake
|
|
6
|
+
* back in. This service keeps a per-project tally of corrections by
|
|
7
|
+
* **class** (a short slug the recorder chooses, e.g. `git-add-all`) and,
|
|
8
|
+
* the second time a class is recorded, hands the project's team lead one
|
|
9
|
+
* WorkItem: "can this be made impossible or checked in code?" with the
|
|
10
|
+
* ladder as options —
|
|
11
|
+
*
|
|
12
|
+
* (a) structural / API change — the mistake can no longer be expressed
|
|
13
|
+
* (b) lint / test / CI check — it is caught before merge
|
|
14
|
+
* (c) state-triggered hook — it is caught when it happens
|
|
15
|
+
* (d) keep as prose, with a stated reason
|
|
16
|
+
*
|
|
17
|
+
* The WorkItem is deduplicated: one open item per class. The lead records
|
|
18
|
+
* the rung with `decide`; until then a third occurrence does not raise a
|
|
19
|
+
* second item. A decision of (d) is not final: when the prose did not
|
|
20
|
+
* stick (two more occurrences after it), the class is raised again. No LLM;
|
|
21
|
+
* a plain JSON store under the project's `.crewly/`.
|
|
22
|
+
*
|
|
23
|
+
* @module services/memory/correction-ladder.service
|
|
24
|
+
*/
|
|
25
|
+
import * as fs from 'fs/promises';
|
|
26
|
+
import * as path from 'path';
|
|
27
|
+
import { LoggerService } from '../core/logger.service.js';
|
|
28
|
+
import { CORRECTION_LADDER_CONSTANTS, ORCHESTRATOR_SESSION_NAME } from '../../constants.js';
|
|
29
|
+
import { atomicWriteJson, safeReadJson } from '../../utils/file-io.utils.js';
|
|
30
|
+
import { resolveProjectDataDir } from '../core/crewly-home.utils.js';
|
|
31
|
+
import { createWorkItem } from '../../types/v2/work-item.types.js';
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Helpers
|
|
34
|
+
// =============================================================================
|
|
35
|
+
/**
|
|
36
|
+
* Normalise a class to a slug: lower case, `a-z0-9-`, no leading/trailing
|
|
37
|
+
* or doubled dashes, at most `CLASS_MAX_CHARS`. Returns `null` when nothing
|
|
38
|
+
* usable is left.
|
|
39
|
+
*
|
|
40
|
+
* @param raw - What the recorder typed
|
|
41
|
+
* @returns The slug, or null
|
|
42
|
+
*/
|
|
43
|
+
export function normalizeCorrectionClass(raw) {
|
|
44
|
+
if (typeof raw !== 'string')
|
|
45
|
+
return null;
|
|
46
|
+
const slug = raw
|
|
47
|
+
.trim()
|
|
48
|
+
.toLowerCase()
|
|
49
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
50
|
+
.replace(/^-+|-+$/g, '')
|
|
51
|
+
.replace(/-{2,}/g, '-')
|
|
52
|
+
.slice(0, CORRECTION_LADDER_CONSTANTS.CLASS_MAX_CHARS)
|
|
53
|
+
.replace(/-+$/g, '');
|
|
54
|
+
return slug.length >= CORRECTION_LADDER_CONSTANTS.CLASS_MIN_CHARS ? slug : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Whether a string names a rung of the ladder.
|
|
58
|
+
*
|
|
59
|
+
* @param rung - Candidate
|
|
60
|
+
* @returns True for one of `RUNGS`
|
|
61
|
+
*/
|
|
62
|
+
export function isCorrectionRung(rung) {
|
|
63
|
+
return typeof rung === 'string' && CORRECTION_LADDER_CONSTANTS.RUNGS.includes(rung);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Where a project's ladder store lives.
|
|
67
|
+
*
|
|
68
|
+
* @param projectPath - Project root
|
|
69
|
+
* @returns `<project data dir>/correction-ladder.json`
|
|
70
|
+
*/
|
|
71
|
+
export function correctionLadderPath(projectPath) {
|
|
72
|
+
return path.join(resolveProjectDataDir(projectPath), CORRECTION_LADDER_CONSTANTS.STORE_FILE);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Occurrences recorded after the current decision (or all, when undecided).
|
|
76
|
+
*
|
|
77
|
+
* @param record - Class record
|
|
78
|
+
* @returns Count
|
|
79
|
+
*/
|
|
80
|
+
export function occurrencesSinceDecision(record) {
|
|
81
|
+
if (!record.decision)
|
|
82
|
+
return record.count;
|
|
83
|
+
const since = record.decision.decidedAt;
|
|
84
|
+
return record.occurrences.filter((o) => o.at > since).length;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The lead's WorkItem for a class: the tally, the recorded texts, the four
|
|
88
|
+
* rungs, and how to record the choice.
|
|
89
|
+
*
|
|
90
|
+
* @param record - Class record (after the occurrence that raised it)
|
|
91
|
+
* @param projectPath - Project root
|
|
92
|
+
* @param target - Lead (or orchestrator) session
|
|
93
|
+
* @param again - Whether an earlier (d) did not hold
|
|
94
|
+
* @returns The WorkItem to add to the pool
|
|
95
|
+
*/
|
|
96
|
+
export function buildCorrectionWorkItem(record, projectPath, target, again) {
|
|
97
|
+
const c = record.class;
|
|
98
|
+
const recent = record.occurrences.slice(-CORRECTION_LADDER_CONSTANTS.OCCURRENCES_IN_BRIEF);
|
|
99
|
+
const lines = [
|
|
100
|
+
`# Correction ladder — \`${c}\`${again ? ' (again)' : ''}`,
|
|
101
|
+
'',
|
|
102
|
+
`Project: \`${projectPath}\``,
|
|
103
|
+
`Recorded ${record.count} time${record.count === 1 ? '' : 's'}; first ${record.firstAt.slice(0, 10)}, last ${record.lastAt.slice(0, 10)}.`,
|
|
104
|
+
'',
|
|
105
|
+
];
|
|
106
|
+
if (again && record.previousDecisions.length) {
|
|
107
|
+
const prev = record.previousDecisions[record.previousDecisions.length - 1];
|
|
108
|
+
lines.push(`An earlier decision kept this as prose (${prev.decidedAt.slice(0, 10)}: "${prev.reason}") and the mistake came back ${occurrencesSinceDecision({ ...record, decision: prev })} more times. Prose did not hold; pick a higher rung or say why prose is still right.`, '');
|
|
109
|
+
}
|
|
110
|
+
lines.push('## What was recorded', '');
|
|
111
|
+
for (const o of recent)
|
|
112
|
+
lines.push(`- ${o.at.slice(0, 10)} · ${o.agentId} · ${o.source}${o.relatedTask ? ` · ${o.relatedTask}` : ''}: ${o.text}`);
|
|
113
|
+
lines.push('', '## The question', '', 'The same class of mistake has come back. Prose (memory, SOP, prompt) is read every turn and still let it through. Decide which rung makes it stop, highest feasible first:', '', '- **structural** — change the API, type or file layout so the mistake can no longer be expressed.', '- **check** — a lint rule, test or CI step that fails before merge.', '- **hook** — a state-triggered hook or skill guard that catches it the moment it happens.', '- **prose** — keep it as memory/SOP text, with the reason why nothing above is worth it.', '', 'Do the work for the rung you pick (or open the PR / ticket for it), then record the choice:', '', '```bash', `bash {{SKILLS_PATH}}/team-leader/decide-correction/execute.sh --project "${projectPath}" --class ${c} --rung <structural|check|hook|prose> --reason "<why this rung>" [--link <PR, file or rule>]`, '```', '', 'This WorkItem counts as done only when the choice is recorded. The owner is not involved; never post this in the owner\'s thread.');
|
|
114
|
+
return createWorkItem({
|
|
115
|
+
type: 'delegate',
|
|
116
|
+
owner: target === ORCHESTRATOR_SESSION_NAME ? 'orchestrator' : 'team_lead',
|
|
117
|
+
target,
|
|
118
|
+
title: `Correction ladder: "${c}" came back (${record.count}×)${again ? ' — prose did not hold' : ''}`,
|
|
119
|
+
description: `The correction class "${c}" was recorded ${record.count} times in ${projectPath}. Decide whether it can be made impossible (structural), caught by a check, caught by a hook, or must stay prose — and record the choice with decide-correction.`,
|
|
120
|
+
briefMarkdown: lines.join('\n'),
|
|
121
|
+
maxRetries: 1,
|
|
122
|
+
metadata: {
|
|
123
|
+
kind: CORRECTION_LADDER_CONSTANTS.WORKITEM_KIND,
|
|
124
|
+
correctionClass: c,
|
|
125
|
+
projectPath,
|
|
126
|
+
count: record.count,
|
|
127
|
+
again,
|
|
128
|
+
autoCreated: true,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// Service
|
|
134
|
+
// =============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Per-project tally of correction classes with one ladder WorkItem per
|
|
137
|
+
* class for the team lead.
|
|
138
|
+
*/
|
|
139
|
+
export class CorrectionLadderService {
|
|
140
|
+
static instance = null;
|
|
141
|
+
logger;
|
|
142
|
+
pool;
|
|
143
|
+
resolveTarget;
|
|
144
|
+
isTargetAwake;
|
|
145
|
+
fallbackTarget;
|
|
146
|
+
now;
|
|
147
|
+
/** Serialises writes per store file */
|
|
148
|
+
locks = new Map();
|
|
149
|
+
/**
|
|
150
|
+
* @param options - Wiring (pool, lead resolver, wake check)
|
|
151
|
+
*/
|
|
152
|
+
constructor(options = {}) {
|
|
153
|
+
this.logger = LoggerService.getInstance().createComponentLogger('CorrectionLadder');
|
|
154
|
+
this.pool = options.pool;
|
|
155
|
+
this.resolveTarget = options.resolveTarget;
|
|
156
|
+
this.isTargetAwake = options.isTargetAwake;
|
|
157
|
+
this.fallbackTarget = options.fallbackTarget ?? ORCHESTRATOR_SESSION_NAME;
|
|
158
|
+
this.now = options.now ?? (() => Date.now());
|
|
159
|
+
}
|
|
160
|
+
/** The wired instance (an unwired one records and never raises). */
|
|
161
|
+
static getInstance() {
|
|
162
|
+
if (!this.instance)
|
|
163
|
+
this.instance = new CorrectionLadderService();
|
|
164
|
+
return this.instance;
|
|
165
|
+
}
|
|
166
|
+
/** Install the wired instance (boot) or reset (tests). */
|
|
167
|
+
static setInstance(instance) {
|
|
168
|
+
this.instance = instance;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Record one correction of a class and, on the second occurrence (or the
|
|
172
|
+
* second after a (d) that did not hold), raise the lead's WorkItem.
|
|
173
|
+
*
|
|
174
|
+
* @param input - Class, who, what, where
|
|
175
|
+
* @returns The class record and whether a WorkItem was raised
|
|
176
|
+
* @throws Error when the class normalises to nothing or the text is empty
|
|
177
|
+
*/
|
|
178
|
+
async record(input) {
|
|
179
|
+
const cls = normalizeCorrectionClass(input.correctionClass);
|
|
180
|
+
if (!cls)
|
|
181
|
+
throw new Error(`Correction class "${String(input.correctionClass)}" has no letters or digits to make a slug from`);
|
|
182
|
+
const text = (input.text ?? '').trim();
|
|
183
|
+
if (!text)
|
|
184
|
+
throw new Error('A correction needs the text that was recorded');
|
|
185
|
+
return this.withLock(input.projectPath, async () => {
|
|
186
|
+
const store = await this.read(input.projectPath);
|
|
187
|
+
const at = new Date(this.now()).toISOString();
|
|
188
|
+
const existing = store.classes[cls];
|
|
189
|
+
const occurrence = {
|
|
190
|
+
at,
|
|
191
|
+
agentId: input.agentId,
|
|
192
|
+
source: input.source,
|
|
193
|
+
text: text.slice(0, CORRECTION_LADDER_CONSTANTS.OCCURRENCE_TEXT_MAX_CHARS),
|
|
194
|
+
...(input.relatedTask ? { relatedTask: input.relatedTask } : {}),
|
|
195
|
+
};
|
|
196
|
+
const record = existing
|
|
197
|
+
? {
|
|
198
|
+
...existing,
|
|
199
|
+
count: existing.count + 1,
|
|
200
|
+
lastAt: at,
|
|
201
|
+
occurrences: [...existing.occurrences, occurrence].slice(-CORRECTION_LADDER_CONSTANTS.MAX_OCCURRENCES_KEPT),
|
|
202
|
+
}
|
|
203
|
+
: { class: cls, count: 1, firstAt: at, lastAt: at, occurrences: [occurrence], workItemId: null, workItemAt: null, decision: null, previousDecisions: [] };
|
|
204
|
+
store.classes[cls] = record;
|
|
205
|
+
const raise = await this.maybeRaise(record, input.projectPath);
|
|
206
|
+
await this.write(input.projectPath, store);
|
|
207
|
+
if (raise.raised) {
|
|
208
|
+
this.logger.info('Correction class raised to the team lead', { projectPath: input.projectPath, class: cls, count: record.count, target: raise.target, workItemId: raise.workItemId });
|
|
209
|
+
}
|
|
210
|
+
return { record, ...raise };
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Record the lead's choice for a class and close the ladder for it.
|
|
215
|
+
*
|
|
216
|
+
* @param input - Class, rung, reason, who
|
|
217
|
+
* @returns The updated record
|
|
218
|
+
* @throws Error for an unknown class, an unknown rung or an empty reason
|
|
219
|
+
*/
|
|
220
|
+
async decide(input) {
|
|
221
|
+
const cls = normalizeCorrectionClass(input.correctionClass);
|
|
222
|
+
if (!cls)
|
|
223
|
+
throw new Error(`Correction class "${String(input.correctionClass)}" is not a slug`);
|
|
224
|
+
const rung = input.rung;
|
|
225
|
+
if (!isCorrectionRung(rung))
|
|
226
|
+
throw new Error(`Unknown rung "${String(rung)}" — one of ${CORRECTION_LADDER_CONSTANTS.RUNGS.join(', ')}`);
|
|
227
|
+
const reason = (input.reason ?? '').trim();
|
|
228
|
+
if (!reason)
|
|
229
|
+
throw new Error('A decision needs a reason, for every rung');
|
|
230
|
+
return this.withLock(input.projectPath, async () => {
|
|
231
|
+
const store = await this.read(input.projectPath);
|
|
232
|
+
const record = store.classes[cls];
|
|
233
|
+
if (!record)
|
|
234
|
+
throw new Error(`No correction class "${cls}" recorded in ${input.projectPath}`);
|
|
235
|
+
const decision = {
|
|
236
|
+
rung,
|
|
237
|
+
reason,
|
|
238
|
+
...(input.link?.trim() ? { link: input.link.trim() } : {}),
|
|
239
|
+
decidedBy: input.decidedBy,
|
|
240
|
+
decidedAt: new Date(this.now()).toISOString(),
|
|
241
|
+
};
|
|
242
|
+
const updated = { ...record, decision, workItemId: null, workItemAt: null };
|
|
243
|
+
store.classes[cls] = updated;
|
|
244
|
+
await this.write(input.projectPath, store);
|
|
245
|
+
this.logger.info('Correction class decided', { projectPath: input.projectPath, class: cls, rung: decision.rung, decidedBy: input.decidedBy });
|
|
246
|
+
return updated;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Every class of a project, most recorded first.
|
|
251
|
+
*
|
|
252
|
+
* @param projectPath - Project root
|
|
253
|
+
* @returns Records
|
|
254
|
+
*/
|
|
255
|
+
async list(projectPath) {
|
|
256
|
+
const store = await this.read(projectPath);
|
|
257
|
+
return Object.values(store.classes).sort((a, b) => b.count - a.count || a.class.localeCompare(b.class));
|
|
258
|
+
}
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
/**
|
|
261
|
+
* Raise the lead's WorkItem when the class has earned it: `THRESHOLD`
|
|
262
|
+
* occurrences with no decision and no open item, or `THRESHOLD`
|
|
263
|
+
* occurrences after a (d) decision. An open item older than
|
|
264
|
+
* `REOPEN_AFTER_MS` with no decision counts as abandoned and is replaced.
|
|
265
|
+
*/
|
|
266
|
+
async maybeRaise(record, projectPath) {
|
|
267
|
+
const since = occurrencesSinceDecision(record);
|
|
268
|
+
const again = record.decision?.rung === 'prose';
|
|
269
|
+
if (record.decision && !again)
|
|
270
|
+
return { raised: false, skipped: 'decided' };
|
|
271
|
+
if (since < CORRECTION_LADDER_CONSTANTS.THRESHOLD)
|
|
272
|
+
return { raised: false, skipped: 'below_threshold' };
|
|
273
|
+
if (record.workItemId) {
|
|
274
|
+
const age = record.workItemAt ? this.now() - Date.parse(record.workItemAt) : 0;
|
|
275
|
+
if (age < CORRECTION_LADDER_CONSTANTS.REOPEN_AFTER_MS)
|
|
276
|
+
return { raised: false, skipped: 'already_raised', workItemId: record.workItemId };
|
|
277
|
+
this.logger.warn('Correction ladder WorkItem never decided; raising again', { projectPath, class: record.class, workItemId: record.workItemId });
|
|
278
|
+
}
|
|
279
|
+
if (!this.pool)
|
|
280
|
+
return { raised: false, skipped: 'no_pool' };
|
|
281
|
+
const target = (await this.targetFor(projectPath)) ?? this.fallbackTarget;
|
|
282
|
+
if (!(await this.targetAwake(target)))
|
|
283
|
+
return { raised: false, skipped: 'target_dormant', target };
|
|
284
|
+
if (again && record.decision) {
|
|
285
|
+
record.previousDecisions = [...record.previousDecisions, record.decision];
|
|
286
|
+
record.decision = null;
|
|
287
|
+
}
|
|
288
|
+
const wi = buildCorrectionWorkItem(record, projectPath, target, again);
|
|
289
|
+
await this.pool.addToPool(wi);
|
|
290
|
+
record.workItemId = wi.id;
|
|
291
|
+
record.workItemAt = new Date(this.now()).toISOString();
|
|
292
|
+
return { raised: true, workItemId: wi.id, target };
|
|
293
|
+
}
|
|
294
|
+
/** The lead for a project; errors count as "no lead". */
|
|
295
|
+
async targetFor(projectPath) {
|
|
296
|
+
if (!this.resolveTarget)
|
|
297
|
+
return null;
|
|
298
|
+
try {
|
|
299
|
+
return await this.resolveTarget(projectPath);
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/** Errors count as dormant: a chore is never worth risking a wake. */
|
|
306
|
+
async targetAwake(target) {
|
|
307
|
+
if (!this.isTargetAwake)
|
|
308
|
+
return true;
|
|
309
|
+
try {
|
|
310
|
+
return await this.isTargetAwake(target);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
async read(projectPath) {
|
|
317
|
+
const data = await safeReadJson(correctionLadderPath(projectPath), null);
|
|
318
|
+
const classes = data && typeof data.classes === 'object' && data.classes ? data.classes : {};
|
|
319
|
+
return { version: 1, classes: { ...classes } };
|
|
320
|
+
}
|
|
321
|
+
async write(projectPath, store) {
|
|
322
|
+
const file = correctionLadderPath(projectPath);
|
|
323
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
324
|
+
await atomicWriteJson(file, store);
|
|
325
|
+
}
|
|
326
|
+
/** Run `fn` after every earlier operation on the same project's store. */
|
|
327
|
+
withLock(projectPath, fn) {
|
|
328
|
+
const key = path.resolve(projectPath);
|
|
329
|
+
const prev = this.locks.get(key) ?? Promise.resolve();
|
|
330
|
+
const next = prev.then(fn, fn);
|
|
331
|
+
this.locks.set(key, next.catch(() => undefined));
|
|
332
|
+
return next;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=correction-ladder.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correction-ladder.service.js","sourceRoot":"","sources":["../../../../../../backend/src/services/memory/correction-ladder.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAwB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAiB,MAAM,mCAAmC,CAAC;AAiHlF,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAY;IACnD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,IAAI,GAAG,GAAG;SACb,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAA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AI,OAAO,CAAC,OAAO,EAAE,CAAC;QACtD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC"}
|
|
@@ -2181,6 +2181,31 @@ export declare const WIKI_GAPS_CONSTANTS: {
|
|
|
2181
2181
|
/** Session that authors the page. */
|
|
2182
2182
|
readonly CALLER_SESSION: "system:wiki-knowledge-gaps";
|
|
2183
2183
|
};
|
|
2184
|
+
/**
|
|
2185
|
+
* Correction ladder (#810): repeated corrections of one class become a
|
|
2186
|
+
* team-lead WorkItem asking for a check in code instead of more prose.
|
|
2187
|
+
*/
|
|
2188
|
+
export declare const CORRECTION_LADDER_CONSTANTS: {
|
|
2189
|
+
/** Per-project store, under the project data dir */
|
|
2190
|
+
readonly STORE_FILE: "correction-ladder.json";
|
|
2191
|
+
/** Occurrences of a class (or after a prose decision) that raise the lead's WorkItem */
|
|
2192
|
+
readonly THRESHOLD: 2;
|
|
2193
|
+
/** An undecided WorkItem older than this is treated as abandoned and raised again */
|
|
2194
|
+
readonly REOPEN_AFTER_MS: number;
|
|
2195
|
+
/** The rungs, highest first: make it impossible → catch before merge → catch when it happens → tell them again */
|
|
2196
|
+
readonly RUNGS: readonly ["structural", "check", "hook", "prose"];
|
|
2197
|
+
/** Class slug bounds */
|
|
2198
|
+
readonly CLASS_MIN_CHARS: 2;
|
|
2199
|
+
readonly CLASS_MAX_CHARS: 48;
|
|
2200
|
+
/** Occurrences kept per class (newest) */
|
|
2201
|
+
readonly MAX_OCCURRENCES_KEPT: 20;
|
|
2202
|
+
/** Occurrences quoted in the lead's brief */
|
|
2203
|
+
readonly OCCURRENCES_IN_BRIEF: 5;
|
|
2204
|
+
/** Correction text kept per occurrence */
|
|
2205
|
+
readonly OCCURRENCE_TEXT_MAX_CHARS: 400;
|
|
2206
|
+
/** WorkItem `metadata.kind` */
|
|
2207
|
+
readonly WORKITEM_KIND: "correction-ladder";
|
|
2208
|
+
};
|
|
2184
2209
|
/**
|
|
2185
2210
|
* Daily agent-memory refresh (#1345): what an agent recorded in the wiki
|
|
2186
2211
|
* log is reflected into its `memory.json` and the project's memory.
|
|
@@ -9789,10 +9814,20 @@ export declare const ACTIVITY_LOG_CONSTANTS: {
|
|
|
9789
9814
|
* importer knows what to reconnect.
|
|
9790
9815
|
*/
|
|
9791
9816
|
export declare const TEAM_EXPORT_CONSTANTS: {
|
|
9792
|
-
/** Format version written by this release */
|
|
9793
|
-
readonly VERSION: "1.
|
|
9817
|
+
/** Format version written by this release (1.2 added the optional wiki) */
|
|
9818
|
+
readonly VERSION: "1.2";
|
|
9794
9819
|
/** Versions `importTeam` accepts */
|
|
9795
|
-
readonly SUPPORTED_VERSIONS: readonly ["1.0", "1.1"];
|
|
9820
|
+
readonly SUPPORTED_VERSIONS: readonly ["1.0", "1.1", "1.2"];
|
|
9821
|
+
/** Folder of a team's wiki vault inside its team directory */
|
|
9822
|
+
readonly WIKI_DIR: "wiki";
|
|
9823
|
+
/** Only these vault files travel: knowledge pages, never ledgers or compile state */
|
|
9824
|
+
readonly WIKI_PAGE_EXTENSION: ".md";
|
|
9825
|
+
/** A wiki page larger than this is listed as skipped, not packaged */
|
|
9826
|
+
readonly WIKI_MAX_PAGE_BYTES: number;
|
|
9827
|
+
/** Once packaged pages reach this many bytes, the rest are listed as skipped */
|
|
9828
|
+
readonly WIKI_MAX_TOTAL_BYTES: number;
|
|
9829
|
+
/** A packaged page path: vault-relative, `.md`, no dot segments, no traversal */
|
|
9830
|
+
readonly WIKI_PAGE_PATH_PATTERN: RegExp;
|
|
9796
9831
|
/** Member fields that describe this install's running agent, never the team */
|
|
9797
9832
|
readonly RUNTIME_MEMBER_FIELDS: readonly ["agentId", "currentTickets", "readyAt", "loginRequired", "usageLimited", "runtimeOverride", "capabilities", "lastActivityCheck"];
|
|
9798
9833
|
/** Connector id → words in prompts / skill ids / schedules that mean the team uses it */
|