risicare 0.6.0 → 0.7.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.
Files changed (41) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +32 -4
  3. package/dist/frameworks/instructor.cjs.map +1 -1
  4. package/dist/frameworks/instructor.js.map +1 -1
  5. package/dist/frameworks/langchain.cjs.map +1 -1
  6. package/dist/frameworks/langchain.js.map +1 -1
  7. package/dist/frameworks/langgraph.cjs.map +1 -1
  8. package/dist/frameworks/langgraph.js.map +1 -1
  9. package/dist/frameworks/llamaindex.cjs.map +1 -1
  10. package/dist/frameworks/llamaindex.js.map +1 -1
  11. package/dist/index.cjs +167 -20
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +16 -2
  14. package/dist/index.d.ts +16 -2
  15. package/dist/index.js +167 -20
  16. package/dist/index.js.map +1 -1
  17. package/dist/providers/anthropic/index.cjs.map +1 -1
  18. package/dist/providers/anthropic/index.js.map +1 -1
  19. package/dist/providers/bedrock/index.cjs.map +1 -1
  20. package/dist/providers/bedrock/index.js.map +1 -1
  21. package/dist/providers/cerebras/index.cjs.map +1 -1
  22. package/dist/providers/cerebras/index.js.map +1 -1
  23. package/dist/providers/cohere/index.cjs.map +1 -1
  24. package/dist/providers/cohere/index.js.map +1 -1
  25. package/dist/providers/google/index.cjs.map +1 -1
  26. package/dist/providers/google/index.js.map +1 -1
  27. package/dist/providers/groq/index.cjs.map +1 -1
  28. package/dist/providers/groq/index.js.map +1 -1
  29. package/dist/providers/huggingface/index.cjs.map +1 -1
  30. package/dist/providers/huggingface/index.js.map +1 -1
  31. package/dist/providers/mistral/index.cjs.map +1 -1
  32. package/dist/providers/mistral/index.js.map +1 -1
  33. package/dist/providers/ollama/index.cjs.map +1 -1
  34. package/dist/providers/ollama/index.js.map +1 -1
  35. package/dist/providers/openai/index.cjs.map +1 -1
  36. package/dist/providers/openai/index.js.map +1 -1
  37. package/dist/providers/together/index.cjs.map +1 -1
  38. package/dist/providers/together/index.js.map +1 -1
  39. package/dist/providers/vercel-ai/index.cjs.map +1 -1
  40. package/dist/providers/vercel-ai/index.js.map +1 -1
  41. package/package.json +5 -12
package/dist/index.d.cts CHANGED
@@ -274,8 +274,14 @@ declare const MASK_ERROR_MARKER = "<risicare:mask-error>";
274
274
  interface RisicareConfig {
275
275
  /** API key for authentication (format: "rsk-{random}"). Each key is scoped to one project. */
276
276
  apiKey?: string;
277
- /** Gateway endpoint URL */
277
+ /** Ingest gateway URL. It receives spans only. */
278
278
  endpoint?: string;
279
+ /**
280
+ * Api URL. It serves active-fix reads and scores.
281
+ * Falls back to `endpoint` when only that one is given, so a single-host
282
+ * deployment keeps every URL shape on the one host.
283
+ */
284
+ apiEndpoint?: string;
279
285
  /**
280
286
  * @deprecated Project is determined by your API key. This field is ignored
281
287
  * by the gateway and will be removed in v1.0. Use `serviceName` and
@@ -311,6 +317,14 @@ interface RisicareConfig {
311
317
  debug?: boolean;
312
318
  /** Enable gzip compression for HTTP exports (default: false) */
313
319
  compress?: boolean;
320
+ /**
321
+ * Whether FixRuntime starts (or `RISICARE_FIX_RUNTIME=true`).
322
+ *
323
+ * **Default `false` since 0.7.0** (it started whenever an `apiKey` was set).
324
+ * When true, the SDK polls `/fixes/active` every 60 s and applies the active
325
+ * fixes to LLM calls. When false, nothing polls and nothing is applied.
326
+ */
327
+ fixRuntime?: boolean;
314
328
  /** Custom metadata attached to all spans */
315
329
  metadata?: Record<string, unknown>;
316
330
  /**
@@ -951,7 +965,7 @@ declare function isProviderInstrumentationSuppressed(): boolean;
951
965
  * Port of Python SDK's runtime/config.py adapted for Node.js patterns.
952
966
  */
953
967
  interface FixRuntimeConfig {
954
- /** API endpoint URL (e.g., "https://app.risicare.ai") */
968
+ /** Api URL, serving /v1/fixes/active (e.g., "https://api.risicare.ai") */
955
969
  apiEndpoint: string;
956
970
  /** API key for authentication (format: "rsk-{random}") */
957
971
  apiKey: string;
package/dist/index.d.ts CHANGED
@@ -274,8 +274,14 @@ declare const MASK_ERROR_MARKER = "<risicare:mask-error>";
274
274
  interface RisicareConfig {
275
275
  /** API key for authentication (format: "rsk-{random}"). Each key is scoped to one project. */
276
276
  apiKey?: string;
277
- /** Gateway endpoint URL */
277
+ /** Ingest gateway URL. It receives spans only. */
278
278
  endpoint?: string;
279
+ /**
280
+ * Api URL. It serves active-fix reads and scores.
281
+ * Falls back to `endpoint` when only that one is given, so a single-host
282
+ * deployment keeps every URL shape on the one host.
283
+ */
284
+ apiEndpoint?: string;
279
285
  /**
280
286
  * @deprecated Project is determined by your API key. This field is ignored
281
287
  * by the gateway and will be removed in v1.0. Use `serviceName` and
@@ -311,6 +317,14 @@ interface RisicareConfig {
311
317
  debug?: boolean;
312
318
  /** Enable gzip compression for HTTP exports (default: false) */
313
319
  compress?: boolean;
320
+ /**
321
+ * Whether FixRuntime starts (or `RISICARE_FIX_RUNTIME=true`).
322
+ *
323
+ * **Default `false` since 0.7.0** (it started whenever an `apiKey` was set).
324
+ * When true, the SDK polls `/fixes/active` every 60 s and applies the active
325
+ * fixes to LLM calls. When false, nothing polls and nothing is applied.
326
+ */
327
+ fixRuntime?: boolean;
314
328
  /** Custom metadata attached to all spans */
315
329
  metadata?: Record<string, unknown>;
316
330
  /**
@@ -951,7 +965,7 @@ declare function isProviderInstrumentationSuppressed(): boolean;
951
965
  * Port of Python SDK's runtime/config.py adapted for Node.js patterns.
952
966
  */
953
967
  interface FixRuntimeConfig {
954
- /** API endpoint URL (e.g., "https://app.risicare.ai") */
968
+ /** Api URL, serving /v1/fixes/active (e.g., "https://api.risicare.ai") */
955
969
  apiEndpoint: string;
956
970
  /** API key for authentication (format: "rsk-{random}") */
957
971
  apiKey: string;
package/dist/index.js CHANGED
@@ -130,15 +130,121 @@ function applyMask(span, mask, onError) {
130
130
  markMasked(span);
131
131
  }
132
132
  var CONTENT_KEYS_EXACT = /* @__PURE__ */ new Set([
133
+ // spec v1
133
134
  "gen_ai.system_prompt",
134
- "gen_ai.prompt.message"
135
+ // anthropic, bedrock
136
+ "gen_ai.prompt.message",
137
+ // cohere
138
+ "gen_ai.prompt",
139
+ // OTel GenAI (deprecated form)
140
+ "gen_ai.completion",
141
+ "gen_ai.input.messages",
142
+ // OTel GenAI
143
+ "gen_ai.output.messages",
144
+ "gen_ai.system_instructions",
145
+ "gen_ai.tool.call.arguments",
146
+ "gen_ai.tool.call.result",
147
+ "input.value",
148
+ // OpenInference
149
+ "output.value",
150
+ "llm.prompts",
151
+ "llm.prompt_template.template",
152
+ "llm.prompt_template.variables",
153
+ "task_description",
154
+ // CrewAI
155
+ // ⚠ EXTENSION to spec v1: content keys that the Python SDK's integrations emit
156
+ // and that no v1 rule strips. Kept here too, so the two SDKs agree on the rule.
157
+ "framework.crewai.task_description",
158
+ "framework.crewai.agent_goal",
159
+ "framework.crewai.agent_output",
160
+ "framework.crewai.result",
161
+ "framework.autogen.last_message",
162
+ "framework.autogen.reply",
163
+ "framework.autogen.response",
164
+ "framework.openai_agents.input",
165
+ "framework.openai_agents.output",
166
+ "framework.dspy.signature",
167
+ "gen_ai.request.messages",
168
+ "agent.action.input",
169
+ "agent.action.log",
170
+ "agent.finish.output",
171
+ "tool.input",
172
+ "tool.output",
173
+ "retriever.query",
174
+ "retriever.first_doc",
175
+ // ⚠ FAIL CLOSED: third-party content keys that no other rule strips.
176
+ "gen_ai.retrieval.query.text",
177
+ // OTel GenAI
178
+ "gen_ai.retrieval.documents",
179
+ "gen_ai.evaluation.explanation",
180
+ "llm.function_call",
181
+ // OpenInference
182
+ "llm.choices",
183
+ "reranker.query",
184
+ "audio.transcript",
185
+ "traceloop.entity.input",
186
+ // OpenLLMetry
187
+ "traceloop.entity.output"
135
188
  ]);
189
+ var CONTENT_LAST_SEGMENT_IN_CONTEXT = /* @__PURE__ */ new Map([
190
+ ["function_call_arguments_json", /* @__PURE__ */ new Set()],
191
+ // OpenInference `message.*`
192
+ ["data", /* @__PURE__ */ new Set(["message_content"])],
193
+ ["url", /* @__PURE__ */ new Set(["image"])],
194
+ // `image.url` can hold base64 data
195
+ ["metadata", /* @__PURE__ */ new Set(["document", "documents"])]
196
+ ]);
197
+ var CONTENT_CONTAINER_SEGMENTS = /* @__PURE__ */ new Set([
198
+ "message",
199
+ "messages",
200
+ "message_content",
201
+ "contents",
202
+ "embedding",
203
+ "embeddings",
204
+ "document",
205
+ "documents",
206
+ "tool_call",
207
+ "tool_calls",
208
+ "function"
209
+ ]);
210
+ var CONTENT_KEYS_KEEP_EXACT = /* @__PURE__ */ new Set([
211
+ "gen_ai.response.content_type",
212
+ "gen_ai.response.content_blocks",
213
+ "gen_ai.prompt.parts",
214
+ "gen_ai.prompt.count",
215
+ "gen_ai.response.choices",
216
+ "gen_ai.completion.tool_calls"
217
+ ]);
218
+ var KEEP_LAST_SEGMENTS = /* @__PURE__ */ new Set([
219
+ "role",
220
+ "name",
221
+ "id",
222
+ "type",
223
+ "count",
224
+ "index",
225
+ "model",
226
+ "finish_reason",
227
+ "mime_type"
228
+ ]);
229
+ var KEEP_LAST_SUFFIXES = ["_length", "_tokens", "_count"];
136
230
  var CONTENT_OMITTED_MARKER = "<risicare:content-omitted>";
137
231
  function isContentKey(key) {
138
- if (CONTENT_KEYS_EXACT.has(key)) return true;
139
- const lastSegment = key.slice(key.lastIndexOf(".") + 1);
140
- if (lastSegment === "content") return true;
141
- return key.endsWith("_content");
232
+ if (CONTENT_KEYS_KEEP_EXACT.has(key)) return false;
233
+ if (CONTENT_KEYS_EXACT.has(key) || key.endsWith("_content")) return true;
234
+ const segments = key.split(".");
235
+ const last = segments[segments.length - 1];
236
+ const context = CONTENT_LAST_SEGMENT_IN_CONTEXT.get(last);
237
+ if (context && (context.size === 0 || segments.slice(0, -1).some((s) => context.has(s)))) {
238
+ return true;
239
+ }
240
+ if (KEEP_LAST_SEGMENTS.has(last) || KEEP_LAST_SUFFIXES.some((x) => last.endsWith(x))) {
241
+ return false;
242
+ }
243
+ if (last === "content") return true;
244
+ if (last === "text" || last === "arguments") {
245
+ return segments.slice(0, -1).some((s) => CONTENT_CONTAINER_SEGMENTS.has(s));
246
+ }
247
+ return false;
142
248
  }
143
249
  function stripAttributes(attrs) {
144
250
  let n = 0;
@@ -621,11 +727,13 @@ var BatchSpanProcessor = class _BatchSpanProcessor {
621
727
  };
622
728
 
623
729
  // src/config.ts
624
- var DEFAULT_ENDPOINT = "https://app.risicare.ai";
730
+ var DEFAULT_ENDPOINT = "https://ingest.risicare.ai";
731
+ var DEFAULT_API_ENDPOINT = "https://api.risicare.ai";
625
732
  function resolveConfig(config) {
626
733
  const env = process.env;
627
734
  const apiKey = config?.apiKey ?? env.RISICARE_API_KEY;
628
735
  const endpoint = config?.endpoint ?? env.RISICARE_ENDPOINT ?? DEFAULT_ENDPOINT;
736
+ const apiEndpoint = config?.apiEndpoint ?? env.RISICARE_API_ENDPOINT ?? config?.endpoint ?? env.RISICARE_ENDPOINT ?? DEFAULT_API_ENDPOINT;
629
737
  const projectId = config?.projectId ?? env.RISICARE_PROJECT_ID;
630
738
  if (config?.projectId || env.RISICARE_PROJECT_ID) {
631
739
  console.warn(
@@ -639,6 +747,7 @@ function resolveConfig(config) {
639
747
  const sampleRateRaw = config?.sampleRate ?? parseFloat(env.RISICARE_SAMPLE_RATE ?? "1.0");
640
748
  const debug2 = config?.debug ?? parseBool(env.RISICARE_DEBUG, false);
641
749
  const compress = config?.compress ?? parseBool(env.RISICARE_COMPRESS, false);
750
+ const fixRuntime = config?.fixRuntime ?? parseBool(env.RISICARE_FIX_RUNTIME, false);
642
751
  const batchSizeRaw = config?.batchSize ?? parseNumericEnv(env.RISICARE_BATCH_SIZE, DEFAULT_BATCH_SIZE);
643
752
  const batchTimeoutMsRaw = config?.batchTimeoutMs ?? parseNumericEnv(env.RISICARE_BATCH_TIMEOUT_MS, 1e3);
644
753
  const maxQueueSizeRaw = config?.maxQueueSize ?? parseNumericEnv(env.RISICARE_MAX_QUEUE_SIZE, 1e4);
@@ -662,6 +771,7 @@ function resolveConfig(config) {
662
771
  return {
663
772
  apiKey: apiKey ?? "",
664
773
  endpoint,
774
+ apiEndpoint,
665
775
  projectId: projectId ?? "",
666
776
  environment,
667
777
  serviceName: serviceName ?? "",
@@ -674,6 +784,7 @@ function resolveConfig(config) {
674
784
  maxQueueSize,
675
785
  debug: debug2,
676
786
  compress,
787
+ fixRuntime,
677
788
  metadata: config?.metadata ?? {},
678
789
  // No env fallback — see the field's note on RisicareConfig.
679
790
  mask: config?.mask
@@ -1757,13 +1868,14 @@ var Tracer = class {
1757
1868
  };
1758
1869
 
1759
1870
  // src/version.ts
1760
- var SDK_VERSION = "0.6.0";
1871
+ var SDK_VERSION = "0.7.0";
1761
1872
 
1762
1873
  // src/exporters/http.ts
1763
1874
  var CAPACITY_REFUSAL_STATUSES = /* @__PURE__ */ new Set([429, 503]);
1764
1875
  var RETRY_AFTER_CEILING_MS = 1e4;
1765
1876
  var REFUSAL_BACKOFF_BASE_MS = 1e3;
1766
1877
  var REFUSAL_NO_HINT = -1;
1878
+ var MISROUTE_WARN_WINDOW_MS = 3e5;
1767
1879
  var HttpExporter = class {
1768
1880
  name = "http";
1769
1881
  _endpoint;
@@ -1791,6 +1903,9 @@ var HttpExporter = class {
1791
1903
  * same reason (its `_send_request` signature is pin-locked).
1792
1904
  */
1793
1905
  _lastRefusalAfterMs = null;
1906
+ /** Set by `_sendRequest` on a MISROUTE: a short description of the answer. `null` = none. */
1907
+ _lastMisroute = null;
1908
+ _lastMisrouteWarnAt = -Infinity;
1794
1909
  _circuitOpenUntil = 0;
1795
1910
  _circuitBreakerThreshold = 5;
1796
1911
  _circuitBreakerCooldownMs = 6e4;
@@ -1821,11 +1936,13 @@ var HttpExporter = class {
1821
1936
  const maxAttempts = isHalfOpen ? 1 : this._maxRetries;
1822
1937
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
1823
1938
  this._lastRefusalAfterMs = null;
1939
+ this._lastMisroute = null;
1824
1940
  const result = await this._sendRequest(body);
1825
1941
  if (result === "success" /* SUCCESS */) {
1826
1942
  this._consecutiveFailures = 0;
1827
1943
  return result;
1828
1944
  }
1945
+ if (this._lastMisroute !== null) break;
1829
1946
  if (attempt < maxAttempts - 1) {
1830
1947
  const refusal = this._lastRefusalAfterMs;
1831
1948
  const delay = refusal === null ? 100 * Math.pow(2, attempt) : refusal === REFUSAL_NO_HINT ? REFUSAL_BACKOFF_BASE_MS * Math.pow(2, attempt) : refusal;
@@ -1840,6 +1957,14 @@ var HttpExporter = class {
1840
1957
  );
1841
1958
  return "failure" /* FAILURE */;
1842
1959
  }
1960
+ const misroute = this._lastMisroute;
1961
+ this._lastMisroute = null;
1962
+ if (misroute !== null && Date.now() - this._lastMisrouteWarnAt > MISROUTE_WARN_WINDOW_MS) {
1963
+ this._lastMisrouteWarnAt = Date.now();
1964
+ warn(
1965
+ `Risicare: spans are NOT reaching ${this._endpoint}. It answered POST /v1/spans with ${misroute}. That is not the Risicare ingest gateway, so the endpoint is probably wrong (for example the dashboard URL instead of the ingest gateway URL). The SDK does not follow redirects, and this batch is counted as NOT delivered. Set endpoint or RISICARE_ENDPOINT to the ingest gateway URL.`
1966
+ );
1967
+ }
1843
1968
  this._consecutiveFailures++;
1844
1969
  if (this._consecutiveFailures >= this._circuitBreakerThreshold) {
1845
1970
  this._circuitOpenUntil = Date.now() + this._circuitBreakerCooldownMs;
@@ -1849,6 +1974,12 @@ var HttpExporter = class {
1849
1974
  }
1850
1975
  return "failure" /* FAILURE */;
1851
1976
  }
1977
+ /** Record a MISROUTE for the retry loop and the breaker. Always returns FAILURE. */
1978
+ _noteMisroute(answer) {
1979
+ this._lastMisroute = answer.slice(0, 300);
1980
+ debug(`Ingest misroute: ${this._lastMisroute}`);
1981
+ return "failure" /* FAILURE */;
1982
+ }
1852
1983
  /**
1853
1984
  * Record a CAPACITY REFUSAL for the retry loop. Returns true if it was one.
1854
1985
  *
@@ -1901,11 +2032,23 @@ var HttpExporter = class {
1901
2032
  method: "POST",
1902
2033
  headers,
1903
2034
  body: payload,
1904
- signal: controller.signal
2035
+ signal: controller.signal,
2036
+ // Never follow: a redirect is a misroute (see MISROUTE_WARN_WINDOW_MS). Node returns
2037
+ // the 3xx itself; a browser-like runtime returns type 'opaqueredirect' with status 0.
2038
+ redirect: "manual"
1905
2039
  });
1906
2040
  clearTimeout(timeoutId);
1907
- if (response.status < 300) {
1908
- return await checkAck(response);
2041
+ const redirected = response.type === "opaqueredirect";
2042
+ if (redirected || response.status >= 300 && response.status < 400) {
2043
+ const location = response.headers?.get?.("Location");
2044
+ const target = location ? location.slice(0, 200) : "no Location header";
2045
+ return this._noteMisroute(`HTTP ${response.status || "3xx"}, a redirect to ${target}`);
2046
+ }
2047
+ if (response.status >= 200 && response.status < 300) {
2048
+ const ack = await checkAck(response);
2049
+ return ack === null ? this._noteMisroute(
2050
+ `HTTP ${response.status} and a body that is not a Risicare ack (content-type: ${response.headers?.get?.("Content-Type") || "none"})`
2051
+ ) : ack;
1909
2052
  } else if (response.status === 408 || response.status === 504) {
1910
2053
  debug(`HTTP export timeout: ${response.status}`);
1911
2054
  return "timeout" /* TIMEOUT */;
@@ -1932,17 +2075,16 @@ async function checkAck(response) {
1932
2075
  try {
1933
2076
  payload = await response.json();
1934
2077
  } catch {
1935
- return "success" /* SUCCESS */;
2078
+ return null;
1936
2079
  }
1937
2080
  if (payload === null || typeof payload !== "object" || Array.isArray(payload)) {
1938
- return "success" /* SUCCESS */;
2081
+ return null;
1939
2082
  }
1940
2083
  const body = payload;
1941
2084
  const accepted = asCount(body.accepted);
1942
2085
  const rejected = asCount(body.rejected);
1943
- if (accepted === void 0 || rejected === void 0 || rejected <= 0) {
1944
- return "success" /* SUCCESS */;
1945
- }
2086
+ if (accepted === void 0 || rejected === void 0) return null;
2087
+ if (rejected === 0) return "success" /* SUCCESS */;
1946
2088
  const errors = body.errors;
1947
2089
  const detail = typeof body.errorMessage === "string" && body.errorMessage || typeof body.error_message === "string" && body.error_message || (Array.isArray(errors) && errors.length > 0 ? JSON.stringify(errors[0]) : "") || "No reason was returned.";
1948
2090
  const total = accepted + rejected;
@@ -2643,7 +2785,7 @@ var FixLoader = class _FixLoader {
2643
2785
  }
2644
2786
  try {
2645
2787
  const endpoint = this._config.apiEndpoint.replace(/\/+$/, "");
2646
- const url = `${endpoint}/api/v1/fixes/active`;
2788
+ const url = `${endpoint}/v1/fixes/active`;
2647
2789
  const controller = new AbortController();
2648
2790
  const timeoutId = setTimeout(
2649
2791
  () => controller.abort(),
@@ -3055,10 +3197,10 @@ var RisicareClient = class {
3055
3197
  serviceVersion: this.config.serviceVersion
3056
3198
  });
3057
3199
  this.processor.start();
3058
- if (this.config.apiKey && this.config.enabled) {
3200
+ if (this.config.apiKey && this.config.enabled && this.config.fixRuntime) {
3059
3201
  try {
3060
3202
  initFixRuntime({
3061
- apiEndpoint: this.config.endpoint,
3203
+ apiEndpoint: this.config.apiEndpoint,
3062
3204
  apiKey: this.config.apiKey,
3063
3205
  enabled: true,
3064
3206
  debug: this.config.debug
@@ -3080,6 +3222,11 @@ var RisicareClient = class {
3080
3222
  this._registerShutdownHooks();
3081
3223
  setDebug(this.config.debug);
3082
3224
  debug(`Initialized: enabled=${this.config.enabled}, endpoint=${this.config.endpoint}`);
3225
+ if (!this.config.fixRuntime) {
3226
+ debug(
3227
+ "FixRuntime is off: nothing polls /fixes/active and no fix is applied. Opt in with fixRuntime: true or RISICARE_FIX_RUNTIME=true."
3228
+ );
3229
+ }
3083
3230
  }
3084
3231
  get enabled() {
3085
3232
  return this.tracer.enabled;
@@ -3341,8 +3488,8 @@ function score(traceId, name, value, options) {
3341
3488
  }
3342
3489
  const client = getClient();
3343
3490
  if (!client?.enabled || !client.config.apiKey) return;
3344
- const endpoint = client.config.endpoint.replace(/\/$/, "");
3345
- const url = `${endpoint}/api/v1/scores`;
3491
+ const endpoint = client.config.apiEndpoint.replace(/\/+$/, "");
3492
+ const url = `${endpoint}/v1/scores`;
3346
3493
  let comment = options?.comment;
3347
3494
  if (comment !== void 0 && client.config.mask) {
3348
3495
  comment = maskText(client.config.mask, SCORE_COMMENT_KEY, comment);