@poncho-ai/cli 0.37.0 → 0.38.1

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/cli@0.37.0 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
2
+ > @poncho-ai/cli@0.38.1 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
3
3
  > tsup src/index.ts src/cli.ts --format esm --dts
4
4
 
5
5
  CLI Building entry: src/cli.ts, src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
10
  ESM dist/cli.js 94.00 B
11
- ESM dist/index.js 917.00 B
12
- ESM dist/run-interactive-ink-75GKYSEC.js 56.86 KB
13
- ESM dist/chunk-GUGBKAIM.js 572.60 KB
14
- ESM ⚡️ Build success in 68ms
11
+ ESM dist/index.js 3.10 KB
12
+ ESM dist/run-interactive-ink-UKPUGCDW.js 23.38 KB
13
+ ESM dist/chunk-W7SQVUB4.js 601.92 KB
14
+ ESM ⚡️ Build success in 79ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4119ms
16
+ DTS ⚡️ Build success in 4135ms
17
17
  DTS dist/cli.d.ts 20.00 B
18
- DTS dist/index.d.ts 7.07 KB
18
+ DTS dist/index.d.ts 13.24 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,269 @@
1
1
  # @poncho-ai/cli
2
2
 
3
+ ## 0.38.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d6248c8`](https://github.com/cesr/poncho-ai/commit/d6248c8b6d22e0fd0becde9e31dff7c12c724d84) Thanks [@cesr](https://github.com/cesr)! - fix(cli, harness): unify turn-parameter assembly so `conversation_recall` works everywhere
8
+
9
+ The recall tool relies on three context parameters (`__conversationRecallCorpus`,
10
+ `__conversationListFn`, `__conversationFetchFn`) that were only injected for
11
+ user-initiated HTTP turns. Cron, reminder, messaging-adapter, chat-continuation,
12
+ subagent-callback, and tool-approval-resume runs all built their own
13
+ `runInput.parameters` object and silently omitted these — causing
14
+ `conversation_recall` to throw "not available in this environment" or return
15
+ empty results depending on the call mode.
16
+
17
+ Introduces a single `buildTurnParameters(conversation, opts)` helper in the CLI
18
+ that owns context-parameter assembly (recall functions, `__activeConversationId`,
19
+ `__ownerId`, messaging metadata, tool-result archive). HTTP, messaging, and
20
+ cron/reminder paths now go through it. The harness orchestrator's three
21
+ internal turn sites (chat continuation, subagent-callback resume, tool-approval
22
+ resume) now call the existing `hooks.buildRecallParams` so they pick up the
23
+ recall functions too.
24
+
25
+ - [#101](https://github.com/cesr/poncho-ai/pull/101) [`7cc2fb5`](https://github.com/cesr/poncho-ai/commit/7cc2fb592bf11b79916df5831598a991f1ac9c0c) Thanks [@cesr](https://github.com/cesr)! - fix(web-ui): thread panel displays anchor message + replies, not full snapshot
26
+
27
+ Shows the anchor message you forked on, plus any replies — and that's it.
28
+ The earlier snapshot is still part of the thread's context server-side
29
+ (the agent sees the full prior conversation), but the panel only
30
+ displays what's relevant: the message you replied to, and what came
31
+ after.
32
+
33
+ Also fixes the underlying scroll bug: `.thread-panel-messages` had
34
+ `flex: 1; overflow-y: auto` but no `min-height: 0`. In flex children
35
+ the default `min-height: auto` lets the item grow to fit content, so
36
+ the messages area never shrank below its content size and the scrollbar
37
+ never engaged.
38
+
39
+ - Updated dependencies [[`244a3a3`](https://github.com/cesr/poncho-ai/commit/244a3a310c6c52f9e8535b28fb25d77829583d3f), [`d6248c8`](https://github.com/cesr/poncho-ai/commit/d6248c8b6d22e0fd0becde9e31dff7c12c724d84)]:
40
+ - @poncho-ai/harness@0.39.1
41
+
42
+ ## 0.38.0
43
+
44
+ ### Minor Changes
45
+
46
+ - [#95](https://github.com/cesr/poncho-ai/pull/95) [`21ee02a`](https://github.com/cesr/poncho-ai/commit/21ee02a577cd0a85823cc3922dd0dc54c630f417) Thanks [@cesr](https://github.com/cesr)! - perf: eliminate per-conversation archive egress on the hot read path
47
+
48
+ Three related fixes that together dramatically reduce database and
49
+ server→browser egress for any long-lived conversation:
50
+ - `conversationStore.get()` no longer loads the `tool_result_archive`
51
+ column. Callers that actually need to reseed the harness archive —
52
+ run entry points, cron runs, reminder firings — must now use the new
53
+ `conversationStore.getWithArchive()` method instead.
54
+ - The `GET /api/conversations/:id` response strips `_toolResultArchive`
55
+ alongside the already-stripped `_continuationMessages` and
56
+ `_harnessMessages`, so the browser never receives the archive payload.
57
+ - Adds a cheap `GET /api/conversations/:id/status` endpoint backed by a
58
+ new `getStatusSnapshot()` method that reads only summary columns (no
59
+ `data` blob). The web UI poll loops now hit this endpoint every 2s
60
+ and only refetch the full conversation when `updatedAt`,
61
+ `messageCount`, or the pending-approval counts actually change.
62
+
63
+ The SQL upsert was also updated to preserve `tool_result_archive` via
64
+ `COALESCE(excluded, conversations.tool_result_archive)` so that updates
65
+ on conversations loaded via the light `get()` do not clobber the
66
+ existing archive.
67
+
68
+ - [#100](https://github.com/cesr/poncho-ai/pull/100) [`ef4fe5d`](https://github.com/cesr/poncho-ai/commit/ef4fe5d1fd4bb31c201fd240f4524b64f01e3e6d) Thanks [@cesr](https://github.com/cesr)! - feat: Slack-style message threads
69
+
70
+ Users can now fork any persisted message into one or more threads. Each
71
+ thread is a new conversation whose initial history is a snapshot of the
72
+ parent up to and including the anchor message; replies in the thread
73
+ evolve independently of the parent. Multiple threads per parent message
74
+ are supported.
75
+
76
+ ## Web UI
77
+ - Hover any message in the main pane to reveal a "Reply in thread" pill
78
+ positioned just below the bubble (offset varies by role). The pill is
79
+ invisible by default and only appears on hover; a delayed-hide bridges
80
+ the empty space between message and pill so the user can move the
81
+ mouse onto it without it flickering off.
82
+ - Once a thread exists on a message, the pill is replaced by an
83
+ always-visible badge (`"N replies · 5m ago"`, count bold + meta muted).
84
+ Multiple threads stack vertically under the message, each with its own
85
+ badge. Hovering a badge reveals an outside-positioned `×` delete with
86
+ the same two-step "× → sure?" confirmation as the sidebar
87
+ conversation-delete.
88
+ - Clicking a badge opens the thread in a right-side panel that mirrors
89
+ the existing browser-panel pattern: a flex sibling of `.main-chat`
90
+ with a 1px drag-resize handle. The panel has its own composer
91
+ (independent file uploads, paste-to-attach, attachment preview)
92
+ rendered alongside the main composer so users can keep typing in the
93
+ parent conversation. Vertical padding matches the main composer so
94
+ both chatboxes line up at the same baseline.
95
+ - The pinned parent message and replies inside the panel render through
96
+ the same DOM construction logic as the main pane (assistant avatar +
97
+ markdown, user bubble + file thumbnails). Reply submissions stream
98
+ token-by-token via SSE (parsed model:chunk events feed an optimistic
99
+ assistant placeholder; a thinking-indicator shows until the first
100
+ chunk lands).
101
+ - The open thread is reflected in the URL hash (`#thread=<id>`) so a
102
+ page reload restores the panel. Switching conversations or closing
103
+ the panel clears the hash and any sticky drag-resize widths.
104
+
105
+ ## DB
106
+ - New `parent_message_id TEXT` column on `conversations` (migration 6)
107
+ plus a partial index on `(parent_conversation_id, parent_message_id)
108
+ WHERE parent_message_id IS NOT NULL`.
109
+ - The existing `parent_conversation_id` plumbing is reused; subagents
110
+ and threads coexist on that column, discriminated by whether
111
+ `parent_message_id` is set (subagents leave it `NULL`).
112
+ - `threadMeta` (snapshot length + cached parent-message summary)
113
+ round-trips inside the conversation `data` blob.
114
+
115
+ ## API
116
+ - `GET /api/conversations/:id/threads` → `{ threads: ApiThreadSummary[] }`
117
+ - `POST /api/conversations/:id/threads { parentMessageId, title? }` →
118
+ 201 `{ thread, conversationId }` |
119
+ 404 `PARENT_MESSAGE_NOT_FOUND` |
120
+ 409 `MESSAGE_ID_REQUIRED` (anchor lacks a stable id) |
121
+ 409 `ANCHOR_IN_FLIGHT` (anchor is the streaming tail of a live run)
122
+ - The two `SUBAGENT_READ_ONLY` gates on `/messages` and `/continue` are
123
+ now keyed on `subagentMeta` rather than `parentConversationId` so
124
+ threads remain writable.
125
+ - New `ApiThreadSummary`, `ApiThreadListResponse`,
126
+ `ApiCreateThreadRequest`, `ApiCreateThreadResponse` types in
127
+ `@poncho-ai/sdk`. New `AgentClient.listThreads` /
128
+ `AgentClient.createThread` wrappers in `@poncho-ai/client`.
129
+
130
+ ## Storage interface
131
+ - `ConversationStore.listThreads(parentConversationId)` and the
132
+ matching `StorageEngine.conversations.listThreads(...)`. External
133
+ implementers of these interfaces will need to add the method.
134
+ - `Conversation` / `ConversationCreateInit` / `ConversationSummary`
135
+ gained optional `parentMessageId` and `threadMeta` fields.
136
+
137
+ ## Fork semantics
138
+ - Stable `metadata.id` on every persisted message: `randomUUID()` is
139
+ hoisted once per turn and reused for both the user message and the
140
+ in-flight assistant message across all persist sites (cli messaging
141
+ run, cli `/messages` handler, cron path). `buildAssistantMetadata`
142
+ takes an optional `{ id, timestamp }` opt-arg.
143
+ - No DB backfill of legacy id-less messages; the SPA hides the
144
+ "Reply in thread" affordance on rows whose `metadata.id` is missing.
145
+ - The visible-sequence used for the anchor lookup is reconstructed as
146
+ `[...compactedHistory, ...messages.filter(notCompactionSummary)]`,
147
+ so pre-compaction anchors are supported. For pre-compaction anchors,
148
+ `_harnessMessages` is reset to `undefined` so the harness rebuilds
149
+ canonical history from `messages` on the thread's first run.
150
+ - Forking on the actively-streaming tail message of a live run returns
151
+ 409 `ANCHOR_IN_FLIGHT`; any prior, already-persisted message is
152
+ fork-able even while the parent is mid-run.
153
+ - Tool-result archive entries are filtered to only those referenced by
154
+ tool calls in the trimmed `_harnessMessages` (no whole-archive clones).
155
+ - All run-specific state is reset on the new thread:
156
+ `runtimeRunId`, `pendingApprovals`, `runStatus`,
157
+ `pendingSubagentResults`, `subagentCallbackCount`,
158
+ `runningCallbackSince`, `_continuationMessages`. `channelMeta` and
159
+ `subagentMeta` are explicitly NOT inherited so threads aren't bound
160
+ to the parent's Slack/Telegram thread and aren't subagent runs.
161
+ - Thread conversations stay out of the sidebar list (already-existing
162
+ `!c.parentConversationId` filter) and are cascade-deleted with their
163
+ parent.
164
+
165
+ ### Patch Changes
166
+
167
+ - [#100](https://github.com/cesr/poncho-ai/pull/100) [`ef4fe5d`](https://github.com/cesr/poncho-ai/commit/ef4fe5d1fd4bb31c201fd240f4524b64f01e3e6d) Thanks [@cesr](https://github.com/cesr)! - feat(logging): readable, scoped, level-aware dev server logs
168
+
169
+ `poncho dev` output is now formatted consistently across the CLI and
170
+ harness:
171
+
172
+ ```
173
+ 20:23:45 ✓ poncho dev server ready at http://localhost:3000
174
+ 20:23:45 • slack enabled at /api/messaging/slack
175
+ 20:23:45 • cron scheduled 2 jobs: hourly_check, nightly_summary
176
+ 20:24:15 → cron:hourly_check started
177
+ 20:24:17 ✓ cron:hourly_check completed in 1.2s (3 chats)
178
+ 20:25:00 ⚠ telegram approval not found: req-7f42a
179
+ 20:25:01 ✗ poncho internal error: ECONNREFUSED
180
+ ```
181
+
182
+ Format: `HH:mm:ss <symbol> <scope> <message>`. Scopes (`poncho`, `cron`,
183
+ `reminder`, `messaging`, `slack`, `telegram`, `resend`, `subagent`,
184
+ `approval`, `browser`, `csrf`, `upload`, `serverless`, `self-fetch`,
185
+ `mcp`, `telemetry`, `cost`, `model`, `harness`, `event`, `tools`)
186
+ replace the previous mix of `[poncho]`, `[poncho][cost]`, `[cron]`,
187
+ `[messaging-runner]`, `[event] ...`, etc.
188
+ - New `createLogger(scope)` exported from `@poncho-ai/sdk` with
189
+ `.debug/.info/.warn/.error/.success/.ready/.item/.child(sub)` and
190
+ helpers `formatError`, `url`, `muted`, `num`.
191
+ - Honors `NO_COLOR` / `FORCE_COLOR` and `LOG_LEVEL=debug|info|warn|error|silent`.
192
+ Verbose telemetry/cost/event lines now log at `debug` and are silent
193
+ by default.
194
+ - `poncho dev` gains `-v`/`--verbose` (debug), `-q`/`--quiet` (warn+),
195
+ and `--log-level <level>` flags.
196
+ - Each scope tag is colored with a stable pastel hue (truecolor), with
197
+ 256-color and 16-color fallbacks. Children (`cron:hourly_check`)
198
+ inherit their parent's color.
199
+ - TTY-aware: ANSI color is stripped when stdout is piped.
200
+ - Conversation-egress logging (`[poncho][egress] read: …`) is now opt-in
201
+ via `PONCHO_LOG_EGRESS=1` (matching the documented behavior; it had
202
+ been logging unconditionally).
203
+ - No behavior changes to which events are emitted — only formatting.
204
+
205
+ - [`fcf6a02`](https://github.com/cesr/poncho-ai/commit/fcf6a027880ac94ada2e3fd732b11eed9f5f15b8) Thanks [@cesr](https://github.com/cesr)! - chore: drop browser-frame noise from the dev log
206
+
207
+ Two sources of per-frame log noise during interactive browser use
208
+ are now silenced:
209
+ - `TelemetryEmitter.emit` skips `browser:frame` events alongside the
210
+ already-skipped `model:chunk`. OTLP forwarding and custom handlers
211
+ still receive every event unchanged.
212
+ - The CLI's browser SSE endpoint no longer prints the
213
+ `[poncho][browser-sse] Frame N: WxH, data bytes: ...` counter
214
+ (which fired for the first 3 frames and every 50th). Related
215
+ `frameCount` / `droppedFrames` state dropped with it.
216
+
217
+ - [#97](https://github.com/cesr/poncho-ai/pull/97) [`1eb1b1e`](https://github.com/cesr/poncho-ai/commit/1eb1b1e71641f79aa089a967811dcfe2de59be8d) Thanks [@cesr](https://github.com/cesr)! - refactor: extract subagent lifecycle into AgentOrchestrator (phase 5)
218
+
219
+ Move subagent orchestration (~1100 lines) from the CLI into the
220
+ AgentOrchestrator class in the harness package. The orchestrator now
221
+ owns all subagent state (activeSubagentRuns, pendingSubagentApprovals,
222
+ pendingCallbackNeeded), lifecycle methods (runSubagent,
223
+ processSubagentCallback, triggerParentCallback), SubagentManager
224
+ creation, approval handling, and stale recovery.
225
+
226
+ New hooks on OrchestratorHooks allow transport-specific concerns
227
+ (child harness creation, serverless dispatch, SSE stream lifecycle,
228
+ messaging notifications) to stay in the CLI while the orchestrator
229
+ handles all orchestration logic.
230
+
231
+ Also fixes subagent approval persistence (decisions now explicitly
232
+ written to the conversation store) and adds live SSE streaming for
233
+ parent callback runs in the web UI.
234
+
235
+ - [`33eaf9f`](https://github.com/cesr/poncho-ai/commit/33eaf9fcc57bab916ae8a25c942912eb5d6396cc) Thanks [@cesr](https://github.com/cesr)! - fix: stop buffering `browser:frame` events for SSE replay
236
+
237
+ Every `browser:frame` carries a base64 screenshot (~100 KB) and they
238
+ stream at 10+ fps. `broadcastEvent` was pushing them into the
239
+ per-conversation replay buffer (`ConversationEventStream.buffer`)
240
+ alongside real conversation events. In a long interactive browser
241
+ session this grew to multiple GB (observed: ~51k frames ≈ 4.4 GB of
242
+ retained base64 strings) and eventually crashed the dev server with
243
+ `FATAL ERROR: Reached heap limit - JavaScript heap out of memory`
244
+ inside V8's `JsonStringify`.
245
+
246
+ Frames are now excluded from the replay buffer — they still reach
247
+ live SSE subscribers, they just don't accumulate for late joiners,
248
+ matching the existing treatment of `browser:status`.
249
+
250
+ - [`a843130`](https://github.com/cesr/poncho-ai/commit/a8431303992381f338d6a90feeba03273734fd81) Thanks [@cesr](https://github.com/cesr)! - fix(web-ui): show assistant content alongside run errors
251
+
252
+ When a run ended with `run:error` (most visibly `MAX_STEPS_EXCEEDED`),
253
+ the web UI renderer replaced the entire assistant turn with just the
254
+ error banner. All the text and tool activity the agent had already
255
+ produced — which the server correctly persists — was hidden because
256
+ the render branch was `if (_error) { only error } else { content }`.
257
+
258
+ The renderer now renders the content first (sections, streaming tools
259
+ and text, pending approvals) and appends the error banner at the end.
260
+ The "waiting" spinner is also suppressed when an error is present.
261
+
262
+ - Updated dependencies [[`ef4fe5d`](https://github.com/cesr/poncho-ai/commit/ef4fe5d1fd4bb31c201fd240f4524b64f01e3e6d), [`fcf6a02`](https://github.com/cesr/poncho-ai/commit/fcf6a027880ac94ada2e3fd732b11eed9f5f15b8), [`1eb1b1e`](https://github.com/cesr/poncho-ai/commit/1eb1b1e71641f79aa089a967811dcfe2de59be8d), [`21ee02a`](https://github.com/cesr/poncho-ai/commit/21ee02a577cd0a85823cc3922dd0dc54c630f417), [`ef4fe5d`](https://github.com/cesr/poncho-ai/commit/ef4fe5d1fd4bb31c201fd240f4524b64f01e3e6d)]:
263
+ - @poncho-ai/sdk@1.9.0
264
+ - @poncho-ai/harness@0.39.0
265
+ - @poncho-ai/messaging@0.8.4
266
+
3
267
  ## 0.37.0
4
268
 
5
269
  ### Minor Changes