amsd-pipeline-shared 0.4.3 → 0.4.4

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.
@@ -195,6 +195,13 @@ const cmdline = (pid, procDir = '/proc') => { try { return fs.readFileSync(`${pr
195
195
  function alone({ install, selfPid = process.pid, procDir = '/proc' }) {
196
196
  const mine = ancestors(selfPid, procDir);
197
197
  const inst = path.resolve(install);
198
+ // THE INSTALL'S OWN SERVICES are not another run: the services its installer registers, one pid file each
199
+ // (orchestrations/dashboards/.<name>.pid — snapshot-watch, cassette-watch), read from the install, never listed here.
200
+ // The pre-flight requires them running; a process running one of their scripts is that service (the pid recorded may be
201
+ // stale after a restart, so the script, not the pid, identifies it).
202
+ let services = [];
203
+ try { services = fs.readdirSync(path.join(orchOf(install), 'dashboards')).map((n) => (n.match(/^\.(.+)\.pid$/) || [])[1]).filter(Boolean).sort(); } catch { services = []; }
204
+ const isService = (s) => services.some((n) => s.includes(`${n}.js`));
198
205
  const others = [];
199
206
  let pids = []; try { pids = fs.readdirSync(procDir).filter((n) => /^\d+$/.test(n)); } catch { pids = []; }
200
207
  for (const p of pids) {
@@ -203,9 +210,9 @@ function alone({ install, selfPid = process.pid, procDir = '/proc' }) {
203
210
  const s = a.join(' ');
204
211
  let cwd = ''; try { cwd = fs.readlinkSync(`${procDir}/${p}/cwd`); } catch { cwd = ''; }
205
212
  // a pipeline process of THIS install: anything running its scripts or a run against it; my own shell is excluded above
206
- if ((s.includes(inst) || cwd.startsWith(inst)) && /\b(node|bash|sh|python3?|claude)\b/.test(a[0] + ' ' + (a[1] || ''))) others.push(`${p} ${s.slice(0, 140)}`);
213
+ if ((s.includes(inst) || cwd.startsWith(inst)) && /\b(node|bash|sh|python3?|claude)\b/.test(a[0] + ' ' + (a[1] || '')) && !isService(s)) others.push(`${p} ${s.slice(0, 140)}`);
207
214
  }
208
- return res('alone', !others.length, others.length ? `${others.length} other process(es) are working against ${inst}: ${others.slice(0, 3).join(' | ')}` : `nothing else is working against ${inst}`, { others });
215
+ return res('alone', !others.length, others.length ? `${others.length} other process(es) are working against ${inst}: ${others.slice(0, 3).join(' | ')}` : `nothing else is working against ${inst}${services.length ? ` (its own services not counted: ${services.join(', ')})` : ''}`, { others, services });
209
216
  }
210
217
 
211
218
  // ── 6. memory ────────────────────────────────────────────────────────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amsd-pipeline-shared",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
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": {