@nimiplatform/app-tools 0.14.0 → 0.16.0-rc.12
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 +112 -24
- package/bin/nimi-app.mjs +35 -15
- package/lib/app-access-declaration.mjs +3 -0
- package/lib/app-dependency-combinations.mjs +70 -24
- package/lib/app-doctor-update.mjs +97 -39
- package/lib/app-host-support.mjs +6 -0
- package/lib/app-identifiers.mjs +27 -0
- package/lib/app-info.mjs +292 -1
- package/lib/app-lifecycle-guidance.mjs +1 -1
- package/lib/app-pack.mjs +65 -39
- package/lib/app-project-lifecycle.mjs +149 -244
- package/lib/app-scaffold-capabilities.mjs +13 -109
- package/lib/app-scaffold-profiles.mjs +81 -115
- package/lib/app-scaffold.mjs +74 -166
- package/lib/app-toolchain-updates.mjs +45 -0
- package/lib/canonical-capability-ids.generated.mjs +2 -0
- package/lib/development-environment.d.mts +10 -0
- package/lib/development-environment.mjs +39 -0
- package/lib/hosted-web-release.mjs +98 -0
- package/lib/index.mjs +43 -3
- package/lib/mobile-development.mjs +19 -0
- package/lib/realm-environments.generated.mjs +5 -0
- package/lib/storefront-media.mjs +154 -0
- package/lib/web-coordination.mjs +59 -0
- package/lib/web-development.d.mts +23 -0
- package/lib/web-development.mjs +118 -0
- package/lib/web-scaffold.mjs +125 -0
- package/package.json +33 -21
- package/scripts/dev-shell.mjs +4 -1
- package/scripts/sync-scaffold-versions.mjs +0 -2
- package/skills/nimi-app-lifecycle/SKILL.md +3 -1
- package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
- package/skills/nimi-app-lifecycle/references/adapt.md +5 -3
- package/skills/nimi-app-lifecycle/references/audit.md +3 -2
- package/skills/nimi-app-lifecycle/references/create.md +6 -2
- package/skills/nimi-app-lifecycle/references/release.md +10 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +12 -7
- package/templates/app-source/src/ai-studio-core/ai-studio-core.css +87 -52
- package/templates/app-source/src/ai-studio-core/history-policy.ts +45 -11
- package/templates/app-source/src/ai-studio-core/history.ts +22 -11
- package/templates/app-source/src/ai-studio-core/host-context.tsx +9 -4
- package/templates/app-source/src/ai-studio-core/index.ts +2 -0
- package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -5
- package/templates/app-source/src/ai-studio-core/job-recovery.ts +2 -2
- package/templates/app-source/src/ai-studio-core/messages/en.json +73 -19
- package/templates/app-source/src/ai-studio-core/messages/zh.json +73 -19
- package/templates/app-source/src/ai-studio-core/module-registration.ts +1 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +30 -5
- package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +12 -6
- package/templates/app-source/src/ai-studio-core/parameters.ts +4 -0
- package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +42 -0
- package/templates/app-source/src/ai-studio-core/runtime-types.ts +9 -2
- package/templates/app-source/src/ai-studio-core/runtime.ts +8 -4
- package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +98 -90
- package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +1 -1
- package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +205 -48
- package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +1 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +36 -14
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +96 -75
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +59 -16
- package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +2 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +12 -21
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +2 -2
- package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +3 -3
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +158 -76
- package/templates/app-source/src/ai-studio-core/workspace.tsx +49 -22
- package/templates/app-source/src/product-modules/agent-center/index.tsx +2 -3
- package/templates/app-source/src/product-modules/agent-conversation/index.tsx +2 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -5
- package/templates/app-source/src/studio-modules/studio-media/messages/en.json +59 -8
- package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +68 -8
- package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +2 -1
- package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +271 -83
- package/templates/app-source/src/studio-modules/studio-media/parameters.ts +120 -2
- package/templates/app-source/src/studio-modules/studio-media/registration.ts +1 -0
- package/templates/app-source/src/studio-modules/studio-media/runtime.ts +24 -14
- package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +1 -1
- package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +46 -23
- package/templates/app-source/src/studio-modules/studio-voice/registration.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +2 -2
- package/templates/app-source/src/workbench-core/workbench-core.tsx +27 -3
- package/templates/default-starter/AGENTS.md +3 -3
- package/templates/default-starter/README.md +1 -1
- package/templates/default-starter/src/shell/App.tsx +6 -18
- package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
- package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
- package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
- package/templates/default-starter.manifest.json +0 -16
- package/templates/hosted-web-release.yml +98 -0
- package/templates/default-starter/src-tauri/Cargo.toml +0 -17
- package/templates/default-starter/src-tauri/build.rs +0 -32
- package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
- package/templates/default-starter/src-tauri/tauri.conf.json +0 -26
package/lib/app-scaffold.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { isAppId } from './app-identifiers.mjs';
|
|
2
|
+
import { WEB_BASE_TEMPLATE_PATHS, webDevelopmentInput, webBuildProfile, webPackage, webDependencyMatrix } from './web-scaffold.mjs';
|
|
3
|
+
import { resolveWebAppScaffoldFeatures } from './app-scaffold-capabilities.mjs';
|
|
1
4
|
import path from 'node:path';
|
|
2
5
|
import { createHash } from 'node:crypto';
|
|
3
6
|
import YAML from 'yaml';
|
|
@@ -14,7 +17,6 @@ import {
|
|
|
14
17
|
resolveAppScaffoldCandidateFeatures,
|
|
15
18
|
resolveAppScaffoldFeatures,
|
|
16
19
|
resolveAppScaffoldIntentFeatures,
|
|
17
|
-
validateAppScaffoldCargoDependencyValue,
|
|
18
20
|
validateAppScaffoldNpmRegistryVersion,
|
|
19
21
|
} from './app-scaffold-capabilities.mjs';
|
|
20
22
|
import {
|
|
@@ -61,6 +63,8 @@ const LOCKFILE_POLICY = 'author-install-generates-lockfile';
|
|
|
61
63
|
const GENERATED_GITIGNORE = [
|
|
62
64
|
'node_modules/',
|
|
63
65
|
'dist/',
|
|
66
|
+
'dist-web/',
|
|
67
|
+
'dist-mobile/',
|
|
64
68
|
'dist-electron/',
|
|
65
69
|
'dist-electron-package/',
|
|
66
70
|
'src-tauri/target/',
|
|
@@ -72,8 +76,6 @@ const GENERATED_GITIGNORE = [
|
|
|
72
76
|
'.DS_Store',
|
|
73
77
|
'',
|
|
74
78
|
].join('\n');
|
|
75
|
-
const MINIMAL_TAURI_ICON_PNG = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR4nGNgAAIAAAUAAXpeqz8AAAAASUVORK5CYII=', 'base64');
|
|
76
|
-
const MINIMAL_TAURI_ICON_ICO = Buffer.from('AAABAAEAAQEAAAEAIABEAAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAABAAAAAQgGAAAAHxXEiQAAAAtJREFUeJxjYAACAAAFAAF6Xqs/AAAAAElFTkSuQmCC', 'base64');
|
|
77
79
|
|
|
78
80
|
const APP_RELEASE_WORKFLOW = [
|
|
79
81
|
'name: nimi-app-release',
|
|
@@ -276,6 +278,7 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
276
278
|
' dist/nimi-app/*.target.json',
|
|
277
279
|
' dist/nimi-app/*.app-info.json',
|
|
278
280
|
' dist/nimi-app/*.candidate.json',
|
|
281
|
+
' dist/nimi-app/*-storefront-media.zip',
|
|
279
282
|
' if-no-files-found: error',
|
|
280
283
|
' release:',
|
|
281
284
|
" if: github.event_name == 'push' && github.ref_type == 'tag'",
|
|
@@ -314,7 +317,7 @@ const APP_RELEASE_WORKFLOW = [
|
|
|
314
317
|
" sleep 10",
|
|
315
318
|
" done",
|
|
316
319
|
" }",
|
|
317
|
-
' assets=(release-assets/*.nimiapp release-assets/*.app-info.json release-assets/*.candidate.json)',
|
|
320
|
+
' assets=(release-assets/*.nimiapp release-assets/*.app-info.json release-assets/*.candidate.json release-assets/*-storefront-media.zip)',
|
|
318
321
|
' test "${#assets[@]}" -gt 0',
|
|
319
322
|
" expected=$(printf '%s\\n' \"${assets[@]##*/}\" | jq -R -s -c 'split(\"\\n\")[:-1] | sort')",
|
|
320
323
|
' if release_id=$(gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json databaseId --jq .databaseId 2>/dev/null); then',
|
|
@@ -391,7 +394,7 @@ function normalizeExplicitAppId(input) {
|
|
|
391
394
|
if (raw !== raw.trim() || raw !== raw.toLowerCase()) {
|
|
392
395
|
throw new Error(`Invalid app id: ${input}`);
|
|
393
396
|
}
|
|
394
|
-
if (
|
|
397
|
+
if (!isAppId(raw)) {
|
|
395
398
|
throw new Error(`Invalid app id: ${input}`);
|
|
396
399
|
}
|
|
397
400
|
return raw;
|
|
@@ -528,12 +531,15 @@ function buildAppIdentity(
|
|
|
528
531
|
accentPack = 'nimi-accent',
|
|
529
532
|
features = undefined,
|
|
530
533
|
featureResolver = resolveAppScaffoldFeatures,
|
|
534
|
+
platform = 'desktop',
|
|
531
535
|
) {
|
|
532
536
|
const resolvedPackageName = packageName || packageSafeName(appId);
|
|
533
|
-
|
|
537
|
+
if (!['desktop', 'web'].includes(platform)) throw new Error(`Unsupported App platform: ${platform}`);
|
|
538
|
+
const capabilityResolution = platform === 'web' ? resolveWebAppScaffoldFeatures(features, featureResolver) : featureResolver(features);
|
|
534
539
|
const identity = {
|
|
535
540
|
appId,
|
|
536
541
|
appTitle,
|
|
542
|
+
platform,
|
|
537
543
|
version: normalizeAppVersion(version),
|
|
538
544
|
profile,
|
|
539
545
|
packageName: resolvedPackageName,
|
|
@@ -583,8 +589,10 @@ function resolveAppScaffoldCreateInputWithResolver(
|
|
|
583
589
|
options.accentPack,
|
|
584
590
|
options.features,
|
|
585
591
|
featureResolver,
|
|
592
|
+
options.platform || 'desktop',
|
|
586
593
|
);
|
|
587
594
|
return Object.freeze({
|
|
595
|
+
...(identity.platform === 'web' ? { platform: 'web' } : {}),
|
|
588
596
|
profile,
|
|
589
597
|
appId,
|
|
590
598
|
appTitle,
|
|
@@ -614,7 +622,6 @@ function buildPackageJson(profile, versions, identity) {
|
|
|
614
622
|
'@nimiplatform/app-tools': versions.appToolsVersion,
|
|
615
623
|
'@nimiplatform/nimi-coding': versions.nimicodingVersion,
|
|
616
624
|
'@tailwindcss/vite': versions.tailwindcssViteVersion,
|
|
617
|
-
'@tauri-apps/cli': versions.tauriCliVersion,
|
|
618
625
|
'@types/node': versions.nodeTypesVersion,
|
|
619
626
|
'@types/react': versions.reactTypesVersion,
|
|
620
627
|
'@types/react-dom': versions.reactDomTypesVersion,
|
|
@@ -656,7 +663,6 @@ function buildPackageJson(profile, versions, identity) {
|
|
|
656
663
|
build: 'tsc --noEmit && vite build',
|
|
657
664
|
'build:electron': 'tsc -p tsconfig.electron.json && node scripts/bundle-electron-preload.mjs',
|
|
658
665
|
'build:electron:production': 'node scripts/clean-electron-production.mjs && pnpm run build && pnpm run build:electron && node scripts/package-electron-production.mjs',
|
|
659
|
-
'build:tauri:production': 'tauri build',
|
|
660
666
|
postinstall: 'install-electron --no',
|
|
661
667
|
validate: 'node scripts/validate.mjs',
|
|
662
668
|
},
|
|
@@ -666,7 +672,7 @@ function buildPackageJson(profile, versions, identity) {
|
|
|
666
672
|
if (identity.author) {
|
|
667
673
|
packageJson.author = identity.author;
|
|
668
674
|
}
|
|
669
|
-
return packageJson;
|
|
675
|
+
return identity.platform === 'web' ? webPackage(packageJson) : packageJson;
|
|
670
676
|
}
|
|
671
677
|
|
|
672
678
|
function buildRuntimeDependencies(profile, versions, capabilityResolution) {
|
|
@@ -701,96 +707,6 @@ function resolveScaffoldVersionReference(value, versions, dependencyName) {
|
|
|
701
707
|
return resolved;
|
|
702
708
|
}
|
|
703
709
|
|
|
704
|
-
function buildCargoDependencies(profile, versions, capabilityResolution) {
|
|
705
|
-
const dependencies = {
|
|
706
|
-
'nimi-shell-tauri': versions.nimiShellTauriVersion,
|
|
707
|
-
tauri: { version: '2', features: [] },
|
|
708
|
-
serde: { version: '1', features: ['derive'] },
|
|
709
|
-
serde_json: '1',
|
|
710
|
-
url: '2',
|
|
711
|
-
base64: '0.23',
|
|
712
|
-
dirs: '7',
|
|
713
|
-
time: '=0.3.55',
|
|
714
|
-
'tauri-build': { version: '2', features: [] },
|
|
715
|
-
};
|
|
716
|
-
for (const [name, value] of Object.entries(capabilityResolution.cargoDependencies || {})) {
|
|
717
|
-
if (Object.hasOwn(dependencies, name) && canonicalJson(dependencies[name]) !== canonicalJson(value)) {
|
|
718
|
-
throw new Error(`App scaffold base/module Cargo dependency collision for ${name}`);
|
|
719
|
-
}
|
|
720
|
-
dependencies[name] = value;
|
|
721
|
-
}
|
|
722
|
-
for (const [name, value] of Object.entries(dependencies)) {
|
|
723
|
-
validateAppScaffoldCargoDependencyValue(value, name);
|
|
724
|
-
}
|
|
725
|
-
return dependencies;
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
function cargoShellDependencyLine(profile, versions) {
|
|
729
|
-
return `nimi-shell-tauri = ${renderCargoDependencyValue(versions.nimiShellTauriVersion, 'nimi-shell-tauri')}`;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
export function renderCargoDependencyValue(value, label) {
|
|
733
|
-
validateAppScaffoldCargoDependencyValue(value, label);
|
|
734
|
-
if (typeof value === 'string' && value.trim() === value && value) {
|
|
735
|
-
return JSON.stringify(value);
|
|
736
|
-
}
|
|
737
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
738
|
-
throw new Error(`Invalid Cargo dependency descriptor: ${label}`);
|
|
739
|
-
}
|
|
740
|
-
const fields = [];
|
|
741
|
-
for (const key of Object.keys(value).sort()) {
|
|
742
|
-
const field = value[key];
|
|
743
|
-
if (typeof field === 'string' && field.trim() === field && field) {
|
|
744
|
-
fields.push(`${key} = ${JSON.stringify(field)}`);
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
if (typeof field === 'boolean') {
|
|
748
|
-
fields.push(`${key} = ${field ? 'true' : 'false'}`);
|
|
749
|
-
continue;
|
|
750
|
-
}
|
|
751
|
-
if (Array.isArray(field) && field.every((item) => typeof item === 'string' && item.trim() === item && item)) {
|
|
752
|
-
fields.push(`${key} = [${field.map((item) => JSON.stringify(item)).join(', ')}]`);
|
|
753
|
-
continue;
|
|
754
|
-
}
|
|
755
|
-
throw new Error(`Invalid Cargo dependency value: ${label}.${key}`);
|
|
756
|
-
}
|
|
757
|
-
if (fields.length === 0) throw new Error(`Invalid empty Cargo dependency descriptor: ${label}`);
|
|
758
|
-
return `{ ${fields.join(', ')} }`;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
function renderCargoManifest(content, profile, versions, identity) {
|
|
762
|
-
let rendered = content.replace(
|
|
763
|
-
/^nimi-shell-tauri\s*=.*$/m,
|
|
764
|
-
cargoShellDependencyLine(profile, versions),
|
|
765
|
-
);
|
|
766
|
-
rendered = rendered.replace(
|
|
767
|
-
/^(\[package\][\s\S]*?^version\s*=\s*)"[^"]+"/m,
|
|
768
|
-
`$1${JSON.stringify(identity.version)}`,
|
|
769
|
-
);
|
|
770
|
-
const baseNames = new Set([
|
|
771
|
-
'tauri',
|
|
772
|
-
'nimi-shell-tauri',
|
|
773
|
-
'serde',
|
|
774
|
-
'serde_json',
|
|
775
|
-
'url',
|
|
776
|
-
'base64',
|
|
777
|
-
'dirs',
|
|
778
|
-
'time',
|
|
779
|
-
'tauri-build',
|
|
780
|
-
]);
|
|
781
|
-
const additions = [];
|
|
782
|
-
for (const [name, value] of Object.entries(identity.capabilityResolution.cargoDependencies || {})) {
|
|
783
|
-
if (!/^[A-Za-z0-9_-]+$/u.test(name)) throw new Error(`Invalid Cargo dependency name: ${name}`);
|
|
784
|
-
if (baseNames.has(name)) continue;
|
|
785
|
-
additions.push(`${name} = ${renderCargoDependencyValue(value, name)}`);
|
|
786
|
-
}
|
|
787
|
-
if (additions.length === 0) return rendered;
|
|
788
|
-
const marker = '\n[build-dependencies]';
|
|
789
|
-
if (!rendered.includes(marker)) throw new Error('Generated Cargo manifest is missing [build-dependencies]');
|
|
790
|
-
rendered = rendered.replace(marker, `\n${additions.join('\n')}\n${marker}`);
|
|
791
|
-
return rendered;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
710
|
function targetIdentityMap(identity) {
|
|
795
711
|
return {
|
|
796
712
|
tauriIdentifier: identity.tauriIdentifier,
|
|
@@ -891,6 +807,7 @@ function buildNimiAppManifest(identity) {
|
|
|
891
807
|
display_name: identity.appTitle,
|
|
892
808
|
version: identity.version,
|
|
893
809
|
profile: identity.profile,
|
|
810
|
+
...(identity.platform === 'web' ? { platform: 'web' } : {}),
|
|
894
811
|
manifest_role: 'submitted-input',
|
|
895
812
|
app_access: identity.appAccessItems,
|
|
896
813
|
capability_contract_refs: identity.capabilityResolution.capabilityContractRefs,
|
|
@@ -901,29 +818,12 @@ function buildNimiAppManifest(identity) {
|
|
|
901
818
|
icon: 'assets/app-icon.png',
|
|
902
819
|
release_notes: 'RELEASE_NOTES.md',
|
|
903
820
|
},
|
|
904
|
-
local_development: {
|
|
905
|
-
electron: {
|
|
906
|
-
renderer_origin: `http://127.0.0.1:${identity.devPort}`,
|
|
907
|
-
},
|
|
821
|
+
local_development: identity.platform === 'web' ? { web: webDevelopmentInput(identity) } : {
|
|
822
|
+
electron: { renderer_origin: `http://127.0.0.1:${identity.devPort}` },
|
|
908
823
|
},
|
|
909
824
|
}, { lineWidth: 0 });
|
|
910
825
|
}
|
|
911
826
|
|
|
912
|
-
function renderTauriConfig(raw, identity) {
|
|
913
|
-
const config = JSON.parse(raw);
|
|
914
|
-
config.productName = identity.appTitle;
|
|
915
|
-
config.version = identity.version;
|
|
916
|
-
config.identifier = identity.nativeBundleIdentifier;
|
|
917
|
-
config.build = { ...config.build, devUrl: `http://127.0.0.1:${identity.devPort}` };
|
|
918
|
-
config.app = {
|
|
919
|
-
...config.app,
|
|
920
|
-
windows: Array.isArray(config.app?.windows)
|
|
921
|
-
? config.app.windows.map((window) => ({ ...window, title: identity.appTitle }))
|
|
922
|
-
: [],
|
|
923
|
-
};
|
|
924
|
-
return jsonFile(config);
|
|
925
|
-
}
|
|
926
|
-
|
|
927
827
|
function renderAppIdentityModule(identity) {
|
|
928
828
|
return [
|
|
929
829
|
`export const appId = ${JSON.stringify(identity.appId)};`,
|
|
@@ -944,9 +844,6 @@ function escapeHtmlText(input) {
|
|
|
944
844
|
}
|
|
945
845
|
|
|
946
846
|
function renderIdentitySensitiveStarterFile(relativePath, raw, manifest, identity) {
|
|
947
|
-
if (relativePath === 'src-tauri/tauri.conf.json') {
|
|
948
|
-
return renderTauriConfig(raw, identity);
|
|
949
|
-
}
|
|
950
847
|
if (relativePath === 'src/shell/auth/app-identity.ts') {
|
|
951
848
|
return renderAppIdentityModule(identity);
|
|
952
849
|
}
|
|
@@ -956,34 +853,31 @@ function renderIdentitySensitiveStarterFile(relativePath, raw, manifest, identit
|
|
|
956
853
|
return applyIdentityReplacement(raw, manifest, targetIdentityMap(identity));
|
|
957
854
|
}
|
|
958
855
|
|
|
959
|
-
function applyProfileSeam(relativePath, content, profile,
|
|
856
|
+
function applyProfileSeam(relativePath, content, profile, identity) {
|
|
960
857
|
if (relativePath === 'nimi.app.yaml') {
|
|
961
858
|
return buildNimiAppManifest(identity);
|
|
962
859
|
}
|
|
963
|
-
if (relativePath === 'src-tauri/Cargo.toml') {
|
|
964
|
-
return renderCargoManifest(content, profile, versions, identity);
|
|
965
|
-
}
|
|
966
860
|
if (relativePath === 'README.md') {
|
|
967
861
|
return content.replace(/Profile: `standalone`/, `Profile: \`${profile}\``);
|
|
968
862
|
}
|
|
969
863
|
return content;
|
|
970
864
|
}
|
|
971
865
|
|
|
972
|
-
function buildDefaultStarterTemplateFiles(identity, profile
|
|
866
|
+
function buildDefaultStarterTemplateFiles(identity, profile) {
|
|
973
867
|
const { baseDir, manifest } = loadDefaultStarterSource();
|
|
974
|
-
const
|
|
975
|
-
return
|
|
868
|
+
const entries = identity.platform === 'web' ? manifest.files.filter(entry => WEB_BASE_TEMPLATE_PATHS.has(entry.path)) : manifest.files;
|
|
869
|
+
return entries.map((entry) => {
|
|
976
870
|
const raw = readDefaultStarterSourceFile(baseDir, entry.path);
|
|
977
871
|
const identityApplied = renderIdentitySensitiveStarterFile(entry.path, raw, manifest, identity);
|
|
978
872
|
return {
|
|
979
873
|
path: entry.path,
|
|
980
|
-
content: applyProfileSeam(entry.path, identityApplied, profile,
|
|
874
|
+
content: applyProfileSeam(entry.path, identityApplied, profile, identity),
|
|
981
875
|
mutationClass: entry.class,
|
|
982
876
|
};
|
|
983
877
|
});
|
|
984
878
|
}
|
|
985
879
|
|
|
986
|
-
function buildCapabilitySliceFiles(identity, profile
|
|
880
|
+
function buildCapabilitySliceFiles(identity, profile) {
|
|
987
881
|
if (identity.capabilityResolution.modules.length === 0) return [];
|
|
988
882
|
const { baseDir, manifest } = loadAppSource(identity.capabilityResolution.resolvedModuleIds);
|
|
989
883
|
const mappings = identity.capabilityResolution.modules.flatMap((module) => (
|
|
@@ -1010,7 +904,7 @@ function buildCapabilitySliceFiles(identity, profile, versions) {
|
|
|
1010
904
|
const rendered = rewriteMappedModuleSpecifiers(raw, entry.path, outputPath, mappings);
|
|
1011
905
|
files.push({
|
|
1012
906
|
path: outputPath,
|
|
1013
|
-
content: applyProfileSeam(outputPath, rendered, profile,
|
|
907
|
+
content: applyProfileSeam(outputPath, rendered, profile, identity),
|
|
1014
908
|
mutationClass: 'app-owned product code',
|
|
1015
909
|
ownerKind: 'module',
|
|
1016
910
|
ownerId: module.id,
|
|
@@ -1021,7 +915,7 @@ function buildCapabilitySliceFiles(identity, profile, versions) {
|
|
|
1021
915
|
return files.sort((left, right) => left.path.localeCompare(right.path));
|
|
1022
916
|
}
|
|
1023
917
|
|
|
1024
|
-
function buildWorkbenchCoreFiles(identity, profile
|
|
918
|
+
function buildWorkbenchCoreFiles(identity, profile) {
|
|
1025
919
|
const { baseDir, manifest } = loadAppSource(identity.capabilityResolution.resolvedModuleIds);
|
|
1026
920
|
const sourcePrefix = `${WORKBENCH_CORE_SOURCE_ROOT}/`;
|
|
1027
921
|
const selected = manifest.files.filter((entry) => entry.path.startsWith(sourcePrefix));
|
|
@@ -1033,7 +927,7 @@ function buildWorkbenchCoreFiles(identity, profile, versions) {
|
|
|
1033
927
|
assertIdentityNeutralProductSource(entry.path, raw, manifest);
|
|
1034
928
|
return {
|
|
1035
929
|
path: entry.path,
|
|
1036
|
-
content: applyProfileSeam(entry.path, raw, profile,
|
|
930
|
+
content: applyProfileSeam(entry.path, raw, profile, identity),
|
|
1037
931
|
mutationClass: 'app-owned product code',
|
|
1038
932
|
ownerKind: 'skeleton',
|
|
1039
933
|
ownerId: 'workbench-core',
|
|
@@ -1056,6 +950,7 @@ export function renderAppIdentityInput(identity) {
|
|
|
1056
950
|
|
|
1057
951
|
export function renderAppBuildProfile(options = {}) {
|
|
1058
952
|
const identity = options.identity || null;
|
|
953
|
+
if (identity?.platform === 'web') return YAML.stringify(webBuildProfile(), { lineWidth: 0 });
|
|
1059
954
|
const targets = options.targets || (identity ? {
|
|
1060
955
|
'windows-x86_64': {
|
|
1061
956
|
os: 'windows',
|
|
@@ -1103,6 +998,7 @@ export function renderAppSubmissionInput(identity, options = {}) {
|
|
|
1103
998
|
display_name: identity.appTitle,
|
|
1104
999
|
version: identity.version,
|
|
1105
1000
|
profile: identity.profile,
|
|
1001
|
+
...(identity.platform === 'web' ? { platform: 'web' } : {}),
|
|
1106
1002
|
npm_package_name: identity.packageName,
|
|
1107
1003
|
cargo_package_name: identity.cargoPackageName,
|
|
1108
1004
|
tauri_identifier: identity.tauriIdentifier,
|
|
@@ -1208,17 +1104,11 @@ function buildStructuredFiles(identity, profile, versions) {
|
|
|
1208
1104
|
content: renderScaffoldBoundary(),
|
|
1209
1105
|
mutationClass: 'scaffold-managed glue',
|
|
1210
1106
|
},
|
|
1211
|
-
{
|
|
1212
|
-
path: 'src-tauri/icons/icon.png',
|
|
1213
|
-
content: MINIMAL_TAURI_ICON_PNG,
|
|
1214
|
-
mutationClass: 'scaffold-managed glue',
|
|
1215
|
-
},
|
|
1216
|
-
{
|
|
1217
|
-
path: 'src-tauri/icons/icon.ico',
|
|
1218
|
-
content: MINIMAL_TAURI_ICON_ICO,
|
|
1219
|
-
mutationClass: 'scaffold-managed glue',
|
|
1220
|
-
},
|
|
1221
1107
|
];
|
|
1108
|
+
if (identity.platform === 'web') {
|
|
1109
|
+
const webPaths = new Set(['.gitignore', 'LICENSE', SCAFFOLD_TEMPLATE_LICENSE_NOTICE_PATH, 'package.json', 'nimi.app.yaml', '.nimi/config/app-identity.yaml', '.nimi/config/build-profile.yaml', '.nimi/admission/submission.yaml', '.nimi/contracts/scaffold-boundary.yaml']);
|
|
1110
|
+
return files.filter(file => webPaths.has(file.path));
|
|
1111
|
+
}
|
|
1222
1112
|
return files;
|
|
1223
1113
|
}
|
|
1224
1114
|
|
|
@@ -1235,7 +1125,7 @@ function buildIdentityMapping(identity, targetDir = '') {
|
|
|
1235
1125
|
appSlug: identity.appSlug,
|
|
1236
1126
|
rendererEntryId: identity.rendererEntryId,
|
|
1237
1127
|
devPort: identity.devPort,
|
|
1238
|
-
devRendererOrigin:
|
|
1128
|
+
devRendererOrigin: `${identity.platform === 'web' ? 'https' : 'http'}://127.0.0.1:${identity.devPort}`,
|
|
1239
1129
|
appOwnedNamespace: identity.appOwnedNamespace,
|
|
1240
1130
|
// Checkout location belongs to CLI diagnostics, not persisted identity.
|
|
1241
1131
|
targetDir: null,
|
|
@@ -1250,6 +1140,7 @@ function buildScaffoldIntent(identity, versions, targetDir = '') {
|
|
|
1250
1140
|
initCommand: 'pnpm exec nimi-app init',
|
|
1251
1141
|
initOrder: ['nimi-app create', 'pnpm install', 'pnpm exec nimi-app init'],
|
|
1252
1142
|
profile: identity.profile,
|
|
1143
|
+
...(identity.platform === 'web' ? { platform: 'web' } : {}),
|
|
1253
1144
|
appId: identity.appId,
|
|
1254
1145
|
appTitle: identity.appTitle,
|
|
1255
1146
|
version: identity.version,
|
|
@@ -1271,7 +1162,7 @@ function buildScaffoldIntent(identity, versions, targetDir = '') {
|
|
|
1271
1162
|
requiredStandardizedFeatureRefs: identity.capabilityResolution.requiredStandardizedFeatureRefs,
|
|
1272
1163
|
devPort: identity.devPort,
|
|
1273
1164
|
appIdentity: buildIdentityMapping(identity, targetDir),
|
|
1274
|
-
dependencyMatrix: buildDependencyMatrix(identity.profile, versions, identity.capabilityResolution),
|
|
1165
|
+
dependencyMatrix: buildDependencyMatrix(identity.profile, versions, identity.capabilityResolution, identity.platform),
|
|
1275
1166
|
semantics: {
|
|
1276
1167
|
role: 'app-scaffold-init-input',
|
|
1277
1168
|
authority: 'app-tools-orchestration-input-not-platform-admission',
|
|
@@ -1306,13 +1197,13 @@ function buildScaffoldFiles(identity, versions) {
|
|
|
1306
1197
|
'structured',
|
|
1307
1198
|
),
|
|
1308
1199
|
...withFileOwner(
|
|
1309
|
-
buildDefaultStarterTemplateFiles(identity, identity.profile
|
|
1200
|
+
buildDefaultStarterTemplateFiles(identity, identity.profile),
|
|
1310
1201
|
'carrier',
|
|
1311
1202
|
'default-starter',
|
|
1312
1203
|
),
|
|
1313
1204
|
...withFileOwner(buildDefaultStarterFiles(identity), 'generated-glue', 'composition'),
|
|
1314
|
-
...buildWorkbenchCoreFiles(identity, identity.profile
|
|
1315
|
-
...buildCapabilitySliceFiles(identity, identity.profile
|
|
1205
|
+
...buildWorkbenchCoreFiles(identity, identity.profile),
|
|
1206
|
+
...buildCapabilitySliceFiles(identity, identity.profile),
|
|
1316
1207
|
];
|
|
1317
1208
|
}
|
|
1318
1209
|
|
|
@@ -1367,8 +1258,8 @@ export function hashScaffoldContent(content) {
|
|
|
1367
1258
|
return createHash('sha256').update(content).digest('hex');
|
|
1368
1259
|
}
|
|
1369
1260
|
|
|
1370
|
-
function buildDependencyMatrix(profile, versions, capabilityResolution) {
|
|
1371
|
-
|
|
1261
|
+
function buildDependencyMatrix(profile, versions, capabilityResolution, platform = 'desktop') {
|
|
1262
|
+
const matrix = {
|
|
1372
1263
|
npm: {
|
|
1373
1264
|
'@nimiplatform/app-tools': versions.appToolsVersion,
|
|
1374
1265
|
'@nimiplatform/nimi-coding': versions.nimicodingVersion,
|
|
@@ -1376,7 +1267,6 @@ function buildDependencyMatrix(profile, versions, capabilityResolution) {
|
|
|
1376
1267
|
typescript: versions.typescriptVersion,
|
|
1377
1268
|
vite: versions.viteVersion,
|
|
1378
1269
|
tailwindcss: versions.tailwindcssVersion,
|
|
1379
|
-
'@tauri-apps/cli': versions.tauriCliVersion,
|
|
1380
1270
|
'@tailwindcss/vite': versions.tailwindcssViteVersion,
|
|
1381
1271
|
'@vitejs/plugin-react': versions.viteReactPluginVersion,
|
|
1382
1272
|
'@electron/packager': versions.electronPackagerVersion,
|
|
@@ -1385,14 +1275,12 @@ function buildDependencyMatrix(profile, versions, capabilityResolution) {
|
|
|
1385
1275
|
pngjs: versions.pngjsVersion,
|
|
1386
1276
|
yaml: versions.yamlVersion,
|
|
1387
1277
|
},
|
|
1388
|
-
cargo: buildCargoDependencies(profile, versions, capabilityResolution),
|
|
1389
1278
|
toolchain: {
|
|
1390
1279
|
node: '>=24',
|
|
1391
1280
|
pnpm: versions.packageManager.replace(/^pnpm@/u, ''),
|
|
1392
|
-
rust: '>=1.80',
|
|
1393
|
-
tauri: '2',
|
|
1394
1281
|
},
|
|
1395
1282
|
};
|
|
1283
|
+
return platform === 'web' ? webDependencyMatrix(matrix) : matrix;
|
|
1396
1284
|
}
|
|
1397
1285
|
|
|
1398
1286
|
function buildScaffoldLock(identity, versions, files, targetDir = '') {
|
|
@@ -1425,6 +1313,7 @@ function buildScaffoldLock(identity, versions, files, targetDir = '') {
|
|
|
1425
1313
|
lockVersion: SCAFFOLD_LOCK_VERSION,
|
|
1426
1314
|
scaffoldVersion: SCAFFOLD_VERSION,
|
|
1427
1315
|
profile: identity.profile,
|
|
1316
|
+
...(identity.platform === 'web' ? { platform: 'web' } : {}),
|
|
1428
1317
|
appId: identity.appId,
|
|
1429
1318
|
appTitle: identity.appTitle,
|
|
1430
1319
|
version: identity.version,
|
|
@@ -1452,7 +1341,7 @@ function buildScaffoldLock(identity, versions, files, targetDir = '') {
|
|
|
1452
1341
|
},
|
|
1453
1342
|
managedFileHashes,
|
|
1454
1343
|
appOwnedInitialHashes,
|
|
1455
|
-
dependencyMatrix: buildDependencyMatrix(identity.profile, versions, identity.capabilityResolution),
|
|
1344
|
+
dependencyMatrix: buildDependencyMatrix(identity.profile, versions, identity.capabilityResolution, identity.platform),
|
|
1456
1345
|
semantics: {
|
|
1457
1346
|
initRole: 'developer-scaffold-initialization-after-install',
|
|
1458
1347
|
nimicodingProjectionOwner: '@nimiplatform/nimi-coding',
|
|
@@ -1467,7 +1356,7 @@ function buildScaffoldLock(identity, versions, files, targetDir = '') {
|
|
|
1467
1356
|
}
|
|
1468
1357
|
|
|
1469
1358
|
function buildAppScaffoldSnapshotWithResolver(
|
|
1470
|
-
{ profile, versions, appId, appTitle, version = DEFAULT_APP_VERSION, packageName, author, accentPack, features, targetDir = '' },
|
|
1359
|
+
{ profile, platform = 'desktop', versions, appId, appTitle, version = DEFAULT_APP_VERSION, packageName, author, accentPack, features, targetDir = '' },
|
|
1471
1360
|
featureResolver,
|
|
1472
1361
|
) {
|
|
1473
1362
|
const identity = buildAppIdentity(
|
|
@@ -1480,6 +1369,7 @@ function buildAppScaffoldSnapshotWithResolver(
|
|
|
1480
1369
|
accentPack,
|
|
1481
1370
|
features,
|
|
1482
1371
|
featureResolver,
|
|
1372
|
+
platform,
|
|
1483
1373
|
);
|
|
1484
1374
|
const createFiles = [
|
|
1485
1375
|
...buildScaffoldFiles(identity, versions),
|
|
@@ -1509,6 +1399,7 @@ function buildAppScaffoldSnapshotWithResolver(
|
|
|
1509
1399
|
appTitle: identity.appTitle,
|
|
1510
1400
|
version: identity.version,
|
|
1511
1401
|
profile: identity.profile,
|
|
1402
|
+
...(identity.platform === 'web' ? { platform: 'web' } : {}),
|
|
1512
1403
|
packageName: identity.packageName,
|
|
1513
1404
|
packageAuthor: identity.author || null,
|
|
1514
1405
|
cargoPackageName: identity.cargoPackageName,
|
|
@@ -1531,7 +1422,7 @@ export function buildAppScaffoldCandidateSnapshot(input) {
|
|
|
1531
1422
|
return buildAppScaffoldSnapshotWithResolver(input, resolveAppScaffoldCandidateFeatures);
|
|
1532
1423
|
}
|
|
1533
1424
|
|
|
1534
|
-
export function buildAppScaffoldSnapshotFromIntent({ intent, versions, targetDir = '', allowDerivedAppAccessDrift = false, refreshDerived = false }) {
|
|
1425
|
+
export function buildAppScaffoldSnapshotFromIntent({ intent, versions, targetDir = '', allowDerivedAppAccessDrift = false, refreshDerived = false, refreshInitialDependencies = false }) {
|
|
1535
1426
|
if (intent?.intentVersion !== SCAFFOLD_INTENT_VERSION) {
|
|
1536
1427
|
throw new Error(`Unsupported scaffold intent version: ${String(intent?.intentVersion || 'missing')}`);
|
|
1537
1428
|
}
|
|
@@ -1544,6 +1435,7 @@ export function buildAppScaffoldSnapshotFromIntent({ intent, versions, targetDir
|
|
|
1544
1435
|
const canonicalTargetDir = targetDir || intent?.appIdentity?.targetDir || '';
|
|
1545
1436
|
const snapshot = buildAppScaffoldSnapshotWithResolver({
|
|
1546
1437
|
profile: intent.profile,
|
|
1438
|
+
platform: intent.platform || 'desktop',
|
|
1547
1439
|
versions,
|
|
1548
1440
|
appId: intent.appId,
|
|
1549
1441
|
appTitle: intent.appTitle,
|
|
@@ -1556,15 +1448,26 @@ export function buildAppScaffoldSnapshotFromIntent({ intent, versions, targetDir
|
|
|
1556
1448
|
}, resolveAppScaffoldIntentFeatures);
|
|
1557
1449
|
const expectedIntent = JSON.parse(snapshot.filesByPath.get(SCAFFOLD_INTENT_PATH).content);
|
|
1558
1450
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
1559
|
-
const immutableInputs = new Set(['intentVersion', 'scaffoldVersion', 'initRequired', 'initCommand', 'initOrder', 'profile', 'appId', 'appTitle', 'version', 'packageName', 'packageAuthor', 'cargoPackageName', 'tauriIdentifier', 'accentPack', 'directFeatures', 'devPort', 'semantics']);
|
|
1451
|
+
const immutableInputs = new Set(['intentVersion', 'scaffoldVersion', 'initRequired', 'initCommand', 'initOrder', 'profile', 'platform', 'appId', 'appTitle', 'version', 'packageName', 'packageAuthor', 'cargoPackageName', 'tauriIdentifier', 'accentPack', 'directFeatures', 'devPort', 'semantics']);
|
|
1560
1452
|
if (canonicalJson(Object.keys(intent).sort()) !== canonicalJson(Object.keys(expectedIntent).sort())) {
|
|
1561
1453
|
throw new Error('Scaffold intent fields do not match the current canonical resolved intent');
|
|
1562
1454
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
:
|
|
1455
|
+
// A compatible creator patch may have different dependency defaults. Its
|
|
1456
|
+
// historical matrix never supplies executable glue or new dependency values.
|
|
1457
|
+
let comparableIntent = intent;
|
|
1458
|
+
if (refreshDerived) {
|
|
1459
|
+
comparableIntent = Object.fromEntries(Object.entries(expectedIntent).map(([key, value]) => [key, immutableInputs.has(key) ? intent[key] : value]));
|
|
1460
|
+
} else if (refreshInitialDependencies) {
|
|
1461
|
+
const historical = intent.dependencyMatrix?.npm;
|
|
1462
|
+
const current = expectedIntent.dependencyMatrix.npm;
|
|
1463
|
+
if (canonicalJson(Object.keys(historical ?? {}).sort()) !== canonicalJson(Object.keys(current).sort())) {
|
|
1464
|
+
throw new Error('Scaffold creator dependencies differ from the current contract. Initialize with the original creator, then sync.');
|
|
1465
|
+
}
|
|
1466
|
+
for (const [name, spec] of Object.entries(historical)) validateAppScaffoldNpmRegistryVersion(spec, name);
|
|
1467
|
+
comparableIntent = { ...intent, dependencyMatrix: { ...intent.dependencyMatrix, npm: current } };
|
|
1468
|
+
} else if (allowDerivedAppAccessDrift) {
|
|
1469
|
+
comparableIntent = { ...intent, appAccessItems: expectedIntent.appAccessItems };
|
|
1470
|
+
}
|
|
1568
1471
|
if (canonicalJson(comparableIntent) !== canonicalJson(expectedIntent)) {
|
|
1569
1472
|
throw new Error('Scaffold intent does not match the current canonical resolved intent');
|
|
1570
1473
|
}
|
|
@@ -1578,6 +1481,7 @@ function buildAppScaffoldCreatePlanWithResolver(
|
|
|
1578
1481
|
const resolvedInput = resolveAppScaffoldCreateInputWithResolver({ cwd, options }, featureResolver);
|
|
1579
1482
|
const snapshot = buildAppScaffoldSnapshotWithResolver({
|
|
1580
1483
|
profile: resolvedInput.profile,
|
|
1484
|
+
platform: resolvedInput.platform || 'desktop',
|
|
1581
1485
|
versions,
|
|
1582
1486
|
appId: resolvedInput.appId,
|
|
1583
1487
|
appTitle: resolvedInput.appTitle,
|
|
@@ -1603,7 +1507,6 @@ function buildAppScaffoldCreatePlanWithResolver(
|
|
|
1603
1507
|
resolvedAssets: snapshot.lock.resolvedAssets,
|
|
1604
1508
|
hostAdapterContracts: snapshot.lock.hostAdapterContracts,
|
|
1605
1509
|
npmDependencies: snapshot.lock.dependencyMatrix.npm,
|
|
1606
|
-
cargoDependencies: snapshot.lock.dependencyMatrix.cargo,
|
|
1607
1510
|
appAccessItems: snapshot.lock.appAccessItems,
|
|
1608
1511
|
topology,
|
|
1609
1512
|
}),
|
|
@@ -1642,7 +1545,10 @@ export function createAppScaffold(input) {
|
|
|
1642
1545
|
};
|
|
1643
1546
|
if (!options.silent) {
|
|
1644
1547
|
process.stdout.write(`[nimi-app] created ${profile} app scaffold at ${targetDir}\n`);
|
|
1645
|
-
|
|
1548
|
+
const next = plan.resolvedInput.platform === 'web'
|
|
1549
|
+
? 'Run pnpm install, fill in your registered origin, redirect_uri and client_id in nimi.app.yaml, then run pnpm run init.'
|
|
1550
|
+
: 'pnpm install && pnpm run init';
|
|
1551
|
+
process.stdout.write(`[nimi-app] next: ${next}\n`);
|
|
1646
1552
|
}
|
|
1647
1553
|
return payload;
|
|
1648
1554
|
}
|
|
@@ -1652,12 +1558,14 @@ export function createAppScaffoldCandidate(input) {
|
|
|
1652
1558
|
return createAppScaffold({ ...input, plan });
|
|
1653
1559
|
}
|
|
1654
1560
|
|
|
1655
|
-
export const APP_AUTHOR_DECLARATION_FIELDS = Object.freeze(['metadata', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', 'safety_profile']);
|
|
1561
|
+
export const APP_AUTHOR_DECLARATION_FIELDS = Object.freeze(['metadata', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', 'safety_profile', 'public_slug']);
|
|
1656
1562
|
|
|
1657
1563
|
// Source configuration is editable; existing scaffold checks still cover identity and carrier fields.
|
|
1658
1564
|
export function hashScaffoldManagedContent(relativePath, content) {
|
|
1659
1565
|
if (relativePath !== 'nimi.app.yaml') return hashScaffoldContent(content);
|
|
1660
1566
|
const manifest = YAML.parse(content.toString());
|
|
1661
1567
|
for (const field of APP_AUTHOR_DECLARATION_FIELDS) delete manifest[field];
|
|
1568
|
+
if (manifest.local_development) delete manifest.local_development.web;
|
|
1569
|
+
if (manifest.local_development) delete manifest.local_development.mobile;
|
|
1662
1570
|
return hashScaffoldContent(YAML.stringify(manifest, { lineWidth: 0 }));
|
|
1663
1571
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { minVersion, satisfies, valid, validRange } from 'semver';
|
|
2
|
+
|
|
3
|
+
// Patched release lines used by Nimi Apps. Vite GHSA-p4f5-76q4-ffq7
|
|
4
|
+
// and Electron's Chromium backports have separate fixes on maintained lines.
|
|
5
|
+
const fixes = {
|
|
6
|
+
vite: [
|
|
7
|
+
['>=8.3.0 <8.3.7', '8.3.7'], ['>=8.2.0 <8.2.5', '8.2.5'],
|
|
8
|
+
['>=8 <8.1.7', '8.1.7'], ['>=7 <7.3.8', '7.3.8'], ['>=4 <6.4.6', '6.4.6'],
|
|
9
|
+
],
|
|
10
|
+
electron: [
|
|
11
|
+
['>=45 <45.4.1', '45.4.1'], ['>=44 <44.11.5', '44.11.5'], ['>=43 <43.8.12', '43.8.12'],
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function lockedRegistryVersion(entry) {
|
|
16
|
+
return typeof entry?.version === 'string' ? valid(entry.version.split('(')[0]) : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Sync can raise a conventional range within its existing bounds. An exact
|
|
20
|
+
// vulnerable pin or a custom range remains an explicit publisher decision.
|
|
21
|
+
export function planToolchainUpdates(pkg, importer, versions) {
|
|
22
|
+
const updates = [];
|
|
23
|
+
for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) {
|
|
24
|
+
for (const [name, releases] of Object.entries(fixes)) {
|
|
25
|
+
const from = pkg[section]?.[name];
|
|
26
|
+
if (typeof from !== 'string') continue;
|
|
27
|
+
const entry = importer?.[section]?.[name];
|
|
28
|
+
const locked = lockedRegistryVersion(entry);
|
|
29
|
+
const minimum = validRange(from) && minVersion(from);
|
|
30
|
+
const affected = releases.find(([range]) => minimum && satisfies(minimum, range));
|
|
31
|
+
const lockedFix = releases.find(([range]) => locked && satisfies(locked, range));
|
|
32
|
+
if (!affected && !lockedFix) continue;
|
|
33
|
+
const fixedVersion = (lockedFix || affected)[1];
|
|
34
|
+
const preferred = minVersion(versions[name + 'Version'])?.version;
|
|
35
|
+
const recommended = [preferred, fixedVersion].find(version => version && satisfies(version, from)
|
|
36
|
+
&& !releases.some(([range]) => satisfies(version, range)));
|
|
37
|
+
const operator = from.match(/^([~^])\d+\.\d+\.\d+$/u)?.[1];
|
|
38
|
+
const to = affected && operator && recommended ? operator + recommended : from;
|
|
39
|
+
const alreadyPatched = locked && !lockedFix && satisfies(locked, from);
|
|
40
|
+
updates.push({ section, name, from, to, locked, lockedAffected: Boolean(lockedFix),
|
|
41
|
+
fixedVersion, manual: !recommended && !alreadyPatched });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return updates;
|
|
45
|
+
}
|
|
@@ -10,6 +10,7 @@ export const CANONICAL_CAPABILITY_IDS = Object.freeze([
|
|
|
10
10
|
"audio.voice.convert",
|
|
11
11
|
"image.face_swap",
|
|
12
12
|
"image.generate",
|
|
13
|
+
"image.upscale",
|
|
13
14
|
"music.generate",
|
|
14
15
|
"music.transcribe",
|
|
15
16
|
"realtime.interact",
|
|
@@ -19,6 +20,7 @@ export const CANONICAL_CAPABILITY_IDS = Object.freeze([
|
|
|
19
20
|
"text.generate",
|
|
20
21
|
"video.face_swap",
|
|
21
22
|
"video.generate",
|
|
23
|
+
"video.upscale",
|
|
22
24
|
"vision.locate",
|
|
23
25
|
"voice.create",
|
|
24
26
|
"world.generate"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface DevelopmentRealm {
|
|
2
|
+
readonly name: 'official' | 'local';
|
|
3
|
+
readonly apiOrigin: string;
|
|
4
|
+
readonly realtimeOrigin: string;
|
|
5
|
+
readonly webOrigin: string;
|
|
6
|
+
readonly environmentId: string;
|
|
7
|
+
}
|
|
8
|
+
export function resolveDevelopmentRealm(selection?: 'official' | 'local', env?: Record<string, string | undefined>): DevelopmentRealm;
|
|
9
|
+
export function developmentRealmEnvironment(realm: DevelopmentRealm): Record<string, string>;
|
|
10
|
+
export function exactDevelopmentOrigin(value: string, label: string): string;
|