@poncho-ai/cli 0.33.2 → 0.33.4

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.33.2 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
2
+ > @poncho-ai/cli@0.33.4 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
@@ -9,10 +9,10 @@
9
9
  ESM Build start
10
10
  ESM dist/cli.js 94.00 B
11
11
  ESM dist/index.js 917.00 B
12
- ESM dist/run-interactive-ink-VS35YSBB.js 56.86 KB
13
- ESM dist/chunk-QAUWCAWU.js 528.49 KB
14
- ESM ⚡️ Build success in 67ms
12
+ ESM dist/run-interactive-ink-JO343QM2.js 56.86 KB
13
+ ESM dist/chunk-QVCJIXPQ.js 529.65 KB
14
+ ESM ⚡️ Build success in 75ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4144ms
16
+ DTS ⚡️ Build success in 4620ms
17
17
  DTS dist/cli.d.ts 20.00 B
18
18
  DTS dist/index.d.ts 7.07 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @poncho-ai/cli
2
2
 
3
+ ## 0.33.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#73](https://github.com/cesr/poncho-ai/pull/73) [`f72f202`](https://github.com/cesr/poncho-ai/commit/f72f202d839dbbb8240336ec76eb6340aba20f06) Thanks [@cesr](https://github.com/cesr)! - Fix Telegram approval message ordering: send accumulated assistant text before approval buttons so the conversation reads naturally. Skip empty bridge replies when text was already sent at checkpoint.
8
+
9
+ - Updated dependencies [[`f72f202`](https://github.com/cesr/poncho-ai/commit/f72f202d839dbbb8240336ec76eb6340aba20f06)]:
10
+ - @poncho-ai/messaging@0.7.10
11
+
12
+ ## 0.33.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [#71](https://github.com/cesr/poncho-ai/pull/71) [`3e5bf7e`](https://github.com/cesr/poncho-ai/commit/3e5bf7e527e394c5f823beac90712756e57cd491) Thanks [@cesr](https://github.com/cesr)! - Fix Telegram tool approval handler never persisting the approval decision, preventing the resume-from-checkpoint flow from triggering. Make answerCallbackQuery best-effort so transient fetch failures don't block approval processing.
17
+
18
+ - Updated dependencies [[`3e5bf7e`](https://github.com/cesr/poncho-ai/commit/3e5bf7e527e394c5f823beac90712756e57cd491)]:
19
+ - @poncho-ai/messaging@0.7.9
20
+
3
21
  ## 0.33.2
4
22
 
5
23
  ### Patch Changes
@@ -10178,6 +10178,7 @@ ${resultBody}`,
10178
10178
  let latestRunId = "";
10179
10179
  const draft = createTurnDraftState();
10180
10180
  let checkpointedRun = false;
10181
+ let checkpointTextAlreadySent = false;
10181
10182
  let runContextTokens = 0;
10182
10183
  let runContextWindow = 0;
10183
10184
  let runContinuation2 = false;
@@ -10268,6 +10269,19 @@ ${resultBody}`,
10268
10269
  if (conv?.channelMeta?.platform === "telegram") {
10269
10270
  const tgAdapter = messagingAdapters.get("telegram");
10270
10271
  if (tgAdapter) {
10272
+ const threadRef = {
10273
+ channelId: conv.channelMeta.channelId,
10274
+ platformThreadId: conv.channelMeta.platformThreadId
10275
+ };
10276
+ const pendingText = draft.assistantResponse.trim();
10277
+ if (pendingText) {
10278
+ try {
10279
+ await tgAdapter.sendReply(threadRef, pendingText);
10280
+ checkpointTextAlreadySent = true;
10281
+ } catch (err) {
10282
+ console.error("[messaging-runner] failed to send pre-approval text:", err instanceof Error ? err.message : err);
10283
+ }
10284
+ }
10271
10285
  const approvals = event.approvals.map((a) => ({
10272
10286
  approvalId: a.approvalId,
10273
10287
  tool: a.tool,
@@ -10351,8 +10365,8 @@ ${resultBody}`,
10351
10365
  runOwners.delete(latestRunId);
10352
10366
  runConversations.delete(latestRunId);
10353
10367
  }
10354
- console.log("[messaging-runner] run complete, response length:", draft.assistantResponse.length, runContinuation2 ? "(continuation)" : "");
10355
- const response = draft.assistantResponse;
10368
+ const response = checkpointTextAlreadySent ? "" : draft.assistantResponse;
10369
+ console.log("[messaging-runner] run complete, response length:", response.length, checkpointTextAlreadySent ? "(text sent at checkpoint)" : "", runContinuation2 ? "(continuation)" : "");
10356
10370
  return {
10357
10371
  response,
10358
10372
  continuation: runContinuation2,
@@ -10905,26 +10919,30 @@ ${resultBody}`,
10905
10919
  }
10906
10920
  const found = await findPendingApproval(approvalId, "local-owner");
10907
10921
  let foundConversation = found?.conversation;
10908
- let foundApproval = found?.approval;
10922
+ const foundApproval = found?.approval;
10909
10923
  if (!foundConversation || !foundApproval) {
10910
10924
  console.warn("[telegram-approval] approval not found:", approvalId);
10911
10925
  return;
10912
10926
  }
10913
- foundApproval = normalizeApprovalCheckpoint(foundApproval, foundConversation.messages);
10914
- await adapter.updateApprovalMessage(approvalId, approved ? "approved" : "denied", foundApproval.tool);
10915
- foundApproval.decision = approved ? "approved" : "denied";
10927
+ const approvalDecision = approved ? "approved" : "denied";
10928
+ await adapter.updateApprovalMessage(approvalId, approvalDecision, foundApproval.tool);
10929
+ foundConversation.pendingApprovals = (foundConversation.pendingApprovals ?? []).map(
10930
+ (approval) => approval.approvalId === approvalId ? { ...normalizeApprovalCheckpoint(approval, foundConversation.messages), decision: approvalDecision } : normalizeApprovalCheckpoint(approval, foundConversation.messages)
10931
+ );
10932
+ await conversationStore.update(foundConversation);
10916
10933
  broadcastEvent(
10917
10934
  foundConversation.conversationId,
10918
10935
  approved ? { type: "tool:approval:granted", approvalId } : { type: "tool:approval:denied", approvalId }
10919
10936
  );
10920
- const allApprovals = (foundConversation.pendingApprovals ?? []).map(
10921
- (approval) => normalizeApprovalCheckpoint(approval, foundConversation.messages)
10937
+ const refreshedConversation = await conversationStore.get(foundConversation.conversationId);
10938
+ const allApprovals = (refreshedConversation?.pendingApprovals ?? []).map(
10939
+ (approval) => normalizeApprovalCheckpoint(approval, refreshedConversation.messages)
10922
10940
  );
10923
10941
  const allDecided = allApprovals.length > 0 && allApprovals.every((a) => a.decision != null);
10924
10942
  if (!allDecided) {
10925
- await conversationStore.update(foundConversation);
10926
10943
  return;
10927
10944
  }
10945
+ foundConversation = refreshedConversation;
10928
10946
  const conversationId = foundConversation.conversationId;
10929
10947
  const checkpointRef = allApprovals[0];
10930
10948
  foundConversation.pendingApprovals = [];
@@ -13071,7 +13089,7 @@ var runInteractive = async (workingDir, params) => {
13071
13089
  await harness.initialize();
13072
13090
  const identity = await ensureAgentIdentity2(workingDir);
13073
13091
  try {
13074
- const { runInteractiveInk } = await import("./run-interactive-ink-VS35YSBB.js");
13092
+ const { runInteractiveInk } = await import("./run-interactive-ink-JO343QM2.js");
13075
13093
  await runInteractiveInk({
13076
13094
  harness,
13077
13095
  params,
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "./chunk-QAUWCAWU.js";
4
+ } from "./chunk-QVCJIXPQ.js";
5
5
 
6
6
  // src/cli.ts
7
7
  void main();
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  runTests,
25
25
  startDevServer,
26
26
  updateAgentGuidance
27
- } from "./chunk-QAUWCAWU.js";
27
+ } from "./chunk-QVCJIXPQ.js";
28
28
  export {
29
29
  __internalRunOrchestration,
30
30
  addSkill,
@@ -2,7 +2,7 @@ import {
2
2
  consumeFirstRunIntro,
3
3
  inferConversationTitle,
4
4
  resolveHarnessEnvironment
5
- } from "./chunk-QAUWCAWU.js";
5
+ } from "./chunk-QVCJIXPQ.js";
6
6
 
7
7
  // src/run-interactive-ink.ts
8
8
  import * as readline from "readline";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/cli",
3
- "version": "0.33.2",
3
+ "version": "0.33.4",
4
4
  "description": "CLI for building and deploying AI agents",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "react": "^19.2.4",
28
28
  "react-devtools-core": "^6.1.5",
29
29
  "yaml": "^2.8.1",
30
+ "@poncho-ai/messaging": "0.7.10",
30
31
  "@poncho-ai/harness": "0.32.1",
31
- "@poncho-ai/messaging": "0.7.8",
32
32
  "@poncho-ai/sdk": "1.7.1"
33
33
  },
34
34
  "devDependencies": {
package/src/index.ts CHANGED
@@ -3385,6 +3385,7 @@ export const createRequestHandler = async (options?: {
3385
3385
  let latestRunId = "";
3386
3386
  const draft = createTurnDraftState();
3387
3387
  let checkpointedRun = false;
3388
+ let checkpointTextAlreadySent = false;
3388
3389
  let runContextTokens = 0;
3389
3390
  let runContextWindow = 0;
3390
3391
  let runContinuation = false;
@@ -3479,11 +3480,27 @@ export const createRequestHandler = async (options?: {
3479
3480
  });
3480
3481
  checkpointedRun = true;
3481
3482
 
3482
- // Send inline keyboard approval buttons to Telegram
3483
3483
  const conv = await conversationStore.get(conversationId);
3484
3484
  if (conv?.channelMeta?.platform === "telegram") {
3485
3485
  const tgAdapter = messagingAdapters.get("telegram") as TelegramAdapter | undefined;
3486
3486
  if (tgAdapter) {
3487
+ const threadRef: import("@poncho-ai/messaging").ThreadRef = {
3488
+ channelId: conv.channelMeta.channelId,
3489
+ platformThreadId: conv.channelMeta.platformThreadId,
3490
+ };
3491
+
3492
+ // Send accumulated text BEFORE approval buttons so Telegram
3493
+ // shows them in the natural order (text → approval request).
3494
+ const pendingText = draft.assistantResponse.trim();
3495
+ if (pendingText) {
3496
+ try {
3497
+ await tgAdapter.sendReply(threadRef, pendingText);
3498
+ checkpointTextAlreadySent = true;
3499
+ } catch (err: unknown) {
3500
+ console.error("[messaging-runner] failed to send pre-approval text:", err instanceof Error ? err.message : err);
3501
+ }
3502
+ }
3503
+
3487
3504
  const approvals = event.approvals.map(a => ({
3488
3505
  approvalId: a.approvalId,
3489
3506
  tool: a.tool,
@@ -3571,8 +3588,8 @@ export const createRequestHandler = async (options?: {
3571
3588
  runConversations.delete(latestRunId);
3572
3589
  }
3573
3590
 
3574
- console.log("[messaging-runner] run complete, response length:", draft.assistantResponse.length, runContinuation ? "(continuation)" : "");
3575
- const response = draft.assistantResponse;
3591
+ const response = checkpointTextAlreadySent ? "" : draft.assistantResponse;
3592
+ console.log("[messaging-runner] run complete, response length:", response.length, checkpointTextAlreadySent ? "(text sent at checkpoint)" : "", runContinuation ? "(continuation)" : "");
3576
3593
 
3577
3594
  return {
3578
3595
  response,
@@ -4188,17 +4205,22 @@ export const createRequestHandler = async (options?: {
4188
4205
  // Regular (non-subagent) approval
4189
4206
  const found = await findPendingApproval(approvalId, "local-owner");
4190
4207
  let foundConversation = found?.conversation;
4191
- let foundApproval = found?.approval;
4208
+ const foundApproval = found?.approval;
4192
4209
 
4193
4210
  if (!foundConversation || !foundApproval) {
4194
4211
  console.warn("[telegram-approval] approval not found:", approvalId);
4195
4212
  return;
4196
4213
  }
4197
- foundApproval = normalizeApprovalCheckpoint(foundApproval, foundConversation.messages);
4198
4214
 
4199
- await adapter.updateApprovalMessage(approvalId, approved ? "approved" : "denied", foundApproval.tool);
4215
+ const approvalDecision = approved ? "approved" as const : "denied" as const;
4216
+ await adapter.updateApprovalMessage(approvalId, approvalDecision, foundApproval.tool);
4200
4217
 
4201
- foundApproval.decision = approved ? "approved" : "denied";
4218
+ foundConversation.pendingApprovals = (foundConversation.pendingApprovals ?? []).map((approval) =>
4219
+ approval.approvalId === approvalId
4220
+ ? { ...normalizeApprovalCheckpoint(approval, foundConversation!.messages), decision: approvalDecision }
4221
+ : normalizeApprovalCheckpoint(approval, foundConversation!.messages),
4222
+ );
4223
+ await conversationStore.update(foundConversation);
4202
4224
 
4203
4225
  broadcastEvent(foundConversation.conversationId,
4204
4226
  approved
@@ -4206,15 +4228,16 @@ export const createRequestHandler = async (options?: {
4206
4228
  : { type: "tool:approval:denied", approvalId },
4207
4229
  );
4208
4230
 
4209
- const allApprovals = (foundConversation.pendingApprovals ?? []).map((approval) =>
4210
- normalizeApprovalCheckpoint(approval, foundConversation!.messages),
4231
+ const refreshedConversation = await conversationStore.get(foundConversation.conversationId);
4232
+ const allApprovals = (refreshedConversation?.pendingApprovals ?? []).map((approval) =>
4233
+ normalizeApprovalCheckpoint(approval, refreshedConversation!.messages),
4211
4234
  );
4212
4235
  const allDecided = allApprovals.length > 0 && allApprovals.every(a => a.decision != null);
4213
4236
 
4214
4237
  if (!allDecided) {
4215
- await conversationStore.update(foundConversation);
4216
4238
  return;
4217
4239
  }
4240
+ foundConversation = refreshedConversation!;
4218
4241
 
4219
4242
  // All decided — resume the run
4220
4243
  const conversationId = foundConversation.conversationId;