@poncho-ai/cli 0.20.2 → 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.2 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-JJDTHPM5.js 55.30 KB
11
12
  ESM dist/index.js 857.00 B
12
- ESM dist/run-interactive-ink-2YFB7AEJ.js 55.30 KB
13
- ESM dist/chunk-VRLHV23J.js 384.02 KB
14
- ESM ⚡️ Build success in 62ms
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 3793ms
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,11 @@
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
+
3
9
  ## 0.20.2
4
10
 
5
11
  ### Patch Changes
@@ -8608,48 +8608,60 @@ data: ${JSON.stringify(data)}
8608
8608
  await conversationStore.update(foundConversation);
8609
8609
  const checkpointRef = allApprovals[0];
8610
8610
  const resumeWork = (async () => {
8611
- const toolContext = {
8612
- runId: checkpointRef.runId,
8613
- agentId: identity.id,
8614
- step: 0,
8615
- workingDir,
8616
- parameters: {}
8617
- };
8618
- const approvalToolCallIds = new Set(allApprovals.map((a) => a.toolCallId));
8619
- const callsToExecute = [];
8620
- const deniedResults = [];
8621
- for (const a of allApprovals) {
8622
- if (a.decision === "approved" && a.toolCallId) {
8623
- callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
8624
- } else if (a.decision === "denied" && a.toolCallId) {
8625
- deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
8626
- }
8627
- }
8628
- const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
8629
- for (const tc of pendingToolCalls) {
8630
- if (!approvalToolCallIds.has(tc.id)) {
8631
- callsToExecute.push(tc);
8632
- }
8633
- }
8634
- let toolResults = [...deniedResults];
8635
- if (callsToExecute.length > 0) {
8636
- const execResults = await harness.executeTools(callsToExecute, toolContext);
8637
- toolResults.push(...execResults.map((r) => ({
8638
- callId: r.callId,
8639
- toolName: r.tool,
8640
- result: r.output,
8641
- error: r.error
8642
- })));
8643
- }
8644
- await resumeRunFromCheckpoint(
8645
- conversationId,
8646
- foundConversation,
8647
- checkpointRef,
8648
- toolResults
8649
- );
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
+ }
8650
8660
  })();
8651
8661
  if (waitUntilHook) {
8652
8662
  waitUntilHook(resumeWork);
8663
+ } else {
8664
+ await resumeWork;
8653
8665
  }
8654
8666
  writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
8655
8667
  return;
@@ -9679,7 +9691,7 @@ var runInteractive = async (workingDir, params) => {
9679
9691
  await harness.initialize();
9680
9692
  const identity = await ensureAgentIdentity2(workingDir);
9681
9693
  try {
9682
- const { runInteractiveInk } = await import("./run-interactive-ink-2YFB7AEJ.js");
9694
+ const { runInteractiveInk } = await import("./run-interactive-ink-JJDTHPM5.js");
9683
9695
  await runInteractiveInk({
9684
9696
  harness,
9685
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-VRLHV23J.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-VRLHV23J.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-VRLHV23J.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.2",
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 });