@netlify/agent-runner-cli 1.133.0-ex-2327.3 → 1.133.0-run-2989.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,12 +1,12 @@
1
- import{spawnSync as w}from"child_process";import{existsSync as I,readdirSync as A,readFileSync as N,statSync as E,writeFileSync as x,mkdirSync as F}from"fs";import{createRequire as v}from"module";import i from"path";import e from"process";var L=".axis-scaffold-skip-install",S=v(import.meta.url);function b(){let t=S("@netlify/ts-cli/package.json"),n=i.dirname(S.resolve("@netlify/ts-cli/package.json"));return i.join(n,t.bin)}function C(t){let n=t.slice(2),s=n[0];(!s||s.startsWith("--"))&&(console.error("Usage: scaffold.js <template-id> [--package-manager npm|pnpm|yarn]"),e.exit(1));let o=n.indexOf("--package-manager"),r=o!==-1?n[o+1]??"":"";return{templateId:s,packageManager:r}}var $=new Set(["node_modules",".git",".netlify",".claude",".next","dist","build",".cache"]),T=["package.json","app.config.ts","app.config.js","vite.config.ts","vite.config.js","next.config.ts","next.config.js","next.config.mjs","remix.config.js","nuxt.config.ts","app/routes/__root.tsx","app/routes/__root.jsx","app/root.tsx","app/root.jsx","src/main.tsx","src/main.ts","src/App.tsx","app/layout.tsx","pages/_app.tsx"],D=4,j=1e4;function M(t){let n=[];for(let s of T){if(n.length>=D)break;let o=i.join(t,s);try{if(!I(o))continue;let r=N(o,"utf8");n.push({filePath:s,content:r.length>j?r.slice(0,j)+`
2
- \u2026 (truncated)`:r})}catch{}}return n}function O(t,n=4){let s=[];function o(r,a){if(a>n)return;let f;try{f=A(r).sort()}catch{return}for(let m of f){if($.has(m))continue;let p=i.join(r,m),y=i.relative(t,p),h;try{h=E(p).isDirectory()}catch{continue}h?(s.push(y+"/"),o(p,a+1)):s.push(y)}}return o(t,0),s.join(`
1
+ import{spawnSync as w}from"child_process";import{existsSync as I,readdirSync as A,readFileSync as N,statSync as E,writeFileSync as x,mkdirSync as F}from"fs";import{createRequire as v}from"module";import i from"path";import e from"process";var L=".axis-scaffold-skip-install",S=v(import.meta.url);function C(){let t=S("@netlify/ts-cli/package.json"),n=i.dirname(S.resolve("@netlify/ts-cli/package.json"));return i.join(n,t.bin)}function $(t){let n=t.slice(2),s=n[0];(!s||s.startsWith("--"))&&(console.error("Usage: scaffold.js <template-id> [--package-manager npm|pnpm|yarn]"),e.exit(1));let o=n.indexOf("--package-manager"),r=o!==-1?n[o+1]??"":"";return{templateId:s,packageManager:r}}var b=new Set(["node_modules",".git",".netlify",".claude",".next","dist","build",".cache"]),T=["package.json","app.config.ts","app.config.js","vite.config.ts","vite.config.js","next.config.ts","next.config.js","next.config.mjs","remix.config.js","nuxt.config.ts","app/routes/__root.tsx","app/routes/__root.jsx","app/root.tsx","app/root.jsx","src/main.tsx","src/main.ts","src/App.tsx","app/layout.tsx","pages/_app.tsx"],D=4,j=1e4;function M(t){let n=[];for(let s of T){if(n.length>=D)break;let o=i.join(t,s);try{if(!I(o))continue;let r=N(o,"utf8");n.push({filePath:s,content:r.length>j?r.slice(0,j)+`
2
+ \u2026 (truncated)`:r})}catch{}}return n}function O(t,n=4){let s=[];function o(r,a){if(a>n)return;let f;try{f=A(r).sort()}catch{return}for(let m of f){if(b.has(m))continue;let p=i.join(r,m),y=i.relative(t,p),h=!1;try{h=E(p).isDirectory()}catch{continue}h?(s.push(y+"/"),o(p,a+1)):s.push(y)}}return o(t,0),s.join(`
3
3
  `)}function P(t){let n=O(t),s=M(t),o=a=>i.extname(a).slice(1)||"text";return["## File tree\n\n```\n"+n+"\n```",...s.map(({filePath:a,content:f})=>`## ${a}
4
4
 
5
5
  \`\`\`${o(a)}
6
6
  ${f}
7
7
  \`\`\``)].join(`
8
8
 
9
- `)}var{templateId:l,packageManager:g}=C(e.argv),K=b(),B=e.env.NVM_BIN?`${e.env.NVM_BIN}/node`:"node",d=[K,"--target-dir","./","--no-git","--json","--add-ons",l];g&&d.push("--package-manager",g);var k=e.env.AXIS_WORKSPACE,R=k!==void 0&&I(i.join(k,L));(e.env.NETLIFY_SCAFFOLD_NO_INSTALL==="1"||R)&&d.push("--no-install");var c=w(B,d,{stdio:["inherit","pipe","inherit"],encoding:"utf8"});c.status!==0&&(c.stdout&&e.stdout.write(c.stdout),e.exit(c.status??1));var u;try{u=JSON.parse(c.stdout)?.starter?.framework}catch{c.stdout&&e.stdout.write(c.stdout)}var Y={template:l,packageManager:g},_=u?` (${u})`:"";try{F(i.join(e.cwd(),".netlify"),{recursive:!0}),x(i.join(e.cwd(),".netlify","scaffold-result.json"),JSON.stringify(Y));let t=P(e.cwd());x(i.join(e.cwd(),".netlify","scaffold-tree.md"),t),console.log(`\u2713 Scaffolded "${l}" template${_}.
9
+ `)}var{templateId:l,packageManager:g}=$(e.argv),K=C(),B=e.env.NVM_BIN?`${e.env.NVM_BIN}/node`:"node",d=[K,"--target-dir","./","--no-git","--json","--add-ons",l];g&&d.push("--package-manager",g);var k=e.env.AXIS_WORKSPACE,R=k!==void 0&&I(i.join(k,L));(e.env.NETLIFY_SCAFFOLD_NO_INSTALL==="1"||R)&&d.push("--no-install");var c=w(B,d,{stdio:["inherit","pipe","inherit"],encoding:"utf8"});c.status!==0&&(c.stdout&&e.stdout.write(c.stdout),e.exit(c.status??1));var u;try{u=JSON.parse(c.stdout)?.starter?.framework}catch{c.stdout&&e.stdout.write(c.stdout)}var Y={template:l,packageManager:g},_=u?` (${u})`:"";try{F(i.join(e.cwd(),".netlify"),{recursive:!0}),x(i.join(e.cwd(),".netlify","scaffold-result.json"),JSON.stringify(Y));let t=P(e.cwd());x(i.join(e.cwd(),".netlify","scaffold-tree.md"),t),console.log(`\u2713 Scaffolded "${l}" template${_}.
10
10
  Bootstrap context written to .netlify/scaffold-tree.md \u2014 read that file now.
11
11
  It contains the complete file tree and the contents of key project files.
12
12
  Do not run ls, find, or read any other files before starting \u2014 everything you need is in that file.`)}catch{console.log(`\u2713 Scaffolded "${l}" template${_}.`)}
@@ -109,7 +109,6 @@ export const config: Config = {
109
109
  | `preferStatic` | `boolean` | If `true`, static file takes precedence over function |
110
110
  | `method` | `string \| string[]` | HTTP method(s) to match (`GET`, `POST`, etc.) |
111
111
  | `schedule` | `string` | Cron expression for scheduled functions |
112
- | `background` | `boolean` | If `true`, run in background mode (fire-and-forget) |
113
112
 
114
113
  `path` and `excludedPath` support substring patterns or the URLPattern syntax from the web platform.
115
114
 
@@ -262,11 +261,11 @@ Returns `null` outside a function invocation.
262
261
  Background functions operate the same as standard serverless functions and are syntactically the same. They run for up
263
262
  to 15 minutes without blocking the client. The client receives an immediate 202 response.
264
263
 
265
- Enable background mode by setting `background: true` in the function's config:
264
+ **Naming convention:** Append `-background` to the filename.
266
265
 
267
266
  ```typescript
268
- // netlify/functions/process-data.mts
269
- import type { Config, Context } from '@netlify/functions'
267
+ // netlify/functions/process-data-background.mts
268
+ import type { Context } from '@netlify/functions'
270
269
 
271
270
  export default async (req: Request, context: Context) => {
272
271
  const data = await req.json()
@@ -278,14 +277,10 @@ export default async (req: Request, context: Context) => {
278
277
 
279
278
  // Return value is ignored - client already received 202
280
279
  }
281
-
282
- export const config: Config = {
283
- background: true,
284
- }
285
280
  ```
286
281
 
287
282
  ```javascript
288
- // netlify/functions/process-data.mjs
283
+ // netlify/functions/process-data-background.mjs
289
284
  export default async (req, context) => {
290
285
  const data = await req.json()
291
286
 
@@ -293,10 +288,6 @@ export default async (req, context) => {
293
288
  await processItem(item)
294
289
  }
295
290
  }
296
-
297
- export const config = {
298
- background: true,
299
- }
300
291
  ```
301
292
 
302
293
  **Key behavior:**
@@ -304,14 +295,15 @@ export const config = {
304
295
  - Function continues executing for up to 15 minutes
305
296
  - Response body is ignored
306
297
  - No streaming support
307
- - Cannot use `config.schedule`
298
+ - Cannot use `config.path` or `config.schedule`
308
299
  - Retry logic: first retry after 1 minute, second retry after 2 minutes on failure
309
300
  - Any data background functions produce should be stored in Netlify Blobs or a database
310
301
 
311
- **Legacy filename convention:** Naming the file with a `-background` suffix (e.g., `process-data-background.mts`) is still
312
- supported and continues to work. New functions should prefer the `config.background` property above.
302
+ **Valid background function paths:**
303
+ - `netlify/functions/hello-background.mts`
304
+ - `netlify/functions/hello-background/index.mts`
313
305
 
314
- Invoke like any function: `POST /.netlify/functions/process-data` (or use the `path` config property).
306
+ Invoke like any function: `POST /.netlify/functions/process-data-background`
315
307
 
316
308
  ## Scheduled Functions
317
309
 
@@ -393,30 +385,6 @@ schedule = "@daily"
393
385
  netlify functions:invoke daily-cleanup
394
386
  ```
395
387
 
396
- ## Region
397
-
398
- Functions deploy to `cmh` (Ohio) by default. This is a deliberate choice: US East is centrally located for an international audience, has a broad provider ecosystem, and gives most projects the lowest overall latency without any configuration.
399
-
400
- Do NOT override `config.region` unless the user has stated a specific reason — for example, a database or backend service in another region with measurable roundtrip savings, a data-residency requirement, or an audience concentrated in one region whose compute dependencies (database, backend services) also live in that region.
401
-
402
- Two constraints to be aware of before adding `config.region`:
403
-
404
- - A function runs in exactly one region. Don't try to deploy the same function to multiple regions — if the user wants geo-routing, route between distinct functions with an edge function instead.
405
- - For framework adapter–generated functions (Next.js, Astro, Nuxt, etc.) the region must be set site-wide in the Netlify UI, not via `config.region` in code. The generated files can't carry per-function config.
406
-
407
- See [Region](https://docs.netlify.com/build/functions/configuration#region) for the full list of supported regions and details.
408
-
409
- ## Memory or vCPU
410
-
411
- Functions run with 1024 MB of memory and a proportional amount of compute by default. The default fits most workloads, and raising it has a direct cost impact: function billing scales linearly with the configured size.
412
-
413
- Do NOT set `config.memory` or `config.vcpu` speculatively. Only reach for them when:
414
-
415
- - The workload is known to be memory- or compute-intensive (AI inference, image/PDF manipulation, large payload processing, CPU-bound work).
416
- - The function is hitting out-of-memory errors or timeouts caused by the function's own work, rather than by waiting on an external service or database.
417
-
418
- `memory` and `vcpu` configure the same underlying resource and are mutually exclusive — set one, not both. See [Memory or vCPU](https://docs.netlify.com/build/functions/configuration#memory-or-vcpu) for accepted values and the exact mapping.
419
-
420
388
  ## Response Streaming
421
389
 
422
390
  Synchronous functions can stream responses for large payloads (up to 20 MB):
@@ -437,70 +405,6 @@ export default async (req: Request) => {
437
405
  }
438
406
  ```
439
407
 
440
- ## Event Handlers
441
-
442
- A function can subscribe to platform events by exporting an object instead of a function as its default. Each event has
443
- a named handler property.
444
-
445
- ```typescript
446
- import type { DeploySucceededEvent, UserSignupEvent } from '@netlify/functions'
447
-
448
- export default {
449
- deploySucceeded(event: DeploySucceededEvent) {
450
- console.log(`Deploy ${event.deploy.id} succeeded`)
451
- },
452
-
453
- userSignup(event: UserSignupEvent) {
454
- return {
455
- user: {
456
- ...event.user,
457
- appMetadata: { ...event.user.appMetadata, roles: ['member'] },
458
- },
459
- }
460
- },
461
- }
462
- ```
463
-
464
- A single function can declare multiple handlers; multiple functions can also subscribe to the same event — both will run.
465
-
466
- The default export can also be an object with a `fetch` method instead of a bare function. Prefer the bare default export shown in [Handler Signature](#handler-signature); reach for the object form only if (1) other functions in the project already use it, or (2) the same function handles HTTP requests AND subscribes to one or more platform events:
467
-
468
- ```typescript
469
- export default {
470
- fetch(req: Request, context: Context) {
471
- return new Response('Hello')
472
- },
473
- }
474
- ```
475
-
476
- **Available handlers:**
477
-
478
- | Handler | Trigger |
479
- |---|---|
480
- | `fetch` | HTTP request (equivalent to a bare function default export) |
481
- | `deployBuilding`, `deploySucceeded`, `deployFailed`, `deployDeleted`, `deployLocked`, `deployUnlocked` | Deploy lifecycle |
482
- | `userSignup`, `userLogin`, `userValidate`, `userModified`, `userDeleted` | Identity lifecycle |
483
- | `formSubmitted` | Form submission verified |
484
-
485
- ### Identity handlers: deny an action
486
-
487
- `userSignup`, `userLogin`, `userValidate`, and `userModified` can reject the action by calling `event.deny()`. The end user
488
- receives a 401. Do NOT throw — `event.deny()` is the canonical denial mechanism and does not produce an error in observability.
489
-
490
- ```typescript
491
- import type { UserLoginEvent } from '@netlify/functions'
492
-
493
- export default {
494
- userLogin(event: UserLoginEvent) {
495
- if (!event.user.email?.endsWith('@example.com')) {
496
- return event.deny()
497
- }
498
- },
499
- }
500
- ```
501
-
502
- If multiple functions subscribe to the same event, the first to call `event.deny()` aborts the chain.
503
-
504
408
  ## Limits
505
409
 
506
410
  | Resource | Limit |
@@ -514,6 +418,8 @@ If multiple functions subscribe to the same event, the first to call `event.deny
514
418
  | Streaming response payload | 20 MB |
515
419
  | Functions per site | Unlimited |
516
420
 
421
+ **Default deployment region:** `us-east-2` (configurable on Pro/Enterprise plans)
422
+
517
423
  ## Common Errors & Solutions
518
424
 
519
425
  ### "Function not found" (404)
@@ -404,69 +404,46 @@ TanStack Start, and SvelteKit. Remix `redirect()` is safe because Remix actions
404
404
 
405
405
  ## Identity Event Functions
406
406
 
407
- Subscribe to Identity lifecycle events by exporting an object whose properties are named event handlers. See the
408
- **netlify-functions** skill for the full event-handler pattern.
407
+ Special serverless functions that trigger on Identity lifecycle events. These use the **legacy named `handler` export**
408
+ (not the modern default export) because they receive `event.body` containing the user payload.
409
409
 
410
- **Available identity handlers:**
410
+ Always use the legacy named `handler` export (not default export) for Identity event functions. The filename must match
411
+ the event name exactly (e.g., `netlify/functions/identity-signup.mts`).
411
412
 
412
- | Handler | Trigger |
413
- |---|---|
414
- | `userValidate` | A user attempts to sign up. Can deny the signup. |
415
- | `userSignup` | A user completes signup. Can deny or mutate. |
416
- | `userLogin` | A user logs in. Can deny or mutate. |
417
- | `userModified` | A user's profile is updated. Can deny or mutate. |
418
- | `userDeleted` | A user is deleted. Notification only. |
413
+ **Event names:** `identity-validate`, `identity-signup`, `identity-login`
419
414
 
420
- Each handler receives a typed event with a parsed `user` object (camelCase fields: `appMetadata`, `userMetadata`,
421
- `confirmedAt`, etc.).
415
+ - `identity-signup` - fires when a new user signs up (email/password or OAuth)
416
+ - `identity-login` - fires on each login
417
+ - `identity-validate` - fires during signup before the user is created; return a non-200 status to reject
422
418
 
423
419
  ### Example: Assign Default Role on Signup
424
420
 
425
- Return `{ user: ... }` to substitute the user record before it's persisted.
426
-
427
421
  ```typescript
428
- // netlify/functions/identity.mts
429
- import type { UserSignupEvent } from '@netlify/functions'
430
-
431
- export default {
432
- userSignup(event: UserSignupEvent) {
433
- return {
434
- user: {
435
- ...event.user,
436
- appMetadata: {
437
- ...event.user.appMetadata,
438
- roles: ['member'],
439
- },
422
+ // netlify/functions/identity-signup.mts
423
+ import type { Handler, HandlerEvent, HandlerContext } from '@netlify/functions'
424
+
425
+ const handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {
426
+ const { user } = JSON.parse(event.body || '{}')
427
+
428
+ return {
429
+ statusCode: 200,
430
+ body: JSON.stringify({
431
+ app_metadata: {
432
+ ...user.app_metadata,
433
+ roles: ['member'],
440
434
  },
441
- }
442
- },
435
+ }),
436
+ }
443
437
  }
444
- ```
445
-
446
- ### Deny an Action
447
-
448
- Call `event.deny()` to reject a signup, login, validation, or modification. The end user receives a 401. Do NOT throw —
449
- `event.deny()` is the canonical denial mechanism and does not produce an error in observability.
450
438
 
451
- ```typescript
452
- import type { UserValidateEvent } from '@netlify/functions'
453
-
454
- export default {
455
- userValidate(event: UserValidateEvent) {
456
- if (!event.user.email?.endsWith('@example.com')) {
457
- return event.deny()
458
- }
459
- },
460
- }
439
+ export { handler }
461
440
  ```
462
441
 
463
- If multiple functions subscribe to the same event, the first to call `event.deny()` aborts the chain.
464
-
465
- For bulk user management or role changes outside lifecycle events, use the `admin` API instead of Identity event functions.
442
+ The response body replaces `app_metadata` and/or `user_metadata` on the user record - include all fields you want to
443
+ keep, not just new ones.
466
444
 
467
- **Legacy filename convention:** The previous syntax files named `identity-validate.ts`, `identity-signup.ts`, or
468
- `identity-login.ts` (with a `-background` suffix for background mode), exporting `handler` and signaling denial via a
469
- non-2xx response — still works. New functions should prefer the typed handler syntax above.
445
+ For bulk user management or role changes outside lifecycle events, use the `admin` API instead of Identity event
446
+ functions.
470
447
 
471
448
  ## Roles and Authorization
472
449
 
@@ -479,7 +456,7 @@ The first admin user cannot be created through code alone. You must direct the u
479
456
  3. After the user accepts the invite, click the user in the Identity list to open their detail page
480
457
  4. In the **Roles** field, add the `admin` role and save
481
458
 
482
- Once the first admin exists, subsequent users can be managed programmatically using Identity event functions (e.g., assigning roles in the `userSignup` handler) or role-based redirects.
459
+ Once the first admin exists, subsequent users can be managed programmatically using Identity event functions (e.g., assigning roles in `identity-signup`) or role-based redirects.
483
460
 
484
461
  ### Metadata Types
485
462
 
@@ -565,15 +542,13 @@ if (newToken) {
565
542
 
566
543
  ### Identity event function not triggering
567
544
 
568
- **Cause:** Export shape does not match the expected pattern.
545
+ **Cause:** Filename or export format does not match expected convention.
569
546
 
570
547
  **Fix:**
571
548
 
572
- 1. Use the typed handler syntax: default export an object with `userSignup`, `userLogin`, `userValidate`, `userModified`,
573
- or `userDeleted` methods
574
- 2. Place the function in `netlify/functions/` with `.mts` or `.mjs` extension
575
- 3. If using the legacy filename convention, verify the filename matches the event exactly (`identity-signup.mts`,
576
- `identity-validate.mts`, or `identity-login.mts`) and that the file exports a named `handler`
549
+ 1. Verify filename matches exactly: `identity-signup`, `identity-validate`, or `identity-login`
550
+ 2. Place in `netlify/functions/` with `.mts` or `.mjs` extension
551
+ 3. Use named `handler` export (not default export)
577
552
 
578
553
  ### `MissingIdentityError`
579
554
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/agent-runner-cli",
3
3
  "type": "module",
4
- "version": "1.133.0-ex-2327.3",
4
+ "version": "1.133.0-run-2989.0",
5
5
  "description": "CLI tool for running Netlify agents",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -41,6 +41,7 @@
41
41
  "test:integration:claude": "vitest run test/integration/claude.test.ts",
42
42
  "test:integration:gemini": "vitest run test/integration/gemini.test.ts",
43
43
  "test:integration:skill-invocation": "vitest run test/integration/skill-invocation.test.ts",
44
+ "test:integration:feature-enablement": "vitest run test/integration/feature-enablement.test.ts",
44
45
  "check:types": "tsc --noEmit",
45
46
  "postinstall": "node scripts/postinstall.js"
46
47
  },
@@ -58,15 +59,14 @@
58
59
  "@commitlint/cli": "^20.0.0",
59
60
  "@commitlint/config-conventional": "^20.0.0",
60
61
  "@eslint/compat": "^2.0.0",
61
- "@eslint/js": "^10.0.1",
62
- "@netlify/axis": "^1.17.0",
62
+ "@eslint/js": "^9.35.0",
63
+ "@netlify/axis": "^1.15.0",
63
64
  "@netlify/eslint-config-node": "^7.0.1",
64
65
  "@types/node": "^24.5.0",
65
66
  "@typescript-eslint/eslint-plugin": "^8.0.0",
66
67
  "@typescript-eslint/parser": "^8.0.0",
67
68
  "@vitest/coverage-v8": "^4.1.5",
68
69
  "@vitest/eslint-plugin": "^1.6.6",
69
- "eslint": "^10.5.0",
70
70
  "eslint-config-prettier": "^10.1.8",
71
71
  "eslint-plugin-n": "^17.0.0",
72
72
  "husky": "^9.0.0",
@@ -90,6 +90,7 @@
90
90
  "execa": "^9.6.1",
91
91
  "fastify": "5.8.5",
92
92
  "minimist": "^1.2.8",
93
- "openai": "6.34.0"
93
+ "openai": "6.34.0",
94
+ "opencode-ai": "^1.17.9"
94
95
  }
95
96
  }