amsd-pipeline-shared 0.4.1 → 0.4.3

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.
@@ -1,3 +1,4 @@
1
+ 33364f057aa890497019737c7004db57 config/model-pricing.json
1
2
  6b83e0d700392eebdd1bae1ec233ab26 prompts/templates/codeline-discovery.json
2
3
  b2470a21b73b03abb95713f05acaa827 scripts/agent-attempt-analyst.sh
3
4
  c45cda62ef52ee95c8de6acead3408f8 scripts/lib/agent-contract.js
@@ -1,3 +1,4 @@
1
+ config/model-pricing.json
1
2
  prompts/templates/codeline-discovery.json
2
3
  scripts/agent-attempt-analyst.sh
3
4
  scripts/lib/agent-contract.js
@@ -0,0 +1,282 @@
1
+ {
2
+ "$comment": "Model prices in USD per 1M tokens. EDIT THIS FILE to update a price — no code change and no rebuild. Update asOf when you check them against the providers. Used by the CLI cost display; the pipeline ledger records what the provider itself reports. A model with null prices is a KNOWN unknown: present so the gap is visible, never filled with a guess.",
3
+ "asOf": "2026-08",
4
+ "models": {
5
+ "claude-opus-4-6": {
6
+ "inputPerMillion": 15,
7
+ "outputPerMillion": 75
8
+ },
9
+ "claude-opus-4-5": {
10
+ "inputPerMillion": 15,
11
+ "outputPerMillion": 75
12
+ },
13
+ "claude-opus-4-6-fast": {
14
+ "inputPerMillion": 15,
15
+ "outputPerMillion": 75
16
+ },
17
+ "claude-sonnet-4-6": {
18
+ "inputPerMillion": 3,
19
+ "outputPerMillion": 15
20
+ },
21
+ "claude-sonnet-4-5": {
22
+ "inputPerMillion": 3,
23
+ "outputPerMillion": 15
24
+ },
25
+ "claude-sonnet-4": {
26
+ "inputPerMillion": 3,
27
+ "outputPerMillion": 15
28
+ },
29
+ "claude-3-7-sonnet-20250219": {
30
+ "inputPerMillion": 3,
31
+ "outputPerMillion": 15
32
+ },
33
+ "claude-3-5-sonnet-20241022": {
34
+ "inputPerMillion": 3,
35
+ "outputPerMillion": 15
36
+ },
37
+ "claude-haiku-4-5": {
38
+ "inputPerMillion": 0.8,
39
+ "outputPerMillion": 4
40
+ },
41
+ "claude-haiku-4-5-20251001": {
42
+ "inputPerMillion": 0.8,
43
+ "outputPerMillion": 4
44
+ },
45
+ "claude-3-5-haiku-20241022": {
46
+ "inputPerMillion": 0.8,
47
+ "outputPerMillion": 4
48
+ },
49
+ "gpt-4o": {
50
+ "inputPerMillion": 2.5,
51
+ "outputPerMillion": 10
52
+ },
53
+ "gpt-4o-mini": {
54
+ "inputPerMillion": 0.15,
55
+ "outputPerMillion": 0.6
56
+ },
57
+ "gpt-4-turbo": {
58
+ "inputPerMillion": 10,
59
+ "outputPerMillion": 30
60
+ },
61
+ "gpt-4.1": {
62
+ "inputPerMillion": 2,
63
+ "outputPerMillion": 8
64
+ },
65
+ "gpt-4.1-mini": {
66
+ "inputPerMillion": 0.4,
67
+ "outputPerMillion": 1.6
68
+ },
69
+ "gpt-4.1-nano": {
70
+ "inputPerMillion": 0.1,
71
+ "outputPerMillion": 0.4
72
+ },
73
+ "gpt-5": {
74
+ "inputPerMillion": 10,
75
+ "outputPerMillion": 40
76
+ },
77
+ "gpt-5-mini": {
78
+ "inputPerMillion": 0.15,
79
+ "outputPerMillion": 0.6
80
+ },
81
+ "o1": {
82
+ "inputPerMillion": 15,
83
+ "outputPerMillion": 60
84
+ },
85
+ "o1-mini": {
86
+ "inputPerMillion": 3,
87
+ "outputPerMillion": 12
88
+ },
89
+ "o3": {
90
+ "inputPerMillion": 10,
91
+ "outputPerMillion": 40
92
+ },
93
+ "o3-mini": {
94
+ "inputPerMillion": 1.1,
95
+ "outputPerMillion": 4.4
96
+ },
97
+ "o4-mini": {
98
+ "inputPerMillion": 1.1,
99
+ "outputPerMillion": 4.4
100
+ },
101
+ "gpt-5-codex": {
102
+ "inputPerMillion": 0,
103
+ "outputPerMillion": 0
104
+ },
105
+ "gpt-5.1": {
106
+ "inputPerMillion": 0,
107
+ "outputPerMillion": 0
108
+ },
109
+ "gpt-5.1-codex": {
110
+ "inputPerMillion": 0,
111
+ "outputPerMillion": 0
112
+ },
113
+ "gpt-5.1-codex-max": {
114
+ "inputPerMillion": 0,
115
+ "outputPerMillion": 0
116
+ },
117
+ "gpt-5.1-codex-mini": {
118
+ "inputPerMillion": 0,
119
+ "outputPerMillion": 0
120
+ },
121
+ "gpt-5.2": {
122
+ "inputPerMillion": 0,
123
+ "outputPerMillion": 0
124
+ },
125
+ "gpt-5.2-codex": {
126
+ "inputPerMillion": 0,
127
+ "outputPerMillion": 0
128
+ },
129
+ "gpt-5.3-codex": {
130
+ "inputPerMillion": 0,
131
+ "outputPerMillion": 0
132
+ },
133
+ "gemini-2.5-pro": {
134
+ "inputPerMillion": 1.25,
135
+ "outputPerMillion": 5
136
+ },
137
+ "gemini-2.5-flash": {
138
+ "inputPerMillion": 0.15,
139
+ "outputPerMillion": 0.6
140
+ },
141
+ "gemini-2.0-flash": {
142
+ "inputPerMillion": 0.1,
143
+ "outputPerMillion": 0.4
144
+ },
145
+ "gemini-2.0-flash-lite": {
146
+ "inputPerMillion": 0.075,
147
+ "outputPerMillion": 0.3
148
+ },
149
+ "gemini-2.0-flash-thinking": {
150
+ "inputPerMillion": 0.15,
151
+ "outputPerMillion": 0.6
152
+ },
153
+ "gemini-1.5-pro": {
154
+ "inputPerMillion": 1.25,
155
+ "outputPerMillion": 5
156
+ },
157
+ "gemini-1.5-flash": {
158
+ "inputPerMillion": 0.075,
159
+ "outputPerMillion": 0.3
160
+ },
161
+ "gemini-1.5-flash-8b": {
162
+ "inputPerMillion": 0.0375,
163
+ "outputPerMillion": 0.15
164
+ },
165
+ "gemini-3-pro-preview": {
166
+ "inputPerMillion": 1.25,
167
+ "outputPerMillion": 5
168
+ },
169
+ "deepseek/deepseek-r1": {
170
+ "inputPerMillion": 0.55,
171
+ "outputPerMillion": 2.19
172
+ },
173
+ "deepseek/deepseek-chat": {
174
+ "inputPerMillion": 0.27,
175
+ "outputPerMillion": 1.1
176
+ },
177
+ "meta-llama/llama-3.3-70b-instruct": {
178
+ "inputPerMillion": 0.12,
179
+ "outputPerMillion": 0.12
180
+ },
181
+ "meta-llama/llama-4-scout": {
182
+ "inputPerMillion": 0.17,
183
+ "outputPerMillion": 0.17
184
+ },
185
+ "mistral/mistral-large-2411": {
186
+ "inputPerMillion": 2,
187
+ "outputPerMillion": 6
188
+ },
189
+ "mistral/mistral-small-3.1": {
190
+ "inputPerMillion": 0.1,
191
+ "outputPerMillion": 0.3
192
+ },
193
+ "moonshotai/kimi-k2": {
194
+ "inputPerMillion": 0.57,
195
+ "outputPerMillion": 2.3
196
+ },
197
+ "z-ai/glm-5.2": {
198
+ "inputPerMillion": 0.93,
199
+ "outputPerMillion": 3
200
+ },
201
+ "z-ai/glm-5.1": {
202
+ "inputPerMillion": 0.966,
203
+ "outputPerMillion": 3.036
204
+ },
205
+ "z-ai/glm-4.7": {
206
+ "inputPerMillion": 0.4,
207
+ "outputPerMillion": 1.75
208
+ },
209
+ "MiniMax-M3": {
210
+ "inputPerMillion": 0.3,
211
+ "outputPerMillion": 1.2,
212
+ "standardTierMaxInputTokens": 524288
213
+ },
214
+ "MiniMax-M2.7": {
215
+ "inputPerMillion": 0.25,
216
+ "outputPerMillion": 1
217
+ },
218
+ "MiniMax-M2.7-highspeed": {
219
+ "inputPerMillion": 0.6,
220
+ "outputPerMillion": 2.4
221
+ },
222
+ "MiniMax-M2.5": {
223
+ "inputPerMillion": 0.15,
224
+ "outputPerMillion": 0.9
225
+ },
226
+ "MiniMax-M2.1": {
227
+ "inputPerMillion": 0.29,
228
+ "outputPerMillion": 0.95
229
+ },
230
+ "MiniMax-M2": {
231
+ "inputPerMillion": 0.26,
232
+ "outputPerMillion": 1
233
+ },
234
+ "zhipuai/glm-z1-9b": {
235
+ "inputPerMillion": null,
236
+ "outputPerMillion": null,
237
+ "note": "PRICE NOT CHECKED. Listed because a configured ladder can escalate to this model. Left null deliberately rather than guessed — an invented price is worse than a visible gap."
238
+ },
239
+ "zhipuai/glm-z1-32b": {
240
+ "inputPerMillion": null,
241
+ "outputPerMillion": null,
242
+ "note": "PRICE NOT CHECKED. Listed because a configured ladder can escalate to this model. Left null deliberately rather than guessed — an invented price is worse than a visible gap."
243
+ },
244
+ "moonshotai/kimi-k2.5": {
245
+ "inputPerMillion": null,
246
+ "outputPerMillion": null,
247
+ "note": "PRICE NOT CHECKED. Listed because a configured ladder can escalate to this model. Left null deliberately rather than guessed — an invented price is worse than a visible gap."
248
+ },
249
+ "moonshotai/kimi-k3": {
250
+ "inputPerMillion": null,
251
+ "outputPerMillion": null,
252
+ "note": "PRICE NOT CHECKED. Listed because a configured ladder can escalate to this model. Left null deliberately rather than guessed — an invented price is worse than a visible gap."
253
+ },
254
+ "claude-sonnet-5": {
255
+ "inputPerMillion": 2,
256
+ "outputPerMillion": 10,
257
+ "cacheReadPerMillion": 0.2,
258
+ "cacheWrite5mPerMillion": 2.5,
259
+ "cacheWrite1hPerMillion": 4,
260
+ "$why": "Checked against the vendor: https://platform.claude.com/docs/en/about-claude/pricing (read 2026-10-19) — $2 input / $10 output per MTok, the standard price (the launch price, kept; the scheduled rise to $3/$15 will not occur). Cache: $2.50 5-minute write, $4 1-hour write, $0.20 hit."
261
+ },
262
+ "claude-opus-5": {
263
+ "inputPerMillion": null,
264
+ "outputPerMillion": null,
265
+ "$why": "On a declared ladder rung but not yet checked against the vendor. Null is a KNOWN unknown per this file: a guessed price is worse than a visible gap."
266
+ },
267
+ "claude-opus-5-5": {
268
+ "inputPerMillion": 4,
269
+ "outputPerMillion": 20,
270
+ "cacheReadPerMillion": 0.2,
271
+ "cacheWrite5mPerMillion": 5,
272
+ "cacheWrite1hPerMillion": 8,
273
+ "$why": "Checked against the vendor: https://platform.claude.com/docs/en/about-claude/pricing (read 2026-10-19) — $4 input / $20 output per MTok. Cache: $5 5-minute write, $8 1-hour write, $0.20 hit (0.05x base)."
274
+ },
275
+ "claude-opus-4-8": {
276
+ "inputPerMillion": null,
277
+ "outputPerMillion": null,
278
+ "$why": "On a declared ladder rung but not yet checked against the vendor. Null is a KNOWN unknown per this file: a guessed price is worse than a visible gap."
279
+ }
280
+ },
281
+ "$tierComment": "standardTierMaxInputTokens: largest per-REQUEST input still billed at the base rate. MiniMax-M3 doubles above 512K (to a 1M ceiling). Absent means UNCAPPED for that model, never a default — a ceiling we invented would throttle a model whose real limit is higher. Add one only when checked against the vendor's published tiers."
282
+ }
@@ -122,7 +122,9 @@ function seed({ install, project, ticket, runsRoots }) {
122
122
  * list, less the templates it installs as they are (copyVerbatim, and multi-body templates), present in the cached set.
123
123
  * An entry is <cache>/<id>.json, or <id>.<variant>.json for a variant run (brownfield).
124
124
  */
125
- function cache({ install, project, codeline, variant = process.env.EPAM_BROWNFIELD === '1' ? 'brownfield' : '' }) {
125
+ // maxRebuild: how many generated prompts without an entry the launch accepts rebuilding (operator, 2026-10-19: a short,
126
+ // NAMED list is acceptable). The launch states it (--max-rebuild); unstated it is 0 — every prompt must be reusable.
127
+ function cache({ install, project, codeline, variant = process.env.EPAM_BROWNFIELD === '1' ? 'brownfield' : '', maxRebuild = 0 }) {
126
128
  const O = orchOf(install);
127
129
  const C = path.join(O, 'projects', project, '.prompt-cache', codeline);
128
130
  const b = require(path.join(scriptsOf(install), 'lib', 'project-prompt-builder.js'));
@@ -139,9 +141,10 @@ function cache({ install, project, codeline, variant = process.env.EPAM_BROWNFIE
139
141
  const required = list.filter((i) => prompts.includes(i) && !multi(i));
140
142
  const has = (i) => fs.existsSync(path.join(C, `${i}.json`)) || (variant && fs.existsSync(path.join(C, `${i}.${variant}.json`)));
141
143
  const missing = required.filter((i) => !has(i));
142
- if (missing.length) problems.push(`${missing.length} of ${required.length} generated prompt(s) have no per-prompt entry, so any template change rebuilds them all (${missing.slice(0, 5).join(', ')}${missing.length > 5 ? ', …' : ''})`);
143
- return res('cache', !problems.length, problems.length ? problems.join('; ') : `${codeline}: ${prompts.length} cached prompt(s), ${b.MINTED_FILES.length} minted file(s), ${required.length} per-prompt entries, marker present`,
144
- { required: required.length, missing });
144
+ if (missing.length > Number(maxRebuild || 0)) problems.push(`${missing.length} of ${required.length} generated prompt(s) have no per-prompt entry and would be rebuilt (paid), above the launch's limit of ${Number(maxRebuild || 0)}: ${missing.join(', ')}`);
145
+ const rebuild = missing.length ? `; ${missing.length} without an entry will be rebuilt (within the launch's limit of ${maxRebuild}): ${missing.join(', ')}` : '';
146
+ return res('cache', !problems.length, problems.length ? problems.join('; ') : `${codeline}: ${prompts.length} cached prompt(s), ${b.MINTED_FILES.length} minted file(s), ${required.length - missing.length} of ${required.length} per-prompt entries, marker present${rebuild}`,
147
+ { required: required.length, missing, willRebuild: problems.length ? [] : missing });
145
148
  }
146
149
 
147
150
  // ── 4. cost ──────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -257,7 +260,7 @@ function prelaunch(o) {
257
260
  results.push(langfuse({ install: o.install, env: o.env, runId: o.runId, outDir: o.outDir }));
258
261
  if (o.ticket) results.push(seed({ install: o.install, project: o.project, ticket: o.ticket, runsRoots: o.runsRoots || [] }));
259
262
  // the variant (brownfield) is the run's, from the env the launch hands over — not this process's own environment
260
- if (o.codeline) results.push(cache({ install: o.install, project: o.project, codeline: o.codeline, variant: (o.env || {}).EPAM_BROWNFIELD === '1' ? 'brownfield' : '' }));
263
+ if (o.codeline) results.push(cache({ install: o.install, project: o.project, codeline: o.codeline, variant: (o.env || {}).EPAM_BROWNFIELD === '1' ? 'brownfield' : '', maxRebuild: o.maxRebuild || 0 }));
261
264
  results.push(cost({ install: o.install, set: o.set || o.env.EPAM_PROVIDER_SET || 'claude', tmpDir: o.outDir }));
262
265
  results.push(alone({ install: o.install }));
263
266
  results.push(memory({ needMb: Number(o.needMb || 4096) }));
@@ -276,7 +279,7 @@ module.exports = { prelaunch, prelaunchCli, preflight, langfuse, langfuseEnv, se
276
279
  * THE COMMAND, for every pipeline:
277
280
  * prelaunch.js --install <i> --project <p> --run-id <id> --out <dir> [--ticket <KEY> --runs <runs dir>[,…]]
278
281
  * [--codeline <cl>] [--set <provider set>] [--need-mb <n>] [--leg-timeout-secs <s>] [--runner <launcher>]
279
- * [--prd <file>] [--preflight no]
282
+ * [--prd <file>] [--preflight no] [--max-rebuild <n prompts the launch accepts rebuilding>]
280
283
  * Prints each check and the verdict; writes <out>/prelaunch.json; exit 0 all green, 1 any red, 64 usage.
281
284
  */
282
285
  function prelaunchCli(argv, env = process.env) {
@@ -284,7 +287,7 @@ function prelaunchCli(argv, env = process.env) {
284
287
  for (const k of ['install', 'project', 'run-id', 'out']) if (!a[k]) { process.stderr.write(`prelaunch: --${k} is required\n`); return 64; }
285
288
  const r = prelaunch({ install: path.resolve(a.install), project: a.project, runId: a['run-id'], outDir: path.resolve(a.out), env,
286
289
  ticket: a.ticket, runsRoots: a.runs ? a.runs.split(',').map((d) => path.resolve(d)) : [], codeline: a.codeline,
287
- set: a.set, needMb: a['need-mb'], legTimeoutSecs: a['leg-timeout-secs'], runner: a.runner, prd: a.prd, preflight: a.preflight !== 'no' });
290
+ set: a.set, needMb: a['need-mb'], maxRebuild: Number(a['max-rebuild'] || 0), legTimeoutSecs: a['leg-timeout-secs'], runner: a.runner, prd: a.prd, preflight: a.preflight !== 'no' });
288
291
  process.stdout.write('── Pre-launch (amsd-pipeline-shared) ─────────────────────────────────────────\n');
289
292
  for (const c of r.results) process.stdout.write(` ${c.ok ? '✓' : '✗'} ${c.name}: ${c.detail}\n`);
290
293
  const cl = r.results.find((c) => c.name === 'checklist');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amsd-pipeline-shared",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
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": {