@nimiplatform/app-tools 0.16.0-rc.15 → 0.16.0-rc.18

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 (84) hide show
  1. package/README.md +5 -42
  2. package/bin/nimi-app.mjs +25 -6
  3. package/lib/app-dependency-combinations.mjs +1 -0
  4. package/lib/app-doctor-update.mjs +8 -6
  5. package/lib/app-info.mjs +39 -19
  6. package/lib/app-lifecycle-guidance.mjs +1 -1
  7. package/lib/app-pack.mjs +4 -1
  8. package/lib/app-project-lifecycle.mjs +32 -12
  9. package/lib/app-resources.mjs +36 -0
  10. package/lib/app-scaffold-profiles.mjs +1 -1
  11. package/lib/app-scaffold.mjs +11 -13
  12. package/lib/index.mjs +7 -0
  13. package/lib/public-storefront.mjs +327 -0
  14. package/lib/storefront-media.mjs +8 -4
  15. package/lib/storefront-pack.mjs +152 -0
  16. package/lib/storefront-release-verification.mjs +31 -0
  17. package/lib/storefront-source.mjs +161 -0
  18. package/lib/web-coordination.mjs +4 -1
  19. package/lib/web-scaffold.mjs +3 -3
  20. package/package.json +9 -6
  21. package/scripts/sync-app-source.mjs +5 -12
  22. package/skills/nimi-app-lifecycle/SKILL.md +1 -0
  23. package/skills/nimi-app-lifecycle/references/storefront.md +28 -0
  24. package/templates/app-source/src/ai-studio-core/ai-config.ts +12 -0
  25. package/templates/app-source/src/ai-studio-core/ai-studio-core.css +138 -117
  26. package/templates/app-source/src/ai-studio-core/history.ts +10 -8
  27. package/templates/app-source/src/ai-studio-core/host-context.tsx +1 -0
  28. package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -10
  29. package/templates/app-source/src/ai-studio-core/job-recovery.ts +505 -115
  30. package/templates/app-source/src/ai-studio-core/messages/en.json +55 -9
  31. package/templates/app-source/src/ai-studio-core/messages/zh.json +55 -9
  32. package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +8 -2
  33. package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +2 -0
  34. package/templates/app-source/src/ai-studio-core/parameters.ts +5 -4
  35. package/templates/app-source/src/ai-studio-core/run-target.ts +12 -1
  36. package/templates/app-source/src/ai-studio-core/runtime-types.ts +3 -0
  37. package/templates/app-source/src/ai-studio-core/runtime.ts +50 -12
  38. package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +6 -7
  39. package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +88 -27
  40. package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +33 -0
  41. package/templates/app-source/src/ai-studio-core/section-ai-testing-music-result.tsx +2 -2
  42. package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +10 -3
  43. package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +6 -4
  44. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +121 -40
  45. package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +34 -8
  46. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcript-result.tsx +16 -2
  47. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +18 -7
  48. package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +1 -1
  49. package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +78 -9
  50. package/templates/app-source/src/ai-studio-core/text-media-replay.ts +2 -1
  51. package/templates/app-source/src/ai-studio-core/workspace.tsx +138 -3
  52. package/templates/app-source/src/product-modules/agent-center/index.tsx +19 -3
  53. package/templates/app-source/src/product-modules/agent-conversation/index.tsx +19 -3
  54. package/templates/app-source/src/product-modules/agent-realtime/index.tsx +19 -3
  55. package/templates/app-source/src/product-modules/kit-recipes/gallery.tsx +12 -7
  56. package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-surface.tsx +48 -20
  57. package/templates/app-source/src/studio-modules/studio-create/messages/en.json +2 -2
  58. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +2 -2
  59. package/templates/app-source/src/studio-modules/studio-create/registration.ts +1 -1
  60. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +11 -19
  61. package/templates/app-source/src/studio-modules/studio-media/audio-separate-parameters.tsx +7 -4
  62. package/templates/app-source/src/studio-modules/studio-media/audio-separate-runtime.ts +14 -10
  63. package/templates/app-source/src/studio-modules/studio-media/messages/en.json +3 -1
  64. package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +3 -1
  65. package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +6 -5
  66. package/templates/app-source/src/studio-modules/studio-media/music-transcription-parameters.tsx +19 -11
  67. package/templates/app-source/src/studio-modules/studio-media/music-transcription-runtime.ts +14 -10
  68. package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +54 -16
  69. package/templates/app-source/src/studio-modules/studio-media/runtime.ts +22 -9
  70. package/templates/app-source/src/studio-modules/studio-media/vision-runtime.ts +19 -10
  71. package/templates/app-source/src/studio-modules/studio-media/voice-convert-parameters.tsx +12 -6
  72. package/templates/app-source/src/studio-modules/studio-media/voice-convert-runtime.ts +11 -9
  73. package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +5 -0
  74. package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +5 -0
  75. package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +18 -7
  76. package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +28 -4
  77. package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +12 -8
  78. package/templates/app-source/src/workbench-core/runtime-gate.tsx +171 -44
  79. package/templates/app-source/src/workbench-core/workbench-core.css +226 -23
  80. package/templates/app-source/src/workbench-core/workbench-core.tsx +5 -5
  81. package/templates/app-source.manifest.json +2 -2
  82. package/templates/default-starter/NIMI_APP.md +11 -3
  83. package/templates/default-starter.manifest.json +2 -2
  84. package/templates/storefront-release.yml +97 -0
@@ -41,6 +41,7 @@ export type StudioSpeechTranscribeParameters = {
41
41
  export type StudioVoiceCreateParameters = {
42
42
  creationSource?: 'reference-audio' | 'text-description';
43
43
  referenceAudioFile?: StudioAudioFile;
44
+ referenceAudioUri?: string;
44
45
  languageHints?: string;
45
46
  preferredName?: string;
46
47
  previewText?: string;
@@ -108,8 +109,8 @@ export const studioSpeechTranscribeParameters = defineStudioParameters<StudioSpe
108
109
  mimeType: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
109
110
  language: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
110
111
  timestamps: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
111
- diarization: CLOUD_ONLY_STUDIO_PARAMETER,
112
- speakerCount: CLOUD_ONLY_STUDIO_PARAMETER,
112
+ diarization: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
113
+ speakerCount: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
113
114
  prompt: CLOUD_ONLY_STUDIO_PARAMETER,
114
115
  responseFormat: LOCAL_TEXT_CLOUD_CONFIGURABLE,
115
116
  },
@@ -122,21 +123,44 @@ export const studioSpeechTranscribeParameters = defineStudioParameters<StudioSpe
122
123
  hasAlternativeInput: (parameters) => Boolean(parameters.audioFile),
123
124
  });
124
125
 
126
+ export function voiceReferenceInput(selection?: import('@nimiplatform/sdk/ai').NimiAIConfigEffectiveSelection) {
127
+ const resource = selection?.resource;
128
+ return resource?.oneofKind === 'cloud' ? resource.cloud.target.referenceAudioInput
129
+ : resource?.oneofKind === 'local' ? resource.local.referenceAudioInput : undefined;
130
+ }
131
+
125
132
  export const studioVoiceCreateParameters = defineStudioParameters<StudioVoiceCreateParameters>({
126
133
  initial: () => ({ creationSource: 'text-description' }),
127
134
  routeMatrix: {
128
135
  creationSource: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
129
136
  referenceAudioFile: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
137
+ referenceAudioUri: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
130
138
  languageHints: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
131
139
  preferredName: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
132
140
  previewText: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
133
141
  language: LOCAL_AND_CLOUD_STUDIO_PARAMETER,
134
142
  },
135
- summarize: (parameters) => ({
143
+ requiredInputIssue: (parameters, selection, prompt) => {
144
+ if (parameters.creationSource !== 'reference-audio') return undefined;
145
+ const support = voiceReferenceInput(selection);
146
+ if (parameters.referenceAudioUri?.trim()) {
147
+ if (!support?.supportsUri || parameters.referenceAudioFile) return 'Studio.parameters.voiceReferenceUnsupported';
148
+ try {
149
+ const url = new URL(parameters.referenceAudioUri.trim());
150
+ if (url.protocol !== 'https:' || url.username || url.password) return 'Studio.parameters.voiceReferenceUriInvalid';
151
+ } catch { return 'Studio.parameters.voiceReferenceUriInvalid'; }
152
+ } else if (!parameters.referenceAudioFile || !support?.supportsBytes) return 'Studio.parameters.voiceReferenceUnsupported';
153
+ else if (support.mimeTypes.length && !support.mimeTypes.includes(parameters.referenceAudioFile.mimeType)) return 'Studio.parameters.voiceReferenceMimeUnsupported';
154
+ if (support?.textMode === 'unsupported' && prompt?.trim()) return 'Studio.parameters.voiceReferenceClearText';
155
+ if (support?.textMode === 'required' && !prompt?.trim()) return 'Studio.parameters.voiceReferenceNeedsText';
156
+ return undefined;
157
+ },
158
+ summarize: ({ referenceAudioUri, ...parameters }) => ({
136
159
  ...parameters,
160
+ ...(referenceAudioUri ? { referenceAudioSource: 'uri' } : {}),
137
161
  ...(parameters.referenceAudioFile ? {
138
162
  referenceAudioFile: `${parameters.referenceAudioFile.name} (${parameters.referenceAudioFile.sizeBytes} bytes)`,
139
163
  } : {}),
140
164
  }),
141
- hasAlternativeInput: (parameters) => Boolean(parameters.referenceAudioFile),
165
+ hasAlternativeInput: (parameters) => parameters.creationSource === 'reference-audio' && Boolean(parameters.referenceAudioFile || parameters.referenceAudioUri?.trim()),
142
166
  });
@@ -69,6 +69,7 @@ async function runSpeechSynthesize(context: StudioCapabilityRuntimeContext) {
69
69
  surfaceId: context.host.surfaceId,
70
70
  observationSignal: context.input.observationSignal,
71
71
  onObservation: context.input.onObservation,
72
+ onJobUpdate: context.input.onJobUpdate,
72
73
  ...(context.input.signal ? {
73
74
  signal: context.input.signal,
74
75
  abortReason: context.host.abortReason,
@@ -123,6 +124,7 @@ async function runSpeechTranscribe(context: StudioCapabilityRuntimeContext) {
123
124
  surfaceId: context.host.surfaceId,
124
125
  observationSignal: context.input.observationSignal,
125
126
  onObservation: context.input.onObservation,
127
+ onJobUpdate: context.input.onJobUpdate,
126
128
  ...(context.input.signal ? {
127
129
  signal: context.input.signal,
128
130
  abortReason: context.host.abortReason,
@@ -163,16 +165,17 @@ async function runVoiceCreate(context: StudioCapabilityRuntimeContext) {
163
165
  }
164
166
  const parameters = context.input.parameters as StudioVoiceCreateParameters | undefined;
165
167
  const creationSource = parameters?.creationSource ?? 'reference-audio';
166
- if (!context.prompt && !parameters?.referenceAudioFile) return inputRequired(context);
168
+ const uri = parameters?.referenceAudioUri?.trim() ?? '';
169
+ const audio = parameters?.referenceAudioFile;
170
+ if (creationSource === 'text-description' && !context.prompt) return inputRequired(context);
167
171
  if (creationSource === 'reference-audio') {
168
- const audio = parameters?.referenceAudioFile;
169
- if (!audio || audio.sizeBytes === 0
172
+ if (Boolean(uri) === Boolean(audio) || (audio && (audio.sizeBytes === 0
170
173
  || audio.sizeBytes > MAX_STUDIO_VOICE_REFERENCE_AUDIO_BYTES
171
- || !audio.mimeType.startsWith('audio/')) {
174
+ || !audio.mimeType.startsWith('audio/')))) {
172
175
  return context.host.nonSuccess(
173
176
  context.capability,
174
177
  'input-invalid',
175
- 'Reference-audio voice creation requires a non-empty audio file up to 20 MiB with an audio MIME type.',
178
+ context.host.translate('Studio.parameters.voiceReferenceUnsupported'),
176
179
  );
177
180
  }
178
181
  }
@@ -196,9 +199,9 @@ async function runVoiceCreate(context: StudioCapabilityRuntimeContext) {
196
199
  source: {
197
200
  oneofKind: 'referenceAudio',
198
201
  referenceAudio: {
199
- referenceAudioBytes: parameters!.referenceAudioFile!.bytes,
200
- referenceAudioUri: '',
201
- referenceAudioMime: parameters!.referenceAudioFile!.mimeType,
202
+ referenceAudioBytes: audio?.bytes ?? new Uint8Array(),
203
+ referenceAudioUri: uri,
204
+ referenceAudioMime: audio?.mimeType ?? '',
202
205
  languageHints: commaSeparatedTokens(parameters?.languageHints),
203
206
  preferredName: parameters?.preferredName?.trim() ?? '',
204
207
  text: context.prompt,
@@ -229,6 +232,7 @@ async function runVoiceCreate(context: StudioCapabilityRuntimeContext) {
229
232
  },
230
233
  observationSignal: context.input.observationSignal,
231
234
  onObservation: context.input.onObservation,
235
+ onJobUpdate: context.input.onJobUpdate,
232
236
  ...(context.input.signal ? {
233
237
  signal: context.input.signal,
234
238
  abortReason: context.host.abortReason,
@@ -1,6 +1,6 @@
1
- import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';
1
+ import { useCallback, useEffect, useId, useRef, useState, type ReactNode } from 'react';
2
2
  import { OfflineCoordinator, type OfflineTier } from '@nimiplatform/kit/core/offline-coordinator';
3
- import { Button, InlineAlert, StatusBadge, Surface } from '@nimiplatform/kit/ui';
3
+ import { Button, StatusBadge, Surface } from '@nimiplatform/kit/ui';
4
4
 
5
5
  // @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-019c
6
6
 
@@ -20,6 +20,7 @@ export type WorkbenchRuntimeGateProjection =
20
20
  | { readonly status: 'ready' }
21
21
  | {
22
22
  readonly status: 'unavailable';
23
+ readonly title?: string;
23
24
  readonly body: string;
24
25
  readonly signInRequired: boolean;
25
26
  readonly nextAction?: string;
@@ -30,17 +31,22 @@ export type WorkbenchRuntimeGateProjection =
30
31
 
31
32
  export type WorkbenchRuntimeGateCopy = {
32
33
  readonly checking: string;
34
+ readonly checkingHint?: string;
33
35
  readonly setupRequired: string;
34
36
  readonly signInRequired: string;
35
37
  readonly connectionRequired: string;
36
38
  readonly retry: string;
37
39
  readonly offlineTier: (tier: OfflineTier) => string;
38
40
  readonly nextAction: (action: string) => string;
41
+ readonly stepLabel?: string;
42
+ readonly recheckStillUnavailable?: string;
43
+ readonly protectionLabel?: string;
39
44
  readonly technicalDetails: string;
40
45
  };
41
46
 
42
47
  export type WorkbenchRuntimeGateProps = {
43
48
  readonly appTitle: string;
49
+ readonly brandMark?: ReactNode;
44
50
  readonly copy: WorkbenchRuntimeGateCopy;
45
51
  readonly resolve: () => Promise<WorkbenchRuntimeGateProjection>;
46
52
  readonly clear: () => void;
@@ -69,8 +75,44 @@ type WorkbenchRuntimeGateRecoveryState =
69
75
  | { readonly kind: 'running' }
70
76
  | { readonly kind: 'done'; readonly message: string };
71
77
 
78
+ function DesktopConnectionIcon() {
79
+ return (
80
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
81
+ <path d="M10 13a5 5 0 0 0 7.54.54l2-2a5 5 0 0 0-7.07-7.07l-1.42 1.41" />
82
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-2 2a5 5 0 0 0 7.07 7.07l1.41-1.41" />
83
+ </svg>
84
+ );
85
+ }
86
+
87
+ function AccountSignInIcon() {
88
+ return (
89
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
90
+ <circle cx="12" cy="8" r="4" />
91
+ <path d="M5.5 20a6.5 6.5 0 0 1 13 0" />
92
+ </svg>
93
+ );
94
+ }
95
+
96
+ function RefreshActionIcon() {
97
+ return (
98
+ <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
99
+ <path d="M21 12a9 9 0 1 1-2.64-6.36" />
100
+ <path d="M21 3v6h-6" />
101
+ </svg>
102
+ );
103
+ }
104
+
105
+ function ChevronDisclosureIcon() {
106
+ return (
107
+ <svg className="runtime-gate-details__chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
108
+ <path d="m9 18 6-6-6-6" />
109
+ </svg>
110
+ );
111
+ }
112
+
72
113
  export function WorkbenchRuntimeGate({
73
114
  appTitle,
115
+ brandMark,
74
116
  copy,
75
117
  resolve,
76
118
  clear,
@@ -79,14 +121,19 @@ export function WorkbenchRuntimeGate({
79
121
  onRevalidated,
80
122
  children,
81
123
  }: WorkbenchRuntimeGateProps) {
124
+ const titleId = useId();
82
125
  const [offlineCoordinator] = useState(() => new OfflineCoordinator());
83
126
  const [state, setState] = useState<WorkbenchRuntimeGateState>({ kind: 'checking' });
127
+ const [rechecking, setRechecking] = useState(false);
128
+ const [manualRetryNotice, setManualRetryNotice] = useState(false);
84
129
  const [reloadKey, setReloadKey] = useState(0);
85
130
  const [recovery, setRecovery] = useState<WorkbenchRuntimeGateRecoveryState>({ kind: 'idle' });
86
131
  // A recovery result belongs to the blocked check that offered it.
87
132
  const recoveryGeneration = useRef(0);
88
133
  // One re-check at a time answers every loss reported while it runs.
89
134
  const revalidating = useRef(false);
135
+ const checkInFlight = useRef(false);
136
+ const manualRetryPending = useRef(false);
90
137
  const onRevalidatedRef = useRef(onRevalidated);
91
138
  onRevalidatedRef.current = onRevalidated;
92
139
 
@@ -102,8 +149,22 @@ export function WorkbenchRuntimeGate({
102
149
  });
103
150
  }, [clear, revalidate]);
104
151
 
152
+ useEffect(() => {
153
+ if (state.kind !== 'blocked' || typeof window === 'undefined') return undefined;
154
+ const onFocus = () => {
155
+ if (checkInFlight.current) return;
156
+ clear();
157
+ setReloadKey((value) => value + 1);
158
+ };
159
+ window.addEventListener('focus', onFocus);
160
+ return () => window.removeEventListener('focus', onFocus);
161
+ }, [clear, state.kind]);
162
+
105
163
  const retry = useCallback(() => {
164
+ if (checkInFlight.current) return;
106
165
  recoveryGeneration.current += 1;
166
+ manualRetryPending.current = true;
167
+ setManualRetryNotice(false);
107
168
  setRecovery({ kind: 'idle' });
108
169
  clear();
109
170
  setReloadKey((value) => value + 1);
@@ -124,22 +185,28 @@ export function WorkbenchRuntimeGate({
124
185
 
125
186
  useEffect(() => {
126
187
  let active = true;
127
- // A re-run triggered by a changed resolve/toErrorMessage identity (for
128
- // example a locale switch) must not tear down the ready subtree: keep the
129
- // current state while re-checking, and only surface the checking screen
130
- // when no successful check has completed yet.
131
- setState((current) => (current.kind === 'ready' ? current : { kind: 'checking' }));
188
+ checkInFlight.current = true;
189
+ const wasManualRetry = manualRetryPending.current;
190
+ manualRetryPending.current = false;
191
+ // A re-run triggered by a manual retry, focus check, or locale switch must
192
+ // not tear down the ready subtree or flash-unmount the blocked panel.
193
+ setState((current) => (current.kind === 'ready' || current.kind === 'blocked' ? current : { kind: 'checking' }));
194
+ setRechecking(true);
132
195
  void resolve().then((projection) => {
133
196
  if (!active) return;
197
+ checkInFlight.current = false;
198
+ setRechecking(false);
134
199
  const revalidated = revalidating.current;
135
200
  revalidating.current = false;
136
201
  if (projection.status === 'ready') {
202
+ setManualRetryNotice(false);
137
203
  offlineCoordinator.markRuntimeReachability('reachable');
138
204
  setState({ kind: 'ready' });
139
205
  if (revalidated) onRevalidatedRef.current?.();
140
206
  return;
141
207
  }
142
208
  offlineCoordinator.markRuntimeReachability('unreachable');
209
+ if (wasManualRetry) setManualRetryNotice(true);
143
210
  setState({
144
211
  kind: 'blocked',
145
212
  projection,
@@ -147,8 +214,11 @@ export function WorkbenchRuntimeGate({
147
214
  });
148
215
  }).catch((error) => {
149
216
  if (!active) return;
217
+ checkInFlight.current = false;
218
+ setRechecking(false);
150
219
  revalidating.current = false;
151
220
  offlineCoordinator.markRuntimeReachability('unreachable');
221
+ if (wasManualRetry) setManualRetryNotice(true);
152
222
  setState({
153
223
  kind: 'blocked',
154
224
  projection: {
@@ -161,13 +231,29 @@ export function WorkbenchRuntimeGate({
161
231
  });
162
232
  return () => {
163
233
  active = false;
234
+ checkInFlight.current = false;
164
235
  };
165
236
  }, [offlineCoordinator, reloadKey, resolve, toErrorMessage]);
166
237
 
238
+ const brandIdentity = (
239
+ <div className="runtime-gate-brand">
240
+ <span className="runtime-gate-brand__mark" aria-hidden="true">
241
+ {brandMark ?? appTitle.trim().slice(0, 1).toUpperCase()}
242
+ </span>
243
+ <span className="runtime-gate-brand__title">{appTitle}</span>
244
+ </div>
245
+ );
246
+
167
247
  if (state.kind === 'checking') {
168
248
  return (
169
- <main className="runtime-check-screen">
170
- <StatusBadge tone="neutral" shape="dot">{copy.checking}</StatusBadge>
249
+ <main className="runtime-check-screen" aria-live="polite" aria-busy="true">
250
+ <Surface className="runtime-check-panel" material="glass-thick" tone="card" elevation="floating" padding="none">
251
+ <div className="runtime-gate-topbar">
252
+ {brandIdentity}
253
+ <StatusBadge tone="neutral" shape="dot">{copy.checking}</StatusBadge>
254
+ </div>
255
+ {copy.checkingHint ? <p className="runtime-check-hint">{copy.checkingHint}</p> : null}
256
+ </Surface>
171
257
  </main>
172
258
  );
173
259
  }
@@ -175,49 +261,90 @@ export function WorkbenchRuntimeGate({
175
261
  if (state.kind === 'blocked') {
176
262
  const { projection } = state;
177
263
  const recoveryAction = projection.recoveryAction;
264
+ const headline = projection.title || (projection.signInRequired ? copy.signInRequired : copy.connectionRequired);
265
+ const badgeTone = projection.signInRequired ? 'warning' : 'info';
266
+ const feedbackMessage = recovery.kind === 'done'
267
+ ? recovery.message
268
+ : (manualRetryNotice && !rechecking ? copy.recheckStillUnavailable : undefined);
178
269
  return (
179
- <main className="runtime-unavailable-screen" aria-live="polite">
180
- <Surface className="runtime-unavailable-panel" material="glass-thick" tone="panel" elevation="floating">
181
- <div className="runtime-unavailable-heading">
182
- <StatusBadge tone="info" shape="dot">{copy.setupRequired}</StatusBadge>
183
- <h1>{appTitle}</h1>
270
+ <main className="runtime-unavailable-screen" aria-labelledby={titleId} aria-live="polite">
271
+ <Surface className="runtime-unavailable-panel" material="glass-thick" tone="card" elevation="floating" padding="none">
272
+ <div className="runtime-gate-topbar">
273
+ {brandIdentity}
274
+ <StatusBadge tone={badgeTone} shape="dot">{copy.setupRequired}</StatusBadge>
275
+ </div>
276
+
277
+ <div className="runtime-gate-hero">
278
+ <span className="runtime-gate-icon" data-tone={badgeTone}>
279
+ {projection.signInRequired ? <AccountSignInIcon /> : <DesktopConnectionIcon />}
280
+ </span>
281
+ <h1 id={titleId}>{headline}</h1>
282
+ <p className="runtime-gate-summary">{projection.body}</p>
184
283
  </div>
185
- <InlineAlert tone="info">
186
- <div className="runtime-alert-copy">
187
- <strong>{projection.signInRequired ? copy.signInRequired : copy.connectionRequired}</strong>
188
- <span>{projection.body}</span>
284
+
285
+ {projection.nextAction ? (
286
+ <div className="runtime-gate-guidance">
287
+ {copy.stepLabel ? <span className="runtime-gate-guidance__label">{copy.stepLabel}</span> : null}
288
+ <p className="runtime-action-hint">
289
+ {copy.stepLabel ? projection.nextAction : copy.nextAction(projection.nextAction)}
290
+ </p>
189
291
  </div>
190
- </InlineAlert>
191
- {projection.nextAction ? <p className="runtime-action-hint">{copy.nextAction(projection.nextAction)}</p> : null}
192
- <div className="runtime-gate-actions">
193
- <Button type="button" tone="primary" onClick={retry}>{copy.retry}</Button>
194
- {recoveryAction ? (
292
+ ) : null}
293
+
294
+ <div className="runtime-gate-action-group">
295
+ <div className="runtime-gate-actions">
195
296
  <Button
196
297
  type="button"
197
- tone="secondary"
198
- loading={recovery.kind === 'running'}
199
- disabled={recovery.kind === 'running'}
200
- onClick={() => runRecovery(recoveryAction)}
298
+ tone="primary"
299
+ loading={rechecking}
300
+ disabled={rechecking}
301
+ leadingIcon={!rechecking ? <RefreshActionIcon /> : undefined}
302
+ onClick={retry}
201
303
  >
202
- {recoveryAction.label}
304
+ {copy.retry}
203
305
  </Button>
204
- ) : null}
306
+ {recoveryAction ? (
307
+ <Button
308
+ type="button"
309
+ tone="secondary"
310
+ loading={recovery.kind === 'running'}
311
+ disabled={recovery.kind === 'running' || rechecking}
312
+ onClick={() => runRecovery(recoveryAction)}
313
+ >
314
+ {recoveryAction.label}
315
+ </Button>
316
+ ) : null}
317
+ </div>
318
+ {feedbackMessage ? <p className="runtime-gate-feedback" role="status">{feedbackMessage}</p> : null}
319
+ </div>
320
+
321
+ <div className="runtime-gate-footer">
322
+ <details className="runtime-gate-details">
323
+ <summary>
324
+ <ChevronDisclosureIcon />
325
+ <span>{copy.technicalDetails}</span>
326
+ </summary>
327
+ <div className="runtime-gate-details__body">
328
+ {projection.technicalDetails?.length || copy.protectionLabel ? (
329
+ <dl>
330
+ {projection.technicalDetails?.map((detail) => (
331
+ <div key={detail.label}>
332
+ <dt>{detail.label}</dt>
333
+ <dd>{detail.value}</dd>
334
+ </div>
335
+ ))}
336
+ {copy.protectionLabel ? (
337
+ <div>
338
+ <dt>{copy.protectionLabel}</dt>
339
+ <dd>{state.offlineTier}</dd>
340
+ </div>
341
+ ) : null}
342
+ </dl>
343
+ ) : null}
344
+ {!copy.protectionLabel ? <p>{copy.offlineTier(state.offlineTier)}</p> : null}
345
+ </div>
346
+ </details>
205
347
  </div>
206
- {recovery.kind === 'done' ? <p className="runtime-action-hint" role="status">{recovery.message}</p> : null}
207
- <details className="runtime-gate-details">
208
- <summary>{copy.technicalDetails}</summary>
209
- {projection.technicalDetails?.length ? (
210
- <dl>
211
- {projection.technicalDetails.map((detail) => (
212
- <div key={detail.label}>
213
- <dt>{detail.label}</dt>
214
- <dd>{detail.value}</dd>
215
- </div>
216
- ))}
217
- </dl>
218
- ) : null}
219
- <p>{copy.offlineTier(state.offlineTier)}</p>
220
- </details>
221
348
  </Surface>
222
349
  </main>
223
350
  );