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

@@ -28,7 +28,11 @@ export function withCapture<Args extends unknown[], R>(
tags: Record<string, string>,
fn: (...args: Args) => Promise<R>,
): Captured<(...args: Args) => Promise<R>> {
const PROPAGATED_BRANDS = ["__instrumented", "__audited"] as const;
const PROPAGATED_BRANDS = [
"__instrumented",
"__audited",
"__analyzed",
] as const;
const wrapped: (...args: Args) => Promise<R> = async (...args) => {
try {

View File

@@ -2,7 +2,7 @@ import type { ITracer, SpanOpts } from "./tracer.interface";
import type { Instrumented } from "../conformance/brands";
import { attachBrand } from "../conformance/brand-runtime";
const PROPAGATED_BRANDS = ["__captured", "__audited"] as const;
const PROPAGATED_BRANDS = ["__captured", "__audited", "__analyzed"] as const;
export function withSpan<Args extends unknown[], R, Extra extends object>(
tracer: ITracer,