@poncho-ai/harness 0.55.0 → 0.58.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.
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +54 -0
- package/dist/index.d.ts +210 -2
- package/dist/index.js +632 -43
- package/package.json +1 -1
- package/src/index.ts +18 -0
- package/src/orchestrator/entries-dual-write.ts +265 -0
- package/src/orchestrator/index.ts +7 -0
- package/src/orchestrator/orchestrator.ts +179 -13
- package/src/orchestrator/run-conversation-turn.ts +108 -0
- package/src/state.ts +66 -1
- package/src/storage/engine.ts +18 -0
- package/src/storage/entries.ts +70 -2
- package/src/storage/memory-engine.ts +57 -2
- package/src/storage/schema.ts +30 -0
- package/src/storage/sql-dialect.ts +127 -2
- package/src/storage/store-adapters.ts +8 -0
- package/test/entries-dual-write.test.ts +172 -0
- package/test/entries-read-cutover.test.ts +96 -0
- package/test/entries-store.test.ts +165 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.
|
|
2
|
+
> @poncho-ai/harness@0.58.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
|
[34mCLI[39m tsup v8.5.1
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m567.32 KB[39m
|
|
11
12
|
[32mESM[39m [1mdist/isolate-F2PPSUL6.js [22m[32m53.82 KB[39m
|
|
12
|
-
[32mESM[39m
|
|
13
|
-
[32mESM[39m ⚡️ Build success in 258ms
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 177ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 7320ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m104.68 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.58.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#155](https://github.com/cesr/poncho-ai/pull/155) [`9939955`](https://github.com/cesr/poncho-ai/commit/9939955585f0ea204e070192827f0b213e84d283) Thanks [@cesr](https://github.com/cesr)! - Phase 3c read cutover: conversation reads rebuild from the append-only
|
|
8
|
+
`conversation_entries` log. Both engines' `get`/`getWithArchive` paths now
|
|
9
|
+
call `rebuildConversationFromEntries`, which overrides `_harnessMessages`
|
|
10
|
+
(via `buildLlmContext`), `messages` (via `buildDisplaySnapshot`, full
|
|
11
|
+
transcript), and `pendingSubagentResults` (via `getPendingSubagentResults`)
|
|
12
|
+
when the entry log is non-empty. Conversations that predate dual-write have
|
|
13
|
+
no entries and fall back to the mutable blob untouched — no migration
|
|
14
|
+
script needed. The rebuild is wrapped in try/catch and never throws on the
|
|
15
|
+
read path. A kill-switch (`PONCHO_READ_ENTRIES=0`) instantly reverts to
|
|
16
|
+
blob reads without a deploy. `_continuationMessages` and `pendingApprovals`
|
|
17
|
+
remain blob fields (not yet modeled as entries).
|
|
18
|
+
|
|
19
|
+
## 0.57.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#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).
|
|
24
|
+
|
|
25
|
+
At each conversation write site the orchestrator now ALSO appends the matching
|
|
26
|
+
append-only `ConversationEntry`s (`user_message`, `assistant_message`,
|
|
27
|
+
`assistant_amendment`, `harness_message`, `compaction`, `subagent_result`,
|
|
28
|
+
`callback_started`) alongside the existing mutable-blob write. This is purely
|
|
29
|
+
additive instrumentation: read paths still use the blob, so the dual-write is
|
|
30
|
+
fire-and-forget and can never corrupt behavior.
|
|
31
|
+
|
|
32
|
+
An opt-in parity checker (gated on `PONCHO_VERIFY_ENTRIES=1`) rebuilds the LLM
|
|
33
|
+
context and display snapshot from the entry log after each turn finalizes and
|
|
34
|
+
logs any divergence from the blob under a `[entries-parity]` prefix. It never
|
|
35
|
+
throws.
|
|
36
|
+
|
|
37
|
+
Re-exports the entry types and rebuild functions (`buildLlmContext`,
|
|
38
|
+
`buildDisplaySnapshot`, `getPendingSubagentResults`) from the package root so
|
|
39
|
+
downstream consumers can build on the substrate.
|
|
40
|
+
|
|
41
|
+
## 0.56.0
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- [#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).
|
|
46
|
+
|
|
47
|
+
Introduces `appendEntries` / `readEntries` on the `ConversationStore` and
|
|
48
|
+
`StorageEngine.conversations` interfaces, implemented for SQLite, PostgreSQL
|
|
49
|
+
(via `SqlStorageEngine`), and the in-memory stores. A new `conversation_entries`
|
|
50
|
+
table (migration v8) stores each entry with an app-assigned per-conversation
|
|
51
|
+
monotonic `seq`, a unique `id`, a JSON `payload`, and a `UNIQUE
|
|
52
|
+
(conversation_id, seq)` constraint.
|
|
53
|
+
|
|
54
|
+
Purely additive: no existing table, behavior, or read path changes — this is
|
|
55
|
+
the foundation for a later dual-write phase.
|
|
56
|
+
|
|
3
57
|
## 0.55.0
|
|
4
58
|
|
|
5
59
|
### 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';
|
|
@@ -126,6 +126,127 @@ interface CompactResult {
|
|
|
126
126
|
*/
|
|
127
127
|
declare const compactMessages: (model: LanguageModel, messages: Message[], config: CompactionConfig, options?: CompactMessagesOptions) => Promise<CompactResult>;
|
|
128
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
|
+
|
|
129
250
|
interface ConversationState {
|
|
130
251
|
runId: string;
|
|
131
252
|
messages: Message[];
|
|
@@ -261,6 +382,19 @@ interface ConversationStore {
|
|
|
261
382
|
clearCallbackLock(conversationId: string): Promise<Conversation | undefined>;
|
|
262
383
|
/** List thread conversations anchored under `parentConversationId`. */
|
|
263
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[]>;
|
|
264
398
|
}
|
|
265
399
|
type StateProviderName = "local" | "memory" | "sqlite" | "postgresql" | "redis" | "upstash" | "dynamodb";
|
|
266
400
|
interface StateConfig {
|
|
@@ -282,6 +416,7 @@ declare class InMemoryStateStore implements StateStore {
|
|
|
282
416
|
}
|
|
283
417
|
declare class InMemoryConversationStore implements ConversationStore {
|
|
284
418
|
private readonly conversations;
|
|
419
|
+
private readonly entries;
|
|
285
420
|
private readonly ttlMs?;
|
|
286
421
|
constructor(ttlSeconds?: number);
|
|
287
422
|
private isExpired;
|
|
@@ -298,6 +433,12 @@ declare class InMemoryConversationStore implements ConversationStore {
|
|
|
298
433
|
appendSubagentResult(conversationId: string, result: PendingSubagentResult): Promise<void>;
|
|
299
434
|
clearCallbackLock(conversationId: string): Promise<Conversation | undefined>;
|
|
300
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[]>;
|
|
301
442
|
}
|
|
302
443
|
type ConversationSummary = {
|
|
303
444
|
conversationId: string;
|
|
@@ -951,6 +1092,19 @@ interface StorageEngine {
|
|
|
951
1092
|
clearCallbackLock(conversationId: string): Promise<Conversation | undefined>;
|
|
952
1093
|
/** List thread conversations anchored under `parentConversationId`. */
|
|
953
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[]>;
|
|
954
1108
|
};
|
|
955
1109
|
memory: {
|
|
956
1110
|
get(tenantId?: string | null): Promise<MainMemory>;
|
|
@@ -1596,6 +1750,7 @@ declare class TelemetryEmitter {
|
|
|
1596
1750
|
declare class InMemoryEngine implements StorageEngine {
|
|
1597
1751
|
readonly agentId: string;
|
|
1598
1752
|
private convs;
|
|
1753
|
+
private entries;
|
|
1599
1754
|
private mem;
|
|
1600
1755
|
private todoData;
|
|
1601
1756
|
private reminderData;
|
|
@@ -1616,6 +1771,12 @@ declare class InMemoryEngine implements StorageEngine {
|
|
|
1616
1771
|
appendSubagentResult: (conversationId: string, result: PendingSubagentResult) => Promise<void>;
|
|
1617
1772
|
clearCallbackLock: (conversationId: string) => Promise<Conversation | undefined>;
|
|
1618
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[]>;
|
|
1619
1780
|
};
|
|
1620
1781
|
memory: {
|
|
1621
1782
|
get: (tenantId?: string | null) => Promise<MainMemory>;
|
|
@@ -1733,6 +1894,12 @@ declare abstract class SqlStorageEngine implements StorageEngine {
|
|
|
1733
1894
|
appendSubagentResult: (conversationId: string, result: PendingSubagentResult) => Promise<void>;
|
|
1734
1895
|
clearCallbackLock: (conversationId: string) => Promise<Conversation | undefined>;
|
|
1735
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[]>;
|
|
1736
1903
|
};
|
|
1737
1904
|
memory: {
|
|
1738
1905
|
get: (tenantId?: string | null) => Promise<MainMemory>;
|
|
@@ -2236,4 +2403,45 @@ interface RunConversationTurnResult {
|
|
|
2236
2403
|
}
|
|
2237
2404
|
declare const runConversationTurn: (opts: RunConversationTurnOpts) => Promise<RunConversationTurnResult>;
|
|
2238
2405
|
|
|
2239
|
-
|
|
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 };
|