UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

1,731 lines • 91.3 kB
"use strict";
/**
 * auditShapes — WHAT the audit chain's bounded mode keeps of each event: one
 * shape per registered event type, every field of its payload ruled.
 *
 * Pattern: a declarative table, total over the registry
 *          (`{ [T in keyof AgentfootprintEventMap]-?: BoundRule }`), built from
 *          the combinators in `auditBounding.ts`.
 * Role:    the bounding layer's data. `audit.ts` asks it for every event in
 *          `payloadMode: 'bounded'`; an event type it does not know is
 *          `unknownEventShape` — every field a marker.
 * Emits:   N/A.
 *
 * A new event type, or a new field on a payload, does not compile until it is
 * classified here. Content (what a person, the model, a tool or the data
 * wrote, or a message composed from it) is a marker; structure (ids, names,
 * kinds, codes, verdicts, counts, the library's own sentences, the words the
 * app declared up front) is kept — and every kept value is CHECKED at runtime
 * as the kind its type declares: `num`, `bool`, `str` (an open string: an id,
 * a name, a label), `oneOf` (a closed union: exactly its words). No container
 * is kept whole; each is spelled out field by field, so a child its type does
 * not declare is a marker. The type walker
 * (`test/type-regressions/AuditBoundingDepth.test.ts`) holds every rule here
 * to the type beneath it; the runtime sweep
 * (`test/observability-providers/audit-bounded-sweep.test.ts`) hands every rule
 * what its kind forbids.
 *
 * The positions a record keeps although their value may come from the run —
 * meta's who, decision evidence, a policy's tag, an app's reason word, a seen
 * tool's name — are the rules `auditKeptByContract.ts` names, placed here.
 *
 * `audit.ts` looks an event's shape up in `eventShapeTable` — a `Map`, so an
 * event NAME is never a key into a plain object (`constructor`, `__proto__`).
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.eventShapes = exports.eventShapeTable = exports.boundMeta = exports.boundAnswerNegatives = exports.boundAnswerCoverage = exports.boundScripts = void 0;
const auditBounding_js_1 = require("./auditBounding.js");
const auditKeptByContract_js_1 = require("./auditKeptByContract.js");
const SCRIPT_LABELS = [
    'submitted',
    'returned',
    'reported-success',
    'reported-failure',
    'completed',
    'completed-with-failure',
    'outcome-unknown',
];
/** A submitted program's attached record: only its text is content. */
const boundShownScript = (0, auditBounding_js_1.shapeOf)({
    toolCallId: auditBounding_js_1.str,
    dispatch: auditBounding_js_1.num,
    tool: auditBounding_js_1.str,
    language: auditBounding_js_1.str,
    label: (0, auditBounding_js_1.oneOf)(...SCRIPT_LABELS),
    exitCode: auditBounding_js_1.num,
    resultWithheld: (0, auditBounding_js_1.oneOf)('over-ceiling'),
    rewritten: (0, auditBounding_js_1.oneOf)(true),
    bytes: auditBounding_js_1.num,
    lines: auditBounding_js_1.num,
    truncated: (0, auditBounding_js_1.shapeOf)({ shownBytes: auditBounding_js_1.num }),
    text: auditBounding_js_1.charsMarker,
});
/** Attachment summary: preserve every declared field, check every runtime child. */
exports.boundScripts = (0, auditBounding_js_1.shapeOf)({
    shown: (0, auditBounding_js_1.listOf)(boundShownScript),
    omitted: auditBounding_js_1.num,
    closedFence: (0, auditBounding_js_1.shapeOf)({
        char: (0, auditBounding_js_1.oneOf)('backtick', 'tilde'),
        length: auditBounding_js_1.num,
    }),
    withheldFromText: (0, auditBounding_js_1.oneOf)(true),
});
/** Match verdicts contain labels and references, never the program. */
const boundScriptsVerdict = (0, auditBounding_js_1.shapeOf)({
    blocks: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        block: auditBounding_js_1.num,
        label: (0, auditBounding_js_1.oneOf)(...SCRIPT_LABELS, 'unmatched'),
        exitCode: auditBounding_js_1.num,
        toolCallId: auditBounding_js_1.str,
        tool: auditBounding_js_1.str,
        dispatch: auditBounding_js_1.num,
        alsoMatches: auditBounding_js_1.num,
        reason: (0, auditBounding_js_1.oneOf)('no-submission-this-turn', 'over-size', 'kept-out'),
    })),
    earlierTurnRows: auditBounding_js_1.num,
    regionsDropped: auditBounding_js_1.num,
    scriptsDropped: auditBounding_js_1.num,
});
// ─── Shared pieces: coverage, periods, witnesses ─────────────────────
/** One coverage item: the tool author's prose (`what`, `why`, `short`), and its `kind`. */
const boundCoverageItem = (0, auditBounding_js_1.shapeOf)({
    what: auditBounding_js_1.charsMarker,
    why: auditBounding_js_1.charsMarker,
    short: auditBounding_js_1.charsMarker,
    kind: (0, auditBounding_js_1.oneOf)('existence', 'scope'),
});
/** What a read found still running: the tool author's prose, and how many things it stands for. */
const boundInProgressItem = (0, auditBounding_js_1.shapeOf)({
    what: auditBounding_js_1.charsMarker,
    why: auditBounding_js_1.charsMarker,
    short: auditBounding_js_1.charsMarker,
    count: auditBounding_js_1.num,
});
/** A declared window: both instants are the tool's own values. */
const boundInstants = (0, auditBounding_js_1.shapeOf)({
    from: auditBounding_js_1.charsMarker,
    to: auditBounding_js_1.charsMarker,
});
/** What the store holds — a window, or the library's word `'unknown'` (the tool
 *  said it cannot vouch for the store), which stays. */
const boundHeld = (0, auditBounding_js_1.either)((0, auditBounding_js_1.oneOf)('unknown'), boundInstants);
/** A declared period: its instants are the tool's values. */
const boundPeriod = (0, auditBounding_js_1.shapeOf)({
    queried: boundInstants,
    held: boundHeld,
    readAt: auditBounding_js_1.charsMarker,
});
/** An absence's source and its clock, as the tool declared them. */
const boundProvenance = (0, auditBounding_js_1.shapeOf)({
    measuredAt: auditBounding_js_1.charsMarker,
    source: auditBounding_js_1.charsMarker,
    ageSeconds: auditBounding_js_1.num,
    sourceExportDate: auditBounding_js_1.charsMarker,
});
/**
 * What the library composed for a `search` tool. Kept: facets ride BY
 * REFERENCE, and a gap's words name arguments and verdicts, never a value
 * (`CoverageGapPayload`'s contract) — a `'prose'` gap's words are the ones
 * the search declaration states up front.
 */
/** What a gap bears on: a facet word, or the filter and values the search declaration states. */
const boundBearsFilter = (0, auditBounding_js_1.shapeOf)({
    filter: auditBounding_js_1.str,
    values: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.either)(auditBounding_js_1.str, auditBounding_js_1.num, auditBounding_js_1.bool)),
});
const boundBears = (0, auditBounding_js_1.either)((0, auditBounding_js_1.oneOf)('completeness', 'period', 'population', 'source'), boundBearsFilter);
const boundComposition = (0, auditBounding_js_1.shapeOf)({
    origin: (0, auditBounding_js_1.oneOf)('local', 'remote'),
    resultId: auditBounding_js_1.str,
    complete: auditBounding_js_1.bool,
    facets: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        facet: (0, auditBounding_js_1.oneOf)('filter', 'names', 'period', 'population', 'source', 'subject'),
        from: (0, auditBounding_js_1.oneOf)('call', 'default', 'host', 'result'),
        ref: (0, auditBounding_js_1.shapeOf)({ resultId: auditBounding_js_1.str, argument: auditBounding_js_1.str }),
        any: auditBounding_js_1.bool,
    })),
    gaps: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        kind: (0, auditBounding_js_1.oneOf)('argument-unsent', 'cap-reached', 'credential-limited', 'match', 'paged', 'partial', 'period', 'prose', 'ranking', 'scope'),
        what: auditBounding_js_1.str,
        why: auditBounding_js_1.str,
        bears: boundBears,
        argument: auditBounding_js_1.str,
    })),
});
/**
 * A skill guard's evaluation: the edge, the call, the verdict, and per
 * condition the key, operator and value the app DECLARED — and the engine's
 * summary of the value it read (`actualSummary`), the decision evidence the
 * chain keeps by contract (redaction-aware).
 */
const boundGuard = (0, auditBounding_js_1.shapeOf)({
    from: auditBounding_js_1.str,
    to: auditBounding_js_1.str,
    toolName: auditBounding_js_1.str,
    toolCallId: auditBounding_js_1.str,
    verdict: auditBounding_js_1.bool,
    conditions: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        key: auditBounding_js_1.str,
        op: auditBounding_js_1.str,
        value: (0, auditBounding_js_1.orList)(auditKeptByContract_js_1.declaredValue),
        // The engine's decision evidence: a summary of the value a guard read.
        actualSummary: auditKeptByContract_js_1.decisionSummary,
        passed: auditBounding_js_1.bool,
    })),
});
/** What an integrity finding is about: a kind and an id. */
const boundSubject = (0, auditBounding_js_1.shapeOf)({ kind: auditBounding_js_1.str, id: auditBounding_js_1.str });
/** What a message said that won a routing match: the text is the person's; the
 *  keyword is the app's declared vocabulary. */
const boundWitness = (0, auditBounding_js_1.shapeOf)({
    text: auditBounding_js_1.charsMarker,
    keyword: auditBounding_js_1.str,
});
/**
 * A typed answer's limits: the three lists, the declared periods, what a read
 * found still running and the values an `assume` rule filled. Every sentence
 * and value is a marker; the tool and argument NAMES, the call ids, counts,
 * kinds and the library's `'unknown'` stay.
 */
exports.boundAnswerCoverage = (0, auditBounding_js_1.shapeOf)({
    checked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
    notChecked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
    cannotCover: (0, auditBounding_js_1.listOf)(boundCoverageItem),
    periods: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        toolName: auditBounding_js_1.str,
        toolCallId: auditBounding_js_1.str,
        queried: boundInstants,
        held: boundHeld,
        readAt: auditBounding_js_1.charsMarker,
    })),
    inProgress: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        toolName: auditBounding_js_1.str,
        toolCallId: auditBounding_js_1.str,
        items: (0, auditBounding_js_1.listOf)(boundInProgressItem),
    })),
    assumed: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        toolName: auditBounding_js_1.str,
        argument: auditBounding_js_1.str,
        value: auditBounding_js_1.charsMarker,
        hidden: auditBounding_js_1.bool,
    })),
});
/**
 * A typed answer's negatives: each statement and the population it is about
 * are markers; the answer field's declared name, the codes, verdicts, ids,
 * tool names and counts stay.
 */
exports.boundAnswerNegatives = (0, auditBounding_js_1.shapeOf)({
    field: auditBounding_js_1.str,
    version: auditBounding_js_1.str,
    delivery: (0, auditBounding_js_1.oneOf)('as-checked', 'fallback', 'recorded'),
    claims: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        kind: (0, auditBounding_js_1.oneOf)('complete', 'none', 'not-found', 'unknown'),
        about: auditBounding_js_1.charsMarker,
        restsOn: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        statement: auditBounding_js_1.charsMarker,
        delivery: (0, auditBounding_js_1.oneOf)('record-composed'),
        version: auditBounding_js_1.str,
    })),
    checks: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        id: auditBounding_js_1.str,
        path: auditBounding_js_1.str,
        index: auditBounding_js_1.num,
        kind: (0, auditBounding_js_1.oneOf)('complete', 'none', 'not-found', 'unknown'),
        notes: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.oneOf)('absence-kind-normalized')),
        // The payload declares any string: a checker's code.
        code: auditBounding_js_1.str,
        disposition: (0, auditBounding_js_1.oneOf)('checked-fail', 'not-applicable', 'unreachable'),
        tools: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        results: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        staleSince: (0, auditBounding_js_1.shapeOf)({
            turn: auditBounding_js_1.num,
            readAt: auditBounding_js_1.str,
        }),
    })),
    coverage: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({ tool: auditBounding_js_1.str, checked: auditBounding_js_1.num })),
    actions: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        tool: auditBounding_js_1.str,
        outcome: (0, auditBounding_js_1.oneOf)('error', 'not-run', 'ok'),
    })),
});
/** A shape for one event's whole payload, exhaustive over that event's payload type. */
const eventShape = (rules) => (0, auditBounding_js_1.shapeOf)(rules);
/** The pause reason the library writes itself — its own words, kept. */
const FIXED_PAUSE_REASON = 'stage requested pause';
/** Why a turn's answer stands where it does — the assessment's own words. */
const boundAssessmentReasons = (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.oneOf)('answer-check-failed', 'argument-asked', 'argument-assumed', 'argument-read', 'argument-unverified', 'asked', 'check-unreachable', 'claim-exceeds-search', 'coverage-gap', 'declaration-overclaimed', 'declared-absent', 'derived-from-reading', 'empty-undeclared', 'negative-prose-unverified', 'period-beyond-retention', 'period-differs-from-asked', 'period-not-held', 'period-partly-held', 'period-undeclared', 'period-unknown', 'script-unmatched', 'sources-conflict', 'steps-unfinished', 'stopped-early', 'value-contingent', 'value-survived-revision', 'value-unsupported'));
/** Which honesty checks ran, and over how much. */
const boundAssessmentChecks = (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
    layer: (0, auditBounding_js_1.oneOf)(1, 2, 3, 4),
    check: (0, auditBounding_js_1.oneOf)('answer-checks', 'argument-rules', 'argument-sources', 'names-and-numbers', 'result-period', 'result-shape', 'script-match', 'tool-coverage'),
    ran: auditBounding_js_1.num,
    of: auditBounding_js_1.num,
}));
/** A turn's answer assessment: verdict words, reason codes and check counts. */
const boundAnswerAssessment = (0, auditBounding_js_1.shapeOf)({
    assessment: (0, auditBounding_js_1.oneOf)('known', 'not-applicable', 'unknown', 'unrefuted'),
    standing: (0, auditBounding_js_1.oneOf)('ask', 'consistent', 'known', 'not-assessed', 'not-sure'),
    reasons: boundAssessmentReasons,
    checked: boundAssessmentChecks,
});
/** One context source's share of a slot: characters and pieces. */
const boundSourceShare = (0, auditBounding_js_1.shapeOf)({ chars: auditBounding_js_1.num, count: auditBounding_js_1.num });
/** A slot's share by context source — every source the library declares, by name. */
const boundSourceBreakdown = (0, auditBounding_js_1.shapeOf)({
    assistant: boundSourceShare,
    base: boundSourceShare,
    custom: boundSourceShare,
    'evidence-recovery': boundSourceShare,
    fact: boundSourceShare,
    findings: boundSourceShare,
    instructions: boundSourceShare,
    memory: boundSourceShare,
    ontology: boundSourceShare,
    rag: boundSourceShare,
    registry: boundSourceShare,
    skill: boundSourceShare,
    steering: boundSourceShare,
    'tool-result': boundSourceShare,
    user: boundSourceShare,
});
const requestReason = (0, auditBounding_js_1.oneOf)('answered', 'cancelled', 'changes-without-key', 'exhausted', 'no-time-left', 'not-permitted', 'not-replayable', 'not-retryable', 'retryable', 'wait-limit');
const requestFailure = (0, auditBounding_js_1.oneOf)('auth', 'network', 'permanent', 'rate-limited', 'server', 'timeout', 'unknown');
const requestRefusalKind = (0, auditBounding_js_1.oneOf)('session-busy', 'throttle');
const requestEffect = (0, auditBounding_js_1.oneOf)('applied', 'none', 'unknown');
/** A request's error: one of the library's two fixed sentences, and a category — never the error itself. */
const requestError = (0, auditBounding_js_1.shapeOf)({
    message: (0, auditBounding_js_1.oneOf)('The call ran out of time before an answer arrived.', 'The request failed before an answer arrived. Its error is not kept.'),
    code: requestFailure,
});
/** One try of a tool's request: outcome, reason, timing and the library's categories. */
const boundRequestAttempt = (0, auditBounding_js_1.shapeOf)({
    attempt: auditBounding_js_1.num,
    outcome: (0, auditBounding_js_1.oneOf)('answered', 'cut', 'failed', 'refused', 'timed-out'),
    reason: requestReason,
    status: auditBounding_js_1.num,
    kind: requestRefusalKind,
    failure: requestFailure,
    waitMs: auditBounding_js_1.num,
    retryAfterMs: auditBounding_js_1.num,
    error: requestError,
    remote: (0, auditBounding_js_1.oneOf)('unknown'),
    effect: requestEffect,
    permission: (0, auditBounding_js_1.shapeOf)({
        by: (0, auditBounding_js_1.oneOf)('adapter', 'compatibility', 'declaration'),
        on: (0, auditBounding_js_1.oneOf)('network', 'throttle'),
        assumes: (0, auditBounding_js_1.oneOf)('refused-before-execution'),
        deduplicated: auditBounding_js_1.bool,
    }),
    durationMs: auditBounding_js_1.num,
});
/** How a tool's request ended. */
const boundRequestEnd = (0, auditBounding_js_1.shapeOf)({
    outcome: (0, auditBounding_js_1.oneOf)('answered', 'cancelled', 'cut', 'failed', 'refused', 'timed-out'),
    reason: requestReason,
    status: auditBounding_js_1.num,
    kind: requestRefusalKind,
    failure: requestFailure,
    during: (0, auditBounding_js_1.oneOf)('request', 'wait'),
    error: requestError,
    remote: (0, auditBounding_js_1.oneOf)('unknown'),
    attempts: auditBounding_js_1.num,
    effect: requestEffect,
    mayHaveRun: auditBounding_js_1.bool,
});
/**
 * Each record's meta: the run and stage ids, paths, indices and engine
 * coordinates the dispatcher stamps — and the who the caller named
 * (`sessionId`, `principal`, `tenant`), kept by contract. A field `EventMeta`
 * does not declare, or a value of another kind, is a marker. (`wallClockMs` is
 * the record's `timestamp`; `runId` its run anchor — `audit.ts` lifts both.)
 */
exports.boundMeta = (0, auditBounding_js_1.shapeOf)({
    wallClockMs: auditBounding_js_1.num,
    runOffsetMs: auditBounding_js_1.num,
    sourcePosition: (0, auditBounding_js_1.shapeOf)({
        engineRunId: auditBounding_js_1.str,
        logRunId: auditBounding_js_1.str,
        drillPath: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        committedThroughIdx: auditBounding_js_1.num,
    }),
    runtimeStageId: auditBounding_js_1.str,
    subflowPath: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
    compositionPath: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
    turnIndex: auditBounding_js_1.num,
    iterIndex: auditBounding_js_1.num,
    traceId: auditBounding_js_1.str,
    spanId: auditBounding_js_1.str,
    correlationId: auditBounding_js_1.str,
    runId: auditBounding_js_1.str,
    sessionId: auditKeptByContract_js_1.metaIdentity,
    principal: auditKeptByContract_js_1.metaIdentity,
    tenant: auditKeptByContract_js_1.metaIdentity,
});
/** What a tool returned, as `describedResult()` declared it: the data is content;
 *  its kinds, field and column names, counts and the library's static note stay. */
const boundSemantics = (0, auditBounding_js_1.shapeOf)({
    af_semantics: auditBounding_js_1.bool,
    series: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        t: auditBounding_js_1.charsMarker,
        entity: auditBounding_js_1.charsMarker,
        metric: auditBounding_js_1.str,
        value: auditBounding_js_1.charsMarker,
    })),
    // An open record: `entity` and every other value is the data; the keys stay.
    facts: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({ entity: auditBounding_js_1.charsMarker })),
    edges: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({ from: auditBounding_js_1.charsMarker, to: auditBounding_js_1.charsMarker, kind: auditBounding_js_1.str })),
    grain: (0, auditBounding_js_1.shapeOf)({
        interval: auditBounding_js_1.str,
        aggregation: auditBounding_js_1.str,
        is_counter: auditBounding_js_1.bool,
        collapsed: auditBounding_js_1.charsMarker,
    }),
    provenance: (0, auditBounding_js_1.shapeOf)({
        measured_at: auditBounding_js_1.charsMarker,
        age_seconds: auditBounding_js_1.num,
        source: auditBounding_js_1.charsMarker,
        source_export_date: auditBounding_js_1.charsMarker,
    }),
    period: (0, auditBounding_js_1.shapeOf)({ queried: boundInstants, held: boundHeld, read_at: auditBounding_js_1.charsMarker }),
    resolved: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
        argument: auditBounding_js_1.str,
        id: auditBounding_js_1.charsMarker,
        name: auditBounding_js_1.charsMarker,
        aliases: (0, auditBounding_js_1.listOf)(auditBounding_js_1.charsMarker),
    })),
    // `null` says there is no next page; a cursor or page number is a value.
    paging: (0, auditBounding_js_1.shapeOf)({ next: (0, auditBounding_js_1.nullOr)(auditBounding_js_1.charsMarker) }),
    coverage: (0, auditBounding_js_1.shapeOf)({
        checked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
        not_checked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
        cannot_cover: (0, auditBounding_js_1.listOf)(boundCoverageItem),
    }),
    not_covered: (0, auditBounding_js_1.listOf)(auditBounding_js_1.charsMarker),
    clarify: (0, auditBounding_js_1.nullOr)((0, auditBounding_js_1.shapeOf)({ question: auditBounding_js_1.charsMarker, candidates: (0, auditBounding_js_1.listOf)(auditBounding_js_1.charsMarker) })),
    render: (0, auditBounding_js_1.shapeOf)({
        default: auditBounding_js_1.str,
        columns: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        sort: auditBounding_js_1.str,
        filter_note: auditBounding_js_1.charsMarker,
        chart_hint: auditBounding_js_1.charsMarker,
    }),
    // "The static sentence. Never interpolated."
    note: auditBounding_js_1.str,
});
/**
 * The whole-event shapes as a `Map`, by event type — what `audit.ts` looks an
 * event up in. An event's name is the emitter's to choose (`agent.emit()`
 * takes any string), so it is never a key into a plain object: a name
 * `Object.prototype` holds (`constructor`, `toString`, `__proto__`) finds no
 * shape here, and that event is bounded as unknown — every field a marker.
 */
function eventShapeTable(toolRan) {
    return new Map(Object.entries(eventShapes(toolRan)));
}
exports.eventShapeTable = eventShapeTable;
/**
 * The whole-event shapes, by event type. `toolRan` answers whether this
 * strategy has seen a tool of that name run (`createToolRunTracker`): a
 * `tryInsteadTool` names another tool, and that name is kept only then —
 * otherwise it is the tool author's word for a tool this agent may not hold
 * (`otel.ts` · `coverageAttrs`, the same rule).
 */
function eventShapes(toolRan) {
    return {
        // ── The seven a tool, the model or the person writes into ──────────
        'agentfootprint.tools.absent': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            lookedFor: auditBounding_js_1.charsMarker,
            checked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
            notChecked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
            cannotCover: (0, auditBounding_js_1.listOf)(boundCoverageItem),
            tryInstead: auditBounding_js_1.charsMarker,
            tryInsteadTool: (0, auditBounding_js_1.shapeOf)({
                tool: (0, auditKeptByContract_js_1.seenToolName)(toolRan),
                why: auditBounding_js_1.charsMarker,
            }),
            provenance: boundProvenance,
            period: boundPeriod,
            composition: boundComposition,
            lookedForRef: (0, auditBounding_js_1.shapeOf)({
                resultId: auditBounding_js_1.str,
                field: (0, auditBounding_js_1.oneOf)('lookedFor'),
            }),
        }),
        'agentfootprint.tools.coverage_declared': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            checked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
            notChecked: (0, auditBounding_js_1.listOf)(boundCoverageItem),
            cannotCover: (0, auditBounding_js_1.listOf)(boundCoverageItem),
            period: boundPeriod,
            inProgress: (0, auditBounding_js_1.listOf)(boundInProgressItem),
            composition: boundComposition,
        }),
        'agentfootprint.tools.semantics_declared': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            semantics: boundSemantics,
        }),
        'agentfootprint.agent.evidence_checked': eventShape({
            iteration: auditBounding_js_1.num,
            posture: (0, auditBounding_js_1.oneOf)('assist', 'guard', 'rails'),
            candidates: auditBounding_js_1.num,
            lookedUp: auditBounding_js_1.num,
            unsupported: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                value: auditBounding_js_1.charsMarker,
                shape: auditBounding_js_1.str,
                region: (0, auditBounding_js_1.oneOf)('prose', 'code'),
            })),
            action: (0, auditBounding_js_1.oneOf)('flagged', 'grounded', 'refused', 'revision-asked'),
            afterRevision: auditBounding_js_1.bool,
            evidenceTruncated: auditBounding_js_1.bool,
            carriedBy: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                toolCallId: auditBounding_js_1.str,
                values: auditBounding_js_1.num,
                only: auditBounding_js_1.num,
            })),
            stagedRefs: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                ref: auditBounding_js_1.str,
                kind: auditBounding_js_1.str,
            })),
            spenderTools: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            // `from` names the operands — and a unit-scaled figure's source value.
            computed: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                value: auditBounding_js_1.charsMarker,
                shape: auditBounding_js_1.str,
                derivation: auditBounding_js_1.str,
                from: auditBounding_js_1.charsMarker,
            })),
            scripts: boundScriptsVerdict,
        }),
        'agentfootprint.integrity.external_ground_used': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            path: auditBounding_js_1.str,
            value: auditBounding_js_1.charsMarker,
            source: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.map.engaged': eventShape({
            mapId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            by: (0, auditBounding_js_1.oneOf)('assumed', 'explicit', 'lexical', 'semantic', 'structural'),
            witness: auditBounding_js_1.charsMarker,
            reengaged: auditBounding_js_1.bool,
            upgraded: auditBounding_js_1.bool,
            foundedBy: (0, auditBounding_js_1.oneOf)('assumed', 'explicit', 'lexical', 'semantic', 'structural'),
            tenantChanged: auditBounding_js_1.bool,
            at: auditBounding_js_1.str,
        }),
        'agentfootprint.skill.turn_routed': eventShape({
            by: (0, auditBounding_js_1.oneOf)('continuity', 'decider', 'entry', 'intent', 'menu', 'none'),
            from: auditBounding_js_1.str,
            to: auditBounding_js_1.str,
            scorer: auditBounding_js_1.str,
            scores: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                score: auditBounding_js_1.num,
                relevance: auditBounding_js_1.num,
            })),
            runnerUp: (0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                gap: auditBounding_js_1.num,
            }),
            decisive: auditBounding_js_1.bool,
            witness: boundWitness,
            offered: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            stayOffered: auditBounding_js_1.bool,
            policy: (0, auditBounding_js_1.shapeOf)({
                nearTieMargin: auditBounding_js_1.num,
                menuSize: auditBounding_js_1.num,
                floor: auditBounding_js_1.num,
            }),
            window: auditBounding_js_1.num,
            droppedResume: (0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                reason: (0, auditBounding_js_1.oneOf)('unknown-skill'),
            }),
            decider: (0, auditBounding_js_1.shapeOf)({
                provider: auditBounding_js_1.str,
                model: auditBounding_js_1.str,
                picked: auditBounding_js_1.str,
            }),
        }),
        // ── The same rule, everywhere else the run's words ride ────────────
        'agentfootprint.map.parked': eventShape({
            mapId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            by: (0, auditBounding_js_1.oneOf)('assumed', 'explicit', 'lexical', 'semantic', 'structural'),
            idleCalls: auditBounding_js_1.num,
            witness: auditBounding_js_1.charsMarker,
        }),
        // A guard's conditions are the engine's decision evidence (kept, see audit.ts).
        'agentfootprint.context.evaluated': eventShape({
            iteration: auditBounding_js_1.num,
            activeCount: auditBounding_js_1.num,
            skippedCount: auditBounding_js_1.num,
            evaluatedTotal: auditBounding_js_1.num,
            activeIds: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            skippedDetails: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                reason: (0, auditBounding_js_1.oneOf)('hidden', 'parked', 'predicate-threw', 'unknown-fact', 'unknown-trigger-kind'),
                error: auditBounding_js_1.charsMarker,
            })),
            triggerKindCounts: (0, auditBounding_js_1.recordOf)(auditBounding_js_1.num),
            // The catalog and the routing provenance are what the app declared.
            skillCatalog: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                description: auditBounding_js_1.str,
            })),
            routing: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                injectionId: auditBounding_js_1.str,
                flavor: auditBounding_js_1.str,
                via: auditBounding_js_1.str,
                path: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({ label: auditBounding_js_1.str, branch: auditBounding_js_1.str })),
                label: auditBounding_js_1.str,
                from: auditBounding_js_1.str,
                triggerKind: auditBounding_js_1.str,
                tools: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            })),
            cursorMove: (0, auditBounding_js_1.shapeOf)({
                from: auditBounding_js_1.str,
                to: auditBounding_js_1.str,
                by: auditBounding_js_1.str,
                offered: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
                declinedOffer: auditBounding_js_1.bool,
                witness: boundWitness,
                guard: boundGuard,
                guardsClosed: (0, auditBounding_js_1.listOf)(boundGuard),
                reachable: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            }),
            supersededIds: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        }),
        'agentfootprint.validation.args_invalid': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            issues: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                path: auditBounding_js_1.str,
                expected: auditBounding_js_1.str,
                got: auditBounding_js_1.str,
                value: auditBounding_js_1.charsMarker,
                hint: auditBounding_js_1.str,
            })),
            enforced: auditBounding_js_1.bool,
        }),
        'agentfootprint.agent.output_schema_validation_failed': eventShape({
            message: auditBounding_js_1.charsMarker,
            stage: (0, auditBounding_js_1.oneOf)('json-parse', 'schema-validate'),
            path: auditBounding_js_1.str,
            rawOutput: auditBounding_js_1.charsMarker,
            draftWithheld: auditBounding_js_1.bool,
            attempt: auditBounding_js_1.num,
            cumulativeRetries: auditBounding_js_1.num,
        }),
        'agentfootprint.resilience.output_fallback_triggered': eventShape({
            stage: (0, auditBounding_js_1.oneOf)('json-parse', 'schema-validate'),
            rawOutputPreview: auditBounding_js_1.charsMarker,
            primaryErrorMessage: auditBounding_js_1.charsMarker,
            retriesSpent: auditBounding_js_1.num,
        }),
        'agentfootprint.resilience.output_canned_used': eventShape({
            rawOutputPreview: auditBounding_js_1.charsMarker,
            fallbackErrorMessage: auditBounding_js_1.charsMarker,
            retriesSpent: auditBounding_js_1.num,
        }),
        'agentfootprint.stream.tool_progress': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            payload: auditBounding_js_1.keysMarker,
        }),
        'agentfootprint.checkin.request': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            request: auditBounding_js_1.keysMarker,
        }),
        'agentfootprint.checkin.decision': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            requestId: auditBounding_js_1.str,
            approved: auditBounding_js_1.bool,
            by: auditBounding_js_1.str,
            note: auditBounding_js_1.charsMarker,
            componentId: auditBounding_js_1.str,
        }),
        'agentfootprint.middleware.decision': eventShape({
            middleware: auditBounding_js_1.str,
            moment: (0, auditBounding_js_1.oneOf)('after-tool', 'before-tool', 'input', 'output', 'window'),
            at: (0, auditBounding_js_1.oneOf)('message', 'tool'),
            phase: (0, auditBounding_js_1.oneOf)('input', 'output'),
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            outcome: (0, auditBounding_js_1.oneOf)('allow', 'ask', 'deny'),
            changed: auditBounding_js_1.bool,
            why: auditBounding_js_1.charsMarker,
            componentId: auditBounding_js_1.str,
        }),
        'agentfootprint.skill.step_skipped': eventShape({
            skillId: auditBounding_js_1.str,
            // The step the app declared — its tool and note.
            step: (0, auditBounding_js_1.shapeOf)({
                index: auditBounding_js_1.num,
                total: auditBounding_js_1.num,
                tool: auditBounding_js_1.str,
                note: auditBounding_js_1.str,
            }),
            reason: auditBounding_js_1.charsMarker,
            policy: (0, auditBounding_js_1.oneOf)('advance', 'hold'),
            iteration: auditBounding_js_1.num,
            toolCallId: auditBounding_js_1.str,
        }),
        'agentfootprint.stream.llm_start': eventShape({
            iteration: auditBounding_js_1.num,
            provider: auditBounding_js_1.str,
            model: auditBounding_js_1.str,
            systemPromptChars: auditBounding_js_1.num,
            systemPromptText: auditBounding_js_1.charsMarker,
            messagesCount: auditBounding_js_1.num,
            toolsCount: auditBounding_js_1.num,
            // The catalog the model saw: names and the descriptions the tools declared.
            tools: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                name: auditBounding_js_1.str,
                description: auditBounding_js_1.str,
            })),
            estimatedPromptTokens: auditBounding_js_1.num,
            temperature: auditBounding_js_1.num,
            providerRequestRef: auditBounding_js_1.str,
            brain: (0, auditBounding_js_1.shapeOf)({
                via: (0, auditBounding_js_1.oneOf)('escalation', 'skill'),
                skillId: auditBounding_js_1.str,
            }),
        }),
        'agentfootprint.credential.failed': eventShape({
            service: auditBounding_js_1.str,
            reason: auditBounding_js_1.charsMarker,
            tool: auditBounding_js_1.str,
            errorClass: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.fallback.triggered': eventShape({
            kind: (0, auditBounding_js_1.oneOf)('provider', 'skill', 'tool'),
            primary: auditBounding_js_1.str,
            fallback: auditBounding_js_1.str,
            reason: auditBounding_js_1.charsMarker,
        }),
        'agentfootprint.memory.retrieved': eventShape({
            strategy: auditBounding_js_1.str,
            queryHash: auditBounding_js_1.str,
            k: auditBounding_js_1.num,
            threshold: auditBounding_js_1.num,
            maxChars: auditBounding_js_1.num,
            charsUsed: auditBounding_js_1.num,
            embedderId: auditBounding_js_1.str,
            dimensions: auditBounding_js_1.num,
            consideredCount: auditBounding_js_1.num,
            admittedCount: auditBounding_js_1.num,
            rejectedCount: auditBounding_js_1.num,
            candidates: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                score: auditBounding_js_1.num,
                rank: auditBounding_js_1.num,
                admitted: auditBounding_js_1.bool,
                reason: (0, auditBounding_js_1.oneOf)('below-threshold', 'over-budget', 'over-char-budget', 'over-max-entries'),
                docUri: auditBounding_js_1.str,
                page: auditBounding_js_1.num,
                heading: auditBounding_js_1.charsMarker,
            })),
            candidatesComplete: auditBounding_js_1.bool,
            candidatesOmittedReason: auditBounding_js_1.str,
            corpusEmpty: auditBounding_js_1.bool,
            namespace: auditBounding_js_1.str,
        }),
        'agentfootprint.integrity.context_error': eventShape({
            kind: (0, auditBounding_js_1.oneOf)('column-type-mismatch', 'dangling-reference', 'duplicate-execution', 'empty-lookup', 'invariant-violation', 'missing-column', 'prior-turn-evidence', 'unsupported-argument', 'unsupported-claim'),
            seam: (0, auditBounding_js_1.oneOf)('choice', 'claim', 'compose', 'wire', 'write'),
            subjects: (0, auditBounding_js_1.listOf)(boundSubject),
            witnesses: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                subject: boundSubject,
                predicate: auditBounding_js_1.str,
                value: auditBounding_js_1.charsMarker,
                epoch: auditBounding_js_1.num,
                stratum: (0, auditBounding_js_1.oneOf)('asserted', 'quoted'),
                provenance: auditBounding_js_1.charsMarker,
                runtimeStageId: auditBounding_js_1.str,
                synthetic: auditBounding_js_1.bool,
            })),
            predicate: auditBounding_js_1.str,
            epoch: auditBounding_js_1.num,
            synthetic: auditBounding_js_1.bool,
            advisory: auditBounding_js_1.bool,
            message: auditBounding_js_1.charsMarker,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.tools.effect': eventShape({
            kind: (0, auditBounding_js_1.oneOf)('propose-transition', 'require-instruction'),
            outcome: (0, auditBounding_js_1.oneOf)('accepted', 'refused', 'superseded'),
            stay: auditBounding_js_1.bool,
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            targetSkillId: auditBounding_js_1.str,
            reason: auditBounding_js_1.charsMarker,
            instructionId: auditBounding_js_1.str,
            deliveryLease: (0, auditBounding_js_1.oneOf)('next-call', 'until-skill-exit'),
            refusalReason: auditBounding_js_1.str,
            supersededBy: (0, auditBounding_js_1.oneOf)('earlier-proposal'),
        }),
        // `reason` is `pauseData.reason` — the same words `questionPayload` hides.
        'agentfootprint.pause.request': eventShape({
            // The library's own pause sentence stays; a pause's own reason is its data.
            reason: (0, auditBounding_js_1.oneOf)(FIXED_PAUSE_REASON),
            questionPayload: auditBounding_js_1.keysMarker,
        }),
        'agentfootprint.artifacts.minted': eventShape({
            ref: auditBounding_js_1.str,
            kind: auditBounding_js_1.str,
            mediaType: auditBounding_js_1.str,
            bytes: auditBounding_js_1.num,
            label: auditBounding_js_1.charsMarker,
            digest: auditBounding_js_1.str,
            expiresAt: auditBounding_js_1.num,
            origin: (0, auditBounding_js_1.shapeOf)({
                runId: auditBounding_js_1.str,
                toolCallId: auditBounding_js_1.str,
            }),
            parentRefs: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            // The column, zone and interval the rows declare.
            timeAxis: (0, auditBounding_js_1.shapeOf)({
                column: auditBounding_js_1.str,
                unit: (0, auditBounding_js_1.oneOf)('epoch-ms', 'epoch-s', 'iso'),
                zone: auditBounding_js_1.str,
                interval: auditBounding_js_1.str,
                // One aggregate for every column, or one per column.
                aggregate: (0, auditBounding_js_1.either)((0, auditBounding_js_1.oneOf)('avg', 'count', 'last', 'max', 'min', 'raw', 'sum'), (0, auditBounding_js_1.recordOf)((0, auditBounding_js_1.oneOf)('avg', 'count', 'last', 'max', 'min', 'sum'))),
            }),
            tool: auditBounding_js_1.str,
        }),
        'agentfootprint.artifacts.presented': eventShape({
            ref: auditBounding_js_1.str,
            as: auditBounding_js_1.str,
            snapshot: (0, auditBounding_js_1.shapeOf)({
                kind: auditBounding_js_1.str,
                mediaType: auditBounding_js_1.str,
                bytes: auditBounding_js_1.num,
                label: auditBounding_js_1.charsMarker,
            }),
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.artifacts.refused': eventShape({
            op: (0, auditBounding_js_1.oneOf)('delete', 'dispatch', 'get', 'head', 'list', 'put'),
            reason: (0, auditBounding_js_1.oneOf)('digest-mismatch', 'invalid-input', 'kind-mismatch', 'missing-or-expired', 'no-store', 'unknown-parent'),
            ref: auditBounding_js_1.str,
            detail: auditBounding_js_1.charsMarker,
            tool: auditBounding_js_1.str,
        }),
        'agentfootprint.reliability.fail_fast': eventShape({
            phase: (0, auditBounding_js_1.oneOf)('post-decide', 'pre-check'),
            kind: auditBounding_js_1.str,
            attempt: auditBounding_js_1.num,
            label: auditBounding_js_1.str,
            reason: auditBounding_js_1.charsMarker,
            providerUsed: auditBounding_js_1.str,
            errorKind: auditBounding_js_1.str,
            errorMessage: auditBounding_js_1.charsMarker,
        }),
        'agentfootprint.agent.handoff': eventShape({
            fromAgentId: auditBounding_js_1.str,
            toAgentId: auditBounding_js_1.str,
            reason: auditBounding_js_1.charsMarker,
            viaProtocol: (0, auditBounding_js_1.oneOf)('http', 'mcp', 'native'),
        }),
        // A policy's `reason` is its telemetry tag; its `rationale` is prose per decision.
        'agentfootprint.permission.check': eventShape({
            capability: (0, auditBounding_js_1.oneOf)('external_net', 'memory_read', 'memory_write', 'skill_read', 'tool_call', 'user_data'),
            actor: auditBounding_js_1.str,
            target: auditBounding_js_1.str,
            result: (0, auditBounding_js_1.oneOf)('allow', 'deny', 'gate_open', 'halt'),
            policyEngine: (0, auditBounding_js_1.oneOf)('cerbos', 'custom', 'opa'),
            policyRuleId: auditBounding_js_1.str,
            rationale: auditBounding_js_1.charsMarker,
            reason: auditKeptByContract_js_1.policyReasonTag,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        // `tellLLM` is the tool result the model read in place of the call.
        'agentfootprint.permission.halt': eventShape({
            checkerId: auditBounding_js_1.str,
            target: auditBounding_js_1.str,
            reason: auditKeptByContract_js_1.policyReasonTag,
            tellLLM: auditBounding_js_1.charsMarker,
            iteration: auditBounding_js_1.num,
            sequenceLength: auditBounding_js_1.num,
            toolCallId: auditBounding_js_1.str,
        }),
        // A router's `{ reason }` is the routing model's own words; `decide()`
        // evidence is the engine's, kept (see audit.ts).
        'agentfootprint.composition.route_decided': eventShape({
            conditionalId: auditBounding_js_1.str,
            chosen: auditBounding_js_1.str,
            rationale: auditBounding_js_1.str,
            evidence: auditKeptByContract_js_1.routeEvidence,
        }),
        // ── Every other event: structure, and the fields bounded whole ─────
        'agentfootprint.composition.enter': eventShape({
            kind: (0, auditBounding_js_1.oneOf)('Conditional', 'Loop', 'Parallel', 'Sequence'),
            id: auditBounding_js_1.str,
            name: auditBounding_js_1.str,
            childCount: auditBounding_js_1.num,
        }),
        'agentfootprint.composition.exit': eventShape({
            kind: (0, auditBounding_js_1.oneOf)('Conditional', 'Loop', 'Parallel', 'Sequence'),
            id: auditBounding_js_1.str,
            name: auditBounding_js_1.str,
            status: (0, auditBounding_js_1.oneOf)('break', 'budget_exhausted', 'err', 'ok'),
            durationMs: auditBounding_js_1.num,
        }),
        'agentfootprint.composition.fork_start': eventShape({
            parentId: auditBounding_js_1.str,
            branches: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                name: auditBounding_js_1.str,
            })),
        }),
        'agentfootprint.composition.branch_complete': eventShape({
            parentId: auditBounding_js_1.str,
            branchId: auditBounding_js_1.str,
            status: (0, auditBounding_js_1.oneOf)('err', 'ok'),
            durationMs: auditBounding_js_1.num,
        }),
        'agentfootprint.composition.merge_end': eventShape({
            parentId: auditBounding_js_1.str,
            strategy: (0, auditBounding_js_1.oneOf)('fn', 'llm', 'outcomes-fn'),
            resultSummary: auditBounding_js_1.charsMarker,
            mergedBranchCount: auditBounding_js_1.num,
            totalBranchCount: auditBounding_js_1.num,
        }),
        'agentfootprint.composition.iteration_start': eventShape({
            loopId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.composition.iteration_exit': eventShape({
            loopId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            reason: (0, auditBounding_js_1.oneOf)('body_complete', 'break', 'budget', 'guard_false'),
        }),
        'agentfootprint.agent.turn_start': eventShape({
            turnIndex: auditBounding_js_1.num,
            userPrompt: auditBounding_js_1.charsMarker,
        }),
        'agentfootprint.agent.turn_end': eventShape({
            turnIndex: auditBounding_js_1.num,
            finalContent: auditBounding_js_1.charsMarker,
            totalInputTokens: auditBounding_js_1.num,
            totalOutputTokens: auditBounding_js_1.num,
            iterationCount: auditBounding_js_1.num,
            durationMs: auditBounding_js_1.num,
            stoppedEarly: (0, auditBounding_js_1.shapeOf)({
                reason: (0, auditBounding_js_1.oneOf)('cost-budget', 'max-iterations'),
                iteration: auditBounding_js_1.num,
                pendingToolCalls: auditBounding_js_1.num,
                wrappedUp: auditBounding_js_1.bool,
            }),
            answerCoverage: exports.boundAnswerCoverage,
            answerAssessment: boundAnswerAssessment,
            standingLineNames: (0, auditBounding_js_1.recordOf)(auditBounding_js_1.str),
            answerNegatives: exports.boundAnswerNegatives,
            scripts: exports.boundScripts,
            refused: (0, auditBounding_js_1.shapeOf)({
                by: (0, auditBounding_js_1.oneOf)('evidence-rails'),
            }),
        }),
        'agentfootprint.agent.iteration_start': eventShape({
            turnIndex: auditBounding_js_1.num,
            iterIndex: auditBounding_js_1.num,
        }),
        'agentfootprint.agent.iteration_end': eventShape({
            turnIndex: auditBounding_js_1.num,
            iterIndex: auditBounding_js_1.num,
            toolCallCount: auditBounding_js_1.num,
            history: auditBounding_js_1.messagesMarker,
        }),
        'agentfootprint.agent.route_decided': eventShape({
            turnIndex: auditBounding_js_1.num,
            iterIndex: auditBounding_js_1.num,
            chosen: (0, auditBounding_js_1.oneOf)('evidence-recheck', 'final', 'negative-recheck', 'output-retry', 'step-nudge', 'tool-calls', 'wrap-up'),
            // A fixed sentence, or one the library composes (a count, a skill's name).
            rationale: auditBounding_js_1.str,
        }),
        'agentfootprint.agent.output_contract_unmet': eventShape({
            stage: (0, auditBounding_js_1.oneOf)('json-parse', 'schema-validate'),
            error: auditBounding_js_1.charsMarker,
            path: auditBounding_js_1.str,
            attempts: auditBounding_js_1.num,
            retriesSpent: auditBounding_js_1.num,
            fallbackConfigured: auditBounding_js_1.bool,
            iteration: auditBounding_js_1.num,
            brokenBy: auditBounding_js_1.str,
        }),
        'agentfootprint.agent.output_schema_retry': eventShape({
            attempt: auditBounding_js_1.num,
            retriesRemaining: auditBounding_js_1.num,
            iteration: auditBounding_js_1.num,
            stage: (0, auditBounding_js_1.oneOf)('json-parse', 'schema-validate'),
            error: auditBounding_js_1.charsMarker,
            path: auditBounding_js_1.str,
            correctiveMessageHash: auditBounding_js_1.str,
        }),
        'agentfootprint.agent.grounding_nudged': eventShape({
            iteration: auditBounding_js_1.num,
            refs: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                ref: auditBounding_js_1.str,
                kind: auditBounding_js_1.str,
            })),
            refsOmitted: auditBounding_js_1.num,
            tools: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        }),
        'agentfootprint.agent.run_configured': eventShape({
            agentId: auditBounding_js_1.str,
            llm: (0, auditBounding_js_1.shapeOf)({
                provider: auditBounding_js_1.str,
                model: auditBounding_js_1.str,
                modelOverrides: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.oneOf)('configure', 'skill-brains')),
            }),
            cache: (0, auditBounding_js_1.shapeOf)({
                requested: (0, auditBounding_js_1.oneOf)('default', 'explicit'),
                strategy: (0, auditBounding_js_1.oneOf)('none'),
                status: (0, auditBounding_js_1.oneOf)('not-applicable'),
            }),
            reactMode: (0, auditBounding_js_1.oneOf)('classic', 'dynamic', 'dynamic-grouped'),
            memories: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                type: (0, auditBounding_js_1.oneOf)('causal', 'episodic', 'narrative', 'semantic'),
                strategy: (0, auditBounding_js_1.oneOf)('budget', 'decay', 'extract', 'hybrid', 'summarize', 'topK', 'window'),
                retrieval: auditBounding_js_1.str,
                embedderId: auditBounding_js_1.str,
                flavor: (0, auditBounding_js_1.oneOf)('memory', 'rag'),
            })),
            window: auditBounding_js_1.str,
            skillGraph: (0, auditBounding_js_1.shapeOf)({
                routing: (0, auditBounding_js_1.oneOf)('assist', 'guard', 'rails'),
                continuity: (0, auditBounding_js_1.oneOf)('conversation', 'turn'),
                scorer: auditBounding_js_1.str,
            }),
            evidenceGate: (0, auditBounding_js_1.oneOf)('assist', 'guard', 'rails'),
            artifacts: (0, auditBounding_js_1.shapeOf)({
                placement: auditBounding_js_1.bool,
                recordings: auditBounding_js_1.bool,
            }),
            recipes: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                version: auditBounding_js_1.str,
            })),
        }),
        'agentfootprint.agent.thinking_parse_failed': eventShape({
            providerName: auditBounding_js_1.str,
            subflowId: auditBounding_js_1.str,
            error: auditBounding_js_1.charsMarker,
            errorName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.agent.thinking_omitted': eventShape({
            providerName: auditBounding_js_1.str,
            model: auditBounding_js_1.str,
            messageIndex: auditBounding_js_1.num,
            blockIndex: auditBounding_js_1.num,
            reason: (0, auditBounding_js_1.oneOf)('content-changed', 'missing-signature', 'prefix-changed', 'sequence-changed', 'thinking-retired'),
            phase: (0, auditBounding_js_1.oneOf)('prepared'),
        }),
        'agentfootprint.agent.budget_exhausted': eventShape({
            reason: (0, auditBounding_js_1.oneOf)('cost-budget', 'max-iterations'),
            iteration: auditBounding_js_1.num,
            limit: auditBounding_js_1.num,
            pendingToolCalls: auditBounding_js_1.num,
            action: (0, auditBounding_js_1.oneOf)('cut-short', 'wrapped-up'),
        }),
        'agentfootprint.stream.llm_end': eventShape({
            iteration: auditBounding_js_1.num,
            content: auditBounding_js_1.charsMarker,
            contentWithheld: auditBounding_js_1.bool,
            toolCallCount: auditBounding_js_1.num,
            // A provider's counts. Its usage object can carry more than these (structural
            // typing lets it): a child the type does not declare is a marker.
            usage: (0, auditBounding_js_1.shapeOf)({
                input: auditBounding_js_1.num,
                output: auditBounding_js_1.num,
                cacheRead: auditBounding_js_1.num,
                cacheWrite: auditBounding_js_1.num,
                thinking: auditBounding_js_1.num,
            }),
            stopReason: auditBounding_js_1.str,
            durationMs: auditBounding_js_1.num,
            providerResponseRef: auditBounding_js_1.str,
        }),
        'agentfootprint.stream.token': eventShape({
            iteration: auditBounding_js_1.num,
            tokenIndex: auditBounding_js_1.num,
            content: auditBounding_js_1.charsMarker,
        }),
        'agentfootprint.stream.tool_start': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            args: auditBounding_js_1.keysMarker,
            parallelCount: auditBounding_js_1.num,
            protocol: (0, auditBounding_js_1.oneOf)('http', 'mcp', 'native', 'python-fn'),
            notDispatched: (0, auditBounding_js_1.shapeOf)({
                pausedCall: (0, auditBounding_js_1.shapeOf)({
                    toolCallId: auditBounding_js_1.str,
                    toolName: auditBounding_js_1.str,
                }),
            }),
        }),
        'agentfootprint.stream.tool_end': eventShape({
            toolCallId: auditBounding_js_1.str,
            result: auditBounding_js_1.typeMarker,
            error: auditBounding_js_1.bool,
            durationMs: auditBounding_js_1.num,
            status: (0, auditBounding_js_1.oneOf)('absent', 'denied', 'failure', 'invalid', 'partial', 'pending', 'success'),
            notDispatched: (0, auditBounding_js_1.shapeOf)({
                pausedCall: (0, auditBounding_js_1.shapeOf)({
                    toolCallId: auditBounding_js_1.str,
                    toolName: auditBounding_js_1.str,
                }),
            }),
            modelResult: auditBounding_js_1.typeMarker,
            changedArgKeys: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            notExecuted: auditBounding_js_1.bool,
        }),
        'agentfootprint.stream.thinking_delta': eventShape({
            iteration: auditBounding_js_1.num,
            tokenIndex: auditBounding_js_1.num,
            content: auditBounding_js_1.charsMarker,
        }),
        'agentfootprint.stream.thinking_end': eventShape({
            iteration: auditBounding_js_1.num,
            blockCount: auditBounding_js_1.num,
            totalChars: auditBounding_js_1.num,
            tokens: auditBounding_js_1.num,
            blocks: auditBounding_js_1.blocksMarker,
        }),
        'agentfootprint.context.injected': eventShape({
            contentSummary: auditBounding_js_1.charsMarker,
            contentHash: auditBounding_js_1.str,
            rawContent: auditBounding_js_1.charsMarker,
            slot: (0, auditBounding_js_1.oneOf)('messages', 'system-prompt', 'tools'),
            asRole: (0, auditBounding_js_1.oneOf)('assistant', 'system', 'tool', 'user'),
            asRecency: (0, auditBounding_js_1.oneOf)('earlier', 'latest'),
            position: auditBounding_js_1.num,
            sectionTag: auditBounding_js_1.str,
            source: (0, auditBounding_js_1.oneOf)('assistant', 'base', 'custom', 'evidence-recovery', 'fact', 'findings', 'instructions', 'memory', 'ontology', 'rag', 'registry', 'skill', 'steering', 'tool-result', 'user'),
            sourceId: auditBounding_js_1.str,
            upstreamRef: auditBounding_js_1.str,
            reason: auditBounding_js_1.str,
            retrievalScore: auditBounding_js_1.num,
            rankPosition: auditBounding_js_1.num,
            threshold: auditBounding_js_1.num,
            budgetSpent: (0, auditBounding_js_1.shapeOf)({
                tokens: auditBounding_js_1.num,
                fractionOfCap: auditBounding_js_1.num,
            }),
            expiresAfter: (0, auditBounding_js_1.oneOf)('iteration', 'persistent', 'run', 'turn'),
        }),
        'agentfootprint.context.evicted': eventShape({
            slot: (0, auditBounding_js_1.oneOf)('messages', 'system-prompt', 'tools'),
            contentHash: auditBounding_js_1.str,
            reason: (0, auditBounding_js_1.oneOf)('budget', 'low_score', 'policy', 'stale', 'user_revoked'),
            survivalMs: auditBounding_js_1.num,
        }),
        'agentfootprint.context.slot_composed': eventShape({
            slot: (0, auditBounding_js_1.oneOf)('messages', 'system-prompt', 'tools'),
            iteration: auditBounding_js_1.num,
            budget: (0, auditBounding_js_1.shapeOf)({
                cap: auditBounding_js_1.num,
                used: auditBounding_js_1.num,
                headroomChars: auditBounding_js_1.num,
            }),
            sourceBreakdown: boundSourceBreakdown,
            orderingStrategy: auditBounding_js_1.str,
            droppedCount: auditBounding_js_1.num,
            droppedSummaries: auditBounding_js_1.summariesMarker,
        }),
        'agentfootprint.context.budget_pressure': eventShape({
            slot: (0, auditBounding_js_1.oneOf)('messages', 'system-prompt', 'tools'),
            overflowBy: auditBounding_js_1.num,
            planAction: (0, auditBounding_js_1.oneOf)('abort', 'evict', 'none', 'summarize'),
            unit: (0, auditBounding_js_1.oneOf)('chars', 'tokens'),
            cap: auditBounding_js_1.num,
            projected: auditBounding_js_1.num,
        }),
        'agentfootprint.memory.strategy_applied': eventShape({
            strategyId: auditBounding_js_1.str,
            strategyKind: (0, auditBounding_js_1.oneOf)('fact-extraction', 'hybrid', 'semantic', 'sliding-window', 'summarizing'),
            reason: auditBounding_js_1.str,
            scoreEvidence: auditBounding_js_1.keysMarker,
            inputMemoryCount: auditBounding_js_1.num,
            outputMemoryCount: auditBounding_js_1.num,
            droppedIds: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            addedIds: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        }),
        'agentfootprint.memory.attached': eventShape({
            memoryId: auditBounding_js_1.str,
            contentSummary: auditBounding_js_1.charsMarker,
            score: auditBounding_js_1.num,
            rank: auditBounding_js_1.num,
            source: (0, auditBounding_js_1.oneOf)('auto-extract', 'manual', 'store'),
            retriever: (0, auditBounding_js_1.oneOf)('chroma', 'custom', 'pinecone', 'qdrant', 'weaviate'),
        }),
        'agentfootprint.memory.detached': eventShape({
            memoryId: auditBounding_js_1.str,
            reason: (0, auditBounding_js_1.oneOf)('budget', 'policy', 'score_low', 'stale'),
        }),
        'agentfootprint.memory.written': eventShape({
            memoryId: auditBounding_js_1.str,
            contentSummary: auditBounding_js_1.charsMarker,
            source: (0, auditBounding_js_1.oneOf)('auto', 'manual'),
            actor: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.offered': eventShape({
            availableIds: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            withheldIds: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            withheldReasons: (0, auditBounding_js_1.recordOf)((0, auditBounding_js_1.oneOf)('cost_guard', 'gated', 'permission', 'skill_inactive')),
            reason: auditKeptByContract_js_1.appReasonWord,
        }),
        'agentfootprint.tools.activated': eventShape({
            toolId: auditBounding_js_1.str,
            reason: (0, auditBounding_js_1.oneOf)('autoActivate', 'permission_granted', 'skill_activated'),
            source: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.deactivated': eventShape({
            toolId: auditBounding_js_1.str,
            reason: (0, auditBounding_js_1.oneOf)('permission_revoked', 'skill_deactivated'),
        }),
        'agentfootprint.tools.discovery_started': eventShape({
            providerId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.tools.discovery_completed': eventShape({
            providerId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            durationMs: auditBounding_js_1.num,
            toolCount: auditBounding_js_1.num,
        }),
        'agentfootprint.tools.discovery_failed': eventShape({
            providerId: auditBounding_js_1.str,
            error: auditBounding_js_1.charsMarker,
            errorName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            durationMs: auditBounding_js_1.num,
        }),
        'agentfootprint.tools.shadowed': eventShape({
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            schemaFrom: (0, auditBounding_js_1.oneOf)('framework', 'provider', 'registry', 'skill'),
            schemaFromId: auditBounding_js_1.str,
            dispatchTo: (0, auditBounding_js_1.oneOf)('framework', 'provider', 'registry', 'skill'),
            dispatchToId: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.claim_swallowed': eventShape({
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            lostBy: (0, auditBounding_js_1.oneOf)('framework', 'provider', 'registry', 'skill'),
            lostById: auditBounding_js_1.str,
            wonBy: (0, auditBounding_js_1.oneOf)('framework', 'provider', 'registry', 'skill'),
            wonById: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.answered_off_wire': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            answeredBy: (0, auditBounding_js_1.oneOf)('framework', 'provider', 'registry', 'skill'),
            answeredById: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.session_started': eventShape({
            tool: auditBounding_js_1.str,
            scope: (0, auditBounding_js_1.oneOf)('call', 'run', 'session', 'shutdown'),
            keyHash: auditBounding_js_1.str,
            runnerId: auditBounding_js_1.str,
            label: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.session_reused': eventShape({
            calls: auditBounding_js_1.num,
            tool: auditBounding_js_1.str,
            scope: (0, auditBounding_js_1.oneOf)('call', 'run', 'session', 'shutdown'),
            keyHash: auditBounding_js_1.str,
            runnerId: auditBounding_js_1.str,
            label: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.session_closed': eventShape({
            reason: (0, auditBounding_js_1.oneOf)('call-end', 'evicted', 'idle', 'run-end', 'session-end', 'shutdown'),
            durationMs: auditBounding_js_1.num,
            tool: auditBounding_js_1.str,
            scope: (0, auditBounding_js_1.oneOf)('call', 'run', 'session', 'shutdown'),
            keyHash: auditBounding_js_1.str,
            runnerId: auditBounding_js_1.str,
            label: auditBounding_js_1.str,
        }),
        'agentfootprint.tools.result_refused': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            sizeChars: auditBounding_js_1.num,
            maxChars: auditBounding_js_1.num,
            narrowBy: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            declaredStatus: (0, auditBounding_js_1.oneOf)('absent', 'denied', 'failure', 'invalid', 'partial', 'pending', 'success'),
        }),
        'agentfootprint.tools.repeated_call': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            occurrences: auditBounding_js_1.num,
            argsFingerprint: auditBounding_js_1.str,
            resultFingerprint: auditBounding_js_1.str,
            mode: (0, auditBounding_js_1.oneOf)('arguments'),
        }),
        'agentfootprint.tools.code_run': eventShape({
            tool: auditBounding_js_1.str,
            language: auditBounding_js_1.str,
            stagedInputs: auditBounding_js_1.num,
            outputChars: auditBounding_js_1.num,
            truncated: auditBounding_js_1.bool,
            ok: auditBounding_js_1.bool,
            exitCode: auditBounding_js_1.num,
            serviceError: auditBounding_js_1.bool,
            terminatedBy: auditBounding_js_1.str,
            shapeHash: auditBounding_js_1.str,
        }),
        // One use of an MCP client pool: "ids, digests, evidence and outcomes only" —
        // never an identity value, a session handle, an argument, a result or a server's text.
        'agentfootprint.tools.mcp_client': eventShape({
            server: auditBounding_js_1.str,
            at: (0, auditBounding_js_1.oneOf)('call', 'list'),
            toolCallId: auditBounding_js_1.str,
            keyHash: auditBounding_js_1.str,
            clientId: auditBounding_js_1.str,
            generation: auditBounding_js_1.num,
            client: (0, auditBounding_js_1.oneOf)('expired', 'handle-lost', 'joined', 'not-needed', 'opened', 'refused', 'reused'),
            previous: (0, auditBounding_js_1.oneOf)('evicted', 'expired', 'handle-lost', 'idle', 'terminated'),
            evidence: (0, auditBounding_js_1.oneOf)('server-404', 'transport-forgot-handle'),
            refusal: (0, auditBounding_js_1.oneOf)('binding-changed', 'closed', 'ending-full', 'identity-mismatch', 'incomplete-identity', 'init-failed', 'init-timeout', 'lease-expired', 'no-identity', 'operations-full', 'pool-full', 'principal-full', 'request-unmatched', 'stale-tools'),
            initMs: auditBounding_js_1.num,
            definitions: (0, auditBounding_js_1.oneOf)('listed', 'shared'),
            definitionsAgeMs: auditBounding_js_1.num,
            revalidated: (0, auditBounding_js_1.oneOf)('kept', 'refused'),
        }),
        'agentfootprint.tools.request_attempts': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            endpoint: auditBounding_js_1.str,
            origin: auditBounding_js_1.str,
            attempts: (0, auditBounding_js_1.listOf)(boundRequestAttempt),
            omitted: auditBounding_js_1.num,
            end: boundRequestEnd,
        }),
        'agentfootprint.tools.session_close_failed': eventShape({
            reason: (0, auditBounding_js_1.oneOf)('call-end', 'evicted', 'idle', 'run-end', 'session-end', 'shutdown'),
            durationMs: auditBounding_js_1.num,
            error: auditBounding_js_1.charsMarker,
            errorClass: auditBounding_js_1.str,
            tool: auditBounding_js_1.str,
            scope: (0, auditBounding_js_1.oneOf)('call', 'run', 'session', 'shutdown'),
            keyHash: auditBounding_js_1.str,
            runnerId: auditBounding_js_1.str,
            label: auditBounding_js_1.str,
        }),
        'agentfootprint.skill.activated': eventShape({
            skillId: auditBounding_js_1.str,
            reason: (0, auditBounding_js_1.oneOf)('autoActivate', 'manual', 'read_skill_result'),
            injectedTools: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            injectedSystemPromptChars: auditBounding_js_1.num,
        }),
        'agentfootprint.skill.graph_declared': eventShape({
            nodes: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                id: auditBounding_js_1.str,
                kind: auditBounding_js_1.str,
                description: auditBounding_js_1.str,
                label: auditBounding_js_1.str,
                title: auditBounding_js_1.str,
            })),
            edges: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                from: (0, auditBounding_js_1.nullOr)(auditBounding_js_1.str),
                to: auditBounding_js_1.str,
                kind: auditBounding_js_1.str,
                label: auditBounding_js_1.str,
                guard: (0, auditBounding_js_1.shapeOf)({
                    conditions: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                        key: auditBounding_js_1.str,
                        op: auditBounding_js_1.str,
                        // The value the app declared to compare against: one, or a list.
                        value: (0, auditBounding_js_1.orList)(auditKeptByContract_js_1.declaredValue),
                    })),
                }),
            })),
        }),
        'agentfootprint.skill.deactivated': eventShape({
            skillId: auditBounding_js_1.str,
            reason: auditKeptByContract_js_1.appReasonWord,
        }),
        'agentfootprint.skill.rejected': eventShape({
            requestedId: auditBounding_js_1.str,
            currentSkillId: auditBounding_js_1.str,
            allowed: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            iteration: auditBounding_js_1.num,
            posture: (0, auditBounding_js_1.oneOf)('guard', 'rails'),
            reason: (0, auditBounding_js_1.oneOf)('posture', 'self-call', 'unreachable'),
        }),
        'agentfootprint.skill.reroute_superseded': eventShape({
            volunteeredId: auditBounding_js_1.str,
            wonId: auditBounding_js_1.str,
            fromSkillId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            source: (0, auditBounding_js_1.oneOf)('tool-proposal'),
        }),
        'agentfootprint.skill.route_conflict': eventShape({
            iteration: auditBounding_js_1.num,
            fromSkillId: auditBounding_js_1.str,
            winner: (0, auditBounding_js_1.shapeOf)({
                toolCallId: auditBounding_js_1.str,
                toolName: auditBounding_js_1.str,
                target: auditBounding_js_1.str,
            }),
            losers: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                toolCallId: auditBounding_js_1.str,
                toolName: auditBounding_js_1.str,
                target: auditBounding_js_1.str,
            })),
            source: (0, auditBounding_js_1.oneOf)('tool-proposal'),
        }),
        'agentfootprint.skill.step_advanced': eventShape({
            skillId: auditBounding_js_1.str,
            step: (0, auditBounding_js_1.shapeOf)({
                index: auditBounding_js_1.num,
                total: auditBounding_js_1.num,
                tool: auditBounding_js_1.str,
                note: auditBounding_js_1.str,
            }),
            iteration: auditBounding_js_1.num,
            toolCallId: auditBounding_js_1.str,
            completed: auditBounding_js_1.bool,
        }),
        'agentfootprint.skill.steps_unfinished': eventShape({
            skillId: auditBounding_js_1.str,
            remaining: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                index: auditBounding_js_1.num,
                tool: auditBounding_js_1.str,
                note: auditBounding_js_1.str,
            })),
            total: auditBounding_js_1.num,
            action: (0, auditBounding_js_1.oneOf)('accepted', 'cut-short', 'nudged'),
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.skill.escalated': eventShape({
            iteration: auditBounding_js_1.num,
            afterRefusals: auditBounding_js_1.num,
            refusals: auditBounding_js_1.num,
            from: (0, auditBounding_js_1.shapeOf)({
                provider: auditBounding_js_1.str,
                model: auditBounding_js_1.str,
            }),
            to: (0, auditBounding_js_1.shapeOf)({
                provider: auditBounding_js_1.str,
                model: auditBounding_js_1.str,
            }),
        }),
        'agentfootprint.permission.gate_opened': eventShape({
            gateId: auditBounding_js_1.str,
            openedBy: auditBounding_js_1.str,
            expiresAt: auditBounding_js_1.num,
        }),
        'agentfootprint.permission.gate_closed': eventShape({
            gateId: auditBounding_js_1.str,
            reason: auditKeptByContract_js_1.appReasonWord,
        }),
        'agentfootprint.credential.requested': eventShape({
            service: auditBounding_js_1.str,
            mode: (0, auditBounding_js_1.oneOf)('machine', 'user'),
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.credential.acquired': eventShape({
            service: auditBounding_js_1.str,
            kind: auditBounding_js_1.str,
            expiresAt: auditBounding_js_1.num,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.credential.authorization_required': eventShape({
            service: auditBounding_js_1.str,
            sessionId: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
        }),
        'agentfootprint.cost.tick': eventShape({
            scope: (0, auditBounding_js_1.oneOf)('iteration', 'run', 'turn'),
            model: auditBounding_js_1.str,
            provider: auditBounding_js_1.str,
            tokensInput: auditBounding_js_1.num,
            tokensOutput: auditBounding_js_1.num,
            estimatedUsd: auditBounding_js_1.num,
            cumulative: (0, auditBounding_js_1.shapeOf)({
                tokensInput: auditBounding_js_1.num,
                tokensOutput: auditBounding_js_1.num,
                estimatedUsd: auditBounding_js_1.num,
            }),
        }),
        'agentfootprint.cost.limit_hit': eventShape({
            kind: (0, auditBounding_js_1.oneOf)('max_cost', 'max_iterations', 'max_tokens', 'max_wallclock'),
            limit: auditBounding_js_1.num,
            actual: auditBounding_js_1.num,
            action: (0, auditBounding_js_1.oneOf)('abort', 'degrade', 'warn'),
        }),
        'agentfootprint.eval.score': eventShape({
            metricId: auditBounding_js_1.str,
            value: auditBounding_js_1.num,
            threshold: auditBounding_js_1.num,
            target: (0, auditBounding_js_1.oneOf)('iteration', 'run', 'toolCall', 'turn'),
            targetRef: auditBounding_js_1.str,
            evaluator: (0, auditBounding_js_1.oneOf)('fn', 'heuristic', 'llm'),
            evidence: auditBounding_js_1.keysMarker,
            label: auditBounding_js_1.str,
            explanation: auditBounding_js_1.charsMarker,
        }),
        'agentfootprint.eval.threshold_crossed': eventShape({
            metricId: auditBounding_js_1.str,
            direction: (0, auditBounding_js_1.oneOf)('above', 'below'),
            value: auditBounding_js_1.num,
            threshold: auditBounding_js_1.num,
            actionTaken: auditBounding_js_1.str,
        }),
        'agentfootprint.error.retried': eventShape({
            attempt: auditBounding_js_1.num,
            maxAttempts: auditBounding_js_1.num,
            lastError: auditBounding_js_1.charsMarker,
            backoffMs: auditBounding_js_1.num,
            reason: auditBounding_js_1.str,
            statedWaitMs: auditBounding_js_1.num,
        }),
        'agentfootprint.error.recovered': eventShape({
            attempt: auditBounding_js_1.num,
            totalDurationMs: auditBounding_js_1.num,
        }),
        'agentfootprint.error.fatal': eventShape({
            error: auditBounding_js_1.charsMarker,
            stage: auditBounding_js_1.str,
            scope: auditBounding_js_1.str,
        }),
        'agentfootprint.error.circuit_changed': eventShape({
            state: (0, auditBounding_js_1.oneOf)('closed', 'half-open', 'open'),
            reason: auditBounding_js_1.str,
            providerName: auditBounding_js_1.str,
        }),
        'agentfootprint.reliability.retried': eventShape({
            attempt: auditBounding_js_1.num,
            action: (0, auditBounding_js_1.oneOf)('retry', 'retry-other'),
            errorKind: auditBounding_js_1.str,
            errorMessage: auditBounding_js_1.charsMarker,
            fromProvider: auditBounding_js_1.str,
            toProvider: auditBounding_js_1.str,
        }),
        'agentfootprint.reliability.recovered': eventShape({
            attempt: auditBounding_js_1.num,
            recoveredVia: (0, auditBounding_js_1.oneOf)('fallback', 'retry', 'retry-other'),
            priorFailures: auditBounding_js_1.num,
            errorKind: auditBounding_js_1.str,
        }),
        'agentfootprint.pause.resume': eventShape({
            resumeInput: auditBounding_js_1.keysMarker,
            pausedDurationMs: auditBounding_js_1.num,
            componentId: auditBounding_js_1.str,
        }),
        'agentfootprint.findings.declared': eventShape({
            toolName: auditBounding_js_1.str,
            toolCallId: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            basis: (0, auditBounding_js_1.oneOf)('direct', 'exploratory'),
            expect: (0, auditBounding_js_1.oneOf)('high', 'low', 'medium'),
            hasProposition: auditBounding_js_1.bool,
            malformed: auditBounding_js_1.num,
        }),
        'agentfootprint.findings.standing': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            standing: (0, auditBounding_js_1.oneOf)('fact', 'noise', 'open', 'ruled-out'),
            declaredOn: (0, auditBounding_js_1.oneOf)('answer', 'tool-call'),
            assertionCount: auditBounding_js_1.num,
            conflictKeys: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            unknownId: auditBounding_js_1.bool,
            agrees: auditBounding_js_1.bool,
        }),
        'agentfootprint.findings.judged': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            against: (0, auditBounding_js_1.oneOf)('proposition', 'question'),
            standing: (0, auditBounding_js_1.oneOf)('fact', 'noise', 'open', 'ruled-out'),
            confidence: auditBounding_js_1.num,
            latencyMs: auditBounding_js_1.num,
            inputTokens: auditBounding_js_1.num,
            outputTokens: auditBounding_js_1.num,
        }),
        'agentfootprint.findings.judge_failed': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            status: auditBounding_js_1.num,
            latencyMs: auditBounding_js_1.num,
        }),
        'agentfootprint.findings.contingent': eventShape({
            iteration: auditBounding_js_1.num,
            declaredOn: (0, auditBounding_js_1.oneOf)('answer', 'tool-call'),
            toolCallId: auditBounding_js_1.str,
            carriers: auditBounding_js_1.num,
            standings: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.oneOf)('fact', 'noise', 'open', 'ruled-out')),
            valueChars: auditBounding_js_1.num,
        }),
        'agentfootprint.findings.argument': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            turn: auditBounding_js_1.num,
            argument: auditBounding_js_1.str,
            rule: (0, auditBounding_js_1.oneOf)('ask', 'assume'),
            period: auditBounding_js_1.bool,
            source: (0, auditBounding_js_1.oneOf)('answered', 'app', 'default', 'model', 'result', 'said'),
            asked: (0, auditBounding_js_1.oneOf)('invalid-answer', 'missing', 'unverified'),
            claimed: (0, auditBounding_js_1.oneOf)('app', 'assumed', 'none', 'result', 'turn', 'user'),
            matched: (0, auditBounding_js_1.oneOf)('mention', 'phrase', 'quote', 'spelling'),
            reading: auditBounding_js_1.bool,
            earlier: auditBounding_js_1.bool,
            setAside: (0, auditBounding_js_1.oneOf)('noise', 'open', 'ruled-out'),
            argumentsFrom: (0, auditBounding_js_1.oneOf)('listed', 'unlisted'),
            coincides: (0, auditBounding_js_1.oneOf)('app', 'person', 'result'),
            free: auditBounding_js_1.bool,
            failed: (0, auditBounding_js_1.oneOf)('composed-message', 'no-earlier-turn', 'not-in-app-text', 'not-in-earlier-turns', 'not-in-result', 'only-in-model-answer', 'placed-result', 'quote-not-found', 'uncheckable', 'unknown-result'),
            malformed: auditBounding_js_1.num,
            valueChars: auditBounding_js_1.num,
        }),
        'agentfootprint.findings.period': eventShape({
            toolCallId: auditBounding_js_1.str,
            toolName: auditBounding_js_1.str,
            iteration: auditBounding_js_1.num,
            turn: auditBounding_js_1.num,
            verdict: (0, auditBounding_js_1.oneOf)('covered', 'not-held', 'partly-held', 'undeclared', 'unknown'),
            timeChecks: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.oneOf)('partly-beyond-retention', 'period-beyond-retention', 'period-differs-from-asked', 'period-shifted')),
        }),
        'agentfootprint.findings.negative_claim': eventShape({
            iteration: auditBounding_js_1.num,
            turn: auditBounding_js_1.num,
            field: auditBounding_js_1.str,
            span: (0, auditBounding_js_1.shapeOf)({
                start: auditBounding_js_1.num,
                end: auditBounding_js_1.num,
            }),
            packVersion: auditBounding_js_1.str,
            phraseId: auditBounding_js_1.str,
            truncated: auditBounding_js_1.bool,
            kind: (0, auditBounding_js_1.oneOf)('negative-claim', 'negative-claim-note'),
            // A claim row's checker codes and native result ids; a note row's code.
            claim: (0, auditBounding_js_1.oneOf)('complete', 'none'),
            notes: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            results: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            code: auditBounding_js_1.str,
        }),
        'agentfootprint.tool_choice.picked': eventShape({
            iteration: auditBounding_js_1.num,
            chosen: auditBounding_js_1.str,
            confidence: auditBounding_js_1.num,
            offered: auditBounding_js_1.num,
            served: auditBounding_js_1.num,
            narrowed: auditBounding_js_1.bool,
            narrowedSkipped: (0, auditBounding_js_1.oneOf)('after-miss', 'evidence-revision', 'too-few', 'unavailable', 'wrap-up'),
            latencyMs: auditBounding_js_1.num,
            inputTokens: auditBounding_js_1.num,
            outputTokens: auditBounding_js_1.num,
        }),
        'agentfootprint.tool_choice.outcome': eventShape({
            iteration: auditBounding_js_1.num,
            called: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
            firstAgrees: auditBounding_js_1.bool,
            missed: (0, auditBounding_js_1.listOf)(auditBounding_js_1.str),
        }),
        'agentfootprint.tool_choice.failed': eventShape({
            iteration: auditBounding_js_1.num,
            status: auditBounding_js_1.num,
            latencyMs: auditBounding_js_1.num,
        }),
        'agentfootprint.ontology.served': eventShape({
            iteration: auditBounding_js_1.num,
            id: auditBounding_js_1.str,
            version: auditBounding_js_1.str,
            hash: auditBounding_js_1.str,
            nodes: auditBounding_js_1.num,
            sources: auditBounding_js_1.num,
            edges: auditBounding_js_1.num,
        }),
        'agentfootprint.answer.assessed': eventShape({
            turn: auditBounding_js_1.num,
            iteration: auditBounding_js_1.num,
            assessment: (0, auditBounding_js_1.oneOf)('known', 'not-applicable', 'unknown', 'unrefuted'),
            standing: (0, auditBounding_js_1.oneOf)('ask', 'consistent', 'known', 'not-assessed', 'not-sure'),
            reasons: boundAssessmentReasons,
            checked: boundAssessmentChecks,
        }),
        'agentfootprint.embedding.generated': eventShape({
            model: auditBounding_js_1.str,
            provider: (0, auditBounding_js_1.oneOf)('cohere', 'custom', 'local', 'openai', 'voyage'),
            inputKind: (0, auditBounding_js_1.oneOf)('document', 'query'),
            dimension: auditBounding_js_1.num,
            count: auditBounding_js_1.num,
            durationMs: auditBounding_js_1.num,
            tokensSpent: auditBounding_js_1.num,
        }),
        'agentfootprint.artifacts.resolved': eventShape({
            ref: auditBounding_js_1.str,
            via: (0, auditBounding_js_1.oneOf)('get', 'head'),
            kind: auditBounding_js_1.str,
            bytes: auditBounding_js_1.num,
            tool: auditBounding_js_1.str,
        }),
        'agentfootprint.artifacts.expired': eventShape({
            ref: auditBounding_js_1.str,
            reason: (0, auditBounding_js_1.oneOf)('max-bytes', 'max-count', 'ttl'),
            kind: auditBounding_js_1.str,
            bytes: auditBounding_js_1.num,
            tool: auditBounding_js_1.str,
        }),
        'agentfootprint.artifacts.hand_over_failed': eventShape({
            cause: (0, auditBounding_js_1.oneOf)('abort', 'expired', 'hook', 'operation', 'timeout'),
            op: (0, auditBounding_js_1.oneOf)('delete', 'dispatch', 'get', 'head', 'list', 'put'),
            errorClass: auditBounding_js_1.str,
            errorCode: auditBounding_js_1.str,
        }),
        'agentfootprint.integrity.disposition': eventShape({
            posture: (0, auditBounding_js_1.oneOf)('dev', 'observe'),
            workExisted: auditBounding_js_1.bool,
            rows: (0, auditBounding_js_1.listOf)((0, auditBounding_js_1.shapeOf)({
                check: auditBounding_js_1.str,
                seam: (0, auditBounding_js_1.oneOf)('choice', 'claim', 'compose', 'wire', 'write'),
                checked: auditBounding_js_1.num,
                findings: auditBounding_js_1.num,
                notApplicable: auditBounding_js_1.num,
                unreachable: auditBounding_js_1.num,
                lastFiredAt: auditBounding_js_1.num,
                synthetic: auditBounding_js_1.num,
            })),
        }),
    };
}
exports.eventShapes = eventShapes;
//# sourceMappingURL=auditShapes.js.map