@veryfront/ext-content-mdx 0.1.1260 → 0.1.1262-rc.19921

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1260",
3
+ "version": "0.1.1262-rc.19921",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -45,4 +45,26 @@ export declare function hasTransientErrorCode(text: string): boolean;
45
45
  * bare string reaches `sanitizeErrorForTelemetry` as raw text.
46
46
  */
47
47
  export declare function telemetryErrorType(error: unknown): string;
48
+ /**
49
+ * Bounded classification of the failure an error wraps, for a span attribute
50
+ * such as `error.cause.type`. Same safety posture as `telemetryErrorType`: the
51
+ * cause's message never leaves the process.
52
+ */
53
+ export declare function telemetryErrorCauseType(error: unknown): string | undefined;
54
+ /** One link of a wrapped error's cause chain, safe to put in a server log. */
55
+ export interface LoggedErrorCause {
56
+ name: string;
57
+ /** Present only for exact allowlisted diagnostics; see {@link LOGGABLE_CAUSE_MESSAGES}. */
58
+ message?: string;
59
+ /** True when the cause had a message that was withheld because it may carry untrusted content. */
60
+ messageRedacted?: true;
61
+ code?: string;
62
+ }
63
+ /**
64
+ * Summarize the failures an error wraps for a server log: name, a
65
+ * credential-redacted and bounded message, and `code` when present. Stacks are
66
+ * omitted, the chain is capped, and accessors are never run. Returns undefined
67
+ * when the error wraps nothing.
68
+ */
69
+ export declare function summarizeErrorCausesForLog(error: unknown): LoggedErrorCause[] | undefined;
48
70
  //# sourceMappingURL=telemetry-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-error.d.ts","sourceRoot":"","sources":["../../../src/src/observability/telemetry-error.ts"],"names":[],"mappings":"AA2KA,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,CAAC,MAAM,GAAG,MAA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TRACE_ATTR
3
3
  import { MAX_OBSERVABILITY_CONFIG_TEXT_LENGTH, MAX_STRUCTURED_TELEMETRY_CONTAINER_ENTRIES, MAX_STRUCTURED_TELEMETRY_DEPTH, MAX_STRUCTURED_TELEMETRY_NODES, MAX_TELEMETRY_ATTRIBUTE_ARRAY_LENGTH, MAX_TELEMETRY_ATTRIBUTE_COUNT, MAX_TELEMETRY_ATTRIBUTE_KEY_LENGTH, } from "./limits.js";
4
4
  import { snapshotVeryfrontError } from "../errors/types.js";
5
5
  import { isNativeErrorWithoutHooks, isProxyWithoutHooks, readNativeErrorNameWithoutHooks, readNativeErrorStackWithoutHooks, } from "../platform/compat/error-introspection.js";
6
+ import { readRuntimeProviderStreamFailureCause } from "../runtime/provider-stream-error-provenance.js";
6
7
  const apply = Reflect.apply;
7
8
  const createObject = Object.create;
8
9
  const defineProperty = Object.defineProperty;
@@ -17,7 +18,10 @@ const NativeURL = URL;
17
18
  const dateGetTime = Date.prototype.getTime;
18
19
  const objectHasOwnProperty = Object.prototype.hasOwnProperty;
19
20
  const regExpExec = RegExp.prototype.exec;
21
+ const setAdd = Set.prototype.add;
20
22
  const setHas = Set.prototype.has;
23
+ const arrayPush = Array.prototype.push;
24
+ const NativeSet = Set;
21
25
  const stringSlice = String.prototype.slice;
22
26
  const ERROR_PROTOTYPE = NativeError.prototype;
23
27
  const URL_HREF_GETTER = readOwnDescriptorGetter(NativeURL.prototype, "href");
@@ -407,6 +411,7 @@ export function sanitizeErrorForTelemetry(error, detail = "withStack", safeName)
407
411
  return createErrorShapedRecord("Unknown error", "Unknown");
408
412
  }
409
413
  }
414
+ const RUNTIME_PROVIDER_STREAM_FAILURE = "RuntimeProviderStreamFailure";
410
415
  const SAFE_TELEMETRY_ERROR_NAMES = new Set([
411
416
  "Error",
412
417
  "EvalError",
@@ -449,6 +454,10 @@ export function telemetryErrorType(error) {
449
454
  const veryfrontError = snapshotVeryfrontError(error);
450
455
  if (veryfrontError)
451
456
  return `VeryfrontError:${veryfrontError.status}`;
457
+ // Brand-checked rather than name-matched: the wrapper's cause is private,
458
+ // so its type is the only span-safe signal that the provider stream broke.
459
+ if (readRuntimeProviderStreamFailureCause(error).found)
460
+ return RUNTIME_PROVIDER_STREAM_FAILURE;
452
461
  if (!isNativeErrorWithoutHooks(error))
453
462
  return "Unknown";
454
463
  const code = readOwnErrorDataField(error, "code");
@@ -465,3 +474,110 @@ export function telemetryErrorType(error) {
465
474
  return "Error";
466
475
  }
467
476
  }
477
+ const NO_CAUSE = Symbol("no-cause");
478
+ const MAX_LOGGED_ERROR_CAUSES = 4;
479
+ /**
480
+ * The failure an error wraps: the private cause of a provider stream failure,
481
+ * else a native error's own `cause` data property. Accessors are never run.
482
+ */
483
+ function readErrorCause(error) {
484
+ try {
485
+ const providerFailure = readRuntimeProviderStreamFailureCause(error);
486
+ if (providerFailure.found)
487
+ return providerFailure.cause;
488
+ if (!isNativeErrorWithoutHooks(error))
489
+ return NO_CAUSE;
490
+ const descriptor = getOwnPropertyDescriptor(error, "cause");
491
+ if (!descriptor || !hasOwn(descriptor, "value"))
492
+ return NO_CAUSE;
493
+ return descriptor.value;
494
+ }
495
+ catch (_) {
496
+ return NO_CAUSE;
497
+ }
498
+ }
499
+ /**
500
+ * Bounded classification of the failure an error wraps, for a span attribute
501
+ * such as `error.cause.type`. Same safety posture as `telemetryErrorType`: the
502
+ * cause's message never leaves the process.
503
+ */
504
+ export function telemetryErrorCauseType(error) {
505
+ try {
506
+ const cause = readErrorCause(error);
507
+ return cause === NO_CAUSE ? undefined : telemetryErrorType(cause);
508
+ }
509
+ catch (_) {
510
+ return undefined;
511
+ }
512
+ }
513
+ /**
514
+ * The complete set of cause messages safe to log verbatim: the exact texts the
515
+ * Anthropic stream parser emits with its fixed limits, and one fixed transport
516
+ * message. Matching is by equality, so no variable text (counts, identifiers,
517
+ * customer data) can pass, whichever component throws the error. Every other
518
+ * cause message may embed untrusted data and is withheld.
519
+ */
520
+ const LOGGABLE_CAUSE_MESSAGES = new NativeSet([
521
+ "Anthropic partial_json exceeded 4096 deltas",
522
+ "Anthropic partial_json exceeded 4096 empty fragments",
523
+ "Anthropic partial_json exceeded 1048576 UTF-8 bytes",
524
+ "Anthropic retained content exceeded 8192 items (content block)",
525
+ "Anthropic retained content exceeded 8192 items (citation delta)",
526
+ "Anthropic retained content exceeded 8192 items (text delta)",
527
+ "Anthropic retained content exceeded 8192 items (thinking delta)",
528
+ "Anthropic retained content exceeded 8192 empty fragments (text delta)",
529
+ "Anthropic retained content exceeded 8192 empty fragments (thinking delta)",
530
+ "Anthropic retained content exceeded 16777216 UTF-8 bytes (content block)",
531
+ "Anthropic retained content exceeded 16777216 UTF-8 bytes (citation delta)",
532
+ "Anthropic retained content exceeded 16777216 UTF-8 bytes (text delta)",
533
+ "Anthropic retained content exceeded 16777216 UTF-8 bytes (thinking delta)",
534
+ "error reading a body from connection",
535
+ ]);
536
+ function isLoggableCauseMessage(message) {
537
+ return apply(setHas, LOGGABLE_CAUSE_MESSAGES, [message]) === true;
538
+ }
539
+ /**
540
+ * Summarize the failures an error wraps for a server log: name, a
541
+ * credential-redacted and bounded message, and `code` when present. Stacks are
542
+ * omitted, the chain is capped, and accessors are never run. Returns undefined
543
+ * when the error wraps nothing.
544
+ */
545
+ export function summarizeErrorCausesForLog(error) {
546
+ const causes = [];
547
+ try {
548
+ const seen = new NativeSet();
549
+ apply(setAdd, seen, [error]);
550
+ let cause = readErrorCause(error);
551
+ while (cause !== NO_CAUSE && causes.length < MAX_LOGGED_ERROR_CAUSES) {
552
+ if (apply(setHas, seen, [cause]) === true)
553
+ break;
554
+ apply(setAdd, seen, [cause]);
555
+ const snapshot = sanitizeErrorForTelemetry(cause, "withoutStack");
556
+ // Name and code are logged only as fixed classifications: an allowlisted
557
+ // error name (else "Error"/"Unknown") and a known transient code token.
558
+ const entry = { name: "Unknown" };
559
+ if (isNativeErrorWithoutHooks(cause)) {
560
+ const rawName = readNativeErrorNameWithoutHooks(cause);
561
+ entry.name = apply(setHas, SAFE_TELEMETRY_ERROR_NAMES, [rawName]) === true
562
+ ? rawName
563
+ : "Error";
564
+ const code = readOwnErrorDataField(cause, "code");
565
+ const knownCode = typeof code === "string" ? matchTransientErrorCode(code) : undefined;
566
+ if (knownCode !== undefined)
567
+ entry.code = knownCode;
568
+ }
569
+ if (isLoggableCauseMessage(snapshot.message)) {
570
+ entry.message = snapshot.message;
571
+ }
572
+ else if (snapshot.message.length > 0) {
573
+ entry.messageRedacted = true;
574
+ }
575
+ apply(arrayPush, causes, [entry]);
576
+ cause = readErrorCause(cause);
577
+ }
578
+ }
579
+ catch (_) {
580
+ // Diagnostics are best effort and must never replace the logged failure.
581
+ }
582
+ return causes.length > 0 ? causes : undefined;
583
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-setup.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/tracing/otlp-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;4BAY4B;AAM5B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,OAAO,EAQZ,KAAK,IAAI,EAET,KAAK,IAAI,EACT,QAAQ,EAMT,MAAM,eAAe,CAAC;AAevB,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AA6DD,sCAAsC;AACtC,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CASpD;AAED,qCAAqC;AACrC,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAGlD;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,0DAA0D;AAC1D,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5D;AAuJD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EA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E,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAC1C,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAK7D;AAED,wBAAwB;AACxB,wBAAsB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM3F;AAED,6BAA6B;AAC7B;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAC1C,IAAI,GAAG,SAAS,CAMlB;AAED,+FAA+F;AAC/F,wBAAgB,cAAc,CAC5B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAC1C,IAAI,GAAG,SAAS,CAElB;AAED,wBAAgB,eAAe,IAAI;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAUvE"}
@@ -18,7 +18,7 @@ import { sanitizeUrlForSpan } from "../../utils/logger/redact.js";
18
18
  import { context as shimContext, createPublicContext, createPublicSpan, defaultTextMapGetter, defaultTextMapSetter, getTracer, getTracerProviderRevision, propagation as shimPropagation, SpanKind, SpanStatusCode, trace as shimTrace, unwrapPublicContext, unwrapPublicSpan, } from "./api-shim.js";
19
19
  import { formatTraceparent, parseTraceparent } from "./traceparent.js";
20
20
  import { getHostTelemetryEnv } from "./telemetry-env.js";
21
- import { sanitizeErrorForTelemetry, sanitizeTelemetryAttributes, sanitizeTelemetryAttributeValue, sanitizeTelemetryText, telemetryErrorType, } from "../telemetry-error.js";
21
+ import { sanitizeErrorForTelemetry, sanitizeTelemetryAttributes, sanitizeTelemetryAttributeValue, sanitizeTelemetryText, telemetryErrorCauseType, telemetryErrorType, } from "../telemetry-error.js";
22
22
  import { runAsyncWithContextFallback, runSyncWithContextFallback } from "./context-callback.js";
23
23
  const logger = serverLogger.component("otel");
24
24
  function parseHeaders(headerString) {
@@ -262,6 +262,11 @@ function boundedSpanError(error) {
262
262
  */
263
263
  function reportSpanFailure(span, error, options) {
264
264
  const statusError = spanErrorStatus(error, options);
265
+ runTelemetryOperation(() => {
266
+ const causeType = telemetryErrorCauseType(error);
267
+ if (causeType !== undefined)
268
+ span.setAttribute("error.cause.type", causeType);
269
+ }, "Failed to classify span error cause");
265
270
  setSpanErrorStatus(span, statusError, statusError === error ? "withStack" : "withoutStack");
266
271
  }
267
272
  /** Applies span. */
@@ -0,0 +1,10 @@
1
+ /** Mark an error from a proven provider-owned stream boundary. */
2
+ export declare function createRuntimeProviderStreamFailure(error: unknown): Error;
3
+ /** Read a provider-owned cause without exposing it on the public error object. */
4
+ export declare function readRuntimeProviderStreamFailureCause(error: unknown): {
5
+ found: false;
6
+ } | {
7
+ found: true;
8
+ cause: unknown;
9
+ };
10
+ //# sourceMappingURL=provider-stream-error-provenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-stream-error-provenance.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/provider-stream-error-provenance.ts"],"names":[],"mappings":"AAcA,kEAAkE;AAClE,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAGxE;AAED,kFAAkF;AAClF,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,OAAO,GACb;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAcpD"}
@@ -0,0 +1,32 @@
1
+ const reflectApply = Reflect.apply;
2
+ const weakMapGet = WeakMap.prototype.get;
3
+ const weakMapHas = WeakMap.prototype.has;
4
+ const weakMapSet = WeakMap.prototype.set;
5
+ const runtimeProviderStreamFailureCauses = new WeakMap();
6
+ class RuntimeProviderStreamFailure extends Error {
7
+ constructor(cause) {
8
+ super("Provider stream failed");
9
+ this.name = "RuntimeProviderStreamFailure";
10
+ reflectApply(weakMapSet, runtimeProviderStreamFailureCauses, [this, cause]);
11
+ }
12
+ }
13
+ /** Mark an error from a proven provider-owned stream boundary. */
14
+ export function createRuntimeProviderStreamFailure(error) {
15
+ if (readRuntimeProviderStreamFailureCause(error).found)
16
+ return error;
17
+ return new RuntimeProviderStreamFailure(error);
18
+ }
19
+ /** Read a provider-owned cause without exposing it on the public error object. */
20
+ export function readRuntimeProviderStreamFailureCause(error) {
21
+ if ((typeof error !== "object" || error === null) &&
22
+ typeof error !== "function") {
23
+ return { found: false };
24
+ }
25
+ if (!reflectApply(weakMapHas, runtimeProviderStreamFailureCauses, [error])) {
26
+ return { found: false };
27
+ }
28
+ return {
29
+ found: true,
30
+ cause: reflectApply(weakMapGet, runtimeProviderStreamFailureCauses, [error]),
31
+ };
32
+ }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1260";
2
+ export declare const VERSION = "0.1.1262-rc.19921";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-constant.d.ts","sourceRoot":"","sources":["../../../src/src/utils/version-constant.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"version-constant.d.ts","sourceRoot":"","sources":["../../../src/src/utils/version-constant.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,OAAO,sBAAsB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1260";
4
+ export const VERSION = "0.1.1262-rc.19921";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-content-mdx",
3
- "version": "0.1.1260",
3
+ "version": "0.1.1262-rc.19921",
4
4
  "description": "Veryfront first-party extension package for ext-content-mdx",
5
5
  "keywords": [
6
6
  "veryfront",
@@ -53,7 +53,7 @@
53
53
  "@types/hast": "3.0.3",
54
54
  "@types/mdast": "4.0.3",
55
55
  "@types/unist": "3.0.2",
56
- "@veryfront/ext-parser-babel": "0.1.1260",
56
+ "@veryfront/ext-parser-babel": "0.1.1262-rc.19921",
57
57
  "acorn": "8.17.0",
58
58
  "acorn-jsx": "5.3.2",
59
59
  "github-slugger": "2.0.0",
@@ -82,7 +82,7 @@
82
82
  "vfile": "6.0.3"
83
83
  },
84
84
  "peerDependencies": {
85
- "veryfront": "^0.1.1260"
85
+ "veryfront": "^0.1.1262-rc.19921"
86
86
  },
87
87
  "type": "module",
88
88
  "types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
@@ -92,5 +92,5 @@
92
92
  "NOTICE",
93
93
  "README.md"
94
94
  ],
95
- "gitHead": "f9a278ca0498b52b524523e79c2af0deb42699c5"
95
+ "gitHead": "7fadf11d809c1a44616ff3fa4045ee2f22528840"
96
96
  }