@nimiplatform/app-tools 0.13.1 → 0.16.0-rc.9
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 +65 -8
- package/bin/nimi-app.mjs +26 -10
- package/lib/app-access-declaration.mjs +3 -0
- package/lib/app-dependency-combinations.mjs +70 -20
- package/lib/app-doctor-update.mjs +95 -36
- package/lib/app-host-support.mjs +6 -0
- package/lib/app-icons.mjs +181 -0
- package/lib/app-identifiers.mjs +27 -0
- package/lib/app-info.mjs +21 -33
- package/lib/app-lifecycle-guidance.mjs +2 -1
- package/lib/app-pack.mjs +14 -36
- package/lib/app-project-lifecycle.mjs +141 -243
- package/lib/app-scaffold-capabilities.mjs +13 -109
- package/lib/app-scaffold-profiles.mjs +108 -117
- package/lib/app-scaffold.mjs +70 -165
- 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 +40 -1
- package/lib/mobile-development.mjs +19 -0
- package/lib/realm-environments.generated.mjs +5 -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 +39 -27
- package/scripts/dev-shell.mjs +4 -1
- package/scripts/sync-scaffold-versions.mjs +0 -2
- package/skills/nimi-app-lifecycle/SKILL.md +13 -5
- package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
- package/skills/nimi-app-lifecycle/references/adapt.md +7 -3
- package/skills/nimi-app-lifecycle/references/audit.md +3 -2
- package/skills/nimi-app-lifecycle/references/create.md +8 -2
- package/skills/nimi-app-lifecycle/references/release.md +2 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +15 -1
- 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 +79 -19
- package/templates/app-source/src/ai-studio-core/messages/zh.json +79 -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 +40 -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 +102 -77
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +62 -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 +26 -9
- 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 +182 -81
- 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 +17 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +17 -3
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +33 -1
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +3 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -4
- 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 +59 -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 +8 -5
- package/templates/default-starter/NIMI_APP.md +7 -0
- package/templates/default-starter/README.md +3 -1
- package/templates/default-starter/src/shell/App.tsx +12 -20
- 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 +4 -16
- package/templates/hosted-web-release.yml +88 -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-pack.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assertDesktopHostSupport } from './app-host-support.mjs';
|
|
2
|
+
import { isAppId } from './app-identifiers.mjs';
|
|
1
3
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-009b
|
|
2
4
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-014a
|
|
3
5
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-018a
|
|
@@ -34,7 +36,6 @@ const AGGREGATE_FORMAT = 'nimi.app-release-candidate/v1';
|
|
|
34
36
|
const BUILD_PROFILE_PATH = '.nimi/config/build-profile.yaml';
|
|
35
37
|
const ELECTRON_BUILD_PROFILE_REF = 'electron-packager-pnpm-vite';
|
|
36
38
|
const APP_OWNED_ELECTRON_BUILD_PROFILE_REF = 'electron-pnpm';
|
|
37
|
-
const TAURI_BUILD_PROFILE_REF = 'tauri-pnpm-vite';
|
|
38
39
|
const OUTPUT_DIR = 'dist/nimi-app';
|
|
39
40
|
const SEMVER_PATTERN = /^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?(?:\+[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$/u;
|
|
40
41
|
const TARGETS = Object.freeze({
|
|
@@ -137,21 +138,6 @@ function readYaml(filePath, label) {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
function readCargoPackageVersion(source) {
|
|
141
|
-
let inPackage = false;
|
|
142
|
-
for (const line of source.split(/\r?\n/u)) {
|
|
143
|
-
const header = line.match(/^\s*\[([^\]]+)\]\s*(?:#.*)?$/u);
|
|
144
|
-
if (header) {
|
|
145
|
-
inPackage = header[1] === 'package';
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
if (!inPackage) continue;
|
|
149
|
-
const match = line.match(/^\s*version\s*=\s*"([^"]+)"\s*(?:#.*)?$/u);
|
|
150
|
-
if (match) return match[1];
|
|
151
|
-
}
|
|
152
|
-
throw new Error('src-tauri/Cargo.toml [package] version is missing');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
141
|
function collectPayload(payloadPath, os) {
|
|
156
142
|
const stat = lstatSync(payloadPath);
|
|
157
143
|
if (stat.isSymbolicLink()) throw new Error('Pack payload must not contain symbolic links');
|
|
@@ -311,7 +297,17 @@ export function readNimiAppArchive(bytes) {
|
|
|
311
297
|
return entries;
|
|
312
298
|
}
|
|
313
299
|
|
|
300
|
+
function readNativePackProfile(targetDir) {
|
|
301
|
+
const profile = readYaml(path.join(targetDir, BUILD_PROFILE_PATH), BUILD_PROFILE_PATH);
|
|
302
|
+
assertDesktopHostSupport(profile.build_profile_ref);
|
|
303
|
+
if (![ELECTRON_BUILD_PROFILE_REF, APP_OWNED_ELECTRON_BUILD_PROFILE_REF].includes(profile.build_profile_ref)) {
|
|
304
|
+
throw new Error(`${BUILD_PROFILE_PATH} build_profile_ref is unsupported: ${String(profile.build_profile_ref)}`);
|
|
305
|
+
}
|
|
306
|
+
return profile;
|
|
307
|
+
}
|
|
308
|
+
|
|
314
309
|
function readPackInputs(targetDir, targetId) {
|
|
310
|
+
const buildProfile = readNativePackProfile(targetDir);
|
|
315
311
|
const target = TARGETS[targetId];
|
|
316
312
|
if (!target) throw new Error(`Unsupported App package target: ${targetId}`);
|
|
317
313
|
const packageJson = readJson(path.join(targetDir, 'package.json'), 'package.json');
|
|
@@ -324,31 +320,12 @@ function readPackInputs(targetDir, targetId) {
|
|
|
324
320
|
const manifestPath = path.join(targetDir, 'nimi.app.yaml');
|
|
325
321
|
const manifest = readYaml(manifestPath, 'nimi.app.yaml');
|
|
326
322
|
const appInfo = readAppInfo(targetDir, targetId);
|
|
327
|
-
const buildProfile = readYaml(path.join(targetDir, BUILD_PROFILE_PATH), BUILD_PROFILE_PATH);
|
|
328
|
-
const buildProfileRef = buildProfile.build_profile_ref;
|
|
329
|
-
if (![ELECTRON_BUILD_PROFILE_REF, APP_OWNED_ELECTRON_BUILD_PROFILE_REF, TAURI_BUILD_PROFILE_REF].includes(buildProfileRef)) {
|
|
330
|
-
throw new Error(`${BUILD_PROFILE_PATH} build_profile_ref is unsupported: ${String(buildProfileRef)}`);
|
|
331
|
-
}
|
|
332
|
-
const requiresTauri = buildProfileRef === TAURI_BUILD_PROFILE_REF;
|
|
333
323
|
const appId = String(manifest.app_id || '');
|
|
334
324
|
const version = String(packageJson.version || '');
|
|
335
|
-
if (
|
|
325
|
+
if (!isAppId(appId)) throw new Error('nimi.app.yaml app_id must be canonical and dotted');
|
|
336
326
|
if (!SEMVER_PATTERN.test(version) || manifest.version !== version) {
|
|
337
327
|
throw new Error('package.json and nimi.app.yaml versions must be exact and lockstep before pack');
|
|
338
328
|
}
|
|
339
|
-
if (requiresTauri) {
|
|
340
|
-
const cargoPath = path.join(targetDir, 'src-tauri', 'Cargo.toml');
|
|
341
|
-
const tauriPath = path.join(targetDir, 'src-tauri', 'tauri.conf.json');
|
|
342
|
-
if (!existsSync(cargoPath)) throw new Error('src-tauri/Cargo.toml is missing');
|
|
343
|
-
if (!existsSync(tauriPath)) throw new Error('src-tauri/tauri.conf.json is missing');
|
|
344
|
-
const tauriConfig = readJson(tauriPath, 'src-tauri/tauri.conf.json');
|
|
345
|
-
if (
|
|
346
|
-
readCargoPackageVersion(readFileSync(cargoPath, 'utf8')) !== version
|
|
347
|
-
|| tauriConfig.version !== version
|
|
348
|
-
) {
|
|
349
|
-
throw new Error('package.json, nimi.app.yaml, Cargo.toml, and tauri.conf.json versions must be exact and lockstep before pack');
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
329
|
const configured = buildProfile.targets?.[targetId];
|
|
353
330
|
if (!configured || typeof configured !== 'object' || Array.isArray(configured)) throw new Error(`Build profile does not declare target: ${targetId}`);
|
|
354
331
|
if (configured.os !== target.os || configured.arch !== target.arch) throw new Error(`Build profile target identity mismatch: ${targetId}`);
|
|
@@ -550,6 +527,7 @@ export function packAppTarget(cwd, options = {}) {
|
|
|
550
527
|
|
|
551
528
|
export function aggregateAppTargetCandidates(cwd, options = {}) {
|
|
552
529
|
const targetDir = path.resolve(cwd, String(options.dir || '').trim() || '.');
|
|
530
|
+
readNativePackProfile(targetDir);
|
|
553
531
|
const outputDir = path.join(targetDir, OUTPUT_DIR);
|
|
554
532
|
if (!existsSync(outputDir)) throw new Error('No target metadata exists to aggregate');
|
|
555
533
|
const files = readdirSync(outputDir).filter((name) => name.endsWith('.target.json')).sort();
|