@osfactory/otel-hook 0.8.0 → 0.10.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 (52) hide show
  1. package/README.md +159 -2
  2. package/dist/{adapter-BJiz6lqM.d.ts → adapter-B9RwW6TO.d.ts} +14 -2
  3. package/dist/cli.js +2514 -1238
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts +5 -2
  6. package/dist/config.js +479 -169
  7. package/dist/config.js.map +1 -1
  8. package/dist/destinations-DWOkVxV1.d.ts +169 -0
  9. package/dist/diagnostics.d.ts +8 -0
  10. package/dist/diagnostics.js +2 -1
  11. package/dist/diagnostics.js.map +1 -1
  12. package/dist/{events-B3MHoJTD.d.ts → events-CSD_YiJ2.d.ts} +2 -0
  13. package/dist/{otlp-log-sink-zuHojHSP.d.ts → export-destinations-lORbe25J.d.ts} +241 -9
  14. package/dist/{filesystem-store-r-nNA3BA.d.ts → filesystem-store-DX3dGIgu.d.ts} +1 -1
  15. package/dist/{hook-Dh8OO4Wa.d.ts → hook-BAxXoKsp.d.ts} +10 -5
  16. package/dist/index.d.ts +15 -14
  17. package/dist/index.js +1936 -730
  18. package/dist/index.js.map +1 -1
  19. package/dist/install.d.ts +4 -4
  20. package/dist/install.js +31 -2
  21. package/dist/install.js.map +1 -1
  22. package/dist/integration.d.ts +37 -12
  23. package/dist/integration.js +1942 -617
  24. package/dist/integration.js.map +1 -1
  25. package/dist/lifecycle.d.ts +3 -3
  26. package/dist/lifecycle.js +8 -1
  27. package/dist/lifecycle.js.map +1 -1
  28. package/dist/{memory-Bl9ANVff.d.ts → memory-aJilVG4R.d.ts} +2 -2
  29. package/dist/model.d.ts +1 -1
  30. package/dist/model.js +7 -0
  31. package/dist/model.js.map +1 -1
  32. package/dist/{payload-Ci8_ERm6.d.ts → payload-D7gc0-WQ.d.ts} +41 -2
  33. package/dist/{ports-n7KFOpKo.d.ts → ports-plO5MKrY.d.ts} +63 -2
  34. package/dist/providers.d.ts +146 -10
  35. package/dist/providers.js +397 -13
  36. package/dist/providers.js.map +1 -1
  37. package/dist/{registry-CIVvRlVK.d.ts → registry-C7XO4DzD.d.ts} +2 -2
  38. package/dist/runtime.d.ts +8 -8
  39. package/dist/runtime.js +1426 -1163
  40. package/dist/runtime.js.map +1 -1
  41. package/dist/{schema-Cn0-xz8L.d.ts → schema-CHb3GU1r.d.ts} +98 -3
  42. package/dist/{semconv-fPRb-dpU.d.ts → semconv-Dw7gcQcg.d.ts} +1 -1
  43. package/dist/state.d.ts +4 -4
  44. package/dist/state.js +607 -39
  45. package/dist/state.js.map +1 -1
  46. package/dist/telemetry.d.ts +23 -66
  47. package/dist/telemetry.js +637 -34
  48. package/dist/telemetry.js.map +1 -1
  49. package/dist/testing.d.ts +10 -8
  50. package/dist/testing.js +868 -560
  51. package/dist/testing.js.map +1 -1
  52. package/package.json +1 -1
@@ -1,27 +1,28 @@
1
- import { O as OtelHookConfig } from './schema-Cn0-xz8L.js';
1
+ import { O as OtelHookConfig } from './schema-CHb3GU1r.js';
2
2
  import { OverallHealth } from './diagnostics.js';
3
3
  import { OtelHookErrorInfo } from './errors.js';
4
4
  import { DeliveryClaimOutcome, UsageAccumulatorSnapshot, LifecycleCleanupReport, CallbackDeduplicator, UsageAccumulator, SpanCorrelator, LifecycleJanitor } from './lifecycle.js';
5
5
  import { P as PrivacyService } from './service-CbI9CObT.js';
6
- import { P as ProviderRegistry } from './registry-CIVvRlVK.js';
7
- import { a as DeliveryOrigin, c as DeliveryUnavailableReason, H as HookIngestInput, e as HookIngestOutcome, U as UsageObservation, O as OtelHook } from './hook-Dh8OO4Wa.js';
8
- import { C as Clock, I as IdGenerator, d as Logger, W as WorktreeLocator } from './ports-n7KFOpKo.js';
9
- import { F as FilesystemStateStore } from './filesystem-store-r-nNA3BA.js';
10
- import { o as OtlpTelemetrySink, n as OtlpLogTelemetrySink, b as DurableSpool, D as DurableLogSpool } from './otlp-log-sink-zuHojHSP.js';
6
+ import { P as ProviderRegistry } from './registry-C7XO4DzD.js';
7
+ import { a as DeliveryOrigin, c as DeliveryUnavailableReason, H as HookIngestInput, e as HookIngestOutcome, U as UsageObservation, O as OtelHook } from './hook-BAxXoKsp.js';
8
+ import { C as Clock, I as IdGenerator, d as Logger, W as WorktreeLocator, P as PayloadEnricher } from './ports-plO5MKrY.js';
9
+ import { F as FilesystemStateStore } from './filesystem-store-DX3dGIgu.js';
10
+ import { p as OtlpTelemetrySink, o as OtlpLogTelemetrySink, b as DurableSpool, D as DurableLogSpool, E as ExportDestinationSinks, u as SkippedExportDestination } from './export-destinations-lORbe25J.js';
11
11
  import 'zod';
12
12
  import './primitives-CJ8-rn-f.js';
13
13
  import './taxonomy-DwhTtuWd.js';
14
14
  import '@opentelemetry/api';
15
- import './events-B3MHoJTD.js';
16
- import './semconv-fPRb-dpU.js';
15
+ import './events-CSD_YiJ2.js';
16
+ import './semconv-Dw7gcQcg.js';
17
17
  import '@opentelemetry/core';
18
18
  import '@opentelemetry/resources';
19
19
  import '@opentelemetry/sdk-trace';
20
20
  import './content-M9xIKG7h.js';
21
21
  import './policy-CimmCfRp.js';
22
- import './adapter-BJiz6lqM.js';
22
+ import './adapter-B9RwW6TO.js';
23
23
  import './identity-BrVBs901.js';
24
24
  import './keys-Dej5bN3L.js';
25
+ import './destinations-DWOkVxV1.js';
25
26
  import '@opentelemetry/sdk-logs';
26
27
 
27
28
  /**
@@ -208,13 +209,21 @@ interface HookRuntime {
208
209
  readonly hook: OtelHook;
209
210
  readonly config: OtelHookConfig;
210
211
  readonly stateStore: FilesystemStateStore;
211
- /** The traces signal. Named `sink` because it is the one every installation has. */
212
+ /**
213
+ * The traces signal of the primary destination — `default`, or the first entry
214
+ * of `exporter.destinations` when there is no single-endpoint setting. Named
215
+ * `sink` because it is the one every installation has.
216
+ */
212
217
  readonly sink: OtlpTelemetrySink;
213
- /** The logs signal. A no-op sink unless `exporter.logs.enabled` is set. */
218
+ /** The primary destination's logs signal. A no-op sink unless `exporter.logs.enabled` is set. */
214
219
  readonly logSink: OtlpLogTelemetrySink;
215
220
  readonly spool?: DurableSpool;
216
221
  /** Retry queue for the logs signal. Absent when spooling or logs are disabled. */
217
222
  readonly logSpool?: DurableLogSpool;
223
+ /** Every destination this runtime sends to, primary first. */
224
+ readonly destinations: readonly ExportDestinationSinks[];
225
+ /** Destinations left out of this invocation, by name, with the variables they lack. */
226
+ readonly skippedDestinations: readonly SkippedExportDestination[];
218
227
  readonly privacy: PrivacyService;
219
228
  readonly deduplicator: CallbackDeduplicator;
220
229
  readonly usageAccumulator: UsageAccumulator;
@@ -239,13 +248,22 @@ type HookRuntimeOptions = {
239
248
  readonly installationId: string;
240
249
  /** State/spool namespace segment; the selected provider id, or a placeholder. */
241
250
  readonly providerNamespace: string;
242
- /** Exporter header *values*, deliberately absent from the config snapshot. */
251
+ /**
252
+ * Header *values* for the `default` destination, deliberately absent from the
253
+ * config snapshot.
254
+ */
243
255
  readonly headers?: Readonly<Record<string, string>>;
244
256
  /**
245
257
  * Header values for the logs signal only, when they differ from the traces
246
258
  * signal's (`OTEL_EXPORTER_OTLP_LOGS_HEADERS`). Defaults to {@link headers}.
247
259
  */
248
260
  readonly logHeaders?: Readonly<Record<string, string>>;
261
+ /**
262
+ * Environment that `env:NAME` header references in `exporter.destinations`
263
+ * resolve against. Never read implicitly; without it, a destination whose
264
+ * headers reference a variable is skipped for the invocation and reported.
265
+ */
266
+ readonly headerEnvironment?: Readonly<Record<string, string | undefined>>;
249
267
  readonly clock?: Clock;
250
268
  readonly ids?: IdGenerator;
251
269
  readonly logger?: Logger;
@@ -284,6 +302,13 @@ type HookRuntimeOptions = {
284
302
  * `null` to disable resolution entirely.
285
303
  */
286
304
  readonly worktreeLocator?: WorktreeLocator | null;
305
+ /**
306
+ * Payload enrichers run before the adapter parses (see `PayloadEnricher`).
307
+ * When absent, the configuration decides: `providers.claudeCode.readTranscriptUsage`
308
+ * adds the Claude Code transcript-usage enricher, and nothing else is added.
309
+ * Pass `[]` to run none regardless of configuration.
310
+ */
311
+ readonly payloadEnrichers?: readonly PayloadEnricher[];
287
312
  };
288
313
  /**
289
314
  * Smallest stale-claim window that cannot expire while a live process is still