feat(core-shared): extend wireUseCase with analytics arg and Analyzed brand propagation

Add AnalyticsProtocol to bind-protocols, extend WireUseCaseOptions with
optional analytics field, and compose the __analyzed brand inline in
wireUseCase (innermost, before withAudit) when analytics is provided.

Propagate __analyzed through withCapture and withSpan PROPAGATED_BRANDS
so the outermost container binding carries the brand for boot-time
assertion checks (Story 05).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 15:12:57 +00:00
parent ff1e0b052c
commit 32018e8a7b
5 changed files with 149 additions and 9 deletions

View File

@@ -68,3 +68,15 @@ export type MetricsProtocol = {
export type AuditLogProtocol = {
record(entry: AuditEntry): Promise<void>;
};
/**
* Minimal analytics protocol surface. `IAnalytics` (in `@repo/core-analytics`)
* extends this — typechecks fail if narrowed below. Feature binders that
* receive `ctx.analytics` see only this protocol type.
*/
export type AnalyticsProtocol = {
track(
event: string,
attributes?: Record<string, string | number | boolean>,
): void;
};