@nifrajs/agent-telemetry 2.2.0 → 2.4.0
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 +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/package.json +4 -4
- package/src/index.ts +3 -3
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ attached as children; otherwise the plugin creates a standalone observation. Oth
|
|
|
18
18
|
|
|
19
19
|
## For AI agents
|
|
20
20
|
|
|
21
|
-
Start with [`LLM.md`](./LLM.md)
|
|
21
|
+
Start with [`LLM.md`](./LLM.md) - this package's contract card (the exports you call + its footguns),
|
|
22
22
|
one cheap read instead of the whole corpus. For the wider framework: the repo's
|
|
23
23
|
[`AGENTS.md`](../../AGENTS.md) is the copy-paste quick reference, and
|
|
24
24
|
[`llms-full.txt`](../../llms-full.txt) is the full machine-readable corpus. Run `nifra check` as the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nifrajs/agent-telemetry`
|
|
2
|
+
* `@nifrajs/agent-telemetry` - child-span instrumentation for AI agent tool calls.
|
|
3
3
|
*
|
|
4
4
|
* Extends `@nifrajs/otel`'s span model: when an AI agent invokes a tool via
|
|
5
5
|
* `/_nifra/tool/*` or the MCP endpoint, this middleware creates a child span
|
|
6
6
|
* tracking tool name, input size, output size, and execution time.
|
|
7
7
|
*
|
|
8
|
-
* **Zero production overhead when not registered**
|
|
8
|
+
* **Zero production overhead when not registered** - Nifra's `bare` flag keeps
|
|
9
9
|
* routes on the sync fast path unless hooks are present at registration time.
|
|
10
10
|
*/
|
|
11
11
|
import { type ActiveObservation, type ObservationAdapter } from "@nifrajs/otel";
|
|
@@ -33,7 +33,7 @@ interface HookContext {
|
|
|
33
33
|
*
|
|
34
34
|
* Creates child spans for requests targeting tool endpoints (`/_nifra/tool/*`)
|
|
35
35
|
* or the MCP endpoint (`/mcp`). Non-matching requests pass through with zero overhead
|
|
36
|
-
* (a single `startsWith` check
|
|
36
|
+
* (a single `startsWith` check - O(1), no regex).
|
|
37
37
|
*/
|
|
38
38
|
export declare function agentTelemetry(options: AgentTelemetryOptions): {
|
|
39
39
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nifrajs/agent-telemetry`
|
|
2
|
+
* `@nifrajs/agent-telemetry` - child-span instrumentation for AI agent tool calls.
|
|
3
3
|
*
|
|
4
4
|
* Extends `@nifrajs/otel`'s span model: when an AI agent invokes a tool via
|
|
5
5
|
* `/_nifra/tool/*` or the MCP endpoint, this middleware creates a child span
|
|
6
6
|
* tracking tool name, input size, output size, and execution time.
|
|
7
7
|
*
|
|
8
|
-
* **Zero production overhead when not registered**
|
|
8
|
+
* **Zero production overhead when not registered** - Nifra's `bare` flag keeps
|
|
9
9
|
* routes on the sync fast path unless hooks are present at registration time.
|
|
10
10
|
*/
|
|
11
11
|
import { createObservationLifecycle, } from "@nifrajs/otel";
|
|
@@ -17,7 +17,7 @@ import { createObservationLifecycle, } from "@nifrajs/otel";
|
|
|
17
17
|
*
|
|
18
18
|
* Creates child spans for requests targeting tool endpoints (`/_nifra/tool/*`)
|
|
19
19
|
* or the MCP endpoint (`/mcp`). Non-matching requests pass through with zero overhead
|
|
20
|
-
* (a single `startsWith` check
|
|
20
|
+
* (a single `startsWith` check - O(1), no regex).
|
|
21
21
|
*/
|
|
22
22
|
export function agentTelemetry(options) {
|
|
23
23
|
const toolPrefix = options.toolPathPrefix ?? "/_nifra/tool/";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/agent-telemetry",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Agent telemetry plugin
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"description": "Agent telemetry plugin - child spans for AI tool calls on /_nifra/tool/* and MCP endpoints.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@nifrajs/otel": "2.
|
|
29
|
+
"@nifrajs/otel": "2.4.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@nifrajs/core": "^2.
|
|
32
|
+
"@nifrajs/core": "^2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@nifrajs/core": "workspace:*"
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nifrajs/agent-telemetry`
|
|
2
|
+
* `@nifrajs/agent-telemetry` - child-span instrumentation for AI agent tool calls.
|
|
3
3
|
*
|
|
4
4
|
* Extends `@nifrajs/otel`'s span model: when an AI agent invokes a tool via
|
|
5
5
|
* `/_nifra/tool/*` or the MCP endpoint, this middleware creates a child span
|
|
6
6
|
* tracking tool name, input size, output size, and execution time.
|
|
7
7
|
*
|
|
8
|
-
* **Zero production overhead when not registered**
|
|
8
|
+
* **Zero production overhead when not registered** - Nifra's `bare` flag keeps
|
|
9
9
|
* routes on the sync fast path unless hooks are present at registration time.
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -49,7 +49,7 @@ interface HookContext {
|
|
|
49
49
|
*
|
|
50
50
|
* Creates child spans for requests targeting tool endpoints (`/_nifra/tool/*`)
|
|
51
51
|
* or the MCP endpoint (`/mcp`). Non-matching requests pass through with zero overhead
|
|
52
|
-
* (a single `startsWith` check
|
|
52
|
+
* (a single `startsWith` check - O(1), no regex).
|
|
53
53
|
*/
|
|
54
54
|
export function agentTelemetry(options: AgentTelemetryOptions) {
|
|
55
55
|
const toolPrefix = options.toolPathPrefix ?? "/_nifra/tool/"
|