/** * Effect identity: the `aiwg.effect/v1` derivation, the contract-registered * adapter derivations (`d13.review/v1`), payload digests and input grammar. * * Every canonical form is RFC 8785 JSON from `artifact-trust.canonicalJson`. * * @see docs/contracts/effect-ledger.v1.md "Effect identity" */ import { type EffectContext, type EffectIdDerivationName, type EffectIdentityInput, type EffectScope } from './types.js'; export declare const EFFECT_ID_V1_PATTERN: RegExp; export declare const D13_REVIEW_ID_PATTERN: RegExp; export declare const SHA256_DIGEST_PATTERN: RegExp; export declare const WRITER_ID_PATTERN: RegExp; /** `"sha256:"` plus lowercase hex SHA-256 of the bytes (strings are UTF-8). */ export declare function sha256Digest(bytes: string | Uint8Array): string; /** Unpadded lowercase RFC 4648 section 6 base32, most significant bit first. */ export declare function base32Lower(bytes: Uint8Array): string; export declare function isCoreEffectKind(kind: string): boolean; export declare function isEffectKind(kind: unknown): kind is string; export declare function assertEffectScope(scope: unknown): asserts scope is EffectScope; export declare function assertWriterId(writer: unknown): asserts writer is string; export declare function assertEffectKind(kind: unknown): asserts kind is string; export declare function assertEffectTarget(target: unknown): asserts target is string; export declare function assertEffectContext(context: unknown): asserts context is EffectContext; export declare function assertPayloadDigest(value: unknown): asserts value is string; /** Digest the exact bytes an effect sends, or `canonicalJson` of a structured request. */ export declare function payloadDigest(payload: string | Uint8Array | Record | unknown[]): string; export interface EffectIdDerivation { readonly name: EffectIdDerivationName; readonly pattern: RegExp; /** Kinds this derivation may identify. */ permitsKind(kind: string): boolean; /** Validate the identity inputs and derive the ID. */ derive(input: EffectIdentityInput): string; } /** * Contract-registered derivations. Registration is closed: a new derivation * needs a contract revision (and a schema `idDerivation` value), so this map is * frozen rather than extensible at runtime. */ export declare const EFFECT_ID_DERIVATIONS: Readonly>; export declare function effectIdDerivation(name: unknown): EffectIdDerivation; /** The derivation a kind uses by default. */ export declare function defaultDerivationFor(kind: string): EffectIdDerivationName; /** * Derive an effect ID. Attempt, time, actor, host and payload are not inputs. * `derivation` defaults to the kind's registered derivation. */ export declare function effectId(input: EffectIdentityInput, derivation?: EffectIdDerivationName): string; /** Strict reader-side check. Uppercase, padding, other lengths and non-zero trailing bits are rejected, never normalized. */ export declare function isValidEffectId(id: unknown, derivation?: EffectIdDerivationName): id is string; export declare function assertEffectId(id: unknown, derivation?: EffectIdDerivationName): asserts id is string; //# sourceMappingURL=identity.d.ts.map