import { z } from 'zod'; import type { OrgTask } from './task-dag.js'; export declare const MAX_REFERENCES = 256; /** All variable first-message parts together, excluding the stable prefix. */ export declare const MAX_PACKET_CHARS = 12000; export interface TaskReferences { files?: string[]; memory_keys?: string[]; task_ids?: string[]; } /** The `references` argument of org_task and org_plan_graph nodes. */ export declare const referencesArg: z.ZodOptional>; memory_keys: z.ZodOptional>; task_ids: z.ZodOptional>; }, z.core.$strict>>; export declare const REFERENCES_HELP = " `references` lists what the assignee should consult: `files` (authorized paths), `memory_keys` (org_recall lookup keys) and `task_ids` (read with org_tasks). They are listed after the brief; the assignee fetches their contents itself, and a path or key is not a snapshot of what it holds."; /** The references block of a dispatch: empty when there is nothing to list. */ export declare function renderReferences(refs: TaskReferences | undefined): string; /** Distinct references, counted per kind (the same string as a file and as a key is two). */ export declare function countReferences(refs: TaskReferences | undefined): number; /** The error for a declared packet that does not fit, or undefined. */ export declare function checkPacket(p: { title: string; brief?: string; references?: TaskReferences; }): string | undefined; export interface PacketPart { name: string; sha256: string; chars: number; } export interface PacketRecord { kind: 'packet'; ts: number; task_id: string; role: string; /** The dispatch text as sent. */ text: string; sha256: string; parts: PacketPart[]; } export interface GenerationRecord { kind: 'generation'; ts: number; role: string; /** The session key: a task id under task scope, `_role` otherwise. */ task_key: string; /** 0 for the first SDK session of this (role, task_key), then 1, 2... */ generation: number; resumed: false; session_id?: string; first_message_sha256: string; chars: number; /** The task whose dispatch packet this first message carries. */ packet_task_id?: string; /** Notes injected ahead of the packet: entries included, entries left out, and the block's hash. */ notes_entries?: number; notes_omitted?: number; notes_sha256?: string; /** The rotation this generation began with: its number and the digest's hash. */ rotation_generation?: number; rotation_digest_sha256?: string; } export type PacketLogRecord = PacketRecord | GenerationRecord; export declare function readPacketLog(runDir: string): PacketLogRecord[]; /** The dispatch parts of a task, in the order they are laid out. */ export declare function dispatchParts(taskLine: string, task: Pick): { name: string; text: string; }[]; /** Record a dispatched packet with each part's hash. */ export declare function recordPacket(runDir: string, rec: { task_id: string; role: string; text: string; parts: { name: string; text: string; }[]; }): void; /** Record the first message of a fresh SDK session. */ export declare function recordGeneration(runDir: string, rec: { role: string; task_key: string; first: string; session_id?: string; notes?: { entries: number; omitted: number; block: string; }; rotation?: { generation: number; digest: string; }; }): void; /** The text of a stream message, whether the runner is handed a string or an SDK user message. */ export declare function messageText(m: unknown): string; /** A copy of a stream message with its text replaced. */ export declare function withMessageText(m: T, text: string): T; /** Pass a message stream through, letting `fn` see (and replace) each message with its position. */ export declare function mapStream(source: AsyncIterable, fn: (m: T, index: number) => T): AsyncIterable; //# sourceMappingURL=packet.d.ts.map