@poncho-ai/harness 0.53.0 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/harness@0.53.0 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.57.0 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
3
3
  > node scripts/embed-docs.js && tsup src/index.ts --format esm --dts
4
4
 
5
5
  [embed-docs] Generated poncho-docs.ts with 4 topics
@@ -8,9 +8,9 @@
8
8
  CLI tsup v8.5.1
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
+ ESM dist/index.js 565.81 KB
11
12
  ESM dist/isolate-F2PPSUL6.js 53.82 KB
12
- ESM dist/index.js 541.42 KB
13
- ESM ⚡️ Build success in 239ms
13
+ ESM ⚡️ Build success in 254ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 7708ms
16
- DTS dist/index.d.ts 94.04 KB
15
+ DTS ⚡️ Build success in 7133ms
16
+ DTS dist/index.d.ts 104.68 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.57.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#153](https://github.com/cesr/poncho-ai/pull/153) [`d39d8fe`](https://github.com/cesr/poncho-ai/commit/d39d8fe0b178c102c728dbb4c000786f0a50a83b) Thanks [@cesr](https://github.com/cesr)! - Dual-write conversation entries + opt-in parity checker (Phase 3b).
8
+
9
+ At each conversation write site the orchestrator now ALSO appends the matching
10
+ append-only `ConversationEntry`s (`user_message`, `assistant_message`,
11
+ `assistant_amendment`, `harness_message`, `compaction`, `subagent_result`,
12
+ `callback_started`) alongside the existing mutable-blob write. This is purely
13
+ additive instrumentation: read paths still use the blob, so the dual-write is
14
+ fire-and-forget and can never corrupt behavior.
15
+
16
+ An opt-in parity checker (gated on `PONCHO_VERIFY_ENTRIES=1`) rebuilds the LLM
17
+ context and display snapshot from the entry log after each turn finalizes and
18
+ logs any divergence from the blob under a `[entries-parity]` prefix. It never
19
+ throws.
20
+
21
+ Re-exports the entry types and rebuild functions (`buildLlmContext`,
22
+ `buildDisplaySnapshot`, `getPendingSubagentResults`) from the package root so
23
+ downstream consumers can build on the substrate.
24
+
25
+ ## 0.56.0
26
+
27
+ ### Minor Changes
28
+
29
+ - [#151](https://github.com/cesr/poncho-ai/pull/151) [`4c116d8`](https://github.com/cesr/poncho-ai/commit/4c116d8f883c1d486b86b6c254334602326d7713) Thanks [@cesr](https://github.com/cesr)! - Add append-only conversation entry persistence (Phase 3 substrate).
30
+
31
+ Introduces `appendEntries` / `readEntries` on the `ConversationStore` and
32
+ `StorageEngine.conversations` interfaces, implemented for SQLite, PostgreSQL
33
+ (via `SqlStorageEngine`), and the in-memory stores. A new `conversation_entries`
34
+ table (migration v8) stores each entry with an app-assigned per-conversation
35
+ monotonic `seq`, a unique `id`, a JSON `payload`, and a `UNIQUE
36
+ (conversation_id, seq)` constraint.
37
+
38
+ Purely additive: no existing table, behavior, or read path changes — this is
39
+ the foundation for a later dual-write phase.
40
+
41
+ ## 0.55.0
42
+
43
+ ### Minor Changes
44
+
45
+ - [#149](https://github.com/cesr/poncho-ai/pull/149) [`f5a8260`](https://github.com/cesr/poncho-ai/commit/f5a8260d0515038afc1797d00507908c334115ff) Thanks [@cesr](https://github.com/cesr)! - compaction: preserve subagent context and prior summaries, harden the split
46
+
47
+ Three improvements to context compaction (fires at ~75% context):
48
+ - **Split safety**: `findSafeSplitPoint` now refuses a split whose compacted
49
+ side would end on an assistant message with unanswered `tool_calls` (its
50
+ answering `role:"tool"` result having moved to the preserved side), walking
51
+ earlier to the next clean `user` boundary. Prevents orphaning a tool-call
52
+ relationship inside the summary boundary. Still returns `-1` when no safe
53
+ point exists.
54
+ - **Subagent ledger**: while compacting, scans for subagent-callback records
55
+ (metadata `_subagentCallback`/`subagentCallback`, or text starting with
56
+ `[Subagent Result]`) and any `## Subagents` block embedded in a prior
57
+ compaction summary, then renders a combined, deduped (by `subagentId`)
58
+ ledger that is appended VERBATIM after the LLM summary text — so the model
59
+ can never paraphrase or truncate subagent results away. Cumulative across
60
+ successive compactions.
61
+ - **Cumulative summary**: when the first compacted message is itself a prior
62
+ compaction summary, it is passed to the summarizer in full (not truncated
63
+ to 1200 chars) and the prompt instructs the model to merge-and-update the
64
+ prior working state rather than re-summarize it from scratch. All other
65
+ messages keep the 1200-char truncation.
66
+
67
+ ## 0.54.0
68
+
69
+ ### Minor Changes
70
+
71
+ - [#147](https://github.com/cesr/poncho-ai/pull/147) [`a3eed14`](https://github.com/cesr/poncho-ai/commit/a3eed142832318b6397cd73819d3296c79d6eff0) Thanks [@cesr](https://github.com/cesr)! - storage: add append-only conversation-entry substrate (unused groundwork)
72
+
73
+ Pure entry types + rebuild functions (`buildLlmContext`,
74
+ `buildDisplaySnapshot`, `getPendingSubagentResults`) for the eventual
75
+ append-only conversation model that removes the mutable-blob clobber race
76
+ (the root cause behind lost subagent results). No storage-engine wiring
77
+ and no live callers yet — additive, deploys nothing behavioral. The
78
+ rebuild logic (compaction overlay, amendment folding, callback-consumption)
79
+ is covered by unit tests so the design is proven before the bigger
80
+ dual-write / migration / cutover PRs.
81
+
3
82
  ## 0.53.0
4
83
 
5
84
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LanguageModel } from 'ai';
2
2
  import * as _poncho_ai_sdk from '@poncho-ai/sdk';
3
- import { Message, ToolContext, ToolDefinition, JsonSchema, RunResult, AgentFailure, RunInput, AgentEvent, FileInput } from '@poncho-ai/sdk';
3
+ import { Message, ToolContext, ToolDefinition, JsonSchema, RunResult, AgentFailure, RunInput, AgentEvent, FileInput, Logger } from '@poncho-ai/sdk';
4
4
  export { ToolDefinition, defineTool } from '@poncho-ai/sdk';
5
5
  import { FsStat, IFileSystem, BufferEncoding, FileContent, MkdirOptions, RmOptions, CpOptions, Bash } from 'just-bash';
6
6
  import { z } from 'zod';
@@ -96,6 +96,12 @@ declare const estimateTotalTokens: (systemPrompt: string, messages: Message[], t
96
96
  * and everything from it onward is preserved. The split always lands just
97
97
  * before a `user` message to avoid breaking assistant+tool pairs.
98
98
  *
99
+ * Defensive guard: even at a `user` boundary, refuse a split whose compacted
100
+ * side would END on an assistant message with unanswered tool_calls (its
101
+ * `tool` result having moved to the preserved side). Such a split would
102
+ * orphan the tool_calls inside the summary boundary. When that happens we
103
+ * walk earlier to the next safe `user` boundary.
104
+ *
99
105
  * Returns -1 if no valid split point is found.
100
106
  */
101
107
  declare const findSafeSplitPoint: (messages: Message[], keepRecentMessages: number) => number;
@@ -120,6 +126,127 @@ interface CompactResult {
120
126
  */
121
127
  declare const compactMessages: (model: LanguageModel, messages: Message[], config: CompactionConfig, options?: CompactMessagesOptions) => Promise<CompactResult>;
122
128
 
129
+ /**
130
+ * Append-only conversation entries (Phase 3 substrate).
131
+ *
132
+ * The eventual replacement for the mutable per-conversation JSON blob: a
133
+ * conversation becomes an ordered, append-only list of entries, and the
134
+ * mutable-blob clobber race (two writers serializing a stale whole-blob
135
+ * snapshot over each other — the root cause behind lost subagent results)
136
+ * stops being expressible.
137
+ *
138
+ * This module is intentionally PURE: it defines the entry shapes and the
139
+ * functions that rebuild a conversation's LLM context / display transcript
140
+ * / pending-subagent-results from an entry list. No storage engine, no DB,
141
+ * no wiring into the live run loop yet — so it deploys nothing and is
142
+ * fully unit-testable. The engine implementations (append/read on
143
+ * postgres/sqlite/memory) and the write-site conversions come in later PRs
144
+ * once this rebuild logic is proven.
145
+ *
146
+ * Ordering: every entry carries a monotonic per-conversation `seq`. Entries
147
+ * are assumed sorted by `seq` ascending when passed to the rebuild fns.
148
+ */
149
+ interface BaseEntry {
150
+ /** Stable cross-reference id (uuid). */
151
+ id: string;
152
+ /** Monotonic per-conversation order. */
153
+ seq: number;
154
+ createdAt: number;
155
+ }
156
+ /** A user-role display message (incl. typed subagent-callback messages). */
157
+ interface UserMessageEntry extends BaseEntry {
158
+ type: "user_message";
159
+ message: Message;
160
+ turnId: string;
161
+ /** Hidden from the display transcript (e.g. a framed job prompt, an
162
+ * onboarding seed, or an injected subagent-result message). Still part
163
+ * of the record; just not rendered as a chat bubble. */
164
+ hidden?: boolean;
165
+ }
166
+ /** The final assistant bubble for a completed/cancelled/errored turn. */
167
+ interface AssistantMessageEntry extends BaseEntry {
168
+ type: "assistant_message";
169
+ message: Message;
170
+ turnId: string;
171
+ runId: string;
172
+ }
173
+ /** A post-hoc edit to an already-emitted assistant message — replaces the
174
+ * orchestrator/resume "mutate the last assistant message in place" writes
175
+ * with an append. Applied at rebuild time. */
176
+ interface AssistantAmendmentEntry extends BaseEntry {
177
+ type: "assistant_amendment";
178
+ targetEntryId: string;
179
+ appendText?: string;
180
+ }
181
+ /** One LLM-transcript message (the model-visible form). Appended from the
182
+ * run loop per step — never diffed from an array. */
183
+ interface HarnessMessageEntry extends BaseEntry {
184
+ type: "harness_message";
185
+ message: Message;
186
+ turnId: string;
187
+ }
188
+ /** Compaction overlay: nothing is deleted. At rebuild, the LLM context is
189
+ * the latest compaction's `summaryMessage` followed by the harness
190
+ * messages from `firstKeptSeq` onward. */
191
+ interface CompactionEntry extends BaseEntry {
192
+ type: "compaction";
193
+ summaryMessage: Message;
194
+ firstKeptSeq: number;
195
+ tokensBefore?: number;
196
+ tokensAfter?: number;
197
+ }
198
+ /** A finished subagent's result arriving for the parent. Pending = a
199
+ * subagent_result whose seq is not listed in any later callback_started. */
200
+ interface SubagentResultEntry extends BaseEntry {
201
+ type: "subagent_result";
202
+ result: PendingSubagentResult;
203
+ }
204
+ /** Marks which subagent_result entries a callback turn consumed (by seq).
205
+ * Consumption is an append, never a delete. */
206
+ interface CallbackStartedEntry extends BaseEntry {
207
+ type: "callback_started";
208
+ consumedSeqs: number[];
209
+ }
210
+ type ConversationEntry = UserMessageEntry | AssistantMessageEntry | AssistantAmendmentEntry | HarnessMessageEntry | CompactionEntry | SubagentResultEntry | CallbackStartedEntry;
211
+ /**
212
+ * An entry to append, before the engine assigns `seq` and `createdAt`. This
213
+ * is a DISTRIBUTIVE omit — `Omit<ConversationEntry, K>` over a union would
214
+ * collapse to only the keys common to every member (dropping `message`,
215
+ * `summaryMessage`, etc.), so we distribute over the union with a
216
+ * conditional type to omit those fields from each member individually.
217
+ */
218
+ type NewConversationEntry = ConversationEntry extends infer T ? T extends ConversationEntry ? Omit<T, "seq" | "createdAt"> : never : never;
219
+ /**
220
+ * Rebuild the LLM-visible message context from the entry log.
221
+ *
222
+ * If a compaction overlay exists, the context is its summary message
223
+ * followed by every harness message with seq >= firstKeptSeq (a later
224
+ * compaction's firstKeptSeq can point at an earlier summary that was
225
+ * itself appended as a harness message, so layered compactions just work).
226
+ * With no compaction, it's every harness message in order.
227
+ */
228
+ declare function buildLlmContext(entries: ConversationEntry[]): Message[];
229
+ interface DisplaySnapshot {
230
+ messages: Message[];
231
+ /** Total display messages available (for pagination UIs). */
232
+ totalMessages: number;
233
+ /** seq of the first message returned (a `beforeSeq` pagination cursor). */
234
+ headSeq: number | null;
235
+ }
236
+ /**
237
+ * Rebuild the display transcript (the user-visible chat) from the entry
238
+ * log, returning the trailing `tailN` messages. Amendments are folded into
239
+ * their target assistant message; hidden user messages are dropped.
240
+ */
241
+ declare function buildDisplaySnapshot(entries: ConversationEntry[], tailN: number): DisplaySnapshot;
242
+ /**
243
+ * Subagent results that have arrived but not yet been consumed by a
244
+ * callback turn — the append-only replacement for the mutable
245
+ * `pendingSubagentResults` array. A result is pending unless a later
246
+ * callback_started lists its seq in `consumedSeqs`.
247
+ */
248
+ declare function getPendingSubagentResults(entries: ConversationEntry[]): PendingSubagentResult[];
249
+
123
250
  interface ConversationState {
124
251
  runId: string;
125
252
  messages: Message[];
@@ -255,6 +382,19 @@ interface ConversationStore {
255
382
  clearCallbackLock(conversationId: string): Promise<Conversation | undefined>;
256
383
  /** List thread conversations anchored under `parentConversationId`. */
257
384
  listThreads(parentConversationId: string): Promise<ConversationSummary[]>;
385
+ /**
386
+ * Append entries to a conversation's append-only log (Phase 3 substrate).
387
+ * Assigns a per-conversation monotonic `seq` and a `createdAt` to each
388
+ * entry, persists them in order, and returns the stored entries with those
389
+ * fields filled in. Additive — no existing read path consumes these yet.
390
+ */
391
+ appendEntries(conversationId: string, agentId: string, tenantId: string | null, entries: NewConversationEntry[]): Promise<ConversationEntry[]>;
392
+ /** Read a conversation's entries ordered by `seq` ascending. */
393
+ readEntries(conversationId: string, opts?: {
394
+ types?: string[];
395
+ afterSeq?: number;
396
+ limit?: number;
397
+ }): Promise<ConversationEntry[]>;
258
398
  }
259
399
  type StateProviderName = "local" | "memory" | "sqlite" | "postgresql" | "redis" | "upstash" | "dynamodb";
260
400
  interface StateConfig {
@@ -276,6 +416,7 @@ declare class InMemoryStateStore implements StateStore {
276
416
  }
277
417
  declare class InMemoryConversationStore implements ConversationStore {
278
418
  private readonly conversations;
419
+ private readonly entries;
279
420
  private readonly ttlMs?;
280
421
  constructor(ttlSeconds?: number);
281
422
  private isExpired;
@@ -292,6 +433,12 @@ declare class InMemoryConversationStore implements ConversationStore {
292
433
  appendSubagentResult(conversationId: string, result: PendingSubagentResult): Promise<void>;
293
434
  clearCallbackLock(conversationId: string): Promise<Conversation | undefined>;
294
435
  listThreads(parentConversationId: string): Promise<ConversationSummary[]>;
436
+ appendEntries(conversationId: string, _agentId: string, _tenantId: string | null, entries: NewConversationEntry[]): Promise<ConversationEntry[]>;
437
+ readEntries(conversationId: string, opts?: {
438
+ types?: string[];
439
+ afterSeq?: number;
440
+ limit?: number;
441
+ }): Promise<ConversationEntry[]>;
295
442
  }
296
443
  type ConversationSummary = {
297
444
  conversationId: string;
@@ -945,6 +1092,19 @@ interface StorageEngine {
945
1092
  clearCallbackLock(conversationId: string): Promise<Conversation | undefined>;
946
1093
  /** List thread conversations anchored under `parentConversationId`. */
947
1094
  listThreads(parentConversationId: string): Promise<ConversationSummary[]>;
1095
+ /**
1096
+ * Append entries to a conversation's append-only log (Phase 3 substrate).
1097
+ * Assigns a per-conversation monotonic `seq` and `createdAt` to each entry,
1098
+ * persists them in order, and returns the stored entries. Additive — no
1099
+ * read path consumes these yet.
1100
+ */
1101
+ appendEntries(conversationId: string, agentId: string, tenantId: string | null, entries: NewConversationEntry[]): Promise<ConversationEntry[]>;
1102
+ /** Read a conversation's entries ordered by `seq` ascending. */
1103
+ readEntries(conversationId: string, opts?: {
1104
+ types?: string[];
1105
+ afterSeq?: number;
1106
+ limit?: number;
1107
+ }): Promise<ConversationEntry[]>;
948
1108
  };
949
1109
  memory: {
950
1110
  get(tenantId?: string | null): Promise<MainMemory>;
@@ -1590,6 +1750,7 @@ declare class TelemetryEmitter {
1590
1750
  declare class InMemoryEngine implements StorageEngine {
1591
1751
  readonly agentId: string;
1592
1752
  private convs;
1753
+ private entries;
1593
1754
  private mem;
1594
1755
  private todoData;
1595
1756
  private reminderData;
@@ -1610,6 +1771,12 @@ declare class InMemoryEngine implements StorageEngine {
1610
1771
  appendSubagentResult: (conversationId: string, result: PendingSubagentResult) => Promise<void>;
1611
1772
  clearCallbackLock: (conversationId: string) => Promise<Conversation | undefined>;
1612
1773
  listThreads: (parentConversationId: string) => Promise<ConversationSummary[]>;
1774
+ appendEntries: (conversationId: string, _agentId: string, _tenantId: string | null, entries: NewConversationEntry[]) => Promise<ConversationEntry[]>;
1775
+ readEntries: (conversationId: string, opts?: {
1776
+ types?: string[];
1777
+ afterSeq?: number;
1778
+ limit?: number;
1779
+ }) => Promise<ConversationEntry[]>;
1613
1780
  };
1614
1781
  memory: {
1615
1782
  get: (tenantId?: string | null) => Promise<MainMemory>;
@@ -1727,6 +1894,12 @@ declare abstract class SqlStorageEngine implements StorageEngine {
1727
1894
  appendSubagentResult: (conversationId: string, result: PendingSubagentResult) => Promise<void>;
1728
1895
  clearCallbackLock: (conversationId: string) => Promise<Conversation | undefined>;
1729
1896
  listThreads: (parentConversationId: string) => Promise<ConversationSummary[]>;
1897
+ appendEntries: (conversationId: string, agentId: string, tenantId: string | null, entries: NewConversationEntry[]) => Promise<ConversationEntry[]>;
1898
+ readEntries: (conversationId: string, opts?: {
1899
+ types?: string[];
1900
+ afterSeq?: number;
1901
+ limit?: number;
1902
+ }) => Promise<ConversationEntry[]>;
1730
1903
  };
1731
1904
  memory: {
1732
1905
  get: (tenantId?: string | null) => Promise<MainMemory>;
@@ -2230,4 +2403,45 @@ interface RunConversationTurnResult {
2230
2403
  }
2231
2404
  declare const runConversationTurn: (opts: RunConversationTurnOpts) => Promise<RunConversationTurnResult>;
2232
2405
 
2233
- export { type ActiveConversationRun, type ActiveSubagentRun, type AgentFrontmatter, AgentHarness, type AgentIdentity, type AgentLimitsConfig, type AgentModelConfig, AgentOrchestrator, type ApprovalEventItem, type ArchivedToolResult$1 as ArchivedToolResult, type BashConfig, BashEnvironmentManager, type BashExecutionLimits, type BuiltInToolToggles, CALLBACK_LOCK_STALE_MS, type CompactMessagesOptions, type CompactResult, type CompactionConfig, type ContinuationHooks, type Conversation, type ConversationCreateInit, type ConversationState, type ConversationStatusSnapshot, type ConversationStore, type ConversationSummary, type CreateSkillToolsOptions, type CronJobConfig, DEFAULT_AGENT_DESCRIPTION, DEFAULT_AGENT_NAME, DEFAULT_MAX_STEPS, DEFAULT_MODEL_NAME, DEFAULT_MODEL_PROVIDER, DEFAULT_TEMPERATURE, DEFAULT_TIMEOUT, type DefaultAgentDefinitionOptions, type EventSink, type ExecuteTurnResult, type HarnessOptions, type HarnessRunOutput, type HistorySource, InMemoryConversationStore, InMemoryEngine, InMemoryStateStore, type IsolateBinding, type IsolateConfig, LocalMcpBridge, LocalUploadStore, MAX_CONCURRENT_SUBAGENTS, MAX_CONTINUATION_COUNT, MAX_SUBAGENT_CALLBACK_COUNT, MAX_SUBAGENT_NESTING, type MainMemory, type McpConfig, type MemoryConfig, type MemoryStore, type MessagingChannelConfig, type ModelProviderFactory, type MountProvider, type NetworkConfig, OPENAI_CODEX_CLIENT_ID, type OpenAICodexAuthConfig, type OpenAICodexDeviceAuthRequest, type OpenAICodexSession, type OrchestratorHooks, type OrchestratorOptions, type OtlpConfig, type OtlpOption, PONCHO_UPLOAD_SCHEME, type ParsedAgent, type PendingSubagentApproval, type PendingSubagentResult, type PendingToolCall, type PonchoConfig, PonchoFsAdapter, PostgresEngine, type ProviderConfig, type Recurrence, type RecurrenceType, type Reminder, type ReminderCreateInput, type ReminderStatus, type ReminderStore, type RemoteMcpServerConfig, type RunConversationTurnOpts, type RunConversationTurnResult, type RunOutcome, type RunRequest, type RuntimeRenderContext, S3UploadStore, STALE_SUBAGENT_THRESHOLD_MS, STORAGE_SCHEMA_VERSION, type SecretsStore, type SkillContextEntry, type SkillMetadata, type SkillSource, SqliteEngine, type StateConfig, type StateProviderName, type StateStore, type StorageConfig, type StorageEngine, type StorageFactoryOptions, type StorageProvider, type StoredApproval, type SubagentManager, type SubagentResult, type SubagentSpawnResult, type SubagentSummary, type SubagentTranscript, type SubagentTranscriptMode, TOOL_RESULT_ARCHIVE_PARAM, type TelemetryConfig, TelemetryEmitter, type TenantTokenPayload, type ToolAccess, type ToolCall, ToolDispatcher, type ToolExecutionResult, type TurnDraftState, type TurnResultMetadata, type TurnSection, type UploadStore, type UploadsConfig, VFS_SCHEME, VercelBlobUploadStore, type VfsDirEntry, type VfsStat, type VirtualMount, abnormalEndResponse, applyTurnMetadata, buildAgentDirectoryName, buildApprovalCheckpoints, buildAssistantMetadata, buildSkillContextWindow, buildToolCompletedText, cloneSections, compactMessages, completeOpenAICodexDeviceAuth, computeNextOccurrence, createBashTool, createConversationStore, createConversationStoreFromEngine, createDefaultTools, createDeleteDirectoryTool, createDeleteTool, createEditTool, createMemoryStore, createMemoryStoreFromEngine, createMemoryTools, createModelProvider, createReminderStore, createReminderStoreFromEngine, createReminderTools, createSearchTools, createSecretsStore, createSkillTools, createStateStore, createStorageEngine, createSubagentTools, createTodoStoreFromEngine, createTurnDraftState, createUploadStore, createWriteTool, decodeFileInputData, defaultAgentDefinition, deleteOpenAICodexSession, deriveUploadKey, ensureAgentIdentity, estimateTokens, estimateTotalTokens, executeConversationTurn, findSafeSplitPoint, flushTurnDraft, generateAgentId, getAgentStoreDirectory, getModelContextWindow, getOpenAICodexAccessToken, getOpenAICodexAuthFilePath, getOpenAICodexRequiredScopes, getPonchoStoreRoot, isMessageArray, jsonSchemaToZod, lastAssistantText, loadCanonicalHistory, loadPonchoConfig, loadRunHistory, loadSkillContext, loadSkillInstructions, loadSkillMetadata, loadSkillMetadataFromDirs, loadVfsSkillMetadata, mergeSkills, normalizeApprovalCheckpoint, normalizeOtlp, normalizeScriptPolicyPath, normalizeToolAccess, parseAgentFile, parseAgentMarkdown, parseSkillFrontmatter, ponchoDocsTool, readOpenAICodexSession, readSkillResource, realResponseText, recordStandardTurnEvent, renderAgentPrompt, resolveAgentIdentity, resolveCompactionConfig, resolveEnv, resolveMemoryConfig, resolveRunRequest, resolveSkillDirs, resolveStateConfig, runConversationTurn, slugifyStorageComponent, startOpenAICodexDeviceAuth, verifyTenantToken, withToolResultArchiveParam, writeOpenAICodexSession };
2406
+ /** True when dual-write parity verification is opted in via env. */
2407
+ declare const entriesParityEnabled: () => boolean;
2408
+ type NewEntryNoId = NewConversationEntry extends infer T ? T extends NewConversationEntry ? Omit<T, "id"> : never : never;
2409
+ /**
2410
+ * Append entries to the conversation's append-only log, mirroring an existing
2411
+ * blob write. Best-effort and non-blocking by contract:
2412
+ * - stamps a fresh uuid `id` on each entry (required input column),
2413
+ * - never throws (logs and returns [] on failure),
2414
+ * - is safe to `void` (callers needn't await).
2415
+ *
2416
+ * Returns the stored entries (with seq/createdAt) for callers that want them
2417
+ * (e.g. to learn the assistant entry's id for a later amendment), or [] on
2418
+ * empty input / failure.
2419
+ */
2420
+ declare const appendEntriesSafe: (store: ConversationStore, conversation: Pick<Conversation, "conversationId" | "ownerId" | "tenantId">, entries: NewEntryNoId[], log: Logger) => Promise<ConversationEntry[]>;
2421
+ /**
2422
+ * The harness messages added during the just-finished turn — i.e. the suffix
2423
+ * of the new `_harnessMessages` array beyond what was there before the turn.
2424
+ *
2425
+ * BEST-EFFORT: the blob replaces `_harnessMessages` wholesale (it's not an
2426
+ * append log), so we recover "what's new" by length-diffing prev vs next.
2427
+ * When a compaction collapsed history this turn, `next` can be SHORTER than
2428
+ * `prev`; in that case there's no clean suffix and we return the whole `next`
2429
+ * so the entry log still ends up with the model-visible context (parity will
2430
+ * flag the over-count for review). The compaction entry (appended separately)
2431
+ * is what makes rebuild correct in that case.
2432
+ */
2433
+ declare const newHarnessMessagesThisTurn: (prev: Message[] | undefined, next: Message[] | undefined) => {
2434
+ messages: Message[];
2435
+ approximate: boolean;
2436
+ };
2437
+ /**
2438
+ * Rebuild LLM context + display snapshot from the entry log and diff against
2439
+ * the blob. Logs under `[entries-parity]` with the conversationId. Never
2440
+ * throws. No-op unless PONCHO_VERIFY_ENTRIES === "1".
2441
+ */
2442
+ declare const verifyEntriesParity: (store: ConversationStore, conversationId: string, blob: {
2443
+ harnessMessages?: Message[];
2444
+ displayMessages?: Message[];
2445
+ }, log: Logger) => Promise<void>;
2446
+
2447
+ export { type ActiveConversationRun, type ActiveSubagentRun, type AgentFrontmatter, AgentHarness, type AgentIdentity, type AgentLimitsConfig, type AgentModelConfig, AgentOrchestrator, type ApprovalEventItem, type ArchivedToolResult$1 as ArchivedToolResult, type AssistantAmendmentEntry, type AssistantMessageEntry, type BashConfig, BashEnvironmentManager, type BashExecutionLimits, type BuiltInToolToggles, CALLBACK_LOCK_STALE_MS, type CallbackStartedEntry, type CompactMessagesOptions, type CompactResult, type CompactionConfig, type CompactionEntry, type ContinuationHooks, type Conversation, type ConversationCreateInit, type ConversationEntry, type ConversationState, type ConversationStatusSnapshot, type ConversationStore, type ConversationSummary, type CreateSkillToolsOptions, type CronJobConfig, DEFAULT_AGENT_DESCRIPTION, DEFAULT_AGENT_NAME, DEFAULT_MAX_STEPS, DEFAULT_MODEL_NAME, DEFAULT_MODEL_PROVIDER, DEFAULT_TEMPERATURE, DEFAULT_TIMEOUT, type DefaultAgentDefinitionOptions, type DisplaySnapshot, type EventSink, type ExecuteTurnResult, type HarnessMessageEntry, type HarnessOptions, type HarnessRunOutput, type HistorySource, InMemoryConversationStore, InMemoryEngine, InMemoryStateStore, type IsolateBinding, type IsolateConfig, LocalMcpBridge, LocalUploadStore, MAX_CONCURRENT_SUBAGENTS, MAX_CONTINUATION_COUNT, MAX_SUBAGENT_CALLBACK_COUNT, MAX_SUBAGENT_NESTING, type MainMemory, type McpConfig, type MemoryConfig, type MemoryStore, type MessagingChannelConfig, type ModelProviderFactory, type MountProvider, type NetworkConfig, type NewConversationEntry, OPENAI_CODEX_CLIENT_ID, type OpenAICodexAuthConfig, type OpenAICodexDeviceAuthRequest, type OpenAICodexSession, type OrchestratorHooks, type OrchestratorOptions, type OtlpConfig, type OtlpOption, PONCHO_UPLOAD_SCHEME, type ParsedAgent, type PendingSubagentApproval, type PendingSubagentResult, type PendingToolCall, type PonchoConfig, PonchoFsAdapter, PostgresEngine, type ProviderConfig, type Recurrence, type RecurrenceType, type Reminder, type ReminderCreateInput, type ReminderStatus, type ReminderStore, type RemoteMcpServerConfig, type RunConversationTurnOpts, type RunConversationTurnResult, type RunOutcome, type RunRequest, type RuntimeRenderContext, S3UploadStore, STALE_SUBAGENT_THRESHOLD_MS, STORAGE_SCHEMA_VERSION, type SecretsStore, type SkillContextEntry, type SkillMetadata, type SkillSource, SqliteEngine, type StateConfig, type StateProviderName, type StateStore, type StorageConfig, type StorageEngine, type StorageFactoryOptions, type StorageProvider, type StoredApproval, type SubagentManager, type SubagentResult, type SubagentResultEntry, type SubagentSpawnResult, type SubagentSummary, type SubagentTranscript, type SubagentTranscriptMode, TOOL_RESULT_ARCHIVE_PARAM, type TelemetryConfig, TelemetryEmitter, type TenantTokenPayload, type ToolAccess, type ToolCall, ToolDispatcher, type ToolExecutionResult, type TurnDraftState, type TurnResultMetadata, type TurnSection, type UploadStore, type UploadsConfig, type UserMessageEntry, VFS_SCHEME, VercelBlobUploadStore, type VfsDirEntry, type VfsStat, type VirtualMount, abnormalEndResponse, appendEntriesSafe, applyTurnMetadata, buildAgentDirectoryName, buildApprovalCheckpoints, buildAssistantMetadata, buildDisplaySnapshot, buildLlmContext, buildSkillContextWindow, buildToolCompletedText, cloneSections, compactMessages, completeOpenAICodexDeviceAuth, computeNextOccurrence, createBashTool, createConversationStore, createConversationStoreFromEngine, createDefaultTools, createDeleteDirectoryTool, createDeleteTool, createEditTool, createMemoryStore, createMemoryStoreFromEngine, createMemoryTools, createModelProvider, createReminderStore, createReminderStoreFromEngine, createReminderTools, createSearchTools, createSecretsStore, createSkillTools, createStateStore, createStorageEngine, createSubagentTools, createTodoStoreFromEngine, createTurnDraftState, createUploadStore, createWriteTool, decodeFileInputData, defaultAgentDefinition, deleteOpenAICodexSession, deriveUploadKey, ensureAgentIdentity, entriesParityEnabled, estimateTokens, estimateTotalTokens, executeConversationTurn, findSafeSplitPoint, flushTurnDraft, generateAgentId, getAgentStoreDirectory, getModelContextWindow, getOpenAICodexAccessToken, getOpenAICodexAuthFilePath, getOpenAICodexRequiredScopes, getPendingSubagentResults, getPonchoStoreRoot, isMessageArray, jsonSchemaToZod, lastAssistantText, loadCanonicalHistory, loadPonchoConfig, loadRunHistory, loadSkillContext, loadSkillInstructions, loadSkillMetadata, loadSkillMetadataFromDirs, loadVfsSkillMetadata, mergeSkills, newHarnessMessagesThisTurn, normalizeApprovalCheckpoint, normalizeOtlp, normalizeScriptPolicyPath, normalizeToolAccess, parseAgentFile, parseAgentMarkdown, parseSkillFrontmatter, ponchoDocsTool, readOpenAICodexSession, readSkillResource, realResponseText, recordStandardTurnEvent, renderAgentPrompt, resolveAgentIdentity, resolveCompactionConfig, resolveEnv, resolveMemoryConfig, resolveRunRequest, resolveSkillDirs, resolveStateConfig, runConversationTurn, slugifyStorageComponent, startOpenAICodexDeviceAuth, verifyEntriesParity, verifyTenantToken, withToolResultArchiveParam, writeOpenAICodexSession };