amsd-pipeline-shared 0.4.3 → 0.4.5

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/README.md CHANGED
@@ -12,8 +12,11 @@ workflows (`amsd-pipeline-workflow`). A fix lands here, once, and both run the s
12
12
  | The Spec runner | `orchestrations/scripts/spec-mode-runner.js` | A failed mint re-proposal keeps the accepted roles and says so |
13
13
  | The KB synthesiser | `orchestrations/scripts/lib/kb-synthesizer.js` | Runs on its own seam's model |
14
14
  | Agent-to-agent messages | `orchestrations/scripts/lib/agent-messages.js` | send / receive / list / route on the pipeline's own bus format (`logs/messages/`, `agent-messages.jsonl`); "router" goes to the stage's router |
15
+ | The shared pre-launch | `orchestrations/scripts/lib/prelaunch.js`, `lib/preflight.sh`, `preflight-check.sh`, `preflight-static.sh`, `preflight-prd-integrity.sh` | Every launch of every pipeline, before any model call: the pipeline's own pre-flight unchanged, then Langfuse (a trace read back under the run's session), seed (the seeded prompts and agent files are the launched ticket's), cache (both layers; at most `--max-rebuild` prompts to rebuild, named), cost (a priced ledger call; every ladder model priced), alone (nothing else on the install but its registered services), memory, no-timeout, and the 12-item checklist. `require_preflight` runs it for every bash launcher; `amsd-pipeline-shared prelaunch` for the workflows |
16
+ | Codeline discovery's instructions | `orchestrations/prompts/templates/codeline-discovery.json` | A repository's `reason` describes the repository and its relation to the others, never the work it needs — the classifier reads it as the codeline's description (backlog B59) |
17
+ | The price table | `orchestrations/config/model-pricing.json` | Claude Sonnet 5 and Opus 5.5 priced from Anthropic's pricing page, so a call whose session never reports a cost can still be priced |
15
18
 
16
- Every file sits at the path it has in a pipeline install. The first commit is the 35 gateway files exactly as released
19
+ Every file sits at the path it has in a pipeline install. Each file is first committed exactly as released
17
20
  in amsd-pipeline 2.0.80 (`docs/gateway-baseline-2.0.80.md5`); every change since is its own commit with its tests.
18
21
  `docs/CONSUMER-REVIEW-B56.md` reads every caller of the gateway before and after the fix.
19
22
 
@@ -34,6 +37,16 @@ with the list. The replaced copies are kept in `<install>/.amsd-pipeline-shared/
34
37
 
35
38
  Needs: Node 20+, bash, jq.
36
39
 
40
+ ## The pre-launch from the shell
41
+
42
+ ```bash
43
+ amsd-pipeline-shared prelaunch --install <install> --project <p> --run-id <id> --out <dir> \
44
+ [--ticket <KEY> --runs <a recorded run's runs dir>] [--codeline <cl>] [--set claude] [--max-rebuild <n>] [--prd <file>] [--preflight no]
45
+ ```
46
+
47
+ Prints every check and the 12-item checklist, writes `<out>/prelaunch.json`; exit 0 all green, 1 any red. Nothing it does
48
+ calls a model.
49
+
37
50
  ## Messages from the shell
38
51
 
39
52
  For the bash pipeline (backlog B55), one JSON line out:
@@ -35,12 +35,20 @@
35
35
  "outputPerMillion": 15
36
36
  },
37
37
  "claude-haiku-4-5": {
38
- "inputPerMillion": 0.8,
39
- "outputPerMillion": 4
38
+ "inputPerMillion": 1,
39
+ "outputPerMillion": 5,
40
+ "cacheReadPerMillion": 0.1,
41
+ "cacheWrite5mPerMillion": 1.25,
42
+ "cacheWrite1hPerMillion": 2,
43
+ "$why": "Checked against the vendor: https://platform.claude.com/docs/en/about-claude/pricing (read 2026-10-19) — $1 input / $5 output per MTok; cache $1.25 5-minute write, $2 1-hour write, $0.10 hit. Was $0.80/$4 (Haiku 3.5's price)."
40
44
  },
41
45
  "claude-haiku-4-5-20251001": {
42
- "inputPerMillion": 0.8,
43
- "outputPerMillion": 4
46
+ "inputPerMillion": 1,
47
+ "outputPerMillion": 5,
48
+ "cacheReadPerMillion": 0.1,
49
+ "cacheWrite5mPerMillion": 1.25,
50
+ "cacheWrite1hPerMillion": 2,
51
+ "$why": "Checked against the vendor: https://platform.claude.com/docs/en/about-claude/pricing (read 2026-10-19) — $1 input / $5 output per MTok; cache $1.25 5-minute write, $2 1-hour write, $0.10 hit. Was $0.80/$4 (Haiku 3.5's price)."
44
52
  },
45
53
  "claude-3-5-haiku-20241022": {
46
54
  "inputPerMillion": 0.8,
@@ -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.5",
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": {