@poncho-ai/harness 0.10.1 → 0.10.2

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.10.1 build /Users/cesar/Dev/latitude/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.10.2 build /Users/cesar/Dev/latitude/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 137.51 KB
11
- ESM ⚡️ Build success in 32ms
10
+ ESM dist/index.js 137.95 KB
11
+ ESM ⚡️ Build success in 58ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 3338ms
13
+ DTS ⚡️ Build success in 3263ms
14
14
  DTS dist/index.d.ts 17.16 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Improve runtime loading of `poncho.config.js` in serverless environments.
8
+
9
+ The harness now falls back to `jiti` when native ESM import of `poncho.config.js` fails, allowing deploys where bundlers/runtime packaging treat project `.js` files as CommonJS. The CLI patch picks up the updated harness runtime.
10
+
3
11
  ## 0.10.1
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -262,6 +262,7 @@ var getAgentStoreDirectory = (identity) => resolve2(getPonchoStoreRoot(), buildA
262
262
  // src/config.ts
263
263
  import { access } from "fs/promises";
264
264
  import { resolve as resolve3 } from "path";
265
+ import { createJiti } from "jiti";
265
266
  var resolveTtl = (ttl, key) => {
266
267
  if (typeof ttl === "number") {
267
268
  return ttl;
@@ -306,8 +307,20 @@ var loadPonchoConfig = async (workingDir) => {
306
307
  } catch {
307
308
  return void 0;
308
309
  }
309
- const imported = await import(`${filePath}?t=${Date.now()}`);
310
- return imported.default;
310
+ try {
311
+ const imported = await import(`${filePath}?t=${Date.now()}`);
312
+ return imported.default;
313
+ } catch (error) {
314
+ const jiti = createJiti(import.meta.url, { interopDefault: true, moduleCache: false });
315
+ const imported = await jiti.import(filePath);
316
+ if (imported && typeof imported === "object" && "default" in imported) {
317
+ return imported.default;
318
+ }
319
+ if (imported && typeof imported === "object") {
320
+ return imported;
321
+ }
322
+ throw error;
323
+ }
311
324
  };
312
325
 
313
326
  // src/default-tools.ts
@@ -1640,7 +1653,7 @@ import { defineTool as defineTool3 } from "@poncho-ai/sdk";
1640
1653
  import { access as access2, readdir as readdir3, stat as stat2 } from "fs/promises";
1641
1654
  import { extname, normalize as normalize2, resolve as resolve7, sep as sep2 } from "path";
1642
1655
  import { pathToFileURL } from "url";
1643
- import { createJiti } from "jiti";
1656
+ import { createJiti as createJiti2 } from "jiti";
1644
1657
  var createSkillTools = (skills, options) => {
1645
1658
  const skillsByName = new Map(skills.map((skill) => [skill.name, skill]));
1646
1659
  const knownNames = skills.length > 0 ? skills.map((skill) => skill.name).join(", ") : "(none)";
@@ -1963,7 +1976,7 @@ var loadScriptModule = async (scriptPath) => {
1963
1976
  try {
1964
1977
  return await import(pathToFileURL(scriptPath).href);
1965
1978
  } catch {
1966
- const jiti = createJiti(import.meta.url, { interopDefault: true });
1979
+ const jiti = createJiti2(import.meta.url, { interopDefault: true });
1967
1980
  return await jiti.import(scriptPath);
1968
1981
  }
1969
1982
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
package/src/config.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { access } from "node:fs/promises";
2
2
  import { resolve } from "node:path";
3
+ import { createJiti } from "jiti";
3
4
  import type { MemoryConfig } from "./memory.js";
4
5
  import type { McpConfig } from "./mcp.js";
5
6
  import type { StateConfig } from "./state.js";
@@ -133,9 +134,22 @@ export const loadPonchoConfig = async (
133
134
  return undefined;
134
135
  }
135
136
 
136
- const imported = (await import(`${filePath}?t=${Date.now()}`)) as {
137
- default?: PonchoConfig;
138
- };
139
-
140
- return imported.default;
137
+ try {
138
+ const imported = (await import(`${filePath}?t=${Date.now()}`)) as {
139
+ default?: PonchoConfig;
140
+ };
141
+ return imported.default;
142
+ } catch (error) {
143
+ // Some serverless packagers load project code as CommonJS and reject ESM
144
+ // config files. Fall back to jiti so both ESM and CJS configs are accepted.
145
+ const jiti = createJiti(import.meta.url, { interopDefault: true, moduleCache: false });
146
+ const imported = (await jiti.import(filePath)) as PonchoConfig | { default?: PonchoConfig };
147
+ if (imported && typeof imported === "object" && "default" in imported) {
148
+ return imported.default;
149
+ }
150
+ if (imported && typeof imported === "object") {
151
+ return imported as PonchoConfig;
152
+ }
153
+ throw error;
154
+ }
141
155
  };