@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
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type NimiLocalAppClient,
|
|
4
|
-
} from '@nimiplatform/sdk';
|
|
5
|
-
import {
|
|
6
|
-
createNimiLocalAppStandardShellSurface,
|
|
7
|
-
} from '@nimiplatform/kit/shell/renderer/bridge';
|
|
8
|
-
|
|
9
|
-
let localAppClient: NimiLocalAppClient | null = null;
|
|
1
|
+
import type { NimiLocalAppClient } from '@nimiplatform/sdk/app';
|
|
2
|
+
import { getTargetAppSession } from '../workbench-target-adapter.js';
|
|
10
3
|
|
|
11
4
|
export function getNimiLocalAppClient(): NimiLocalAppClient {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
return localAppClient;
|
|
5
|
+
const runtime = getTargetAppSession().getSnapshot().runtime;
|
|
6
|
+
if (runtime.status !== 'connected') throw new Error('Connect through Nimi Home before starting work.');
|
|
7
|
+
runtime.scope.signal.throwIfAborted();
|
|
8
|
+
return runtime.scope.client;
|
|
18
9
|
}
|
|
@@ -1,110 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { appId } from './app-identity.js';
|
|
3
|
-
import { getNimiLocalAppClient } from './local-app-client.js';
|
|
4
|
-
|
|
1
|
+
import { getTargetAppSession } from '../workbench-target-adapter.js';
|
|
5
2
|
export { appId, appTitle, scaffoldProfile } from './app-identity.js';
|
|
6
3
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly appHost: {
|
|
14
|
-
readonly state: 'session-bound';
|
|
15
|
-
readonly reasonCode: string;
|
|
16
|
-
readonly actionHint: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type RuntimePlatformUnavailableProjection = {
|
|
21
|
-
readonly status: 'unavailable' | 'action-required';
|
|
22
|
-
readonly mode: RuntimeAuthMode;
|
|
23
|
-
readonly reasonCode: string;
|
|
24
|
-
readonly message: string;
|
|
25
|
-
readonly actionHint?: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type RuntimePlatformProjection =
|
|
29
|
-
| RuntimePlatformReadyProjection
|
|
30
|
-
| RuntimePlatformUnavailableProjection;
|
|
31
|
-
|
|
32
|
-
let runtimeProjection: Promise<RuntimePlatformProjection> | null = null;
|
|
33
|
-
|
|
34
|
-
export function clearRuntimePlatformProjection(): void {
|
|
35
|
-
runtimeProjection = null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function getRuntimePlatformProjection(): Promise<RuntimePlatformProjection> {
|
|
39
|
-
runtimeProjection ??= resolveAppHostProjection();
|
|
40
|
-
return runtimeProjection;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async function resolveAppHostProjection(): Promise<RuntimePlatformProjection> {
|
|
44
|
-
try {
|
|
45
|
-
const status = await getNimiLocalAppClient().auth.status();
|
|
46
|
-
if (!status.sessionBound) {
|
|
47
|
-
return {
|
|
48
|
-
status: status.state === 'unavailable' ? 'unavailable' : 'action-required',
|
|
49
|
-
mode: 'local-app',
|
|
50
|
-
reasonCode: status.reasonCode,
|
|
51
|
-
actionHint: status.actionHint,
|
|
52
|
-
message: messageFor(status.reasonCode),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
status: 'ready',
|
|
57
|
-
mode: 'local-app',
|
|
58
|
-
appHost: {
|
|
59
|
-
state: 'session-bound',
|
|
60
|
-
reasonCode: status.reasonCode,
|
|
61
|
-
actionHint: status.actionHint,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
} catch (error) {
|
|
65
|
-
return unavailableFromError(error);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function unavailableFromError(error: unknown): RuntimePlatformUnavailableProjection {
|
|
70
|
-
const reasonCode = typeof error === 'object' && error !== null && 'reasonCode' in error
|
|
71
|
-
? normalizeText((error as { reasonCode?: unknown }).reasonCode) || ReasonCode.RUNTIME_UNAVAILABLE
|
|
72
|
-
: ReasonCode.RUNTIME_UNAVAILABLE;
|
|
73
|
-
return {
|
|
74
|
-
status: 'action-required',
|
|
75
|
-
mode: 'local-app',
|
|
76
|
-
reasonCode,
|
|
77
|
-
actionHint: actionHintFor(reasonCode),
|
|
78
|
-
message: error instanceof Error ? error.message : messageFor(reasonCode),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function messageFor(reasonCode: string): string {
|
|
83
|
-
switch (reasonCode) {
|
|
84
|
-
case 'local-development-registration-required':
|
|
85
|
-
return 'This development project must be registered through Nimi.';
|
|
86
|
-
case 'local-development-session-revoked':
|
|
87
|
-
return 'Nimi access for this running App is unavailable.';
|
|
88
|
-
case 'local-development-project-changed':
|
|
89
|
-
return 'The project identity no longer matches its current registration.';
|
|
90
|
-
default:
|
|
91
|
-
return 'The protected Nimi local-app carrier is unavailable.';
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function actionHintFor(reasonCode: string): string {
|
|
96
|
-
switch (reasonCode) {
|
|
97
|
-
case 'local-development-registration-required':
|
|
98
|
-
return 'restart_official_nimi_app_dev_command';
|
|
99
|
-
case 'local-development-session-revoked':
|
|
100
|
-
return 'retry_when_nimi_access_is_available';
|
|
101
|
-
case 'local-development-project-changed':
|
|
102
|
-
return 'restore_registered_project_identity';
|
|
103
|
-
default:
|
|
104
|
-
return 'open_nimi_desktop_and_retry';
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function normalizeText(value: unknown): string {
|
|
109
|
-
return typeof value === 'string' ? value.trim() : '';
|
|
4
|
+
export async function getRuntimePlatformProjection() {
|
|
5
|
+
const snapshot = getTargetAppSession().getSnapshot();
|
|
6
|
+
if (snapshot.runtime.status === 'connected') return { status: 'ready' as const, mode: 'local-app' as const };
|
|
7
|
+
return { status: 'unavailable' as const, mode: 'local-app' as const,
|
|
8
|
+
reasonCode: snapshot.issue?.reasonCode ?? 'KIT_APP_CONNECTION_UNAVAILABLE',
|
|
9
|
+
message: snapshot.issue?.message ?? 'Open Nimi Home to check your account and App access.' };
|
|
110
10
|
}
|
|
@@ -1,130 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
WorkbenchRuntimeGateCopy,
|
|
4
|
-
WorkbenchRuntimeGateProjection,
|
|
5
|
-
} from '../workbench-core/index.js';
|
|
6
|
-
import {
|
|
7
|
-
appId,
|
|
8
|
-
appTitle,
|
|
9
|
-
clearRuntimePlatformProjection,
|
|
10
|
-
getRuntimePlatformProjection,
|
|
11
|
-
type RuntimePlatformUnavailableProjection,
|
|
12
|
-
} from './auth/runtime-platform.js';
|
|
1
|
+
import { createDesktopNimiAppSession } from '@nimiplatform/kit/auth/app/desktop';
|
|
13
2
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
checking: 'Connecting to Nimi…',
|
|
20
|
-
setupRequired: 'Not connected',
|
|
21
|
-
signInRequired: 'Sign in to Nimi to continue',
|
|
22
|
-
connectionRequired: 'This App needs Nimi',
|
|
23
|
-
retry: 'Try again',
|
|
24
|
-
offlineTier: (tier) => `Offline tier: ${tier}`,
|
|
25
|
-
nextAction: (step) => step,
|
|
26
|
-
technicalDetails: 'Technical details',
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// A gate that renders recovery actions and technical details receives them;
|
|
30
|
-
// an App-owned gate from an earlier scaffold still type-checks and shows the
|
|
31
|
-
// plain copy without them.
|
|
32
|
-
type TargetRuntimeGateRecovery = {
|
|
33
|
-
readonly recoveryAction?: { readonly label: string; readonly run: () => Promise<string> };
|
|
34
|
-
readonly technicalDetails?: readonly { readonly label: string; readonly value: string }[];
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type TargetRuntimeGateProjection =
|
|
38
|
-
| Extract<WorkbenchRuntimeGateProjection, { readonly status: 'ready' }>
|
|
39
|
-
| (Extract<WorkbenchRuntimeGateProjection, { readonly status: 'unavailable' }> & TargetRuntimeGateRecovery);
|
|
40
|
-
|
|
41
|
-
type TargetRuntimeGateGuidance = {
|
|
42
|
-
readonly signInRequired: boolean;
|
|
43
|
-
readonly body: string;
|
|
44
|
-
readonly nextStep: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export async function resolveTargetRuntimeGate(): Promise<TargetRuntimeGateProjection> {
|
|
48
|
-
const projection = await getRuntimePlatformProjection();
|
|
49
|
-
if (projection.status === 'ready') return { status: 'ready' };
|
|
50
|
-
const guidance = targetRuntimeGateGuidance(projection);
|
|
51
|
-
return {
|
|
52
|
-
status: 'unavailable',
|
|
53
|
-
body: guidance.body,
|
|
54
|
-
signInRequired: guidance.signInRequired,
|
|
55
|
-
nextAction: guidance.nextStep,
|
|
56
|
-
recoveryAction: { label: 'Open Nimi', run: openNimi },
|
|
57
|
-
technicalDetails: [
|
|
58
|
-
{ label: 'Reason', value: projection.reasonCode },
|
|
59
|
-
...(projection.actionHint ? [{ label: 'Suggested action', value: projection.actionHint }] : []),
|
|
60
|
-
{ label: 'Details', value: projection.message },
|
|
61
|
-
],
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function clearTargetRuntimeGate(): void {
|
|
66
|
-
clearRuntimePlatformProjection();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// The Runtime projection already carries failures as data; this covers only an
|
|
70
|
-
// unexpected rejection of the check itself.
|
|
71
|
-
export function targetRuntimeGateErrorMessage(): string {
|
|
72
|
-
return "This App couldn't check its connection to Nimi.";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function targetRuntimeGateGuidance(projection: RuntimePlatformUnavailableProjection): TargetRuntimeGateGuidance {
|
|
76
|
-
if (projection.reasonCode === 'runtime-unauthenticated') {
|
|
77
|
-
return {
|
|
78
|
-
signInRequired: true,
|
|
79
|
-
body: "You aren't signed in to Nimi on this computer.",
|
|
80
|
-
nextStep: 'Open Nimi and sign in, then select Try again.',
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
switch (projection.actionHint) {
|
|
84
|
-
case 'establish_fresh_app_access_session':
|
|
85
|
-
case 'wait_for_app_access_admission':
|
|
86
|
-
return {
|
|
87
|
-
signInRequired: false,
|
|
88
|
-
body: "Nimi hasn't finished giving this App access.",
|
|
89
|
-
nextStep: 'Wait a moment, then select Try again. If this keeps happening, open the App again from Nimi.',
|
|
90
|
-
};
|
|
91
|
-
case 'reopen_local_app_session':
|
|
92
|
-
case 'establish_session_for_current_account':
|
|
93
|
-
case 'restart_through_verified_desktop_supervisor':
|
|
94
|
-
case 'retry_when_nimi_access_is_available':
|
|
95
|
-
return {
|
|
96
|
-
signInRequired: false,
|
|
97
|
-
body: "This App's connection to Nimi ended, for example because Nimi restarted or the account changed.",
|
|
98
|
-
nextStep: 'Close this App and open it again from Nimi.',
|
|
99
|
-
};
|
|
100
|
-
case 'register_local_development_project':
|
|
101
|
-
case 'restart_official_nimi_app_dev_command':
|
|
102
|
-
case 'restore_registered_project_identity':
|
|
103
|
-
return {
|
|
104
|
-
signInRequired: false,
|
|
105
|
-
body: "Nimi doesn't recognize this development project as it is now.",
|
|
106
|
-
nextStep: 'Stop the App and start it again with pnpm dev.',
|
|
107
|
-
};
|
|
108
|
-
default:
|
|
109
|
-
return {
|
|
110
|
-
signInRequired: false,
|
|
111
|
-
body: "Nimi isn't running, or this App can't reach it right now.",
|
|
112
|
-
nextStep: 'Make sure Nimi is open, then select Try again.',
|
|
113
|
-
};
|
|
114
|
-
}
|
|
3
|
+
// One Kit-owned lifetime. Account and operation authority stay in Home/Runtime.
|
|
4
|
+
let session: ReturnType<typeof createDesktopNimiAppSession> | null = null;
|
|
5
|
+
export function getTargetAppSession() {
|
|
6
|
+
session ??= createDesktopNimiAppSession();
|
|
7
|
+
return session;
|
|
115
8
|
}
|
|
116
9
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
const result = await openDesktopIntent({ intent: { kind: 'open-apps', appId } });
|
|
122
|
-
if (result.status === 'accepted') return "Nimi is open. When you're done there, select Try again.";
|
|
123
|
-
if (result.reasonCode === 'desktop-open-desktop-not-running') return "Nimi isn't running. Start Nimi, then select Try again.";
|
|
124
|
-
if (result.reasonCode === 'desktop-open-desktop-not-ready') return 'Nimi is still starting. Wait a moment, then select Try again.';
|
|
125
|
-
} catch {
|
|
126
|
-
// Without the verified Host bridge, for example in a plain browser tab,
|
|
127
|
-
// this App cannot ask Nimi to open.
|
|
128
|
-
}
|
|
129
|
-
return "This App couldn't open Nimi. Open Nimi yourself, then select Try again.";
|
|
10
|
+
export function endTargetAppSession(current: ReturnType<typeof createDesktopNimiAppSession>) {
|
|
11
|
+
if (session === current) session = null;
|
|
12
|
+
current.dispose();
|
|
130
13
|
}
|
|
@@ -51,22 +51,6 @@
|
|
|
51
51
|
"path": "SECURITY.md",
|
|
52
52
|
"class": "app-owned product code"
|
|
53
53
|
},
|
|
54
|
-
{
|
|
55
|
-
"path": "src-tauri/build.rs",
|
|
56
|
-
"class": "scaffold-managed glue"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"path": "src-tauri/capabilities/default.json",
|
|
60
|
-
"class": "scaffold-managed glue"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"path": "src-tauri/Cargo.toml",
|
|
64
|
-
"class": "scaffold-managed glue"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"path": "src-tauri/tauri.conf.json",
|
|
68
|
-
"class": "scaffold-managed glue"
|
|
69
|
-
},
|
|
70
54
|
{
|
|
71
55
|
"path": "src/shell/App.tsx",
|
|
72
56
|
"class": "scaffold-managed glue"
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
name: Release immutable Nimi Web bundle
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ['web-v*']
|
|
5
|
+
permissions: {}
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
outputs:
|
|
12
|
+
asset_id: ${{ steps.upload.outputs.artifact-id }}
|
|
13
|
+
version: ${{ steps.release.outputs.version }}
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
16
|
+
with:
|
|
17
|
+
persist-credentials: false
|
|
18
|
+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
|
|
19
|
+
with:
|
|
20
|
+
node-version: '24'
|
|
21
|
+
package-manager-cache: false
|
|
22
|
+
- id: release
|
|
23
|
+
shell: bash
|
|
24
|
+
run: |
|
|
25
|
+
set -euo pipefail
|
|
26
|
+
version="${GITHUB_REF_NAME#web-v}"
|
|
27
|
+
[[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]
|
|
28
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
29
|
+
if grep -Eq 'file:.*(\.tgz|\.nimi/local)|link:|workspace:' pnpm-workspace.yaml pnpm-lock.yaml; then
|
|
30
|
+
echo 'Web production requires published package resolutions in the lockfile.' >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
- run: corepack enable && pnpm install --frozen-lockfile
|
|
34
|
+
env:
|
|
35
|
+
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
|
|
36
|
+
- name: Build the hosted Web release
|
|
37
|
+
env:
|
|
38
|
+
NIMI_WEB_VERSION: ${{ steps.release.outputs.version }}
|
|
39
|
+
NIMI_WEB_ARCHIVE: nimi-web-${{ steps.release.outputs.version }}.zip
|
|
40
|
+
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
|
|
41
|
+
run: |
|
|
42
|
+
if node -e "process.exit(require('./package.json').scripts?.['build:web:release'] ? 0 : 1)"; then
|
|
43
|
+
pnpm run build:web:release
|
|
44
|
+
else
|
|
45
|
+
pnpm run build:release
|
|
46
|
+
fi
|
|
47
|
+
test -s "$NIMI_WEB_ARCHIVE"
|
|
48
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
|
|
49
|
+
id: upload
|
|
50
|
+
with:
|
|
51
|
+
name: hosted-web
|
|
52
|
+
path: nimi-web-*.zip
|
|
53
|
+
if-no-files-found: error
|
|
54
|
+
publish:
|
|
55
|
+
needs: build
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
permissions:
|
|
58
|
+
contents: write
|
|
59
|
+
id-token: write
|
|
60
|
+
attestations: write
|
|
61
|
+
artifact-metadata: write
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
|
|
64
|
+
with:
|
|
65
|
+
artifact-ids: ${{ needs.build.outputs.asset_id }}
|
|
66
|
+
path: release
|
|
67
|
+
- uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6
|
|
68
|
+
with:
|
|
69
|
+
subject-path: release/nimi-web-*.zip
|
|
70
|
+
- name: Publish exact assets
|
|
71
|
+
env:
|
|
72
|
+
GH_TOKEN: ${{ github.token }}
|
|
73
|
+
WEB_VERSION: ${{ needs.build.outputs.version }}
|
|
74
|
+
run: |
|
|
75
|
+
set -euo pipefail
|
|
76
|
+
asset="release/nimi-web-$WEB_VERSION.zip"
|
|
77
|
+
if ! gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
|
78
|
+
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --draft --latest=false --title "Web $WEB_VERSION" --notes "Web release $WEB_VERSION"
|
|
79
|
+
fi
|
|
80
|
+
if [[ "$(gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json isDraft --jq .isDraft)" == true ]]; then
|
|
81
|
+
if gh release download "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" -p "$(basename "$asset")" --dir "$RUNNER_TEMP"; then
|
|
82
|
+
cmp "$asset" "$RUNNER_TEMP/$(basename "$asset")"
|
|
83
|
+
else
|
|
84
|
+
gh release upload "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" "$asset"
|
|
85
|
+
fi
|
|
86
|
+
gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft=false --latest=false
|
|
87
|
+
fi
|
|
88
|
+
for attempt in 1 2 3 4 5 6; do
|
|
89
|
+
if message=$(gh release verify-asset "$GITHUB_REF_NAME" "$asset" --repo "$GITHUB_REPOSITORY" 2>&1); then
|
|
90
|
+
echo "$message"
|
|
91
|
+
break
|
|
92
|
+
fi
|
|
93
|
+
echo "$message" >&2
|
|
94
|
+
if [[ "$message" != *"no attestations found for tag $GITHUB_REF_NAME ("* || "$attempt" == 6 ]]; then
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|
|
97
|
+
sleep 10
|
|
98
|
+
done
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "acme-widget-shell"
|
|
3
|
-
version = "0.1.0"
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[dependencies]
|
|
7
|
-
tauri = { version = "2", features = [] }
|
|
8
|
-
nimi-shell-tauri = "0.1.0"
|
|
9
|
-
serde = { version = "1", features = ["derive"] }
|
|
10
|
-
serde_json = "1"
|
|
11
|
-
url = "2"
|
|
12
|
-
base64 = "0.23"
|
|
13
|
-
dirs = "7"
|
|
14
|
-
time = "=0.3.55"
|
|
15
|
-
|
|
16
|
-
[build-dependencies]
|
|
17
|
-
tauri-build = { version = "2", features = [] }
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-napp-034a
|
|
2
|
-
|
|
3
|
-
const WINDOWS_APP_MANIFEST: &str = r#"
|
|
4
|
-
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
|
5
|
-
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
|
6
|
-
<security>
|
|
7
|
-
<requestedPrivileges>
|
|
8
|
-
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
|
9
|
-
</requestedPrivileges>
|
|
10
|
-
</security>
|
|
11
|
-
</trustInfo>
|
|
12
|
-
<dependency>
|
|
13
|
-
<dependentAssembly>
|
|
14
|
-
<assemblyIdentity
|
|
15
|
-
type="win32"
|
|
16
|
-
name="Microsoft.Windows.Common-Controls"
|
|
17
|
-
version="6.0.0.0"
|
|
18
|
-
processorArchitecture="*"
|
|
19
|
-
language="*"
|
|
20
|
-
publicKeyToken="6595b64144ccf1df" /> <!-- pragma: allowlist secret; public Microsoft Common Controls token. -->
|
|
21
|
-
</dependentAssembly>
|
|
22
|
-
</dependency>
|
|
23
|
-
</assembly>
|
|
24
|
-
"#;
|
|
25
|
-
|
|
26
|
-
fn main() {
|
|
27
|
-
println!("cargo:rerun-if-changed=icons/icon.png");
|
|
28
|
-
println!("cargo:rerun-if-changed=icons/icon.ico");
|
|
29
|
-
let windows = tauri_build::WindowsAttributes::new().app_manifest(WINDOWS_APP_MANIFEST);
|
|
30
|
-
let attributes = tauri_build::Attributes::new().windows_attributes(windows);
|
|
31
|
-
tauri_build::try_build(attributes).expect("failed to build Tauri application attributes");
|
|
32
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://schema.tauri.app/capability/2",
|
|
3
|
-
"identifier": "default",
|
|
4
|
-
"description": "Default capability for the Nimi App main window. Grants the Tauri core baseline — notably core:event (allow-listen), which the @nimiplatform/sdk tauri-ipc transport requires to subscribe to runtime bridge stream events (chat.stream and other openStream paths). App-defined runtime_bridge commands are not ACL-gated and need no entry here.",
|
|
5
|
-
"windows": ["main"],
|
|
6
|
-
"permissions": ["core:default"]
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"productName": "Acme Widget",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"identifier": "ai.nimi.apps.acme.widget",
|
|
5
|
-
"build": {
|
|
6
|
-
"beforeDevCommand": "pnpm run dev:renderer",
|
|
7
|
-
"beforeBuildCommand": "pnpm run build",
|
|
8
|
-
"devUrl": "http://127.0.0.1:1466",
|
|
9
|
-
"frontendDist": "../dist"
|
|
10
|
-
},
|
|
11
|
-
"app": {
|
|
12
|
-
"windows": [
|
|
13
|
-
{
|
|
14
|
-
"title": "Acme Widget",
|
|
15
|
-
"width": 1120,
|
|
16
|
-
"height": 760
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
"bundle": {
|
|
21
|
-
"icon": [
|
|
22
|
-
"icons/icon.png",
|
|
23
|
-
"icons/icon.ico"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|