mesedi 0.8.0 → 0.10.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 +14 -5
- package/dist/_transport.d.ts +30 -0
- package/dist/_transport.d.ts.map +1 -0
- package/dist/_transport.js +43 -0
- package/dist/_transport.js.map +1 -0
- package/dist/client.d.ts +34 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +99 -18
- package/dist/client.js.map +1 -1
- package/dist/egress.d.ts +58 -0
- package/dist/egress.d.ts.map +1 -0
- package/dist/egress.js +131 -0
- package/dist/egress.js.map +1 -0
- package/dist/events.d.ts +5 -3
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +13 -3
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jcs.d.ts +22 -0
- package/dist/jcs.d.ts.map +1 -0
- package/dist/jcs.js +57 -0
- package/dist/jcs.js.map +1 -0
- package/dist/mcp.d.ts +50 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +62 -0
- package/dist/mcp.js.map +1 -0
- package/dist/observe.d.ts +2 -34
- package/dist/observe.d.ts.map +1 -1
- package/dist/observe.js +3 -45
- package/dist/observe.js.map +1 -1
- package/dist/tool.d.ts +12 -0
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +11 -0
- package/dist/tool.js.map +1 -1
- package/dist/wrap.d.ts +10 -0
- package/dist/wrap.d.ts.map +1 -1
- package/dist/wrap.js +10 -2
- package/dist/wrap.js.map +1 -1
- package/package.json +7 -7
package/dist/egress.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Egress and environment-declaration emitters.
|
|
3
|
+
*
|
|
4
|
+
* Added 2026-09-14 when the egress-visibility deferral was reopened.
|
|
5
|
+
* Twin of sdk-python/mesedi/egress.py.
|
|
6
|
+
*/
|
|
7
|
+
import { getClient } from "./client.js";
|
|
8
|
+
import { currentExecutionContext, newEventId } from "./context.js";
|
|
9
|
+
import { EventType, utcNowRfc3339 } from "./events.js";
|
|
10
|
+
/**
|
|
11
|
+
* Reduce a destination to host or host:port. A full URL loses its
|
|
12
|
+
* scheme, path, query, fragment and any user:password@ part on
|
|
13
|
+
* purpose: identical services must cluster, and query strings and
|
|
14
|
+
* userinfo are where secrets ride. A port survives only if it is all
|
|
15
|
+
* digits, so a malformed URL cannot smuggle part of a password out as
|
|
16
|
+
* a "port". Cases: spec/egress_destination_vectors.json (shared with
|
|
17
|
+
* the Python SDK). Exported only for that test; not re-exported from
|
|
18
|
+
* index.ts, so it is not part of the public API.
|
|
19
|
+
*/
|
|
20
|
+
export function normalizeEgressDestination(destination) {
|
|
21
|
+
let d = destination.trim();
|
|
22
|
+
const schemeIdx = d.indexOf("://");
|
|
23
|
+
if (schemeIdx >= 0)
|
|
24
|
+
d = d.slice(schemeIdx + 3);
|
|
25
|
+
for (const cut of ["/", "?", "#"]) {
|
|
26
|
+
const i = d.indexOf(cut);
|
|
27
|
+
if (i >= 0)
|
|
28
|
+
d = d.slice(0, i);
|
|
29
|
+
}
|
|
30
|
+
// Everything up to the last @ is userinfo (user, or user:password).
|
|
31
|
+
// Until 2026-11-15 it was kept and sent (outside review finding D13).
|
|
32
|
+
const at = d.lastIndexOf("@");
|
|
33
|
+
if (at >= 0)
|
|
34
|
+
d = d.slice(at + 1);
|
|
35
|
+
return hostAndNumericPort(d);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Keep host, plus :port only when the port is all ASCII digits.
|
|
39
|
+
* Bracketed IPv6 hosts keep their brackets.
|
|
40
|
+
*/
|
|
41
|
+
function hostAndNumericPort(d) {
|
|
42
|
+
const digits = /^[0-9]+$/;
|
|
43
|
+
if (d.startsWith("[")) {
|
|
44
|
+
const end = d.indexOf("]");
|
|
45
|
+
if (end === -1)
|
|
46
|
+
return d;
|
|
47
|
+
const host = d.slice(0, end + 1);
|
|
48
|
+
const rest = d.slice(end + 1);
|
|
49
|
+
const port = rest.startsWith(":") ? rest.slice(1) : "";
|
|
50
|
+
return digits.test(port) ? host + rest : host;
|
|
51
|
+
}
|
|
52
|
+
const colon = d.indexOf(":");
|
|
53
|
+
if (colon >= 0) {
|
|
54
|
+
return digits.test(d.slice(colon + 1)) ? d : d.slice(0, colon);
|
|
55
|
+
}
|
|
56
|
+
return d;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Emit an `egress` event recording one outbound network contact by
|
|
60
|
+
* the agent's environment.
|
|
61
|
+
*
|
|
62
|
+
* Report, never infer: call this from the host application or
|
|
63
|
+
* sandbox that actually opened the connection. Mesedi cannot see a
|
|
64
|
+
* connection nobody reports. The destination is normalized to host
|
|
65
|
+
* or host:port; scheme, path, query, fragment and user:password@ are
|
|
66
|
+
* dropped so identical services cluster and secrets in URLs never
|
|
67
|
+
* leave the process. Versions before 0.10.0 kept the user:password@
|
|
68
|
+
* part.
|
|
69
|
+
*
|
|
70
|
+
* Outside `wrap()`: silent no-op.
|
|
71
|
+
*/
|
|
72
|
+
export function emitEgress(destination, opts = {}) {
|
|
73
|
+
const ctx = currentExecutionContext();
|
|
74
|
+
if (!ctx)
|
|
75
|
+
return;
|
|
76
|
+
const payload = {
|
|
77
|
+
destination: normalizeEgressDestination(destination),
|
|
78
|
+
};
|
|
79
|
+
if (opts.protocol)
|
|
80
|
+
payload["protocol"] = opts.protocol;
|
|
81
|
+
if (opts.toolName)
|
|
82
|
+
payload["tool_name"] = opts.toolName;
|
|
83
|
+
if (opts.bytesOut)
|
|
84
|
+
payload["bytes_out"] = opts.bytesOut;
|
|
85
|
+
if (opts.note)
|
|
86
|
+
payload["note"] = opts.note;
|
|
87
|
+
const client = getClient();
|
|
88
|
+
const event = {
|
|
89
|
+
event_id: newEventId(),
|
|
90
|
+
execution_id: ctx.executionId,
|
|
91
|
+
event_type: EventType.EGRESS,
|
|
92
|
+
sequence: ctx.nextSequence(),
|
|
93
|
+
timestamp: utcNowRfc3339(),
|
|
94
|
+
payload,
|
|
95
|
+
};
|
|
96
|
+
client.submitEvent(event);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Emit an `environment_declaration` event stating what environment
|
|
100
|
+
* this run is SUPPOSED to be in.
|
|
101
|
+
*
|
|
102
|
+
* Well-known modes are "live", "simulation" and "staging"; any other
|
|
103
|
+
* string is stored verbatim and treated as not-live. Emit once, near
|
|
104
|
+
* the start of the run. The backend's environment_misapprehension
|
|
105
|
+
* detector compares later observations against this claim; it checks
|
|
106
|
+
* the declared boundary, never the model's beliefs.
|
|
107
|
+
*
|
|
108
|
+
* Outside `wrap()`: silent no-op.
|
|
109
|
+
*/
|
|
110
|
+
export function emitEnvironmentDeclaration(mode, opts = {}) {
|
|
111
|
+
const ctx = currentExecutionContext();
|
|
112
|
+
if (!ctx)
|
|
113
|
+
return;
|
|
114
|
+
const payload = {
|
|
115
|
+
mode: mode.trim().toLowerCase(),
|
|
116
|
+
};
|
|
117
|
+
payload["declared_by"] = opts.declaredBy ?? "operator";
|
|
118
|
+
if (opts.note)
|
|
119
|
+
payload["note"] = opts.note;
|
|
120
|
+
const client = getClient();
|
|
121
|
+
const event = {
|
|
122
|
+
event_id: newEventId(),
|
|
123
|
+
execution_id: ctx.executionId,
|
|
124
|
+
event_type: EventType.ENVIRONMENT_DECLARATION,
|
|
125
|
+
sequence: ctx.nextSequence(),
|
|
126
|
+
timestamp: utcNowRfc3339(),
|
|
127
|
+
payload,
|
|
128
|
+
};
|
|
129
|
+
client.submitEvent(event);
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=egress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress.js","sourceRoot":"","sources":["../src/egress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE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
|
|
|
3
3
|
* backend's wire format and the Python SDK's data model.
|
|
4
4
|
*
|
|
5
5
|
* Source-of-truth lives in the Go backend at
|
|
6
|
-
* `backend/
|
|
6
|
+
* `backend/attest/events/types.go`. Any new EventType or Status
|
|
7
7
|
* added there MUST be added here too, strict-JSON decoding on the
|
|
8
8
|
* backend will reject events whose fields it doesn't recognize.
|
|
9
9
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
export declare function utcNowRfc3339(): string;
|
|
23
23
|
/**
|
|
24
24
|
* Seven event types. Must match `EventType` constants in
|
|
25
|
-
* backend/
|
|
25
|
+
* backend/attest/events/types.go exactly.
|
|
26
26
|
*/
|
|
27
27
|
export declare const EventType: {
|
|
28
28
|
readonly LLM_CALL: "llm_call";
|
|
@@ -38,11 +38,13 @@ export declare const EventType: {
|
|
|
38
38
|
readonly MEMORY_OPERATION: "memory_operation";
|
|
39
39
|
readonly AGENT_HANDOFF: "agent_handoff";
|
|
40
40
|
readonly HUMAN_INTERVENTION: "human_intervention";
|
|
41
|
+
readonly EGRESS: "egress";
|
|
42
|
+
readonly ENVIRONMENT_DECLARATION: "environment_declaration";
|
|
41
43
|
};
|
|
42
44
|
export type EventType = (typeof EventType)[keyof typeof EventType];
|
|
43
45
|
/**
|
|
44
46
|
* Execution lifecycle states. Must match `ExecutionStatus` constants
|
|
45
|
-
* in backend/
|
|
47
|
+
* in backend/attest/events/types.go exactly.
|
|
46
48
|
*/
|
|
47
49
|
export declare const Status: {
|
|
48
50
|
readonly STARTED: "started";
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../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GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAU3E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW7D"}
|
package/dist/events.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* backend's wire format and the Python SDK's data model.
|
|
4
4
|
*
|
|
5
5
|
* Source-of-truth lives in the Go backend at
|
|
6
|
-
* `backend/
|
|
6
|
+
* `backend/attest/events/types.go`. Any new EventType or Status
|
|
7
7
|
* added there MUST be added here too, strict-JSON decoding on the
|
|
8
8
|
* backend will reject events whose fields it doesn't recognize.
|
|
9
9
|
*
|
|
@@ -28,7 +28,7 @@ export function utcNowRfc3339() {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Seven event types. Must match `EventType` constants in
|
|
31
|
-
* backend/
|
|
31
|
+
* backend/attest/events/types.go exactly.
|
|
32
32
|
*/
|
|
33
33
|
export const EventType = {
|
|
34
34
|
LLM_CALL: "llm_call",
|
|
@@ -60,10 +60,20 @@ export const EventType = {
|
|
|
60
60
|
// moment the human's decision lands. Aggregated by the
|
|
61
61
|
// hitl_timeout and hitl_rejection_spike detectors.
|
|
62
62
|
HUMAN_INTERVENTION: "human_intervention",
|
|
63
|
+
// one outbound network contact by the agent's environment,
|
|
64
|
+
// reported by the host or sandbox (never inferred). Destination
|
|
65
|
+
// is host or host:port, not a full URL. Consumed by the
|
|
66
|
+
// covert_coordination and environment_misapprehension detectors.
|
|
67
|
+
EGRESS: "egress",
|
|
68
|
+
// the operator's statement of what environment this run is
|
|
69
|
+
// SUPPOSED to be in ("live" | "simulation" | "staging"), emitted
|
|
70
|
+
// once near start. The environment_misapprehension detector
|
|
71
|
+
// compares later observations against this declared boundary.
|
|
72
|
+
ENVIRONMENT_DECLARATION: "environment_declaration",
|
|
63
73
|
};
|
|
64
74
|
/**
|
|
65
75
|
* Execution lifecycle states. Must match `ExecutionStatus` constants
|
|
66
|
-
* in backend/
|
|
76
|
+
* in backend/attest/events/types.go exactly.
|
|
67
77
|
*/
|
|
68
78
|
export const Status = {
|
|
69
79
|
STARTED: "started",
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;IACrB,oEAAoE;IACpE,iEAAiE;IACjE,yDAAyD;IACzD,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;IACpC,YAAY,EAAE,cAAc;IAC5B,eAAe,EAAE,iBAAiB;IAClC,2DAA2D;IAC3D,gDAAgD;IAChD,oDAAoD;IACpD,oBAAoB,EAAE,sBAAsB;IAC5C,qDAAqD;IACrD,gEAAgE;IAChE,6CAA6C;IAC7C,QAAQ,EAAE,UAAU;IACpB,sDAAsD;IACtD,mDAAmD;IACnD,8BAA8B;IAC9B,UAAU,EAAE,YAAY;IACxB,4CAA4C;IAC5C,gBAAgB,EAAE,kBAAkB;IACpC,+CAA+C;IAC/C,yDAAyD;IACzD,uDAAuD;IACvD,aAAa,EAAE,eAAe;IAC9B,kDAAkD;IAClD,uDAAuD;IACvD,mDAAmD;IACnD,kBAAkB,EAAE,oBAAoB;
|
|
1
|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G,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC;IAChF,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,CAAQ;IAClC,MAAM,GAAG,GAA4B;QACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,OAAO,EAAE,CAAC,CAAC,OAAO;KACnB,CAAC;IACF,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC;IACpE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -51,4 +51,5 @@ export type { OllamaClassLike } from "./ollama_integration.js";
|
|
|
51
51
|
export { MesediHalt, isMesediHalt } from "./halt.js";
|
|
52
52
|
export type { Budget, HaltTrigger } from "./halt.js";
|
|
53
53
|
export declare const VERSION = "0.0.4";
|
|
54
|
+
export { emitEgress, emitEnvironmentDeclaration, type EgressOptions, type EnvironmentDeclarationOptions, } from "./egress.js";
|
|
54
55
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,SAAS,EACT,MAAM,EACN,aAAa,GACd,MAAM,aAAa,CAA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AA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EACV,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACrD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAErD,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EACL,UAAU,EACV,0BAA0B,EAC1B,KAAK,aAAa,EAClB,KAAK,6BAA6B,GACnC,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,4 +39,5 @@ export { instrumentVertexGemini } from "./vertex_gemini_integration.js";
|
|
|
39
39
|
export { instrumentOllama } from "./ollama_integration.js";
|
|
40
40
|
export { MesediHalt, isMesediHalt } from "./halt.js";
|
|
41
41
|
export const VERSION = "0.0.4";
|
|
42
|
+
export { emitEgress, emitEnvironmentDeclaration, } from "./egress.js";
|
|
42
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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AE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAC;AAatB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGrD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,OAAO,EACL,UAAU,EACV,0BAA0B,GAG3B,MAAM,aAAa,CAAC"}
|
package/dist/jcs.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON hashing for declared tool schemas, feeding the
|
|
3
|
+
* backend's tool_definition_drift detector (the mcp-pin class: a
|
|
4
|
+
* tool whose declared input schema changes while its description
|
|
5
|
+
* stays byte-identical).
|
|
6
|
+
*
|
|
7
|
+
* The backend only ever sees the hash, so this MUST produce the
|
|
8
|
+
* same bytes as the Python SDK's mesedi/_jcs.py for the same
|
|
9
|
+
* schema, or a project mixing SDKs would see phantom drift. Both
|
|
10
|
+
* follow RFC 8785 (JCS) for the JSON that schema documents are in
|
|
11
|
+
* practice: keys sorted, no whitespace, minimal escaping, UTF-8,
|
|
12
|
+
* non-ASCII unescaped. A cross-SDK fixture test pins the agreement
|
|
13
|
+
* with a hash computed by the Python side.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* SHA-256 hex over the canonicalized schema. Returns "" for
|
|
17
|
+
* null/undefined or anything not JSON-serializable, so callers omit
|
|
18
|
+
* the field entirely and the backend distinguishes "no declared
|
|
19
|
+
* schema" from a value, the contract tool_description established.
|
|
20
|
+
*/
|
|
21
|
+
export declare function inputSchemaHash(schema: unknown): string;
|
|
22
|
+
//# sourceMappingURL=jcs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jcs.d.ts","sourceRoot":"","sources":["../src/jcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA6BH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAWvD"}
|
package/dist/jcs.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON hashing for declared tool schemas, feeding the
|
|
3
|
+
* backend's tool_definition_drift detector (the mcp-pin class: a
|
|
4
|
+
* tool whose declared input schema changes while its description
|
|
5
|
+
* stays byte-identical).
|
|
6
|
+
*
|
|
7
|
+
* The backend only ever sees the hash, so this MUST produce the
|
|
8
|
+
* same bytes as the Python SDK's mesedi/_jcs.py for the same
|
|
9
|
+
* schema, or a project mixing SDKs would see phantom drift. Both
|
|
10
|
+
* follow RFC 8785 (JCS) for the JSON that schema documents are in
|
|
11
|
+
* practice: keys sorted, no whitespace, minimal escaping, UTF-8,
|
|
12
|
+
* non-ASCII unescaped. A cross-SDK fixture test pins the agreement
|
|
13
|
+
* with a hash computed by the Python side.
|
|
14
|
+
*/
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
|
+
/**
|
|
17
|
+
* Recursively stringify with object keys sorted. Throws on values
|
|
18
|
+
* JSON cannot represent (functions, symbols, undefined, BigInt),
|
|
19
|
+
* mirroring Python's json.dumps raising on unserializable input so
|
|
20
|
+
* both SDKs return "" for the same inputs.
|
|
21
|
+
*/
|
|
22
|
+
function canonicalize(value) {
|
|
23
|
+
if (value === null || typeof value !== "object") {
|
|
24
|
+
const s = JSON.stringify(value);
|
|
25
|
+
if (s === undefined) {
|
|
26
|
+
throw new TypeError("unserializable value in schema");
|
|
27
|
+
}
|
|
28
|
+
return s;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return "[" + value.map(canonicalize).join(",") + "]";
|
|
32
|
+
}
|
|
33
|
+
const obj = value;
|
|
34
|
+
const keys = Object.keys(obj).sort();
|
|
35
|
+
const parts = keys.map((k) => JSON.stringify(k) + ":" + canonicalize(obj[k]));
|
|
36
|
+
return "{" + parts.join(",") + "}";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* SHA-256 hex over the canonicalized schema. Returns "" for
|
|
40
|
+
* null/undefined or anything not JSON-serializable, so callers omit
|
|
41
|
+
* the field entirely and the backend distinguishes "no declared
|
|
42
|
+
* schema" from a value, the contract tool_description established.
|
|
43
|
+
*/
|
|
44
|
+
export function inputSchemaHash(schema) {
|
|
45
|
+
if (schema === null || schema === undefined) {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
let canonical;
|
|
49
|
+
try {
|
|
50
|
+
canonical = canonicalize(schema);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
return createHash("sha256").update(canonical, "utf8").digest("hex");
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=jcs.js.map
|
package/dist/jcs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jcs.js","sourceRoot":"","sources":["../src/jcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,E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package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Context Protocol call observation.
|
|
3
|
+
*
|
|
4
|
+
* Moved verbatim out of observe.ts on 2026-09-10 as the mirror of
|
|
5
|
+
* the Python SDK's mesedi/mcp.py split. Re-exported from observe, so
|
|
6
|
+
* every existing import keeps working.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Options for emitMcpCall. Mirrors the Go MCPCallPayload struct in
|
|
10
|
+
* backend/attest/events/types.go field-for-field, omitting
|
|
11
|
+
* `serverName` and `method` which are positional args.
|
|
12
|
+
*/
|
|
13
|
+
export interface McpCallOptions {
|
|
14
|
+
/** Optional server URL or stdio target for the expanded view. */
|
|
15
|
+
serverUrl?: string;
|
|
16
|
+
/** Method arguments (any JSON-serializable value). */
|
|
17
|
+
arguments?: unknown;
|
|
18
|
+
/** Successful return value; omit on error. */
|
|
19
|
+
returnValue?: unknown;
|
|
20
|
+
/** Wall-clock duration in milliseconds. */
|
|
21
|
+
latencyMs?: number;
|
|
22
|
+
/** Error message when the call failed. */
|
|
23
|
+
error?: string;
|
|
24
|
+
/** Failure classifier: "hard_error" / "soft_error" / "timeout" / "server_unreachable" / "method_not_found". */
|
|
25
|
+
errorClass?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The method's DECLARED input schema as the MCP server advertises
|
|
28
|
+
* it (the tool definition's inputSchema member). Only a canonical
|
|
29
|
+
* SHA-256 is sent, feeding the definition-drift detector. Pass it
|
|
30
|
+
* fresh from the server's current tool listing on each call, not a
|
|
31
|
+
* copy cached at startup: a poisoned server swaps the definition
|
|
32
|
+
* between calls and a cached copy hides exactly that swap.
|
|
33
|
+
*/
|
|
34
|
+
inputSchema?: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Emit an `mcp_call` event for one Model Context Protocol server
|
|
38
|
+
* invocation.
|
|
39
|
+
*
|
|
40
|
+
* Use this when your agent talks to an MCP server (Anthropic's
|
|
41
|
+
* filesystem / github servers, a customer-hosted MCP server, etc.).
|
|
42
|
+
* The dashboard renders MCP calls in a distinct chip so cost
|
|
43
|
+
* attribution can break down by server identity, and the existing
|
|
44
|
+
* tool_failures detector picks up failed MCP calls when `error` or
|
|
45
|
+
* `errorClass` is non-empty.
|
|
46
|
+
*
|
|
47
|
+
* Outside `wrap()`: silent no-op.
|
|
48
|
+
*/
|
|
49
|
+
export declare function emitMcpCall(serverName: string, method: string, opts?: McpCallOptions): void;
|
|
50
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+GAA+G;IAC/G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,cAAmB,GACxB,IAAI,CA8BN"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Context Protocol call observation.
|
|
3
|
+
*
|
|
4
|
+
* Moved verbatim out of observe.ts on 2026-09-10 as the mirror of
|
|
5
|
+
* the Python SDK's mesedi/mcp.py split. Re-exported from observe, so
|
|
6
|
+
* every existing import keeps working.
|
|
7
|
+
*/
|
|
8
|
+
import { getClient } from "./client.js";
|
|
9
|
+
import { currentExecutionContext, newEventId } from "./context.js";
|
|
10
|
+
import { EventType, utcNowRfc3339 } from "./events.js";
|
|
11
|
+
import { inputSchemaHash } from "./jcs.js";
|
|
12
|
+
/**
|
|
13
|
+
* Emit an `mcp_call` event for one Model Context Protocol server
|
|
14
|
+
* invocation.
|
|
15
|
+
*
|
|
16
|
+
* Use this when your agent talks to an MCP server (Anthropic's
|
|
17
|
+
* filesystem / github servers, a customer-hosted MCP server, etc.).
|
|
18
|
+
* The dashboard renders MCP calls in a distinct chip so cost
|
|
19
|
+
* attribution can break down by server identity, and the existing
|
|
20
|
+
* tool_failures detector picks up failed MCP calls when `error` or
|
|
21
|
+
* `errorClass` is non-empty.
|
|
22
|
+
*
|
|
23
|
+
* Outside `wrap()`: silent no-op.
|
|
24
|
+
*/
|
|
25
|
+
export function emitMcpCall(serverName, method, opts = {}) {
|
|
26
|
+
const ctx = currentExecutionContext();
|
|
27
|
+
if (!ctx)
|
|
28
|
+
return;
|
|
29
|
+
const payload = {
|
|
30
|
+
server_name: serverName,
|
|
31
|
+
method,
|
|
32
|
+
};
|
|
33
|
+
if (opts.serverUrl)
|
|
34
|
+
payload["server_url"] = opts.serverUrl;
|
|
35
|
+
if (opts.arguments !== undefined)
|
|
36
|
+
payload["arguments"] = opts.arguments;
|
|
37
|
+
if (opts.returnValue !== undefined)
|
|
38
|
+
payload["return_value"] = opts.returnValue;
|
|
39
|
+
if (opts.latencyMs)
|
|
40
|
+
payload["latency_ms"] = Math.trunc(opts.latencyMs);
|
|
41
|
+
if (opts.error)
|
|
42
|
+
payload["error"] = opts.error;
|
|
43
|
+
if (opts.errorClass)
|
|
44
|
+
payload["error_class"] = opts.errorClass;
|
|
45
|
+
{
|
|
46
|
+
const schemaHash = inputSchemaHash(opts.inputSchema);
|
|
47
|
+
if (schemaHash)
|
|
48
|
+
payload["input_schema_hash"] = schemaHash;
|
|
49
|
+
}
|
|
50
|
+
const client = getClient();
|
|
51
|
+
const event = {
|
|
52
|
+
event_id: newEventId(),
|
|
53
|
+
execution_id: ctx.executionId,
|
|
54
|
+
event_type: EventType.MCP_CALL,
|
|
55
|
+
sequence: ctx.nextSequence(),
|
|
56
|
+
timestamp: utcNowRfc3339(),
|
|
57
|
+
duration_ms: opts.latencyMs,
|
|
58
|
+
payload,
|
|
59
|
+
};
|
|
60
|
+
client.submitEvent(event);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAS,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA+B3C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,UAAkB,EAClB,MAAc,EACd,OAAuB,EAAE;IAEzB,MAAM,GAAG,GAAG,uBAAuB,EAAE,CAAC;IACtC,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,MAAM,OAAO,GAA4B;QACvC,WAAW,EAAE,UAAU;QACvB,MAAM;KACP,CAAC;IACF,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IAC3D,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IACxE,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IAC/E,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvE,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;IAC9C,IAAI,IAAI,CAAC,UAAU;QAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9D,CAAC;QACC,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,UAAU;YAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,UAAU,CAAC;IAC5D,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAU;QACnB,QAAQ,EAAE,UAAU,EAAE;QACtB,YAAY,EAAE,GAAG,CAAC,WAAW;QAC7B,UAAU,EAAE,SAAS,CAAC,QAAQ;QAC9B,QAAQ,EAAE,GAAG,CAAC,YAAY,EAAE;QAC5B,SAAS,EAAE,aAAa,EAAE;QAC1B,WAAW,EAAE,IAAI,CAAC,SAAS;QAC3B,OAAO;KACR,CAAC;IACF,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/observe.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare function validatorResult(name: string, passed: boolean, opts?: Va
|
|
|
62
62
|
/**
|
|
63
63
|
* Options for emitInfrastructureEvent. Mirrors the Go
|
|
64
64
|
* InfrastructureEventPayload struct in
|
|
65
|
-
* backend/
|
|
65
|
+
* backend/attest/events/types.go field-for-field, omitting `reason`
|
|
66
66
|
* which is the positional first arg of the emitter.
|
|
67
67
|
*/
|
|
68
68
|
export interface InfrastructureEventOptions {
|
|
@@ -157,39 +157,7 @@ export declare function _maybeEmitThrottlingEvent(args: {
|
|
|
157
157
|
* its own; emitting this event is purely observational.
|
|
158
158
|
*/
|
|
159
159
|
export declare function emitInfrastructureEvent(reason: InfrastructureReason, opts?: InfrastructureEventOptions): void;
|
|
160
|
-
|
|
161
|
-
* Options for emitMcpCall. Mirrors the Go MCPCallPayload struct in
|
|
162
|
-
* backend/internal/events/types.go field-for-field, omitting
|
|
163
|
-
* `serverName` and `method` which are positional args.
|
|
164
|
-
*/
|
|
165
|
-
export interface McpCallOptions {
|
|
166
|
-
/** Optional server URL or stdio target for the expanded view. */
|
|
167
|
-
serverUrl?: string;
|
|
168
|
-
/** Method arguments (any JSON-serializable value). */
|
|
169
|
-
arguments?: unknown;
|
|
170
|
-
/** Successful return value; omit on error. */
|
|
171
|
-
returnValue?: unknown;
|
|
172
|
-
/** Wall-clock duration in milliseconds. */
|
|
173
|
-
latencyMs?: number;
|
|
174
|
-
/** Error message when the call failed. */
|
|
175
|
-
error?: string;
|
|
176
|
-
/** Failure classifier: "hard_error" / "soft_error" / "timeout" / "server_unreachable" / "method_not_found". */
|
|
177
|
-
errorClass?: string;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Emit an `mcp_call` event for one Model Context Protocol server
|
|
181
|
-
* invocation.
|
|
182
|
-
*
|
|
183
|
-
* Use this when your agent talks to an MCP server (Anthropic's
|
|
184
|
-
* filesystem / github servers, a customer-hosted MCP server, etc.).
|
|
185
|
-
* The dashboard renders MCP calls in a distinct chip so cost
|
|
186
|
-
* attribution can break down by server identity, and the existing
|
|
187
|
-
* tool_failures detector picks up failed MCP calls when `error` or
|
|
188
|
-
* `errorClass` is non-empty.
|
|
189
|
-
*
|
|
190
|
-
* Outside `wrap()`: silent no-op.
|
|
191
|
-
*/
|
|
192
|
-
export declare function emitMcpCall(serverName: string, method: string, opts?: McpCallOptions): void;
|
|
160
|
+
export { emitMcpCall, type McpCallOptions } from "./mcp.js";
|
|
193
161
|
/** Options for emitEvalScore beyond the required core fields. */
|
|
194
162
|
export interface EvalScoreOptions {
|
|
195
163
|
/** Optional cutoff value the evaluator used. */
|
package/dist/observe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAaH;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,IAAI,CAuBN;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,sBAA2B,GAChC,IAAI,CAoCN;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,oB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,CAAC,CA+B7C;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,2BAA2B,EACnC,IAAI,EAAE,gCAAgC,GACrC,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
package/dist/observe.js
CHANGED
|
@@ -221,51 +221,9 @@ export function emitInfrastructureEvent(reason, opts = {}) {
|
|
|
221
221
|
};
|
|
222
222
|
client.submitEvent(event);
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
*
|
|
228
|
-
* Use this when your agent talks to an MCP server (Anthropic's
|
|
229
|
-
* filesystem / github servers, a customer-hosted MCP server, etc.).
|
|
230
|
-
* The dashboard renders MCP calls in a distinct chip so cost
|
|
231
|
-
* attribution can break down by server identity, and the existing
|
|
232
|
-
* tool_failures detector picks up failed MCP calls when `error` or
|
|
233
|
-
* `errorClass` is non-empty.
|
|
234
|
-
*
|
|
235
|
-
* Outside `wrap()`: silent no-op.
|
|
236
|
-
*/
|
|
237
|
-
export function emitMcpCall(serverName, method, opts = {}) {
|
|
238
|
-
const ctx = currentExecutionContext();
|
|
239
|
-
if (!ctx)
|
|
240
|
-
return;
|
|
241
|
-
const payload = {
|
|
242
|
-
server_name: serverName,
|
|
243
|
-
method,
|
|
244
|
-
};
|
|
245
|
-
if (opts.serverUrl)
|
|
246
|
-
payload["server_url"] = opts.serverUrl;
|
|
247
|
-
if (opts.arguments !== undefined)
|
|
248
|
-
payload["arguments"] = opts.arguments;
|
|
249
|
-
if (opts.returnValue !== undefined)
|
|
250
|
-
payload["return_value"] = opts.returnValue;
|
|
251
|
-
if (opts.latencyMs)
|
|
252
|
-
payload["latency_ms"] = Math.trunc(opts.latencyMs);
|
|
253
|
-
if (opts.error)
|
|
254
|
-
payload["error"] = opts.error;
|
|
255
|
-
if (opts.errorClass)
|
|
256
|
-
payload["error_class"] = opts.errorClass;
|
|
257
|
-
const client = getClient();
|
|
258
|
-
const event = {
|
|
259
|
-
event_id: newEventId(),
|
|
260
|
-
execution_id: ctx.executionId,
|
|
261
|
-
event_type: EventType.MCP_CALL,
|
|
262
|
-
sequence: ctx.nextSequence(),
|
|
263
|
-
timestamp: utcNowRfc3339(),
|
|
264
|
-
duration_ms: opts.latencyMs,
|
|
265
|
-
payload,
|
|
266
|
-
};
|
|
267
|
-
client.submitEvent(event);
|
|
268
|
-
}
|
|
224
|
+
// emitMcpCall moved to mcp.ts on 2026-09-10; re-exported so existing
|
|
225
|
+
// imports keep working.
|
|
226
|
+
export { emitMcpCall } from "./mcp.js";
|
|
269
227
|
/**
|
|
270
228
|
* Emit an `eval_score` event recording one external evaluator
|
|
271
229
|
* verdict on an execution's output.
|