@agent-native/core 0.74.0 → 0.75.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.
@@ -42,8 +42,19 @@ export declare function findInstalledResvgPackages(nodeModulesRoots: string[]):
42
42
  /**
43
43
  * Deploy-time gate for emitting the second `-background` Netlify function.
44
44
  * Reads the same env flag the runtime gate uses
45
- * (`AGENT_CHAT_DURABLE_BACKGROUND`). Off by default — when off, the deploy
46
- * emits exactly one function (today's behavior, byte-for-byte).
45
+ * (`AGENT_CHAT_DURABLE_BACKGROUND`).
46
+ *
47
+ * DEFAULT-ON, matching the runtime gate (`isFlagEnabled` in
48
+ * durable-background.ts): unset/empty/unknown means enabled; an app opts OUT
49
+ * only with an explicit falsy value (`false`/`0`/`no`/`off`). This is what
50
+ * actually emits the 15-min `-background` function so the `_process-run`
51
+ * dispatch lands on it (async 202 → the worker runs with the real 15-min budget
52
+ * → its ~13-min soft-timeout fits). The deploy gate and runtime gate MUST agree:
53
+ * if the deploy emitted no `-background` function but the runtime still routed
54
+ * the worker into the ~13-min timeout regime, the worker would overshoot the
55
+ * ~60s synchronous wall and re-dispatch in a loop. (The runtime now also guards
56
+ * the ~13-min budget on the real function name via `isInBackgroundFunctionRuntime`,
57
+ * so a missing emit degrades to clean 40s-chunked runs rather than the loop.)
47
58
  */
48
59
  export declare function isDurableBackgroundDeployEnabled(): boolean;
49
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAOH,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AA4B7B,eAAO,MAAM,6BAA6B,UAiBzC,CAAC;AAuBF,wBAAgB,wCAAwC,CACtD,WAAW,EAAE,MAAM,EAAE,GACp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,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,UAAU,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
@@ -1230,15 +1230,26 @@ export function findInstalledResvgPackages(nodeModulesRoots) {
1230
1230
  /**
1231
1231
  * Deploy-time gate for emitting the second `-background` Netlify function.
1232
1232
  * Reads the same env flag the runtime gate uses
1233
- * (`AGENT_CHAT_DURABLE_BACKGROUND`). Off by default — when off, the deploy
1234
- * emits exactly one function (today's behavior, byte-for-byte).
1233
+ * (`AGENT_CHAT_DURABLE_BACKGROUND`).
1234
+ *
1235
+ * DEFAULT-ON, matching the runtime gate (`isFlagEnabled` in
1236
+ * durable-background.ts): unset/empty/unknown means enabled; an app opts OUT
1237
+ * only with an explicit falsy value (`false`/`0`/`no`/`off`). This is what
1238
+ * actually emits the 15-min `-background` function so the `_process-run`
1239
+ * dispatch lands on it (async 202 → the worker runs with the real 15-min budget
1240
+ * → its ~13-min soft-timeout fits). The deploy gate and runtime gate MUST agree:
1241
+ * if the deploy emitted no `-background` function but the runtime still routed
1242
+ * the worker into the ~13-min timeout regime, the worker would overshoot the
1243
+ * ~60s synchronous wall and re-dispatch in a loop. (The runtime now also guards
1244
+ * the ~13-min budget on the real function name via `isInBackgroundFunctionRuntime`,
1245
+ * so a missing emit degrades to clean 40s-chunked runs rather than the loop.)
1235
1246
  */
1236
1247
  export function isDurableBackgroundDeployEnabled() {
1237
1248
  const raw = process.env.AGENT_CHAT_DURABLE_BACKGROUND;
1238
1249
  if (raw == null)
1239
- return false;
1250
+ return true;
1240
1251
  const v = raw.trim().toLowerCase();
1241
- return v === "1" || v === "true" || v === "yes" || v === "on";
1252
+ return !(v === "0" || v === "false" || v === "no" || v === "off");
1242
1253
  }
1243
1254
  /**
1244
1255
  * Single-template Netlify build: emit a SECOND function whose name ends in
@@ -1686,11 +1697,12 @@ export default bundle;
1686
1697
  copyInstalledResvgPackages(nitro.options.output.serverDir);
1687
1698
  copyInstalledFfmpegStaticPackage(nitro.options.output.serverDir);
1688
1699
  }
1689
- // Durable background agent runs (off by default). Additive ONLY: emits a
1690
- // SECOND Netlify function whose name ends in `-background` re-exporting the
1691
- // same handler bundle, so the chat `_process-run` POST lands on Netlify's
1692
- // async (15-min) function. When the flag is off this is a no-op and the
1693
- // single-function deploy is byte-for-byte unchanged.
1700
+ // Durable background agent runs (default-ON; opt out with a falsy
1701
+ // AGENT_CHAT_DURABLE_BACKGROUND). Additive ONLY: emits a SECOND Netlify
1702
+ // function whose name ends in `-background` re-exporting the same handler
1703
+ // bundle, so the chat `_process-run` POST lands on Netlify's async (15-min)
1704
+ // function. When explicitly opted out this is a no-op and the single-function
1705
+ // deploy is byte-for-byte unchanged.
1694
1706
  if (preset === "netlify" && isDurableBackgroundDeployEnabled()) {
1695
1707
  try {
1696
1708
  emitSingleTemplateNetlifyBackgroundFunction(cwd);