@poncho-ai/cli 0.30.3 → 0.30.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.30.3 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
2
+ > @poncho-ai/cli@0.30.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 857.00 B
12
- ESM dist/run-interactive-ink-FUMHN6DS.js 56.86 KB
13
- ESM dist/chunk-FA546WPW.js 490.84 KB
14
- ESM ⚡️ Build success in 63ms
12
+ ESM dist/run-interactive-ink-VEUZATR3.js 56.86 KB
13
+ ESM dist/chunk-EZUW7UI3.js 491.51 KB
14
+ ESM ⚡️ Build success in 62ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3898ms
16
+ DTS ⚡️ Build success in 3983ms
17
17
  DTS dist/cli.d.ts 20.00 B
18
18
  DTS dist/index.d.ts 4.16 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @poncho-ai/cli
2
2
 
3
+ ## 0.30.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ea8b5da`](https://github.com/cesr/poncho-ai/commit/ea8b5da1bca5d45c05a68a43c4850aacee612ffb) Thanks [@cesr](https://github.com/cesr)! - Fix internal self-fetch blocked by Vercel Deployment Protection and PONCHO_AUTH_TOKEN
8
+ - Include x-vercel-protection-bypass header when VERCEL_AUTOMATION_BYPASS_SECRET is set
9
+ - Internal requests with valid x-poncho-internal header bypass the PONCHO_AUTH_TOKEN auth gate
10
+ - Better error messages distinguishing Vercel Deployment Protection from internal auth failures
11
+
3
12
  ## 0.30.3
4
13
 
5
14
  ### Patch Changes
@@ -9821,6 +9821,7 @@ ${resultBody}`,
9821
9821
  const doWaitUntil = (promise) => {
9822
9822
  if (waitUntilHook) waitUntilHook(promise);
9823
9823
  };
9824
+ const vercelBypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
9824
9825
  const selfFetchWithRetry = async (path, body, retries = 3) => {
9825
9826
  if (!selfBaseUrl) {
9826
9827
  console.error(`[poncho][self-fetch] Missing self base URL for ${path}`);
@@ -9829,12 +9830,16 @@ ${resultBody}`,
9829
9830
  let lastError;
9830
9831
  for (let attempt = 0; attempt < retries; attempt++) {
9831
9832
  try {
9833
+ const headers = {
9834
+ "Content-Type": "application/json",
9835
+ "x-poncho-internal": internalSecret
9836
+ };
9837
+ if (vercelBypassSecret) {
9838
+ headers["x-vercel-protection-bypass"] = vercelBypassSecret;
9839
+ }
9832
9840
  const result = await fetch(`${selfBaseUrl}${path}`, {
9833
9841
  method: "POST",
9834
- headers: {
9835
- "Content-Type": "application/json",
9836
- "x-poncho-internal": internalSecret
9837
- },
9842
+ headers,
9838
9843
  body: body ? JSON.stringify(body) : void 0
9839
9844
  });
9840
9845
  if (result.ok) {
@@ -9858,9 +9863,15 @@ ${resultBody}`,
9858
9863
  lastError instanceof Error ? lastError.message : String(lastError)
9859
9864
  );
9860
9865
  if (lastError instanceof Error && (lastError.message.includes("HTTP 403") || lastError.message.includes("HTTP 401"))) {
9861
- console.error(
9862
- "[poncho][self-fetch] Internal auth failed. Ensure all serverless instances share PONCHO_INTERNAL_SECRET."
9863
- );
9866
+ if (lastError.message.includes("HTTP 401") && lastError.message.includes("<!doctype")) {
9867
+ console.error(
9868
+ "[poncho][self-fetch] Blocked by Vercel Deployment Protection. Set VERCEL_AUTOMATION_BYPASS_SECRET in your Vercel project settings and env vars."
9869
+ );
9870
+ } else {
9871
+ console.error(
9872
+ "[poncho][self-fetch] Internal auth failed. Ensure all serverless instances share PONCHO_INTERNAL_SECRET."
9873
+ );
9874
+ }
9864
9875
  }
9865
9876
  } else {
9866
9877
  console.error(`[poncho][self-fetch] Failed ${path} after ${retries} attempt(s).`);
@@ -10309,8 +10320,9 @@ ${resultBody}`,
10309
10320
  return;
10310
10321
  }
10311
10322
  if (pathname.startsWith("/api/")) {
10323
+ const isInternal = pathname.startsWith("/api/internal/") && request.method === "POST" && isValidInternalRequest(request.headers);
10312
10324
  const hasBearerToken = request.headers.authorization?.startsWith("Bearer ");
10313
- const isAuthenticated = !requireAuth || session || validateBearerToken(request.headers.authorization);
10325
+ const isAuthenticated = isInternal || !requireAuth || session || validateBearerToken(request.headers.authorization);
10314
10326
  if (!isAuthenticated) {
10315
10327
  writeJson(response, 401, {
10316
10328
  code: "AUTH_ERROR",
@@ -12171,7 +12183,7 @@ var runInteractive = async (workingDir, params) => {
12171
12183
  await harness.initialize();
12172
12184
  const identity = await ensureAgentIdentity2(workingDir);
12173
12185
  try {
12174
- const { runInteractiveInk } = await import("./run-interactive-ink-FUMHN6DS.js");
12186
+ const { runInteractiveInk } = await import("./run-interactive-ink-VEUZATR3.js");
12175
12187
  await runInteractiveInk({
12176
12188
  harness,
12177
12189
  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-FA546WPW.js";
4
+ } from "./chunk-EZUW7UI3.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-FA546WPW.js";
26
+ } from "./chunk-EZUW7UI3.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-FA546WPW.js";
5
+ } from "./chunk-EZUW7UI3.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.30.3",
3
+ "version": "0.30.4",
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.28.3",
30
+ "@poncho-ai/messaging": "0.7.2",
31
31
  "@poncho-ai/sdk": "1.6.1",
32
- "@poncho-ai/messaging": "0.7.2"
32
+ "@poncho-ai/harness": "0.28.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/busboy": "^1.5.4",
package/src/index.ts CHANGED
@@ -3074,6 +3074,8 @@ export const createRequestHandler = async (options?: {
3074
3074
  if (waitUntilHook) waitUntilHook(promise);
3075
3075
  };
3076
3076
 
3077
+ const vercelBypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
3078
+
3077
3079
  const selfFetchWithRetry = async (path: string, body?: Record<string, unknown>, retries = 3): Promise<Response | void> => {
3078
3080
  if (!selfBaseUrl) {
3079
3081
  console.error(`[poncho][self-fetch] Missing self base URL for ${path}`);
@@ -3082,12 +3084,16 @@ export const createRequestHandler = async (options?: {
3082
3084
  let lastError: unknown;
3083
3085
  for (let attempt = 0; attempt < retries; attempt++) {
3084
3086
  try {
3087
+ const headers: Record<string, string> = {
3088
+ "Content-Type": "application/json",
3089
+ "x-poncho-internal": internalSecret,
3090
+ };
3091
+ if (vercelBypassSecret) {
3092
+ headers["x-vercel-protection-bypass"] = vercelBypassSecret;
3093
+ }
3085
3094
  const result = await fetch(`${selfBaseUrl}${path}`, {
3086
3095
  method: "POST",
3087
- headers: {
3088
- "Content-Type": "application/json",
3089
- "x-poncho-internal": internalSecret,
3090
- },
3096
+ headers,
3091
3097
  body: body ? JSON.stringify(body) : undefined,
3092
3098
  });
3093
3099
  if (result.ok) {
@@ -3114,9 +3120,15 @@ export const createRequestHandler = async (options?: {
3114
3120
  lastError instanceof Error
3115
3121
  && (lastError.message.includes("HTTP 403") || lastError.message.includes("HTTP 401"))
3116
3122
  ) {
3117
- console.error(
3118
- "[poncho][self-fetch] Internal auth failed. Ensure all serverless instances share PONCHO_INTERNAL_SECRET.",
3119
- );
3123
+ if (lastError.message.includes("HTTP 401") && lastError.message.includes("<!doctype")) {
3124
+ console.error(
3125
+ "[poncho][self-fetch] Blocked by Vercel Deployment Protection. Set VERCEL_AUTOMATION_BYPASS_SECRET in your Vercel project settings and env vars.",
3126
+ );
3127
+ } else {
3128
+ console.error(
3129
+ "[poncho][self-fetch] Internal auth failed. Ensure all serverless instances share PONCHO_INTERNAL_SECRET.",
3130
+ );
3131
+ }
3120
3132
  }
3121
3133
  } else {
3122
3134
  console.error(`[poncho][self-fetch] Failed ${path} after ${retries} attempt(s).`);
@@ -3634,9 +3646,12 @@ export const createRequestHandler = async (options?: {
3634
3646
  }
3635
3647
 
3636
3648
  if (pathname.startsWith("/api/")) {
3637
- // Check authentication: either valid session (Web UI) or valid Bearer token (API)
3649
+ // Internal self-fetch requests bypass user-facing auth
3650
+ const isInternal = pathname.startsWith("/api/internal/") && request.method === "POST" && isValidInternalRequest(request.headers);
3651
+
3652
+ // Check authentication: either valid session (Web UI), valid Bearer token (API), or valid internal request
3638
3653
  const hasBearerToken = request.headers.authorization?.startsWith("Bearer ");
3639
- const isAuthenticated = !requireAuth || session || validateBearerToken(request.headers.authorization);
3654
+ const isAuthenticated = isInternal || !requireAuth || session || validateBearerToken(request.headers.authorization);
3640
3655
 
3641
3656
  if (!isAuthenticated) {
3642
3657
  writeJson(response, 401, {