@poncho-ai/cli 0.20.2 → 0.21.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.
@@ -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.21.0 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 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
12
+ ESM dist/run-interactive-ink-H55INI7H.js 55.30 KB
13
+ ESM dist/chunk-54WK2ATG.js 384.68 KB
14
+ ESM ⚡️ Build success in 57ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3793ms
16
+ DTS ⚡️ Build success in 3701ms
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.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c5d94c5`](https://github.com/cesr/poncho-ai/commit/c5d94c5854081ac23e91f7104047354ad1a415ef) Thanks [@cesr](https://github.com/cesr)! - Automatically add `@vercel/functions` to project dependencies when running `poncho build vercel`. This ensures `waitUntil` is available for keeping serverless functions alive during webhook processing and approval resume.
8
+
9
+ ## 0.20.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`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.
14
+
3
15
  ## 0.20.2
4
16
 
5
17
  ### Patch Changes
@@ -6862,7 +6862,7 @@ var UPLOAD_PROVIDER_DEPS = {
6862
6862
  { name: "@aws-sdk/s3-request-presigner", fallback: "^3.700.0" }
6863
6863
  ]
6864
6864
  };
6865
- var ensureRuntimeCliDependency = async (projectDir, cliVersion, config) => {
6865
+ var ensureRuntimeCliDependency = async (projectDir, cliVersion, config, target) => {
6866
6866
  const packageJsonPath = resolve3(projectDir, "package.json");
6867
6867
  const content = await readFile3(packageJsonPath, "utf8");
6868
6868
  const parsed = JSON.parse(content);
@@ -6886,6 +6886,10 @@ var ensureRuntimeCliDependency = async (projectDir, cliVersion, config) => {
6886
6886
  }
6887
6887
  }
6888
6888
  }
6889
+ if (target === "vercel" && !dependencies["@vercel/functions"]) {
6890
+ dependencies["@vercel/functions"] = "^1.0.0";
6891
+ addedDeps.push("@vercel/functions");
6892
+ }
6889
6893
  parsed.dependencies = dependencies;
6890
6894
  await writeFile3(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
6891
6895
  `, "utf8");
@@ -7094,7 +7098,8 @@ CMD ["node","server.js"]
7094
7098
  const { paths: packagePaths, addedDeps } = await ensureRuntimeCliDependency(
7095
7099
  projectDir,
7096
7100
  cliVersion,
7097
- config
7101
+ config,
7102
+ target
7098
7103
  );
7099
7104
  const depNote = addedDeps.length > 0 ? ` (added ${addedDeps.join(", ")})` : "";
7100
7105
  for (const p of packagePaths) {
@@ -8608,48 +8613,60 @@ data: ${JSON.stringify(data)}
8608
8613
  await conversationStore.update(foundConversation);
8609
8614
  const checkpointRef = allApprovals[0];
8610
8615
  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
- );
8616
+ try {
8617
+ const toolContext = {
8618
+ runId: checkpointRef.runId,
8619
+ agentId: identity.id,
8620
+ step: 0,
8621
+ workingDir,
8622
+ parameters: {}
8623
+ };
8624
+ const approvalToolCallIds = new Set(allApprovals.map((a) => a.toolCallId));
8625
+ const callsToExecute = [];
8626
+ const deniedResults = [];
8627
+ for (const a of allApprovals) {
8628
+ if (a.decision === "approved" && a.toolCallId) {
8629
+ callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
8630
+ } else if (a.decision === "denied" && a.toolCallId) {
8631
+ deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
8632
+ }
8633
+ }
8634
+ const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
8635
+ for (const tc of pendingToolCalls) {
8636
+ if (!approvalToolCallIds.has(tc.id)) {
8637
+ callsToExecute.push(tc);
8638
+ }
8639
+ }
8640
+ let toolResults = [...deniedResults];
8641
+ if (callsToExecute.length > 0) {
8642
+ const execResults = await harness.executeTools(callsToExecute, toolContext);
8643
+ toolResults.push(...execResults.map((r) => ({
8644
+ callId: r.callId,
8645
+ toolName: r.tool,
8646
+ result: r.output,
8647
+ error: r.error
8648
+ })));
8649
+ }
8650
+ await resumeRunFromCheckpoint(
8651
+ conversationId,
8652
+ foundConversation,
8653
+ checkpointRef,
8654
+ toolResults
8655
+ );
8656
+ } catch (err) {
8657
+ console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
8658
+ const conv = await conversationStore.get(conversationId);
8659
+ if (conv) {
8660
+ conv.runStatus = "idle";
8661
+ conv.updatedAt = Date.now();
8662
+ await conversationStore.update(conv);
8663
+ }
8664
+ }
8650
8665
  })();
8651
8666
  if (waitUntilHook) {
8652
8667
  waitUntilHook(resumeWork);
8668
+ } else {
8669
+ await resumeWork;
8653
8670
  }
8654
8671
  writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });
8655
8672
  return;
@@ -9679,7 +9696,7 @@ var runInteractive = async (workingDir, params) => {
9679
9696
  await harness.initialize();
9680
9697
  const identity = await ensureAgentIdentity2(workingDir);
9681
9698
  try {
9682
- const { runInteractiveInk } = await import("./run-interactive-ink-2YFB7AEJ.js");
9699
+ const { runInteractiveInk } = await import("./run-interactive-ink-H55INI7H.js");
9683
9700
  await runInteractiveInk({
9684
9701
  harness,
9685
9702
  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-54WK2ATG.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-54WK2ATG.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-54WK2ATG.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.21.0",
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/harness": "0.20.0",
31
30
  "@poncho-ai/messaging": "0.2.7",
31
+ "@poncho-ai/harness": "0.20.0",
32
32
  "@poncho-ai/sdk": "1.4.0"
33
33
  },
34
34
  "devDependencies": {
package/src/index.ts CHANGED
@@ -889,6 +889,7 @@ const ensureRuntimeCliDependency = async (
889
889
  projectDir: string,
890
890
  cliVersion: string,
891
891
  config?: PonchoConfig,
892
+ target?: string,
892
893
  ): Promise<{ paths: string[]; addedDeps: string[] }> => {
893
894
  const packageJsonPath = resolve(projectDir, "package.json");
894
895
  const content = await readFile(packageJsonPath, "utf8");
@@ -922,6 +923,11 @@ const ensureRuntimeCliDependency = async (
922
923
  }
923
924
  }
924
925
 
926
+ if (target === "vercel" && !dependencies["@vercel/functions"]) {
927
+ dependencies["@vercel/functions"] = "^1.0.0";
928
+ addedDeps.push("@vercel/functions");
929
+ }
930
+
925
931
  parsed.dependencies = dependencies;
926
932
  await writeFile(packageJsonPath, `${JSON.stringify(parsed, null, 2)}\n`, "utf8");
927
933
  return { paths: [relative(projectDir, packageJsonPath)], addedDeps };
@@ -1137,6 +1143,7 @@ CMD ["node","server.js"]
1137
1143
  projectDir,
1138
1144
  cliVersion,
1139
1145
  config,
1146
+ target,
1140
1147
  );
1141
1148
  const depNote = addedDeps.length > 0 ? ` (added ${addedDeps.join(", ")})` : "";
1142
1149
  for (const p of packagePaths) {
@@ -2909,55 +2916,67 @@ export const createRequestHandler = async (options?: {
2909
2916
  const checkpointRef = allApprovals[0]!;
2910
2917
 
2911
2918
  const resumeWork = (async () => {
2912
- const toolContext = {
2913
- runId: checkpointRef.runId,
2914
- agentId: identity.id,
2915
- step: 0,
2916
- workingDir,
2917
- parameters: {},
2918
- };
2919
+ try {
2920
+ const toolContext = {
2921
+ runId: checkpointRef.runId,
2922
+ agentId: identity.id,
2923
+ step: 0,
2924
+ workingDir,
2925
+ parameters: {},
2926
+ };
2919
2927
 
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 }> = [];
2928
+ // Collect tool calls to execute: approved approval-gated tools + auto-approved deferred tools
2929
+ const approvalToolCallIds = new Set(allApprovals.map(a => a.toolCallId));
2930
+ const callsToExecute: Array<{ id: string; name: string; input: Record<string, unknown> }> = [];
2931
+ const deniedResults: Array<{ callId: string; toolName: string; error: string }> = [];
2924
2932
 
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" });
2933
+ for (const a of allApprovals) {
2934
+ if (a.decision === "approved" && a.toolCallId) {
2935
+ callsToExecute.push({ id: a.toolCallId, name: a.tool, input: a.input });
2936
+ } else if (a.decision === "denied" && a.toolCallId) {
2937
+ deniedResults.push({ callId: a.toolCallId, toolName: a.tool, error: "Tool execution denied by user" });
2938
+ }
2930
2939
  }
2931
- }
2932
2940
 
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);
2941
+ // Auto-approved tools that were deferred alongside the approval-needing ones
2942
+ const pendingToolCalls = checkpointRef.pendingToolCalls ?? [];
2943
+ for (const tc of pendingToolCalls) {
2944
+ if (!approvalToolCallIds.has(tc.id)) {
2945
+ callsToExecute.push(tc);
2946
+ }
2938
2947
  }
2939
- }
2940
2948
 
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
- }
2949
+ let toolResults: Array<{ callId: string; toolName: string; result?: unknown; error?: string }> = [...deniedResults];
2950
+ if (callsToExecute.length > 0) {
2951
+ const execResults = await harness.executeTools(callsToExecute, toolContext);
2952
+ toolResults.push(...execResults.map(r => ({
2953
+ callId: r.callId,
2954
+ toolName: r.tool,
2955
+ result: r.output,
2956
+ error: r.error,
2957
+ })));
2958
+ }
2951
2959
 
2952
- await resumeRunFromCheckpoint(
2953
- conversationId,
2954
- foundConversation!,
2955
- checkpointRef,
2956
- toolResults,
2957
- );
2960
+ await resumeRunFromCheckpoint(
2961
+ conversationId,
2962
+ foundConversation!,
2963
+ checkpointRef,
2964
+ toolResults,
2965
+ );
2966
+ } catch (err) {
2967
+ console.error("[approval-resume] failed:", err instanceof Error ? err.message : err);
2968
+ const conv = await conversationStore.get(conversationId);
2969
+ if (conv) {
2970
+ conv.runStatus = "idle";
2971
+ conv.updatedAt = Date.now();
2972
+ await conversationStore.update(conv);
2973
+ }
2974
+ }
2958
2975
  })();
2959
2976
  if (waitUntilHook) {
2960
2977
  waitUntilHook(resumeWork);
2978
+ } else {
2979
+ await resumeWork;
2961
2980
  }
2962
2981
 
2963
2982
  writeJson(response, 200, { ok: true, approvalId, approved, batchComplete: true });