@nimiplatform/app-tools 0.16.0-rc.14 → 0.16.0-rc.18

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 (84) hide show
  1. package/README.md +5 -42
  2. package/bin/nimi-app.mjs +25 -6
  3. package/lib/app-dependency-combinations.mjs +1 -0
  4. package/lib/app-doctor-update.mjs +8 -6
  5. package/lib/app-info.mjs +39 -19
  6. package/lib/app-lifecycle-guidance.mjs +1 -1
  7. package/lib/app-pack.mjs +31 -13
  8. package/lib/app-project-lifecycle.mjs +32 -12
  9. package/lib/app-resources.mjs +36 -0
  10. package/lib/app-scaffold-profiles.mjs +72 -2
  11. package/lib/app-scaffold.mjs +11 -13
  12. package/lib/index.mjs +7 -0
  13. package/lib/public-storefront.mjs +327 -0
  14. package/lib/storefront-media.mjs +8 -4
  15. package/lib/storefront-pack.mjs +152 -0
  16. package/lib/storefront-release-verification.mjs +31 -0
  17. package/lib/storefront-source.mjs +161 -0
  18. package/lib/web-coordination.mjs +4 -1
  19. package/lib/web-scaffold.mjs +3 -3
  20. package/package.json +9 -6
  21. package/scripts/sync-app-source.mjs +5 -12
  22. package/skills/nimi-app-lifecycle/SKILL.md +1 -0
  23. package/skills/nimi-app-lifecycle/references/storefront.md +28 -0
  24. package/templates/app-source/src/ai-studio-core/ai-config.ts +12 -0
  25. package/templates/app-source/src/ai-studio-core/ai-studio-core.css +138 -117
  26. package/templates/app-source/src/ai-studio-core/history.ts +10 -8
  27. package/templates/app-source/src/ai-studio-core/host-context.tsx +1 -0
  28. package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -10
  29. package/templates/app-source/src/ai-studio-core/job-recovery.ts +505 -115
  30. package/templates/app-source/src/ai-studio-core/messages/en.json +55 -9
  31. package/templates/app-source/src/ai-studio-core/messages/zh.json +55 -9
  32. package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +8 -2
  33. package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +2 -0
  34. package/templates/app-source/src/ai-studio-core/parameters.ts +5 -4
  35. package/templates/app-source/src/ai-studio-core/run-target.ts +12 -1
  36. package/templates/app-source/src/ai-studio-core/runtime-types.ts +3 -0
  37. package/templates/app-source/src/ai-studio-core/runtime.ts +50 -12
  38. package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +6 -7
  39. package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +88 -27
  40. package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +33 -0
  41. package/templates/app-source/src/ai-studio-core/section-ai-testing-music-result.tsx +2 -2
  42. package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +10 -3
  43. package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +6 -4
  44. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +121 -40
  45. package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +34 -8
  46. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcript-result.tsx +16 -2
  47. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +18 -7
  48. package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +1 -1
  49. package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +78 -9
  50. package/templates/app-source/src/ai-studio-core/text-media-replay.ts +2 -1
  51. package/templates/app-source/src/ai-studio-core/workspace.tsx +138 -3
  52. package/templates/app-source/src/product-modules/agent-center/index.tsx +19 -3
  53. package/templates/app-source/src/product-modules/agent-conversation/index.tsx +19 -3
  54. package/templates/app-source/src/product-modules/agent-realtime/index.tsx +19 -3
  55. package/templates/app-source/src/product-modules/kit-recipes/gallery.tsx +12 -7
  56. package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-surface.tsx +48 -20
  57. package/templates/app-source/src/studio-modules/studio-create/messages/en.json +2 -2
  58. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +2 -2
  59. package/templates/app-source/src/studio-modules/studio-create/registration.ts +1 -1
  60. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +11 -19
  61. package/templates/app-source/src/studio-modules/studio-media/audio-separate-parameters.tsx +7 -4
  62. package/templates/app-source/src/studio-modules/studio-media/audio-separate-runtime.ts +14 -10
  63. package/templates/app-source/src/studio-modules/studio-media/messages/en.json +3 -1
  64. package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +3 -1
  65. package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +6 -5
  66. package/templates/app-source/src/studio-modules/studio-media/music-transcription-parameters.tsx +19 -11
  67. package/templates/app-source/src/studio-modules/studio-media/music-transcription-runtime.ts +14 -10
  68. package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +54 -16
  69. package/templates/app-source/src/studio-modules/studio-media/runtime.ts +22 -9
  70. package/templates/app-source/src/studio-modules/studio-media/vision-runtime.ts +19 -10
  71. package/templates/app-source/src/studio-modules/studio-media/voice-convert-parameters.tsx +12 -6
  72. package/templates/app-source/src/studio-modules/studio-media/voice-convert-runtime.ts +11 -9
  73. package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +5 -0
  74. package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +5 -0
  75. package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +18 -7
  76. package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +28 -4
  77. package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +12 -8
  78. package/templates/app-source/src/workbench-core/runtime-gate.tsx +171 -44
  79. package/templates/app-source/src/workbench-core/workbench-core.css +226 -23
  80. package/templates/app-source/src/workbench-core/workbench-core.tsx +5 -5
  81. package/templates/app-source.manifest.json +2 -2
  82. package/templates/default-starter/NIMI_APP.md +11 -3
  83. package/templates/default-starter.manifest.json +2 -2
  84. package/templates/storefront-release.yml +97 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@ Use App Tools to create, test and ship native desktop and Web apps. Desktop apps
4
4
 
5
5
  ## 1. The Application Lifecycle
6
6
 
7
- Create a project, install its dependencies with your package manager and run `init`. For Web, fill in the registered origin, callback and client ID before initialization. Both carriers support `sync`, `check`, `dev`, `test` and `build`. Desktop projects use `pack` to prepare the built app for distribution.
7
+ Create a project, install its dependencies with your package manager and run `init`. For Web, fill in the registered origin, callback and client ID before initialization. Both carriers support `sync`, `check`, `dev`, `test` and `build`, as well as `check --storefront` and `pack --storefront --rev <int>` for carrier-independent storefront releases. Desktop projects also use `pack --target` to prepare the built app for distribution.
8
8
 
9
9
  Choose one product `app_id` for all its carriers. For a new PC + Web product, bootstrap the desktop scaffold with the Web-capable App Tools version in the [Web guide](https://docs.nimi.ai/start/connect-web-app), then add the browser entry to the same project. Use that guide directly for a Web-only project. After installation, run the project-local CLI with `pnpm exec nimi-app`. The [upgrade guide](skills/nimi-app-lifecycle/references/upgrade-platform.md) covers existing Apps and changes to the SDK/Kit pair.
10
10
 
@@ -17,7 +17,7 @@ Choose one product `app_id` for all its carriers. For a new PC + Web product, bo
17
17
  | **`dev`** | Launches native desktop apps in the Desktop-supervised Electron shell with a protected session bridge, or starts a Web app's own HTTPS dev entrypoint. |
18
18
  | **`test`** | Executes the test suite declared in `.nimi/config/build-profile.yaml`. |
19
19
  | **`build`** | Compiles production binaries and assets for native desktop targets (macOS / Windows), or outputs static assets for Web apps. |
20
- | **`pack`** | Native desktop only. Deterministically packages verified binaries and metadata into an immutable `.nimiapp` bundle. |
20
+ | **`pack`** | Deterministically packages verified native desktop binaries and metadata into an immutable `.nimiapp` bundle, or packages a carrier-independent storefront manifest and Store-0 media ZIP with `--storefront --rev <int>`. |
21
21
 
22
22
  ---
23
23
 
@@ -251,48 +251,11 @@ Keep repository setup, architecture, build/release commands and engineering acce
251
251
 
252
252
  Packaging copies its exact text into the existing `app-info.json` `readme_markdown` field. Installed and Catalog entries display their exact release snapshot; changing source documentation does not rewrite an immutable release.
253
253
 
254
- ### Storefront Presentation (`metadata.storefront`)
254
+ ### Storefront presentation
255
255
 
256
- Apps may declare optional `metadata.storefront` in `nimi.app.yaml` to provide localized store copy, highlights, tags, a 16:9 cover image, and up to 6 static screenshots (WebP or PNG, static only, `<= 512 KiB` each; cover `800–2560 × 450–1600`, gallery `640–2560 × 360–1600`). Supported `category` values: `companions-worlds`, `lifestyle`, `writing-notes`, `design-diagrams`, `audio-music`, `video-media`, `research-learning`, `productivity-automation`, `developer-tools`.
256
+ Use `metadata.storefront.schema_version: 2` in `nimi.app.yaml` to publish a localized public storefront independently of executable releases. A capsule introduces the App in lists and a hero establishes its visual identity. A short series of posters shows what people can experience on the indicated carrier. Native packages retain their own offline localized names, summaries, and optional non-default introductions in `app-info.json` (`localization`).
257
257
 
258
- Non-default locales may override `display_name`, `summary`, and `introduction` (pointing to a repo-relative UTF-8 Markdown file up to `96 KiB`); the `default_locale` reuses top-level `display_name`, `metadata.summary`, and root `NIMI_APP.md` without duplicating them.
259
-
260
- ```yaml
261
- metadata:
262
- summary: 中文简介(默认语种来自顶层字段与 NIMI_APP.md)
263
- icon: assets/app-artwork.png
264
- storefront:
265
- category: lifestyle
266
- default_locale: zh
267
- locales:
268
- zh:
269
- tags: [节律观察, 本地隐私]
270
- highlights:
271
- - title: 确定性排盘
272
- description: 本地先算准客观盘面,再结合模型解读。
273
- en:
274
- display_name: ShiJing
275
- summary: Deterministic personal rhythm companion.
276
- introduction: NIMI_APP.en.md
277
- tags: [Rhythm, Local-First]
278
- highlights:
279
- - title: Deterministic Engine
280
- description: Computes local charts before layering AI reflection.
281
- media:
282
- cover:
283
- path: assets/storefront/cover-zh.webp
284
- locales:
285
- en: assets/storefront/cover-en.webp
286
- gallery:
287
- - id: overview
288
- kind: image
289
- path: assets/storefront/overview-zh.webp
290
- caption:
291
- zh: 主视图总览
292
- en: "Main workspace overview"
293
- ```
294
-
295
- During `nimi-app pack --target`, App Tools validates every declared image and writes only image digests and dimensions into `app-info.json` (never embedding screenshots inside `.nimiapp`). During `nimi-app pack --aggregate`, App Tools checks cross-target display parity and packages all referenced images once into a deduplicated `<app_id>-<version>-storefront-media.zip` (`<= 8 MiB`) uploaded alongside the immutable GitHub Release.
258
+ Run `pnpm exec nimi-app check --storefront` to check the declared images and copy. Run `pnpm exec nimi-app pack --storefront --rev 1 --json` to produce the manifest and deterministic Store-0 media ZIP. Adding `--production` to either command enforces the same storefront checks and rejects local Nimi overrides or resolutions in standalone project `pnpm-workspace.yaml` and `pnpm-lock.yaml` files. The [storefront guide](skills/nimi-app-lifecycle/references/storefront.md) covers artwork, localization, preview and release.
296
259
 
297
260
  ### Package v2 Output & Sidecar Verification
298
261
  `pack` writes the `nimi.app-package/v2` format and emits the exact embedded `app-info.json` bytes as a sidecar file named `<app_id>-<version>-<target_id>.app-info.json` alongside the `.nimiapp` bundle and `.target.json`. Aggregate verification checks both files and confirms they match the embedded document byte-for-byte.
package/bin/nimi-app.mjs CHANGED
@@ -23,7 +23,7 @@ function parseArgs(argv) {
23
23
  const values = {
24
24
  dir: '', profile: '', platform: '', carrier: '', appId: '', version: '', title: '', packageName: '', author: '',
25
25
  features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '', newRegistration: false, target: '', aggregate: false, production: false, json: false,
26
- adopt: false, dryRun: false, input: '', realm: '',
26
+ adopt: false, dryRun: false, input: '', realm: '', storefront: false, rev: '',
27
27
  };
28
28
  const seen = new Set();
29
29
  const readValue = (index, flag, key, preserve = false) => {
@@ -132,6 +132,16 @@ function parseArgs(argv) {
132
132
  index = readValue(index, '--target', 'target');
133
133
  continue;
134
134
  }
135
+ if (rest[index] === '--storefront') {
136
+ if (seen.has('storefront')) throw new Error('Duplicate option: --storefront');
137
+ seen.add('storefront');
138
+ values.storefront = true;
139
+ continue;
140
+ }
141
+ if (rest[index] === '--rev') {
142
+ index = readValue(index, '--rev', 'rev');
143
+ continue;
144
+ }
135
145
  if (rest[index] === '--aggregate') {
136
146
  if (seen.has('aggregate')) throw new Error('Duplicate option: --aggregate');
137
147
  seen.add('aggregate');
@@ -164,11 +174,11 @@ function assertCommandOptions(command, providedOptions) {
164
174
  create: new Set(['dir', 'profile', 'platform', 'carrier', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
165
175
  init: new Set(['dir', 'json', 'adopt', 'input', 'dryRun']),
166
176
  sync: new Set(['dir', 'json', 'dryRun']),
167
- check: new Set(['dir', 'json', 'production']),
177
+ check: new Set(['dir', 'json', 'production', 'storefront']),
168
178
  dev: new Set(['dir', 'platform', 'shell', 'realm', 'cdpPort', 'noCdp', 'listRegistrations', 'resume', 'newRegistration']),
169
179
  test: new Set(['dir', 'json']),
170
180
  build: new Set(['dir', 'target', 'production', 'json']),
171
- pack: new Set(['dir', 'target', 'aggregate', 'production', 'json']),
181
+ pack: new Set(['dir', 'target', 'aggregate', 'production', 'json', 'storefront', 'rev']),
172
182
  }[command];
173
183
  if (!allowed) return;
174
184
  const invalid = providedOptions.find((key) => !allowed.has(key));
@@ -195,11 +205,11 @@ function printUsage() {
195
205
  ' nimi-app create [--dir path] [--profile standalone] [--platform desktop|web] [--carrier managed-web|native] [--features admitted-ids|all] [--app-id dotted.id] [--version semver] [--title title] [--package-name name] [--author person-or-team] [--json]',
196
206
  ' nimi-app init [--adopt [--input json-path]] [--dry-run] [--dir path] [--json]',
197
207
  ' nimi-app sync [--dry-run] [--dir path] [--json]',
198
- ' nimi-app check [--dir path] [--production] [--json]',
208
+ ' nimi-app check [--dir path] [--production] [--json] [--storefront]',
199
209
  ' nimi-app dev [--dir path] [--platform desktop|web|mobile] [--realm official|local (web/mobile)] [--shell electron] [--list-registrations | --resume <selector> | --new-registration] [--cdp-port 1024..65535 | --no-cdp]',
200
210
  ' nimi-app test [--dir path] [--json]',
201
211
  ' nimi-app build [--dir path] [--target target-id] [--production] [--json]',
202
- ' nimi-app pack [--dir path] (--target target-id [--production] | --aggregate) [--json]',
212
+ ' nimi-app pack [--dir path] (--target target-id [--production] | --aggregate | --storefront --rev integer [--production]) [--json]',
203
213
  '',
204
214
  'Publishing a native package on GitHub:',
205
215
  ' Before the first release, configure NIMI_REPOSITORY_ADMIN_TOKEN with Administration: Read-only.',
@@ -336,6 +346,8 @@ try {
336
346
  packageName,
337
347
  author,
338
348
  features: parsedFeatures,
349
+ storefront,
350
+ rev,
339
351
  realm,
340
352
  shell,
341
353
  cdpPort,
@@ -419,7 +431,13 @@ try {
419
431
  dir,
420
432
  production,
421
433
  json,
434
+ storefront,
422
435
  });
436
+ if (storefront) {
437
+ process.stdout.write(json ? JSON.stringify(result, null, 2) + '\n' : '[nimi-app] ' + result.images + ' storefront images checked\n');
438
+ if (!json) for (const warning of result.warnings) process.stdout.write('[nimi-app] ' + (warning.field || warning.sha256) + ': ' + warning.reason + '\n');
439
+ break;
440
+ }
423
441
  if (production && !json && result.platform === 'web') {
424
442
  process.stdout.write('[nimi-app] Protect web-v* tags and enable immutable Releases in the App repository. Submit the exact Web bundle and hosted source for Registry review.\n');
425
443
  } else if (production && !json) {
@@ -438,8 +456,9 @@ try {
438
456
  case 'pack':
439
457
  if (aggregate && (target || production)) throw new Error('--aggregate cannot be combined with --target or --production');
440
458
  {
441
- const result = await packApp(process.cwd(), { dir, target, aggregate, production });
459
+ const result = await packApp(process.cwd(), { dir, target, aggregate, production, storefront, rev });
442
460
  if (json) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
461
+ else if (storefront) process.stdout.write('[nimi-app] ' + result.manifest.path + '\n' + result.media_archive.path + '\n');
443
462
  else process.stdout.write(`[nimi-app] pack ${aggregate ? 'aggregate' : target} completed\n`);
444
463
  }
445
464
  break;
@@ -10,6 +10,7 @@ const SDK = '@nimiplatform/sdk';
10
10
  const KIT = '@nimiplatform/kit';
11
11
 
12
12
  export const ADDITIONAL_DEPENDENCY_COMBINATIONS = Object.freeze([
13
+ Object.freeze({ sdkVersion: '^0.24.0-rc.11', kitVersion: '^0.24.0-rc.18', source: 'existing' }),
13
14
  Object.freeze({ sdkVersion: '^0.24.0-rc.10', kitVersion: '^0.24.0-rc.16', source: 'existing' }),
14
15
  Object.freeze({ sdkVersion: '^0.24.0-rc.7', kitVersion: '^0.24.0-rc.11', source: 'existing' }),
15
16
  Object.freeze({ sdkVersion: '^0.24.0-rc.2', kitVersion: '^0.24.0-rc.1', source: 'existing' }),
@@ -193,7 +193,7 @@ function expectedSnapshotFromLock(lock, versions, intent, targetDir, options = {
193
193
  ['packageName', 'packageName', 'package name'],
194
194
  ['packageAuthor', 'packageAuthor', 'package author'],
195
195
  ['cargoPackageName', 'cargoPackageName', 'Cargo package name'],
196
- ['tauriIdentifier', 'tauriIdentifier', 'Tauri identifier'],
196
+ ['nativeBundleIdentifier', 'nativeBundleIdentifier', 'native bundle identifier'],
197
197
  ['accentPack', 'accentPack', 'accent pack'],
198
198
  ]) {
199
199
  const expected = lockField.includes('.')
@@ -257,7 +257,7 @@ function ensureLockMatchesCurrentGenerator(lock, snapshot) {
257
257
  assertSameJson(lock.packageName, snapshot.lock.packageName, 'Package name');
258
258
  assertSameJson(lock.packageAuthor, snapshot.lock.packageAuthor, 'Package author');
259
259
  assertSameJson(lock.cargoPackageName, snapshot.lock.cargoPackageName, 'Cargo package name');
260
- assertSameJson(lock.tauriIdentifier, snapshot.lock.tauriIdentifier, 'Tauri identifier');
260
+ assertSameJson(lock.nativeBundleIdentifier, snapshot.lock.nativeBundleIdentifier, 'Native bundle identifier');
261
261
  assertSameJson(lock.accentPack, snapshot.lock.accentPack, 'Accent pack');
262
262
  assertSameJson(lock.features, snapshot.lock.features, 'Scaffold features');
263
263
  assertSameJson(lock.directFeatures, snapshot.lock.directFeatures, 'Direct scaffold features');
@@ -862,9 +862,11 @@ const RETIRED_TAURI_GLUE = new Set([
862
862
  'src-tauri/tauri.conf.json', 'src-tauri/src/main.rs', 'src-tauri/icons/icon.png', 'src-tauri/icons/icon.ico',
863
863
  ]);
864
864
 
865
- function isAppOwnedHandover(relativePath, lockedEntry, current) {
865
+ function isAppOwnedHandover(relativePath, lockedEntry, current, platform) {
866
866
  if (!current && RETIRED_TAURI_GLUE.has(relativePath)) return lockedEntry?.class === 'scaffold-managed glue';
867
- return SCAFFOLD_APP_OWNED_HANDOVER_PATHS.includes(relativePath)
867
+ const knownHandover = SCAFFOLD_APP_OWNED_HANDOVER_PATHS.includes(relativePath)
868
+ || (platform === 'web' && relativePath === 'src/shell/routes/product-area.tsx');
869
+ return knownHandover
868
870
  && lockedEntry?.class === 'scaffold-managed glue'
869
871
  && current?.owner === 'app-owned'
870
872
  && current.class === 'app-owned product code';
@@ -873,7 +875,7 @@ function isAppOwnedHandover(relativePath, lockedEntry, current) {
873
875
  function assertNoPendingAppOwnedHandover(lock, snapshot) {
874
876
  const currentClasses = collectExpectedClasses(snapshot);
875
877
  const pending = Object.entries(lock.managedFileHashes || {})
876
- .filter(([relativePath, entry]) => isAppOwnedHandover(relativePath, entry, currentClasses.get(relativePath)))
878
+ .filter(([relativePath, entry]) => isAppOwnedHandover(relativePath, entry, currentClasses.get(relativePath), lock.platform))
877
879
  .map(([relativePath]) => relativePath);
878
880
  if (pending.length > 0) {
879
881
  throw new Error(`${pending.join(', ')} now belongs to the App and is no longer scaffold-managed. Run nimi-app sync to record the new owner; sync leaves the file unchanged.`);
@@ -900,7 +902,7 @@ function assertNoClassificationConflict(lock, snapshot, targetDir) {
900
902
  if (current?.owner === 'managed' && current.class === entry.class) {
901
903
  continue;
902
904
  }
903
- if (isAppOwnedHandover(relativePath, entry, current)) {
905
+ if (isAppOwnedHandover(relativePath, entry, current, lock.platform)) {
904
906
  handovers.push(describeAppOwnedHandover(targetDir, relativePath, entry));
905
907
  continue;
906
908
  }
package/lib/app-info.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  // @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042a
2
2
  // @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-043a
3
3
  // @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042d
4
- import { existsSync, lstatSync, readFileSync } from 'node:fs';
4
+ import { existsSync, readFileSync } from 'node:fs';
5
+ import { readAppResource as resource } from './app-resources.mjs';
6
+ import { packageLocalizationFromSource } from './storefront-source.mjs';
5
7
  import path from 'node:path';
6
8
  import { readAppIcon, validateAppIcon } from './app-icons.mjs';
7
9
  export { validateAppIcon } from './app-icons.mjs';
@@ -26,7 +28,7 @@ export const APP_INTRODUCTION_FILE = 'NIMI_APP.md';
26
28
  export const APP_INFO_FIELDS = Object.freeze([
27
29
  'format', 'app_id', 'version', 'target_id', 'display_name', 'summary', 'icon', 'readme_markdown', 'release_notes_markdown',
28
30
  'license', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', 'author',
29
- 'homepage_url', 'support_url', SAFETY_PROFILE_FIELD, 'storefront',
31
+ 'homepage_url', 'support_url', SAFETY_PROFILE_FIELD, 'storefront', 'localization',
30
32
  ]);
31
33
  // Declaration fields that App Tools projects from nimi.app.yaml into the
32
34
  // archive declaration and that Registry compares against the candidate.
@@ -114,6 +116,7 @@ export function validateAppInfo(info) {
114
116
  https(info.support_url, 'support_url');
115
117
  safetyProfile(info[SAFETY_PROFILE_FIELD], 'App info');
116
118
  if (info.storefront !== undefined) validateAppInfoStorefront(info.storefront);
119
+ if (info.localization !== undefined) validateAppLocalization(info.localization);
117
120
  if (Buffer.byteLength(JSON.stringify(info)) > APP_INFO_MAX_BYTES) throw new Error('App info exceeds 1 MiB');
118
121
  return info;
119
122
  }
@@ -125,6 +128,34 @@ function validLocale(value, label) {
125
128
  return value;
126
129
  }
127
130
 
131
+ function validateAppLocalization(value) {
132
+ if (!value || typeof value !== 'object' || Array.isArray(value)
133
+ || Object.keys(value).some((key) => !['default_locale', 'locales'].includes(key))) {
134
+ throw new Error('App info localization has invalid fields');
135
+ }
136
+ const defaultLocale = validLocale(value.default_locale, 'localization.default_locale');
137
+ if (!value.locales || typeof value.locales !== 'object' || Array.isArray(value.locales)) {
138
+ throw new Error('App info localization.locales must be a language map');
139
+ }
140
+ const entries = Object.entries(value.locales);
141
+ if (entries.length < 1 || entries.length > 16) throw new Error('App info localization needs 1–16 locales');
142
+ if (!Object.hasOwn(value.locales, defaultLocale)) {
143
+ throw new Error('App info localization.locales must include localization.default_locale');
144
+ }
145
+ for (const [lang, entry] of entries) {
146
+ validLocale(lang, 'localization.locales key');
147
+ if (!entry || typeof entry !== 'object' || Array.isArray(entry)
148
+ || Object.keys(entry).some((key) => !['display_name', 'summary', 'introduction_markdown'].includes(key))) {
149
+ throw new Error(`App info localization.locales.${lang} has invalid fields`);
150
+ }
151
+ text(entry.display_name, `localization.locales.${lang}.display_name`, 120);
152
+ text(entry.summary, `localization.locales.${lang}.summary`, 280);
153
+ if (lang === defaultLocale || entry.introduction_markdown !== undefined) {
154
+ text(entry.introduction_markdown, `localization.locales.${lang}.introduction_markdown`, 96 * 1024, true);
155
+ }
156
+ }
157
+ }
158
+
128
159
  function validateImageRef(ref, bounds, label) {
129
160
  if (!ref || typeof ref !== 'object' || Array.isArray(ref)) throw new Error(`${label} must be an image reference object`);
130
161
  for (const key of Object.keys(ref)) {
@@ -264,6 +295,9 @@ export function validateAppInfoStorefront(storefront) {
264
295
  export function readAppStorefront(root, manifest) {
265
296
  const raw = manifest?.metadata?.storefront;
266
297
  if (raw === undefined) return { storefront: undefined, mediaEntries: new Map() };
298
+ if (raw?.schema_version === 2) {
299
+ return { localization: packageLocalizationFromSource(root, manifest), storefront: undefined, mediaEntries: new Map() };
300
+ }
267
301
  if (!raw || typeof raw !== 'object' || Array.isArray(raw)) throw new Error('metadata.storefront must be an object');
268
302
  for (const key of Object.keys(raw)) {
269
303
  if (!['category', 'default_locale', 'locales', 'media'].includes(key)) {
@@ -395,21 +429,6 @@ export function readAppStorefront(root, manifest) {
395
429
  return { storefront, mediaEntries };
396
430
  }
397
431
 
398
- function resource(root, relative, label, maxBytes) {
399
- if (typeof relative !== 'string' || path.isAbsolute(relative) || relative.includes('\\')
400
- || relative.split('/').some((part) => !part || part === '.' || part === '..')) throw new Error(`metadata.${label} must name an App-relative resource`);
401
- const file = path.join(root, relative);
402
- const field = label === 'license' ? 'App license' : label === 'introduction' ? APP_INTRODUCTION_FILE : `metadata.${label}`;
403
- try {
404
- const stat = lstatSync(file);
405
- if (!stat.isFile() || stat.isSymbolicLink() || stat.size === 0 || stat.size > maxBytes) throw new Error(`must be a nonempty regular file of at most ${maxBytes} bytes`);
406
- return readFileSync(file);
407
- } catch (error) {
408
- if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') throw new Error(`${field} resource is missing: ${relative}`);
409
- throw new Error(`${field} resource ${relative}: ${error.message}`, { cause: error });
410
- }
411
- }
412
-
413
432
  export function readAppIntroduction(root, manifest) {
414
433
  if (manifest?.metadata && Object.hasOwn(manifest.metadata, 'readme')) {
415
434
  throw new Error('metadata.readme is not supported; put the user introduction in root NIMI_APP.md and remove metadata.readme');
@@ -430,10 +449,10 @@ export function readAppInfo(root, targetId) {
430
449
  const metadata = manifest.metadata;
431
450
  if (!metadata || typeof metadata !== 'object') throw new Error('nimi.app.yaml metadata is required for distribution (summary, icon)');
432
451
  const readText = (relative, label, max) => new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(resource(root, relative, label, max));
433
- const { storefront } = readAppStorefront(root, manifest);
452
+ const { storefront, localization } = readAppStorefront(root, manifest);
434
453
  const info = validateAppInfo({
435
454
  format: 'nimi.app-info/v1', app_id: manifest.app_id, version: manifest.version, target_id: targetId,
436
- display_name: manifest.display_name, summary: metadata.summary,
455
+ display_name: manifest.display_name, summary: metadata.summary ?? localization?.locales[localization.default_locale]?.summary,
437
456
  icon: { media_type: 'image/png', data_base64: readAppIcon(root).toString('base64') },
438
457
  readme_markdown: readAppIntroduction(root, manifest),
439
458
  release_notes_markdown: metadata.release_notes === undefined ? '' : readText(metadata.release_notes, 'release_notes', 32 * 1024),
@@ -445,6 +464,7 @@ export function readAppInfo(root, targetId) {
445
464
  author: metadata.author || '', homepage_url: https(metadata.homepage_url, 'homepage_url'), support_url: https(metadata.support_url, 'support_url'),
446
465
  ...(manifest[SAFETY_PROFILE_FIELD] === undefined ? {} : { [SAFETY_PROFILE_FIELD]: normalizeSafetyProfile(manifest[SAFETY_PROFILE_FIELD]) }),
447
466
  ...(storefront === undefined ? {} : { storefront }),
467
+ ...(localization === undefined ? {} : { localization }),
448
468
  });
449
469
  const submissionPath = path.join(root, '.nimi/admission/submission.yaml');
450
470
  if (existsSync(submissionPath)) {
@@ -5,7 +5,7 @@ import { assertProjectOutputPath, changedFiles, plannedFile } from './app-projec
5
5
 
6
6
  export const LIFECYCLE_SKILL_PATH = fileURLToPath(new URL('../skills/nimi-app-lifecycle/SKILL.md', import.meta.url));
7
7
  export const PROJECT_SKILL_DIR = '.agents/skills/nimi-app-lifecycle';
8
- const SKILL_FILES = ['SKILL.md', ...['audit', 'create', 'adapt', 'platform-gaps', 'upgrade-platform', 'sync-upstream', 'safety-declaration', 'release', 'acceptance'].map((name) => `references/${name}.md`)];
8
+ const SKILL_FILES = ['SKILL.md', ...['audit', 'create', 'adapt', 'platform-gaps', 'upgrade-platform', 'sync-upstream', 'safety-declaration', 'storefront', 'release', 'acceptance'].map((name) => `references/${name}.md`)];
9
9
  const START = '<!-- nimi-app:managed:start -->';
10
10
  const END = '<!-- nimi-app:managed:end -->';
11
11
  const AGENTS_BLOCK = `${START}
package/lib/app-pack.mjs CHANGED
@@ -449,17 +449,12 @@ export function writeNimiAppArchive(entries, options = {}) {
449
449
  if (normalized.length === 0 || normalized.length > MAX_ZIP32_ENTRIES) {
450
450
  throw new Error('nimiapp archive requires between 1 and 65535 files');
451
451
  }
452
- for (let index = 1; index < normalized.length; index += 1) {
453
- if (Buffer.compare(normalized[index - 1].rawName, normalized[index].rawName) >= 0) {
452
+ let totalUncompressed = 0;
453
+ for (let index = 0; index < normalized.length; index += 1) {
454
+ const entry = normalized[index];
455
+ if (index > 0 && Buffer.compare(normalized[index - 1].rawName, entry.rawName) >= 0) {
454
456
  throw new Error('nimiapp archive entries must be unique');
455
457
  }
456
- }
457
-
458
- const localParts = [];
459
- const centralParts = [];
460
- let offset = 0;
461
- let totalUncompressed = 0;
462
- for (const entry of normalized) {
463
458
  const uncompSize = entry.bytes.length;
464
459
  if (uncompSize > NATIVE_MAX_ENTRY_BYTES || uncompSize >= 0xffffffff) {
465
460
  throw new Error(`Archive entry is too large: ${entry.name}`);
@@ -471,12 +466,23 @@ export function writeNimiAppArchive(entries, options = {}) {
471
466
  if (totalUncompressed > maxTotalUncompressedBytes) {
472
467
  throw new Error(`Archive uncompressed size exceeds ${maxTotalUncompressedBytes} bytes`);
473
468
  }
469
+ }
470
+ const enforceExpansionBudget = totalUncompressed > EXPANSION_RATIO_FLOOR_BYTES;
471
+
472
+ const localParts = [];
473
+ const centralParts = [];
474
+ let offset = 0;
475
+ let emittedUncompressed = 0;
476
+ for (const entry of normalized) {
477
+ const uncompSize = entry.bytes.length;
474
478
  const crc = uncompSize === 0 ? 0 : nativeCrc32(entry.bytes);
475
479
  let method = ZIP_METHOD_STORE;
476
480
  let payload = entry.bytes;
477
481
  if (compress && entry.mode !== SYMBOLIC_LINK_MODE && uncompSize > 0) {
478
482
  const deflated = deflateRawSync(entry.bytes, { level: DEFLATE_LEVEL });
479
- if (deflated.length > 0 && deflated.length < uncompSize) {
483
+ const fitsBudget = !enforceExpansionBudget
484
+ || emittedUncompressed + uncompSize <= (offset + 30 + entry.rawName.length + deflated.length) * MAX_EXPANSION_RATIO;
485
+ if (deflated.length > 0 && deflated.length < uncompSize && fitsBudget) {
480
486
  method = ZIP_METHOD_DEFLATE;
481
487
  payload = deflated;
482
488
  }
@@ -499,6 +505,7 @@ export function writeNimiAppArchive(entries, options = {}) {
499
505
  );
500
506
  centralParts.push(central, entry.rawName);
501
507
  offset = nextOffset;
508
+ emittedUncompressed += uncompSize;
502
509
  }
503
510
  const central = Buffer.concat(centralParts);
504
511
  const finalSize = offset + central.length + 22;
@@ -678,6 +685,8 @@ export async function writeNimiAppArchiveToFile(filePath, entries, options = {})
678
685
  }
679
686
  }
680
687
 
688
+ const enforceExpansionBudget = totalUncompressed > EXPANSION_RATIO_FLOOR_BYTES;
689
+
681
690
  await fsp.mkdir(path.dirname(filePath), { recursive: true });
682
691
  const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
683
692
  const shardPath = `${tempPath}.shard`;
@@ -685,6 +694,7 @@ export async function writeNimiAppArchiveToFile(filePath, entries, options = {})
685
694
  const archiveHash = createHash('sha256');
686
695
  const centralParts = [];
687
696
  let offset = 0;
697
+ let emittedUncompressed = 0;
688
698
  let hashedEntrySha256 = null;
689
699
  let renamed = false;
690
700
 
@@ -716,7 +726,9 @@ export async function writeNimiAppArchiveToFile(filePath, entries, options = {})
716
726
  let payload = plain;
717
727
  if (compress && entry.mode !== SYMBOLIC_LINK_MODE) {
718
728
  const deflated = deflateRawSync(plain, { level: DEFLATE_LEVEL });
719
- if (deflated.length > 0 && deflated.length < uncompSize) {
729
+ const fitsBudget = !enforceExpansionBudget
730
+ || emittedUncompressed + uncompSize <= (offset + 30 + entry.rawName.length + deflated.length) * MAX_EXPANSION_RATIO;
731
+ if (deflated.length > 0 && deflated.length < uncompSize && fitsBudget) {
720
732
  method = ZIP_METHOD_DEFLATE;
721
733
  payload = deflated;
722
734
  }
@@ -735,7 +747,9 @@ export async function writeNimiAppArchiveToFile(filePath, entries, options = {})
735
747
  const stats = await streamDeflateFileToShard(entry.filePath, shardPath, uncompSize, wantHash);
736
748
  crc = stats.crc;
737
749
  if (wantHash) hashedEntrySha256 = stats.entrySha256;
738
- if (stats.compSize > 0 && stats.compSize < uncompSize) {
750
+ const fitsBudget = !enforceExpansionBudget
751
+ || emittedUncompressed + uncompSize <= (offset + 30 + entry.rawName.length + stats.compSize) * MAX_EXPANSION_RATIO;
752
+ if (stats.compSize > 0 && stats.compSize < uncompSize && fitsBudget) {
739
753
  method = ZIP_METHOD_DEFLATE;
740
754
  compSize = stats.compSize;
741
755
  const nextOffset = offset + 30 + entry.rawName.length + compSize;
@@ -806,6 +820,7 @@ export async function writeNimiAppArchiveToFile(filePath, entries, options = {})
806
820
  );
807
821
  centralParts.push(central, entry.rawName);
808
822
  offset += 30 + entry.rawName.length + compSize;
823
+ emittedUncompressed += uncompSize;
809
824
  }
810
825
 
811
826
  const central = Buffer.concat(centralParts);
@@ -1009,6 +1024,9 @@ export function readNimiAppArchive(bytes, options = {}) {
1009
1024
  totalUncompressed,
1010
1025
  );
1011
1026
  const localBuf = archive.subarray(meta.localOffset, meta.dataOffset);
1027
+ if (options.storeOnly && meta.method !== ZIP_METHOD_STORE) {
1028
+ throw new Error('Storefront media ZIP entries must use the Store method');
1029
+ }
1012
1030
  assertLocalHeaderMatches(localBuf, meta);
1013
1031
  parsed.push(meta);
1014
1032
  cursor = meta.nextCursor;
@@ -1664,7 +1682,7 @@ export async function aggregateAppTargetCandidates(cwd, options = {}) {
1664
1682
  }
1665
1683
  const firstInfo = parsedInfos[0].info;
1666
1684
  for (const entry of parsedInfos.slice(1)) {
1667
- for (const field of ['display_name', 'summary', 'icon', 'readme_markdown', 'release_notes_markdown', 'safety_profile', 'storefront']) {
1685
+ for (const field of ['display_name', 'summary', 'icon', 'readme_markdown', 'release_notes_markdown', 'safety_profile', 'storefront', 'localization']) {
1668
1686
  if (!sameCanonicalValue(entry.info[field], firstInfo[field])) {
1669
1687
  throw new Error(`Target App info ${field} differs between ${parsedInfos[0].targetId} and ${entry.targetId}; one release shares one presentation`);
1670
1688
  }
@@ -60,6 +60,18 @@ const APP_OWNED_ELECTRON_BUILD_PROFILE_REF = 'electron-pnpm';
60
60
  const SUPPORTED_BUILD_PROFILE_REFS = new Set([MANAGED_WEB_BUILD_PROFILE_REF, ELECTRON_BUILD_PROFILE_REF, APP_OWNED_ELECTRON_BUILD_PROFILE_REF, 'web-pnpm']);
61
61
  const MANAGED_WORKFLOW_PATH = '.github/workflows/nimi-app-release.yml';
62
62
  const HOSTED_WEB_WORKFLOW_PATH = '.github/workflows/nimi-web-release.yml';
63
+ const STOREFRONT_WORKFLOW_PATH = '.github/workflows/nimi-storefront-release.yml';
64
+ function storefrontWorkflowSource() {
65
+ return readFileSync(new URL('../templates/storefront-release.yml', import.meta.url), 'utf8').replaceAll('\r\n', '\n');
66
+ }
67
+
68
+ function planStorefrontWorkflow(targetDir) {
69
+ const file = plannedFile(targetDir, STOREFRONT_WORKFLOW_PATH, storefrontWorkflowSource());
70
+ if (file.previous && file.previous.toString('utf8').replaceAll('\r\n', '\n') !== file.content) {
71
+ throw new Error('Storefront workflow already exists with different content: ' + STOREFRONT_WORKFLOW_PATH);
72
+ }
73
+ return file;
74
+ }
63
75
  function hostedWorkflowSource() {
64
76
  return readFileSync(new URL('../templates/hosted-web-release.yml', import.meta.url), 'utf8').replaceAll('\r\n', '\n');
65
77
  }
@@ -173,7 +185,8 @@ function readSubmittedManifest(targetDir, sources) {
173
185
  }
174
186
  }
175
187
  const desktop = validateManifestDesktop(document.desktop, 'nimi.app.yaml desktop', source);
176
- return Object.freeze({ appId, displayName, profile, platform, version, publicSlug: hosted?.slug, rendererOrigin: parsedOrigin.origin, capabilityContractRefs: document.capability_contract_refs, requiredStandardizedFeatureRefs: document.required_standardized_feature_refs, storagePolicy: document.storage_policy, safetyProfile, desktop });
188
+ const publishesStorefront = document.metadata?.storefront?.schema_version === 2 && Boolean(document.metadata.storefront.media);
189
+ return Object.freeze({ appId, displayName, profile, platform, version, publishesStorefront, publicSlug: hosted?.slug, rendererOrigin: parsedOrigin.origin, capabilityContractRefs: document.capability_contract_refs, requiredStandardizedFeatureRefs: document.required_standardized_feature_refs, storagePolicy: document.storage_policy, safetyProfile, desktop });
177
190
  }
178
191
 
179
192
  function assertNoRetiredScaffoldState(targetDir) {
@@ -711,7 +724,7 @@ function normalizeStandaloneSourceFiles(targetDir, sources) {
711
724
  .replace(/^const nimiRepoRoot\s*=.*\r?\n/gmu, '')
712
725
  .replace(/^const nimiSdkSourceRoot\s*=.*\r?\n/gmu, '')
713
726
  .replace(/^const nimiKitSourceRoot\s*=.*\r?\n/gmu, '')
714
- .replace(/^\s*\|\|\s*normalizedId\.includes\(['"]\/nimi-realm\/nimi\/(?:sdks\/typescript|kit)\/['"]\)\r?\n/gmu, '')
727
+ .replace(/^\s*\|\|\s*normalizedId\.includes\(['"](?:\/[^/'"]+)*\/nimi\/(?:sdks\/typescript|kit)\/['"]\)\r?\n/gmu, '')
715
728
  .replace(/^\s*\{\s*find:\s*\/\^@nimiplatform\\\/(?:sdk|kit).*replacement:\s*path\.resolve\(nimi(?:Sdk|Kit)SourceRoot.*\r?\n/gmu, '')
716
729
  .replace(/\n\s*server:\s*\{\s*\n\s*fs:\s*\{\s*\n\s*allow:\s*\[\s*\n\s*appRoot,\s*\n\s*nimiRepoRoot,\s*\n\s*\],\s*\n\s*\},\s*\n\s*\},?/mu, '\n');
717
730
  if (!content.includes('appRoot')) content = content.replace(/^const appRoot\s*=.*\r?\n/gmu, '');
@@ -735,7 +748,7 @@ function assertNoStandaloneParentSources(targetDir, sources) {
735
748
  if (!hasProjectFile(targetDir, relativePath, sources)) continue;
736
749
  const source = readProjectText(targetDir, relativePath, sources);
737
750
  if (
738
- /nimiRepoRoot|nimiSdkSourceRoot|nimiKitSourceRoot|\/nimi-realm\/nimi\/(?:sdks|kit)\//u.test(source)
751
+ /nimiRepoRoot|nimiSdkSourceRoot|nimiKitSourceRoot|(?:\/[^/'"]+)*\/nimi\/(?:sdks|kit)\//u.test(source)
739
752
  || /find:\s*\/\^@nimiplatform\\\/(?:sdk|kit)(?:\\\/|\$)/u.test(source)
740
753
  || /server\s*:\s*\{[\s\S]*?fs\s*:\s*\{[\s\S]*?allow\s*:/u.test(source)
741
754
  || /@source\s+["'][^"']*\/nimi\/kit\//u.test(source)
@@ -758,7 +771,7 @@ function cargoPackageNameFromNpmPackageName(packageName) {
758
771
  return `${normalized}-shell`;
759
772
  }
760
773
 
761
- function tauriIdentifierFromAppId(appId) {
774
+ function nativeBundleIdentifierFromAppId(appId) {
762
775
  return `ai.nimi.apps.${appId}`;
763
776
  }
764
777
 
@@ -790,7 +803,7 @@ function assertCanonicalAuthoringInputs(targetDir, descriptor, files, version, n
790
803
  if (!hasProjectFile(targetDir, APP_IDENTITY_PATH, sources)) throw new Error(`Required App lifecycle file is missing: ${APP_IDENTITY_PATH}`);
791
804
  if (!hasProjectFile(targetDir, SUBMISSION_PATH, sources)) throw new Error(`Required App lifecycle file is missing: ${SUBMISSION_PATH}`);
792
805
  const identity = assertExactKeys(parseYamlFile(readProjectText(targetDir, APP_IDENTITY_PATH, sources), identityPath), APP_IDENTITY_PATH, [
793
- 'app_id', 'display_name', 'version', 'npm_package_name', 'cargo_package_name', 'tauri_identifier', 'package_author', 'identity_role',
806
+ 'app_id', 'display_name', 'version', 'npm_package_name', 'cargo_package_name', 'native_bundle_identifier', 'package_author', 'identity_role',
794
807
  ]);
795
808
  const packageAuthor = files.packageJson.author === undefined ? null : files.packageJson.author;
796
809
  if (packageAuthor !== null) canonicalInputText(packageAuthor, 'package.json author');
@@ -800,7 +813,7 @@ function assertCanonicalAuthoringInputs(targetDir, descriptor, files, version, n
800
813
  version,
801
814
  npm_package_name: canonicalInputText(files.packageJson.name, 'package.json name'),
802
815
  cargo_package_name: nativeIdentity.cargoPackageName,
803
- tauri_identifier: nativeIdentity.tauriIdentifier,
816
+ native_bundle_identifier: nativeIdentity.nativeBundleIdentifier,
804
817
  package_author: packageAuthor,
805
818
  identity_role: 'scaffold-generated-authoring-input',
806
819
  };
@@ -815,7 +828,7 @@ function assertCanonicalAuthoringInputs(targetDir, descriptor, files, version, n
815
828
  'profile',
816
829
  'npm_package_name',
817
830
  'cargo_package_name',
818
- 'tauri_identifier',
831
+ 'native_bundle_identifier',
819
832
  'package_author',
820
833
  'submission_role',
821
834
  'capability_contract_refs',
@@ -833,7 +846,7 @@ function assertCanonicalAuthoringInputs(targetDir, descriptor, files, version, n
833
846
  ...(descriptor.platform === 'web' ? { platform: 'web' } : {}),
834
847
  npm_package_name: expectedIdentity.npm_package_name,
835
848
  cargo_package_name: expectedIdentity.cargo_package_name,
836
- tauri_identifier: expectedIdentity.tauri_identifier,
849
+ native_bundle_identifier: expectedIdentity.native_bundle_identifier,
837
850
  package_author: packageAuthor,
838
851
  submission_role: 'developer-submitted-input',
839
852
  admission_truth: 'platform-owned-after-review',
@@ -1085,10 +1098,14 @@ function assertProjectLifecycleCurrent(targetDir, versions, options = {}) {
1085
1098
  const version = assertVersionLockstep(files, descriptor);
1086
1099
  const nativeIdentity = {
1087
1100
  cargoPackageName: cargoPackageNameFromNpmPackageName(files.packageJson.name),
1088
- tauriIdentifier: tauriIdentifierFromAppId(descriptor.appId),
1101
+ nativeBundleIdentifier: nativeBundleIdentifierFromAppId(descriptor.appId),
1089
1102
  };
1090
1103
  assertNoStandaloneParentSources(targetDir, sources);
1091
1104
  const authoring = assertCanonicalAuthoringInputs(targetDir, descriptor, files, version, nativeIdentity, sources);
1105
+ if (descriptor.publishesStorefront && (!hasProjectFile(targetDir, STOREFRONT_WORKFLOW_PATH, sources) ||
1106
+ readProjectText(targetDir, STOREFRONT_WORKFLOW_PATH, sources).replaceAll('\r\n', '\n') !== storefrontWorkflowSource())) {
1107
+ throw new Error('Use nimi-app sync to install the reviewed storefront workflow.');
1108
+ }
1092
1109
  if (descriptor.publicSlug && (!hasProjectFile(targetDir, HOSTED_WEB_WORKFLOW_PATH, sources) || readProjectText(targetDir, HOSTED_WEB_WORKFLOW_PATH, sources).replaceAll('\r\n', '\n') !== hostedWorkflowSource())) {
1093
1110
  throw new Error('The hosted Web workflow must match App Tools. Use nimi-app sync to install its reviewed template.');
1094
1111
  }
@@ -1124,7 +1141,7 @@ function buildExistingSubmittedAppSyncPlan(targetDir, versions, sources, managed
1124
1141
  ...(descriptor.platform === 'web' ? { platform: 'web' } : {}),
1125
1142
  packageName: files.packageJson.name,
1126
1143
  cargoPackageName: cargoPackageNameFromNpmPackageName(files.packageJson.name),
1127
- tauriIdentifier: tauriIdentifierFromAppId(descriptor.appId),
1144
+ nativeBundleIdentifier: nativeBundleIdentifierFromAppId(descriptor.appId),
1128
1145
  author: typeof files.packageJson.author === 'string' ? files.packageJson.author : '',
1129
1146
  };
1130
1147
  const planned = [
@@ -1149,7 +1166,7 @@ function buildExistingSubmittedAppSyncPlan(targetDir, versions, sources, managed
1149
1166
  'profile',
1150
1167
  'npm_package_name',
1151
1168
  'cargo_package_name',
1152
- 'tauri_identifier',
1169
+ 'native_bundle_identifier',
1153
1170
  'package_author',
1154
1171
  'submission_role',
1155
1172
  'capability_contract_refs',
@@ -1210,6 +1227,7 @@ function buildExistingSubmittedAppSyncPlan(targetDir, versions, sources, managed
1210
1227
  });
1211
1228
  }
1212
1229
  if (descriptor.publicSlug) planned.push(planHostedWorkflow(targetDir));
1230
+ if (descriptor.publishesStorefront) planned.push(planStorefrontWorkflow(targetDir));
1213
1231
  const workspace = normalizePnpmWorkspace(targetDir);
1214
1232
  if (workspace) planned.push(workspace);
1215
1233
  return { descriptor, planned: planned.map((file) => plannedFile(targetDir, path.relative(targetDir, file.path), file.content)), buildProfileRef: buildProfile.buildProfileRef, combination, toolchainUpdates, packageJson: files.packageJson };
@@ -1244,7 +1262,9 @@ function validateProjectPlan(targetDir, versions, planned, managed) {
1244
1262
 
1245
1263
  export function validateAppInitialization(targetDir, versions) {
1246
1264
  const effective = managedProjectVersions(targetDir, versions);
1247
- const planned = readSubmittedManifest(targetDir).publicSlug ? [planHostedWorkflow(targetDir)] : [];
1265
+ const descriptor = readSubmittedManifest(targetDir);
1266
+ const planned = descriptor.publicSlug ? [planHostedWorkflow(targetDir)] : [];
1267
+ if (descriptor.publishesStorefront) planned.push(planStorefrontWorkflow(targetDir));
1248
1268
  const current = assertProjectLifecycleCurrent(targetDir, effective, { managed: true, sources: planSources(targetDir, planned) });
1249
1269
  for (const target of Object.keys(current.buildProfile.targets)) selectBuildOwner(current.buildProfile, target);
1250
1270
  return planned;