import type { ActivationStatusRecord } from './activation-types.js'; export declare const RUNTIME_V2_PRINCIPLE_BUDGET = 2000; export interface ActivatedPrinciple { principleId: string; text: string; artifactId: string; activationId: string; /** * 谁授权了这条激活 (INV-05, P0-G): * - owner: 经 approvals 队列 approve (derived join on artifact_id+channel) * - system_policy: PRI-811 Phase B 前的存量行 — 旧低风险渠道 policy 自动 * 激活 (无 approval 行);Phase B 起不再产生新的 system_policy 激活 * - undefined: 读取层无法判定 (旧数据/查询失败) — 渲染层不得声称 owner */ authority?: 'owner' | 'system_policy'; /** owner 授权时的决定者 (approvals.decided_by) */ approvedBy?: string; } export interface PromptActivationReaderResult { principles: ActivatedPrinciple[]; warnings: string[]; source: 'runtime_v2'; } export declare function isRecord(value: unknown): value is Record; export declare function filterPromptActivations(activations: ActivationStatusRecord[]): ActivationStatusRecord[]; export declare function resolvePrincipleFromArtifact(artifactRow: unknown, activation: ActivationStatusRecord): { ok: true; principle: ActivatedPrinciple; } | { ok: false; warning: string; }; /** * PRI-904 (SPEC v0.1): which budget-packing policy produced a selection. * * - `legacy_fifo_prefix_v1` — the pre-PRI-904 policy and the rollback target: * greedy prefix packing in base order, first non-fit breaks. Also the * characterization baseline reproducing the audited 16→9/1893 behavior. * - `fair_rotation_v1` — deterministic rotating start + circular * continue-on-non-fit packing. Eliminates permanent positional starvation * under the fixed budget without randomness or persisted cursors. */ export type PromptSelectionPolicy = 'legacy_fifo_prefix_v1' | 'fair_rotation_v1'; export interface TrimToBudgetResult { lines: string[]; injectedIds: Set; truncated: boolean; /** PRI-904: policy that produced this selection. */ selectionPolicy: PromptSelectionPolicy; /** PRI-904: candidates that reached the budget selector (post eligibility + dedup). */ eligibleCount: number; /** PRI-904: circular scan start; present only under fair_rotation_v1. */ rotationStartIndex?: number; /** * PRI-904 (bounded, max 16): activation ids dropped because the remaining * budget was insufficient. Ordered by scan position. */ droppedActivationIds: string[]; /** * PRI-904 (bounded, max 16): activation ids whose single entry exceeds the * whole principle budget — they can never fit alone and are not starvation. */ oversizedActivationIds: string[]; } /** * PRI-904: the round key is a deterministic session-local user-turn ordinal * (see `nextSessionTurnOrdinal` in the registered trajectory-store seam) — * NOT a hash of an opaque run identity. Because consecutive recorded user * turns yield consecutive ordinals, N consecutive rounds cover all N * positions of an N-entry eligible ring: a bounded opportunity window, not a * statistical one. Both injection routes read the same fact, so their * fairness semantics are identical. */ /** * The single authority for the list route's serialized entry line format. * `trimToBudget` measures entries through this helper; capacity prechecks and * status projections must measure through it too instead of re-typing the * format (PD_PROMPT_CAPACITY_V1 R-A2: costs come from the production * serializer, not an approximation). */ export declare function listEntryLine(principle: { principleId: string; text: string; }, escapeFn?: (s: string) => string): string; export declare function trimToBudget(principles: ActivatedPrinciple[], budget: number, escapeFn?: (s: string) => string, roundKey?: number): TrimToBudgetResult; export interface RenderDirectivesOptions { /** XML-escape function applied to principle ids and texts. */ escapeFn?: (s: string) => string; /** * PRI-532 (SPEC §5.2): append the agent self-report instruction footer. * When a directive actually changes the agent's behavior this turn, the * agent appends one 📌 line echoing the directive id — captured by the * plugin's llm_output / before_message_write handlers. */ selfReportInstruction?: boolean; } export declare function renderPrinciplesToDirectives(principles: { principleId: string; text: string; artifactId: string; activationId: string; authority?: 'owner' | 'system_policy'; approvedBy?: string; }[], injectedIds: Set, options?: RenderDirectivesOptions): string; //# sourceMappingURL=prompt-activation-reader-contract.d.ts.map