@poncho-ai/cli 0.20.1 → 0.20.3

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.20.1 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
2
+ > @poncho-ai/cli@0.20.3 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/run-interactive-ink-S3D42QQY.js 55.30 KB
12
- ESM dist/chunk-J4OZUXG5.js 383.23 KB
11
+ ESM dist/run-interactive-ink-JJDTHPM5.js 55.30 KB
13
12
  ESM dist/index.js 857.00 B
14
- ESM ⚡️ Build success in 60ms
13
+ ESM dist/chunk-F4SLLHSH.js 384.50 KB
14
+ ESM ⚡️ Build success in 50ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3870ms
16
+ DTS ⚡️ Build success in 3455ms
17
17
  DTS dist/cli.d.ts 20.00 B
18
18
  DTS dist/index.d.ts 3.59 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @poncho-ai/cli
2
2
 
3
+ ## 0.20.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9b38474`](https://github.com/cesr/poncho-ai/commit/9b38474a25bfb54cec108d1d3eae664aaed37ccf) Thanks [@cesr](https://github.com/cesr)! - Make approval resume robust: wrap in try/catch to always clear runStatus, and await the work when waitUntil is unavailable so the resume completes before the response is sent.
8
+
9
+ ## 0.20.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`dcb1b51`](https://github.com/cesr/poncho-ai/commit/dcb1b51ed3be9147c982ed75e3784de38e77bc2f) Thanks [@cesr](https://github.com/cesr)! - Fix polling fallback wiping approval buttons: hydrate pending approvals on each poll cycle so the approve/deny UI stays visible.
14
+
3
15
  ## 0.20.1
4
16
 
5
17
  ### Patch Changes
@@ -2567,7 +2567,25 @@ var getWebUiClientScript = (markedSource2) => `
2567
2567
  var payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
2568
2568
  if (state.activeConversationId !== conversationId) return;
2569
2569
  if (payload.conversation) {
2570
- state.activeMessages = payload.conversation.messages || [];
2570
+ var allPending = [].concat(
2571
+ payload.conversation.pendingApprovals || [],
2572
+ );
2573
+ if (Array.isArray(payload.subagentPendingApprovals)) {
2574
+ payload.subagentPendingApprovals.forEach(function(sa) {
2575
+ var subIdShort = sa.subagentId && sa.subagentId.length > 12 ? sa.subagentId.slice(0, 12) + "..." : (sa.subagentId || "");
2576
+ allPending.push({
2577
+ approvalId: sa.approvalId,
2578
+ tool: sa.tool,
2579
+ input: sa.input,
2580
+ _subagentId: sa.subagentId,
2581
+ _subagentLabel: "subagent " + subIdShort,
2582
+ });
2583
+ });
2584
+ }
2585
+ state.activeMessages = hydratePendingApprovals(
2586
+ payload.conversation.messages || [],
2587
+ allPending,
2588
+ );
2571
2589
  renderMessages(state.activeMessages, payload.hasActiveRun);
2572
2590
  }
2573
2591
  if (payload.hasActiveRun) {
@@ -8590,48 +8608,60 @@ data: ${JSON.stringify(data)}
8590
8608
  await conversationStore.update(foundConversation);
8591
8609
  const checkpointRef = allApprovals[0];
8592
8610
  const resumeWork = (async () => {
8593
- const toolContext = {
8594
- runId: checkpointRef.runId,
8595
- agentId: identity.id,
8596
- step: 0,
8597
- workingDir,
8598
- parameters: {}
8599
- };
8600
- const approvalToolCallIds = new Set(allApprovals.map((a) => a.toolCallId));
8601
- const callsToExecute = [];
8602
- const deniedResults = [];
8603
- for (const a of allApprovals) {
8604
- if (a.decision === "approved" && a.toolCallId) {
8605
- callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
8606
- } else if (a.decision === "denied" && a.toolCallId) {
8607
- deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
8608
- }
8609
- }
8610
- const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
8611
- for (const tc of pendingToolCalls) {
8612
- if (!approvalToolCallIds.has(tc.id)) {
8613
- callsToExecute.push(tc);
8614
- }
8615
- }
8616
- let toolResults = [...deniedResults];
8617
- if (callsToExecute.length > 0) {
8618
- const execResults = await harness.executeTools(callsToExecute, toolContext);
8619
- toolResults.push(...execResults.map((r) => ({
8620
- callId: r.callId,
8621
- toolName: r.tool,
8622
- result: r.output,
8623
- error: r.error
8624
- })));
8625
- }
8626
- await resumeRunFromCheckpoint(
8627
- conversationId,
8628
- foundConversation,
8629
- checkpointRef,
8630
- toolResults
8631
- );
8611
+ try {
8612
+ const toolContext = {
8613
+ runId: checkpointRef.runId,
8614
+ agentId: identity.id,
8615
+ step: 0,
8616
+ workingDir,
8617
+ parameters: {}
8618
+ };
8619
+ const approvalToolCallIds = new Set(allApprovals.map((a) => a.toolCallId));
8620
+ const callsToExecute = [];
8621
+ const deniedResults = [];
8622
+ for (const a of allApprovals) {
8623
+ if (a.decision === "approved" && a.toolCallId) {
8624
+ callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
8625
+ } else if (a.decision === "denied" && a.toolCallId) {
8626
+ deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
8627
+ }
8628
+ }
8629
+ const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
8630
+ for (const tc of pendingToolCalls) {
8631
+ if (!approvalToolCallIds.has(tc.id)) {
8632
+ callsToExecute.push(tc);
8633
+ }
8634
+ }
8635
+ let toolResults = [...deniedResults];
8636
+ if (callsToExecute.length > 0) {
8637
+ const execResults = await harness.executeTools(callsToExecute, toolContext);
8638
+ toolResults.push(...execResults.map((r) => ({
8639
+ callId: r.callId,
8640
+ toolName: r.tool,
8641
+ result: r.output,
8642
+ error: r.error
8643
+ })));
8644
+ }
8645
+ await resumeRunFromCheckpoint(
8646
+ conversationId,
8647
+ foundConversation,
8648
+ checkpointRef,
8649
+ toolResults
8650
+ );
8651
+ } catch (err) {
8652
+ console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
8653
+ const conv = await conversationStore.get(conversationId);
8654
+ if (conv) {
8655
+ conv.runStatus = "idle";
8656
+ conv.updatedAt = Date.now();
8657
+ await conversationStore.update(conv);
8658
+ }
8659
+ }
8632
8660
  })();
8633
8661
  if (waitUntilHook) {
8634
8662
  waitUntilHook(resumeWork);
8663
+ } else {
8664
+ await resumeWork;
8635
8665
  }
8636
8666
  writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
8637
8667
  return;
@@ -9661,7 +9691,7 @@ var runInteractive = async (workingDir, params) => {
9661
9691
  await harness.initialize();
9662
9692
  const identity = await ensureAgentIdentity2(workingDir);
9663
9693
  try {
9664
- const { runInteractiveInk } = await import("./run-interactive-ink-S3D42QQY.js");
9694
+ const { runInteractiveInk } = await import("./run-interactive-ink-JJDTHPM5.js");
9665
9695
  await runInteractiveInk({
9666
9696
  harness,
9667
9697
  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-J4OZUXG5.js";
4
+ } from "./chunk-F4SLLHSH.js";
5
5
 
6
6
  // src/cli.ts
7
7
  void main();
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  runTests,
24
24
  startDevServer,
25
25
  updateAgentGuidance
26
- } from "./chunk-J4OZUXG5.js";
26
+ } from "./chunk-F4SLLHSH.js";
27
27
  export {
28
28
  addSkill,
29
29
  buildCli,
@@ -2,7 +2,7 @@ import {
2
2
  consumeFirstRunIntro,
3
3
  inferConversationTitle,
4
4
  resolveHarnessEnvironment
5
- } from "./chunk-J4OZUXG5.js";
5
+ } from "./chunk-F4SLLHSH.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.20.1",
3
+ "version": "0.20.3",
4
4
  "description": "CLI for building and deploying AI agents",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "react": "^19.2.4",
28
28
  "react-devtools-core": "^6.1.5",
29
29
  "yaml": "^2.8.1",
30
- "@poncho-ai/harness": "0.20.0",
30
+ "@poncho-ai/sdk": "1.4.0",
31
31
  "@poncho-ai/messaging": "0.2.7",
32
- "@poncho-ai/sdk": "1.4.0"
32
+ "@poncho-ai/harness": "0.20.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/busboy": "^1.5.4",
package/src/index.ts CHANGED
@@ -2909,55 +2909,67 @@ export const createRequestHandler = async (options?: {
2909
2909
  const checkpointRef = allApprovals[0]!;
2910
2910
 
2911
2911
  const resumeWork = (async () => {
2912
- const toolContext = {
2913
- runId: checkpointRef.runId,
2914
- agentId: identity.id,
2915
- step: 0,
2916
- workingDir,
2917
- parameters: {},
2918
- };
2912
+ try {
2913
+ const toolContext = {
2914
+ runId: checkpointRef.runId,
2915
+ agentId: identity.id,
2916
+ step: 0,
2917
+ workingDir,
2918
+ parameters: {},
2919
+ };
2919
2920
 
2920
- // Collect tool calls to execute: approved approval-gated tools + auto-approved deferred tools
2921
- const approvalToolCallIds = new Set(allApprovals.map(a => a.toolCallId));
2922
- const callsToExecute: Array<{ id: string; name: string; input: Record<string, unknown> }> = [];
2923
- const deniedResults: Array<{ callId: string; toolName: string; error: string }> = [];
2921
+ // Collect tool calls to execute: approved approval-gated tools + auto-approved deferred tools
2922
+ const approvalToolCallIds = new Set(allApprovals.map(a => a.toolCallId));
2923
+ const callsToExecute: Array<{ id: string; name: string; input: Record<string, unknown> }> = [];
2924
+ const deniedResults: Array<{ callId: string; toolName: string; error: string }> = [];
2924
2925
 
2925
- for (const a of allApprovals) {
2926
- if (a.decision === "approved" && a.toolCallId) {
2927
- callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
2928
- } else if (a.decision === "denied" && a.toolCallId) {
2929
- deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
2926
+ for (const a of allApprovals) {
2927
+ if (a.decision === "approved" && a.toolCallId) {
2928
+ callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
2929
+ } else if (a.decision === "denied" && a.toolCallId) {
2930
+ deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
2931
+ }
2930
2932
  }
2931
- }
2932
2933
 
2933
- // Auto-approved tools that were deferred alongside the approval-needing ones
2934
- const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
2935
- for (const tc of pendingToolCalls) {
2936
- if (!approvalToolCallIds.has(tc.id)) {
2937
- callsToExecute.push(tc);
2934
+ // Auto-approved tools that were deferred alongside the approval-needing ones
2935
+ const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
2936
+ for (const tc of pendingToolCalls) {
2937
+ if (!approvalToolCallIds.has(tc.id)) {
2938
+ callsToExecute.push(tc);
2939
+ }
2938
2940
  }
2939
- }
2940
2941
 
2941
- let toolResults: Array<{ callId: string; toolName: string; result?: unknown; error?: string }> = [...deniedResults];
2942
- if (callsToExecute.length > 0) {
2943
- const execResults = await harness.executeTools(callsToExecute, toolContext);
2944
- toolResults.push(...execResults.map(r => ({
2945
- callId: r.callId,
2946
- toolName: r.tool,
2947
- result: r.output,
2948
- error: r.error,
2949
- })));
2950
- }
2942
+ let toolResults: Array<{ callId: string; toolName: string; result?: unknown; error?: string }> = [...deniedResults];
2943
+ if (callsToExecute.length > 0) {
2944
+ const execResults = await harness.executeTools(callsToExecute, toolContext);
2945
+ toolResults.push(...execResults.map(r => ({
2946
+ callId: r.callId,
2947
+ toolName: r.tool,
2948
+ result: r.output,
2949
+ error: r.error,
2950
+ })));
2951
+ }
2951
2952
 
2952
- await resumeRunFromCheckpoint(
2953
- conversationId,
2954
- foundConversation!,
2955
- checkpointRef,
2956
- toolResults,
2957
- );
2953
+ await resumeRunFromCheckpoint(
2954
+ conversationId,
2955
+ foundConversation!,
2956
+ checkpointRef,
2957
+ toolResults,
2958
+ );
2959
+ } catch (err) {
2960
+ console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
2961
+ const conv = await conversationStore.get(conversationId);
2962
+ if (conv) {
2963
+ conv.runStatus = "idle";
2964
+ conv.updatedAt = Date.now();
2965
+ await conversationStore.update(conv);
2966
+ }
2967
+ }
2958
2968
  })();
2959
2969
  if (waitUntilHook) {
2960
2970
  waitUntilHook(resumeWork);
2971
+ } else {
2972
+ await resumeWork;
2961
2973
  }
2962
2974
 
2963
2975
  writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
@@ -1036,7 +1036,25 @@ export const getWebUiClientScript = (markedSource: string): string => `
1036
1036
  var payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
1037
1037
  if (state.activeConversationId !== conversationId) return;
1038
1038
  if (payload.conversation) {
1039
- state.activeMessages = payload.conversation.messages || [];
1039
+ var allPending = [].concat(
1040
+ payload.conversation.pendingApprovals || [],
1041
+ );
1042
+ if (Array.isArray(payload.subagentPendingApprovals)) {
1043
+ payload.subagentPendingApprovals.forEach(function(sa) {
1044
+ var subIdShort = sa.subagentId && sa.subagentId.length > 12 ? sa.subagentId.slice(0, 12) + "..." : (sa.subagentId || "");
1045
+ allPending.push({
1046
+ approvalId: sa.approvalId,
1047
+ tool: sa.tool,
1048
+ input: sa.input,
1049
+ _subagentId: sa.subagentId,
1050
+ _subagentLabel: "subagent " + subIdShort,
1051
+ });
1052
+ });
1053
+ }
1054
+ state.activeMessages = hydratePendingApprovals(
1055
+ payload.conversation.messages || [],
1056
+ allPending,
1057
+ );
1040
1058
  renderMessages(state.activeMessages, payload.hasActiveRun);
1041
1059
  }
1042
1060
  if (payload.hasActiveRun) {