@sanity/runtime-cli 17.21.0-next.gb3fb310 → 17.21.1-next.g0cb67b7

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.
package/README.md CHANGED
@@ -90,7 +90,7 @@ EXAMPLES
90
90
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
91
91
  ```
92
92
 
93
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/add.ts)_
94
94
 
95
95
  ## `sanity-run blueprints config`
96
96
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/config.ts)_
131
131
 
132
132
  ## `sanity-run blueprints deploy`
133
133
 
@@ -183,7 +183,7 @@ EXAMPLES
183
183
  $ sanity-run blueprints deploy --new-stack-name <new-name>
184
184
  ```
185
185
 
186
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/deploy.ts)_
186
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/deploy.ts)_
187
187
 
188
188
  ## `sanity-run blueprints destroy`
189
189
 
@@ -221,7 +221,7 @@ EXAMPLES
221
221
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
222
222
  ```
223
223
 
224
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/destroy.ts)_
224
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/destroy.ts)_
225
225
 
226
226
  ## `sanity-run blueprints doctor`
227
227
 
@@ -253,7 +253,7 @@ EXAMPLES
253
253
  $ sanity-run blueprints doctor --fix
254
254
  ```
255
255
 
256
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/doctor.ts)_
256
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/doctor.ts)_
257
257
 
258
258
  ## `sanity-run blueprints info`
259
259
 
@@ -291,7 +291,7 @@ EXAMPLES
291
291
  $ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
292
292
  ```
293
293
 
294
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/info.ts)_
294
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/info.ts)_
295
295
 
296
296
  ## `sanity-run blueprints init [DIR]`
297
297
 
@@ -355,7 +355,7 @@ EXAMPLES
355
355
  $ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
356
356
  ```
357
357
 
358
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/init.ts)_
358
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/init.ts)_
359
359
 
360
360
  ## `sanity-run blueprints logs`
361
361
 
@@ -401,7 +401,7 @@ EXAMPLES
401
401
  $ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
402
402
  ```
403
403
 
404
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/logs.ts)_
404
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/logs.ts)_
405
405
 
406
406
  ## `sanity-run blueprints mint-deploy-token`
407
407
 
@@ -446,7 +446,7 @@ EXAMPLES
446
446
  $ sanity-run blueprints mint-deploy-token --organization-id <orgId>
447
447
  ```
448
448
 
449
- _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/mint-deploy-token.ts)_
449
+ _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/mint-deploy-token.ts)_
450
450
 
451
451
  ## `sanity-run blueprints plan`
452
452
 
@@ -479,7 +479,7 @@ EXAMPLES
479
479
  $ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
480
480
  ```
481
481
 
482
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/plan.ts)_
482
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/plan.ts)_
483
483
 
484
484
  ## `sanity-run blueprints promote`
485
485
 
@@ -515,7 +515,7 @@ EXAMPLES
515
515
  $ sanity-run blueprints promote --new-stack-name <new-name>
516
516
  ```
517
517
 
518
- _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/promote.ts)_
518
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/promote.ts)_
519
519
 
520
520
  ## `sanity-run blueprints stacks`
521
521
 
@@ -556,7 +556,7 @@ EXAMPLES
556
556
  $ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
557
557
  ```
558
558
 
559
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/blueprints/stacks.ts)_
559
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/blueprints/stacks.ts)_
560
560
 
561
561
  ## `sanity-run functions add`
562
562
 
@@ -608,7 +608,7 @@ EXAMPLES
608
608
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
609
609
  ```
610
610
 
611
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/add.ts)_
611
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/add.ts)_
612
612
 
613
613
  ## `sanity-run functions dev`
614
614
 
@@ -643,7 +643,7 @@ EXAMPLES
643
643
  $ sanity-run functions dev --timeout 60
644
644
  ```
645
645
 
646
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/dev.ts)_
646
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/dev.ts)_
647
647
 
648
648
  ## `sanity-run functions env add NAME KEY VALUE`
649
649
 
@@ -676,7 +676,7 @@ EXAMPLES
676
676
  $ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
677
677
  ```
678
678
 
679
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/env/add.ts)_
679
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/env/add.ts)_
680
680
 
681
681
  ## `sanity-run functions env list NAME`
682
682
 
@@ -706,7 +706,7 @@ EXAMPLES
706
706
  $ sanity-run functions env list --stack <name-or-id> MyFunction
707
707
  ```
708
708
 
709
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/env/list.ts)_
709
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/env/list.ts)_
710
710
 
711
711
  ## `sanity-run functions env remove NAME KEY`
712
712
 
@@ -738,7 +738,7 @@ EXAMPLES
738
738
  $ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
739
739
  ```
740
740
 
741
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/env/remove.ts)_
741
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/env/remove.ts)_
742
742
 
743
743
  ## `sanity-run functions logs [NAME]`
744
744
 
@@ -778,7 +778,7 @@ EXAMPLES
778
778
  $ sanity-run functions logs <name> --delete
779
779
  ```
780
780
 
781
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/logs.ts)_
781
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/logs.ts)_
782
782
 
783
783
  ## `sanity-run functions test [NAME]`
784
784
 
@@ -836,7 +836,7 @@ EXAMPLES
836
836
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
837
837
  ```
838
838
 
839
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.0-next.gb3fb310/src/commands/functions/test.ts)_
839
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.1-next.g0cb67b7/src/commands/functions/test.ts)_
840
840
 
841
841
  ## `sanity-run help [COMMAND]`
842
842
 
@@ -12,9 +12,14 @@ export async function functionEnvListCore(options) {
12
12
  spinner.stop();
13
13
  return { success: false, error: result.error || 'Unknown error' };
14
14
  }
15
- spinner.succeed(`Environment variables for "${args.name}"`);
16
- for (const key of result.envvars) {
17
- options.log(key);
15
+ if (result.envvars.length > 0) {
16
+ spinner.succeed(`Environment variables for "${args.name}"`);
17
+ for (const key of result.envvars) {
18
+ options.log(key);
19
+ }
20
+ }
21
+ else {
22
+ spinner.succeed(`"${args.name}" has no configured environment variables`);
18
23
  }
19
24
  return { success: true, json: { name: args.name, envvars: result.envvars } };
20
25
  }
@@ -0,0 +1,6 @@
1
+ import type { Hook } from '@oclif/core';
2
+ /**
3
+ * Registers a no-op telemetry store so `getCliTelemetry()` calls don't warn.
4
+ */
5
+ declare const hook: Hook.Prerun;
6
+ export default hook;
@@ -0,0 +1,13 @@
1
+ import { CLI_TELEMETRY_SYMBOL, noopLogger, setCliTelemetry } from '@sanity/cli-core/telemetry';
2
+ const PACKAGE_NAME = '@sanity/runtime-cli';
3
+ /**
4
+ * Registers a no-op telemetry store so `getCliTelemetry()` calls don't warn.
5
+ */
6
+ const hook = async ({ config }) => {
7
+ if (config.name !== PACKAGE_NAME)
8
+ return;
9
+ if (globalThis[CLI_TELEMETRY_SYMBOL])
10
+ return;
11
+ setCliTelemetry(noopLogger);
12
+ };
13
+ export default hook;
@@ -1,6 +1,6 @@
1
1
  import AdmZip from 'adm-zip';
2
2
  import type { AgentResource } from '../types.js';
3
- /** `sanityID` must be exactly 36 characters because the platform manifest gate requires it. */
3
+ /** The platform manifest gate requires `sanityID` to be exactly 36 characters. */
4
4
  export declare const SANITY_ID_LENGTH = 36;
5
5
  /** The manifest written to `package.json` at the bundle root. */
6
6
  export interface AgentManifest {
@@ -9,14 +9,25 @@ export interface AgentManifest {
9
9
  description?: string;
10
10
  region: string;
11
11
  }
12
- /** Derive the 36-character `sanityID` from the project scope id, as a UUID-shaped hash so it is stable across redeploys. */
12
+ /** Derive a stable 36-char `sanityID` from the project scope id (UUID-shaped hash). */
13
13
  export declare function deriveSanityId(scopeId: string): string;
14
14
  /** Build the manifest from the resource and project scope. */
15
15
  export declare function buildAgentManifest(resource: AgentResource, scopeId: string): AgentManifest;
16
16
  /**
17
- * Assemble the full bundle for a `sanity.agent` resource: the `package.json`
18
- * manifest, the authored source under `agent/`, the `www/index.ts` app entry, a
19
- * `public/` folder, and a `Dockerfile`. Asset prep is the only bundle producer;
20
- * the Provider just reads the bytes, so the layout must be complete here.
17
+ * Run `eve build` and return the produced `.output` dir. Runs with `cwd` set to
18
+ * the agent src since eve builds a single agent from its own directory. Output
19
+ * is captured, not inherited, so it does not clobber the caller's spinner or
20
+ * --json output; the captured output is surfaced in the error on failure.
21
21
  */
22
- export declare function buildAgentPackage(agentPath: string, manifest: AgentManifest): AdmZip;
22
+ export type EveBuildRunner = (agentPath: string) => Promise<string>;
23
+ /** Seam so tests can supply a fixture `.output` instead of a real build. */
24
+ export declare const eveBuild: {
25
+ run: EveBuildRunner;
26
+ };
27
+ /**
28
+ * Assemble the Web Function bundle for a `sanity.agent` resource: a runnable
29
+ * root `index.mjs` bootstrap, eve's built node-server under `.output/`, and the
30
+ * root `package.json` manifest. Asset prep is the sole producer; the Provider
31
+ * only reads the bytes, so the layout is complete here.
32
+ */
33
+ export declare function buildAgentPackage(agentPath: string, manifest: AgentManifest, build?: EveBuildRunner): Promise<AdmZip>;
@@ -1,8 +1,12 @@
1
+ import { spawn } from 'node:child_process';
1
2
  import crypto from 'node:crypto';
3
+ import fs from 'node:fs';
4
+ import { createRequire } from 'node:module';
5
+ import path from 'node:path';
2
6
  import AdmZip from 'adm-zip';
3
- /** `sanityID` must be exactly 36 characters because the platform manifest gate requires it. */
7
+ /** The platform manifest gate requires `sanityID` to be exactly 36 characters. */
4
8
  export const SANITY_ID_LENGTH = 36;
5
- /** Derive the 36-character `sanityID` from the project scope id, as a UUID-shaped hash so it is stable across redeploys. */
9
+ /** Derive a stable 36-char `sanityID` from the project scope id (UUID-shaped hash). */
6
10
  export function deriveSanityId(scopeId) {
7
11
  const hex = crypto.createHash('sha256').update(scopeId).digest('hex');
8
12
  return [
@@ -25,36 +29,85 @@ export function buildAgentManifest(resource, scopeId) {
25
29
  }
26
30
  return manifest;
27
31
  }
28
- /** The `www/index.{js,ts}` app entry the platform layout gate requires. */
29
- const WWW_INDEX_TS = `// Generated by the sanity.agent asset prep. The app entry the platform build
30
- // mounts: it re-exports the authored eve agent under agent/.
31
- export {default} from '../agent/agent.js'
32
+ // The Web Function runtime loads this root index.mjs and expects an HTTP
33
+ // listener on AWS_LAMBDA_HTTP_ENDPOINT. eve's node-server reads HOST/NITRO_HOST/
34
+ // PORT/NITRO_PORT, so map the endpoint onto those before importing the server.
35
+ // Only /tmp is writable, so ensure EVE_DATA_ROOT exists.
36
+ const WEB_FUNCTION_ENTRY = `import {mkdirSync} from 'node:fs'
37
+ const endpoint = process.env.AWS_LAMBDA_HTTP_ENDPOINT || '0.0.0.0:3000'
38
+ const sep = endpoint.lastIndexOf(':')
39
+ const host = sep > 0 ? endpoint.slice(0, sep).replace(/^\\[|\\]$/g, '') : '0.0.0.0'
40
+ const port = sep > 0 ? endpoint.slice(sep + 1) : '3000'
41
+ process.env.HOST = host
42
+ process.env.NITRO_HOST = host
43
+ process.env.PORT = port
44
+ process.env.NITRO_PORT = port
45
+ const dataRoot = process.env.EVE_DATA_ROOT || '/tmp/eve-data'
46
+ process.env.EVE_DATA_ROOT = dataRoot
47
+ mkdirSync(dataRoot, {recursive: true})
48
+ await import('./.output/server/index.mjs')
32
49
  `;
33
- /** The `Dockerfile` build context the platform layout gate requires. */
34
- const DOCKERFILE = `# Generated by the sanity.agent asset prep.
35
- FROM node:22-slim
36
- WORKDIR /app
37
- COPY . .
38
- RUN npm install --omit=dev
39
- EXPOSE 3000
40
- CMD ["node", "www/index.js"]
41
- `;
42
- /** Keep file so the required `public/` folder exists even with no static assets. */
43
- const PUBLIC_KEEP = '';
50
+ // Resolve the eve CLI from the agent's own install so its pinned version runs.
51
+ // eve's exports map blocks the bin subpath, so resolve its package.json and read
52
+ // the bin field rather than require.resolve('eve/bin/eve.js').
53
+ function resolveEveBin(agentPath) {
54
+ const require = createRequire(path.join(agentPath, 'noop.js'));
55
+ try {
56
+ const pkgPath = require.resolve('eve/package.json');
57
+ const pkg = require('eve/package.json');
58
+ const bin = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.eve;
59
+ if (!bin)
60
+ throw new Error('eve package has no bin entry');
61
+ return path.join(path.dirname(pkgPath), bin);
62
+ }
63
+ catch {
64
+ throw new Error(`eve is not installed for the agent at ${agentPath}. ` +
65
+ 'Run `npm install` in the agent project so `eve build` can run.');
66
+ }
67
+ }
68
+ function runEveBuild(agentPath) {
69
+ const eveBin = resolveEveBin(agentPath);
70
+ return new Promise((resolve, reject) => {
71
+ const child = spawn(process.execPath, [eveBin, 'build'], { cwd: agentPath });
72
+ let output = '';
73
+ child.stdout?.on('data', (d) => {
74
+ output += d;
75
+ });
76
+ child.stderr?.on('data', (d) => {
77
+ output += d;
78
+ });
79
+ child.on('error', reject);
80
+ child.on('close', (code) => {
81
+ if (code !== 0) {
82
+ reject(new Error(`eve build failed for ${agentPath} (exit code ${code}).\n${output.trim()}`));
83
+ return;
84
+ }
85
+ const outputDir = path.join(agentPath, '.output');
86
+ const serverEntry = path.join(outputDir, 'server', 'index.mjs');
87
+ if (!fs.existsSync(serverEntry)) {
88
+ reject(new Error(`eve build did not produce ${serverEntry}.\n${output.trim()}`));
89
+ return;
90
+ }
91
+ resolve(outputDir);
92
+ });
93
+ });
94
+ }
95
+ /** Seam so tests can supply a fixture `.output` instead of a real build. */
96
+ export const eveBuild = { run: runEveBuild };
44
97
  /**
45
- * Assemble the full bundle for a `sanity.agent` resource: the `package.json`
46
- * manifest, the authored source under `agent/`, the `www/index.ts` app entry, a
47
- * `public/` folder, and a `Dockerfile`. Asset prep is the only bundle producer;
48
- * the Provider just reads the bytes, so the layout must be complete here.
98
+ * Assemble the Web Function bundle for a `sanity.agent` resource: a runnable
99
+ * root `index.mjs` bootstrap, eve's built node-server under `.output/`, and the
100
+ * root `package.json` manifest. Asset prep is the sole producer; the Provider
101
+ * only reads the bytes, so the layout is complete here.
49
102
  */
50
- export function buildAgentPackage(agentPath, manifest) {
103
+ export async function buildAgentPackage(agentPath, manifest, build = eveBuild.run) {
104
+ const outputDir = await build(agentPath);
51
105
  const zip = new AdmZip();
106
+ zip.addFile('index.mjs', Buffer.from(WEB_FUNCTION_ENTRY, 'utf8'));
107
+ zip.addLocalFolder(outputDir, '.output');
52
108
  zip.addFile('package.json', Buffer.from(JSON.stringify(manifest, null, 2), 'utf8'));
53
- zip.addLocalFolder(agentPath, 'agent');
54
- zip.addFile('www/index.ts', Buffer.from(WWW_INDEX_TS, 'utf8'));
55
- zip.addFile('public/.gitkeep', Buffer.from(PUBLIC_KEEP, 'utf8'));
56
- zip.addFile('Dockerfile', Buffer.from(DOCKERFILE, 'utf8'));
57
- // Fixed entry times so the same input gives the same bytes, and the same asset id
109
+ // Zero entry times so identical inputs hash identically and the stash reuses
110
+ // the asset.
58
111
  for (const entry of zip.getEntries())
59
112
  entry.header.time = new Date(0);
60
113
  return zip;
@@ -1,9 +1,23 @@
1
1
  import type { AgentResource, AssetPrepResult, AuthParams } from '../types.js';
2
2
  /**
3
- * Build the full bundle for a `sanity.agent` resource from its `src` source
4
- * path, with the manifest inside the zip. Asset prep is the only bundle
5
- * producer; the Provider just reads the prepared bytes. A failure returns
6
- * `{success: false}`, failing the prep step before the Blueprints API is called.
3
+ * Builds the complete Web Function bundle for a `sanity.agent` resource from its
4
+ * `src` source path, with the manifest INSIDE the zip. Asset prep is the sole
5
+ * producer of this bundle: the Provider only reads the prepared bytes and never
6
+ * builds, assembles, or merges a manifest, so the bundle emitted here is
7
+ * complete -- a runnable root `index.mjs` bootstrap, eve's built node-server
8
+ * under `.output/`, and the root `package.json` manifest. The platform deploys
9
+ * it as a zip Web Function (`EntryPoint index.mjs`, `Runtime nodejs24.x`), which
10
+ * loads the root `index.mjs`; a container layout (raw `.ts` + Dockerfile) never
11
+ * boots there.
12
+ *
13
+ * The `sanityID` in the manifest is derived from the project scope (`auth.scopeId`);
14
+ * `name`, `description`, and `region` come from the resource.
15
+ *
16
+ * The returned `assetParameter` is `src`, so once the bytes are stashed the
17
+ * resource `src` is rewritten from the source path to the returned `AS-...` asset
18
+ * id before deploy. A build failure (including a failed `eve build`) returns
19
+ * `{success: false}`, which fails the CLI prep step before the Blueprints API is
20
+ * called.
7
21
  */
8
22
  export declare function prepareAsset({ blueprintFileDir, resource, auth, }: {
9
23
  blueprintFileDir: string;
@@ -1,13 +1,26 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { CONVERT_BYTES_TO_MB, MAX_ASSET_SIZE } from '../../constants.js';
4
- import { isFolderLargerThan } from '../functions/is-folder-larger-than.js';
5
4
  import { buildAgentManifest, buildAgentPackage } from './build-package.js';
6
5
  /**
7
- * Build the full bundle for a `sanity.agent` resource from its `src` source
8
- * path, with the manifest inside the zip. Asset prep is the only bundle
9
- * producer; the Provider just reads the prepared bytes. A failure returns
10
- * `{success: false}`, failing the prep step before the Blueprints API is called.
6
+ * Builds the complete Web Function bundle for a `sanity.agent` resource from its
7
+ * `src` source path, with the manifest INSIDE the zip. Asset prep is the sole
8
+ * producer of this bundle: the Provider only reads the prepared bytes and never
9
+ * builds, assembles, or merges a manifest, so the bundle emitted here is
10
+ * complete -- a runnable root `index.mjs` bootstrap, eve's built node-server
11
+ * under `.output/`, and the root `package.json` manifest. The platform deploys
12
+ * it as a zip Web Function (`EntryPoint index.mjs`, `Runtime nodejs24.x`), which
13
+ * loads the root `index.mjs`; a container layout (raw `.ts` + Dockerfile) never
14
+ * boots there.
15
+ *
16
+ * The `sanityID` in the manifest is derived from the project scope (`auth.scopeId`);
17
+ * `name`, `description`, and `region` come from the resource.
18
+ *
19
+ * The returned `assetParameter` is `src`, so once the bytes are stashed the
20
+ * resource `src` is rewritten from the source path to the returned `AS-...` asset
21
+ * id before deploy. A build failure (including a failed `eve build`) returns
22
+ * `{success: false}`, which fails the CLI prep step before the Blueprints API is
23
+ * called.
11
24
  */
12
25
  export async function prepareAsset({ blueprintFileDir, resource, auth, }) {
13
26
  if (!resource.src)
@@ -24,12 +37,9 @@ export async function prepareAsset({ blueprintFileDir, resource, auth, }) {
24
37
  if (!existsSync(agentPath)) {
25
38
  throw new Error(`Agent source path not found: ${agentPath}`);
26
39
  }
27
- if (isFolderLargerThan(agentPath, MAX_ASSET_SIZE)) {
28
- throw new Error('Resource is larger than max asset size of 200 MB.');
29
- }
30
40
  const manifest = buildAgentManifest(resource, auth.scopeId);
31
- const zip = buildAgentPackage(agentPath, manifest);
32
- // Sum uncompressed entry sizes so the limit check reflects on-disk size.
41
+ const zip = await buildAgentPackage(agentPath, manifest);
42
+ // Sum uncompressed entry sizes so the limit check reflects the zip size.
33
43
  const zipEntrySize = zip
34
44
  .getEntries()
35
45
  .map((entry) => entry.header.size)
@@ -199,8 +199,15 @@ async function buildApplicationBundle({ resource, appId, workDir, outDir, output
199
199
  if (extraWindow) {
200
200
  throw new Error(`Application resource '${resource.name}' declares more than one window view; at most one is allowed`);
201
201
  }
202
+ let mismatchedPackages;
202
203
  const { mfManifest } = await buildApp({
203
204
  ...sharedBuildAppOptions({ appId, workDir, outDir, output, eventListener }),
205
+ autoUpdatesEnabled: resource.autoUpdates?.enabled ?? false,
206
+ async compareDependencyVersions(packages) {
207
+ const result = await compareDependencyVersions(packages, workDir, { appId });
208
+ mismatchedPackages = result.mismatched.map((m) => m.pkg);
209
+ return result;
210
+ },
204
211
  appId,
205
212
  appTitle: resource.title,
206
213
  entry: window?.src,
@@ -213,8 +220,7 @@ async function buildApplicationBundle({ resource, appId, workDir, outDir, output
213
220
  if (mfManifest) {
214
221
  resource.mfManifest = mfManifest;
215
222
  }
216
- // a workbench app never auto-updates, so no dependency mismatches are compared
217
- return {};
223
+ return { mismatchedPackages };
218
224
  }
219
225
  async function buildInstallationConfigBundle({ resource, workDir, outDir, output, eventListener, }) {
220
226
  const { mfManifest } = await buildApp({
@@ -3150,5 +3150,5 @@
3150
3150
  ]
3151
3151
  }
3152
3152
  },
3153
- "version": "17.21.0-next.gb3fb310"
3153
+ "version": "17.21.1-next.g0cb67b7"
3154
3154
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "17.21.0-next.gb3fb310",
4
+ "version": "17.21.1-next.g0cb67b7",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -68,7 +68,7 @@
68
68
  "@oclif/core": "^4.14.0",
69
69
  "@oclif/plugin-help": "^6.3.0",
70
70
  "@sanity-labs/oclif-plugin-skills-flag": "^0.2.1",
71
- "@sanity/blueprints": "^0.32.0",
71
+ "@sanity/blueprints": "^0.33.0",
72
72
  "@sanity/blueprints-parser": "^0.5.0",
73
73
  "@sanity/cli-build": "^7.1.0",
74
74
  "@sanity/cli-core": "^3.14.1",
@@ -120,6 +120,9 @@
120
120
  "bin": "sanity-run",
121
121
  "dirname": "sanity-run",
122
122
  "commands": "./dist/commands",
123
+ "hooks": {
124
+ "prerun": "./dist/hooks/prerun/setup-telemetry"
125
+ },
123
126
  "plugins": [
124
127
  "@oclif/plugin-help",
125
128
  "@sanity-labs/oclif-plugin-skills-flag"