@netgreener/runtime 0.1.13 → 0.1.15

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.
@@ -0,0 +1,617 @@
1
+ {
2
+ "version": 1,
3
+ "scenarios": [
4
+ {
5
+ "name": "token_boundary",
6
+ "providers": [
7
+ {
8
+ "provider_key": "openai",
9
+ "calls": 2,
10
+ "input_tokens": 1000,
11
+ "output_tokens": 500,
12
+ "calls_with_usage": 2
13
+ }
14
+ ],
15
+ "budgets": {
16
+ "max_total_tokens": 1500
17
+ },
18
+ "passed": true,
19
+ "catalog": []
20
+ },
21
+ {
22
+ "name": "token_exceeded",
23
+ "providers": [
24
+ {
25
+ "provider_key": "openai",
26
+ "calls": 2,
27
+ "input_tokens": 1000,
28
+ "output_tokens": 500,
29
+ "calls_with_usage": 2
30
+ }
31
+ ],
32
+ "budgets": {
33
+ "max_total_tokens": 1499
34
+ },
35
+ "passed": false,
36
+ "catalog": []
37
+ },
38
+ {
39
+ "name": "input_exceeded",
40
+ "providers": [
41
+ {
42
+ "provider_key": "openai",
43
+ "calls": 2,
44
+ "input_tokens": 1000,
45
+ "output_tokens": 500,
46
+ "calls_with_usage": 2
47
+ }
48
+ ],
49
+ "budgets": {
50
+ "max_input_tokens": 999
51
+ },
52
+ "passed": false,
53
+ "catalog": []
54
+ },
55
+ {
56
+ "name": "output_boundary",
57
+ "providers": [
58
+ {
59
+ "provider_key": "openai",
60
+ "calls": 2,
61
+ "input_tokens": 1000,
62
+ "output_tokens": 500,
63
+ "calls_with_usage": 2
64
+ }
65
+ ],
66
+ "budgets": {
67
+ "max_output_tokens": 500
68
+ },
69
+ "passed": true,
70
+ "catalog": []
71
+ },
72
+ {
73
+ "name": "calls_boundary",
74
+ "providers": [
75
+ {
76
+ "provider_key": "openai",
77
+ "calls": 2,
78
+ "input_tokens": 1000,
79
+ "output_tokens": 500,
80
+ "calls_with_usage": 2
81
+ }
82
+ ],
83
+ "budgets": {
84
+ "max_external_api_calls": 2
85
+ },
86
+ "passed": true,
87
+ "catalog": []
88
+ },
89
+ {
90
+ "name": "zero_call_budget",
91
+ "providers": [
92
+ {
93
+ "provider_key": "openai",
94
+ "calls": 2,
95
+ "input_tokens": 1000,
96
+ "output_tokens": 500,
97
+ "calls_with_usage": 2
98
+ }
99
+ ],
100
+ "budgets": {
101
+ "max_external_api_calls": 0
102
+ },
103
+ "passed": false,
104
+ "catalog": []
105
+ },
106
+ {
107
+ "name": "cost_boundary",
108
+ "providers": [
109
+ {
110
+ "provider_key": "openai",
111
+ "calls": 2,
112
+ "input_tokens": 1000,
113
+ "output_tokens": 500,
114
+ "calls_with_usage": 2
115
+ }
116
+ ],
117
+ "budgets": {
118
+ "max_external_cost_usd": 0.02
119
+ },
120
+ "passed": true,
121
+ "catalog": [
122
+ {
123
+ "provider_key": "openai",
124
+ "category": "llm",
125
+ "cost_per_call_usd": 0.01,
126
+ "cost_per_1k_input_tokens_usd": 0.01,
127
+ "cost_per_1k_output_tokens_usd": 0.02
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "name": "cost_exceeded",
133
+ "providers": [
134
+ {
135
+ "provider_key": "openai",
136
+ "calls": 2,
137
+ "input_tokens": 1000,
138
+ "output_tokens": 500,
139
+ "calls_with_usage": 2
140
+ }
141
+ ],
142
+ "budgets": {
143
+ "max_external_cost_usd": 0.019
144
+ },
145
+ "passed": false,
146
+ "catalog": [
147
+ {
148
+ "provider_key": "openai",
149
+ "category": "llm",
150
+ "cost_per_call_usd": 0.01,
151
+ "cost_per_1k_input_tokens_usd": 0.01,
152
+ "cost_per_1k_output_tokens_usd": 0.02
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "name": "missing_telemetry",
158
+ "providers": null,
159
+ "budgets": {
160
+ "max_total_tokens": 9999
161
+ },
162
+ "passed": false,
163
+ "catalog": []
164
+ },
165
+ {
166
+ "name": "empty_telemetry",
167
+ "providers": [],
168
+ "budgets": {
169
+ "max_external_api_calls": 5
170
+ },
171
+ "passed": false,
172
+ "catalog": []
173
+ },
174
+ {
175
+ "name": "partial_token_coverage",
176
+ "providers": [
177
+ {
178
+ "provider_key": "openai",
179
+ "calls": 2,
180
+ "input_tokens": 1000,
181
+ "output_tokens": 500,
182
+ "calls_with_usage": 1
183
+ }
184
+ ],
185
+ "budgets": {
186
+ "max_total_tokens": 9999
187
+ },
188
+ "passed": false,
189
+ "catalog": []
190
+ },
191
+ {
192
+ "name": "legacy_coverage_unknown",
193
+ "providers": [
194
+ {
195
+ "provider_key": "openai",
196
+ "calls": 2,
197
+ "input_tokens": 1000,
198
+ "output_tokens": 500
199
+ }
200
+ ],
201
+ "budgets": {
202
+ "max_total_tokens": 9999
203
+ },
204
+ "passed": false,
205
+ "catalog": []
206
+ },
207
+ {
208
+ "name": "calls_do_not_require_tokens",
209
+ "providers": [
210
+ {
211
+ "provider_key": "openai",
212
+ "calls": 2
213
+ }
214
+ ],
215
+ "budgets": {
216
+ "max_external_api_calls": 2
217
+ },
218
+ "passed": true,
219
+ "catalog": []
220
+ },
221
+ {
222
+ "name": "missing_usage_cost",
223
+ "providers": [
224
+ {
225
+ "provider_key": "openai",
226
+ "calls": 2
227
+ }
228
+ ],
229
+ "budgets": {
230
+ "max_external_cost_usd": 999
231
+ },
232
+ "passed": false,
233
+ "catalog": [
234
+ {
235
+ "provider_key": "openai",
236
+ "category": "llm",
237
+ "cost_per_call_usd": 0.01,
238
+ "cost_per_1k_input_tokens_usd": 0.01,
239
+ "cost_per_1k_output_tokens_usd": 0.02
240
+ }
241
+ ]
242
+ },
243
+ {
244
+ "name": "unpriced_vendor",
245
+ "providers": [
246
+ {
247
+ "provider_key": "new.example",
248
+ "calls": 1
249
+ }
250
+ ],
251
+ "budgets": {
252
+ "max_external_cost_usd": 999
253
+ },
254
+ "passed": false,
255
+ "catalog": []
256
+ },
257
+ {
258
+ "name": "ocr_calls",
259
+ "providers": [
260
+ {
261
+ "provider_key": "aws_textract",
262
+ "calls": 3
263
+ }
264
+ ],
265
+ "budgets": {
266
+ "max_external_api_calls": 3,
267
+ "external_provider": "aws_textract"
268
+ },
269
+ "passed": true,
270
+ "catalog": []
271
+ },
272
+ {
273
+ "name": "ocr_cost",
274
+ "providers": [
275
+ {
276
+ "provider_key": "aws_textract",
277
+ "calls": 3
278
+ }
279
+ ],
280
+ "budgets": {
281
+ "max_external_cost_usd": 0.0045
282
+ },
283
+ "passed": true,
284
+ "catalog": []
285
+ },
286
+ {
287
+ "name": "ocr_does_not_need_tokens",
288
+ "providers": [
289
+ {
290
+ "provider_key": "aws_textract",
291
+ "calls": 3
292
+ },
293
+ {
294
+ "provider_key": "openai",
295
+ "calls": 2,
296
+ "input_tokens": 1000,
297
+ "output_tokens": 500,
298
+ "calls_with_usage": 2
299
+ }
300
+ ],
301
+ "budgets": {
302
+ "max_total_tokens": 1500
303
+ },
304
+ "passed": true,
305
+ "catalog": []
306
+ },
307
+ {
308
+ "name": "filter_provider",
309
+ "providers": [
310
+ {
311
+ "provider_key": "aws_textract",
312
+ "calls": 3
313
+ },
314
+ {
315
+ "provider_key": "openai",
316
+ "calls": 2,
317
+ "input_tokens": 1000,
318
+ "output_tokens": 500,
319
+ "calls_with_usage": 2
320
+ }
321
+ ],
322
+ "budgets": {
323
+ "max_external_api_calls": 2,
324
+ "external_provider": "openai"
325
+ },
326
+ "passed": true,
327
+ "catalog": []
328
+ },
329
+ {
330
+ "name": "missing_provider",
331
+ "providers": [
332
+ {
333
+ "provider_key": "openai",
334
+ "calls": 2,
335
+ "input_tokens": 1000,
336
+ "output_tokens": 500,
337
+ "calls_with_usage": 2
338
+ }
339
+ ],
340
+ "budgets": {
341
+ "max_external_api_calls": 99,
342
+ "external_provider": "aws_textract"
343
+ },
344
+ "passed": false,
345
+ "catalog": []
346
+ },
347
+ {
348
+ "name": "model_not_double_counted",
349
+ "providers": [
350
+ {
351
+ "provider_key": "openai",
352
+ "calls": 2,
353
+ "input_tokens": 1000,
354
+ "output_tokens": 500,
355
+ "calls_with_usage": 2,
356
+ "by_model": [
357
+ {
358
+ "model": "test-model",
359
+ "calls": 2,
360
+ "input_tokens": 1000,
361
+ "output_tokens": 500,
362
+ "calls_with_usage": 2
363
+ }
364
+ ]
365
+ }
366
+ ],
367
+ "budgets": {
368
+ "max_total_tokens": 1500,
369
+ "max_external_api_calls": 2,
370
+ "max_external_cost_usd": 0.02
371
+ },
372
+ "passed": true,
373
+ "catalog": [
374
+ {
375
+ "provider_key": "openai",
376
+ "category": "llm",
377
+ "cost_per_call_usd": 0.01,
378
+ "cost_per_1k_input_tokens_usd": 0.01,
379
+ "cost_per_1k_output_tokens_usd": 0.02
380
+ }
381
+ ]
382
+ },
383
+ {
384
+ "name": "model_override",
385
+ "providers": [
386
+ {
387
+ "provider_key": "openai",
388
+ "calls": 2,
389
+ "input_tokens": 1000,
390
+ "output_tokens": 500,
391
+ "calls_with_usage": 2,
392
+ "by_model": [
393
+ {
394
+ "model": "test-model",
395
+ "calls": 2,
396
+ "input_tokens": 1000,
397
+ "output_tokens": 500,
398
+ "calls_with_usage": 2
399
+ }
400
+ ]
401
+ }
402
+ ],
403
+ "budgets": {
404
+ "max_external_cost_usd": 0.002
405
+ },
406
+ "passed": true,
407
+ "catalog": [
408
+ {
409
+ "provider_key": "openai",
410
+ "category": "llm",
411
+ "cost_per_call_usd": 0.01,
412
+ "cost_per_1k_input_tokens_usd": 0.01,
413
+ "cost_per_1k_output_tokens_usd": 0.02
414
+ },
415
+ {
416
+ "provider_key": "openai::test-model",
417
+ "category": "llm",
418
+ "cost_per_call_usd": 0.01,
419
+ "cost_per_1k_input_tokens_usd": 0.001,
420
+ "cost_per_1k_output_tokens_usd": 0.002
421
+ }
422
+ ]
423
+ },
424
+ {
425
+ "name": "unrounded_small_cost",
426
+ "providers": [
427
+ {
428
+ "provider_key": "aws_textract",
429
+ "calls": 1
430
+ }
431
+ ],
432
+ "budgets": {
433
+ "max_external_cost_usd": 0
434
+ },
435
+ "passed": false,
436
+ "catalog": [
437
+ {
438
+ "provider_key": "aws_textract",
439
+ "category": "document_ai",
440
+ "cost_per_call_usd": 1e-06
441
+ }
442
+ ]
443
+ },
444
+ {
445
+ "name": "invalid_counter",
446
+ "providers": [
447
+ {
448
+ "provider_key": "openai",
449
+ "calls": -1,
450
+ "input_tokens": 1000,
451
+ "output_tokens": 500,
452
+ "calls_with_usage": 2
453
+ }
454
+ ],
455
+ "budgets": {
456
+ "max_external_api_calls": 99
457
+ },
458
+ "passed": false,
459
+ "catalog": []
460
+ },
461
+ {
462
+ "name": "invalid_counter_type",
463
+ "providers": [
464
+ {
465
+ "provider_key": "openai",
466
+ "calls": "bad",
467
+ "input_tokens": 1000,
468
+ "output_tokens": 500,
469
+ "calls_with_usage": 2
470
+ }
471
+ ],
472
+ "budgets": {
473
+ "max_external_api_calls": 99
474
+ },
475
+ "passed": false,
476
+ "catalog": []
477
+ },
478
+ {
479
+ "name": "interrupted",
480
+ "providers": [
481
+ {
482
+ "provider_key": "openai",
483
+ "calls": 2,
484
+ "input_tokens": 1000,
485
+ "output_tokens": 500,
486
+ "calls_with_usage": 2
487
+ }
488
+ ],
489
+ "budgets": {
490
+ "max_total_tokens": 9999
491
+ },
492
+ "passed": false,
493
+ "catalog": [],
494
+ "interrupted": true
495
+ },
496
+ {
497
+ "name": "model_residual_pricing",
498
+ "providers": [
499
+ {
500
+ "provider_key": "openai",
501
+ "calls": 2,
502
+ "input_tokens": 1000,
503
+ "output_tokens": 500,
504
+ "calls_with_usage": 2,
505
+ "by_model": [
506
+ {
507
+ "model": "test-model",
508
+ "calls": 1,
509
+ "input_tokens": 300,
510
+ "output_tokens": 200,
511
+ "calls_with_usage": 1
512
+ }
513
+ ]
514
+ }
515
+ ],
516
+ "budgets": {
517
+ "max_external_cost_usd": 0.0137,
518
+ "max_external_api_calls": 2
519
+ },
520
+ "passed": true,
521
+ "catalog": [
522
+ {
523
+ "provider_key": "openai",
524
+ "category": "llm",
525
+ "cost_per_call_usd": 0.01,
526
+ "cost_per_1k_input_tokens_usd": 0.01,
527
+ "cost_per_1k_output_tokens_usd": 0.02
528
+ },
529
+ {
530
+ "provider_key": "openai::test-model",
531
+ "category": "llm",
532
+ "cost_per_call_usd": 0.01,
533
+ "cost_per_1k_input_tokens_usd": 0.001,
534
+ "cost_per_1k_output_tokens_usd": 0.002
535
+ }
536
+ ]
537
+ },
538
+ {
539
+ "name": "filter_model",
540
+ "providers": [
541
+ {
542
+ "provider_key": "openai",
543
+ "calls": 2,
544
+ "input_tokens": 1000,
545
+ "output_tokens": 500,
546
+ "calls_with_usage": 2,
547
+ "by_model": [
548
+ {
549
+ "model": "test-model",
550
+ "calls": 1,
551
+ "input_tokens": 300,
552
+ "output_tokens": 200,
553
+ "calls_with_usage": 1
554
+ }
555
+ ]
556
+ }
557
+ ],
558
+ "budgets": {
559
+ "external_provider": "openai::test-model",
560
+ "max_total_tokens": 500,
561
+ "max_external_api_calls": 1
562
+ },
563
+ "passed": true,
564
+ "catalog": []
565
+ },
566
+ {
567
+ "name": "zero_price_is_unknown",
568
+ "providers": [
569
+ {
570
+ "provider_key": "openai",
571
+ "calls": 2,
572
+ "input_tokens": 1000,
573
+ "output_tokens": 500,
574
+ "calls_with_usage": 2
575
+ }
576
+ ],
577
+ "budgets": {
578
+ "max_external_cost_usd": 10
579
+ },
580
+ "passed": false,
581
+ "catalog": [
582
+ {
583
+ "provider_key": "openai",
584
+ "category": "llm",
585
+ "cost_per_call_usd": 0,
586
+ "cost_per_1k_input_tokens_usd": 0,
587
+ "cost_per_1k_output_tokens_usd": 0
588
+ }
589
+ ]
590
+ },
591
+ {
592
+ "name": "invalid_model_coverage",
593
+ "providers": [
594
+ {
595
+ "provider_key": "openai",
596
+ "calls": 2,
597
+ "input_tokens": 1000,
598
+ "output_tokens": 500,
599
+ "calls_with_usage": 2,
600
+ "by_model": [
601
+ {
602
+ "model": "test-model",
603
+ "calls": 2,
604
+ "input_tokens": 1000,
605
+ "output_tokens": 500
606
+ }
607
+ ]
608
+ }
609
+ ],
610
+ "budgets": {
611
+ "max_total_tokens": 9999
612
+ },
613
+ "passed": false,
614
+ "catalog": []
615
+ }
616
+ ]
617
+ }
@@ -0,0 +1,14 @@
1
+ [
2
+ {"name":"Vercel production deployment", "env":{"VERCEL_ENV":"production","VERCEL_DEPLOYMENT_ID":"dpl_one","VERCEL_URL":"app-one.vercel.app","VERCEL_GIT_COMMIT_SHA":"same-commit"}, "expected":{"release_tag":"vercel:dpl_one","deploy_id":"dpl_one","git_sha":"same-commit","deploy_environment":"prod"}},
3
+ {"name":"Vercel redeploy of the same commit", "env":{"VERCEL_ENV":"production","VERCEL_DEPLOYMENT_ID":"dpl_two","VERCEL_GIT_COMMIT_SHA":"same-commit"}, "expected":{"release_tag":"vercel:dpl_two","deploy_id":"dpl_two","git_sha":"same-commit","deploy_environment":"prod"}},
4
+ {"name":"Vercel preview without Git", "env":{"VERCEL_ENV":"preview","VERCEL_URL":"app-preview-123.vercel.app"}, "expected":{"release_tag":"vercel:app-preview-123.vercel.app","deploy_id":"app-preview-123.vercel.app","git_sha":null,"deploy_environment":"staging"}},
5
+ {"name":"Vercel development", "env":{"VERCEL_ENV":"development"}, "expected":{"release_tag":null,"deploy_id":null,"git_sha":null,"deploy_environment":"dev"}},
6
+ {"name":"Stable project and branch URLs are not releases", "env":{"VERCEL_PROJECT_PRODUCTION_URL":"app.example.com","VERCEL_BRANCH_URL":"app-main.vercel.app"}, "expected":{"release_tag":null,"deploy_id":null,"git_sha":null}},
7
+ {"name":"Explicit runtime settings win", "env":{"NETGREENER_RELEASE_TAG":"v4","NETGREENER_GIT_SHA":"override-sha","NETGREENER_DEPLOY_ID":"override-id","NETGREENER_DEPLOY_ENVIRONMENT":"staging","VERCEL_ENV":"production","VERCEL_DEPLOYMENT_ID":"dpl_ignored","VERCEL_GIT_COMMIT_SHA":"ignored"}, "expected":{"release_tag":"v4","deploy_id":"override-id","git_sha":"override-sha","deploy_environment":"staging"}},
8
+ {"name":"Existing context wins", "context":{"release_tag":"existing","git_sha":"saved-sha","deploy_id":"saved-id","deploy_environment":"staging"}, "env":{"VERCEL_ENV":"production","VERCEL_DEPLOYMENT_ID":"dpl_ignored","VERCEL_GIT_COMMIT_SHA":"ignored"}, "expected":{"release_tag":"existing","deploy_id":"saved-id","git_sha":"saved-sha","deploy_environment":"staging"}},
9
+ {"name":"Azure named release", "env":{"RELEASE_RELEASENAME":"Release-42","RELEASE_RELEASEID":"42","RELEASE_DEPLOYMENTID":"99","BUILD_BUILDNUMBER":"artifact-build","BUILD_SOURCEVERSION":"azure-sha","NETGREENER_ENV":"prod"}, "expected":{"release_tag":"Release-42","deploy_id":"99","git_sha":"azure-sha","deploy_environment":"prod"}},
10
+ {"name":"Azure release ID without Git", "env":{"RELEASE_RELEASEID":"43","RELEASE_DEPLOYMENTID":"100","DEPLOY_ENV":"staging"}, "expected":{"release_tag":"azure:43","deploy_id":"100","git_sha":null,"deploy_environment":"staging"}},
11
+ {"name":"Azure deployment ID only", "env":{"RELEASE_DEPLOYMENTID":"101"}, "expected":{"release_tag":"azure:101","deploy_id":"101","git_sha":null}},
12
+ {"name":"Azure build metadata remains supported", "env":{"BUILD_BUILDNUMBER":"2026.10.24.1","BUILD_BUILDID":"77","BUILD_SOURCEVERSION":"build-sha"}, "expected":{"release_tag":"2026.10.24.1","deploy_id":"77","git_sha":"build-sha"}},
13
+ {"name":"Blank platform values do not create identities", "env":{"VERCEL_DEPLOYMENT_ID":" ","VERCEL_URL":" ","RELEASE_RELEASEID":" "}, "expected":{"release_tag":null,"deploy_id":null,"git_sha":null}}
14
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netgreener/runtime",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "NetGreener Node.js Runtime — Express/Fastify/Nest/Next/process adapter uploading RunSessions to api_server.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",