@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
@@ -0,0 +1,152 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { parse as parseYaml } from 'yaml';
5
+ import { isLocalDependencySpec } from './app-dependency-combinations.mjs';
6
+ import { writeNimiAppArchive } from './app-pack.mjs';
7
+ import { assertProjectOutputPath } from './app-project-files.mjs';
8
+ import { compilePublicStorefront } from './storefront-source.mjs';
9
+ import { PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES, PUBLIC_STOREFRONT_MAX_BYTES } from './public-storefront.mjs';
10
+
11
+ const digest = (bytes) => createHash('sha256').update(bytes).digest('hex');
12
+
13
+ const isLocalSpec = (value) =>
14
+ typeof value === 'string' && !/^https?:\/\//iu.test(value.trim()) && isLocalDependencySpec(value);
15
+
16
+ function findLocalNimiSpec(value, currentPackage = '') {
17
+ if (Array.isArray(value)) {
18
+ for (const item of value) {
19
+ const found = findLocalNimiSpec(item, currentPackage);
20
+ if (found) return found;
21
+ }
22
+ return null;
23
+ }
24
+ if (!value || typeof value !== 'object') return null;
25
+ for (const [key, child] of Object.entries(value)) {
26
+ const normalizedKey = String(key).replace(/^\/+/, '');
27
+ const packageName = normalizedKey.startsWith('@nimiplatform/')
28
+ ? normalizedKey.split('@').slice(0, 2).join('@')
29
+ : currentPackage;
30
+ if (
31
+ normalizedKey.startsWith('@nimiplatform/') &&
32
+ normalizedKey.length > packageName.length + 1 &&
33
+ isLocalSpec(normalizedKey.slice(packageName.length + 1))
34
+ ) {
35
+ return normalizedKey;
36
+ }
37
+ if (packageName && typeof child === 'string' && isLocalSpec(child)) {
38
+ return `${packageName} (${child})`;
39
+ }
40
+ const found = findLocalNimiSpec(child, packageName);
41
+ if (found) return found;
42
+ }
43
+ return null;
44
+ }
45
+
46
+ function assertStorefrontProductionDependencies(root) {
47
+ const workspacePath = path.join(root, 'pnpm-workspace.yaml');
48
+ if (existsSync(workspacePath)) {
49
+ const workspace = parseYaml(readFileSync(workspacePath, 'utf8'));
50
+ const overrides = workspace?.overrides;
51
+ if (overrides && typeof overrides === 'object' && !Array.isArray(overrides)) {
52
+ for (const [key, value] of Object.entries(overrides)) {
53
+ if (key.startsWith('@nimiplatform/') && isLocalSpec(value)) {
54
+ throw new Error(
55
+ `Production storefront preflight requires published Nimi dependencies; remove local override ${key} in pnpm-workspace.yaml`,
56
+ );
57
+ }
58
+ }
59
+ }
60
+ }
61
+ const lockPath = path.join(root, 'pnpm-lock.yaml');
62
+ if (existsSync(lockPath)) {
63
+ const lock = parseYaml(readFileSync(lockPath, 'utf8'));
64
+ const local = findLocalNimiSpec(lock);
65
+ if (local) {
66
+ throw new Error(
67
+ `Production storefront preflight requires published Nimi dependencies; pnpm-lock.yaml contains local resolution ${local}`,
68
+ );
69
+ }
70
+ }
71
+ }
72
+
73
+ function buildStorefront(root, revision, production) {
74
+ if (production) assertStorefrontProductionDependencies(root);
75
+ const { manifest, entries, warnings } = compilePublicStorefront(root, revision);
76
+ const json = Buffer.from(JSON.stringify(manifest) + '\n');
77
+ if (json.length > PUBLIC_STOREFRONT_MAX_BYTES) throw new Error('Storefront manifest exceeds 1 MiB');
78
+ const archive = writeNimiAppArchive(
79
+ Array.from(entries, ([name, bytes]) => ({ name, bytes, mode: 0o644 })),
80
+ {
81
+ compress: false,
82
+ maxArchiveBytes: PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES,
83
+ maxTotalUncompressedBytes: PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES,
84
+ },
85
+ );
86
+ return { manifest, images: entries.size, warnings, json, archive };
87
+ }
88
+
89
+ export function checkStorefront(cwd, options = {}) {
90
+ const production = options.production === true;
91
+ const { manifest, images, warnings } = buildStorefront(
92
+ path.resolve(cwd, options.dir || '.'),
93
+ 1,
94
+ production,
95
+ );
96
+ return {
97
+ ok: true,
98
+ command: 'check',
99
+ storefront: true,
100
+ production,
101
+ app_id: manifest.app_id,
102
+ images,
103
+ warnings,
104
+ };
105
+ }
106
+
107
+ export function packStorefront(cwd, options = {}) {
108
+ const revision = Number(options.rev);
109
+ if (!/^[1-9][0-9]*$/u.test(String(options.rev)) || !Number.isSafeInteger(revision))
110
+ throw new Error('Storefront revision must be a positive integer');
111
+ const production = options.production === true;
112
+ const root = path.resolve(cwd, options.dir || '.');
113
+ const { manifest, images, warnings, json, archive } = buildStorefront(root, revision, production);
114
+ const manifestSha = digest(json),
115
+ archiveSha = digest(archive);
116
+ const parent = path.join(root, 'dist', 'nimi-storefront', String(revision)),
117
+ output = path.join(parent, manifestSha);
118
+ const prefix = manifest.app_id + '-storefront-' + revision,
119
+ manifestName = prefix + '.json',
120
+ archiveName = prefix + '-media.zip';
121
+ assertProjectOutputPath(root, path.join(output, manifestName));
122
+ mkdirSync(parent, { recursive: true });
123
+ const temp = mkdtempSync(path.join(parent, '.pack-'));
124
+ try {
125
+ writeFileSync(path.join(temp, manifestName), json);
126
+ writeFileSync(path.join(temp, archiveName), archive);
127
+ try {
128
+ renameSync(temp, output);
129
+ } catch (err) {
130
+ if (
131
+ !existsSync(output) ||
132
+ !json.equals(readFileSync(path.join(output, manifestName))) ||
133
+ !archive.equals(readFileSync(path.join(output, archiveName)))
134
+ )
135
+ throw err;
136
+ }
137
+ } finally {
138
+ rmSync(temp, { recursive: true, force: true });
139
+ }
140
+ return {
141
+ ok: true,
142
+ command: 'pack',
143
+ storefront: true,
144
+ production,
145
+ app_id: manifest.app_id,
146
+ revision,
147
+ images,
148
+ warnings,
149
+ manifest: { path: path.join(output, manifestName), size: json.length, sha256: manifestSha },
150
+ media_archive: { path: path.join(output, archiveName), size: archive.length, sha256: archiveSha },
151
+ };
152
+ }
@@ -0,0 +1,31 @@
1
+ // @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042e
2
+ import { isDeepStrictEqual } from 'node:util';
3
+ import { readNimiAppArchive } from './app-pack.mjs';
4
+ import {
5
+ PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES,
6
+ inspectPublicStorefrontImage,
7
+ readPublicStorefront,
8
+ } from './public-storefront.mjs';
9
+
10
+ export function verifyPublicStorefrontArchive(document, archive) {
11
+ const { manifest, refs } = readPublicStorefront(document);
12
+ const entries = readNimiAppArchive(archive, {
13
+ storeOnly: true,
14
+ maxArchiveBytes: PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES,
15
+ maxTotalUncompressedBytes: PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES,
16
+ });
17
+ if (entries.size !== refs.size) throw new Error('Storefront archive differs from its manifest');
18
+ const warnings = [];
19
+ for (const [name, entry] of entries) {
20
+ const expected = refs.get(name);
21
+ if (!expected || entry.mode !== 0o644) throw new Error('Invalid storefront archive entry: ' + name);
22
+ for (const role of expected.roles) {
23
+ const actual = inspectPublicStorefrontImage(entry.bytes, role, name, warnings);
24
+ if (!isDeepStrictEqual(actual, expected.ref))
25
+ throw new Error('Storefront image differs from its reviewed reference: ' + name);
26
+ }
27
+ if (expected.roles.has('capsule_wide') && expected.roles.has('showcase'))
28
+ warnings.push({ reason: 'capsule-reused-in-showcase', sha256: expected.ref.sha256 });
29
+ }
30
+ return { manifest, refs, entries, warnings };
31
+ }
@@ -0,0 +1,161 @@
1
+ // @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042e
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { parse as parseYaml } from 'yaml';
5
+ import { readAppResource } from './app-resources.mjs';
6
+ import {
7
+ inspectPublicStorefrontImage,
8
+ PUBLIC_STOREFRONT_SLOTS,
9
+ PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES,
10
+ readPublicStorefront,
11
+ storefrontFields,
12
+ storefrontLocale,
13
+ storefrontText,
14
+ } from './public-storefront.mjs';
15
+
16
+ function textFile(root, relative) {
17
+ const bytes = readAppResource(root, relative, 'storefront introduction', 96 * 1024);
18
+ const text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
19
+ return storefrontText(text, relative, 96 * 1024, true);
20
+ }
21
+
22
+ export function packageLocalizationFromSource(root, manifest) {
23
+ const source = manifest.metadata?.storefront;
24
+ if (source?.schema_version !== 2) return undefined;
25
+ const defaultLocale = storefrontLocale(source.default_locale);
26
+ const keys = Object.keys(source.locales ?? {}).sort();
27
+ if (!keys.length || keys.length > 16 || !keys.includes(defaultLocale))
28
+ throw new Error('Invalid package localization languages');
29
+ if (Object.hasOwn(manifest.metadata, 'readme'))
30
+ throw new Error('Use root NIMI_APP.md for the default App introduction');
31
+ const defaultIntro = textFile(root, 'NIMI_APP.md');
32
+ const locales = {};
33
+ for (const lang of keys) {
34
+ storefrontLocale(lang);
35
+ const entry = source.locales[lang];
36
+ storefrontFields(
37
+ entry,
38
+ 'storefront.locales.' + lang,
39
+ [],
40
+ ['display_name', 'summary', 'introduction_file', 'tagline', 'highlights'],
41
+ );
42
+ if (
43
+ lang === defaultLocale &&
44
+ entry.introduction_file !== undefined &&
45
+ entry.introduction_file !== 'NIMI_APP.md'
46
+ ) {
47
+ throw new Error('The default introduction must be root NIMI_APP.md');
48
+ }
49
+ const conventional = 'NIMI_APP.' + lang + '.md';
50
+ const file =
51
+ lang === defaultLocale
52
+ ? 'NIMI_APP.md'
53
+ : (entry.introduction_file ??
54
+ (existsSync(path.join(root, conventional)) ? conventional : undefined));
55
+ const displayName = entry.display_name ?? manifest.display_name;
56
+ if (typeof displayName === 'string' && [...displayName].length > 120) {
57
+ throw new Error(
58
+ `storefront.locales.${lang}.display_name exceeds the 120-character offline app-info limit (public storefront allows up to 80 characters)`,
59
+ );
60
+ }
61
+ locales[lang] = {
62
+ display_name: storefrontText(displayName, `storefront.locales.${lang}.display_name`, 120),
63
+ summary: storefrontText(entry.summary ?? manifest.metadata.summary, `storefront.locales.${lang}.summary`, 280),
64
+ ...(file === undefined
65
+ ? {}
66
+ : { introduction_markdown: file === 'NIMI_APP.md' ? defaultIntro : textFile(root, file) }),
67
+ };
68
+ }
69
+ return { default_locale: defaultLocale, locales };
70
+ }
71
+
72
+ export function compilePublicStorefront(root, revision) {
73
+ const app = parseYaml(readFileSync(path.join(root, 'nimi.app.yaml'), 'utf8'));
74
+ const source = app?.metadata?.storefront;
75
+ storefrontFields(source, 'metadata.storefront', [
76
+ 'schema_version',
77
+ 'default_locale',
78
+ 'primary_genre',
79
+ 'secondary_genres',
80
+ 'tag_ids',
81
+ 'brand',
82
+ 'locales',
83
+ 'media',
84
+ ]);
85
+ if (source.schema_version !== 2)
86
+ throw new Error('Publishing a storefront requires metadata.storefront.schema_version: 2');
87
+ const { locales: packageTexts } = packageLocalizationFromSource(root, app);
88
+ const locales = Object.fromEntries(
89
+ Object.entries(packageTexts).map(([lang, entry]) => {
90
+ if (entry.introduction_markdown === undefined) {
91
+ throw new Error(
92
+ `Public storefront locale "${lang}" requires an introduction file (add NIMI_APP.${lang}.md or set metadata.storefront.locales.${lang}.introduction_file)`,
93
+ );
94
+ }
95
+ if ([...entry.display_name].length > 80) {
96
+ throw new Error(
97
+ `locales.${lang}.display_name exceeds the 80-character public storefront limit (offline app-info allows up to 120 characters)`,
98
+ );
99
+ }
100
+ return [
101
+ lang,
102
+ {
103
+ ...entry,
104
+ tagline: source.locales[lang].tagline,
105
+ highlights: source.locales[lang].highlights,
106
+ },
107
+ ];
108
+ }),
109
+ );
110
+ storefrontFields(
111
+ source.media,
112
+ 'metadata.storefront.media',
113
+ ['capsule_wide', 'hero_banner', 'showcase'],
114
+ ['icon', 'capsule_portrait', 'logo_mark'],
115
+ );
116
+ const icon = source.media.icon ?? {
117
+ default: app.metadata.icon,
118
+ alt: Object.fromEntries(Object.entries(locales).map(([lang, t]) => [lang, t.display_name])),
119
+ };
120
+ if (icon.default !== app.metadata.icon)
121
+ throw new Error('Storefront icon and metadata.icon must share the default App artwork');
122
+ const entries = new Map(),
123
+ files = new Map(),
124
+ checkedFiles = new Map(),
125
+ warnings = [];
126
+ let total = 0;
127
+ const doc = {
128
+ format: 'nimi.storefront/v2',
129
+ app_id: app.app_id,
130
+ revision,
131
+ default_locale: source.default_locale,
132
+ primary_genre: source.primary_genre,
133
+ secondary_genres: source.secondary_genres,
134
+ tag_ids: source.tag_ids,
135
+ brand: source.brand,
136
+ locales,
137
+ media: { ...source.media, icon },
138
+ };
139
+ const { manifest, refs } = readPublicStorefront(doc, (relative, role, label) => {
140
+ const slotFile = role + '\0' + relative;
141
+ if (checkedFiles.has(slotFile)) return checkedFiles.get(slotFile);
142
+ const bytes = readAppResource(root, relative, label, PUBLIC_STOREFRONT_SLOTS[role].maxBytes);
143
+ const ref = inspectPublicStorefrontImage(bytes, role, label, warnings);
144
+ if (role === 'icon' && app.platform !== 'web' && ref.media_type !== 'image/png')
145
+ throw new Error('Desktop App icons must use PNG');
146
+ const name = ref.sha256 + (ref.media_type === 'image/png' ? '.png' : '.webp');
147
+ if (!entries.has(name)) {
148
+ total += bytes.length;
149
+ if (total > PUBLIC_STOREFRONT_ARCHIVE_MAX_BYTES) throw new Error('Storefront artwork exceeds 32 MiB');
150
+ entries.set(name, bytes);
151
+ files.set(name, relative);
152
+ }
153
+ checkedFiles.set(slotFile, ref);
154
+ return ref;
155
+ });
156
+ for (const { roles, ref } of refs.values()) {
157
+ if (roles.has('capsule_wide') && roles.has('showcase'))
158
+ warnings.push({ reason: 'capsule-reused-in-showcase', sha256: ref.sha256 });
159
+ }
160
+ return { manifest, entries, files, warnings };
161
+ }
@@ -41,7 +41,10 @@ export async function handleNimiWebCoordination({ request, env }) {
41
41
  const target = new URL(source.pathname + source.search, realm);
42
42
  let upstream;
43
43
  try {
44
- upstream = await fetch(target, { method: request.method, headers, body: request.body, redirect: 'manual' });
44
+ upstream = await fetch(target, {
45
+ method: request.method, headers, redirect: 'manual',
46
+ ...(request.body ? { body: request.body, duplex: 'half' } : {}),
47
+ });
45
48
  } catch {
46
49
  return reject('Realm coordination is unavailable', 502);
47
50
  }
@@ -47,7 +47,7 @@ export function buildWebStarterFiles(identity, { productArea, navigation }) {
47
47
  managed('src/shell/auth/runtime-platform.ts', WEB_RUNTIME),
48
48
  managed('src/shell/web-download.ts', WEB_DOWNLOAD),
49
49
  managed('vite.config.ts', WEB_VITE),
50
- managed('src/shell/routes/product-area.tsx', productArea),
50
+ { path: 'src/shell/routes/product-area.tsx', content: productArea, mutationClass: 'app-owned product code' },
51
51
  { ...managed('src/shell/routes/app-navigation.tsx', navigation), mutationClass: 'app-owned product code' },
52
52
  { path: 'README.md', mutationClass: 'app-owned product code', content: `# ${identity.appTitle}\n\nBrowser App using the shared Nimi SDK and Kit.\n\nInstall dependencies and configure the admitted HTTPS origin, client ID and callback in nimi.app.yaml before running init, check or dev. In .env.local, point NIMI_WEB_TLS_KEY to your HTTPS private key and NIMI_WEB_TLS_CERT to its matching certificate. Your browser must trust that certificate. Have this source admitted through the Registry owner and confirm it once in PC Home. These steps do not publish the website.\n\nAI and files travel directly to the user's primary Runtime. The dev server forwards only scoped identity and connection coordination. Production hosting must separately provide those bounded routes. No Relay or native Host is installed in the browser.\n\nThe initial test command typechecks the project; add business tests as the App evolves and run real supported tasks. Build does not certify Runtime use. For a Nimi-hosted Web release, declare public_slug, build the hosted candidate and follow Registry review and platform promotion. See the Web release instructions in the App Tools README.\n` },
53
53
  { path: 'AGENTS.md', mutationClass: 'app-owned product code', content: '# Web App instructions\n\nUse the shared public SDK and Kit. Keep business state with the App and AI execution with Runtime. This project uses official Runtime-client login and an admitted Web source, never native Host proof or a direct provider fallback. Preserve App-owned product code during sync. Use the declared development, test and build commands. New source admission and first Home confirmation belong to their owners; normal reconnection reuses them. Do not publish or bypass trust prompts as part of development.\n' },
@@ -94,8 +94,8 @@ import { createWebNimiAppSession, type NimiRemoteAppConfig } from '@nimiplatform
94
94
  import { NimiAppSessionProvider, NimiAccountControl, NimiAppAccessGate } from '@nimiplatform/kit/auth/app';
95
95
  import { setNimiRemoteAppClient } from './shell/auth/local-app-client.js';
96
96
  import { appTitle } from './shell/auth/app-identity.js';
97
- import { App } from './shell/App.js';
98
97
  import './styles.css';
98
+ const App = React.lazy(() => import('./shell/App.js').then((module) => ({ default: module.App })));
99
99
  declare const __NIMI_APP_WEB_CONFIG__: NimiRemoteAppConfig;
100
100
  const session = createWebNimiAppSession(__NIMI_APP_WEB_CONFIG__);
101
101
  const off = session.subscribe(() => { const state = session.getSnapshot(); setNimiRemoteAppClient(state.runtime.status === 'connected' ? state.runtime.scope : null); });
@@ -104,7 +104,7 @@ root.classList.add('nimi-workbench-host', 'nimi-ui-module--lab'); document.body.
104
104
  const reactRoot = createRoot(root);
105
105
  reactRoot.render(<React.StrictMode><NimiThemeProvider accentPack="nimi-accent"><TooltipProvider><NimiAppSessionProvider session={session}>
106
106
  <div className="flex h-full min-h-0 flex-col"><header className="flex items-center gap-3 border-b p-3"><strong>{appTitle}</strong><NimiAccountControl hideSignedOut language="en" /></header>
107
- <NimiAppAccessGate title={appTitle} language="en">{() => <main className="min-h-0 flex-1"><App /></main>}</NimiAppAccessGate></div>
107
+ <NimiAppAccessGate title={appTitle} language="en">{() => <main className="min-h-0 flex-1"><React.Suspense fallback={null}><App /></React.Suspense></main>}</NimiAppAccessGate></div>
108
108
  </NimiAppSessionProvider></TooltipProvider></NimiThemeProvider></React.StrictMode>);
109
109
  void session.start();
110
110
  if (import.meta.hot) import.meta.hot.dispose(() => { session.dispose(); off(); setNimiRemoteAppClient(null); reactRoot.unmount(); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimiplatform/app-tools",
3
- "version": "0.16.0-rc.14",
3
+ "version": "0.16.0-rc.18",
4
4
  "description": "Public app-authoring CLI for Nimi App projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -18,11 +18,11 @@
18
18
  "provenance": true
19
19
  },
20
20
  "nimiScaffoldVersions": {
21
- "sdkVersion": "^0.24.0-rc.11",
22
- "appToolsVersion": "^0.16.0-rc.14",
23
- "nimicodingVersion": "0.7.0",
21
+ "sdkVersion": "^0.24.0-rc.13",
22
+ "appToolsVersion": "^0.16.0-rc.18",
23
+ "nimicodingVersion": "0.7.1",
24
24
  "aiSdkVersion": "^7.0.171",
25
- "kitVersion": "^0.24.0-rc.18",
25
+ "kitVersion": "^0.24.0-rc.21",
26
26
  "reactVersion": "^19.3.1",
27
27
  "reactDomVersion": "^19.3.1",
28
28
  "i18nextVersion": "^26.7.2",
@@ -47,6 +47,9 @@
47
47
  "nimi-app": "./bin/nimi-app.mjs"
48
48
  },
49
49
  "exports": {
50
+ "./storefront/manifest": "./lib/public-storefront.mjs",
51
+ "./storefront/verify": "./lib/storefront-release-verification.mjs",
52
+ "./storefront/source": "./lib/storefront-source.mjs",
50
53
  "./development": {
51
54
  "types": "./lib/development-environment.d.mts",
52
55
  "import": "./lib/development-environment.mjs",
@@ -68,7 +71,7 @@
68
71
  "prepublishOnly": "pnpm run build",
69
72
  "test": "node ../scripts/with-workspace-surfaces.mjs -- pnpm run test:prepared",
70
73
  "test:large-archive": "node --test test/app-pack-large.test.mjs",
71
- "test:prepared": "node scripts/sync-scaffold-versions.mjs --check && node --test test/dev-shell.test.mjs && node --test test/app-icons.test.mjs test/app-storefront.test.mjs test/app-dependency-combinations.test.mjs test/app-safety-profile.test.mjs test/app-project-lifecycle.test.mjs test/app-pack.test.mjs test/app-pack-deflate.test.mjs test/app-pack-large.test.mjs test/app-scaffold.test.mjs test/managed-web-carrier.test.mjs test/web-carrier.test.mjs test/hosted-web-release.test.mjs test/mobile-development.test.mjs"
74
+ "test:prepared": "node scripts/sync-scaffold-versions.mjs --check && node --test test/dev-shell.test.mjs && node --test test/app-icons.test.mjs test/app-storefront.test.mjs test/storefront-release.test.mjs test/app-dependency-combinations.test.mjs test/app-safety-profile.test.mjs test/app-project-lifecycle.test.mjs test/app-pack.test.mjs test/app-pack-deflate.test.mjs test/app-pack-large.test.mjs test/app-scaffold.test.mjs test/managed-web-carrier.test.mjs test/web-carrier.test.mjs test/hosted-web-release.test.mjs test/mobile-development.test.mjs"
72
75
  },
73
76
  "files": [
74
77
  "bin",
@@ -69,9 +69,9 @@ function sourceRootsForModuleIds(resolvedModuleIds) {
69
69
  return Object.freeze(roots);
70
70
  }
71
71
 
72
- // Directories never copied into the snapshot: build output, generated Tauri
73
- // schema/icon assets, dependency state, and host-projection truth that init
74
- // regenerates through nimicoding rather than the scaffold copy.
72
+ // Directories never copied into the snapshot: build output, dependency state,
73
+ // and host-projection truth that init regenerates through nimicoding rather
74
+ // than the scaffold copy.
75
75
  const EXCLUDED_DIRS = new Set([
76
76
  '.git',
77
77
  'node_modules',
@@ -84,24 +84,20 @@ const EXCLUDED_DIRS = new Set([
84
84
  '.turbo',
85
85
  '.vite',
86
86
  ]);
87
- const EXCLUDED_DIR_PATHS = new Set([
88
- 'src-tauri/gen',
89
- 'src-tauri/icons',
90
- ]);
87
+ const EXCLUDED_DIR_PATHS = new Set();
91
88
  // Files the generator emits structurally (identity/profile/version derived or a
92
89
  // fixed scaffold asset), so they must not also live as a verbatim snapshot copy.
93
90
  const STRUCTURED_FILE_PATHS = new Set([
94
91
  '.gitignore',
95
92
  '.github/workflows/ci.yml',
96
93
  'package.json',
97
- 'src-tauri/Cargo.lock',
98
94
  ]);
99
95
 
100
96
  // Nimi Lab's concrete identity literals. The generator string-replaces
101
97
  // these with the target app identity at create time. Ordered longest-first so a
102
98
  // shorter literal can never partially rewrite a longer one.
103
99
  const SOURCE_IDENTITY = {
104
- tauriIdentifier: 'ai.nimi.apps.nimi.lab',
100
+ nativeBundleIdentifier: 'ai.nimi.apps.nimi.lab',
105
101
  packageName: '@nimiplatform/lab',
106
102
  cargoPackageName: 'nimiapp-lab-shell',
107
103
  appId: 'nimi.lab',
@@ -143,9 +139,6 @@ function isAppOwnedProductCode(relativePath) {
143
139
  if (relativePath.startsWith('src/lab/')) {
144
140
  return true;
145
141
  }
146
- if (relativePath === 'src-tauri/src/world_tour.rs') {
147
- return true;
148
- }
149
142
  if (relativePath.startsWith('test/')) {
150
143
  return true;
151
144
  }
@@ -19,6 +19,7 @@ Start with the repository's package manifest, actual product entry and nearest i
19
19
  | Bring in upstream changes | [Upstream sync](references/sync-upstream.md) |
20
20
  | Declare audience, content, AI output and data facts | [Safety declaration](references/safety-declaration.md) |
21
21
  | Prepare a Release or Registry submission | [Release](references/release.md) |
22
+ | Author and publish the App's storefront artwork and localized presentation | [Storefront](references/storefront.md) |
22
23
  | Verify real App behavior or installation | [Acceptance](references/acceptance.md) |
23
24
 
24
25
  An audit or planning request delivers findings and a proposal; continue implementation only when it is also authorized. For ordinary product edits, follow existing code and tests and keep logic direct. Extract helpers or add layers for current reuse, a complex boundary, or a clear concept that improves readability. New fallback, retry, compatibility, concurrency, or recovery machinery must address a concrete failure mode in a supported path or an explicit contract; supported uncommon cases remain in scope. Reinitialize or run a release journey only when affected inputs or behavior require it.
@@ -0,0 +1,28 @@
1
+ # Publish an App storefront
2
+
3
+ The storefront introduces the experience people can try. Keep the default App introduction in root `NIMI_APP.md`. In `nimi.app.yaml`, select `metadata.storefront.schema_version: 2`, a `default_locale`, one `primary_genre`, up to two distinct `secondary_genres`, one to six `tag_ids`, and `brand.accent_color` and `brand.surface_tone`. The Registry reviews genre and tag membership against its catalog taxonomy.
4
+
5
+ For each public locale, supply `display_name` (up to 80 characters for a public storefront; offline `app-info.json` allows up to 120 characters), `tagline`, `summary`, and one to four `highlights` with `id`, `title` and `description`. Both English (`en`) and Chinese (`zh`) entries—including localized introductions—are required for public listing. A highlight can reference a poster through `showcase_id`. A localized introduction can name a repository-relative `introduction_file`. The default locale always uses `NIMI_APP.md`; other languages use their declared `introduction_file` or `NIMI_APP.<locale>.md` when present. In offline `app-info.json` (`localization`), missing non-default introductions are omitted rather than copied from `NIMI_APP.md` so Home falls back cleanly; public `check/pack --storefront` requires an introduction for every declared public locale.
6
+
7
+ ## Prepare artwork
8
+
9
+ Use a square 512px icon from `metadata.icon`, a 16:9 `capsule_wide`, a 21:9 or 16:9 `hero_banner`, and two to six 16:9 `showcase` posters. Use a 3:4 `capsule_portrait` for a separate portrait composition. A curated spotlight also uses a transparent `logo_mark`. Supply static PNG or WebP images. Native icons use PNG. Each ordinary image may be up to 2 MiB, the icon 512 KiB, the wordmark 1 MiB, and all images together must fit a 32 MiB stored ZIP.
10
+
11
+ Each image slot declares a repository-relative `default` path, localized `alt`, and optional alternate paths in `locales`. A hero can identify its subject with `focal_point.x` and `.y` in the range 0 to 1. An icon without a separate slot uses the App names as its accessible labels. Each poster carries a unique `id`, `kind: poster`, localized `title`, `caption` and `alt`, a `target_carrier` of `desktop`, `hosted-web`, `bundled` or `all`, and a boolean `is_fictional_sample`.
12
+
13
+ Use a branded composition for the capsule and hero. Arrange the posters as a short sequence of experiences. At least one shows a real scene, interaction or result available on the indicated carrier. Confirm that the subject is recognizable at card size and remains visible on a narrow screen. Use clearly identified fictional material when illustrating personal or family records. Automated light-edge, low-luminance-variance and dominant-color warnings apply only to opaque artwork slots (`capsule_wide`, `capsule_portrait`, `hero_banner`, `showcase`), not `icon` or `logo_mark`, and serve as editorial prompts.
14
+
15
+ ## Check and release
16
+
17
+ ```sh
18
+ pnpm exec nimi-app check --storefront --json
19
+ pnpm exec nimi-app pack --storefront --rev 1 --json
20
+ ```
21
+
22
+ Pass `--production` in release preflight (`check --storefront --production` / `pack --storefront --rev <int> --production`) to additionally reject local Nimi overrides or resolutions in standalone project `pnpm-workspace.yaml` and `pnpm-lock.yaml` files while producing the same deterministic manifest and Store-0 ZIP.
23
+
24
+ The pack result gives the exact manifest and ZIP paths, sizes and SHA-256 digests. Repeating a pack with the same source yields the same bytes. The local preview, check and pack read the same declared artwork. Images select the exact locale, language base or default asset. Switching languages can require fetching another image.
25
+
26
+ Run `nimi-app sync` in an independent publishing repository to install the generic single-app `.github/workflows/nimi-storefront-release.yml` workflow, where a protected `storefront-v<revision>` tag builds and attests both release assets. Multi-product monorepos (such as `nimiplatform/nimi`, which maps `storefront-zhiyu-v<revision>` directly to `apps/zhiyu` in its own repository workflow) maintain their own explicit tag-to-directory mapping. Each public revision requires its own reviewed Registry record. The publishing tag does not activate it.
27
+
28
+ For offline and private packages, localized names, summaries and optional non-default introductions live in the version-bound `app-info.json` `localization` block. Those packages can supply translations without a public storefront or artwork release.
@@ -102,6 +102,18 @@ export function studioCloudIntentHasExactTarget(
102
102
  && exactText(target.remoteModelCatalogId);
103
103
  }
104
104
 
105
+ export function studioExternalIntentHasExactTarget(
106
+ intent: NimiPortableAppAIConfigIntent,
107
+ ): boolean {
108
+ if (intent.route.oneofKind !== 'external') return false;
109
+ const route = intent.route;
110
+ if (!('external' in route)) return false;
111
+ const exactText = (value: unknown): boolean => (
112
+ typeof value === 'string' && value.length > 0 && value.trim() === value
113
+ );
114
+ return exactText(route.external.executorRef) && exactText(route.external.targetRef);
115
+ }
116
+
105
117
  function isStudioAIConfigNotFound(error: unknown): boolean {
106
118
  if (!error || typeof error !== 'object') return false;
107
119
  const record = error as Record<string, unknown>;