@poncho-ai/harness 0.19.0 → 0.20.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/harness@0.19.0 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.20.0 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
3
3
  > tsup src/index.ts --format esm --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -7,8 +7,8 @@
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
- ESM dist/index.js 198.85 KB
11
- ESM ⚡️ Build success in 137ms
10
+ ESM dist/index.js 199.42 KB
11
+ ESM ⚡️ Build success in 145ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 7145ms
14
- DTS dist/index.d.ts 24.33 KB
13
+ DTS ⚡️ Build success in 7280ms
14
+ DTS dist/index.d.ts 24.36 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5df6b5f`](https://github.com/cesr/poncho-ai/commit/5df6b5fcdc98e0445bea504dc9d077f02d1e954f) Thanks [@cesr](https://github.com/cesr)! - Add polling fallback for web UI on serverless deployments: when the SSE event stream is unavailable (different instance from the webhook handler), the UI polls the conversation every 2 seconds until the run completes. Conversations now track a persisted `runStatus` field.
8
+
9
+ ## 0.19.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`470563b`](https://github.com/cesr/poncho-ai/commit/470563b96bbb5d2c6358a1c89dd3b52beb7799c8) Thanks [@cesr](https://github.com/cesr)! - Fix LocalUploadStore ENOENT on Vercel: use /tmp for uploads on serverless environments instead of the read-only working directory.
14
+
3
15
  ## 0.19.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -96,6 +96,7 @@ interface Conversation {
96
96
  }>;
97
97
  decision?: "approved" | "denied";
98
98
  }>;
99
+ runStatus?: "running" | "idle";
99
100
  ownerId: string;
100
101
  tenantId: string | null;
101
102
  contextTokens?: number;
package/dist/index.js CHANGED
@@ -518,6 +518,7 @@ import { getTextContent as getTextContent2 } from "@poncho-ai/sdk";
518
518
  import { createHash as createHash2 } from "crypto";
519
519
  import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile3, rm as rm2 } from "fs/promises";
520
520
  import { createRequire } from "module";
521
+ import { homedir as homedir2 } from "os";
521
522
  import { resolve as resolve5 } from "path";
522
523
  var tryImport = async (mod, workingDir) => {
523
524
  try {
@@ -605,10 +606,15 @@ var MIME_EXT_MAP = {
605
606
  "audio/wav": ".wav"
606
607
  };
607
608
  var mimeToExt = (mediaType) => MIME_EXT_MAP[mediaType] ?? `.${mediaType.split("/").pop() ?? "bin"}`;
609
+ var isServerlessEnv = () => {
610
+ const cwd = process.cwd();
611
+ const home = homedir2();
612
+ return process.env.VERCEL === "1" || process.env.VERCEL_ENV !== void 0 || process.env.VERCEL_URL !== void 0 || process.env.AWS_LAMBDA_FUNCTION_NAME !== void 0 || process.env.AWS_EXECUTION_ENV?.includes("AWS_Lambda") === true || process.env.LAMBDA_TASK_ROOT !== void 0 || process.env.NOW_REGION !== void 0 || cwd.startsWith("/var/task") || home.startsWith("/var/task") || process.env.SERVERLESS === "1";
613
+ };
608
614
  var LocalUploadStore = class {
609
615
  uploadsDir;
610
616
  constructor(workingDir) {
611
- this.uploadsDir = resolve5(workingDir, ".poncho", "uploads");
617
+ this.uploadsDir = isServerlessEnv() ? "/tmp/.poncho/uploads" : resolve5(workingDir, ".poncho", "uploads");
612
618
  }
613
619
  async put(_key, data, mediaType) {
614
620
  const key = deriveUploadKey(data, mediaType);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
package/src/state.ts CHANGED
@@ -37,6 +37,7 @@ export interface Conversation {
37
37
  pendingToolCalls?: Array<{ id: string; name: string; input: Record<string, unknown> }>;
38
38
  decision?: "approved" | "denied";
39
39
  }>;
40
+ runStatus?: "running" | "idle";
40
41
  ownerId: string;
41
42
  tenantId: string | null;
42
43
  contextTokens?: number;
@@ -1,6 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { mkdir, readFile, writeFile, rm } from "node:fs/promises";
3
3
  import { createRequire } from "node:module";
4
+ import { homedir } from "node:os";
4
5
  import { resolve } from "node:path";
5
6
  import type { UploadsConfig } from "./config.js";
6
7
 
@@ -127,11 +128,30 @@ const mimeToExt = (mediaType: string): string =>
127
128
  // Local filesystem implementation
128
129
  // ---------------------------------------------------------------------------
129
130
 
131
+ const isServerlessEnv = (): boolean => {
132
+ const cwd = process.cwd();
133
+ const home = homedir();
134
+ return (
135
+ process.env.VERCEL === "1" ||
136
+ process.env.VERCEL_ENV !== undefined ||
137
+ process.env.VERCEL_URL !== undefined ||
138
+ process.env.AWS_LAMBDA_FUNCTION_NAME !== undefined ||
139
+ process.env.AWS_EXECUTION_ENV?.includes("AWS_Lambda") === true ||
140
+ process.env.LAMBDA_TASK_ROOT !== undefined ||
141
+ process.env.NOW_REGION !== undefined ||
142
+ cwd.startsWith("/var/task") ||
143
+ home.startsWith("/var/task") ||
144
+ process.env.SERVERLESS === "1"
145
+ );
146
+ };
147
+
130
148
  export class LocalUploadStore implements UploadStore {
131
149
  private readonly uploadsDir: string;
132
150
 
133
151
  constructor(workingDir: string) {
134
- this.uploadsDir = resolve(workingDir, ".poncho", "uploads");
152
+ this.uploadsDir = isServerlessEnv()
153
+ ? "/tmp/.poncho/uploads"
154
+ : resolve(workingDir, ".poncho", "uploads");
135
155
  }
136
156
 
137
157
  async put(_key: string, data: Buffer, mediaType: string): Promise<string> {