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.js
CHANGED
|
@@ -1757,7 +1757,7 @@ var Tracer = class {
|
|
|
1757
1757
|
};
|
|
1758
1758
|
|
|
1759
1759
|
// src/version.ts
|
|
1760
|
-
var SDK_VERSION = "0.
|
|
1760
|
+
var SDK_VERSION = "0.6.0";
|
|
1761
1761
|
|
|
1762
1762
|
// src/exporters/http.ts
|
|
1763
1763
|
var CAPACITY_REFUSAL_STATUSES = /* @__PURE__ */ new Set([429, 503]);
|
|
@@ -1873,7 +1873,13 @@ var HttpExporter = class {
|
|
|
1873
1873
|
const url = `${this._endpoint}/v1/spans`;
|
|
1874
1874
|
const headers = {
|
|
1875
1875
|
"Content-Type": "application/json",
|
|
1876
|
-
"User-Agent": `risicare-js/${SDK_VERSION} node/${process.version}
|
|
1876
|
+
"User-Agent": `risicare-js/${SDK_VERSION} node/${process.version}`,
|
|
1877
|
+
// F-SDKVER-001 parity. Python's ingest exporter has always sent
|
|
1878
|
+
// `X-Risicare-SDK-Version`; JS sent only a User-Agent, so the two SDKs
|
|
1879
|
+
// disagreed about how a client identifies itself. A parser-free header is
|
|
1880
|
+
// strictly easier for the gateway to consume than picking a version out of
|
|
1881
|
+
// a UA string.
|
|
1882
|
+
"X-Risicare-SDK-Version": SDK_VERSION
|
|
1877
1883
|
};
|
|
1878
1884
|
if (this._apiKey) {
|
|
1879
1885
|
headers["Authorization"] = `Bearer ${this._apiKey}`;
|
|
@@ -3312,6 +3318,7 @@ function reportError(error, options) {
|
|
|
3312
3318
|
span.setAttribute("error.message", err.message.slice(0, 2e3));
|
|
3313
3319
|
if (err.stack) span.setAttribute("error.stack", err.stack.slice(0, 4e3));
|
|
3314
3320
|
span.setAttribute("risicare.reported_error", true);
|
|
3321
|
+
attachErrorCode(span, err);
|
|
3315
3322
|
if (options?.attributes) {
|
|
3316
3323
|
for (const [k, v] of Object.entries(options.attributes)) {
|
|
3317
3324
|
span.setAttribute(k, v);
|
|
@@ -3352,7 +3359,14 @@ function score(traceId, name, value, options) {
|
|
|
3352
3359
|
method: "POST",
|
|
3353
3360
|
headers: {
|
|
3354
3361
|
"Content-Type": "application/json",
|
|
3355
|
-
"Authorization": `Bearer ${client.config.apiKey}
|
|
3362
|
+
"Authorization": `Bearer ${client.config.apiKey}`,
|
|
3363
|
+
// F-SDKVER-001 — see the Python twin. `score()` reaches the FastAPI
|
|
3364
|
+
// server under /v1/, which `main.py::audit_logging_middleware` audits
|
|
3365
|
+
// into `audit_logs.user_agent`; ingest reaches the Rust gateway, which
|
|
3366
|
+
// discards it. This is the one client-identity visible with no gateway
|
|
3367
|
+
// change.
|
|
3368
|
+
"User-Agent": `risicare-js/${SDK_VERSION} node/${process.version}`,
|
|
3369
|
+
"X-Risicare-SDK-Version": SDK_VERSION
|
|
3356
3370
|
},
|
|
3357
3371
|
body
|
|
3358
3372
|
}).catch((err) => debug(`score: send failed: ${err}`));
|
|
@@ -3505,14 +3519,14 @@ function withSession(options, fn) {
|
|
|
3505
3519
|
parentSessionId: options.parentSessionId,
|
|
3506
3520
|
turnNumber: options.turnNumber ?? 1
|
|
3507
3521
|
};
|
|
3508
|
-
return runWithContext({ session: session2 }, fn);
|
|
3522
|
+
return runWithContext({ session: session2 }, () => withSessionEndMarker(fn));
|
|
3509
3523
|
}
|
|
3510
3524
|
|
|
3511
3525
|
// src/decorators/session.ts
|
|
3512
3526
|
function _wrapSession(optionsOrResolver, fn) {
|
|
3513
3527
|
return (...args) => {
|
|
3514
3528
|
const options = typeof optionsOrResolver === "function" ? optionsOrResolver(...args) : optionsOrResolver;
|
|
3515
|
-
return withSession(options, () =>
|
|
3529
|
+
return withSession(options, () => fn(...args));
|
|
3516
3530
|
};
|
|
3517
3531
|
}
|
|
3518
3532
|
function session(optionsOrResolver, fn) {
|