@nimiplatform/app-tools 0.6.3 → 0.7.5
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 +100 -10
- package/bin/nimi-app.mjs +6 -12
- package/lib/app-dependency-combinations.mjs +62 -0
- package/lib/app-doctor-update.mjs +18 -16
- package/lib/app-info.mjs +25 -2
- package/lib/app-lifecycle-guidance.mjs +4 -2
- package/lib/app-pack.mjs +5 -2
- package/lib/app-project-lifecycle.mjs +208 -50
- package/lib/app-safety-profile.mjs +204 -0
- package/lib/app-scaffold-capabilities.mjs +8 -0
- package/lib/app-scaffold-profiles.mjs +42 -3
- package/lib/app-scaffold.mjs +2 -1
- package/lib/canonical-capability-ids.generated.mjs +21 -0
- package/lib/index.mjs +0 -4
- package/package.json +7 -12
- package/scripts/dev-shell.mjs +20 -2
- package/skills/nimi-app-lifecycle/SKILL.md +7 -3
- package/skills/nimi-app-lifecycle/references/acceptance.md +6 -0
- package/skills/nimi-app-lifecycle/references/adapt.md +46 -1
- package/skills/nimi-app-lifecycle/references/audit.md +55 -0
- package/skills/nimi-app-lifecycle/references/platform-gaps.md +15 -0
- package/skills/nimi-app-lifecycle/references/release.md +1 -1
- package/skills/nimi-app-lifecycle/references/safety-declaration.md +37 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +2 -2
- package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +8 -10
- package/templates/default-starter/AGENTS.md +4 -2
- package/lib/simulator-conformance-ast.mjs +0 -498
- package/lib/simulator-conformance-css.mjs +0 -116
- package/lib/simulator-conformance-graph.mjs +0 -757
- package/lib/simulator-conformance.d.mts +0 -14
- package/lib/simulator-conformance.mjs +0 -203
- package/lib/simulator-css-profile.d.mts +0 -27
- package/lib/simulator-css-profile.mjs +0 -531
- package/lib/simulator-kit-export-resolution.mjs +0 -70
- package/lib/simulator-manifest.mjs +0 -334
package/README.md
CHANGED
|
@@ -6,19 +6,41 @@ It does not own GitHub publisher or repository truth, registry review/main, Runt
|
|
|
6
6
|
|
|
7
7
|
For your first public release, start with [Publishing on GitHub](#publishing-on-github), including the read-only repository-settings credential.
|
|
8
8
|
|
|
9
|
+
Simulator integration is retired. Remove `nimi-app check --conformance simulator`
|
|
10
|
+
and imports of `@nimiplatform/app-tools/simulator-conformance` or
|
|
11
|
+
`@nimiplatform/app-tools/simulator-css-profile` from active projects. Use the
|
|
12
|
+
normal App lifecycle checks and Desktop-supervised development for current
|
|
13
|
+
Apps; the archived preview implementation is no longer a release prerequisite.
|
|
14
|
+
|
|
9
15
|
## AI development and existing projects
|
|
10
16
|
|
|
11
17
|
The package includes one `skills/nimi-app-lifecycle/SKILL.md` with on-demand
|
|
12
|
-
guides for creating, adapting, platform upgrades, upstream sync, releases and
|
|
18
|
+
guides for adaptation audits, creating, adapting, platform gaps and upgrades, upstream sync, releases and
|
|
13
19
|
acceptance. Read it inside the installed package before initializing an existing
|
|
14
20
|
repository. `nimi-app --help` prints its resolved location. Installation does
|
|
15
21
|
not activate instructions; explicit init/sync maintains the project skill under
|
|
16
22
|
`.agents/skills/nimi-app-lifecycle/` and an independent AGENTS.md block.
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
For a feasibility, capability-fit or cost decision, start with [Audit](skills/nimi-app-lifecycle/references/audit.md). It uses existing public consumption paths and the target's actual workflows without requiring adoption or a running reference App. When implementation follows a report, preserve its evidence and uncertainty boundaries through the guide's handoff.
|
|
25
|
+
|
|
26
|
+
Install the selected app-tools and the exact nimi-coding version declared in
|
|
27
|
+
its `nimiScaffoldVersions`. For first integration, generate a minimal reference
|
|
28
|
+
App under `.nimi/local/` with its own identity and the needed admitted features,
|
|
29
|
+
using this same SDK/Kit/native package combination. Run its generated foundation
|
|
30
|
+
and reuse or align its Host, preload, renderer bridge, session, App Access,
|
|
31
|
+
AIConfig and AI call wiring in the existing App. SDK/Kit documentation explains
|
|
32
|
+
the contracts; it does not replace working generated code.
|
|
33
|
+
|
|
34
|
+
When the task includes installation, establish the reference's local installed
|
|
35
|
+
Access baseline as described in the packaged acceptance guide. Compare under
|
|
36
|
+
the same conditions to separate toolchain failures from App wiring differences.
|
|
37
|
+
Reuse passing results for ordinary business changes; no extra evidence ledger
|
|
38
|
+
or repeated full reference run is needed.
|
|
39
|
+
|
|
40
|
+
Preserve the original product's workflows and business settings while preparing
|
|
41
|
+
its actual renderer and build/test scripts. A reference workbench or passing
|
|
42
|
+
sample is not the complete App. Init does not convert a server framework,
|
|
43
|
+
invent tests or replace product UI. Preview adoption after this preparation:
|
|
22
44
|
|
|
23
45
|
```bash
|
|
24
46
|
pnpm exec nimi-app init --adopt --dry-run --json
|
|
@@ -78,9 +100,73 @@ commands; older Desktop versions enforcing Vite reject this project even after
|
|
|
78
100
|
app-tools validation passes. Do not introduce a Vite placeholder to bypass it.
|
|
79
101
|
|
|
80
102
|
Use the selected package's `nimiScaffoldVersions` declarations in `package.json`
|
|
81
|
-
and commit the matching lockfile to pin resolved versions.
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
and commit the matching lockfile to pin resolved versions. Fresh `create` uses
|
|
104
|
+
the tool default SDK/Kit combination. An existing App keeps its current SDK/Kit
|
|
105
|
+
combination when it is one of the supported combinations app-tools declares:
|
|
106
|
+
`sync` preserves it, `check` verifies the same combination in the manifest,
|
|
107
|
+
lockfile and Cargo inputs, and only the app-tools and nimi-coding tool
|
|
108
|
+
dependencies follow the selected tool version. An unlisted SDK x Kit pairing is
|
|
109
|
+
rejected rather than normalized. A matrix range in the manifest does not
|
|
110
|
+
require an automatic upgrade; install with the frozen lockfile until
|
|
111
|
+
deliberately selecting and synchronizing a new component combination.
|
|
112
|
+
|
|
113
|
+
### Local development packages
|
|
114
|
+
|
|
115
|
+
Development does not require publishing every SDK/Kit or app-tools change.
|
|
116
|
+
Keep the selected version matrix in `package.json`, and use explicit npm tarball
|
|
117
|
+
overrides in the App's own `pnpm-workspace.yaml`:
|
|
118
|
+
|
|
119
|
+
```yaml
|
|
120
|
+
packages:
|
|
121
|
+
- .
|
|
122
|
+
overrides:
|
|
123
|
+
'@nimiplatform/app-tools': file:D:/nimi-packages/nimiplatform-app-tools-0.7.0.tgz
|
|
124
|
+
'@nimiplatform/sdk': file:D:/nimi-packages/nimiplatform-sdk-0.14.0.tgz
|
|
125
|
+
'@nimiplatform/kit': file:D:/nimi-packages/nimiplatform-kit-0.10.0.tgz
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
These are example artifact locations; use the complete packages you were given.
|
|
129
|
+
Override Kit's matching native optional package too when that component changes;
|
|
130
|
+
keep the native carrier Kit-owned rather than adding it as an App dependency.
|
|
131
|
+
Local archives may also use paths relative to the App. Install, run sync and
|
|
132
|
+
check, then use the normal dev/test/build/pack loop. Sync retains these choices;
|
|
133
|
+
check verifies matrix compatibility and compares the selected tarball version,
|
|
134
|
+
source and integrity with pnpm's installed dependency lock and package manifest.
|
|
135
|
+
Workspace members declare their own SDK/Kit dependencies and share the root
|
|
136
|
+
tarball overrides. pnpm writes each member's `specifier` relative to that member,
|
|
137
|
+
while resolved versions and package records remain workspace-relative; check
|
|
138
|
+
compares the resulting archive identities and installed importer bindings.
|
|
139
|
+
Do not rewrite member lock entries to look identical to the root importer.
|
|
140
|
+
Updating only the lockfile does not update installed packages: run `pnpm install`
|
|
141
|
+
after selecting another local package combination. Directory links and
|
|
142
|
+
source-workspace overrides stay invalid.
|
|
143
|
+
The generated Electron packager rebases archive paths for its isolated dependency
|
|
144
|
+
staging so a local build uses the same packages.
|
|
145
|
+
|
|
146
|
+
`check --production` is the final public-release preflight and requires registry
|
|
147
|
+
resolutions. It is not a prerequisite for development or local build/pack;
|
|
148
|
+
the normal build still executes the actual declared production payload command.
|
|
149
|
+
|
|
150
|
+
For local installed-App acceptance, keep these tarball overrides and run:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pnpm exec nimi-app check
|
|
154
|
+
pnpm exec nimi-app build --target windows-x86_64
|
|
155
|
+
pnpm exec nimi-app pack --target windows-x86_64 --production
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Use the actual target on its matching host. `pack --production` observes the
|
|
159
|
+
payload's native signature and execution permissions; it does not run registry
|
|
160
|
+
dependency preflight or publish anything. Plain `pack` writes a development
|
|
161
|
+
archive that Runtime local import rejects. Import the resulting package through
|
|
162
|
+
Desktop's Apps → Add App → Import local package, then verify its installed launch
|
|
163
|
+
and business use. This exercises the `user_imported` source independently of
|
|
164
|
+
Catalog admission and download.
|
|
165
|
+
|
|
166
|
+
When preparing a public release after development acceptance, remove local
|
|
167
|
+
overrides, install the published matched versions and complete release preflight.
|
|
168
|
+
Local import creates no GitHub Release or Registry approval and does not verify
|
|
169
|
+
Catalog download or installation on a machine without the development environment.
|
|
84
170
|
|
|
85
171
|
`init --dry-run --json` and `sync --dry-run --json` show app-tools file/field
|
|
86
172
|
changes without writes, installation or owner mutation. The separate
|
|
@@ -140,7 +226,7 @@ node app-tools/bin/nimi-app.mjs create \
|
|
|
140
226
|
|
|
141
227
|
The base is identity-neutral and combines only explicitly admitted `--features` plus their dependency closure. `--features all` means all currently admitted features, not all Nimi Lab source.
|
|
142
228
|
|
|
143
|
-
Standalone output
|
|
229
|
+
Standalone output keeps public npm and Cargo dependency version declarations. Complete local npm tarballs are supported development resolutions through the documented overrides; public-release preflight requires registry resolutions. Source-workspace paths, parent-source aliases and App-owned direct native-carrier dependencies remain outside the standalone dependency boundary.
|
|
144
230
|
|
|
145
231
|
## Development and build
|
|
146
232
|
|
|
@@ -356,7 +442,11 @@ pnpm dlx --package @nimiplatform/app-tools nimi-app --help
|
|
|
356
442
|
## Portable App information (package v2)
|
|
357
443
|
|
|
358
444
|
A distribution package includes `app-info.json`, containing its actual icon,
|
|
359
|
-
summary, available usage guide and version notes, license
|
|
445
|
+
summary, available usage guide and version notes, license, portable requirements
|
|
446
|
+
and, when declared, the publisher safety declaration from `nimi.app.yaml`
|
|
447
|
+
`safety_profile` (see the lifecycle skill's safety-declaration reference). An
|
|
448
|
+
undeclared `safety_profile` stays absent and blocks nothing locally; new public
|
|
449
|
+
Registry admission requires the complete declaration.
|
|
360
450
|
Every `pack`, including development-mode packaging and non-release CI, requires
|
|
361
451
|
valid App information. Complete `nimi.app.yaml` and its resources before packing;
|
|
362
452
|
production check/build validates them before the build starts:
|
package/bin/nimi-app.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function parseArgs(argv) {
|
|
|
22
22
|
const [command = '', ...rest] = argv;
|
|
23
23
|
const values = {
|
|
24
24
|
dir: '', profile: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
25
|
-
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '',
|
|
25
|
+
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '', target: '', aggregate: false, production: false, json: false,
|
|
26
26
|
adopt: false, dryRun: false, input: '',
|
|
27
27
|
};
|
|
28
28
|
const seen = new Set();
|
|
@@ -109,10 +109,6 @@ function parseArgs(argv) {
|
|
|
109
109
|
values.noCdp = true;
|
|
110
110
|
continue;
|
|
111
111
|
}
|
|
112
|
-
if (rest[index] === '--conformance') {
|
|
113
|
-
index = readValue(index, '--conformance', 'conformance');
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
112
|
if (rest[index] === '--target') {
|
|
117
113
|
index = readValue(index, '--target', 'target');
|
|
118
114
|
continue;
|
|
@@ -149,7 +145,7 @@ function assertCommandOptions(command, providedOptions) {
|
|
|
149
145
|
create: new Set(['dir', 'profile', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
|
|
150
146
|
init: new Set(['dir', 'json', 'adopt', 'input', 'dryRun']),
|
|
151
147
|
sync: new Set(['dir', 'json', 'dryRun']),
|
|
152
|
-
check: new Set(['dir', 'json', '
|
|
148
|
+
check: new Set(['dir', 'json', 'production']),
|
|
153
149
|
dev: new Set(['dir', 'shell', 'cdpPort', 'noCdp', 'listRegistrations', 'resume']),
|
|
154
150
|
test: new Set(['dir', 'json']),
|
|
155
151
|
build: new Set(['dir', 'target', 'production', 'json']),
|
|
@@ -180,7 +176,7 @@ function printUsage() {
|
|
|
180
176
|
' 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]',
|
|
181
177
|
' nimi-app init [--adopt [--input json-path]] [--dry-run] [--dir path] [--json]',
|
|
182
178
|
' nimi-app sync [--dry-run] [--dir path] [--json]',
|
|
183
|
-
' nimi-app check [--dir path] [--
|
|
179
|
+
' nimi-app check [--dir path] [--production] [--json]',
|
|
184
180
|
' nimi-app dev [--dir path] [--shell electron] [--list-registrations | --resume <selector>] [--cdp-port 1024..65535 | --no-cdp]',
|
|
185
181
|
' nimi-app test [--dir path] [--json]',
|
|
186
182
|
' nimi-app build [--dir path] [--target target-id] [--production] [--json]',
|
|
@@ -209,14 +205,14 @@ function printUsage() {
|
|
|
209
205
|
' Generated Apps exclude Lab-only Settings/account, App Access diagnostics, Realm/Agent probes, World Tour, and native/diagnostic surfaces.',
|
|
210
206
|
'',
|
|
211
207
|
'Third-party topology:',
|
|
212
|
-
' standalone: any empty target directory using public
|
|
213
|
-
'
|
|
208
|
+
' standalone: any empty target directory using public dependency version declarations.',
|
|
209
|
+
' Development may resolve complete local npm tarballs through documented overrides; no additional create mode is needed.',
|
|
210
|
+
' Source-workspace paths, parent-source aliases and private validation topology are not public create modes.',
|
|
214
211
|
'',
|
|
215
212
|
'Ownership:',
|
|
216
213
|
' App-owned: workbench-core and selected module product code under src/capabilities/**.',
|
|
217
214
|
' Scaffold-managed: carrier, identity, manifest/native wiring, and generated composition glue.',
|
|
218
215
|
' sync refreshes only scaffold-managed files; check is non-mutating.',
|
|
219
|
-
' Simulator conformance remains an explicit check mode for existing Simulator Apps; this scaffold does not generate one.',
|
|
220
216
|
'',
|
|
221
217
|
'Required order:',
|
|
222
218
|
' create -> dependency install -> init -> sync -> check -> dev/test/build -> pack',
|
|
@@ -320,7 +316,6 @@ try {
|
|
|
320
316
|
noCdp,
|
|
321
317
|
listRegistrations,
|
|
322
318
|
resume,
|
|
323
|
-
conformance,
|
|
324
319
|
target,
|
|
325
320
|
aggregate,
|
|
326
321
|
production,
|
|
@@ -393,7 +388,6 @@ try {
|
|
|
393
388
|
case 'check':
|
|
394
389
|
await checkApp(process.cwd(), {
|
|
395
390
|
dir,
|
|
396
|
-
conformance,
|
|
397
391
|
production,
|
|
398
392
|
json,
|
|
399
393
|
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-018c
|
|
2
|
+
|
|
3
|
+
// Supported SDK/Kit dependency combinations.
|
|
4
|
+
//
|
|
5
|
+
// Fresh `create` uses the tool default combination (nimiScaffoldVersions).
|
|
6
|
+
// An existing App keeps its current SDK/Kit combination when that pairing is
|
|
7
|
+
// one of the limited combinations below; sync preserves it and its matching
|
|
8
|
+
// glue, while the app-tools and nimi-coding tool dependencies are still
|
|
9
|
+
// synchronized to the selected tool version. Manifest, lock, Cargo, glue,
|
|
10
|
+
// build/pack and workflow checks all resolve the combination through
|
|
11
|
+
// `resolveDependencyCombination` so no entry point accepts an arbitrary
|
|
12
|
+
// SDK x Kit pairing.
|
|
13
|
+
//
|
|
14
|
+
// Evidence for each row is a shipped app-tools default matrix
|
|
15
|
+
// (app-tools/package.json history) whose Kit release declares the paired SDK
|
|
16
|
+
// range and whose Kit release commit carries the listed nimi-shell-tauri
|
|
17
|
+
// crate version. Add a row only with that evidence; never widen to ranges.
|
|
18
|
+
export const SUPPORTED_DEPENDENCY_COMBINATIONS = Object.freeze([
|
|
19
|
+
Object.freeze({ sdkVersion: '^0.11.0', kitVersion: '^0.7.0', nimiShellTauriVersion: '0.3.0' }),
|
|
20
|
+
Object.freeze({ sdkVersion: '^0.12.0', kitVersion: '^0.8.0', nimiShellTauriVersion: '0.4.0' }),
|
|
21
|
+
Object.freeze({ sdkVersion: '^0.13.0', kitVersion: '^0.9.0', nimiShellTauriVersion: '0.5.0' }),
|
|
22
|
+
Object.freeze({ sdkVersion: '^0.14.0', kitVersion: '^0.10.0', nimiShellTauriVersion: '0.6.0' }),
|
|
23
|
+
Object.freeze({ sdkVersion: '^0.15.0', kitVersion: '^0.11.0', nimiShellTauriVersion: '0.6.0' }),
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
const SDK = '@nimiplatform/sdk';
|
|
27
|
+
const KIT = '@nimiplatform/kit';
|
|
28
|
+
|
|
29
|
+
function isRegistrySpec(value) {
|
|
30
|
+
return typeof value === 'string' && /^\^?(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$/u.test(value.trim()) && value.trim() === value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function defaultDependencyCombination(versions) {
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
sdkVersion: versions.sdkVersion,
|
|
36
|
+
kitVersion: versions.kitVersion,
|
|
37
|
+
nimiShellTauriVersion: versions.nimiShellTauriVersion,
|
|
38
|
+
source: 'default',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function describe(combination) {
|
|
43
|
+
return `${SDK}@${combination.sdkVersion} with ${KIT}@${combination.kitVersion}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Resolves the combination an App is on from its package.json. Local,
|
|
47
|
+
// workspace or missing specs are not a selected combination and resolve to the
|
|
48
|
+
// tool default (the sync normalization target for fresh or local-only
|
|
49
|
+
// projects). A registry pairing must match one supported combination exactly.
|
|
50
|
+
export function resolveDependencyCombination(packageJson, versions) {
|
|
51
|
+
const fallback = defaultDependencyCombination(versions);
|
|
52
|
+
const section = packageJson?.dependencies;
|
|
53
|
+
const sdk = section && typeof section === 'object' && !Array.isArray(section) ? section[SDK] : undefined;
|
|
54
|
+
const kit = section && typeof section === 'object' && !Array.isArray(section) ? section[KIT] : undefined;
|
|
55
|
+
if (!isRegistrySpec(sdk) || !isRegistrySpec(kit)) return fallback;
|
|
56
|
+
if (sdk === fallback.sdkVersion && kit === fallback.kitVersion) return fallback;
|
|
57
|
+
const supported = SUPPORTED_DEPENDENCY_COMBINATIONS.find((entry) => entry.sdkVersion === sdk && entry.kitVersion === kit);
|
|
58
|
+
if (!supported) {
|
|
59
|
+
throw new Error(`Unsupported SDK/Kit combination: ${describe({ sdkVersion: sdk, kitVersion: kit })}. Supported combinations: ${[...SUPPORTED_DEPENDENCY_COMBINATIONS, fallback].map(describe).filter((entry, index, all) => all.indexOf(entry) === index).join('; ')}. Select one complete combination, then rerun nimi-app sync and nimi-app check.`);
|
|
60
|
+
}
|
|
61
|
+
return Object.freeze({ ...supported, source: 'existing' });
|
|
62
|
+
}
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
SUPPORTED_APP_SCAFFOLD_PROFILES,
|
|
13
13
|
} from './app-scaffold.mjs';
|
|
14
14
|
import { assertManifestAppAccessDeclaration } from './app-access-declaration.mjs';
|
|
15
|
-
import { validateSimulatorAppSourceWithCanonicalKitExports } from './simulator-conformance.mjs';
|
|
16
15
|
import { assertLifecycleGuidanceCurrent, LIFECYCLE_SKILL_PATH, lifecycleOwnerSteps, planLifecycleGuidance } from './app-lifecycle-guidance.mjs';
|
|
17
16
|
import { applyProjectFiles, describeChanges, plannedFile } from './app-project-files.mjs';
|
|
18
17
|
|
|
@@ -85,11 +84,10 @@ const PROVIDER_MODEL_HARDCODING_MODEL_FAMILIES = Object.freeze([
|
|
|
85
84
|
]);
|
|
86
85
|
const LOCAL_DEVELOPMENT_BYPASS_LABELS = new Set([
|
|
87
86
|
'generic platform auth helper in scaffold',
|
|
88
|
-
'Realm login bypass endpoint',
|
|
89
|
-
'Realm refresh bypass endpoint',
|
|
90
87
|
'Realm permission grant REST bypass endpoint',
|
|
91
88
|
'Realm raw request bypass',
|
|
92
89
|
// Existing Apps own ordinary HTTP routes and may retain vendor sources.
|
|
90
|
+
// Their login/refresh paths also do not identify Nimi Realm authority.
|
|
93
91
|
// A bare /api or /v1 URL does not identify Nimi Realm/Runtime authority.
|
|
94
92
|
// Those broad patterns remain applicable to our generated scaffold only.
|
|
95
93
|
'app-owned session store',
|
|
@@ -260,6 +258,18 @@ function isScannedTextPath(relativePath) {
|
|
|
260
258
|
&& TEXT_EXTENSIONS.has(path.extname(relativePath));
|
|
261
259
|
}
|
|
262
260
|
|
|
261
|
+
function isNextBuildOutputDirectory(directory) {
|
|
262
|
+
if (!path.basename(directory).startsWith('.next-')) return false;
|
|
263
|
+
// Next can separate dev and production distDir outputs. Exclude an actual
|
|
264
|
+
// output tree, not every similarly named source directory or ignored file.
|
|
265
|
+
return [directory, path.join(directory, 'dev')].some((output) => (
|
|
266
|
+
statSync(path.join(output, 'build-manifest.json'), { throwIfNoEntry: false })?.isFile()
|
|
267
|
+
&& statSync(path.join(output, 'routes-manifest.json'), { throwIfNoEntry: false })?.isFile()
|
|
268
|
+
&& statSync(path.join(output, 'server'), { throwIfNoEntry: false })?.isDirectory()
|
|
269
|
+
&& statSync(path.join(output, 'static'), { throwIfNoEntry: false })?.isDirectory()
|
|
270
|
+
));
|
|
271
|
+
}
|
|
272
|
+
|
|
263
273
|
function collectTextFiles(rootDir) {
|
|
264
274
|
const results = [];
|
|
265
275
|
const walk = (currentDir) => {
|
|
@@ -269,6 +279,11 @@ function collectTextFiles(rootDir) {
|
|
|
269
279
|
}
|
|
270
280
|
const fullPath = path.join(currentDir, entry.name);
|
|
271
281
|
if (entry.isDirectory()) {
|
|
282
|
+
if (isNextBuildOutputDirectory(fullPath)) continue;
|
|
283
|
+
// Python environments can contain bundled JS applications. Like
|
|
284
|
+
// node_modules, these installed dependencies are not App source.
|
|
285
|
+
// Use the environment marker, not a project-specific directory name.
|
|
286
|
+
if (existsSync(path.join(fullPath, 'pyvenv.cfg'))) continue;
|
|
272
287
|
walk(fullPath);
|
|
273
288
|
continue;
|
|
274
289
|
}
|
|
@@ -321,7 +336,6 @@ function buildForbiddenPatterns() {
|
|
|
321
336
|
['direct Realm permission grant module access', /\.permissionGrants\./],
|
|
322
337
|
['direct Realm permission grant method', /\b(?:listMyAppPermissionGrants|getMyAppPermissionGrant(?:Status|Projection)?|requestMyAppPermissionGrant|revokeMyAppPermissionGrant)\s*\(/],
|
|
323
338
|
['OpenAI-compatible Runtime REST endpoint assumption', /\/v1\/(?:chat\/completions|responses|embeddings|audio|images|models)\b/],
|
|
324
|
-
['app-owned session store', /sessionStore/],
|
|
325
339
|
['app-owned refresh token provider', /refreshTokenProvider/],
|
|
326
340
|
['app-owned protected Runtime gRPC client', /@grpc\/grpc-js|\bgrpc\.credentials\.createInsecure\s*\(/],
|
|
327
341
|
['app-owned Runtime endpoint custody', /\b(?:NIMI_RUNTIME_ENDPOINT|runtimeEndpoint)\b/],
|
|
@@ -715,18 +729,6 @@ export function initApp(cwd, options = {}, versions, runners = {}) {
|
|
|
715
729
|
|
|
716
730
|
export function validateAppProject(cwd, options = {}, versions, runners = {}) {
|
|
717
731
|
const targetDir = resolveTargetDir(cwd, options);
|
|
718
|
-
if (options.conformance) {
|
|
719
|
-
if (options.conformance !== 'simulator') {
|
|
720
|
-
throw new Error(`Unsupported conformance target: ${options.conformance}`);
|
|
721
|
-
}
|
|
722
|
-
if (options.json) {
|
|
723
|
-
throw new Error('--json is not supported for Simulator source validation');
|
|
724
|
-
}
|
|
725
|
-
return validateSimulatorAppSourceWithCanonicalKitExports(targetDir).then((result) => {
|
|
726
|
-
process.stdout.write(`[nimi-app] Simulator source validation passed for ${targetDir}\n`);
|
|
727
|
-
return result;
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
732
|
const result = validateAppProjectState(targetDir, versions, runners);
|
|
731
733
|
const payload = {
|
|
732
734
|
ok: true,
|
package/lib/app-info.mjs
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-042a
|
|
2
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-043a
|
|
2
3
|
import { existsSync, lstatSync, readFileSync } from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import { PNG } from 'pngjs';
|
|
5
6
|
import { parse as parseYaml } from 'yaml';
|
|
6
7
|
import { normalizeAppAccessItems } from './app-access-declaration.mjs';
|
|
8
|
+
import { SAFETY_PROFILE_FIELD, normalizeSafetyProfile } from './app-safety-profile.mjs';
|
|
7
9
|
|
|
8
10
|
export const APP_INFO_MAX_BYTES = 1024 * 1024;
|
|
11
|
+
export const APP_INFO_FIELDS = Object.freeze([
|
|
12
|
+
'format', 'app_id', 'version', 'target_id', 'display_name', 'summary', 'icon', 'readme_markdown', 'release_notes_markdown',
|
|
13
|
+
'license', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', 'author',
|
|
14
|
+
'homepage_url', 'support_url', SAFETY_PROFILE_FIELD,
|
|
15
|
+
]);
|
|
16
|
+
// Declaration fields that App Tools projects from nimi.app.yaml into the
|
|
17
|
+
// archive declaration and that Registry compares against the candidate.
|
|
18
|
+
export const APP_INFO_DECLARATION_FIELDS = Object.freeze(['app_id', 'display_name', 'version', 'app_access', 'capability_contract_refs', 'required_standardized_feature_refs', 'storage_policy', SAFETY_PROFILE_FIELD]);
|
|
9
19
|
const PNG_SIGNATURE = Buffer.from('89504e470d0a1a0a', 'hex');
|
|
10
20
|
|
|
11
21
|
function text(value, label, max, multiline = false) {
|
|
@@ -77,8 +87,19 @@ function https(value, field) {
|
|
|
77
87
|
return value;
|
|
78
88
|
}
|
|
79
89
|
|
|
90
|
+
// A declared safety_profile must already be canonical (tool-serialized); an
|
|
91
|
+
// absent field means undeclared and is never filled in.
|
|
92
|
+
function safetyProfile(value, label) {
|
|
93
|
+
if (value === undefined) return undefined;
|
|
94
|
+
const normalized = normalizeSafetyProfile(value);
|
|
95
|
+
if (JSON.stringify(normalized) !== JSON.stringify(value)) throw new Error(`${label} safety_profile is not canonical; run nimi-app sync to project the declaration`);
|
|
96
|
+
return normalized;
|
|
97
|
+
}
|
|
98
|
+
|
|
80
99
|
export function validateAppInfo(info) {
|
|
81
|
-
if (!info || info
|
|
100
|
+
if (!info || typeof info !== 'object' || Array.isArray(info)) throw new Error('Unsupported App info format');
|
|
101
|
+
for (const key of Object.keys(info)) if (!APP_INFO_FIELDS.includes(key)) throw new Error(`App info contains unsupported field: ${key}`);
|
|
102
|
+
if (info.format !== 'nimi.app-info/v1') throw new Error('Unsupported App info format');
|
|
82
103
|
for (const key of ['app_id', 'version', 'target_id']) text(info[key], key, 200);
|
|
83
104
|
text(info.display_name, 'display_name', 120);
|
|
84
105
|
text(info.summary, 'summary', 280);
|
|
@@ -98,6 +119,7 @@ export function validateAppInfo(info) {
|
|
|
98
119
|
if (info.author) text(info.author, 'author', 200);
|
|
99
120
|
https(info.homepage_url, 'homepage_url');
|
|
100
121
|
https(info.support_url, 'support_url');
|
|
122
|
+
safetyProfile(info[SAFETY_PROFILE_FIELD], 'App info');
|
|
101
123
|
if (Buffer.byteLength(JSON.stringify(info)) > APP_INFO_MAX_BYTES) throw new Error('App info exceeds 1 MiB');
|
|
102
124
|
return info;
|
|
103
125
|
}
|
|
@@ -136,11 +158,12 @@ export function readAppInfo(root, targetId) {
|
|
|
136
158
|
required_standardized_feature_refs: refs(manifest.required_standardized_feature_refs, 'required_standardized_feature_refs'),
|
|
137
159
|
storage_policy: storage(manifest.storage_policy),
|
|
138
160
|
author: metadata.author || '', homepage_url: https(metadata.homepage_url, 'homepage_url'), support_url: https(metadata.support_url, 'support_url'),
|
|
161
|
+
...(manifest[SAFETY_PROFILE_FIELD] === undefined ? {} : { [SAFETY_PROFILE_FIELD]: normalizeSafetyProfile(manifest[SAFETY_PROFILE_FIELD]) }),
|
|
139
162
|
});
|
|
140
163
|
const submissionPath = path.join(root, '.nimi/admission/submission.yaml');
|
|
141
164
|
if (existsSync(submissionPath)) {
|
|
142
165
|
const submission = parseYaml(readFileSync(submissionPath, 'utf8'));
|
|
143
|
-
for (const field of ['app_id', 'version', 'display_name', 'capability_contract_refs', 'required_standardized_feature_refs']) {
|
|
166
|
+
for (const field of ['app_id', 'version', 'display_name', 'capability_contract_refs', 'required_standardized_feature_refs', SAFETY_PROFILE_FIELD]) {
|
|
144
167
|
if (JSON.stringify(info[field]) !== JSON.stringify(submission[field])) throw new Error(`App info differs from submission ${field}; run nimi-app sync to project the declaration`);
|
|
145
168
|
}
|
|
146
169
|
if (JSON.stringify(storage(submission.storage_policy)) !== JSON.stringify(info.storage_policy)) throw new Error('App info differs from submission storage_policy; run nimi-app sync to project the declaration');
|
|
@@ -5,14 +5,16 @@ import { assertProjectOutputPath, changedFiles, plannedFile } from './app-projec
|
|
|
5
5
|
|
|
6
6
|
export const LIFECYCLE_SKILL_PATH = fileURLToPath(new URL('../skills/nimi-app-lifecycle/SKILL.md', import.meta.url));
|
|
7
7
|
export const PROJECT_SKILL_DIR = '.agents/skills/nimi-app-lifecycle';
|
|
8
|
-
const SKILL_FILES = ['SKILL.md', ...['create', 'adapt', 'upgrade-platform', 'sync-upstream', 'release', 'acceptance'].map((name) => `references/${name}.md`)];
|
|
8
|
+
const SKILL_FILES = ['SKILL.md', ...['audit', 'create', 'adapt', 'platform-gaps', 'upgrade-platform', 'sync-upstream', 'safety-declaration', 'release', 'acceptance'].map((name) => `references/${name}.md`)];
|
|
9
9
|
const START = '<!-- nimi-app:managed:start -->';
|
|
10
10
|
const END = '<!-- nimi-app:managed:end -->';
|
|
11
11
|
const AGENTS_BLOCK = `${START}
|
|
12
12
|
## Nimi App development
|
|
13
13
|
|
|
14
|
-
- For creating, adapting, upgrading or releasing this App, read [the lifecycle skill](.agents/skills/nimi-app-lifecycle/SKILL.md) and only the relevant scenario.
|
|
14
|
+
- For auditing adaptation feasibility or cost, creating, adapting, upgrading or releasing this App, read [the lifecycle skill](.agents/skills/nimi-app-lifecycle/SKILL.md) and only the relevant scenario. Audit-only requests do not begin implementation; prior reports remain evidence-dependent.
|
|
15
|
+
- For first integration or foundation wiring changes, use the selected app-tools package's generated reference and reuse its Host, preload, renderer, session, App Access, AIConfig and AI call wiring. Follow the adaptation guide's baseline checks and reuse passing results for ordinary business edits.
|
|
15
16
|
- Keep App-owned product behavior, Host code, business accounts and non-AI services with this repository. Use the SDK/Kit Local App carrier for Nimi AI, configuration, storage and session access.
|
|
17
|
+
- Development may consume complete local npm tarballs through the supported explicit overrides and version matrix; public-release preflight uses registry resolutions. Do not substitute source-workspace or directory links.
|
|
16
18
|
- App Tools owns its lifecycle skill, this block, managed workflow and declared engineering fields; preserve other instructions, product source and licenses. Existing adoption does not create fresh scaffold intent or lock.
|
|
17
19
|
- Product-operation guides apply to their specific business tasks; they do not replace the Nimi development boundary.
|
|
18
20
|
- Reuse the user's confirmed scope and authorization. Report command checks separately from actual App journeys; unrun relevant paths remain NOT-VERIFIED.
|
package/lib/app-pack.mjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-024a
|
|
5
5
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-024b
|
|
6
6
|
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-034a
|
|
7
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-043a
|
|
7
8
|
|
|
8
9
|
import { createHash } from 'node:crypto';
|
|
9
10
|
import {
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
} from 'node:fs';
|
|
18
19
|
import path from 'node:path';
|
|
19
20
|
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
20
|
-
import { APP_INFO_MAX_BYTES, readAppInfo, validateAppInfo } from './app-info.mjs';
|
|
21
|
+
import { APP_INFO_DECLARATION_FIELDS, APP_INFO_MAX_BYTES, readAppInfo, validateAppInfo } from './app-info.mjs';
|
|
21
22
|
import { observeWindowsExecutableFacts } from './windows-powershell.mjs';
|
|
22
23
|
import { SYMBOLIC_LINK_MODE, validatePayloadLinks } from './payload-links.mjs';
|
|
23
24
|
import { observeMacOSExecutableFacts } from './macos-native.mjs';
|
|
@@ -467,7 +468,9 @@ export function packAppTarget(cwd, options = {}) {
|
|
|
467
468
|
};
|
|
468
469
|
const infoBytes = Buffer.from(canonicalJson(input.appInfo));
|
|
469
470
|
if (infoBytes.length > APP_INFO_MAX_BYTES) throw new Error('App info exceeds 1 MiB');
|
|
470
|
-
|
|
471
|
+
// An undeclared safety_profile stays absent from the declaration copy; it is
|
|
472
|
+
// never serialized as an empty or default declaration.
|
|
473
|
+
const declaration = Object.fromEntries(APP_INFO_DECLARATION_FIELDS.filter((key) => input.appInfo[key] !== undefined).map((key) => [key, input.appInfo[key]]));
|
|
471
474
|
const archive = writeNimiAppArchive([
|
|
472
475
|
{ name: 'LICENSE', bytes: readFileSync(input.licensePath), mode: 0o644 },
|
|
473
476
|
{ name: 'manifest.json', bytes: canonicalJson(packageManifest), mode: 0o644 },
|