@nimiplatform/app-tools 0.14.0 → 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 (96) hide show
  1. package/README.md +48 -5
  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 -24
  5. package/lib/app-doctor-update.mjs +92 -36
  6. package/lib/app-host-support.mjs +6 -0
  7. package/lib/app-identifiers.mjs +27 -0
  8. package/lib/app-lifecycle-guidance.mjs +1 -1
  9. package/lib/app-pack.mjs +14 -36
  10. package/lib/app-project-lifecycle.mjs +141 -243
  11. package/lib/app-scaffold-capabilities.mjs +13 -109
  12. package/lib/app-scaffold-profiles.mjs +81 -115
  13. package/lib/app-scaffold.mjs +68 -164
  14. package/lib/app-toolchain-updates.mjs +45 -0
  15. package/lib/canonical-capability-ids.generated.mjs +2 -0
  16. package/lib/development-environment.d.mts +10 -0
  17. package/lib/development-environment.mjs +39 -0
  18. package/lib/hosted-web-release.mjs +98 -0
  19. package/lib/index.mjs +40 -1
  20. package/lib/mobile-development.mjs +19 -0
  21. package/lib/realm-environments.generated.mjs +5 -0
  22. package/lib/web-coordination.mjs +59 -0
  23. package/lib/web-development.d.mts +23 -0
  24. package/lib/web-development.mjs +118 -0
  25. package/lib/web-scaffold.mjs +125 -0
  26. package/package.json +32 -21
  27. package/scripts/dev-shell.mjs +4 -1
  28. package/scripts/sync-scaffold-versions.mjs +0 -2
  29. package/skills/nimi-app-lifecycle/SKILL.md +3 -1
  30. package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
  31. package/skills/nimi-app-lifecycle/references/adapt.md +5 -3
  32. package/skills/nimi-app-lifecycle/references/audit.md +3 -2
  33. package/skills/nimi-app-lifecycle/references/create.md +6 -2
  34. package/skills/nimi-app-lifecycle/references/upgrade-platform.md +12 -7
  35. package/templates/app-source/src/ai-studio-core/ai-studio-core.css +87 -52
  36. package/templates/app-source/src/ai-studio-core/history-policy.ts +45 -11
  37. package/templates/app-source/src/ai-studio-core/history.ts +22 -11
  38. package/templates/app-source/src/ai-studio-core/host-context.tsx +9 -4
  39. package/templates/app-source/src/ai-studio-core/index.ts +2 -0
  40. package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -5
  41. package/templates/app-source/src/ai-studio-core/job-recovery.ts +2 -2
  42. package/templates/app-source/src/ai-studio-core/messages/en.json +73 -19
  43. package/templates/app-source/src/ai-studio-core/messages/zh.json +73 -19
  44. package/templates/app-source/src/ai-studio-core/module-registration.ts +1 -0
  45. package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +30 -5
  46. package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +12 -6
  47. package/templates/app-source/src/ai-studio-core/parameters.ts +4 -0
  48. package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +42 -0
  49. package/templates/app-source/src/ai-studio-core/runtime-types.ts +9 -2
  50. package/templates/app-source/src/ai-studio-core/runtime.ts +8 -4
  51. package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +98 -90
  52. package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +1 -1
  53. package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +205 -48
  54. package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +1 -0
  55. package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +36 -14
  56. package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +96 -75
  57. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +59 -16
  58. package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +2 -0
  59. package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +12 -21
  60. package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +2 -2
  61. package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +3 -3
  62. package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +158 -76
  63. package/templates/app-source/src/ai-studio-core/workspace.tsx +49 -22
  64. package/templates/app-source/src/product-modules/agent-center/index.tsx +2 -3
  65. package/templates/app-source/src/product-modules/agent-conversation/index.tsx +2 -3
  66. package/templates/app-source/src/studio-modules/studio-create/messages/en.json +12 -3
  67. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +12 -3
  68. package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
  69. package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
  70. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -5
  71. package/templates/app-source/src/studio-modules/studio-media/messages/en.json +59 -8
  72. package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +59 -8
  73. package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +2 -1
  74. package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +271 -83
  75. package/templates/app-source/src/studio-modules/studio-media/parameters.ts +120 -2
  76. package/templates/app-source/src/studio-modules/studio-media/registration.ts +1 -0
  77. package/templates/app-source/src/studio-modules/studio-media/runtime.ts +24 -14
  78. package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +1 -1
  79. package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +3 -2
  80. package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +3 -2
  81. package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +46 -23
  82. package/templates/app-source/src/studio-modules/studio-voice/registration.ts +2 -1
  83. package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +2 -2
  84. package/templates/app-source/src/workbench-core/workbench-core.tsx +27 -3
  85. package/templates/default-starter/AGENTS.md +3 -3
  86. package/templates/default-starter/README.md +1 -1
  87. package/templates/default-starter/src/shell/App.tsx +6 -18
  88. package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
  89. package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
  90. package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
  91. package/templates/default-starter.manifest.json +0 -16
  92. package/templates/hosted-web-release.yml +88 -0
  93. package/templates/default-starter/src-tauri/Cargo.toml +0 -17
  94. package/templates/default-starter/src-tauri/build.rs +0 -32
  95. package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
  96. package/templates/default-starter/src-tauri/tauri.conf.json +0 -26
@@ -1,5 +1,5 @@
1
1
  import { useId, useState, type ChangeEvent, type ReactNode } from 'react';
2
- import { Button, IconButton, InlineAlert, NimiText, TextareaField, Tooltip } from '@nimiplatform/kit/ui';
2
+ import { Button, IconButton, InlineAlert, NimiText, TextareaField } from '@nimiplatform/kit/ui';
3
3
  import { ArrowUp, Paperclip, Play, Plus, RefreshCw, ScanSearch, SlidersHorizontal, X } from 'lucide-react';
4
4
  import type { BrowserDataUrlAttachment } from '@nimiplatform/kit/features/chat/headless';
5
5
  import { useAIStudioHost } from './host-context.js';
@@ -37,6 +37,7 @@ function IntentSummaryChip({
37
37
  leadingIcon={<SlidersHorizontal size={15} aria-hidden="true" />}
38
38
  onClick={onOpen}
39
39
  aria-label={t('Studio.composer.openIntentConfig')}
40
+ title={label}
40
41
  >
41
42
  {label}
42
43
  </Button>
@@ -61,6 +62,8 @@ export function TextStudioComposer({
61
62
  parameterPanel,
62
63
  parametersActive = false,
63
64
  hasAlternativeInput = false,
65
+ promptEnabled = true,
66
+ inputIssue,
64
67
  onPromptChange,
65
68
  onContextChange,
66
69
  onOpenIntentConfig,
@@ -83,6 +86,8 @@ export function TextStudioComposer({
83
86
  parameterPanel?: ReactNode;
84
87
  parametersActive?: boolean;
85
88
  hasAlternativeInput?: boolean;
89
+ promptEnabled?: boolean;
90
+ inputIssue?: string;
86
91
  onPromptChange: (value: string) => void;
87
92
  onContextChange: (value: string) => void;
88
93
  onOpenIntentConfig?: () => void;
@@ -93,13 +98,14 @@ export function TextStudioComposer({
93
98
  const profile = registration.profile;
94
99
  const isVisionLocate = capability.id === 'vision.locate';
95
100
  const queryInputId = useId();
101
+ const inputIssueId = useId();
96
102
  const isReadOnlyComposer = profile.inputKind === 'none';
97
103
  const requiresPrompt = !isReadOnlyComposer;
98
104
  const contextAttached = Boolean(context.trim());
99
105
  const supportsContext = requiresPrompt && !usesVerbatimStudioPrompt(capability.id) && !profile.rawPrompt;
100
106
  const [contextOpen, setContextOpen] = useState(false);
101
107
  const [parametersOpen, setParametersOpen] = useState(false);
102
- const promptReady = hasStudioCapabilityRunInput({ requiresPrompt, prompt, hasAlternativeInput })
108
+ const promptReady = !inputIssue && hasStudioCapabilityRunInput({ requiresPrompt, prompt: promptEnabled ? prompt : '', hasAlternativeInput })
103
109
  && ((capability.id !== 'music.transcribe' && capability.id !== 'audio.voice.convert' && capability.id !== 'audio.separate') || hasAlternativeInput)
104
110
  && (!profile.requiresParameterInput || hasAlternativeInput)
105
111
  && (!isVisionLocate || (attachments.length === 1 && attachments[0]?.kind === 'image'));
@@ -112,6 +118,10 @@ export function TextStudioComposer({
112
118
  : intentConfigAction
113
119
  ? t('Studio.composer.configureIntent')
114
120
  : t(profile.primaryLabelKey);
121
+ const visibleInputIssue = running ? undefined : inputIssue ?? (!promptReady ? t('Studio.composer.inputRequired') : undefined);
122
+ const hasPromptField = !isReadOnlyComposer && promptEnabled;
123
+ const hasAttachmentControls = profile.supportsAttachments && !isVisionLocate;
124
+ const canRunFromPrompt = hasPromptField && !intentConfigAction && !generateDisabled;
115
125
  const composerBar = (
116
126
  <div className="studio-composer__bar">
117
127
  <div className="studio-composer__controls">
@@ -128,7 +138,7 @@ export function TextStudioComposer({
128
138
  {contextAttached ? t('Studio.composer.contextAttached') : t('Studio.composer.context')}
129
139
  </Button>
130
140
  ) : null}
131
- {parameterPanel && !isVisionLocate ? (
141
+ {parameterPanel && !isVisionLocate && profile.primaryParameters !== 'all' ? (
132
142
  <Button
133
143
  type="button"
134
144
  tone="ghost"
@@ -141,74 +151,38 @@ export function TextStudioComposer({
141
151
  {t('Studio.parameters.title')}
142
152
  </Button>
143
153
  ) : null}
144
- </div>
145
- <div className="studio-composer__actions">
146
- <IntentSummaryChip
147
- label={intentLabel}
148
- onOpen={onOpenIntentConfig}
149
- configurable={intentConfigurable && Boolean(onOpenIntentConfig)}
150
- />
151
- {profile.supportsAttachments && !isVisionLocate && (attachmentPickerEnabled || attachments.length > 0) ? (
152
- <div className="studio-attachment-strip studio-attachment-strip--icon">
153
- {attachmentPickerEnabled ? <Tooltip content={t('Studio.composer.attachContext')} placement="top">
154
- <Button
155
- type="button"
156
- className="h-8 w-8 rounded-full px-0"
157
- size="sm"
158
- tone="ghost"
159
- onClick={onOpenAttachmentPicker}
160
- disabled={running}
161
- aria-label={t('Studio.composer.attachContext')}
162
- >
163
- <Paperclip size={15} aria-hidden="true" />
164
- </Button>
165
- </Tooltip> : null}
166
- {attachments.map((item, index) => (
167
- <span key={item.id} className="studio-attachment-chip">
168
- {item.kind === 'image' ? (
169
- <img src={item.dataUrl} alt={item.name} />
170
- ) : (
171
- <span className="studio-attachment-chip__video" aria-hidden="true">
172
- <Play size={13} />
173
- </span>
174
- )}
175
- <span className="studio-attachment-chip__name">{item.name}</span>
176
- <IconButton
177
- aria-label={t('Studio.composer.removeAttachment', { name: item.name })}
178
- onClick={() => onRemoveAttachment(index)}
179
- icon={<X size={13} aria-hidden="true" />}
180
- size="sm"
181
- tone="ghost"
182
- className="h-6 w-6"
183
- />
184
- </span>
185
- ))}
186
- </div>
187
- ) : null}
188
- {isVisionLocate ? (
154
+ {hasAttachmentControls && attachmentPickerEnabled ? (
189
155
  <Button
190
156
  type="button"
191
- tone="primary"
192
- disabled={generateDisabled}
193
- onClick={intentConfigAction ? onOpenIntentConfig : onSubmit}
194
- leadingIcon={running
195
- ? <RefreshCw size={16} aria-hidden="true" className="studio-spin" />
196
- : <ScanSearch size={16} aria-hidden="true" />}
157
+ tone="ghost"
158
+ size="sm"
159
+ className="studio-context-chip"
160
+ leadingIcon={<Paperclip size={15} aria-hidden="true" />}
161
+ onClick={onOpenAttachmentPicker}
162
+ disabled={running}
163
+ aria-label={t('Studio.composer.attachContext')}
197
164
  >
198
- {generateLabel}
165
+ {t('Studio.composer.attachContext')}
199
166
  </Button>
200
- ) : <Tooltip content={generateLabel} placement="top">
201
- <IconButton
202
- type="button"
203
- className={intentConfigAction ? 'studio-generate-action studio-generate-action--configure' : 'studio-generate-action'}
204
- tone="primary"
205
- size="sm"
206
- aria-label={generateLabel}
207
- disabled={generateDisabled}
208
- onClick={intentConfigAction ? onOpenIntentConfig : onSubmit}
209
- icon={running ? <RefreshCw size={15} aria-hidden="true" className="studio-spin" /> : <ArrowUp size={16} aria-hidden="true" />}
210
- />
211
- </Tooltip>}
167
+ ) : null}
168
+ </div>
169
+ <div className="studio-composer__actions">
170
+ {canRunFromPrompt ? <kbd className="studio-composer__shortcut">{t('Studio.composer.runShortcut')}</kbd> : null}
171
+ <Button
172
+ type="button"
173
+ tone="primary"
174
+ size="sm"
175
+ disabled={generateDisabled}
176
+ aria-label={generateLabel}
177
+ aria-describedby={visibleInputIssue ? inputIssueId : undefined}
178
+ aria-keyshortcuts={canRunFromPrompt ? 'Control+Enter Meta+Enter' : undefined}
179
+ onClick={intentConfigAction ? onOpenIntentConfig : onSubmit}
180
+ leadingIcon={running
181
+ ? <RefreshCw size={16} aria-hidden="true" className="studio-spin" />
182
+ : isVisionLocate ? <ScanSearch size={16} aria-hidden="true" /> : <ArrowUp size={16} aria-hidden="true" />}
183
+ >
184
+ {generateLabel}
185
+ </Button>
212
186
  </div>
213
187
  </div>
214
188
  );
@@ -222,26 +196,59 @@ export function TextStudioComposer({
222
196
  onRemove={() => onRemoveAttachment(0)}
223
197
  /> : null}
224
198
  <div className={isReadOnlyComposer ? 'studio-input studio-input--readonly' : 'studio-input'}>
225
- {isVisionLocate ? <label className="studio-locate-input__label" htmlFor={queryInputId}>{t('VisionLocate.queryLabel')}</label> : null}
199
+ <div className="studio-composer__heading">
200
+ <h3>{t('Studio.composer.inputTitle')}</h3>
201
+ <IntentSummaryChip label={intentLabel} onOpen={onOpenIntentConfig} configurable={intentConfigurable} />
202
+ </div>
226
203
  {isReadOnlyComposer ? (
227
204
  <NimiText role="body" className="studio-input__note">
228
205
  {profile.inputNoteKey ? t(profile.inputNoteKey) : ''}
229
206
  </NimiText>
230
- ) : (
231
- <TextareaField
232
- id={queryInputId}
233
- tone="quiet"
234
- className="rounded-none focus-within:border-transparent focus-within:ring-0"
235
- textareaClassName="min-h-[calc(2*1.55em)] resize-none px-0 py-0 text-[15px] leading-[1.55]"
236
- rows={2}
237
- wrap="soft"
238
- maxLength={2000}
239
- aria-label={isVisionLocate ? t('VisionLocate.queryLabel') : t('Studio.composer.requestAriaLabel', { capability: t(capability.labelKey) })}
240
- placeholder={capability.id === 'text.generate' ? t('Studio.composer.textGeneratePlaceholder') : t(profile.inputPlaceholderKey)}
241
- value={prompt}
242
- onChange={(event: ChangeEvent<HTMLTextAreaElement>) => onPromptChange(event.currentTarget.value)}
243
- />
244
- )}
207
+ ) : hasPromptField ? (
208
+ <div className="studio-composer__field">
209
+ <label htmlFor={queryInputId}>
210
+ {t(isVisionLocate ? 'VisionLocate.queryLabel' : profile.inputKind === 'url' ? 'Studio.composer.sourceUrl' : 'StudioShell.promptLabel')}
211
+ </label>
212
+ <TextareaField
213
+ id={queryInputId}
214
+ tone="quiet"
215
+ className="rounded-none focus-within:border-transparent focus-within:ring-0"
216
+ textareaClassName="resize-none px-0 py-0 text-[14px] font-normal leading-relaxed"
217
+ rows={compact ? 2 : 3}
218
+ wrap="soft"
219
+ maxLength={2000}
220
+ aria-label={isVisionLocate ? t('VisionLocate.queryLabel') : t('Studio.composer.requestAriaLabel', { capability: t(capability.labelKey) })}
221
+ placeholder={capability.id === 'text.generate' ? t('Studio.composer.textGeneratePlaceholder') : t(profile.inputPlaceholderKey)}
222
+ value={prompt}
223
+ onChange={(event: ChangeEvent<HTMLTextAreaElement>) => onPromptChange(event.currentTarget.value)}
224
+ onKeyDown={(event) => {
225
+ if (event.key !== 'Enter' || !(event.ctrlKey || event.metaKey) || event.altKey || event.shiftKey || event.nativeEvent.isComposing) return;
226
+ event.preventDefault();
227
+ if (canRunFromPrompt && !event.repeat) onSubmit();
228
+ }}
229
+ />
230
+ </div>
231
+ ) : null}
232
+ {hasAttachmentControls && attachments.length > 0 ? (
233
+ <div className="studio-attachment-strip">
234
+ {attachments.map((item, index) => (
235
+ <span key={item.id} className="studio-attachment-chip">
236
+ {item.kind === 'image' ? <img src={item.dataUrl} alt="" /> : (
237
+ <span className="studio-attachment-chip__video" aria-hidden="true"><Play size={13} /></span>
238
+ )}
239
+ <span className="studio-attachment-chip__name" title={item.name}>{item.name}</span>
240
+ <IconButton
241
+ aria-label={t('Studio.composer.removeAttachment', { name: item.name })}
242
+ onClick={() => onRemoveAttachment(index)}
243
+ icon={<X size={13} aria-hidden="true" />}
244
+ size="sm"
245
+ tone="ghost"
246
+ className="h-6 w-6"
247
+ />
248
+ </span>
249
+ ))}
250
+ </div>
251
+ ) : null}
245
252
  {supportsContext ? (
246
253
  <div className={contextOpen ? 'studio-context studio-context--open' : 'studio-context'}>
247
254
  <TextareaField
@@ -261,10 +268,15 @@ export function TextStudioComposer({
261
268
  {parameterPanel && isVisionLocate ? (
262
269
  <div className="studio-locate-parameters">{parameterPanel}</div>
263
270
  ) : parameterPanel ? (
264
- <div className={parametersOpen ? 'studio-parameters-drawer studio-parameters-drawer--open' : 'studio-parameters-drawer'}>
271
+ <div className={[
272
+ 'studio-parameters-drawer',
273
+ profile.primaryParameters ? 'studio-parameters-drawer--with-primary' : '',
274
+ parametersOpen ? 'studio-parameters-drawer--open' : '',
275
+ ].filter(Boolean).join(' ')}>
265
276
  {parameterPanel}
266
277
  </div>
267
278
  ) : null}
279
+ {visibleInputIssue ? <p id={inputIssueId} className="studio-parameters__note" role="status">{visibleInputIssue}</p> : null}
268
280
  {composerBar}
269
281
  </div>
270
282
  </div>
@@ -280,13 +292,9 @@ export function TextStudioStartState({
280
292
  }) {
281
293
  const { translate: t } = useAIStudioHost();
282
294
  const capability = registration.descriptor;
283
- const profile = registration.profile;
284
295
  return (
285
- <section className={capability.id === 'vision.locate' ? 'studio-start studio-start--vision' : 'studio-start'} aria-label={t('Studio.composer.startAriaLabel', { capability: t(capability.labelKey) })}>
286
- <div className="studio-start__center">
287
- <h2>{t(profile.inputTitleKey)}</h2>
288
- <div className="studio-start__composer">{composer}</div>
289
- </div>
296
+ <section className="studio-start" tabIndex={-1} aria-label={t('Studio.composer.startAriaLabel', { capability: t(capability.labelKey) })}>
297
+ {composer}
290
298
  </section>
291
299
  );
292
300
  }
@@ -11,7 +11,7 @@ export function TextExchangeResultView({ output }: { readonly output: TextExchan
11
11
  return (
12
12
  <section className="studio-result__rich" aria-label={t('StudioResults.exchange.title')}>
13
13
  <p className="studio-result__plain">
14
- {t(output.scenario === 'tool-call' ? 'StudioResults.exchange.toolScenario' : 'StudioResults.exchange.structuredScenario')}
14
+ {t(output.scenario === 'tool-call' ? 'StudioResults.exchange.toolScenario' : output.scenario === 'json-object' ? 'StudioResults.exchange.jsonObjectScenario' : 'StudioResults.exchange.structuredScenario')}
15
15
  </p>
16
16
  <ol className="studio-exchange">
17
17
  {output.steps.map((step, index) => (