risicare 0.5.2 → 0.6.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 +11 -6
- package/dist/frameworks/instructor.cjs.map +1 -1
- package/dist/frameworks/instructor.js.map +1 -1
- package/dist/frameworks/langchain.cjs.map +1 -1
- package/dist/frameworks/langchain.js.map +1 -1
- package/dist/frameworks/langgraph.cjs.map +1 -1
- package/dist/frameworks/langgraph.js.map +1 -1
- package/dist/frameworks/llamaindex.cjs.map +1 -1
- package/dist/frameworks/llamaindex.js.map +1 -1
- package/dist/index.cjs +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic/index.cjs.map +1 -1
- package/dist/providers/anthropic/index.js.map +1 -1
- package/dist/providers/bedrock/index.cjs.map +1 -1
- package/dist/providers/bedrock/index.js.map +1 -1
- package/dist/providers/cerebras/index.cjs.map +1 -1
- package/dist/providers/cerebras/index.js.map +1 -1
- package/dist/providers/cohere/index.cjs.map +1 -1
- package/dist/providers/cohere/index.js.map +1 -1
- package/dist/providers/google/index.cjs.map +1 -1
- package/dist/providers/google/index.js.map +1 -1
- package/dist/providers/groq/index.cjs.map +1 -1
- package/dist/providers/groq/index.js.map +1 -1
- package/dist/providers/huggingface/index.cjs.map +1 -1
- package/dist/providers/huggingface/index.js.map +1 -1
- package/dist/providers/mistral/index.cjs.map +1 -1
- package/dist/providers/mistral/index.js.map +1 -1
- package/dist/providers/ollama/index.cjs.map +1 -1
- package/dist/providers/ollama/index.js.map +1 -1
- package/dist/providers/openai/index.cjs.map +1 -1
- package/dist/providers/openai/index.js.map +1 -1
- package/dist/providers/together/index.cjs.map +1 -1
- package/dist/providers/together/index.js.map +1 -1
- package/dist/providers/vercel-ai/index.cjs.map +1 -1
- package/dist/providers/vercel-ai/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1843,7 +1843,7 @@ var Tracer = class {
|
|
|
1843
1843
|
};
|
|
1844
1844
|
|
|
1845
1845
|
// src/version.ts
|
|
1846
|
-
var SDK_VERSION = "0.
|
|
1846
|
+
var SDK_VERSION = "0.6.0";
|
|
1847
1847
|
|
|
1848
1848
|
// src/exporters/http.ts
|
|
1849
1849
|
var CAPACITY_REFUSAL_STATUSES = /* @__PURE__ */ new Set([429, 503]);
|
|
@@ -1959,7 +1959,13 @@ var HttpExporter = class {
|
|
|
1959
1959
|
const url = `${this._endpoint}/v1/spans`;
|
|
1960
1960
|
const headers = {
|
|
1961
1961
|
"Content-Type": "application/json",
|
|
1962
|
-
"User-Agent": `risicare-js/${SDK_VERSION} node/${process.version}
|
|
1962
|
+
"User-Agent": `risicare-js/${SDK_VERSION} node/${process.version}`,
|
|
1963
|
+
// F-SDKVER-001 parity. Python's ingest exporter has always sent
|
|
1964
|
+
// `X-Risicare-SDK-Version`; JS sent only a User-Agent, so the two SDKs
|
|
1965
|
+
// disagreed about how a client identifies itself. A parser-free header is
|
|
1966
|
+
// strictly easier for the gateway to consume than picking a version out of
|
|
1967
|
+
// a UA string.
|
|
1968
|
+
"X-Risicare-SDK-Version": SDK_VERSION
|
|
1963
1969
|
};
|
|
1964
1970
|
if (this._apiKey) {
|
|
1965
1971
|
headers["Authorization"] = `Bearer ${this._apiKey}`;
|
|
@@ -3398,6 +3404,7 @@ function reportError(error, options) {
|
|
|
3398
3404
|
span.setAttribute("error.message", err.message.slice(0, 2e3));
|
|
3399
3405
|
if (err.stack) span.setAttribute("error.stack", err.stack.slice(0, 4e3));
|
|
3400
3406
|
span.setAttribute("risicare.reported_error", true);
|
|
3407
|
+
attachErrorCode(span, err);
|
|
3401
3408
|
if (options?.attributes) {
|
|
3402
3409
|
for (const [k, v] of Object.entries(options.attributes)) {
|
|
3403
3410
|
span.setAttribute(k, v);
|
|
@@ -3438,7 +3445,14 @@ function score(traceId, name, value, options) {
|
|
|
3438
3445
|
method: "POST",
|
|
3439
3446
|
headers: {
|
|
3440
3447
|
"Content-Type": "application/json",
|
|
3441
|
-
"Authorization": `Bearer ${client.config.apiKey}
|
|
3448
|
+
"Authorization": `Bearer ${client.config.apiKey}`,
|
|
3449
|
+
// F-SDKVER-001 — see the Python twin. `score()` reaches the FastAPI
|
|
3450
|
+
// server under /v1/, which `main.py::audit_logging_middleware` audits
|
|
3451
|
+
// into `audit_logs.user_agent`; ingest reaches the Rust gateway, which
|
|
3452
|
+
// discards it. This is the one client-identity visible with no gateway
|
|
3453
|
+
// change.
|
|
3454
|
+
"User-Agent": `risicare-js/${SDK_VERSION} node/${process.version}`,
|
|
3455
|
+
"X-Risicare-SDK-Version": SDK_VERSION
|
|
3442
3456
|
},
|
|
3443
3457
|
body
|
|
3444
3458
|
}).catch((err) => debug(`score: send failed: ${err}`));
|
|
@@ -3591,14 +3605,14 @@ function withSession(options, fn) {
|
|
|
3591
3605
|
parentSessionId: options.parentSessionId,
|
|
3592
3606
|
turnNumber: options.turnNumber ?? 1
|
|
3593
3607
|
};
|
|
3594
|
-
return runWithContext({ session: session2 }, fn);
|
|
3608
|
+
return runWithContext({ session: session2 }, () => withSessionEndMarker(fn));
|
|
3595
3609
|
}
|
|
3596
3610
|
|
|
3597
3611
|
// src/decorators/session.ts
|
|
3598
3612
|
function _wrapSession(optionsOrResolver, fn) {
|
|
3599
3613
|
return (...args) => {
|
|
3600
3614
|
const options = typeof optionsOrResolver === "function" ? optionsOrResolver(...args) : optionsOrResolver;
|
|
3601
|
-
return withSession(options, () =>
|
|
3615
|
+
return withSession(options, () => fn(...args));
|
|
3602
3616
|
};
|
|
3603
3617
|
}
|
|
3604
3618
|
function session(optionsOrResolver, fn) {
|