amsd-pipeline-shared 0.5.32 → 0.5.34
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.
|
@@ -74,7 +74,7 @@ async function handle(a) {
|
|
|
74
74
|
for (const f of profile.logs.evidence) fs.writeFileSync(path.join(ev, path.basename(f)), tail(path.join(runDir, f), profile.logs.evidenceTailLines));
|
|
75
75
|
|
|
76
76
|
const base = git(repo, 'rev-parse', 'HEAD').stdout.trim();
|
|
77
|
-
const branch = `${profile.branch.prefix}${runId}-${attempt.n}
|
|
77
|
+
const branch = freeBranch(repo, `${profile.branch.prefix}${runId}-${attempt.n}`);
|
|
78
78
|
const wt = path.join(A, 'wt');
|
|
79
79
|
const mk = git(repo, 'worktree', 'add', '-b', branch, wt, 'HEAD');
|
|
80
80
|
if (mk.status !== 0) return stop('worktree', `cannot make the repair's work tree: ${mk.stderr.trim()}`);
|
|
@@ -150,4 +150,12 @@ async function handle(a) {
|
|
|
150
150
|
} finally { git(repo, 'worktree', 'remove', '--force', wt); git(repo, 'worktree', 'prune'); }
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
/** The first branch name free in <repo>: <name>, else <name>-leg2, -leg3, … A run's next leg starts its attempts at 1 again, and an earlier
|
|
154
|
+
* leg's repair branch is that repair's evidence — never moved or deleted (2026-10-24: run 13's next leg stopped on "already exists"). */
|
|
155
|
+
function freeBranch(repo, name) {
|
|
156
|
+
const taken = (b) => git(repo, 'rev-parse', '--verify', '--quiet', `refs/heads/${b}`).status === 0;
|
|
157
|
+
if (!taken(name)) return name;
|
|
158
|
+
for (let k = 2; ; k += 1) if (!taken(`${name}-leg${k}`)) return `${name}-leg${k}`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = { handle, freeBranch };
|
|
@@ -143,7 +143,7 @@ function cache({ install, project, codeline, variant = process.env.EPAM_BROWNFIE
|
|
|
143
143
|
if (minted.length) problems.push(`minted files missing: ${minted.join(', ')}`);
|
|
144
144
|
const marker = path.join(O, 'projects', project, '.prompt-cache', `.complete-${codeline}${variant ? `.${variant}` : ''}`);
|
|
145
145
|
if (!fs.existsSync(marker)) problems.push(`no completion marker ${path.basename(marker)}`);
|
|
146
|
-
const list = b.provisioningList({ bootstrap: readJson(path.join(O, 'prompts', 'bootstrap.json'), {}), registry: readJson(path.join(O, 'agents', 'invocation-profiles.json'), {}), templateExists: (t) => fs.existsSync(tpl(t)) });
|
|
146
|
+
const list = b.provisioningList({ bootstrap: readJson(path.join(O, 'prompts', 'bootstrap.json'), {}), registry: readJson(path.join(O, 'agents', 'invocation-profiles.json'), {}), templateExists: (t) => fs.existsSync(tpl(t)), templatesDir: path.join(O, 'prompts', 'templates') });
|
|
147
147
|
const multi = (t) => Object.prototype.hasOwnProperty.call(readJson(tpl(t), {}), 'bodies');
|
|
148
148
|
const required = list.filter((i) => prompts.includes(i) && !multi(i));
|
|
149
149
|
const has = (i) => fs.existsSync(path.join(C, `${i}.json`)) || (variant && fs.existsSync(path.join(C, `${i}.${variant}.json`)));
|
|
@@ -448,7 +448,11 @@ function renderGeneratorPrompt({ generatorBody, template, projectContext, codeli
|
|
|
448
448
|
* @param {function} [o.templateExists] (id) => bool; defaults to assuming it does
|
|
449
449
|
* @returns {string[]} template ids needing a generated project copy
|
|
450
450
|
*/
|
|
451
|
-
function provisioningList({ bootstrap = {}, registry = {}, templateExists = () => true,
|
|
451
|
+
function provisioningList({ bootstrap = {}, registry = {}, templateExists = () => true, templatesDir = '' }) {
|
|
452
|
+
// THE THIRD KIND is read HERE, once, for every reader — the build, the inputs digest a recorded set is judged by, the pre-launch's
|
|
453
|
+
// check (2026-10-24: only the build read it, so a new one never made a set stale and its copy was never made)
|
|
454
|
+
const declaredProject = templatesDir && fs.existsSync(templatesDir) ? fs.readdirSync(templatesDir).filter((f) => f.endsWith('.json'))
|
|
455
|
+
.map((f) => { try { return readJson(path.join(templatesDir, f)); } catch { return null; } }).filter((t) => t && t.layer === 'project' && t.id).map((t) => t.id) : [];
|
|
452
456
|
const copyVerbatim = Array.isArray(bootstrap.copyVerbatim) ? bootstrap.copyVerbatim : [];
|
|
453
457
|
const aux = Array.isArray(bootstrap.generated) ? bootstrap.generated : [];
|
|
454
458
|
|
|
@@ -529,9 +533,7 @@ async function buildProjectPrompts({
|
|
|
529
533
|
generated = provisioningList({
|
|
530
534
|
bootstrap: boot,
|
|
531
535
|
registry: readJson(registryFile),
|
|
532
|
-
templateExists: (id) => fs.existsSync(path.join(templatesDir, `${id}.json`)),
|
|
533
|
-
declaredProject: fs.readdirSync(templatesDir).filter((f) => f.endsWith('.json'))
|
|
534
|
-
.map((f) => readJson(path.join(templatesDir, f))).filter((t) => t && t.layer === 'project' && t.id).map((t) => t.id),
|
|
536
|
+
templateExists: (id) => fs.existsSync(path.join(templatesDir, `${id}.json`)), templatesDir,
|
|
535
537
|
});
|
|
536
538
|
log(`[prompt-builder] ${generated.length} template(s) need a project copy `
|
|
537
539
|
+ '(seam-declared, plus bootstrap auxiliaries)');
|
|
@@ -1239,7 +1241,7 @@ function promptInputIds({ dir, registryFile }) {
|
|
|
1239
1241
|
const exists = (id) => fs.existsSync(path.join(dir, `${id}.json`));
|
|
1240
1242
|
const ids = new Set();
|
|
1241
1243
|
const copy = Array.isArray(boot.copyVerbatim) ? boot.copyVerbatim : [];
|
|
1242
|
-
for (const id of [...copy, ...provisioningList({ bootstrap: boot, registry, templateExists: exists })]) {
|
|
1244
|
+
for (const id of [...copy, ...provisioningList({ bootstrap: boot, registry, templateExists: exists, templatesDir: dir })]) {
|
|
1243
1245
|
ids.add(id);
|
|
1244
1246
|
ids.add(variantIdFor(id, exists));
|
|
1245
1247
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amsd-pipeline-shared",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.34",
|
|
4
4
|
"description": "The AMSD pipeline's shared components, one source for the bash pipeline and its Claude workflows: the model-call gateway (llm-handler.sh — retry, ladder, self-heal, cost) and the libraries it runs.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"bin": {
|