/** * `peac emit lifecycle` subcommand. * * Issues a Wire 0.2 compact JWS lifecycle observation record from * caller-supplied flags. The caller observed the lifecycle event (an * external approval, evaluation, experiment, workflow transition, or * mode tag); the CLI is the issuance path; the caller's issuer is the * signer-of-record. PEAC provides the record format, validation, and * signing path. PEAC does not capture, observe, decide, evaluate, * score, transition, orchestrate, schedule, or vouch for the truth of * the event. * * Signing UX uses the existing PEAC issuer-key reference convention * (mirrors `peac record command`): * * --issuer-key * --issuer-id * --unsafe-ephemeral-key * * `--observed-at` is REQUIRED. The wrapper does not silently default the * external event time to the wrapper-invocation time; that would * misrepresent when the external system observed the event. * * Stable error codes: * lifecycle.missing_required_field (missing flag for required field) * lifecycle.event_kind_unknown (--event-kind not in the 9 enum) * lifecycle.invalid_observed_at (--observed-at not RFC 3339) * lifecycle.opaque_ref_grammar_violation * lifecycle.approver_ref_pii_blocked * lifecycle.ref_must_be_string * lifecycle.inline_value_blocked * cli.issuer_key_required (no signing input supplied) * cli.issuer_id_required * cli.issuer_id_invalid * cli.unsafe_ephemeral_key_mutex (--issuer-key and --unsafe-ephemeral-key both supplied) * cli.issuer_key_load_failed (from the shared issuer-key loader) * cli.issuer_key_invalid (from the shared issuer-key loader) * cli.signing_failed * cli.output_write_failed */ import { Command } from 'commander'; import { type LifecycleEventKind } from '@peac/schema'; /** * Discriminator literal -> canonical record-type URI. The two arrays move * together; this is a defense-in-depth check. */ declare const EVENT_KINDS: readonly LifecycleEventKind[]; declare const TYPE_URI_BY_EVENT_KIND: Readonly>; declare const OBSERVED_MODES: readonly ["deterministic_script", "templated_flow", "agent_loop", "human_step", "hybrid"]; type ObservedMode = (typeof OBSERVED_MODES)[number]; export declare const EMIT_LIFECYCLE_ERROR_CODES: { readonly missingRequiredField: "lifecycle.missing_required_field"; readonly eventKindUnknown: "lifecycle.event_kind_unknown"; readonly invalidObservedAt: "lifecycle.invalid_observed_at"; readonly invalidObservedMode: "lifecycle.invalid_observed_mode"; readonly invalidState: "lifecycle.invalid_state"; readonly issuerKeyRequired: "cli.issuer_key_required"; readonly issuerIdRequired: "cli.issuer_id_required"; readonly issuerIdInvalid: "cli.issuer_id_invalid"; readonly unsafeEphemeralKeyMutex: "cli.unsafe_ephemeral_key_mutex"; readonly issuerKeyLoadFailed: "cli.issuer_key_load_failed"; readonly issuerKeyInvalid: "cli.issuer_key_invalid"; readonly signingFailed: "cli.signing_failed"; readonly outputWriteFailed: "cli.output_write_failed"; }; export interface EmitLifecycleOptions { eventKind?: string; subjectRef?: string; parentRef?: string; upstreamArtifactRef?: string; upstreamArtifactDigest?: string; policyRef?: string; policyDigest?: string; rubricRef?: string; approvalRef?: string; approverRef?: string; experimentRef?: string; cohortRef?: string; variantRef?: string; observedMode?: string; resultRef?: string; resultDigest?: string; scoreRef?: string; fromState?: string; toState?: string; observedAt?: string; issuerKey?: string; issuerId?: string; unsafeEphemeralKey: boolean; output: string; } export interface EmitLifecycleIO { writeStdout: (chunk: string) => void; writeStderr: (chunk: string) => void; /** * Environment used to resolve `env:VAR` issuer-key references. * Defaults to `process.env`. Tests inject custom env. */ issuerKeyEnv: NodeJS.ProcessEnv; } export interface EmitLifecycleResult { exitCode: number; } interface ValidationFailure { code: string; message: string; } /** * Validate flag combinations BEFORE building the observation, loading * the key, or signing. Surfaces stable codes that match the schema's * lifecycle.* codes for schema-domain failures. */ export declare function validateEmitLifecycleOptions(opts: EmitLifecycleOptions): ValidationFailure[]; /** * Build the lifecycle observation object from validated CLI options. * Only fields populated by flags are included; the schema validator * accepts the discriminated-union shape per event_kind. */ export declare function buildLifecycleObservation(opts: EmitLifecycleOptions): Record; /** * Pure handler: validates flags, preflights output and key, builds the * observation, validates against the schema, signs as Wire 0.2 JWS, emits. * Tests drive this directly without going through commander. */ export declare function runEmitLifecycle(options: Partial, io?: Partial): Promise; /** * Commander factory for the `lifecycle` subcommand under the `emit` * parent group. Wires --flag parsing and delegates to the pure handler. */ export declare function emitLifecycleSubcommand(): Command; /** * Commander factory for the public `peac emit` parent group. Adds the * `lifecycle` subcommand. Additional `emit` subcommands can be * registered by their own profiles. */ export declare function emitCommand(): Command; /** Re-exports for tests. */ export { TYPE_URI_BY_EVENT_KIND, EVENT_KINDS, OBSERVED_MODES }; export type { ObservedMode }; //# sourceMappingURL=emit-lifecycle.d.ts.map