@nimiplatform/app-tools 0.14.0 → 0.16.0-rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -24
- package/bin/nimi-app.mjs +35 -15
- package/lib/app-access-declaration.mjs +3 -0
- package/lib/app-dependency-combinations.mjs +70 -24
- package/lib/app-doctor-update.mjs +97 -39
- package/lib/app-host-support.mjs +6 -0
- package/lib/app-identifiers.mjs +27 -0
- package/lib/app-info.mjs +292 -1
- package/lib/app-lifecycle-guidance.mjs +1 -1
- package/lib/app-pack.mjs +65 -39
- package/lib/app-project-lifecycle.mjs +149 -244
- package/lib/app-scaffold-capabilities.mjs +13 -109
- package/lib/app-scaffold-profiles.mjs +81 -115
- package/lib/app-scaffold.mjs +74 -166
- package/lib/app-toolchain-updates.mjs +45 -0
- package/lib/canonical-capability-ids.generated.mjs +2 -0
- package/lib/development-environment.d.mts +10 -0
- package/lib/development-environment.mjs +39 -0
- package/lib/hosted-web-release.mjs +98 -0
- package/lib/index.mjs +43 -3
- package/lib/mobile-development.mjs +19 -0
- package/lib/realm-environments.generated.mjs +5 -0
- package/lib/storefront-media.mjs +154 -0
- package/lib/web-coordination.mjs +59 -0
- package/lib/web-development.d.mts +23 -0
- package/lib/web-development.mjs +118 -0
- package/lib/web-scaffold.mjs +125 -0
- package/package.json +33 -21
- package/scripts/dev-shell.mjs +4 -1
- package/scripts/sync-scaffold-versions.mjs +0 -2
- package/skills/nimi-app-lifecycle/SKILL.md +3 -1
- package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
- package/skills/nimi-app-lifecycle/references/adapt.md +5 -3
- package/skills/nimi-app-lifecycle/references/audit.md +3 -2
- package/skills/nimi-app-lifecycle/references/create.md +6 -2
- package/skills/nimi-app-lifecycle/references/release.md +10 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +12 -7
- package/templates/app-source/src/ai-studio-core/ai-studio-core.css +87 -52
- package/templates/app-source/src/ai-studio-core/history-policy.ts +45 -11
- package/templates/app-source/src/ai-studio-core/history.ts +22 -11
- package/templates/app-source/src/ai-studio-core/host-context.tsx +9 -4
- package/templates/app-source/src/ai-studio-core/index.ts +2 -0
- package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -5
- package/templates/app-source/src/ai-studio-core/job-recovery.ts +2 -2
- package/templates/app-source/src/ai-studio-core/messages/en.json +73 -19
- package/templates/app-source/src/ai-studio-core/messages/zh.json +73 -19
- package/templates/app-source/src/ai-studio-core/module-registration.ts +1 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +30 -5
- package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +12 -6
- package/templates/app-source/src/ai-studio-core/parameters.ts +4 -0
- package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +42 -0
- package/templates/app-source/src/ai-studio-core/runtime-types.ts +9 -2
- package/templates/app-source/src/ai-studio-core/runtime.ts +8 -4
- package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +98 -90
- package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +1 -1
- package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +205 -48
- package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +1 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +36 -14
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +96 -75
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +59 -16
- package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +2 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +12 -21
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +2 -2
- package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +3 -3
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +158 -76
- package/templates/app-source/src/ai-studio-core/workspace.tsx +49 -22
- package/templates/app-source/src/product-modules/agent-center/index.tsx +2 -3
- package/templates/app-source/src/product-modules/agent-conversation/index.tsx +2 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -5
- package/templates/app-source/src/studio-modules/studio-media/messages/en.json +59 -8
- package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +68 -8
- package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +2 -1
- package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +271 -83
- package/templates/app-source/src/studio-modules/studio-media/parameters.ts +120 -2
- package/templates/app-source/src/studio-modules/studio-media/registration.ts +1 -0
- package/templates/app-source/src/studio-modules/studio-media/runtime.ts +24 -14
- package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +1 -1
- package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +46 -23
- package/templates/app-source/src/studio-modules/studio-voice/registration.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +2 -2
- package/templates/app-source/src/workbench-core/workbench-core.tsx +27 -3
- package/templates/default-starter/AGENTS.md +3 -3
- package/templates/default-starter/README.md +1 -1
- package/templates/default-starter/src/shell/App.tsx +6 -18
- package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
- package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
- package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
- package/templates/default-starter.manifest.json +0 -16
- package/templates/hosted-web-release.yml +98 -0
- package/templates/default-starter/src-tauri/Cargo.toml +0 -17
- package/templates/default-starter/src-tauri/build.rs +0 -32
- package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
- package/templates/default-starter/src-tauri/tauri.conf.json +0 -26
package/README.md
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
# @nimiplatform/app-tools
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`@nimiplatform/app-tools` manages the entire application lifecycle—from project scaffolding and dependency synchronization to Desktop-supervised development, test orchestration, and deterministic `.nimiapp` distribution packaging.
|
|
6
|
-
|
|
7
|
-
---
|
|
3
|
+
Use App Tools to create, test and ship native desktop and Web apps. Desktop apps run under Nimi Home during development and ship as `.nimiapp` bundles. Web apps run at their own HTTPS origin and build to static files. You can host those files yourself or submit a candidate for Nimi hosting.
|
|
8
4
|
|
|
9
5
|
## 1. The Application Lifecycle
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
Create a project, install its dependencies with your package manager and run `init`. For Web, fill in the registered origin, callback and client ID before initialization. Both carriers support `sync`, `check`, `dev`, `test` and `build`. Desktop projects use `pack` to prepare the built app for distribution.
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
create ➔ install ➔ init ➔ sync ➔ check ➔ dev / test / build ➔ pack
|
|
15
|
-
```
|
|
9
|
+
Choose one product `app_id` for all its carriers. For a new PC + Web product, bootstrap the desktop scaffold with the Web-capable App Tools version in the [Web guide](https://docs.nimi.ai/start/connect-web-app), then add the browser entry to the same project. Use that guide directly for a Web-only project. After installation, run the project-local CLI with `pnpm exec nimi-app`. The [upgrade guide](skills/nimi-app-lifecycle/references/upgrade-platform.md) covers existing Apps and changes to the SDK/Kit pair.
|
|
16
10
|
|
|
17
11
|
| Command | Role |
|
|
18
12
|
| :--- | :--- |
|
|
19
|
-
| **`create`** | Scaffolds a standalone project with reverse-domain App ID, manifest declarations, and build workflows. |
|
|
20
|
-
| **`init`** | Materializes managed files and lifecycle guidance after installation
|
|
13
|
+
| **`create`** | Scaffolds a standalone native desktop or Web project with a reverse-domain App ID, manifest declarations, and build workflows. |
|
|
14
|
+
| **`init`** | Materializes managed files and lifecycle guidance after dependency installation. Fresh scaffolds also receive a scaffold lock. |
|
|
21
15
|
| **`sync`** | Refreshes managed build configs, CI workflows, and glue code without touching your business logic. |
|
|
22
|
-
| **`check`** | Validates scaffold, package constraints, and declared inputs. Run
|
|
23
|
-
| **`dev`** | Launches
|
|
24
|
-
| **`test`** | Executes the test suite declared in
|
|
25
|
-
| **`build`** | Compiles production binaries and assets for
|
|
26
|
-
| **`pack`** | Deterministically packages verified binaries and metadata into an immutable `.nimiapp` bundle. |
|
|
16
|
+
| **`check`** | Validates the scaffold, package constraints, and declared inputs. Run app-owned typechecks separately. |
|
|
17
|
+
| **`dev`** | Launches native desktop apps in the Desktop-supervised Electron shell with a protected session bridge, or starts a Web app's own HTTPS dev entrypoint. |
|
|
18
|
+
| **`test`** | Executes the test suite declared in `.nimi/config/build-profile.yaml`. |
|
|
19
|
+
| **`build`** | Compiles production binaries and assets for native desktop targets (macOS / Windows), or outputs static assets for Web apps. |
|
|
20
|
+
| **`pack`** | Native desktop only. Deterministically packages verified binaries and metadata into an immutable `.nimiapp` bundle. |
|
|
27
21
|
|
|
28
22
|
---
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
<a id="2-quickstart-creating-a-new-app"></a>
|
|
25
|
+
|
|
26
|
+
## 2. Quickstart: Creating a Desktop App
|
|
31
27
|
|
|
32
28
|
Run the interactive creator or pass parameters directly:
|
|
33
29
|
|
|
@@ -48,6 +44,7 @@ pnpm install
|
|
|
48
44
|
pnpm run init
|
|
49
45
|
pnpm run sync
|
|
50
46
|
pnpm run check
|
|
47
|
+
# Open a matching Nimi Home, sign in and enable Developer Mode.
|
|
51
48
|
pnpm dev
|
|
52
49
|
```
|
|
53
50
|
|
|
@@ -61,20 +58,30 @@ Set `--author` to the person or team responsible for the App and its license.
|
|
|
61
58
|
|
|
62
59
|
### Dependencies & Existing Projects
|
|
63
60
|
|
|
64
|
-
|
|
61
|
+
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
62
|
|
|
66
|
-
- **SDK and Kit Version Alignment**: Keep the SDK/Kit
|
|
67
|
-
- **
|
|
63
|
+
- **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.
|
|
64
|
+
- **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.
|
|
65
|
+
- **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
66
|
- **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
67
|
|
|
70
68
|
---
|
|
71
69
|
|
|
72
70
|
## 3. Desktop-Supervised Development
|
|
73
71
|
|
|
74
|
-
Nimi
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
When working on Runtime, SDK, or Kit changes, running Nimi from source defaults to the official Realm. Pass `--realm local` to the source Home launcher when you need Realm integration or controlled data. Native `nimi-app dev` discovers the active Home and inherits its target. From a Nimi checkout, run `pnpm doctor:dev -- --host source --realm official` to compare the requested and observed Runtime. Coordinate with other developers before switching a shared host, as switching ends live App sessions. Compatible versions can reuse the same model and engine files in sequence. See the [local development guide](https://github.com/nimiplatform/nimi/blob/main/LOCAL_DEVELOPMENT.md).
|
|
75
|
+
|
|
76
|
+
Native App development uses 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).
|
|
77
|
+
|
|
78
|
+
<a id="continuing-an-existing-session"></a>
|
|
79
|
+
|
|
80
|
+
### Reopening a Development Registration
|
|
81
|
+
|
|
82
|
+
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.
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
To keep your app data and registrations intact across restarts:
|
|
84
|
+
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
85
|
|
|
79
86
|
```bash
|
|
80
87
|
# List active registrations
|
|
@@ -109,7 +116,7 @@ Before publishing publicly, verify the `.nimiapp` package on your own machine:
|
|
|
109
116
|
|
|
110
117
|
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
118
|
|
|
112
|
-
Use Desktop-supervised Electron for App development and acceptance.
|
|
119
|
+
Use Desktop-supervised Electron for native App development and acceptance.
|
|
113
120
|
|
|
114
121
|
---
|
|
115
122
|
|
|
@@ -232,6 +239,49 @@ Keep repository setup, architecture, build/release commands and engineering acce
|
|
|
232
239
|
|
|
233
240
|
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.
|
|
234
241
|
|
|
242
|
+
### Storefront Presentation (`metadata.storefront`)
|
|
243
|
+
|
|
244
|
+
Apps may declare optional `metadata.storefront` in `nimi.app.yaml` to provide localized store copy, highlights, tags, a 16:9 cover image, and up to 6 static screenshots (WebP or PNG, static only, `<= 512 KiB` each; cover `800–2560 × 450–1600`, gallery `640–2560 × 360–1600`). Supported `category` values: `companions-worlds`, `lifestyle`, `writing-notes`, `design-diagrams`, `audio-music`, `video-media`, `research-learning`, `productivity-automation`, `developer-tools`.
|
|
245
|
+
|
|
246
|
+
Non-default locales may override `display_name`, `summary`, and `introduction` (pointing to a repo-relative UTF-8 Markdown file up to `96 KiB`); the `default_locale` reuses top-level `display_name`, `metadata.summary`, and root `NIMI_APP.md` without duplicating them.
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
metadata:
|
|
250
|
+
summary: 中文简介(默认语种来自顶层字段与 NIMI_APP.md)
|
|
251
|
+
icon: assets/app-artwork.png
|
|
252
|
+
storefront:
|
|
253
|
+
category: lifestyle
|
|
254
|
+
default_locale: zh
|
|
255
|
+
locales:
|
|
256
|
+
zh:
|
|
257
|
+
tags: [节律观察, 本地隐私]
|
|
258
|
+
highlights:
|
|
259
|
+
- title: 确定性排盘
|
|
260
|
+
description: 本地先算准客观盘面,再结合模型解读。
|
|
261
|
+
en:
|
|
262
|
+
display_name: ShiJing
|
|
263
|
+
summary: Deterministic personal rhythm companion.
|
|
264
|
+
introduction: NIMI_APP.en.md
|
|
265
|
+
tags: [Rhythm, Local-First]
|
|
266
|
+
highlights:
|
|
267
|
+
- title: Deterministic Engine
|
|
268
|
+
description: Computes local charts before layering AI reflection.
|
|
269
|
+
media:
|
|
270
|
+
cover:
|
|
271
|
+
path: assets/storefront/cover-zh.webp
|
|
272
|
+
locales:
|
|
273
|
+
en: assets/storefront/cover-en.webp
|
|
274
|
+
gallery:
|
|
275
|
+
- id: overview
|
|
276
|
+
kind: image
|
|
277
|
+
path: assets/storefront/overview-zh.webp
|
|
278
|
+
caption:
|
|
279
|
+
zh: 主视图总览
|
|
280
|
+
en: "Main workspace overview"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
During `nimi-app pack --target`, App Tools validates every declared image and writes only image digests and dimensions into `app-info.json` (never embedding screenshots inside `.nimiapp`). During `nimi-app pack --aggregate`, App Tools checks cross-target display parity and packages all referenced images once into a deduplicated `<app_id>-<version>-storefront-media.zip` (`<= 8 MiB`) uploaded alongside the immutable GitHub Release.
|
|
284
|
+
|
|
235
285
|
### Package v2 Output & Sidecar Verification
|
|
236
286
|
`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.
|
|
237
287
|
|
|
@@ -242,3 +292,41 @@ During release, the managed GitHub Actions workflow uploads this sidecar to the
|
|
|
242
292
|
## License
|
|
243
293
|
|
|
244
294
|
Licensed under [Apache-2.0](../licenses/Apache-2.0.txt).
|
|
295
|
+
|
|
296
|
+
<a id="web-development-current-source-build"></a>
|
|
297
|
+
|
|
298
|
+
## Web development
|
|
299
|
+
|
|
300
|
+
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.
|
|
301
|
+
|
|
302
|
+
Use a compatible host and matching prerelease packages for Web development. App Tools `0.16.0-rc.12` scaffolds the project with SDK `0.24.0-rc.10` and Kit `0.24.0-rc.16`. For unpublished changes, use a matching set of complete source archives. See [Environment Setup](../docs/start/install.md).
|
|
303
|
+
|
|
304
|
+
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.
|
|
305
|
+
|
|
306
|
+
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. In `.env.local`, point `NIMI_WEB_TLS_KEY` to the HTTPS private key and `NIMI_WEB_TLS_CERT` to the matching certificate trusted by the browser. Source review and first PC Home confirmation remain required and do not require a native package release. The CLI does not approve the source.
|
|
307
|
+
|
|
308
|
+
For local Realm integration, add `local_development.web.local` with that environment's exact source fields and run `nimi-app dev --platform web --realm local`. The App-owned `command` stays under `web`, and source fields survive sync. Official defaults come from the package's public Realm profile; a local profile is always explicit and never acts as a fallback when the official service is unavailable.
|
|
309
|
+
|
|
310
|
+
`@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.
|
|
311
|
+
|
|
312
|
+
For a Nimi-hosted release, declare `public_slug` in `nimi.app.yaml`, use your existing Web production build, and set `NIMI_WEB_VERSION` to the protected Web release version. App Tools generates `nimi-web-bundle.json` along with the exact `https://<slug>.nimi.xyz` origin, root callback, public client identity, official account URL, and Realm environment, placing compiled assets under `/_releases/<version>/assets/`.
|
|
313
|
+
|
|
314
|
+
Run `nimi-app sync` to install the managed `.github/workflows/nimi-web-release.yml` workflow. 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. To pack the static output directory as a stored ZIP directly, use `packHostedWeb(directory, outputFile)` from `@nimiplatform/app-tools/web/release`. App-authored Pages control files are excluded, and executable public assets should be imported into the build or explicitly referenced under their release path.
|
|
315
|
+
|
|
316
|
+
For an independently registered release build, run `pnpm build:release` in a generated Web App or pass `release: true` to `nimiWebViteConfig` in your 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 your deployment values. The build reads the App ID from `nimi.app.yaml` and uses these release inputs for source identity and login. On that App origin, serve the coordination allowlist defined by `isWebCoordinationPath` and forward matching requests to the corresponding Realm without cookies. Source admission and cookie isolation remain deployment requirements.
|
|
317
|
+
|
|
318
|
+
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.
|
|
319
|
+
|
|
320
|
+
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.
|
|
321
|
+
|
|
322
|
+
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.
|
|
323
|
+
|
|
324
|
+
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 is no longer exported. Update existing App-owned Web entries to match the selected SDK and Kit packages; 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.
|
|
325
|
+
|
|
326
|
+
### Existing mobile development entry
|
|
327
|
+
|
|
328
|
+
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.
|
|
329
|
+
|
|
330
|
+
The initial reference is Zhiyu's Android Capacitor container using Kit's `auth/app/mobile`. Ordinary debug development targets the official Realm with a registered Android App Link, the actual debug package/signature, and a verified HTTPS association—no release APK is required, though the project itself and Android build/device tools remain prerequisites. Passing `--realm local` explicitly enables the non-production `android-dev-scheme` path when that local source is admitted.
|
|
331
|
+
|
|
332
|
+
Source admission and Home consent remain with their respective owners. This entry does not add mobile scaffolding, APK publishing, or store releases, and a child process exiting successfully does not constitute Runtime acceptance. Node build configs can use `@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,24 +188,26 @@ 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]',
|
|
190
199
|
'',
|
|
191
|
-
'Publishing on GitHub:',
|
|
200
|
+
'Publishing a native package on GitHub:',
|
|
192
201
|
' Before the first release, configure NIMI_REPOSITORY_ADMIN_TOKEN with Administration: Read-only.',
|
|
193
202
|
' It checks tag protection and Release immutability; uploads use the built-in GitHub token.',
|
|
194
203
|
' The built-in token lacks the Administration permission needed for this settings check.',
|
|
195
204
|
' Local development does not need this credential. Setup:',
|
|
196
205
|
' https://github.com/nimiplatform/nimi/blob/main/app-tools/README.md#publishing-on-github',
|
|
206
|
+
'Hosted Web: protect web-v* tags, enable immutable Releases, and submit the exact bundle to the Registry.',
|
|
197
207
|
'',
|
|
198
208
|
'Current module registry:',
|
|
199
209
|
` Admitted features: ${featureList(admitted)}`,
|
|
210
|
+
` Web features: ${featureList(admitted.filter(entry => entry.carriers.includes('web')))}`,
|
|
200
211
|
` Candidate features (not public-selectable): ${featureList(candidates)}`,
|
|
201
212
|
` Internal modules (dependency-only): ${internalList}`,
|
|
202
213
|
admitted.length > 0
|
|
@@ -210,6 +221,7 @@ function printUsage() {
|
|
|
210
221
|
' AI features resolve the internal ai-studio-core once; it cannot be selected directly.',
|
|
211
222
|
' Generated Apps exclude Lab-only Settings/account, App Access diagnostics, Realm/Agent probes, World Tour, and native/diagnostic surfaces.',
|
|
212
223
|
'',
|
|
224
|
+
'Native desktop support: Electron on Windows x64 and macOS arm64. Standard builds use Node and pnpm with prebuilt Kit bindings.',
|
|
213
225
|
'Third-party topology:',
|
|
214
226
|
' standalone: any empty target directory using public dependency version declarations.',
|
|
215
227
|
' Development may resolve complete local npm tarballs through documented overrides; no additional create mode is needed.',
|
|
@@ -224,7 +236,7 @@ function printUsage() {
|
|
|
224
236
|
' create -> dependency install -> init -> sync -> check -> dev/test/build -> pack',
|
|
225
237
|
' Run init and later commands only after dependency installation.',
|
|
226
238
|
` Before init, read the packaged lifecycle skill: ${LIFECYCLE_SKILL_PATH}`,
|
|
227
|
-
' Existing adoption requires pnpm
|
|
239
|
+
' 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
240
|
' Use electron-pnpm for an existing renderer framework; no fresh scaffold lock is created.',
|
|
229
241
|
'',
|
|
230
242
|
'Development CDP:',
|
|
@@ -311,12 +323,14 @@ try {
|
|
|
311
323
|
command,
|
|
312
324
|
dir,
|
|
313
325
|
profile,
|
|
326
|
+
platform,
|
|
314
327
|
appId,
|
|
315
328
|
version,
|
|
316
329
|
title,
|
|
317
330
|
packageName,
|
|
318
331
|
author,
|
|
319
332
|
features: parsedFeatures,
|
|
333
|
+
realm,
|
|
320
334
|
shell,
|
|
321
335
|
cdpPort,
|
|
322
336
|
noCdp,
|
|
@@ -351,6 +365,7 @@ try {
|
|
|
351
365
|
const rawInput = {
|
|
352
366
|
dir,
|
|
353
367
|
profile,
|
|
368
|
+
platform,
|
|
354
369
|
appId,
|
|
355
370
|
version,
|
|
356
371
|
title,
|
|
@@ -392,18 +407,21 @@ try {
|
|
|
392
407
|
dryRun,
|
|
393
408
|
});
|
|
394
409
|
break;
|
|
395
|
-
case 'check':
|
|
396
|
-
await checkApp(process.cwd(), {
|
|
410
|
+
case 'check': {
|
|
411
|
+
const result = await checkApp(process.cwd(), {
|
|
397
412
|
dir,
|
|
398
413
|
production,
|
|
399
414
|
json,
|
|
400
415
|
});
|
|
401
|
-
if (production && !json) {
|
|
402
|
-
process.stdout.write('[nimi-app]
|
|
416
|
+
if (production && !json && result.platform === 'web') {
|
|
417
|
+
process.stdout.write('[nimi-app] Protect web-v* tags and enable immutable Releases in the App repository. Submit the exact Web bundle and hosted source for Registry review.\n');
|
|
418
|
+
} else if (production && !json) {
|
|
419
|
+
process.stdout.write('[nimi-app] Local checks do not verify GitHub repository settings or secrets. Before a native release, configure NIMI_REPOSITORY_ADMIN_TOKEN (Administration: Read-only) to check tag protection and Release immutability:\n');
|
|
403
420
|
process.stdout.write('[nimi-app] Release uploads use the built-in GitHub token; it lacks the Administration permission needed for this settings check.\n');
|
|
404
421
|
process.stdout.write('https://github.com/nimiplatform/nimi/blob/main/app-tools/README.md#publishing-on-github\n');
|
|
405
422
|
}
|
|
406
423
|
break;
|
|
424
|
+
}
|
|
407
425
|
case 'test':
|
|
408
426
|
testApp(process.cwd(), { dir, json });
|
|
409
427
|
break;
|
|
@@ -419,9 +437,11 @@ try {
|
|
|
419
437
|
}
|
|
420
438
|
break;
|
|
421
439
|
case 'dev':
|
|
422
|
-
await
|
|
440
|
+
await runAppDevelopment(process.cwd(), {
|
|
441
|
+
realm,
|
|
423
442
|
dir,
|
|
424
|
-
shell
|
|
443
|
+
shell,
|
|
444
|
+
platform,
|
|
425
445
|
cdpPort,
|
|
426
446
|
noCdp,
|
|
427
447
|
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,28 +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.22.
|
|
15
|
-
Object.freeze({ sdkVersion: '^0.
|
|
16
|
-
Object.freeze({ sdkVersion: '^0.
|
|
17
|
-
Object.freeze({ sdkVersion: '^0.
|
|
18
|
-
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.
|
|
19
|
-
Object.freeze({ sdkVersion: '^0.21.0', kitVersion: '^0.
|
|
20
|
-
Object.freeze({ sdkVersion: '^0.
|
|
21
|
-
Object.freeze({ sdkVersion: '^0.
|
|
22
|
-
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' }),
|
|
23
27
|
]);
|
|
24
28
|
|
|
25
|
-
function
|
|
26
|
-
|
|
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;
|
|
27
46
|
}
|
|
28
47
|
|
|
29
48
|
export function defaultDependencyCombination(versions) {
|
|
30
49
|
return Object.freeze({
|
|
31
50
|
sdkVersion: versions.sdkVersion,
|
|
32
51
|
kitVersion: versions.kitVersion,
|
|
33
|
-
nimiShellTauriVersion: versions.nimiShellTauriVersion,
|
|
34
52
|
source: 'default',
|
|
35
53
|
});
|
|
36
54
|
}
|
|
@@ -39,18 +57,46 @@ function describe(combination) {
|
|
|
39
57
|
return `${SDK}@${combination.sdkVersion} with ${KIT}@${combination.kitVersion}`;
|
|
40
58
|
}
|
|
41
59
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
+
|
|
46
88
|
export function resolveDependencyCombination(packageJson, versions) {
|
|
47
89
|
const fallback = defaultDependencyCombination(versions);
|
|
48
90
|
const section = packageJson?.dependencies;
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
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;
|
|
52
95
|
if (sdk === fallback.sdkVersion && kit === fallback.kitVersion) return fallback;
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
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)}.`);
|
|
56
102
|
}
|