@reliantlabs/forge-web-runtime 0.10.0 → 0.10.2
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 +76 -0
- package/dist/node-exception.d.ts +73 -0
- package/dist/node-exception.js +278 -0
- package/dist/node-exception.js.map +1 -0
- package/dist/node-otlp.d.ts +168 -0
- package/dist/node-otlp.js +235 -0
- package/dist/node-otlp.js.map +1 -0
- package/dist/node-trace.d.ts +41 -0
- package/dist/node-trace.js +331 -0
- package/dist/node-trace.js.map +1 -0
- package/dist/node.d.ts +153 -0
- package/dist/node.js +576 -0
- package/dist/node.js.map +1 -0
- package/dist/service-name.d.ts +2 -0
- package/dist/service-name.js +14 -0
- package/dist/service-name.js.map +1 -0
- package/package.json +16 -3
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,+BAA+B;AAC/B,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,gDAAgD;AAChD,2EAA2E;AAC3E,uEAAuE;AACvE,+EAA+E;AAC/E,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,0BAA0B;AAC1B,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,sEAAsE;AACtE,gEAAgE;AAChE,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,oEAAoE;AACpE,gBAAgB;AAChB,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EAAQ,EAAE;QAC3D,MAAM,CAAC,GAAG,OAAO,CAAC;QAClB,IAAI,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QACD,OAAO,GAAG,IAAI,CAAC;QACf,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC;aACH,KAAK,CAAC,OAAO,CAAC,SAAS,IAAI,wBAAwB,CAAC;aACpD,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC,CAAC;IACF,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAChC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Part of @reliantlabs/forge-web-runtime — the web twin of forge/pkg.\n//\n// Node / Electron-main telemetry: logs, errors and spans over OTLP/HTTP to the\n// same ingest the browser entry (`/telemetry`) ships to — usually the KEYED\n// ingest, `https://<ingest host>/k/<key>`, since a desktop app's main process\n// has no same-origin `/_otel`.\n//\n// ── What it records ──────────────────────────────────────────────────────\n//\n// - uncaught exceptions and unhandled rejections, as ERROR log records in\n// the shape forge/pkg/observe gives a server error (node-exception.ts), so\n// `forge obs issues` groups them with sfp1;\n// - what the app logs through `telemetry.logger`, and errors it hands to\n// `telemetry.reportError` (and to the barrel's `reportException`);\n// - spans: the global @opentelemetry/api tracer is this one (node-trace.ts).\n//\n// Records carry no `rum.sessionId`. That is what makes the issues pipeline\n// treat them as server-side errors (obsquery.ServerErrorFilterSQL), which is\n// what a main process is.\n//\n// ── What it changes about the process ────────────────────────────────────\n//\n// Nothing an app can observe, by design. Exceptions are watched through\n// `uncaughtExceptionMonitor`, which leaves the process's fate to whoever owns\n// it (the app's own handler, Electron's dialog, Node's exit). Rejections have\n// no monitor event, and any `unhandledRejection` listener — this one included\n// — switches off Node's default of raising the rejection as an uncaught\n// exception. So when this listener is the only one, it puts the default back:\n// it flushes the record, then raises the rejection as Node would have\n// (`--unhandled-rejections` is honoured). In plain Node with no\n// `uncaughtException` handler of the app's own, the process would die before\n// an async export could finish, so the runtime flushes first and then exits\n// as Node does (stderr, code 1). Under Electron the main process outlives an\n// uncaught exception by default, and nothing is installed.\n//\n// ── Batching and quitting ────────────────────────────────────────────────\n//\n// Records are queued and exported in batches (delay and size below), with\n// unref'd timers, so telemetry never keeps a process alive. A fatal record\n// starts its export at once. `flush(timeoutMs)` exports everything queued and\n// resolves by the timeout whatever the network does; `flushOnQuit(app)` runs\n// it from Electron's `before-quit`. An idle Node process flushes on\n// `beforeExit`.\n//\n// ── Privacy ──────────────────────────────────────────────────────────────\n//\n// Nothing about the user beyond what the browser entry sends: an opaque user\n// id when the app sets one, the app client, and the record itself. Messages,\n// bodies and string attributes have credential shapes redacted with the same\n// patterns `track()` uses; an exception keeps only its message's first line;\n// stack paths lose the home directory and the install location; object-valued\n// attributes are dropped, never serialized. No host name, no IP, no argv, no\n// environment.\nimport { createRequire } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { inspect } from \"node:util\";\n\nimport {\n context as contextApi,\n propagation,\n trace,\n type Tracer,\n} from \"@opentelemetry/api\";\n\nimport { setExceptionReporter } from \"./error-reporter.js\";\nimport {\n bound,\n boundMessage,\n ERROR_GROUP,\n exceptionAttributes,\n type PathScrub,\n} from \"./node-exception.js\";\nimport {\n type Attributes,\n type AttributeValue,\n BatchQueue,\n encodeAttributes,\n exportSignal,\n type ExporterOptions,\n type FetchLike,\n type KeyValue,\n type LogRecord,\n logsPayload,\n MAX_ATTRIBUTE_CHARS,\n nowMs,\n type Scope,\n SEVERITY,\n type SeverityText,\n type SpanRecord,\n tracesPayload,\n unixNanos,\n} from \"./node-otlp.js\";\nimport {\n AsyncLocalContextManager,\n type ContextOps,\n NodeTracerProvider,\n TraceparentPropagator,\n} from \"./node-trace.js\";\nimport { redactSecrets } from \"./track.js\";\n\nexport { frontendServiceName } from \"./service-name.js\";\nexport {\n CODE_FILE,\n CODE_FUNCTION,\n CODE_LINE,\n ERROR_GROUP,\n EXCEPTION_MESSAGE,\n EXCEPTION_STACKTRACE,\n EXCEPTION_TYPE,\n exceptionAttributes,\n type PathScrub,\n} from \"./node-exception.js\";\n\n/** The instrumentation scope of every log record this entry writes. */\nexport const NODE_SCOPE_NAME = \"@reliantlabs/forge-web-runtime/node\";\n\n/** Body of the record for an uncaught exception. */\nexport const UNCAUGHT_EXCEPTION_BODY = \"uncaught exception\";\n/** Body of the record for an unhandled rejection. */\nexport const UNHANDLED_REJECTION_BODY = \"unhandled rejection\";\n/** Body of the record for an error passed to reportError / reportException. */\nexport const REPORTED_EXCEPTION_BODY = \"caught exception\";\n\n/** Longest log body. */\nexport const MAX_BODY_CHARS = 4096;\n/** Longest user id, as the browser entry bounds it. */\nexport const MAX_USER_ID_CHARS = 128;\n\nexport const DEFAULT_FLUSH_TIMEOUT_MS = 2_000;\nexport const DEFAULT_BATCH_DELAY_MS = 5_000;\nexport const DEFAULT_MAX_BATCH = 256;\nexport const DEFAULT_MAX_QUEUE = 2_048;\nexport const DEFAULT_EXPORT_TIMEOUT_MS = 10_000;\n/**\n * Most records of ONE fatal error (same type, message and frame) per minute.\n * A handler that throws while handling — an EPIPE logger writing to the pipe\n * that just broke — raises the same exception in a tight loop, and each one\n * would otherwise be a record and a request.\n */\nexport const MAX_REPEATS_PER_MINUTE = 5;\n\n/** A value a caller may attach to a log record; anything else is dropped. */\nexport type LogAttributes = Record<string, unknown>;\n\nexport interface NodeTelemetryConfig {\n /** `service.name`. For a forge frontend: frontendServiceName(project, frontend). */\n serviceName: string;\n /** `service.version` — the release. */\n serviceVersion?: string;\n /** `service.namespace`, conventionally the project name. */\n serviceNamespace?: string;\n /** Emitted as `deployment.environment.name` and the legacy `deployment.environment`. */\n environment?: string;\n /** The forge frontend this process belongs to, as `forge.frontend`. */\n frontend?: string;\n /** `app.client` on every record and span (`electron`, `cli`, ...). */\n appClient?: string;\n /**\n * The OTLP base URL: `${endpoint}/v1/logs` and `/v1/traces` are posted to.\n * The keyed ingest is `https://<ingest host>/k/<key>`. Unset, empty, `off`\n * or not an absolute http(s) URL disables telemetry: init returns null and\n * installs nothing.\n */\n endpoint?: string;\n /**\n * The `Origin` header sent with every export. The keyed ingest admits a\n * request only when its Origin is EXACTLY one of the key's allowed origins,\n * so a desktop app sends its renderer's origin (`app://bundle`).\n */\n origin?: string;\n /** Extra request headers. */\n headers?: Record<string, string>;\n /** Files below it are reported relative to it. Electron: app.getAppPath(). Default process.cwd(). */\n appRoot?: string;\n /** Extra resource attributes. They cannot override `service.name`. */\n resourceAttributes?: Record<string, string>;\n /** Record uncaught exceptions and unhandled rejections. Default true. */\n captureProcessErrors?: boolean;\n /** Register the tracer, context manager and propagator globally. Default true. */\n registerGlobal?: boolean;\n /** Least severe level the logger exports. Default `INFO`. */\n minSeverity?: SeverityText;\n /** How long a record may wait for its batch. Default 5s. */\n batchDelayMs?: number;\n /** Most records in one request. Default 256. */\n maxBatchSize?: number;\n /** Most records held per signal; more are dropped and counted. Default 2048. */\n maxQueueSize?: number;\n /** One request's budget. Default 10s. */\n exportTimeoutMs?: number;\n /** How long a fatal error's record may delay the process's default exit. Default 2s. */\n fatalFlushTimeoutMs?: number;\n /** Told when a batch is dropped (the ingest refused it or was unreachable). */\n onExportError?: (error: Error) => void;\n /** Test seam: the fetch exports go through. Default globalThis.fetch. */\n fetch?: FetchLike;\n}\n\nexport interface NodeLogger {\n debug(body: string, attributes?: LogAttributes): void;\n info(body: string, attributes?: LogAttributes): void;\n warn(body: string, attributes?: LogAttributes): void;\n /** An ERROR record. An Error among the attributes supplies its exception.* keys. */\n error(body: string, attributes?: LogAttributes): void;\n}\n\nexport interface NodeTelemetry {\n readonly logger: NodeLogger;\n /** The tracer to open spans on (also the global one, unless registerGlobal is false). */\n readonly tracer: Tracer;\n /** One ERROR record for an error the app caught. */\n reportError(error: unknown, attributes?: LogAttributes): void;\n /** The opaque `userId` on every later record and span; null clears it. Never an email. */\n setUser(id: string | null): void;\n /** Export everything queued; resolves by `timeoutMs` (default 2s) whatever the network does. */\n flush(timeoutMs?: number): Promise<void>;\n /** Flush, then stop: every later call is a no-op. init may run again afterwards. */\n shutdown(timeoutMs?: number): Promise<void>;\n /** Records refused because a queue was full. */\n readonly dropped: number;\n}\n\nlet current: NodeTelemetry | null = null;\n\n/** The running instance, or null before init / after shutdown. */\nexport function getNodeTelemetry(): NodeTelemetry | null {\n return current;\n}\n\n/**\n * The absolute OTLP base for `endpoint`, or null when telemetry is off: unset,\n * empty, `off`, or not an absolute http(s) URL. Trailing slashes are dropped.\n */\nexport function resolveNodeIngestUrl(\n endpoint: string | undefined,\n): string | null {\n const value = (endpoint ?? \"\").trim();\n if (value === \"\" || value.toLowerCase() === \"off\") {\n return null;\n }\n try {\n const url = new URL(value);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return null;\n }\n url.search = \"\";\n url.hash = \"\";\n return url.toString().replace(/\\/+$/, \"\");\n } catch {\n return null;\n }\n}\n\nfunction sdkVersion(): string {\n try {\n const req = createRequire(import.meta.url);\n const v = (req(\"../package.json\") as { version?: unknown }).version;\n return typeof v === \"string\" ? v : \"\";\n } catch {\n return \"\";\n }\n}\n\nconst OS_TYPE: Record<string, string> = { win32: \"windows\", sunos: \"solaris\" };\nconst HOST_ARCH: Record<string, string> = {\n x64: \"amd64\",\n ia32: \"x86\",\n ppc64: \"ppc64\",\n};\n\n/**\n * The resource every record and span carries. Pure given its inputs;\n * exported for tests and for an app that wants to see exactly what is sent.\n */\nexport function buildNodeResource(\n config: Pick<\n NodeTelemetryConfig,\n | \"serviceName\"\n | \"serviceVersion\"\n | \"serviceNamespace\"\n | \"environment\"\n | \"frontend\"\n | \"resourceAttributes\"\n >,\n runtime: {\n versions: Record<string, string | undefined>;\n platform: string;\n arch: string;\n },\n version = sdkVersion(),\n): Record<string, string> {\n const electron = runtime.versions.electron;\n const out: Record<string, string> = {\n \"telemetry.sdk.name\": \"@reliantlabs/forge-web-runtime\",\n \"telemetry.sdk.language\": \"nodejs\",\n \"process.runtime.name\": electron ? \"electron\" : \"nodejs\",\n \"process.runtime.version\": (electron ??\n runtime.versions.node ??\n \"\") as string,\n \"os.type\": OS_TYPE[runtime.platform] ?? runtime.platform,\n \"host.arch\": HOST_ARCH[runtime.arch] ?? runtime.arch,\n };\n if (version) out[\"telemetry.sdk.version\"] = version;\n if (config.serviceVersion) out[\"service.version\"] = config.serviceVersion;\n if (config.serviceNamespace)\n out[\"service.namespace\"] = config.serviceNamespace;\n if (config.frontend) out[\"forge.frontend\"] = config.frontend;\n if (config.environment) {\n out[\"deployment.environment.name\"] = config.environment;\n out[\"deployment.environment\"] = config.environment;\n }\n Object.assign(out, config.resourceAttributes ?? {});\n out[\"service.name\"] = config.serviceName;\n return out;\n}\n\nfunction scrubString(value: string, max: number): string {\n return bound(redactSecrets(value.slice(0, max * 2)), max);\n}\n\n/**\n * Reduce caller attributes to what a record may carry: strings redacted and\n * bounded, finite numbers, booleans, arrays of those; an Error becomes its\n * bounded message (its stack goes in exception.*). Objects are dropped.\n */\nfunction sanitizeAttributes(attrs: LogAttributes | undefined): {\n attributes: Attributes;\n error: unknown;\n} {\n const out: Attributes = {};\n let error: unknown = undefined;\n if (!attrs || typeof attrs !== \"object\") {\n return { attributes: out, error };\n }\n for (const [key, v] of Object.entries(attrs)) {\n if (v instanceof Error) {\n if (error === undefined) error = v;\n out[key] = boundMessage(v.message ?? \"\");\n } else if (typeof v === \"string\") {\n out[key] = scrubString(v, MAX_ATTRIBUTE_CHARS);\n } else if (\n (typeof v === \"number\" && Number.isFinite(v)) ||\n typeof v === \"boolean\"\n ) {\n out[key] = v;\n } else if (Array.isArray(v)) {\n const kept = v\n .filter(\n (x) =>\n typeof x === \"string\" ||\n typeof x === \"boolean\" ||\n (typeof x === \"number\" && Number.isFinite(x)),\n )\n .map((x) =>\n typeof x === \"string\" ? scrubString(x, MAX_ATTRIBUTE_CHARS) : x,\n );\n out[key] = kept as AttributeValue;\n }\n }\n return { attributes: out, error };\n}\n\nfunction withTimeout(p: Promise<unknown>, ms: number): Promise<void> {\n return new Promise((resolve) => {\n const t = setTimeout(resolve, Math.max(0, ms));\n (t as { unref?: () => void }).unref?.();\n void p.then(\n () => {\n clearTimeout(t);\n resolve();\n },\n () => {\n clearTimeout(t);\n resolve();\n },\n );\n });\n}\n\n/** What `--unhandled-rejections` says Node does with a rejection nobody handles. */\nexport function unhandledRejectionMode(\n execArgv: readonly string[],\n nodeOptions: string | undefined,\n): string {\n const args = [...execArgv, ...(nodeOptions ?? \"\").split(/\\s+/)];\n let mode = \"throw\";\n for (let i = 0; i < args.length; i++) {\n const a = args[i] ?? \"\";\n if (a.startsWith(\"--unhandled-rejections=\")) {\n mode = a.slice(\"--unhandled-rejections=\".length);\n } else if (a === \"--unhandled-rejections\" && args[i + 1]) {\n mode = args[i + 1] as string;\n }\n }\n return mode;\n}\n\n/** The error Node raises for a rejection whose reason is not an Error. */\nfunction rejectionError(reason: unknown): Error {\n const err = new Error(\n \"This error originated either by throwing inside of an async function without a catch block, \" +\n \"or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason \" +\n `\"${inspect(reason)}\".`,\n );\n err.name = \"UnhandledPromiseRejection\";\n (err as { code?: string }).code = \"ERR_UNHANDLED_REJECTION\";\n return err;\n}\n\n/**\n * initNodeTelemetry starts telemetry for this process and returns it, or null\n * when it is off (no usable endpoint, no fetch, not Node). Idempotent: a\n * second call returns the running instance and ignores its config. Never\n * throws.\n */\nexport function initNodeTelemetry(\n config: NodeTelemetryConfig,\n): NodeTelemetry | null {\n if (current) {\n return current;\n }\n try {\n const instance = start(config);\n current = instance;\n return instance;\n } catch {\n // Telemetry must never break the app.\n return null;\n }\n}\n\nfunction start(config: NodeTelemetryConfig): NodeTelemetry | null {\n if (typeof process === \"undefined\" || !process.versions?.node) {\n return null;\n }\n const endpoint = resolveNodeIngestUrl(config.endpoint);\n const fetchFn: FetchLike | undefined =\n config.fetch ??\n (typeof globalThis.fetch === \"function\"\n ? (globalThis.fetch as unknown as FetchLike)\n : undefined);\n if (!endpoint || !fetchFn || !config.serviceName) {\n return null;\n }\n\n const isElectron = Boolean(process.versions.electron);\n const scrub: PathScrub = {\n appRoot: config.appRoot ?? process.cwd(),\n homeDir: safeHomedir(),\n caseInsensitive: process.platform === \"win32\",\n };\n const resource: KeyValue[] = encodeAttributes(\n buildNodeResource(config, {\n versions: process.versions,\n platform: process.platform,\n arch: process.arch,\n }),\n );\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const origin = config.origin?.trim().replace(/\\/+$/, \"\");\n if (origin) {\n headers[\"origin\"] = origin;\n }\n const exporter: ExporterOptions = {\n endpoint,\n headers,\n fetch: fetchFn,\n timeoutMs: config.exportTimeoutMs ?? DEFAULT_EXPORT_TIMEOUT_MS,\n retries: 2,\n onError: config.onExportError,\n };\n const batch = {\n maxQueue: config.maxQueueSize ?? DEFAULT_MAX_QUEUE,\n maxBatch: config.maxBatchSize ?? DEFAULT_MAX_BATCH,\n delayMs: config.batchDelayMs ?? DEFAULT_BATCH_DELAY_MS,\n };\n const logScope: Scope = {\n name: NODE_SCOPE_NAME,\n version: sdkVersion() || undefined,\n };\n const logs = new BatchQueue<LogRecord>({\n ...batch,\n send: (records) =>\n exportSignal(exporter, \"logs\", logsPayload(resource, logScope, records)),\n });\n const spans = new BatchQueue<SpanRecord>({\n ...batch,\n send: (records) =>\n exportSignal(exporter, \"traces\", tracesPayload(resource, records)),\n });\n\n let stopped = false;\n let userId: string | null = null;\n const globals = (): Attributes => {\n const g: Attributes = {};\n if (config.appClient) g[\"app.client\"] = config.appClient;\n if (userId) g[\"userId\"] = userId;\n return g;\n };\n\n // Context: ours, registered globally when allowed. If another manager got\n // there first, spans follow ITS context so the app's context.active() and\n // ours agree.\n const manager = new AsyncLocalContextManager();\n const registerGlobal = config.registerGlobal ?? true;\n const ownsContext =\n registerGlobal && contextApi.setGlobalContextManager(manager);\n const ctxOps: ContextOps = registerGlobal\n ? {\n active: () => contextApi.active(),\n with: (c, fn) => contextApi.with(c, fn),\n }\n : { active: () => manager.active(), with: (c, fn) => manager.with(c, fn) };\n const provider = new NodeTracerProvider(\n (span) => {\n if (!stopped) spans.push(span);\n },\n globals,\n ctxOps,\n );\n const ownsTrace = registerGlobal && trace.setGlobalTracerProvider(provider);\n const ownsPropagation =\n registerGlobal &&\n propagation.setGlobalPropagator(new TraceparentPropagator());\n const tracer = provider.getTracer(NODE_SCOPE_NAME, sdkVersion() || undefined);\n\n const minSeverity = SEVERITY[config.minSeverity ?? \"INFO\"] ?? SEVERITY.INFO;\n\n function emit(\n severity: SeverityText,\n body: string,\n attributes: Attributes,\n ): void {\n if (stopped || SEVERITY[severity] < minSeverity) {\n return;\n }\n const now = unixNanos(nowMs());\n const record: LogRecord = {\n timeUnixNano: now,\n observedTimeUnixNano: now,\n severityNumber: SEVERITY[severity],\n severityText: severity,\n body: { stringValue: scrubString(body, MAX_BODY_CHARS) },\n attributes: encodeAttributes({ ...globals(), ...attributes }),\n };\n const sc = trace.getSpanContext(ctxOps.active());\n if (sc && trace.isSpanContextValid(sc)) {\n record.traceId = sc.traceId;\n record.spanId = sc.spanId;\n record.flags = sc.traceFlags;\n }\n logs.push(record);\n }\n\n function log(\n severity: SeverityText,\n body: string,\n attrs?: LogAttributes,\n ): void {\n try {\n const { attributes, error } = sanitizeAttributes(attrs);\n // As observe: only an ERROR record gets exception inputs, and an\n // attribute the caller set wins over the derived one.\n const derived =\n severity === \"ERROR\" && error !== undefined\n ? exceptionAttributes(error, scrub)\n : {};\n emit(severity, body, { ...derived, ...attributes });\n } catch {\n // Telemetry must never break the app.\n }\n }\n\n const logger: NodeLogger = {\n debug: (b, a) => log(\"DEBUG\", b, a),\n info: (b, a) => log(\"INFO\", b, a),\n warn: (b, a) => log(\"WARN\", b, a),\n error: (b, a) => log(\"ERROR\", b, a),\n };\n\n function reportError(error: unknown, attrs?: LogAttributes): void {\n try {\n const { attributes } = sanitizeAttributes(attrs);\n emit(\"ERROR\", REPORTED_EXCEPTION_BODY, {\n ...exceptionAttributes(error, scrub),\n ...attributes,\n });\n } catch {\n // Telemetry must never break the app.\n }\n }\n\n // ── Process errors ──────────────────────────────────────────────────────\n const recorded = new WeakSet<object>();\n const repeats = new Map<string, { since: number; count: number }>();\n let drainScheduled = false;\n function recordFatal(value: unknown, body: string): void {\n if (typeof value === \"object\" && value !== null) {\n if (recorded.has(value)) return;\n recorded.add(value);\n }\n try {\n const attributes = exceptionAttributes(value, scrub);\n const key = [\n body,\n attributes[\"exception.type\"],\n attributes[\"code.function.name\"],\n attributes[\"exception.message\"],\n ].join(\"\\u001f\");\n const now = Date.now();\n let seen = repeats.get(key);\n if (!seen || now - seen.since >= 60_000) {\n if (repeats.size >= 256) repeats.clear();\n seen = { since: now, count: 0 };\n repeats.set(key, seen);\n }\n if (++seen.count > MAX_REPEATS_PER_MINUTE) {\n return;\n }\n emit(\"ERROR\", body, attributes);\n // A fatal record does not wait for its batch; a burst in one turn of the\n // event loop goes out as one request.\n if (!drainScheduled) {\n drainScheduled = true;\n setImmediate(() => {\n drainScheduled = false;\n logs.drain();\n }).unref();\n }\n } catch {\n // Telemetry must never break the app.\n }\n }\n const fatalFlushMs = config.fatalFlushTimeoutMs ?? DEFAULT_FLUSH_TIMEOUT_MS;\n\n const onMonitor = (err: unknown, origin: string): void => {\n recordFatal(\n err,\n origin === \"unhandledRejection\"\n ? UNHANDLED_REJECTION_BODY\n : UNCAUGHT_EXCEPTION_BODY,\n );\n };\n const onRejection = (reason: unknown): void => {\n recordFatal(reason, UNHANDLED_REJECTION_BODY);\n if (process.listenerCount(\"unhandledRejection\") > 1) {\n return; // The app handles rejections; it decides what happens next.\n }\n const mode = unhandledRejectionMode(\n process.execArgv,\n process.env.NODE_OPTIONS,\n );\n if (mode === \"warn\" || mode === \"none\") {\n return;\n }\n if (mode === \"warn-with-error-code\") {\n process.exitCode = 1;\n return;\n }\n // throw / strict: what Node does with no listener at all — raise it as an\n // uncaught exception — once the record is out.\n const err = reason instanceof Error ? reason : rejectionError(reason);\n recorded.add(err);\n void withTimeout(flushAll(), fatalFlushMs).then(() =>\n process.nextTick(() => {\n throw err;\n }),\n );\n };\n let exiting = false;\n const onUncaught = (err: unknown): void => {\n if (process.listenerCount(\"uncaughtException\") > 1 || exiting) {\n return; // The app's own handler owns the process's fate.\n }\n // Node's default (print, exit 1), after the record is out.\n exiting = true;\n void withTimeout(flushAll(), fatalFlushMs).then(() => {\n try {\n process.stderr.write(\n `${err instanceof Error && err.stack ? err.stack : inspect(err)}\\n`,\n );\n } catch {\n // stderr may be gone; the exit code still says what happened.\n }\n process.exit(1);\n });\n };\n const onBeforeExit = (): void => {\n if (logs.size > 0 || spans.size > 0) {\n void flushAll();\n }\n };\n\n const captureErrors = config.captureProcessErrors ?? true;\n if (captureErrors) {\n process.on(\"uncaughtExceptionMonitor\", onMonitor);\n process.on(\"unhandledRejection\", onRejection);\n if (!isElectron) {\n process.on(\"uncaughtException\", onUncaught);\n }\n }\n process.on(\"beforeExit\", onBeforeExit);\n setExceptionReporter((error, attributes) => reportError(error, attributes));\n\n function flushAll(): Promise<void> {\n return Promise.all([logs.flush(), spans.flush()]).then(() => undefined);\n }\n\n const instance: NodeTelemetry = {\n logger,\n tracer,\n reportError,\n setUser(id) {\n userId =\n typeof id === \"string\" && id !== \"\"\n ? id.slice(0, MAX_USER_ID_CHARS)\n : null;\n },\n flush(timeoutMs = DEFAULT_FLUSH_TIMEOUT_MS) {\n return withTimeout(flushAll(), timeoutMs);\n },\n async shutdown(timeoutMs = DEFAULT_FLUSH_TIMEOUT_MS) {\n if (stopped) return;\n await withTimeout(flushAll(), timeoutMs);\n stopped = true;\n process.removeListener(\"uncaughtExceptionMonitor\", onMonitor);\n process.removeListener(\"unhandledRejection\", onRejection);\n process.removeListener(\"uncaughtException\", onUncaught);\n process.removeListener(\"beforeExit\", onBeforeExit);\n setExceptionReporter(null);\n if (ownsTrace) trace.disable();\n if (ownsPropagation) propagation.disable();\n if (ownsContext) contextApi.disable();\n if (current === instance) current = null;\n },\n get dropped() {\n return logs.dropped + spans.dropped;\n },\n };\n return instance;\n}\n\nfunction safeHomedir(): string | undefined {\n try {\n return homedir() || undefined;\n } catch {\n return undefined;\n }\n}\n\n/** The slice of Electron's `app` flushOnQuit needs. */\nexport interface QuitApp {\n on(\n event: \"before-quit\",\n listener: (event: { preventDefault(): void }) => void,\n ): unknown;\n removeListener?(\n event: \"before-quit\",\n listener: (event: { preventDefault(): void }) => void,\n ): unknown;\n quit(): void;\n}\n\n/**\n * Hold Electron's quit until the running telemetry has flushed (bounded by\n * `timeoutMs`, default 2s), then quit. Returns a function that removes the\n * hook.\n *\n * It defers the FIRST quit and calls app.quit() again when the flush is done.\n * An app that already defers quit for its own shutdown (stops a backend, then\n * exits) should instead `await telemetry.flush()` as the last step of that\n * sequence: two listeners that each defer and re-quit cut each other short.\n */\nexport function flushOnQuit(\n app: QuitApp,\n options: { timeoutMs?: number } = {},\n): () => void {\n let flushed = false;\n const listener = (event: { preventDefault(): void }): void => {\n const t = current;\n if (flushed || !t) {\n return;\n }\n flushed = true;\n event.preventDefault();\n void t\n .flush(options.timeoutMs ?? DEFAULT_FLUSH_TIMEOUT_MS)\n .finally(() => app.quit());\n };\n app.on(\"before-quit\", listener);\n return () => {\n app.removeListener?.(\"before-quit\", listener);\n };\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Part of @reliantlabs/forge-web-runtime — the web twin of forge/pkg.
|
|
2
|
+
//
|
|
3
|
+
// A frontend's `service.name`, derived exactly as forge derives it
|
|
4
|
+
// (internal/naming.FrontendServiceName): `<project>-<frontend>`. The generated
|
|
5
|
+
// observability — the frontend dashboard's panel scope and the frontend alert
|
|
6
|
+
// defaults — filters on that name, so telemetry reporting anything else is
|
|
7
|
+
// invisible to both. The cases in testdata/frontend-service-names.json are
|
|
8
|
+
// read by this package's tests AND by internal/naming's, so the two spellings
|
|
9
|
+
// cannot drift apart.
|
|
10
|
+
/** `<project>-<frontend>`: the service.name forge's observability filters on. */
|
|
11
|
+
export function frontendServiceName(project, frontend) {
|
|
12
|
+
return `${project}-${frontend}`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=service-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-name.js","sourceRoot":"","sources":["../src/service-name.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,mEAAmE;AACnE,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,sBAAsB;AAEtB,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,QAAgB;IACnE,OAAO,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAC;AAClC,CAAC","sourcesContent":["// Part of @reliantlabs/forge-web-runtime — the web twin of forge/pkg.\n//\n// A frontend's `service.name`, derived exactly as forge derives it\n// (internal/naming.FrontendServiceName): `<project>-<frontend>`. The generated\n// observability — the frontend dashboard's panel scope and the frontend alert\n// defaults — filters on that name, so telemetry reporting anything else is\n// invisible to both. The cases in testdata/frontend-service-names.json are\n// read by this package's tests AND by internal/naming's, so the two spellings\n// cannot drift apart.\n\n/** `<project>-<frontend>`: the service.name forge's observability filters on. */\nexport function frontendServiceName(project: string, frontend: string): string {\n return `${project}-${frontend}`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reliantlabs/forge-web-runtime",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "The forge frontend runtime: Connect interceptor stack, session, error boundary, toast queue, <Resource> container, W3C trace propagation and the HyperDX browser SDK wiring (errors, console, network, traces; replay off by default). The web twin of forge/pkg.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"//repository note": "REQUIRED for `npm publish --provenance`, not decoration. npm cross-checks this against the repository in the signed provenance statement and rejects the publish with a 422 if they disagree — an absent field reads as \"\" and fails that comparison. `directory` names the subdirectory this package lives in, so the provenance points at the real source. Omitting this is what made the first 0.3.1 publish fail AFTER the tarball had been signed and written to the sigstore transparency log.",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"types": "./dist/interceptors.d.ts",
|
|
43
43
|
"default": "./dist/interceptors.js"
|
|
44
44
|
},
|
|
45
|
+
"./node": {
|
|
46
|
+
"types": "./dist/node.d.ts",
|
|
47
|
+
"default": "./dist/node.js"
|
|
48
|
+
},
|
|
45
49
|
"./mock-transport": {
|
|
46
50
|
"types": "./dist/mock-transport.d.ts",
|
|
47
51
|
"default": "./dist/mock-transport.js"
|
|
@@ -68,7 +72,7 @@
|
|
|
68
72
|
"pretest": "node scripts/build.mjs",
|
|
69
73
|
"test": "vitest run"
|
|
70
74
|
},
|
|
71
|
-
"// peerDependencies note": "@opentelemetry/api is REQUIRED
|
|
75
|
+
"// peerDependencies note": "@opentelemetry/api is the one REQUIRED peer: trace.ts propagates traceparent on every RPC from the barrel, and the './node' entry builds its spans on it. Every other peer is OPTIONAL because some entry point never imports it, and npm installs a non-optional peer for every consumer whether or not it is reached: react, @connectrpc/connect and @bufbuild/protobuf are imported by the barrel and the browser subpaths, which every forge frontend scaffold (Next.js, Vite, Expo) declares as its own direct dependencies, while a './node'-only consumer (an Electron main process, a Node CLI) imports none of them. @hyperdx/browser is exact-pinned and imported only (and lazily) by the './telemetry' subpath; it carries the whole OpenTelemetry web SDK and the rrweb recorder, so a frontend that never imports './telemetry' (React Native) installs none of it. @tanstack/react-query is imported only by './service-hooks'. src/published-surface.test.ts holds the rule: a peer the './node' import closure does not reach must be optional.",
|
|
72
76
|
"peerDependencies": {
|
|
73
77
|
"@bufbuild/protobuf": "^2.5.0",
|
|
74
78
|
"@connectrpc/connect": "^2.0.0",
|
|
@@ -78,11 +82,20 @@
|
|
|
78
82
|
"react": "^18.3.0 || ^19.0.0"
|
|
79
83
|
},
|
|
80
84
|
"peerDependenciesMeta": {
|
|
81
|
-
"@
|
|
85
|
+
"@bufbuild/protobuf": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@connectrpc/connect": {
|
|
82
89
|
"optional": true
|
|
83
90
|
},
|
|
84
91
|
"@hyperdx/browser": {
|
|
85
92
|
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@tanstack/react-query": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"react": {
|
|
98
|
+
"optional": true
|
|
86
99
|
}
|
|
87
100
|
},
|
|
88
101
|
"devDependencies": {
|