@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/README.md
CHANGED
|
@@ -48,6 +48,7 @@ pnpm install
|
|
|
48
48
|
pnpm run init
|
|
49
49
|
pnpm run sync
|
|
50
50
|
pnpm run check
|
|
51
|
+
# Open a matching Nimi Home, sign in and enable Developer Mode.
|
|
51
52
|
pnpm dev
|
|
52
53
|
```
|
|
53
54
|
|
|
@@ -61,20 +62,30 @@ Set `--author` to the person or team responsible for the App and its license.
|
|
|
61
62
|
|
|
62
63
|
### Dependencies & Existing Projects
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
The supported native App host is Electron on Windows x64 and macOS arm64. Standard projects need Node, pnpm, prebuilt Kit bindings and a ready Nimi Home and Runtime. Apps own any additional Rust toolchain. Existing Tauri projects can use their original tools or explicitly migrate to Electron. Use published packages, or override them for local development with the complete archives described below—never point dependencies at a Nimi source checkout.
|
|
65
66
|
|
|
66
|
-
- **SDK and Kit Version Alignment**: Keep the SDK/Kit
|
|
67
|
-
- **
|
|
67
|
+
- **SDK and Kit Version Alignment**: Keep the SDK/Kit combination in the selected package's `nimiScaffoldVersions` and lockfile (`sync` preserves supported ranges and exact pins, and rejects an unlisted pairing). Source manifests may select numbered RC packages; a candidate version does not claim public availability. Use Kit's matching optional native package and the Runtime contract named by that combination's migration notes.
|
|
68
|
+
- **Tool and security updates**: The CLI accepts compatible patches within a bounded project range. Preview dependency changes with `pnpm exec nimi-app sync --dry-run --json`. Sync raises compatible direct Vite and Electron security floors. Select a patched version explicitly when your pin excludes the fix. After sync run `pnpm install`, `pnpm exec nimi-app check` and `pnpm audit`, then commit the updated App lockfile. An installed App follows its package and Runtime contracts independently of the authoring CLI.
|
|
69
|
+
- **Testing Local Tarballs**: During local development, select complete `.tgz` archives via `pnpm-workspace.yaml` overrides, including Kit's matching optional native package. A package version identifies fixed content: increment the candidate version for a content change, then update declarations, overrides and the lockfile with `pnpm install`. Do not overwrite an archive with different content under the same version. Record the selected native trust profile in the existing delivery notes. For local acceptance, run ordinary `check` and `build`, followed by `pack --production` when inspecting a native payload (`check --production` requires dependencies resolved from the public registry). Builds do not replace real login, source confirmation, direct connection, AI/data and recovery acceptance.
|
|
68
70
|
- **Adopting or Upgrading Projects**: Follow the [adoption guide](skills/nimi-app-lifecycle/SKILL.md) and [platform upgrade reference](skills/nimi-app-lifecycle/references/upgrade-platform.md). Preview managed changes before applying them with `init --adopt --dry-run --json` or `sync --dry-run --json`. Adoption preserves your App-owned product and Host code rather than converting an application framework; migrating from an older scaffold contract requires following the documented migration steps, not just bumping dependency versions.
|
|
69
71
|
|
|
70
72
|
---
|
|
71
73
|
|
|
72
74
|
## 3. Desktop-Supervised Development
|
|
73
75
|
|
|
76
|
+
For ordinary native App work, use a matching **installed Nimi and official Realm**. Sign in, enable Developer Mode, and run `pnpm dev` in your App repository. This works with public packages and an official account. If a compatible source Home is already running against a Realm suitable for your task, use that Home and the same App command.
|
|
77
|
+
|
|
78
|
+
When changing Runtime, SDK or Kit, source Nimi defaults to official Realm. Choose `--realm local` on the source Home launcher for Realm integration or controlled data. Native `nimi-app dev` discovers the active Home and inherits its target. From a Nimi checkout, `pnpm doctor:dev -- --host source --realm official` compares the requested and observed Runtime. Coordinate with other developers before switching a shared host. The switch ends live App sessions. Compatible versions can use the same model and engine files in sequence. See the [local development guide](https://github.com/nimiplatform/nimi/blob/main/LOCAL_DEVELOPMENT.md).
|
|
79
|
+
|
|
74
80
|
Nimi Apps run inside a Desktop-supervised Electron shell. The host provides a protected session for SDK calls without exposing Nimi credentials to the App renderer (note that this session bridge does not create an OS-level sandbox for the entire application).
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
<a id="continuing-an-existing-session"></a>
|
|
83
|
+
|
|
84
|
+
### Reopening a Development Registration
|
|
85
|
+
|
|
86
|
+
After a restart, list registrations on the current host and resume the one that owns your App data. Use the selector from the current list. The new launch establishes a fresh protected session.
|
|
87
|
+
|
|
88
|
+
If you need the App terminal to confirm a planned stop, press `Ctrl+C` there and wait for `stopped` before quitting Home. Closing Home first can disconnect the terminal before it receives the final status.
|
|
78
89
|
|
|
79
90
|
```bash
|
|
80
91
|
# List active registrations
|
|
@@ -109,7 +120,7 @@ Before publishing publicly, verify the `.nimiapp` package on your own machine:
|
|
|
109
120
|
|
|
110
121
|
Exercise the actual install, launch, and key user flows on each supported target. Passing tests or packaging alone is not enough—mark any path you have not run as `NOT-VERIFIED`.
|
|
111
122
|
|
|
112
|
-
|
|
123
|
+
Use Desktop-supervised Electron for App development and acceptance.
|
|
113
124
|
|
|
114
125
|
---
|
|
115
126
|
|
|
@@ -191,7 +202,6 @@ Configure your metadata, capability references, and storage policy in `nimi.app.
|
|
|
191
202
|
metadata:
|
|
192
203
|
summary: A short description of what your App helps people do.
|
|
193
204
|
icon: assets/app-icon.png
|
|
194
|
-
readme: README.md
|
|
195
205
|
release_notes: RELEASE_NOTES.md
|
|
196
206
|
author: Your team
|
|
197
207
|
homepage_url: https://example.com
|
|
@@ -204,6 +214,10 @@ storage_policy:
|
|
|
204
214
|
|
|
205
215
|
Scaffold `sync` preserves your author-edited `metadata`, requirement, and storage fields while continuing to validate managed identity and carrier fields.
|
|
206
216
|
|
|
217
|
+
`metadata.icon` is portable App artwork for Nimi Home and distribution information, not a pre-rendered macOS Dock tile. Keep platform padding, outer bevels and shadows out of this source; a background that belongs to the App's brand can remain. The generated Electron build preserves that artwork in `app-icon.png`, derives a separate `app-icon-macos.png` with a light neutral rounded-square plate and transparent outer margin, and packages the same macOS composition as ICNS with 1×/2× representations from 16 through 1024 pixels. Windows ICO preserves the source silhouette and transparency, with 15 sizes from 16 through 256 pixels, including intermediate high-DPI taskbar sizes. Development uses the platform-specific window/Dock resource; production packaging includes those runtime resources and embeds ICNS or ICO before signing. Custom repository-relative source paths are supported. Rebuild after changing the image or its declaration. Development without artwork remains available with an explicit warning; invalid artwork fails the build, and production requires valid artwork. Removing or invalidating an image clears its old derived icons.
|
|
218
|
+
|
|
219
|
+
Windows taskbar identity is `ai.nimi.dev.apps.<app_id>` for the generated development Host and `ai.nimi.apps.<app_id>` for a production bundle. Separate namespaces also avoid collisions with an App whose canonical ID ends in `.dev`. This does not change the canonical App ID or Runtime registration. Existing scaffold projects receive this managed Host/build logic through `sync`; adopted App-owned Hosts must implement the same behavior in their own code.
|
|
220
|
+
|
|
207
221
|
### Field & Asset Requirements
|
|
208
222
|
All `metadata` file paths are relative to the App repository root:
|
|
209
223
|
|
|
@@ -212,12 +226,23 @@ All `metadata` file paths are relative to the App repository root:
|
|
|
212
226
|
| **Name & Summary** | Up to **120 characters** for the App name and **280 characters** for `metadata.summary`. |
|
|
213
227
|
| **App Icon (`icon`)** | Required. Complete static PNG, square (`128–1024` pixels), max **512 KiB**, and not fully transparent. The scaffold does not supply finished artwork (the legacy `1×1` scaffold native icon is not valid distribution artwork). |
|
|
214
228
|
| **Root `LICENSE` & `package.json.license`** | Required (`LICENSE` max **128 KiB**). `package.json.license` provides the explicit license identifier; setting an identifier does not turn a private license into an open-source Registry license. |
|
|
215
|
-
| **
|
|
229
|
+
| **App introduction (`NIMI_APP.md`)** | Required at the repository root for every App, including local/private packages. Nonempty UTF-8 regular file, at most **96 KiB**. Home reads this file; `metadata.readme` and README fallback are not supported. |
|
|
230
|
+
| **Version Notes (`release_notes`)** | Optional for local/private packages, required for Registry admission; at most **32 KiB**. |
|
|
216
231
|
| **Author, Homepage & Support URLs** | Optional claims for local/private imports. Public Registry admission enforces its own independent public-source, open-source license, and support requirements. |
|
|
217
232
|
| **Capability & Feature Refs** | Use the canonical requirement references your App needs; an explicitly empty list (`[]`) is valid. |
|
|
218
233
|
| **Storage Policy (`storage_policy`)** | Declare `kind: nimi-mediated-default` for Nimi-mediated storage. Apps managing their own OS storage must declare `kind: app-owned-os-storage` along with `os_storage_disclosure` entries specifying `path_pattern`, `purpose`, and `expected_size_band` (these are disclosures only, not instructions for Nimi to delete files). |
|
|
219
234
|
| **Safety Declaration (`safety_profile`)** | When declared in `nimi.app.yaml`, included in `app-info.json` (see the lifecycle skill's safety-declaration reference). An undeclared `safety_profile` stays absent and blocks nothing locally; the Registry's current admission policy determines whether public submissions require it (App Tools does not fetch Registry policy during local checks). |
|
|
220
235
|
|
|
236
|
+
### Write the App introduction
|
|
237
|
+
|
|
238
|
+
`NIMI_APP.md` is the single Home introduction source. Write for the App's actual users: what it helps them do, how to start the main task, required configuration, relevant data handling and current limitations, and where to get help. Developer tools may retain the technical precision their users need. Describe available behavior, not roadmap promises or inferred acceptance.
|
|
239
|
+
|
|
240
|
+
Keep repository setup, architecture, build/release commands and engineering acceptance logs in `README.md` or developer documentation. Use self-contained Markdown: Home displays image alt text and only opens absolute HTTP(S) links; relative file links and anchors are not navigable. Keep necessary instructions in the introduction itself.
|
|
241
|
+
|
|
242
|
+
`create` supplies an honest starter introduction. Replace its unfinished-product notice with the App's actual user content as the product develops. `NIMI_APP.md` is App-owned: `sync` neither overwrites nor recreates it. Existing Apps must author this file and remove `metadata.readme` before checking; there is no automatic document migration. `check` and `pack` validate the file, not the truth or quality of its prose. Review it alongside the real user journey.
|
|
243
|
+
|
|
244
|
+
Packaging copies its exact text into the existing `app-info.json` `readme_markdown` field. Installed and Catalog entries display their exact release snapshot; changing source documentation does not rewrite an immutable release.
|
|
245
|
+
|
|
221
246
|
### Package v2 Output & Sidecar Verification
|
|
222
247
|
`pack` writes the `nimi.app-package/v2` format and emits the exact embedded `app-info.json` bytes as a sidecar file named `<app_id>-<version>-<target_id>.app-info.json` alongside the `.nimiapp` bundle and `.target.json`. Aggregate verification checks both files and confirms they match the embedded document byte-for-byte.
|
|
223
248
|
|
|
@@ -228,3 +253,35 @@ During release, the managed GitHub Actions workflow uploads this sidecar to the
|
|
|
228
253
|
## License
|
|
229
254
|
|
|
230
255
|
Licensed under [Apache-2.0](../licenses/Apache-2.0.txt).
|
|
256
|
+
|
|
257
|
+
## Web development (current source build)
|
|
258
|
+
|
|
259
|
+
The same CLI supports `create --platform web`, Web `init/sync/check/test/build`, existing-site `init --adopt`, and `dev --platform web`. `standalone` is still the repository topology. Web `--features all` currently resolves to `studio-create` (text, streaming chat and embeddings); other feature selections fail explicitly until their Web carrier is admitted. Mobile generation remains outside this command. For managed Web hosting, build a static release with the App's public slug and prepare it for separate human Registry admission.
|
|
260
|
+
|
|
261
|
+
Use matching complete SDK, Kit and App Tools source archives until the new entries are published; a published package with the same numeric version may not contain this source iteration. No source-directory dependency links are required.
|
|
262
|
+
|
|
263
|
+
The current workbench uses account-owned prompt drafts with an asynchronous `promptDraft` projection and independent history record documents. For existing unreleased generated prototypes, update the App-owned AI Studio capability source together with the generated host adapters. `sync` intentionally preserves `src/capabilities` and does not migrate or overwrite that business source; running `check` alone is not a substitute for the project's typecheck/build after this source update.
|
|
264
|
+
|
|
265
|
+
The generated `nimi.app.yaml` has `platform: web`. Its `local_development.web` uses official Realm and leaves `origin`, `redirect_uri` and `client_id` empty until you configure the exact source registered through the public Registry. Configure them before init/check/dev. Choose an HTTPS origin dedicated to this App; a generated port hash or different client id cannot isolate scripts on the same browser origin. Put browser-trusted `NIMI_WEB_TLS_KEY` and `NIMI_WEB_TLS_CERT` file paths in `.env.local`. Source review and first PC Home confirmation remain required and do not require a native package release. The CLI does not approve the source.
|
|
266
|
+
|
|
267
|
+
For local Realm integration, add `local_development.web.local` with that environment's exact source fields and use `nimi-app dev --platform web --realm local`. The App-owned `command` stays on `web`; source fields survive sync. Default official values come from the package's public Realm profile. A local profile is explicit and never a fallback from an unavailable official service.
|
|
268
|
+
|
|
269
|
+
`@nimiplatform/app-tools/web` exports the Node-only `nimiWebViteConfig` helper. Its development proxy only forwards scoped identity and SDP coordination routes and strips official cookies. AI, files, audio and results use the browser-to-PC connection. Built static files need a separately configured production origin and bounded coordination route; the Vite dev server is not production hosting.
|
|
270
|
+
|
|
271
|
+
For a Nimi-hosted release declare `public_slug` in `nimi.app.yaml`, use the existing Web production build, and set `NIMI_WEB_VERSION` to the protected Web release version. App Tools generates the exact `https://<slug>.nimi.xyz` origin, root callback, public client identity, official account URL and Realm environment together with `nimi-web-bundle.json`. It places compiled assets under `/_releases/<version>/assets/`. Run `nimi-app sync` to install the managed `.github/workflows/nimi-web-release.yml`. The protected `web-v*` workflow uses `build:web:release` or `build:release` and sets `NIMI_WEB_ARCHIVE` so the same build writes the immutable candidate ZIP. Publish the static directory as a stored ZIP using `packHostedWeb(directory, outputFile)` from `@nimiplatform/app-tools/web/release`. App-authored Pages control files are excluded. Executable public assets should be imported into the build or explicitly referenced under their release path.
|
|
272
|
+
|
|
273
|
+
For an independently registered release build, use `pnpm build:release` in a generated Web App or pass `release: true` to `nimiWebViteConfig` from the App's build config. Set `NIMI_WEB_ORIGIN`, `NIMI_WEB_REDIRECT_URI`, `NIMI_WEB_CLIENT_ID`, `NIMI_WEB_REALM_ENVIRONMENT_ID`, and `NIMI_WEB_OFFICIAL_WEB_URL` to the deployment values. The build uses the App ID from `nimi.app.yaml` and the release inputs for its source and login. Serve the coordination allowlist defined by `isWebCoordinationPath` on that App origin, forwarding it to the matching Realm without cookies. Source admission and cookie isolation are deployment requirements.
|
|
274
|
+
|
|
275
|
+
A Desktop project can also declare an App-owned `local_development.web` entry and use `dev --platform web`. Init/sync preserve it and check validates both entries. This does not change the project's managed platform, native feature selection or build profile: its Web renderer, tests and build remain App-owned. Update retained capability modules alongside the selected tool package when their generated Host interface changes; sync deliberately preserves those App-owned files.
|
|
276
|
+
|
|
277
|
+
For an existing website, keep its product entry and actual commands. Use a `web-pnpm` build profile with the real `test_command` / `build_command`, and a `web` target describing the browser output directory and `payload/index.html` entry. The identity-free configuration does not replace a site's own account system. SDK current-user context must follow its verified account session; never use an operator account or a front-end asserted Nimi account ID as another user's identity.
|
|
278
|
+
|
|
279
|
+
Native-only guidance such as Electron installation, native signatures and `pack --production` above does not apply to the Web carrier. The initial generated test command typechecks the project; App business tests and real task acceptance belong to the application iteration.
|
|
280
|
+
|
|
281
|
+
The current Web bootstrap uses Kit `auth/app/web` plus its shared Provider, account control and access gate. The old `core/remote-app-session` entry was removed in this unreleased hard cut. Existing App-owned Web entries must be updated explicitly with their selected SDK/Kit source package combination; sync does not take ownership of the application entry. Generated business callbacks retain their captured client; identity-only views use their own identity lifetime rather than a Runtime connection key.
|
|
282
|
+
|
|
283
|
+
### Existing mobile development entry
|
|
284
|
+
|
|
285
|
+
An existing App can add `local_development.mobile.command: pnpm run dev:android` to `nimi.app.yaml`, define that real App-owned script in `package.json`, and select it with `nimi-app dev --platform mobile`. Desktop shell, registration selectors and Desktop CDP flags do not apply. App Tools delegates the native command; it does not create a local Home session or native source qualification. The additional command survives supported init/sync updates as App-owned configuration.
|
|
286
|
+
|
|
287
|
+
The initial reference is Zhiyu's Android Capacitor container using Kit `auth/app/mobile`. Ordinary debug development uses official Realm with a registered Android App Link, the actual debug package/signature and verified HTTPS association; it does not require a release APK. Its project and Android build/device tools remain prerequisites. `--realm local` explicitly enables the existing non-production `android-dev-scheme` path where the local source is admitted. Source admission and Home consent stay with their owners. This entry does not add mobile scaffolding, APK publication or store release. A child process exiting successfully is not Runtime acceptance. Node build configuration may consume `@nimiplatform/app-tools/development` to resolve the same selected Realm.
|
package/bin/nimi-app.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
packApp,
|
|
11
11
|
resolveAppCreateInput,
|
|
12
12
|
resolveAppCreatePlan,
|
|
13
|
-
|
|
13
|
+
runAppDevelopment,
|
|
14
14
|
syncApp,
|
|
15
15
|
testApp,
|
|
16
16
|
} from '../lib/index.mjs';
|
|
@@ -21,9 +21,9 @@ import { createInterface } from 'node:readline/promises';
|
|
|
21
21
|
function parseArgs(argv) {
|
|
22
22
|
const [command = '', ...rest] = argv;
|
|
23
23
|
const values = {
|
|
24
|
-
dir: '', profile: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
24
|
+
dir: '', profile: '', platform: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
25
25
|
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '', newRegistration: false, target: '', aggregate: false, production: false, json: false,
|
|
26
|
-
adopt: false, dryRun: false, input: '',
|
|
26
|
+
adopt: false, dryRun: false, input: '', realm: '',
|
|
27
27
|
};
|
|
28
28
|
const seen = new Set();
|
|
29
29
|
const readValue = (index, flag, key, preserve = false) => {
|
|
@@ -39,6 +39,11 @@ function parseArgs(argv) {
|
|
|
39
39
|
return index + 1;
|
|
40
40
|
};
|
|
41
41
|
for (let index = 0; index < rest.length; index += 1) {
|
|
42
|
+
if (rest[index] === '--realm') {
|
|
43
|
+
if (command !== 'dev') throw new Error(`${rest[index]} is available only for dev.`);
|
|
44
|
+
index = readValue(index, rest[index], rest[index].slice(2));
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
42
47
|
if (rest[index] === '--input') {
|
|
43
48
|
index = readValue(index, '--input', 'input');
|
|
44
49
|
continue;
|
|
@@ -81,6 +86,10 @@ function parseArgs(argv) {
|
|
|
81
86
|
index = readValue(index, '--author', 'author', true);
|
|
82
87
|
continue;
|
|
83
88
|
}
|
|
89
|
+
if (rest[index] === '--platform') {
|
|
90
|
+
index = readValue(index, '--platform', 'platform');
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
84
93
|
if (rest[index] === '--features') {
|
|
85
94
|
index = readValue(index, '--features', 'features');
|
|
86
95
|
continue;
|
|
@@ -148,11 +157,11 @@ function parseArgs(argv) {
|
|
|
148
157
|
|
|
149
158
|
function assertCommandOptions(command, providedOptions) {
|
|
150
159
|
const allowed = {
|
|
151
|
-
create: new Set(['dir', 'profile', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
|
|
160
|
+
create: new Set(['dir', 'profile', 'platform', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
|
|
152
161
|
init: new Set(['dir', 'json', 'adopt', 'input', 'dryRun']),
|
|
153
162
|
sync: new Set(['dir', 'json', 'dryRun']),
|
|
154
163
|
check: new Set(['dir', 'json', 'production']),
|
|
155
|
-
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume', 'newRegistration']),
|
|
164
|
+
dev: new Set(['dir', 'platform', 'shell', 'realm', 'cdpPort', 'noCdp', 'listRegistrations', 'resume', 'newRegistration']),
|
|
156
165
|
test: new Set(['dir', 'json']),
|
|
157
166
|
build: new Set(['dir', 'target', 'production', 'json']),
|
|
158
167
|
pack: new Set(['dir', 'target', 'aggregate', 'production', 'json']),
|
|
@@ -179,11 +188,11 @@ function printUsage() {
|
|
|
179
188
|
'Nimi App developer tools',
|
|
180
189
|
'',
|
|
181
190
|
'Usage:',
|
|
182
|
-
' nimi-app create [--dir path] [--profile standalone] [--features admitted-ids|all] [--app-id dotted.id] [--version semver] [--title title] [--package-name name] [--author person-or-team] [--json]',
|
|
191
|
+
' nimi-app create [--dir path] [--profile standalone] [--platform desktop|web] [--features admitted-ids|all] [--app-id dotted.id] [--version semver] [--title title] [--package-name name] [--author person-or-team] [--json]',
|
|
183
192
|
' nimi-app init [--adopt [--input json-path]] [--dry-run] [--dir path] [--json]',
|
|
184
193
|
' nimi-app sync [--dry-run] [--dir path] [--json]',
|
|
185
194
|
' nimi-app check [--dir path] [--production] [--json]',
|
|
186
|
-
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector> | --new-registration] [--cdp-port 1024..65535 | --no-cdp]',
|
|
195
|
+
' nimi-app dev [--dir path] [--platform desktop|web|mobile] [--realm official|local (web/mobile)] [--shell electron] [--list-registrations | --resume <selector> | --new-registration] [--cdp-port 1024..65535 | --no-cdp]',
|
|
187
196
|
' nimi-app test [--dir path] [--json]',
|
|
188
197
|
' nimi-app build [--dir path] [--target target-id] [--production] [--json]',
|
|
189
198
|
' nimi-app pack [--dir path] (--target target-id [--production] | --aggregate) [--json]',
|
|
@@ -197,6 +206,7 @@ function printUsage() {
|
|
|
197
206
|
'',
|
|
198
207
|
'Current module registry:',
|
|
199
208
|
` Admitted features: ${featureList(admitted)}`,
|
|
209
|
+
` Web features: ${featureList(admitted.filter(entry => entry.carriers.includes('web')))}`,
|
|
200
210
|
` Candidate features (not public-selectable): ${featureList(candidates)}`,
|
|
201
211
|
` Internal modules (dependency-only): ${internalList}`,
|
|
202
212
|
admitted.length > 0
|
|
@@ -210,6 +220,7 @@ function printUsage() {
|
|
|
210
220
|
' AI features resolve the internal ai-studio-core once; it cannot be selected directly.',
|
|
211
221
|
' Generated Apps exclude Lab-only Settings/account, App Access diagnostics, Realm/Agent probes, World Tour, and native/diagnostic surfaces.',
|
|
212
222
|
'',
|
|
223
|
+
'Native desktop support: Electron on Windows x64 and macOS arm64. Standard builds use Node and pnpm with prebuilt Kit bindings.',
|
|
213
224
|
'Third-party topology:',
|
|
214
225
|
' standalone: any empty target directory using public dependency version declarations.',
|
|
215
226
|
' Development may resolve complete local npm tarballs through documented overrides; no additional create mode is needed.',
|
|
@@ -224,7 +235,7 @@ function printUsage() {
|
|
|
224
235
|
' create -> dependency install -> init -> sync -> check -> dev/test/build -> pack',
|
|
225
236
|
' Run init and later commands only after dependency installation.',
|
|
226
237
|
` Before init, read the packaged lifecycle skill: ${LIFECYCLE_SKILL_PATH}`,
|
|
227
|
-
' Existing adoption requires pnpm
|
|
238
|
+
' Existing adoption requires pnpm and real App-owned dev/build/test inputs: use a supervised Electron Host for Desktop, or the Web carrier and an admitted HTTPS source.',
|
|
228
239
|
' Use electron-pnpm for an existing renderer framework; no fresh scaffold lock is created.',
|
|
229
240
|
'',
|
|
230
241
|
'Development CDP:',
|
|
@@ -311,12 +322,14 @@ try {
|
|
|
311
322
|
command,
|
|
312
323
|
dir,
|
|
313
324
|
profile,
|
|
325
|
+
platform,
|
|
314
326
|
appId,
|
|
315
327
|
version,
|
|
316
328
|
title,
|
|
317
329
|
packageName,
|
|
318
330
|
author,
|
|
319
331
|
features: parsedFeatures,
|
|
332
|
+
realm,
|
|
320
333
|
shell,
|
|
321
334
|
cdpPort,
|
|
322
335
|
noCdp,
|
|
@@ -351,6 +364,7 @@ try {
|
|
|
351
364
|
const rawInput = {
|
|
352
365
|
dir,
|
|
353
366
|
profile,
|
|
367
|
+
platform,
|
|
354
368
|
appId,
|
|
355
369
|
version,
|
|
356
370
|
title,
|
|
@@ -419,9 +433,11 @@ try {
|
|
|
419
433
|
}
|
|
420
434
|
break;
|
|
421
435
|
case 'dev':
|
|
422
|
-
await
|
|
436
|
+
await runAppDevelopment(process.cwd(), {
|
|
437
|
+
realm,
|
|
423
438
|
dir,
|
|
424
|
-
shell
|
|
439
|
+
shell,
|
|
440
|
+
platform,
|
|
425
441
|
cdpPort,
|
|
426
442
|
noCdp,
|
|
427
443
|
listRegistrations,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
2
|
+
import { gt, intersects, minVersion, satisfies, subset, valid, validRange } from 'semver';
|
|
2
3
|
|
|
3
4
|
// The manifest names the tested candidate/default combination. Explicitly selected
|
|
4
5
|
// development pairs use the same current Host, never an older template.
|
|
@@ -9,24 +10,45 @@ const SDK = '@nimiplatform/sdk';
|
|
|
9
10
|
const KIT = '@nimiplatform/kit';
|
|
10
11
|
|
|
11
12
|
export const ADDITIONAL_DEPENDENCY_COMBINATIONS = Object.freeze([
|
|
12
|
-
Object.freeze({ sdkVersion: '^0.
|
|
13
|
-
Object.freeze({ sdkVersion: '^0.
|
|
14
|
-
Object.freeze({ sdkVersion: '^0.
|
|
15
|
-
Object.freeze({ sdkVersion: '^0.
|
|
16
|
-
Object.freeze({ sdkVersion: '^0.
|
|
17
|
-
Object.freeze({ sdkVersion: '^0.
|
|
18
|
-
Object.freeze({ sdkVersion: '^0.
|
|
13
|
+
Object.freeze({ sdkVersion: '^0.24.0-rc.7', kitVersion: '^0.24.0-rc.11', source: 'existing' }),
|
|
14
|
+
Object.freeze({ sdkVersion: '^0.24.0-rc.2', kitVersion: '^0.24.0-rc.1', source: 'existing' }),
|
|
15
|
+
Object.freeze({ sdkVersion: '^0.22.2', kitVersion: '^0.22.1', source: 'existing' }),
|
|
16
|
+
Object.freeze({ sdkVersion: '^0.22.1', kitVersion: '^0.22.1', source: 'existing' }),
|
|
17
|
+
Object.freeze({ sdkVersion: '^0.22.1', kitVersion: '^0.22.0', source: 'existing' }),
|
|
18
|
+
Object.freeze({ sdkVersion: '^0.22.0', kitVersion: '^0.22.0', source: 'existing' }),
|
|
19
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.21.0', source: 'existing' }),
|
|
20
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.20.0', source: 'existing' }),
|
|
21
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.19.0', source: 'existing' }),
|
|
22
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.18.1', source: 'existing' }),
|
|
23
|
+
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.18.0', source: 'existing' }),
|
|
24
|
+
Object.freeze({ sdkVersion: '^0.20.0', kitVersion: '^0.17.0', source: 'existing' }),
|
|
25
|
+
Object.freeze({ sdkVersion: '^0.18.1', kitVersion: '^0.15.3', source: 'existing' }),
|
|
26
|
+
Object.freeze({ sdkVersion: '^0.19.0', kitVersion: '^0.16.0', source: 'existing' }),
|
|
19
27
|
]);
|
|
20
28
|
|
|
21
|
-
function
|
|
22
|
-
|
|
29
|
+
export function isLocalDependencySpec(value) {
|
|
30
|
+
const normalized = typeof value === 'string' ? value.trim() : '';
|
|
31
|
+
return /^(?:file|link|patch|path|portal|workspace):/iu.test(normalized)
|
|
32
|
+
|| /^(?:\.{1,2}[\\/]|~[\\/]|[A-Za-z]:[\\/]|\\\\)/u.test(normalized)
|
|
33
|
+
|| /\.(?:tar\.gz|tgz)(?:[?#].*)?$/iu.test(normalized);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// The released CLI may be a later patch selected by the project's bounded range.
|
|
37
|
+
export function appToolsDeclaration(declared, toolRange) {
|
|
38
|
+
if (declared === toolRange) return declared;
|
|
39
|
+
const minimum = typeof declared === 'string' && validRange(declared) && minVersion(declared);
|
|
40
|
+
const running = minVersion(toolRange);
|
|
41
|
+
if (minimum && running && gt(minimum, running)) {
|
|
42
|
+
throw new Error(`This App requires app-tools ${declared}. Install the selected tool before running init, sync or check.`);
|
|
43
|
+
}
|
|
44
|
+
return minimum && running && (valid(declared) || subset(declared, '^' + minimum.version)) && satisfies(running, declared)
|
|
45
|
+
? declared : toolRange;
|
|
23
46
|
}
|
|
24
47
|
|
|
25
48
|
export function defaultDependencyCombination(versions) {
|
|
26
49
|
return Object.freeze({
|
|
27
50
|
sdkVersion: versions.sdkVersion,
|
|
28
51
|
kitVersion: versions.kitVersion,
|
|
29
|
-
nimiShellTauriVersion: versions.nimiShellTauriVersion,
|
|
30
52
|
source: 'default',
|
|
31
53
|
});
|
|
32
54
|
}
|
|
@@ -35,18 +57,46 @@ function describe(combination) {
|
|
|
35
57
|
return `${SDK}@${combination.sdkVersion} with ${KIT}@${combination.kitVersion}`;
|
|
36
58
|
}
|
|
37
59
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
// semver's range intersection can reject a prerelease pin that satisfies the range.
|
|
61
|
+
function selectionsOverlap(recorded, selected) {
|
|
62
|
+
const selectedPin = valid(validRange(selected));
|
|
63
|
+
if (selectedPin) return satisfies(selectedPin, recorded);
|
|
64
|
+
const recordedPin = valid(validRange(recorded));
|
|
65
|
+
if (recordedPin) return satisfies(recordedPin, selected);
|
|
66
|
+
return intersects(recorded, selected);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function matchesRecordedHostDependencies(npm, combination) {
|
|
70
|
+
return selectionsOverlap(npm[SDK], combination.sdkVersion)
|
|
71
|
+
&& selectionsOverlap(npm[KIT], combination.kitVersion);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Some verified pairs share a minor line. Match each
|
|
75
|
+
// declaration to its most specific admitted floor, then validate the pair.
|
|
76
|
+
function matchingLine(spec, lines) {
|
|
77
|
+
const range = typeof spec === 'string' && validRange(spec);
|
|
78
|
+
if (!range || !minVersion(range)) return undefined;
|
|
79
|
+
const pin = valid(range);
|
|
80
|
+
let best;
|
|
81
|
+
for (const line of new Set(lines)) {
|
|
82
|
+
const admitted = pin ? satisfies(pin, line) : subset(range, line);
|
|
83
|
+
if (admitted && (!best || gt(minVersion(line), minVersion(best)))) best = line;
|
|
84
|
+
}
|
|
85
|
+
return best;
|
|
86
|
+
}
|
|
87
|
+
|
|
42
88
|
export function resolveDependencyCombination(packageJson, versions) {
|
|
43
89
|
const fallback = defaultDependencyCombination(versions);
|
|
44
90
|
const section = packageJson?.dependencies;
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
91
|
+
const declaredSdk = section?.[SDK];
|
|
92
|
+
const declaredKit = section?.[KIT];
|
|
93
|
+
const sdk = declaredSdk === undefined || isLocalDependencySpec(declaredSdk) ? fallback.sdkVersion : declaredSdk;
|
|
94
|
+
const kit = declaredKit === undefined || isLocalDependencySpec(declaredKit) ? fallback.kitVersion : declaredKit;
|
|
48
95
|
if (sdk === fallback.sdkVersion && kit === fallback.kitVersion) return fallback;
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
96
|
+
const pairs = [fallback, ...ADDITIONAL_DEPENDENCY_COMBINATIONS];
|
|
97
|
+
const sdkLine = matchingLine(sdk, pairs.map(pair => pair.sdkVersion));
|
|
98
|
+
const kitLine = matchingLine(kit, pairs.map(pair => pair.kitVersion));
|
|
99
|
+
const selected = pairs.find(pair => pair.sdkVersion === sdkLine && pair.kitVersion === kitLine);
|
|
100
|
+
if (selected) return { ...selected, sdkVersion: sdk, kitVersion: kit };
|
|
101
|
+
throw new Error(`Unsupported SDK/Kit combination: ${describe({ sdkVersion: sdk, kitVersion: kit })}. Select a verified pair explicitly before sync. Tool default: ${describe(fallback)}.`);
|
|
52
102
|
}
|