@nimiplatform/app-tools 0.13.1 → 0.16.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +65 -8
  2. package/bin/nimi-app.mjs +26 -10
  3. package/lib/app-access-declaration.mjs +3 -0
  4. package/lib/app-dependency-combinations.mjs +70 -20
  5. package/lib/app-doctor-update.mjs +95 -36
  6. package/lib/app-host-support.mjs +6 -0
  7. package/lib/app-icons.mjs +181 -0
  8. package/lib/app-identifiers.mjs +27 -0
  9. package/lib/app-info.mjs +21 -33
  10. package/lib/app-lifecycle-guidance.mjs +2 -1
  11. package/lib/app-pack.mjs +14 -36
  12. package/lib/app-project-lifecycle.mjs +141 -243
  13. package/lib/app-scaffold-capabilities.mjs +13 -109
  14. package/lib/app-scaffold-profiles.mjs +108 -117
  15. package/lib/app-scaffold.mjs +70 -165
  16. package/lib/app-toolchain-updates.mjs +45 -0
  17. package/lib/canonical-capability-ids.generated.mjs +2 -0
  18. package/lib/development-environment.d.mts +10 -0
  19. package/lib/development-environment.mjs +39 -0
  20. package/lib/hosted-web-release.mjs +98 -0
  21. package/lib/index.mjs +40 -1
  22. package/lib/mobile-development.mjs +19 -0
  23. package/lib/realm-environments.generated.mjs +5 -0
  24. package/lib/web-coordination.mjs +59 -0
  25. package/lib/web-development.d.mts +23 -0
  26. package/lib/web-development.mjs +118 -0
  27. package/lib/web-scaffold.mjs +125 -0
  28. package/package.json +39 -27
  29. package/scripts/dev-shell.mjs +4 -1
  30. package/scripts/sync-scaffold-versions.mjs +0 -2
  31. package/skills/nimi-app-lifecycle/SKILL.md +13 -5
  32. package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
  33. package/skills/nimi-app-lifecycle/references/adapt.md +7 -3
  34. package/skills/nimi-app-lifecycle/references/audit.md +3 -2
  35. package/skills/nimi-app-lifecycle/references/create.md +8 -2
  36. package/skills/nimi-app-lifecycle/references/release.md +2 -0
  37. package/skills/nimi-app-lifecycle/references/upgrade-platform.md +15 -1
  38. package/templates/app-source/src/ai-studio-core/ai-studio-core.css +87 -52
  39. package/templates/app-source/src/ai-studio-core/history-policy.ts +45 -11
  40. package/templates/app-source/src/ai-studio-core/history.ts +22 -11
  41. package/templates/app-source/src/ai-studio-core/host-context.tsx +9 -4
  42. package/templates/app-source/src/ai-studio-core/index.ts +2 -0
  43. package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -5
  44. package/templates/app-source/src/ai-studio-core/job-recovery.ts +2 -2
  45. package/templates/app-source/src/ai-studio-core/messages/en.json +79 -19
  46. package/templates/app-source/src/ai-studio-core/messages/zh.json +79 -19
  47. package/templates/app-source/src/ai-studio-core/module-registration.ts +1 -0
  48. package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +40 -5
  49. package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +12 -6
  50. package/templates/app-source/src/ai-studio-core/parameters.ts +4 -0
  51. package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +42 -0
  52. package/templates/app-source/src/ai-studio-core/runtime-types.ts +9 -2
  53. package/templates/app-source/src/ai-studio-core/runtime.ts +8 -4
  54. package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +98 -90
  55. package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +1 -1
  56. package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +205 -48
  57. package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +1 -0
  58. package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +36 -14
  59. package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +102 -77
  60. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +62 -16
  61. package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +2 -0
  62. package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +12 -21
  63. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +26 -9
  64. package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +3 -3
  65. package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +182 -81
  66. package/templates/app-source/src/ai-studio-core/workspace.tsx +49 -22
  67. package/templates/app-source/src/product-modules/agent-center/index.tsx +2 -3
  68. package/templates/app-source/src/product-modules/agent-conversation/index.tsx +2 -3
  69. package/templates/app-source/src/studio-modules/studio-create/messages/en.json +17 -3
  70. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +17 -3
  71. package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +33 -1
  72. package/templates/app-source/src/studio-modules/studio-create/parameters.ts +3 -1
  73. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -4
  74. package/templates/app-source/src/studio-modules/studio-media/messages/en.json +59 -8
  75. package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +59 -8
  76. package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +2 -1
  77. package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +271 -83
  78. package/templates/app-source/src/studio-modules/studio-media/parameters.ts +120 -2
  79. package/templates/app-source/src/studio-modules/studio-media/registration.ts +1 -0
  80. package/templates/app-source/src/studio-modules/studio-media/runtime.ts +24 -14
  81. package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +1 -1
  82. package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +3 -2
  83. package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +3 -2
  84. package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +46 -23
  85. package/templates/app-source/src/studio-modules/studio-voice/registration.ts +2 -1
  86. package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +2 -2
  87. package/templates/app-source/src/workbench-core/workbench-core.tsx +27 -3
  88. package/templates/default-starter/AGENTS.md +8 -5
  89. package/templates/default-starter/NIMI_APP.md +7 -0
  90. package/templates/default-starter/README.md +3 -1
  91. package/templates/default-starter/src/shell/App.tsx +12 -20
  92. package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
  93. package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
  94. package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
  95. package/templates/default-starter.manifest.json +4 -16
  96. package/templates/hosted-web-release.yml +88 -0
  97. package/templates/default-starter/src-tauri/Cargo.toml +0 -17
  98. package/templates/default-starter/src-tauri/build.rs +0 -32
  99. package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
  100. package/templates/default-starter/src-tauri/tauri.conf.json +0 -26
@@ -1,37 +1,29 @@
1
- import { WorkbenchRuntimeGate } from '../workbench-core/index.js';
1
+ import { NimiAppSessionProvider, NimiAppAccessGate } from '@nimiplatform/kit/auth/app';
2
2
  import { NimiToaster } from '@nimiplatform/kit/ui';
3
3
  import { NimiAppChrome } from '@nimiplatform/kit/ui/app-chrome';
4
4
  import appPackage from '../../package.json';
5
5
  import { hasGeneratedViews } from '../scaffold/generated/navigation.js';
6
6
  import { AppNavigationProvider, useAppNavigation } from './routes/app-navigation.js';
7
7
  import { AuthenticatedShell } from './authenticated-shell.js';
8
- import {
9
- appTitle,
10
- clearTargetRuntimeGate,
11
- resolveTargetRuntimeGate,
12
- targetRuntimeGateCopy,
13
- targetRuntimeGateErrorMessage,
14
- } from './workbench-target-adapter.js';
8
+ import { appTitle } from './auth/app-identity.js';
9
+ import { getTargetAppSession } from './workbench-target-adapter.js';
15
10
 
16
11
  export function App() {
17
- return <AppNavigationProvider><AppFrame /></AppNavigationProvider>;
12
+ return <NimiAppSessionProvider session={getTargetAppSession()}><AppNavigationProvider><AppFrame /></AppNavigationProvider></NimiAppSessionProvider>;
18
13
  }
19
14
  function AppFrame() {
20
15
  const owner = useAppNavigation();
16
+ // Optional App-owned presentation choices keep product chrome with its owner.
17
+ const sidebarAvailable = 'sidebarAvailable' in owner ? owner.sidebarAvailable === true : hasGeneratedViews;
18
+ const locale = 'locale' in owner && (owner.locale === 'zh' || owner.locale === 'en')
19
+ ? owner.locale : navigator.language.toLowerCase().startsWith('zh') ? 'zh' : 'en';
21
20
  return (
22
21
  <div className="flex h-full min-h-0 flex-col overflow-hidden">
23
- <NimiAppChrome metadata={{ name: appTitle, version: appPackage.version, license: 'license' in appPackage && typeof appPackage.license === 'string' ? appPackage.license : undefined }} navigation={owner.navigation} navigationEnabled={owner.ready}
24
- sidebar={hasGeneratedViews && owner.ready ? { visible: owner.sidebarVisible, onVisibleChange: owner.setSidebarVisible } : undefined} />
22
+ <NimiAppChrome metadata={{ name: appTitle, version: appPackage.version, license: 'license' in appPackage && typeof appPackage.license === 'string' ? appPackage.license : undefined }} locale={locale} navigation={owner.navigation} navigationEnabled={owner.ready}
23
+ commands={[{ id: 'app.nimi-account', label: locale === 'zh' ? 'Nimi 账号' : 'Nimi account', menu: 'file', state: () => ({ visible: true, enabled: true }), execute: async () => { const account = getTargetAppSession().account; if (account.kind === 'home-managed') await account.openAccountOwner(); } }]}
24
+ sidebar={sidebarAvailable && owner.ready ? { visible: owner.sidebarVisible, onVisibleChange: owner.setSidebarVisible } : undefined} />
25
25
  <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
26
- <WorkbenchRuntimeGate
27
- appTitle={appTitle}
28
- copy={targetRuntimeGateCopy}
29
- resolve={resolveTargetRuntimeGate}
30
- clear={clearTargetRuntimeGate}
31
- toErrorMessage={targetRuntimeGateErrorMessage}
32
- >
33
- <AuthenticatedShell />
34
- </WorkbenchRuntimeGate>
26
+ <NimiAppAccessGate title={appTitle} language={locale}>{() => <AuthenticatedShell />}</NimiAppAccessGate>
35
27
  </div>
36
28
  <NimiToaster />
37
29
  </div>
@@ -1,18 +1,9 @@
1
- import {
2
- createNimiClient,
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
- localAppClient ??= createNimiClient({
13
- localApp: {
14
- standardShell: createNimiLocalAppStandardShellSurface(),
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 { ReasonCode } from '@nimiplatform/sdk/types';
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 const runtimeAccountLoginEnabled = false;
8
- export type RuntimeAuthMode = 'local-app';
9
-
10
- export type RuntimePlatformReadyProjection = {
11
- readonly status: 'ready';
12
- readonly mode: RuntimeAuthMode;
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 { openDesktopIntent } from '@nimiplatform/kit/shell/renderer/bridge';
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
- export { appTitle };
15
-
16
- // Plain copy for people using the App. Reason codes and Runtime hints stay in
17
- // the gate's folded technical details.
18
- export const targetRuntimeGateCopy: WorkbenchRuntimeGateCopy = Object.freeze({
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
- // Brings a running Nimi forward on this App's page. Nimi is never started from
118
- // here, so a closed Nimi gets a plain instruction instead.
119
- async function openNimi(): Promise<string> {
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
  }
@@ -40,28 +40,16 @@
40
40
  "class": "app-owned product code"
41
41
  },
42
42
  {
43
- "path": "scripts/validate.mjs",
44
- "class": "scaffold-managed glue"
45
- },
46
- {
47
- "path": "SECURITY.md",
43
+ "path": "NIMI_APP.md",
48
44
  "class": "app-owned product code"
49
45
  },
50
46
  {
51
- "path": "src-tauri/build.rs",
52
- "class": "scaffold-managed glue"
53
- },
54
- {
55
- "path": "src-tauri/capabilities/default.json",
56
- "class": "scaffold-managed glue"
57
- },
58
- {
59
- "path": "src-tauri/Cargo.toml",
47
+ "path": "scripts/validate.mjs",
60
48
  "class": "scaffold-managed glue"
61
49
  },
62
50
  {
63
- "path": "src-tauri/tauri.conf.json",
64
- "class": "scaffold-managed glue"
51
+ "path": "SECURITY.md",
52
+ "class": "app-owned product code"
65
53
  },
66
54
  {
67
55
  "path": "src/shell/App.tsx",
@@ -0,0 +1,88 @@
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
+ gh release verify-asset "$GITHUB_REF_NAME" "$asset" --repo "$GITHUB_REPOSITORY"
@@ -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.22"
13
- dirs = "6"
14
- time = "=0.3.47"
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
- }