@cosmicdrift/kumiko-types 0.185.0 → 0.186.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/handlers.ts +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.185.0",
3
+ "version": "0.186.0",
4
4
  "description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
package/src/handlers.ts CHANGED
@@ -504,6 +504,20 @@ export type HandlerContext<TMap extends object = KumikoEventTypeMap> = SharedCon
504
504
  // Feature code can call ctx.metrics.inc(...) / ctx.tracer.startSpan(...)
505
505
  // without null-checks.
506
506
  readonly metrics: MetricsHandle;
507
+
508
+ // For shared/library code invoked from many features' HandlerContext
509
+ // (e.g. a helper package called by several consumer features): binds to
510
+ // `featureName` instead of the dispatching handler's own feature, so the
511
+ // library counts under one stable kumiko_<featureName>_x name instead of
512
+ // splintering per caller. `featureName` accepts the same kebab-case form
513
+ // used as the feature's own name at defineFeature() — normalized to
514
+ // snake_case internally before resolving the metric name.
515
+ //
516
+ // Unlike ctx.metrics, an unregistered metric name here is a silent
517
+ // no-op, not a throw (framework#1844) — this handle is meant for
518
+ // error/catch-path counters in shared code, where a missing registration
519
+ // must not turn an already-swallowed error into a thrown one.
520
+ readonly metricsFor: (featureName: string) => MetricsHandle;
507
521
  readonly tracer: Tracer;
508
522
 
509
523
  // Time + TZ helper. Feature code MUST go through this instead of