@agent-native/core 0.75.0 → 0.75.1

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.
Files changed (31) hide show
  1. package/corpus/core/CHANGELOG.md +16 -0
  2. package/corpus/core/package.json +1 -1
  3. package/corpus/core/src/agent/durable-background.ts +15 -3
  4. package/corpus/core/src/cli/skills.ts +15 -11
  5. package/corpus/core/src/deploy/build.ts +33 -10
  6. package/corpus/core/src/templates/default/_gitignore +1 -0
  7. package/corpus/core/src/templates/headless/_gitignore +1 -0
  8. package/corpus/core/src/templates/workspace-root/_gitignore +1 -0
  9. package/corpus/templates/clips/actions/list-recordings.ts +21 -0
  10. package/corpus/templates/clips/app/components/library/library-layout.tsx +21 -2
  11. package/corpus/templates/clips/app/hooks/use-library.ts +18 -0
  12. package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +7 -5
  13. package/dist/agent/durable-background.d.ts +7 -3
  14. package/dist/agent/durable-background.d.ts.map +1 -1
  15. package/dist/agent/durable-background.js +13 -3
  16. package/dist/agent/durable-background.js.map +1 -1
  17. package/dist/cli/skills.d.ts +1 -1
  18. package/dist/cli/skills.d.ts.map +1 -1
  19. package/dist/cli/skills.js +15 -11
  20. package/dist/cli/skills.js.map +1 -1
  21. package/dist/deploy/build.d.ts +14 -9
  22. package/dist/deploy/build.d.ts.map +1 -1
  23. package/dist/deploy/build.js +33 -10
  24. package/dist/deploy/build.js.map +1 -1
  25. package/dist/templates/default/_gitignore +1 -0
  26. package/dist/templates/headless/_gitignore +1 -0
  27. package/dist/templates/workspace-root/_gitignore +1 -0
  28. package/package.json +1 -1
  29. package/src/templates/default/_gitignore +1 -0
  30. package/src/templates/headless/_gitignore +1 -0
  31. package/src/templates/workspace-root/_gitignore +1 -0
@@ -68,15 +68,20 @@ export declare function isDurableBackgroundDeployEnabled(): boolean;
68
68
  * that directory to a sibling `<...>-background` function and write an entry
69
69
  * with a `config.path` of the process-run route.
70
70
  *
71
- * ⚠️ REAL-DEPLOY VERIFICATION REQUIRED. Whether Netlify routes
72
- * `/_agent-native/agent-chat/_process-run` to this `-background` function (and
73
- * invokes it asynchronously with the 15-min budget) vs the synchronous Nitro
74
- * function cannot be verified in this environment Nitro owns the primary
75
- * function's routing manifest, and the precedence between the two functions for
76
- * that path is a Netlify runtime behavior. If routing resolves to the
77
- * synchronous function, the run still completes via the existing 40s
78
- * soft-timeout path (no durable win, no regression). See
79
- * docs/design/durable-agent-runs.md (Open risks #1).
71
+ * The function declares `background: true` so Netlify invokes it ASYNC (HTTP
72
+ * 202 ack) with the 15-min budget, and a `config.path` of the process-run route
73
+ * so the `_process-run` self-dispatch lands on it. The earlier version set the
74
+ * path but omitted `background: true` and relied on the legacy `-background`
75
+ * filename which the `config` object overrides so Netlify served it
76
+ * SYNCHRONOUSLY (~60s) and the durable worker never got the 15-min budget
77
+ * (confirmed live: a POST to the process-run path returned a synchronous 401
78
+ * from the handler instead of a 202 async ack).
79
+ *
80
+ * ⚠️ One Netlify runtime behavior still resolves only on a real deploy: the
81
+ * routing precedence between this function's `config.path` and Nitro's catch-all
82
+ * for that exact path. If the catch-all wins, the run still completes via the
83
+ * 40s soft-timeout path on the sync function (no durable win, no regression).
84
+ * See docs/design/durable-agent-runs.md (Open risks #1).
80
85
  */
81
86
  export declare function emitSingleTemplateNetlifyBackgroundFunction(projectCwd: string): void;
82
87
  /**
@@ -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,GACpB,MAAM,CAaR;AAgBD,K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AAE,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"}
@@ -1262,15 +1262,20 @@ export function isDurableBackgroundDeployEnabled() {
1262
1262
  * that directory to a sibling `<...>-background` function and write an entry
1263
1263
  * with a `config.path` of the process-run route.
1264
1264
  *
1265
- * ⚠️ REAL-DEPLOY VERIFICATION REQUIRED. Whether Netlify routes
1266
- * `/_agent-native/agent-chat/_process-run` to this `-background` function (and
1267
- * invokes it asynchronously with the 15-min budget) vs the synchronous Nitro
1268
- * function cannot be verified in this environment Nitro owns the primary
1269
- * function's routing manifest, and the precedence between the two functions for
1270
- * that path is a Netlify runtime behavior. If routing resolves to the
1271
- * synchronous function, the run still completes via the existing 40s
1272
- * soft-timeout path (no durable win, no regression). See
1273
- * docs/design/durable-agent-runs.md (Open risks #1).
1265
+ * The function declares `background: true` so Netlify invokes it ASYNC (HTTP
1266
+ * 202 ack) with the 15-min budget, and a `config.path` of the process-run route
1267
+ * so the `_process-run` self-dispatch lands on it. The earlier version set the
1268
+ * path but omitted `background: true` and relied on the legacy `-background`
1269
+ * filename which the `config` object overrides so Netlify served it
1270
+ * SYNCHRONOUSLY (~60s) and the durable worker never got the 15-min budget
1271
+ * (confirmed live: a POST to the process-run path returned a synchronous 401
1272
+ * from the handler instead of a 202 async ack).
1273
+ *
1274
+ * ⚠️ One Netlify runtime behavior still resolves only on a real deploy: the
1275
+ * routing precedence between this function's `config.path` and Nitro's catch-all
1276
+ * for that exact path. If the catch-all wins, the run still completes via the
1277
+ * 40s soft-timeout path on the sync function (no durable win, no regression).
1278
+ * See docs/design/durable-agent-runs.md (Open risks #1).
1274
1279
  */
1275
1280
  export function emitSingleTemplateNetlifyBackgroundFunction(projectCwd) {
1276
1281
  const functionsDir = path.join(projectCwd, ".netlify", "functions-internal");
@@ -1288,7 +1293,16 @@ export function emitSingleTemplateNetlifyBackgroundFunction(projectCwd) {
1288
1293
  copyDir(serverDir, dest);
1289
1294
  // Drop the original Nitro entry so our background entry is the entrypoint.
1290
1295
  fs.rmSync(path.join(dest, "server.mjs"), { force: true });
1291
- const entry = `let cachedHandler;
1296
+ const entry = `// Mark this isolate as the durable background runtime BEFORE the handler
1297
+ // bundle is imported, so isInBackgroundFunctionRuntime() reliably returns true
1298
+ // in this function. The deployed Lambda name is NOT guaranteed to end in
1299
+ // "-background" (Netlify may mangle/prefix it), so we cannot depend on
1300
+ // AWS_LAMBDA_FUNCTION_NAME alone. A globalThis flag (NOT process.env) avoids the
1301
+ // no-env-mutation guard and carries no cross-request state — it is a static,
1302
+ // set-once isolate marker read back by isInBackgroundFunctionRuntime().
1303
+ globalThis.__AGENT_NATIVE_BACKGROUND_RUNTIME__ = true;
1304
+
1305
+ let cachedHandler;
1292
1306
 
1293
1307
  export default async function handler(...args) {
1294
1308
  cachedHandler ??= (await import("./main.mjs")).default;
@@ -1298,6 +1312,15 @@ export default async function handler(...args) {
1298
1312
  export const config = {
1299
1313
  name: "agent background handler",
1300
1314
  generator: "agent-native build",
1315
+ // background: true is what actually makes Netlify invoke this ASYNCHRONOUSLY
1316
+ // (immediate HTTP 202 ack) with the 15-minute budget. Without it, a function
1317
+ // that declares a custom \`path\` is served SYNCHRONOUSLY (~60s) even when its
1318
+ // file name ends in "-background" — the \`config\` object overrides the legacy
1319
+ // filename convention. That omission is why the durable worker was capped at
1320
+ // ~60s in prod (verified live: POST to the process-run path returned a
1321
+ // synchronous 401 from the handler, not a 202 async ack). See Netlify docs:
1322
+ // build/functions/background-functions + build/functions/configuration.
1323
+ background: true,
1301
1324
  path: ${JSON.stringify([AGENT_CHAT_PROCESS_RUN_PATH])},
1302
1325
  nodeBundler: "none",
1303
1326
  includedFiles: ["**"],