@netgreener/runtime 0.1.9 → 0.1.10
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/CHANGELOG.md +12 -0
- package/dist/externalApiMeter.d.ts +8 -1
- package/dist/externalApiMeter.js +112 -21
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/mcpToolMeter.d.ts +101 -0
- package/dist/mcpToolMeter.js +496 -0
- package/dist/next.d.ts +28 -0
- package/dist/next.js +143 -10
- package/dist/nextConfig.d.ts +34 -0
- package/dist/nextConfig.js +73 -0
- package/dist/nextEntryTransform.d.ts +9 -0
- package/dist/nextEntryTransform.js +181 -0
- package/dist/runtime.d.ts +8 -1
- package/dist/runtime.js +51 -6
- package/dist/types.d.ts +8 -0
- package/examples/azure-functions-gate/.funcignore +6 -0
- package/examples/azure-functions-gate/README.md +25 -0
- package/examples/azure-functions-gate/host.json +15 -0
- package/examples/azure-functions-gate/package-lock.json +161 -0
- package/examples/azure-functions-gate/package.json +14 -0
- package/examples/azure-functions-gate/src/functions/health.js +27 -0
- package/loaders/next-entry-loader.cjs +14 -0
- package/package.json +3 -1
package/dist/types.d.ts
CHANGED
|
@@ -78,6 +78,8 @@ export type ExternalApiModelBucket = {
|
|
|
78
78
|
calls: number;
|
|
79
79
|
errors: number;
|
|
80
80
|
calls_with_usage?: number;
|
|
81
|
+
/** Calls seen with no provider usage. Not a per-call price. */
|
|
82
|
+
calls_unknown?: number;
|
|
81
83
|
input_tokens?: number;
|
|
82
84
|
output_tokens?: number;
|
|
83
85
|
total_tokens?: number;
|
|
@@ -87,6 +89,8 @@ export type ExternalApiProvider = {
|
|
|
87
89
|
calls: number;
|
|
88
90
|
errors: number;
|
|
89
91
|
calls_with_usage?: number;
|
|
92
|
+
/** Calls seen with no provider usage. Not a per-call price. */
|
|
93
|
+
calls_unknown?: number;
|
|
90
94
|
duration_ms_avg?: number;
|
|
91
95
|
hosts?: string[];
|
|
92
96
|
input_tokens?: number;
|
|
@@ -161,6 +165,10 @@ export type RuntimeSessionMetadata = {
|
|
|
161
165
|
run_context?: RunContext;
|
|
162
166
|
service_runtime_v0?: ServiceRuntimeV0;
|
|
163
167
|
external_api_v0?: ExternalApiV0;
|
|
168
|
+
/** Same-process MCP tool series. Not an API cost and not a second bill. */
|
|
169
|
+
mcp_tool_v0?: Record<string, unknown>;
|
|
170
|
+
/** Wall time beside MCP and HTTP durations. Overlap is marked, not stacked. */
|
|
171
|
+
mcp_latency_v0?: Record<string, unknown>;
|
|
164
172
|
measurement_provenance?: MeasurementProvenance;
|
|
165
173
|
[key: string]: unknown;
|
|
166
174
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Azure Functions gate (isolated)
|
|
2
|
+
|
|
3
|
+
Isolated serverless-thin dogfood for `CHK-R6.serverless-degraded`.
|
|
4
|
+
|
|
5
|
+
**Does not** touch existing NetGreener prod resources. Create under
|
|
6
|
+
`rg-ng-runtime-gate-test` only. Env secrets live in
|
|
7
|
+
`../../.env.azure-test-servers` (gitignored).
|
|
8
|
+
|
|
9
|
+
## Deployed app (example)
|
|
10
|
+
|
|
11
|
+
- Function App: `fn-ng-runtime-gate-20261014`
|
|
12
|
+
- URL: `https://fn-ng-runtime-gate-20261014.azurewebsites.net/api/health`
|
|
13
|
+
|
|
14
|
+
## Local publish
|
|
15
|
+
|
|
16
|
+
```powershell
|
|
17
|
+
npm install
|
|
18
|
+
func azure functionapp publish fn-ng-runtime-gate-20261014 --javascript
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Tear down
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
az group delete -n rg-ng-runtime-gate-test --yes
|
|
25
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0",
|
|
3
|
+
"logging": {
|
|
4
|
+
"applicationInsights": {
|
|
5
|
+
"samplingSettings": {
|
|
6
|
+
"isEnabled": true,
|
|
7
|
+
"excludedTypes": "Request"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"extensionBundle": {
|
|
12
|
+
"id": "Microsoft.Azure.Functions.ExtensionBundle",
|
|
13
|
+
"version": "[4.*, 5.0.0)"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ng-azure-functions-gate",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "ng-azure-functions-gate",
|
|
9
|
+
"version": "0.1.0",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@azure/functions": "^4.6.0",
|
|
12
|
+
"@netgreener/runtime": "0.1.9"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"node_modules/@azure/functions": {
|
|
19
|
+
"version": "4.16.5",
|
|
20
|
+
"resolved": "https://registry.npmjs.org/@azure/functions/-/functions-4.16.5.tgz",
|
|
21
|
+
"integrity": "sha512-h0lVUeI/Q36SyE2xGQOXZqBbmSgQHNLk8pvMxhq3Dw1TaT3eGWs2X25dceGJ153aXXkjcTEdkxg3D2Gcz1uJ0w==",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@azure/functions-extensions-base": "0.3.0",
|
|
25
|
+
"cookie": "^0.7.0"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.0"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"node_modules/@azure/functions-extensions-base": {
|
|
32
|
+
"version": "0.3.0",
|
|
33
|
+
"resolved": "https://registry.npmjs.org/@azure/functions-extensions-base/-/functions-extensions-base-0.3.0.tgz",
|
|
34
|
+
"integrity": "sha512-Cux0hLu5ZXlC/Kb+yvJVhRLIdkfFwui2HeT5oGZL00r/GCUUkhGTzRfZUjRN4Bq729mPv3okPucz2z7SMQLStA==",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"node_modules/@netgreener/runtime": {
|
|
41
|
+
"version": "0.1.9",
|
|
42
|
+
"resolved": "https://registry.npmjs.org/@netgreener/runtime/-/runtime-0.1.9.tgz",
|
|
43
|
+
"integrity": "sha512-dp4vwl968K58zk6eTCurJjLFQMaFg2jZrtOoEI5AREuZbl1v9Tkgbvm80A4GAWgIWA7la2TJS6MlUFKt7w3G7Q==",
|
|
44
|
+
"license": "UNLICENSED",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"ajv": "^8.20.0",
|
|
47
|
+
"ajv-formats": "^3.0.1"
|
|
48
|
+
},
|
|
49
|
+
"bin": {
|
|
50
|
+
"netgreener": "dist/cli/netgreener.js",
|
|
51
|
+
"netgreener-analyze": "dist/analyze/cli.js"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"axios": ">=1",
|
|
58
|
+
"bullmq": ">=4",
|
|
59
|
+
"express": ">=4",
|
|
60
|
+
"fastify": ">=4",
|
|
61
|
+
"typescript": ">=5"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"axios": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"bullmq": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"express": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"fastify": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"typescript": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"node_modules/ajv": {
|
|
82
|
+
"version": "8.20.0",
|
|
83
|
+
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
|
|
84
|
+
"integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
|
|
85
|
+
"license": "MIT",
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"fast-deep-equal": "^3.1.3",
|
|
88
|
+
"fast-uri": "^3.0.1",
|
|
89
|
+
"json-schema-traverse": "^1.0.0",
|
|
90
|
+
"require-from-string": "^2.0.2"
|
|
91
|
+
},
|
|
92
|
+
"funding": {
|
|
93
|
+
"type": "github",
|
|
94
|
+
"url": "https://github.com/sponsors/epoberezkin"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"node_modules/ajv-formats": {
|
|
98
|
+
"version": "3.0.1",
|
|
99
|
+
"resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",
|
|
100
|
+
"integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
|
|
101
|
+
"license": "MIT",
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"ajv": "^8.0.0"
|
|
104
|
+
},
|
|
105
|
+
"peerDependencies": {
|
|
106
|
+
"ajv": "^8.0.0"
|
|
107
|
+
},
|
|
108
|
+
"peerDependenciesMeta": {
|
|
109
|
+
"ajv": {
|
|
110
|
+
"optional": true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"node_modules/cookie": {
|
|
115
|
+
"version": "0.7.2",
|
|
116
|
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
|
117
|
+
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
|
118
|
+
"license": "MIT",
|
|
119
|
+
"engines": {
|
|
120
|
+
"node": ">= 0.6"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"node_modules/fast-deep-equal": {
|
|
124
|
+
"version": "3.1.3",
|
|
125
|
+
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
|
126
|
+
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
|
127
|
+
"license": "MIT"
|
|
128
|
+
},
|
|
129
|
+
"node_modules/fast-uri": {
|
|
130
|
+
"version": "3.1.8",
|
|
131
|
+
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz",
|
|
132
|
+
"integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==",
|
|
133
|
+
"funding": [
|
|
134
|
+
{
|
|
135
|
+
"type": "github",
|
|
136
|
+
"url": "https://github.com/sponsors/fastify"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "opencollective",
|
|
140
|
+
"url": "https://opencollective.com/fastify"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"license": "BSD-3-Clause"
|
|
144
|
+
},
|
|
145
|
+
"node_modules/json-schema-traverse": {
|
|
146
|
+
"version": "1.0.0",
|
|
147
|
+
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
|
148
|
+
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
|
149
|
+
"license": "MIT"
|
|
150
|
+
},
|
|
151
|
+
"node_modules/require-from-string": {
|
|
152
|
+
"version": "2.0.2",
|
|
153
|
+
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
|
154
|
+
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
|
|
155
|
+
"license": "MIT",
|
|
156
|
+
"engines": {
|
|
157
|
+
"node": ">=0.10.0"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ng-azure-functions-gate",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/functions/*.js",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@azure/functions": "^4.6.0",
|
|
12
|
+
"@netgreener/runtime": "0.1.9"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Isolated Azure Functions gate for serverless-thin live run_id evidence.
|
|
3
|
+
* Does not modify existing NetGreener Azure resources.
|
|
4
|
+
*/
|
|
5
|
+
import { app } from '@azure/functions'
|
|
6
|
+
import { NetGreener } from '@netgreener/runtime'
|
|
7
|
+
|
|
8
|
+
NetGreener.init({ runtime: 'auto' })
|
|
9
|
+
|
|
10
|
+
app.http('health', {
|
|
11
|
+
methods: ['GET', 'POST'],
|
|
12
|
+
authLevel: 'anonymous',
|
|
13
|
+
handler: async (_request, _context) => {
|
|
14
|
+
try {
|
|
15
|
+
return {
|
|
16
|
+
status: 200,
|
|
17
|
+
jsonBody: {
|
|
18
|
+
ok: true,
|
|
19
|
+
gate: 'CHK-R6.serverless-degraded',
|
|
20
|
+
platform: 'azure_functions',
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
} finally {
|
|
24
|
+
await NetGreener.flushForInvokeEnd()
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webpack / Turbopack loader. Wraps Next.js route, page, and server-action
|
|
3
|
+
* exports. No-ops for every other module.
|
|
4
|
+
*/
|
|
5
|
+
const { transformNextEntrySource } = require('../dist/nextEntryTransform.js')
|
|
6
|
+
|
|
7
|
+
module.exports = function netgreenerNextEntryLoader(source) {
|
|
8
|
+
const filename = (this && this.resourcePath) || ''
|
|
9
|
+
try {
|
|
10
|
+
return transformNextEntrySource(String(source), filename)
|
|
11
|
+
} catch {
|
|
12
|
+
return source
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netgreener/runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
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",
|
|
@@ -49,10 +49,12 @@
|
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"dist",
|
|
52
|
+
"loaders",
|
|
52
53
|
"!dist/tests",
|
|
53
54
|
"!dist/tests/**",
|
|
54
55
|
"fixtures",
|
|
55
56
|
"examples",
|
|
57
|
+
"!examples/**/node_modules/**",
|
|
56
58
|
"README.md",
|
|
57
59
|
"TUTORIAL.md",
|
|
58
60
|
"CHANGELOG.md"
|