@nimiplatform/app-tools 0.6.3 → 0.11.4

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 (115) hide show
  1. package/README.md +153 -12
  2. package/bin/nimi-app.mjs +16 -14
  3. package/lib/app-access-declaration.mjs +1 -0
  4. package/lib/app-dependency-combinations.mjs +49 -0
  5. package/lib/app-doctor-update.mjs +84 -23
  6. package/lib/app-info.mjs +33 -3
  7. package/lib/app-lifecycle-guidance.mjs +4 -2
  8. package/lib/app-pack.mjs +5 -2
  9. package/lib/app-project-lifecycle.mjs +284 -53
  10. package/lib/app-safety-profile.mjs +204 -0
  11. package/lib/app-scaffold-capabilities.mjs +11 -3
  12. package/lib/app-scaffold-profiles.mjs +136 -27
  13. package/lib/app-scaffold.mjs +55 -7
  14. package/lib/canonical-capability-ids.generated.mjs +25 -0
  15. package/lib/index.mjs +0 -4
  16. package/package.json +27 -31
  17. package/scripts/dev-shell.mjs +80 -18
  18. package/skills/nimi-app-lifecycle/SKILL.md +7 -3
  19. package/skills/nimi-app-lifecycle/references/acceptance.md +7 -1
  20. package/skills/nimi-app-lifecycle/references/adapt.md +46 -1
  21. package/skills/nimi-app-lifecycle/references/audit.md +55 -0
  22. package/skills/nimi-app-lifecycle/references/platform-gaps.md +15 -0
  23. package/skills/nimi-app-lifecycle/references/release.md +2 -2
  24. package/skills/nimi-app-lifecycle/references/safety-declaration.md +37 -0
  25. package/skills/nimi-app-lifecycle/references/upgrade-platform.md +16 -2
  26. package/templates/app-source/src/ai-studio-core/ai-config.ts +17 -3
  27. package/templates/app-source/src/ai-studio-core/ai-studio-core.css +40 -3
  28. package/templates/app-source/src/ai-studio-core/audio-separation-request.ts +24 -0
  29. package/templates/app-source/src/ai-studio-core/contexts.tsx +4 -0
  30. package/templates/app-source/src/ai-studio-core/history-policy.ts +395 -41
  31. package/templates/app-source/src/ai-studio-core/history.ts +262 -10
  32. package/templates/app-source/src/ai-studio-core/host-context.tsx +15 -2
  33. package/templates/app-source/src/ai-studio-core/index.ts +15 -4
  34. package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +105 -0
  35. package/templates/app-source/src/ai-studio-core/job-recovery.ts +224 -0
  36. package/templates/app-source/src/ai-studio-core/managed-result-references.ts +79 -0
  37. package/templates/app-source/src/ai-studio-core/messages/en.json +185 -10
  38. package/templates/app-source/src/ai-studio-core/messages/zh.json +185 -10
  39. package/templates/app-source/src/ai-studio-core/module-registration.ts +9 -1
  40. package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +81 -2
  41. package/templates/app-source/src/ai-studio-core/parameters.ts +34 -1
  42. package/templates/app-source/src/ai-studio-core/runtime-types.ts +124 -8
  43. package/templates/app-source/src/ai-studio-core/runtime.ts +218 -20
  44. package/templates/app-source/src/ai-studio-core/section-ai-testing-annotation-result.tsx +123 -0
  45. package/templates/app-source/src/ai-studio-core/section-ai-testing-artifact-preview.ts +3 -0
  46. package/templates/app-source/src/ai-studio-core/section-ai-testing-audio-separation-result.tsx +26 -0
  47. package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +14 -7
  48. package/templates/app-source/src/ai-studio-core/section-ai-testing-decision-result.tsx +76 -0
  49. package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +71 -0
  50. package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +20 -4
  51. package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +29 -0
  52. package/templates/app-source/src/ai-studio-core/section-ai-testing-music-result.tsx +45 -0
  53. package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +132 -10
  54. package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +122 -38
  55. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +4 -3
  56. package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +66 -0
  57. package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +100 -22
  58. package/templates/app-source/src/ai-studio-core/section-ai-testing-surface.tsx +6 -0
  59. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcript-result.tsx +45 -0
  60. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +106 -0
  61. package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +23 -4
  62. package/templates/app-source/src/ai-studio-core/section-ai-testing-voice-asset-actions.tsx +40 -0
  63. package/templates/app-source/src/ai-studio-core/section-ai-testing-voice-conversion-result.tsx +20 -0
  64. package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +219 -35
  65. package/templates/app-source/src/ai-studio-core/text-annotation-document.ts +50 -0
  66. package/templates/app-source/src/ai-studio-core/text-media-replay.ts +51 -0
  67. package/templates/app-source/src/ai-studio-core/voice-assets.ts +17 -0
  68. package/templates/app-source/src/ai-studio-core/workspace.tsx +48 -6
  69. package/templates/app-source/src/studio-modules/studio-create/descriptors.ts +1 -1
  70. package/templates/app-source/src/studio-modules/studio-create/messages/en.json +13 -1
  71. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +13 -1
  72. package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
  73. package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -2
  74. package/templates/app-source/src/studio-modules/studio-create/registration.ts +2 -2
  75. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +121 -3
  76. package/templates/app-source/src/studio-modules/studio-media/audio-separate-parameters.tsx +72 -0
  77. package/templates/app-source/src/studio-modules/studio-media/audio-separate-runtime.ts +90 -0
  78. package/templates/app-source/src/studio-modules/studio-media/descriptors.ts +16 -1
  79. package/templates/app-source/src/studio-modules/studio-media/index.ts +2 -0
  80. package/templates/app-source/src/studio-modules/studio-media/messages/en.json +225 -7
  81. package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +225 -7
  82. package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +85 -0
  83. package/templates/app-source/src/studio-modules/studio-media/music-transcription-parameters.tsx +85 -0
  84. package/templates/app-source/src/studio-modules/studio-media/music-transcription-runtime.ts +64 -0
  85. package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +9 -26
  86. package/templates/app-source/src/studio-modules/studio-media/parameters.ts +170 -6
  87. package/templates/app-source/src/studio-modules/studio-media/registration.ts +29 -1
  88. package/templates/app-source/src/studio-modules/studio-media/runtime.ts +90 -6
  89. package/templates/app-source/src/studio-modules/studio-media/vision-parameters.tsx +1 -0
  90. package/templates/app-source/src/studio-modules/studio-media/vision-runtime.ts +23 -5
  91. package/templates/app-source/src/studio-modules/studio-media/voice-convert-parameters.tsx +132 -0
  92. package/templates/app-source/src/studio-modules/studio-media/voice-convert-runtime.ts +120 -0
  93. package/templates/app-source/src/studio-modules/studio-voice/audio-url.ts +25 -0
  94. package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +4 -4
  95. package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +4 -4
  96. package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +36 -10
  97. package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +66 -30
  98. package/templates/app-source/src/workbench-core/index.ts +2 -0
  99. package/templates/app-source/src/workbench-core/runtime-gate.tsx +102 -6
  100. package/templates/app-source/src/workbench-core/workbench-core.css +42 -0
  101. package/templates/app-source/src/workbench-core/workbench-core.tsx +69 -18
  102. package/templates/app-source.manifest.json +100 -0
  103. package/templates/default-starter/AGENTS.md +4 -2
  104. package/templates/default-starter/README.md +2 -1
  105. package/templates/default-starter/src/shell/workbench-target-adapter.ts +102 -12
  106. package/templates/default-starter.manifest.json +0 -4
  107. package/lib/simulator-conformance-ast.mjs +0 -498
  108. package/lib/simulator-conformance-css.mjs +0 -116
  109. package/lib/simulator-conformance-graph.mjs +0 -757
  110. package/lib/simulator-conformance.d.mts +0 -14
  111. package/lib/simulator-conformance.mjs +0 -203
  112. package/lib/simulator-css-profile.d.mts +0 -27
  113. package/lib/simulator-css-profile.mjs +0 -531
  114. package/lib/simulator-kit-export-resolution.mjs +0 -70
  115. package/lib/simulator-manifest.mjs +0 -334
@@ -33,6 +33,22 @@ export const SCAFFOLD_VERSION = '2026-08-31.app-lifecycle-v1';
33
33
  export const SCAFFOLD_STATE_DIR = '.nimi/app-scaffold';
34
34
  export const SCAFFOLD_INTENT_PATH = `${SCAFFOLD_STATE_DIR}/intent.json`;
35
35
  export const SCAFFOLD_LOCK_PATH = `${SCAFFOLD_STATE_DIR}/lock.json`;
36
+ // The template's own license notice, kept for the template-derived portions of
37
+ // a generated project. The project root LICENSE is the App's own file.
38
+ export const SCAFFOLD_TEMPLATE_LICENSE_NOTICE_PATH = 'licenses/nimi-app-template.txt';
39
+ // Files that earlier scaffold versions managed and that now belong to the App.
40
+ // Sync records the new owner and leaves the existing file exactly as it is.
41
+ export const SCAFFOLD_APP_OWNED_HANDOVER_PATHS = Object.freeze(['LICENSE']);
42
+ const TEMPLATE_LICENSE_COPYRIGHT_LINE = /^Copyright \(c\) (\d{4}) \S.*$/gmu;
43
+ const TEMPLATE_LICENSE_NOTICE_HEADER = [
44
+ 'Nimi App template notice',
45
+ '',
46
+ 'This project was created from the Nimi App template in @nimiplatform/app-tools.',
47
+ 'Portions that come from the template are provided under the license below.',
48
+ "The App's own license is the LICENSE file at the project root.",
49
+ '',
50
+ '',
51
+ ].join('\n');
36
52
  const LOCKFILE_POLICY = 'author-install-generates-lockfile';
37
53
  const GENERATED_GITIGNORE = [
38
54
  'node_modules/',
@@ -67,11 +83,11 @@ const APP_RELEASE_WORKFLOW = [
67
83
  ' outputs:',
68
84
  ' matrix: ${{ steps.matrix.outputs.matrix }}',
69
85
  ' steps:',
70
- ' - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2',
86
+ ' - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1',
71
87
  ' with:',
72
88
  ' fetch-depth: 0',
73
89
  ' persist-credentials: false',
74
- ' - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0',
90
+ ' - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0',
75
91
  ' with:',
76
92
  ' node-version: 24',
77
93
  ' package-manager-cache: false',
@@ -158,10 +174,10 @@ const APP_RELEASE_WORKFLOW = [
158
174
  ' fail-fast: false',
159
175
  ' matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}',
160
176
  ' steps:',
161
- ' - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2',
177
+ ' - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1',
162
178
  ' with:',
163
179
  ' persist-credentials: false',
164
- ' - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0',
180
+ ' - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0',
165
181
  ' with:',
166
182
  ' node-version: 24',
167
183
  ' package-manager-cache: false',
@@ -229,10 +245,10 @@ const APP_RELEASE_WORKFLOW = [
229
245
  ' needs: build-target',
230
246
  ' runs-on: ubuntu-latest',
231
247
  ' steps:',
232
- ' - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2',
248
+ ' - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1',
233
249
  ' with:',
234
250
  ' persist-credentials: false',
235
- ' - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0',
251
+ ' - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0',
236
252
  ' with:',
237
253
  ' node-version: 24',
238
254
  ' package-manager-cache: false',
@@ -1087,6 +1103,7 @@ export function renderAppSubmissionInput(identity, options = {}) {
1087
1103
  required_standardized_feature_refs: options.requiredStandardizedFeatureRefs || [],
1088
1104
  ...(options.aiProfileRecommendationRef ? { ai_profile_recommendation_ref: options.aiProfileRecommendationRef } : {}),
1089
1105
  storage_policy: options.storagePolicy || { kind: 'nimi-mediated-default' },
1106
+ ...(options.safetyProfile ? { safety_profile: options.safetyProfile } : {}),
1090
1107
  support_manifest: supportManifest,
1091
1108
  review_inputs: {
1092
1109
  manifest: 'nimi.app.yaml',
@@ -1097,6 +1114,25 @@ export function renderAppSubmissionInput(identity, options = {}) {
1097
1114
  }, { lineWidth: 0 });
1098
1115
  }
1099
1116
 
1117
+ // The App's initial license keeps the template's license text and names the
1118
+ // package author, or the App title when no author was given, as the holder.
1119
+ export function renderInitialAppLicense(templateLicense, holder) {
1120
+ const copyrightLines = [...templateLicense.matchAll(TEMPLATE_LICENSE_COPYRIGHT_LINE)];
1121
+ if (copyrightLines.length !== 1) {
1122
+ throw new Error('Template LICENSE must contain exactly one copyright line');
1123
+ }
1124
+ return templateLicense.replace(TEMPLATE_LICENSE_COPYRIGHT_LINE, (_line, year) => `Copyright (c) ${year} ${holder}`);
1125
+ }
1126
+
1127
+ export function renderTemplateLicenseNotice(templateLicense) {
1128
+ return `${TEMPLATE_LICENSE_NOTICE_HEADER}${templateLicense}`;
1129
+ }
1130
+
1131
+ function readTemplateLicense() {
1132
+ const { baseDir } = loadDefaultStarterSource();
1133
+ return readDefaultStarterSourceFile(baseDir, 'LICENSE');
1134
+ }
1135
+
1100
1136
  export function renderScaffoldBoundary() {
1101
1137
  return YAML.stringify({
1102
1138
  scaffold_contract: 'P-SCAF',
@@ -1107,12 +1143,24 @@ export function renderScaffoldBoundary() {
1107
1143
  }
1108
1144
 
1109
1145
  function buildStructuredFiles(identity, profile, versions) {
1146
+ const templateLicense = readTemplateLicense();
1110
1147
  const files = [
1111
1148
  {
1112
1149
  path: '.gitignore',
1113
1150
  content: GENERATED_GITIGNORE,
1114
1151
  mutationClass: 'scaffold-managed glue',
1115
1152
  },
1153
+ {
1154
+ // Created once for the App to own; sync never rewrites it.
1155
+ path: 'LICENSE',
1156
+ content: renderInitialAppLicense(templateLicense, identity.author || identity.appTitle),
1157
+ mutationClass: 'app-owned product code',
1158
+ },
1159
+ {
1160
+ path: SCAFFOLD_TEMPLATE_LICENSE_NOTICE_PATH,
1161
+ content: renderTemplateLicenseNotice(templateLicense),
1162
+ mutationClass: 'scaffold-managed glue',
1163
+ },
1116
1164
  {
1117
1165
  path: 'package.json',
1118
1166
  content: jsonFile(buildPackageJson(profile, versions, identity)),
@@ -1594,7 +1642,7 @@ export function createAppScaffoldCandidate(input) {
1594
1642
  return createAppScaffold({ ...input, plan });
1595
1643
  }
1596
1644
 
1597
- export const APP_AUTHOR_DECLARATION_FIELDS = Object.freeze(['metadata', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy']);
1645
+ export const APP_AUTHOR_DECLARATION_FIELDS = Object.freeze(['metadata', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', 'safety_profile']);
1598
1646
 
1599
1647
  // Source configuration is editable; existing scaffold checks still cover identity and carrier fields.
1600
1648
  export function hashScaffoldManagedContent(relativePath, content) {
@@ -0,0 +1,25 @@
1
+ // GENERATED FILE — DO NOT EDIT.
2
+ // Source: config/platform-canonical-capability-catalog.yaml
3
+ // Regenerate: pnpm gen:canonical-capability-catalog
4
+ // These identities validate references; they do not admit scaffold features.
5
+ export const CANONICAL_CAPABILITY_IDS = Object.freeze([
6
+ "audio.separate",
7
+ "audio.speaker.embed",
8
+ "audio.synthesize",
9
+ "audio.transcribe",
10
+ "audio.voice.convert",
11
+ "image.face_swap",
12
+ "image.generate",
13
+ "music.generate",
14
+ "music.transcribe",
15
+ "realtime.interact",
16
+ "text.annotate",
17
+ "text.decide",
18
+ "text.embed",
19
+ "text.generate",
20
+ "video.face_swap",
21
+ "video.generate",
22
+ "vision.locate",
23
+ "voice.create",
24
+ "world.generate"
25
+ ]);
package/lib/index.mjs CHANGED
@@ -20,10 +20,6 @@ import {
20
20
  } from './app-project-lifecycle.mjs';
21
21
  import { aggregateAppTargetCandidates, packAppTarget } from './app-pack.mjs';
22
22
  export { runDevShell } from '../scripts/dev-shell.mjs';
23
- export {
24
- validateSimulatorAppSource,
25
- validateSimulatorAppSourceWithCanonicalKitExports,
26
- } from './simulator-conformance.mjs';
27
23
  export { APP_SCAFFOLD_FEATURE_IDS } from './app-scaffold-capabilities.mjs';
28
24
 
29
25
  const APP_TOOLS_PACKAGE_MANIFEST = JSON.parse(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimiplatform/app-tools",
3
- "version": "0.6.3",
3
+ "version": "0.11.4",
4
4
  "description": "Public app-authoring CLI for Nimi App projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -18,39 +18,36 @@
18
18
  "provenance": true
19
19
  },
20
20
  "nimiScaffoldVersions": {
21
- "sdkVersion": "^0.13.0",
22
- "appToolsVersion": "^0.6.3",
23
- "nimicodingVersion": "0.6.3",
21
+ "sdkVersion": "^0.21.0",
22
+ "appToolsVersion": "^0.11.4",
23
+ "nimicodingVersion": "0.6.5",
24
24
  "aiSdkVersion": "^6.0.85",
25
- "kitVersion": "^0.9.0",
26
- "reactVersion": "^19.2.8",
27
- "reactDomVersion": "^19.2.8",
28
- "i18nextVersion": "^25.10.10",
29
- "lucideReactVersion": "^0.577.0",
30
- "tsxVersion": "^4.23.13",
31
- "typescriptVersion": "^5.9.3",
32
- "nodeTypesVersion": "^24.13.3",
33
- "reactTypesVersion": "^19.2.18",
34
- "reactDomTypesVersion": "^19.2.5",
35
- "viteVersion": "^7.3.6",
36
- "viteReactPluginVersion": "^5.2.0",
25
+ "kitVersion": "^0.18.1",
26
+ "reactVersion": "^19.3.0",
27
+ "reactDomVersion": "^19.3.0",
28
+ "i18nextVersion": "^26.4.2",
29
+ "lucideReactVersion": "^1.51.0",
30
+ "tsxVersion": "^4.23.15",
31
+ "typescriptVersion": "^6.0.3",
32
+ "nodeTypesVersion": "^24.19.1",
33
+ "reactTypesVersion": "^19.3.0",
34
+ "reactDomTypesVersion": "^19.3.0",
35
+ "viteVersion": "^8.3.3",
36
+ "viteReactPluginVersion": "^6.1.2",
37
37
  "tailwindcssVersion": "^4.3.3",
38
38
  "tailwindcssViteVersion": "^4.3.3",
39
39
  "tauriCliVersion": "^2.11.4",
40
- "yamlVersion": "^2.9.0",
41
- "nimiShellTauriVersion": "0.5.0",
40
+ "yamlVersion": "^2.9.1",
41
+ "nimiShellTauriVersion": "0.10.0",
42
42
  "electronPackagerVersion": "^20.3.0",
43
- "electronVersion": "^42.10.1",
43
+ "electronVersion": "^44.5.1",
44
44
  "esbuildVersion": "^0.28.2",
45
45
  "packageManager": "pnpm@10.34.5"
46
46
  },
47
47
  "bin": {
48
48
  "nimi-app": "./bin/nimi-app.mjs"
49
49
  },
50
- "exports": {
51
- "./simulator-conformance": "./lib/simulator-conformance.mjs",
52
- "./simulator-css-profile": "./lib/simulator-css-profile.mjs"
53
- },
50
+ "exports": {},
54
51
  "scripts": {
55
52
  "build": "node scripts/sync-scaffold-versions.mjs --apply && node scripts/sync-app-source.mjs --apply",
56
53
  "sync:versions": "node scripts/sync-scaffold-versions.mjs --apply",
@@ -58,7 +55,7 @@
58
55
  "prepack": "pnpm run build",
59
56
  "prepublishOnly": "pnpm run build",
60
57
  "test": "node ../scripts/with-workspace-surfaces.mjs -- pnpm run test:prepared",
61
- "test:prepared": "node scripts/sync-scaffold-versions.mjs --check && node --test test/simulator-conformance.test.mjs test/dev-shell.test.mjs && node --test test/app-project-lifecycle.test.mjs test/app-pack.test.mjs test/app-scaffold.test.mjs"
58
+ "test:prepared": "node scripts/sync-scaffold-versions.mjs --check && node --test test/dev-shell.test.mjs && node --test 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-scaffold.test.mjs"
62
59
  },
63
60
  "files": [
64
61
  "bin",
@@ -70,14 +67,12 @@
70
67
  ],
71
68
  "dependencies": {
72
69
  "pngjs": "7.0.0",
73
- "postcss": "^8.5.26",
74
- "postcss-selector-parser": "^7.1.5",
75
70
  "semver": "^7.8.5",
76
- "typescript": "^5.9.3",
77
- "yaml": "^2.9.0"
71
+ "typescript": "6.0.3",
72
+ "yaml": "2.9.1"
78
73
  },
79
74
  "peerDependencies": {
80
- "vite": "^7.3.6"
75
+ "vite": "^8.0.0"
81
76
  },
82
77
  "peerDependenciesMeta": {
83
78
  "vite": {
@@ -85,7 +80,8 @@
85
80
  }
86
81
  },
87
82
  "devDependencies": {
88
- "@types/node": "^24.13.3",
89
- "vite": "7.3.6"
83
+ "@types/node": "24.19.1",
84
+ "vite": "8.3.3",
85
+ "i18next": "26.4.2"
90
86
  }
91
87
  }
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { lstat, readFile, realpath } from 'node:fs/promises';
3
+ import { lstat, readFile, realpath, stat } from 'node:fs/promises';
4
4
  import { homedir } from 'node:os';
5
5
  import path from 'node:path';
6
6
  import process from 'node:process';
7
+ import { createInterface } from 'node:readline/promises';
7
8
  import { parseEnv } from 'node:util';
8
9
  import { parse as parseYaml } from 'yaml';
9
10
 
@@ -25,7 +26,9 @@ const TERMINAL_STATES = new Set([
25
26
 
26
27
  // @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018a
27
28
  export async function runDevShell(cwd, options = {}) {
28
- if (options.listRegistrations && options.resume) throw new DevShellError('local-development-intent-invalid', '--list-registrations and --resume cannot be combined.');
29
+ if ([options.listRegistrations, options.resume, options.newRegistration].filter(Boolean).length > 1) {
30
+ throw new DevShellError('local-development-intent-invalid', '--list-registrations, --resume and --new-registration cannot be combined.');
31
+ }
29
32
  if (options.resume && !/^dev-project-[A-Za-z0-9_-]{1,148}$/u.test(options.resume)) {
30
33
  throw new DevShellError('local-development-selector-invalid', '--resume requires a current-host selector from --list-registrations.');
31
34
  }
@@ -42,8 +45,10 @@ export async function runDevShell(cwd, options = {}) {
42
45
  if (typeof fetchImpl !== 'function') {
43
46
  throw new DevShellError('local-development-launcher-unavailable', 'This Node.js runtime does not provide fetch.');
44
47
  }
45
- if (options.listRegistrations) {
46
- const listed = await postJson(fetchImpl, descriptor.endpoint, '/v1/registrations', {
48
+ if (!options.listRegistrations) await assertProjectElectronRuntime(projectRoot);
49
+ let registrationSelector = options.resume;
50
+ if (options.listRegistrations || (!options.resume && !options.newRegistration)) {
51
+ const listed = await postJson(fetchImpl, descriptor, '/v1/registrations', {
47
52
  schemaVersion: 1, appId, projectRoot, shell,
48
53
  });
49
54
  if (listed?.status !== 'ok' || !Array.isArray(listed.registrations)) {
@@ -55,12 +60,17 @@ export async function runDevShell(cwd, options = {}) {
55
60
  || typeof row.displayName !== 'string' || !Number.isSafeInteger(row.registeredAtUnixMs)) {
56
61
  throw new DevShellError('local-development-intent-invalid', 'Desktop returned an invalid registration projection.');
57
62
  }
58
- output.write(`${row.selector}\t${new Date(row.registeredAtUnixMs).toISOString()}\t${row.displayName}\n`);
59
63
  }
60
- output.write(listed.registrations.length
61
- ? '[nimi-app dev] Resume an explicit selection with: pnpm dev -- --resume <selector>\n'
62
- : '[nimi-app dev] No current-host registrations for this project. Run pnpm dev to create one.\n');
63
- return listed.registrations;
64
+ if (options.listRegistrations) {
65
+ printRegistrations(output, listed.registrations);
66
+ output.write(listed.registrations.length
67
+ ? '[nimi-app dev] Resume an explicit selection with: pnpm dev -- --resume <selector>\n'
68
+ : '[nimi-app dev] No current-host registrations for this project. Run pnpm dev to create one.\n');
69
+ return listed.registrations;
70
+ }
71
+ if (listed.registrations.length) {
72
+ registrationSelector = await selectRegistration(listed.registrations, options);
73
+ }
64
74
  }
65
75
 
66
76
  const startIntent = {
@@ -69,9 +79,10 @@ export async function runDevShell(cwd, options = {}) {
69
79
  projectRoot,
70
80
  shell,
71
81
  ...(cdpPort === undefined ? {} : { cdpPort }),
72
- ...(options.resume ? { registrationSelector: options.resume } : {}),
82
+ ...(registrationSelector ? { registrationSelector } : {}),
83
+ ...(options.newRegistration ? { newRegistration: true } : {}),
73
84
  };
74
- const start = await postJson(fetchImpl, descriptor.endpoint, '/v1/start', startIntent);
85
+ const start = await postJson(fetchImpl, descriptor, '/v1/start', startIntent);
75
86
  const initial = parseBridgeRun(start);
76
87
  if (!initial.runId) {
77
88
  throw bridgeError(start, initial);
@@ -87,7 +98,7 @@ export async function runDevShell(cwd, options = {}) {
87
98
  if (cancelling) return;
88
99
  cancelling = true;
89
100
  try {
90
- await postJson(fetchImpl, descriptor.endpoint, '/v1/cancel', {
101
+ await postJson(fetchImpl, descriptor, '/v1/cancel', {
91
102
  schemaVersion: 1,
92
103
  runId: initial.runId,
93
104
  });
@@ -104,7 +115,8 @@ export async function runDevShell(cwd, options = {}) {
104
115
  if (current.state !== lastState) lastState = current.state;
105
116
  lastLogSequence = printNewLogs(output, current, lastLogSequence);
106
117
  if (TERMINAL_STATES.has(current.state)) {
107
- if (current.state === 'stopped' && cancelling) return current;
118
+ // Desktop may finish an ordinary stop from its own UI, without a CLI signal.
119
+ if (current.state === 'stopped') return current;
108
120
  throw new DevShellError(
109
121
  current.reasonCode || `local-development-${current.state}`,
110
122
  current.message || `Nimi local development ended in state ${current.state}.`,
@@ -115,7 +127,7 @@ export async function runDevShell(cwd, options = {}) {
115
127
  return current;
116
128
  }
117
129
  await delay(STATUS_POLL_MS, signal);
118
- const response = await postJson(fetchImpl, descriptor.endpoint, '/v1/status', {
130
+ const response = await postJson(fetchImpl, descriptor, '/v1/status', {
119
131
  schemaVersion: 1,
120
132
  runId: initial.runId,
121
133
  });
@@ -134,6 +146,36 @@ export async function runDevShell(cwd, options = {}) {
134
146
  }
135
147
  }
136
148
 
149
+ function printRegistrations(output, registrations) {
150
+ for (const [index, row] of registrations.entries()) {
151
+ output.write(`${index + 1}. ${row.selector}\t${new Date(row.registeredAtUnixMs).toISOString()}\t${row.displayName}\n`);
152
+ }
153
+ }
154
+
155
+ async function selectRegistration(registrations, options) {
156
+ const input = options.input ?? process.stdin;
157
+ const output = options.output ?? process.stdout;
158
+ printRegistrations(output, registrations);
159
+ const guidance = 'Choose an existing registration with --resume <selector>, or use --new-registration for separate App data.';
160
+ if (!input.isTTY || !output.isTTY) {
161
+ throw new DevShellError('local-development-registration-selection-required', guidance);
162
+ }
163
+ const prompt = createInterface({ input, output });
164
+ try {
165
+ const answer = (await prompt.question(
166
+ '[nimi-app dev] Resume which registration? Enter its number (empty cancels): ',
167
+ options.signal ? { signal: options.signal } : undefined,
168
+ )).trim();
169
+ const index = /^\d+$/u.test(answer) ? Number(answer) - 1 : -1;
170
+ if (!Number.isSafeInteger(index) || !registrations[index]) {
171
+ throw new DevShellError('local-development-registration-selection-required', guidance);
172
+ }
173
+ return registrations[index].selector;
174
+ } finally {
175
+ prompt.close();
176
+ }
177
+ }
178
+
137
179
  export function assertLocalDevelopmentPlatform(platform, shell) {
138
180
  if (shell !== 'electron') {
139
181
  throw new DevShellError(
@@ -148,6 +190,22 @@ export function assertLocalDevelopmentPlatform(platform, shell) {
148
190
  );
149
191
  }
150
192
 
193
+ // This is a dependency-presence check, not executable identity or admission.
194
+ // Desktop still verifies and supervises the actual Host process.
195
+ export async function assertProjectElectronRuntime(projectRoot, platform = process.platform) {
196
+ if (platform !== 'win32') return;
197
+ const executable = path.join(projectRoot, 'node_modules', 'electron', 'dist', 'electron.exe');
198
+ const available = await stat(executable).then((value) => value.isFile()).catch(() => false);
199
+ if (!available) {
200
+ throw new DevShellError(
201
+ 'local-development-launcher-unavailable',
202
+ 'The project Electron binary is missing (node_modules/electron/dist/electron.exe). '
203
+ + 'For the matched Electron package, run pnpm exec install-electron --no in this project, '
204
+ + 'resolve any reported installation error, then retry nimi-app dev.',
205
+ );
206
+ }
207
+ }
208
+
151
209
  export class DevShellError extends Error {
152
210
  constructor(reasonCode, message) {
153
211
  super(message);
@@ -194,6 +252,7 @@ async function readPresenceDescriptor(descriptorPath, now) {
194
252
  await assertRegularFileWithoutSymlinkAncestry(descriptorPath);
195
253
  const raw = JSON.parse(await readFile(descriptorPath, 'utf8'));
196
254
  if (!isPlainObject(raw) || Object.keys(raw).sort().join(',') !== [
255
+ 'callerToken',
197
256
  'desktopAppId',
198
257
  'desktopPid',
199
258
  'endpoint',
@@ -209,7 +268,8 @@ async function readPresenceDescriptor(descriptorPath, now) {
209
268
  if (!Number.isFinite(heartbeat) || now - heartbeat > MAX_HEARTBEAT_AGE_MS || heartbeat - now > 5_000) {
210
269
  throw new Error('heartbeat');
211
270
  }
212
- return { endpoint: normalizeLoopbackEndpoint(raw.endpoint) };
271
+ if (typeof raw.callerToken !== 'string' || !/^[0-9a-f]{64}$/u.test(raw.callerToken)) throw new Error('caller-token');
272
+ return { endpoint: normalizeLoopbackEndpoint(raw.endpoint), callerToken: raw.callerToken };
213
273
  } catch {
214
274
  throw new DevShellError(
215
275
  'local-development-desktop-not-running',
@@ -232,12 +292,14 @@ async function assertRegularFileWithoutSymlinkAncestry(filePath) {
232
292
  if (!metadata.isFile()) throw new Error('not-file');
233
293
  }
234
294
 
235
- async function postJson(fetchImpl, endpoint, route, body) {
295
+ async function postJson(fetchImpl, desktop, route, body) {
236
296
  let response;
237
297
  try {
238
- response = await fetchImpl(`${endpoint}${route}`, {
298
+ response = await fetchImpl(`${desktop.endpoint}${route}`, {
239
299
  method: 'POST',
240
- headers: { 'Content-Type': 'application/json' },
300
+ // The token read from the owner-only presence file proves this caller
301
+ // is the official launcher running as the same OS user.
302
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${desktop.callerToken}` },
241
303
  body: JSON.stringify(body),
242
304
  redirect: 'error',
243
305
  signal: AbortSignal.timeout(route === '/v1/start' || route === '/v1/registrations'
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: nimi-app-lifecycle
3
- description: Create, adapt, maintain and prepare releases of Nimi App repositories with app-tools and the standard SDK/Kit carrier. Use for App development, not for carrying out the App's own creative or research tasks.
3
+ description: Audit Nimi App adaptation feasibility, capability fit and cost, or create, adapt, maintain and prepare releases with app-tools and the standard SDK/Kit carrier. Use for App development, not for carrying out the App's own creative or research tasks.
4
4
  ---
5
5
 
6
6
  # Nimi App lifecycle
@@ -9,20 +9,24 @@ Start with the repository's package manifest, actual product entry and nearest i
9
9
 
10
10
  | Task | Guide |
11
11
  | --- | --- |
12
+ | Decide whether to adapt an App; assess feasibility, gaps or cost | [Audit](references/audit.md) |
12
13
  | Create a new App | [Create](references/create.md) |
13
14
  | Adapt an existing project | [Adapt](references/adapt.md) |
15
+ | Resolve a Nimi AI capability or carrier gap | [Platform gaps](references/platform-gaps.md) |
14
16
  | Upgrade app-tools, SDK or Kit | [Platform upgrade](references/upgrade-platform.md) |
15
17
  | Bring in upstream changes | [Upstream sync](references/sync-upstream.md) |
18
+ | Declare audience, content, AI output and data facts | [Safety declaration](references/safety-declaration.md) |
16
19
  | Prepare a Release or Registry submission | [Release](references/release.md) |
17
20
  | Verify real App behavior or installation | [Acceptance](references/acceptance.md) |
18
21
 
19
- For an ordinary product edit, follow its existing code and tests. Do not reinitialize or run the entire release journey unless affected inputs or behavior require it.
22
+ An audit or planning request produces findings and a proposal; the future adaptation goal does not authorize implementation. If implementation is also explicitly requested, continue within that authorization after resolving the necessary decisions. For an ordinary product edit, follow its existing code and tests. Do not reinitialize or run the entire release journey unless affected inputs or behavior require it.
20
23
 
21
24
  ## Boundaries that matter
22
25
 
23
26
  - App-owned workflows, tool handlers, business accounts, non-AI services and product presentation stay with the App. Nimi AI, configuration, managed storage and protected sessions use public SDK/Kit Local App surfaces. Display identity is not a business login ticket.
27
+ - When implementing an existing App's first Nimi integration or foundation wiring change, follow the adaptation guide's same-package generated reference first. Reuse its Host, preload, renderer, session, App Access, AIConfig and AI call wiring; documentation complements that implementation. Preserve the original product journeys and settings rather than treating the reference workbench as the finished App. Reuse passing baseline results for ordinary business edits; creating or running a reference App is not a default audit prerequisite.
24
28
  - Fresh Apps use pnpm, Vite and Desktop-supervised Electron. Existing Apps may use another renderer framework with an App-owned development command and the `electron-pnpm` build profile. A Next/server or Python project still needs real Host and backend lifecycle/build work. Preserve its original user tasks and framework where they fit; initialization does not convert the product.
25
- - Read the selected app-tools package's `nimiScaffoldVersions` and the SDK/Kit migration notes. Public Apps use published registry dependencies. Private platform experiments are not public installation evidence.
29
+ - Read the selected app-tools package's `nimiScaffoldVersions` and the SDK/Kit migration notes. Fresh Apps use the tool default SDK/Kit combination; an existing App keeps its current supported SDK/Kit combination through sync and check while only the app-tools and nimi-coding tool dependencies follow the tool, and a declaration or tool update never upgrades business dependencies. Development can consume complete local npm tarballs through explicit pnpm-workspace overrides; keep the selected combination and lockfile, follow the package README, and do not require publication before iteration. Public release preflight requires registry resolutions; local package acceptance is not public installation evidence.
26
30
  - App Tools maintains its fixed lifecycle skill, AGENTS block and declared engineering projections. Existing Apps have no fresh scaffold intent/lock. Preserve their Host, product source and license; report unknown file collisions rather than inventing ownership.
27
31
  - GitHub owns publisher builds and Releases; Registry owns candidate validation and human admission; Runtime owns packages and App access; Desktop owns exact processes. These are separate facts. The external AI host owns the development task.
28
32
  - Continue authorized work through verification. Missing prerequisites pause dependent steps only. Never infer publication or human approval from a passing command. Mark relevant unrun product paths NOT-VERIFIED.
@@ -2,10 +2,14 @@
2
2
 
3
3
  Select the actual user journey and affected capability. Reuse the App's package scripts, existing tests and prior sufficient evidence; a small source or wording change does not require the whole release chain.
4
4
 
5
- For development, run the official `nimi-app dev` launcher with Desktop supervising Electron. Attach only to the exact App's reported loopback CDP target. Renderer URLs or independently launched processes cannot prove protected access. Use the existing `--list-registrations` and explicit `--resume <selector>` when continuing the same development data; do not persist selectors or reopen by App ID/path. Native and installed UI use their owner-supported paths, not production CDP additions.
5
+ For development, run the official `nimi-app dev` launcher with Desktop supervising Electron. Attach only to the exact App's reported loopback CDP target. Renderer URLs or independently launched processes cannot prove protected access. Use the existing `--list-registrations` and explicit `--resume <selector>` when continuing the same development data; do not persist selectors or reopen by App ID/path. Plain dev requests an explicit selection when registrations exist; non-interactive runs must pass --resume. Use --new-registration only for deliberately separate App data, never as a fallback from a rejected resume. Native and installed UI use their owner-supported paths, not production CDP additions.
6
+
7
+ On Windows the project must have its Electron binary installed. If the launcher reports a missing `node_modules/electron/dist/electron.exe`, run the matched package's explicit `pnpm exec install-electron --no`, then retry the original launch. An installed npm wrapper or a successful `pnpm rebuild electron` alone does not prove that binary is present. Keep the explicit installer in the App's normal dependency setup; no empty renderer or alternate Host is needed.
6
8
 
7
9
  Verify the real output the user needs: a cited research result, a correctly indexed document, or a playable/exported media artifact. Check cancellation, reconnect or account change when that behavior is affected. Tests and mocks can establish a contract; they cannot replace actual AI or App acceptance.
8
10
 
11
+ For local installed-App acceptance with complete local npm tarballs, run ordinary `check` and `build --target <target>`, then `pack --target <target> --production` on the matching host. The pack flag observes actual native signature and execution permissions; it neither requires registry dependency resolutions nor publishes. Plain `pack` produces a development archive that Runtime rejects for installation. Use Desktop's Apps → Add App → Import local package, review the actual preview, install and launch that source. Keep this separate from public-release `check --production` and `build --production`.
12
+
9
13
  For a declared release target, verify Catalog discovery/download/install, exact Host launch, current Access, real business use and uninstall on an ordinary machine without the source workspace or development runtimes. Local-package import proves only that separate source path. Keep missing external services visible.
10
14
 
11
15
  With two separately admitted versions, verify N to N+1 and the promised data retention. Reuse existing Runtime failure tests for preservation of the old package; if a normal real failure is observed, retry the same N/N+1 after confirming N remains available. Do not manufacture N+2, a downgrade path or a new fault-injection service.
@@ -13,3 +17,5 @@ With two separately admitted versions, verify N to N+1 and the promised data ret
13
17
  Runtime uninstall removes its exact managed package after Desktop stops the Host. App-owned OS storage remains untouched, including disclosed paths; explain the App's own cleanup action separately. Ordinary repair and arbitrary rollback remain outside this workflow.
14
18
 
15
19
  Report the tested App/version, target and result, plus relevant NOT-VERIFIED paths. Tool-core checks, a representative App slice, first release/install and a later update are separate completion levels. Keep necessary local output under `.nimi/local/`; do not create another task or proof ledger.
20
+
21
+ Separate results obtained now from prior actual acceptance that still applies to the same behavior and combination. Reuse sufficient evidence until a change, failure or concrete risk invalidates it; not rerunning a journey does not mean it never passed. Keep contract correctness and the user's required business result distinct from model-content quality. Maintain a current summary in existing project notes, label historical stages, and do not promote a bounded platform fix into completion of an ongoing App adaptation.
@@ -1,19 +1,58 @@
1
1
  # Existing project
2
2
 
3
+ When starting from an earlier assessment, apply [Audit handoff](audit.md#handoff-to-implementation): reuse confirmed user decisions and sufficient evidence, and check the assumptions relevant to the next consequential change. An audit recommendation does not become a platform contract or a reason to preserve a disproved design.
4
+
3
5
  Before changing code, identify the upstream URL and baseline commit, license, user journeys, actual AI/auth/storage entry points, business services, helper processes and active instruction loaders. Record a short upstream/range note in the existing App README or product document; do not create another integration state file.
4
6
 
5
- Install a selected published app-tools package and read this package skill before init. Install its matching SDK/Kit and exact nimi-coding. Follow the package's manifest version matrix and use the lockfile to pin actual resolutions. Prepare the actual pnpm/Electron Host, renderer and test/production-build commands; do not make init manufacture a test success or convert a server deployment implicitly.
7
+ For a complete App adaptation, account for the original product entry, business settings, input/output formats, recovery and editing handoffs. Restore the required original journeys on the Nimi integration. A capability demo or generated workbench is not a replacement for the existing product, and passing its sample task does not complete the App adaptation.
8
+
9
+ Match the core journeys' required inputs and outputs against the selected SDK/Kit public contracts before substantial conversion. A request option or scaffold feature name does not prove that a usable result is supported. Consult the SDK README's support boundaries and the selected resource's capabilities; distinguish missing configuration, unclear documentation, an existing-contract defect, and a required new platform capability. Use a small real protected call only where it can resolve the remaining question. If the task excludes new platform capabilities, a required missing capability makes the candidate unsuitable; report it without shrinking the product or continuing with a private inference bypass. Code-level absence of a required operation does not need a running Desktop to be reported, while an unavailable Desktop is only a launch prerequisite failure.
10
+
11
+ If the task includes Nimi expansion or repair and a required gap is found, follow [Platform gaps](platform-gaps.md), then return to the original App workflow with the delivered shared fix. Existing authorization covers that work; a missing capability is not automatically the end of adaptation.
12
+
13
+ Install a selected app-tools package and read this package skill before init. For local SDK/Kit/app-tools iteration, use the complete tarball override workflow in its README; do not wait for publication or link to the source workspace. Install its matching SDK/Kit and exact nimi-coding. Follow the package's manifest version matrix and use the lockfile to pin actual resolutions.
14
+
15
+ When adopting Kit UI, compile `@nimiplatform/kit/ui/styles.css` in the same
16
+ Tailwind 4 CSS entry as `@import 'tailwindcss'`, and include the appropriate
17
+ Kit foundation theme. A separate JavaScript CSS import can leave Kit utilities
18
+ uncompiled. Verify a long model list and its confirmation button in the real
19
+ App before treating an overflow or transparent dialog as a missing primitive;
20
+ follow the Kit README rather than adding App-local overlay overrides.
21
+
22
+ Before writing Nimi foundation wiring, use that same app-tools package to generate a minimal reference App with its own identity under `.nimi/local/`. Choose the smallest admitted feature closure that exposes the needed session, App Access, AIConfig and AI call surfaces; use `nimi-app --help` for the actual features and create options. Install the same SDK/Kit/native package combination in the reference, then run its generated setup and Desktop-supervised path. Start from its working Host, preload, renderer bridge and public client calls when integrating the existing App. Align or reuse that code; do not reconstruct these foundation pieces freely from API prose. SDK/Kit documentation defines the contracts and fills gaps in the generated implementation.
23
+
24
+ When installation and launch are in scope, establish the reference's local installed Access baseline using the acceptance guide before attributing an installed failure to App wiring. A reference failure under the same conditions points to the toolchain or environment; a passing reference makes its wiring differences with the App the next inspection target. Direct evidence of a platform defect remains actionable. Reuse current passing reference results; repeat this baseline for first integration or affected foundation changes, not ordinary business edits. Record only the necessary result in existing project notes, with no extra proof files or state ledger. Missing prerequisites pause the dependent wiring checks, not independent product restoration.
25
+
26
+ Prepare the existing App's actual pnpm/Electron Host, renderer and test/production-build commands from that integration. Preserve its framework and business code where they fit; do not make init manufacture a test success or convert a server deployment implicitly.
27
+
28
+ Prepare the actual Electron binary as well as its npm wrapper. The matched Electron 42 package exposes `install-electron` and has no package lifecycle script, so `pnpm rebuild electron` does not install its binary. Run `pnpm exec install-electron --no` from the App. The official fresh scaffold uses `postinstall: "install-electron --no"`; an adopted App owns its existing installation hooks, so add that step to the App's normal setup without discarding other postinstall work. Do not use the installer's `--help` as a read-only probe: this version does not parse that flag.
6
29
 
7
30
  For a Next.js or other existing renderer, declare the framework-neutral `electron-pnpm` build profile and a real `dev:renderer` package script serving the manifest's loopback origin. Init/sync preserve that command and the App's build owners. The official `dev` launcher still asks Desktop to supervise the Host; `build:electron` must produce `dist-electron/main.js`. Keep any required local backend under App lifecycle management. A Desktop that still requires the old exact Vite command must be upgraded before this project's real launch; do not add an empty Vite server or lose server routes to pass checks.
8
31
 
32
+ For a helper process's text/JSON pipes, make UTF-8 explicit for the initial request, callback replies and output. A frozen Python worker should decode and encode the byte streams strictly; interpreter environment settings alone may not govern its text streams. Verify non-ASCII data in the actual packaged worker and at its business consumer, such as saved configuration: a matching wire round trip can hide reciprocal decoding and encoding errors.
33
+
9
34
  If Host sources live outside the scaffold's `src-electron`, declare the actual project-relative directory in `nimi.app.yaml` as `local_development.electron.host_source_directory` (for example `electron`). The directory must exist inside the project. Desktop validates it before launch and watches it for Host rebuilds; init/sync retain it. Keep the upstream source layout instead of adding a placeholder directory.
10
35
 
11
36
  Use `pnpm exec nimi-app init --adopt --dry-run --json`, then apply without `--dry-run` once the changes fit the authorized scope. Existing nimi.app.yaml and `.nimi/config/build-profile.yaml` are the inputs. If either is absent, supply `--input <json-path>` with only `manifest` and/or `build_profile`, using their existing schemas from the app-tools README. A file under `.nimi/local/` is sufficient. Input supplied alongside an existing file must agree with it. Target paths are declarations at init; build/pack later verify real artifacts.
12
37
 
13
38
  Review the exact dependency, dev/renderer/pack script and workflow changes. Existing Host and business code, README and license remain App-owned; no fresh intent/lock is created. An unknown same-name skill/workflow or broken managed block requires a bounded cleanup, not forced takeover. Install normalized dependencies, sync/check, then run affected tests and the official App journey.
14
39
 
40
+ Make Kit's `configureNimiElectronAppHostProfile(app)` from `@nimiplatform/kit/shell/electron/host-profile` the first call of the Electron main, before any session, window or `whenReady` work, and load the rest of Kit afterwards, as the generated Host does with `await import('@nimiplatform/kit/shell/electron/main')`. It binds user data, session data and temp to the Host profile Desktop prepared under the selected Nimi data root for both development and installed launches; without that profile the Host must stop rather than use Electron's default location. Do not override those paths with a fixed `app.setPath(...)` or another `--user-data-dir`: Desktop discovers the ephemeral development CDP port from that profile's `DevToolsActivePort` file. Keep business databases and media in their declared App-owned storage, separately from the Electron profile. A `local-development-cdp-port-unavailable` error can mean that the Host exited early or moved that profile; a DevTools listening line alone does not establish successful supervision. Inspect the actual Host startup error and retry the normal launcher after fixing it. Also verify icons, preload and business-process resource paths from the built Host entry, since bundling can change their directory base.
41
+
42
+ Browser localStorage and IndexedDB are Host-profile data, not the SDK's Nimi-mediated JSON/asset partition. Development and installed launches receive separate Host profiles, and switching the Nimi data root starts from a new one, so do not promise automatic transfer of browser drafts between them. For `app-owned-os-storage`, disclose the actual stable OS roots the packaged Host uses for its own data; its Electron profile stays in the Nimi Host profile. Do not put Nimi's private Host-profile layout in an App manifest. Keep important projects in the App's declared durable storage and use its normal project export/open workflow across those separate profiles; verify restart retention before promising it.
43
+
15
44
  ## Map only the capabilities the product uses
16
45
 
46
+ For an existing Electron custom renderer protocol, compose its privileged scheme
47
+ with Kit's public `NIMI_ELECTRON_APP_ASSET_PROTOCOL_REGISTRATION` in one
48
+ `protocol.registerSchemesAsPrivileged` call before `app.ready`. Electron permits
49
+ that registration only once; do not first register the App scheme and then call
50
+ `registerNimiElectronAppAssetProtocolScheme`. The helper is for a Host without
51
+ other privileged schemes. Follow the Kit Electron README's composition example,
52
+ retain the App's exact renderer URL, and verify its installed renderer can fetch
53
+ the business API as well as use Nimi IPC. A listening worker or a passing file-URL
54
+ reference does not cover this custom-protocol path.
55
+
17
56
  - Renderer code can use `createNimiClient` with Kit's `createNimiLocalAppStandardShellSurface`. Node business work uses `registerNimiElectronAppBridge(...).services` from the same protected Host, fixed app commands and session invalidation callbacks. Consult the installed SDK/Kit public types for exact inputs.
18
57
  - Keep the App's tool loop, IDs, ordered tool results and any opaque continuity needed in subsequent turns. An SDK model step does not run business callbacks.
19
58
  - For an existing Vercel AI SDK 6 App, use the matching independent `@nimiplatform/sdk-adapter-vercel-ai` package and its Host-bound Local App factory. Read its README for image upload and complete UI message metadata; keep `useChat`/`streamText` and App-owned tools instead of rebuilding their wire protocol inside the App.
@@ -25,5 +64,11 @@ For an existing App, a generic `/api/...` route or provider `/v1/...` URL alone
25
64
  does not prove a Nimi Realm/Runtime bypass. The checker retains explicit
26
65
  protected-custody/private-import checks; review actual product call paths to
27
66
  establish Nimi AI routing. Do not edit vendor code just to remove a keyword.
67
+ App-owned login and refresh route literals are not Realm identity evidence.
68
+ Python virtual environments identified by `pyvenv.cfg` are installed dependency
69
+ trees, not App source; their bundled web clients do not establish App custody.
70
+ Custom `.next-*` output trees with Next build/routes manifests and server/static
71
+ directories (including the `dev` layout) are also excluded. A similarly named
72
+ App source directory without those output markers remains checked.
28
73
 
29
74
  Separate development instructions from product-operation guides, including other host entry files actually used by the repository. Upstream supplier examples may remain as knowledge; check the active product/agent route instead of deleting by keyword. Keep unimplemented original workflows explicit rather than counting a visible menu or retained source as completion.