@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.
Files changed (99) hide show
  1. package/README.md +112 -24
  2. package/bin/nimi-app.mjs +35 -15
  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 +97 -39
  6. package/lib/app-host-support.mjs +6 -0
  7. package/lib/app-identifiers.mjs +27 -0
  8. package/lib/app-info.mjs +292 -1
  9. package/lib/app-lifecycle-guidance.mjs +1 -1
  10. package/lib/app-pack.mjs +65 -39
  11. package/lib/app-project-lifecycle.mjs +149 -244
  12. package/lib/app-scaffold-capabilities.mjs +13 -109
  13. package/lib/app-scaffold-profiles.mjs +81 -115
  14. package/lib/app-scaffold.mjs +74 -166
  15. package/lib/app-toolchain-updates.mjs +45 -0
  16. package/lib/canonical-capability-ids.generated.mjs +2 -0
  17. package/lib/development-environment.d.mts +10 -0
  18. package/lib/development-environment.mjs +39 -0
  19. package/lib/hosted-web-release.mjs +98 -0
  20. package/lib/index.mjs +43 -3
  21. package/lib/mobile-development.mjs +19 -0
  22. package/lib/realm-environments.generated.mjs +5 -0
  23. package/lib/storefront-media.mjs +154 -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 +33 -21
  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 +3 -1
  32. package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
  33. package/skills/nimi-app-lifecycle/references/adapt.md +5 -3
  34. package/skills/nimi-app-lifecycle/references/audit.md +3 -2
  35. package/skills/nimi-app-lifecycle/references/create.md +6 -2
  36. package/skills/nimi-app-lifecycle/references/release.md +10 -0
  37. package/skills/nimi-app-lifecycle/references/upgrade-platform.md +12 -7
  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 +73 -19
  46. package/templates/app-source/src/ai-studio-core/messages/zh.json +73 -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 +30 -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 +96 -75
  60. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +59 -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 +2 -2
  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 +158 -76
  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 +12 -3
  70. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +12 -3
  71. package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
  72. package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
  73. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -5
  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 +68 -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 +3 -3
  89. package/templates/default-starter/README.md +1 -1
  90. package/templates/default-starter/src/shell/App.tsx +6 -18
  91. package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
  92. package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
  93. package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
  94. package/templates/default-starter.manifest.json +0 -16
  95. package/templates/hosted-web-release.yml +98 -0
  96. package/templates/default-starter/src-tauri/Cargo.toml +0 -17
  97. package/templates/default-starter/src-tauri/build.rs +0 -32
  98. package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
  99. package/templates/default-starter/src-tauri/tauri.conf.json +0 -26
@@ -35,6 +35,7 @@ export type StudioParameterContract = {
35
35
  readonly initial: () => StudioParameterValue;
36
36
  readonly summarize: (parameters: StudioParameterValue) => Readonly<Record<string, unknown>>;
37
37
  readonly hasAlternativeInput: (parameters: StudioParameterValue) => boolean;
38
+ readonly requiredInputIssue?: (parameters: StudioParameterValue) => string | undefined;
38
39
  readonly presentation: (source: StudioRunTargetSource) => readonly StudioParameterPresentation[];
39
40
  readonly project: (source: StudioRunTargetSource, parameters: StudioParameterValue) => StudioParameterValue;
40
41
  readonly recordedInput?: StudioRecordedParameterInput;
@@ -48,6 +49,7 @@ export type TypedStudioParameterContract<TParameters extends object> = {
48
49
  readonly initial: () => TParameters;
49
50
  readonly summarize?: (parameters: TParameters) => Readonly<Record<string, unknown>>;
50
51
  readonly hasAlternativeInput?: (parameters: TParameters) => boolean;
52
+ readonly requiredInputIssue?: (parameters: TParameters) => string | undefined;
51
53
  readonly routeMatrix: StudioParameterRouteMatrix;
52
54
  readonly recordedInput?: {
53
55
  readonly encode: (parameters: TParameters) => string;
@@ -88,6 +90,7 @@ export function defineStudioParameters<TParameters extends object>(
88
90
  projectStudioParameters(typed.routeMatrix, source, parameters)
89
91
  );
90
92
  const recorded = typed.recordedInput;
93
+ const requiredInputIssue = typed.requiredInputIssue;
91
94
  const recordedInput: StudioRecordedParameterInput | undefined = recorded
92
95
  ? Object.freeze({
93
96
  encode: (parameters: StudioParameterValue) => recorded.encode(parameters as TParameters),
@@ -96,6 +99,7 @@ export function defineStudioParameters<TParameters extends object>(
96
99
  : undefined;
97
100
  return Object.freeze({
98
101
  initial, summarize, hasAlternativeInput, presentation, project,
102
+ ...(requiredInputIssue ? { requiredInputIssue: (parameters: StudioParameterValue) => requiredInputIssue(parameters as TParameters) } : {}),
99
103
  ...(recordedInput ? { recordedInput } : {}),
100
104
  ...(typed.restoreRecordedParameters ? { restoreRecordedParameters: (snapshot: Readonly<Record<string, unknown>> | undefined, result?: StudioRunHistoryResultSnapshot, recordedPrompt?: string) => typed.restoreRecordedParameters!(snapshot, result, recordedPrompt) as StudioParameterValue | null } : {}),
101
105
  });
@@ -6,6 +6,48 @@ export type StudioPromptDraftKey = {
6
6
  readonly scenarioId: string;
7
7
  };
8
8
 
9
+ type DraftStorage = {
10
+ readJson(path: string): Promise<{ readonly value: unknown }>;
11
+ writeJson(path: string, value: { schemaVersion: number; prompt: string }): Promise<unknown>;
12
+ };
13
+
14
+ /** The captured App client resolves the current account and registered subject.
15
+ * Browser storage never supplies an identity or an unowned previous draft. */
16
+ export function createStudioPromptDraftRepository(storage: DraftStorage) {
17
+ const cache = new Map<string, string>();
18
+ let saving: Promise<unknown> = Promise.resolve();
19
+ async function path(key: StudioPromptDraftKey) {
20
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify([key.surfaceId, key.capabilityId, key.scenarioId])));
21
+ return `studio/prompt-drafts/${Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join('')}.json`;
22
+ }
23
+ return {
24
+ async load(key: StudioPromptDraftKey, enabled: boolean): Promise<{ prompt: string | null }> {
25
+ const id = studioPromptDraftId(key);
26
+ if (cache.has(id)) return { prompt: cache.get(id)! };
27
+ if (!enabled) return { prompt: null };
28
+ let value: unknown;
29
+ try { value = (await storage.readJson(await path(key))).value; }
30
+ catch (error) {
31
+ const code = (error as { reasonCode?: string; code?: string } | null)?.reasonCode
32
+ ?? (error as { code?: string } | null)?.code;
33
+ if (code === 'APP_STORAGE_ENTRY_NOT_FOUND' || code === 'not-found') return { prompt: cache.get(id) ?? null };
34
+ throw error;
35
+ }
36
+ const draft = value as { schemaVersion?: unknown; prompt?: unknown } | null;
37
+ if (!draft || draft.schemaVersion !== 1 || typeof draft.prompt !== 'string') throw new Error('Stored prompt draft is invalid.');
38
+ return { prompt: cache.get(id) ?? draft.prompt };
39
+ },
40
+ save(key: StudioPromptDraftKey, prompt: string, enabled: boolean): Promise<void> {
41
+ cache.set(studioPromptDraftId(key), prompt);
42
+ if (!enabled) return Promise.resolve();
43
+ const write = async () => { await storage.writeJson(await path(key), { schemaVersion: 1, prompt }); };
44
+ const next = saving.then(write, write);
45
+ saving = next;
46
+ return next;
47
+ },
48
+ };
49
+ }
50
+
9
51
  export type StudioPromptDraftStore = {
10
52
  readonly schemaVersion: typeof STUDIO_PROMPT_DRAFTS_SCHEMA_VERSION;
11
53
  readonly drafts: Readonly<Record<string, string>>;
@@ -14,6 +14,11 @@ export type StudioTrace = {
14
14
  readonly traceId?: string;
15
15
  };
16
16
 
17
+ export type StudioEmbeddingRetrieval = {
18
+ readonly query: string;
19
+ readonly matches: readonly { readonly inputIndex: number; readonly excerpt: string; readonly score: number }[];
20
+ };
21
+
17
22
  export type StudioManagedArtifact = {
18
23
  readonly relativePath: string;
19
24
  readonly mediaType?: string;
@@ -112,6 +117,8 @@ export type StudioTextDecisionAnswer =
112
117
  | { readonly questionId: string; readonly kind: 'boolean'; readonly trueProbability: number };
113
118
 
114
119
  export type StudioSessionSummary = {
120
+ readonly audioUsage?: { readonly audioSeconds: number; readonly final: boolean };
121
+ readonly closure?: { readonly localResourcesReleased: boolean; readonly providerSessionClosed: boolean };
115
122
  readonly capabilityContract: string;
116
123
  readonly startedAt: string;
117
124
  readonly endedAt: string;
@@ -125,12 +132,12 @@ export type StudioTypedOutput =
125
132
  | { readonly kind: 'vision-locate'; readonly jobId: string; readonly result: NimiLocalAppVisionLocateResult; readonly sourceImage?: StudioManagedArtifact; readonly imagePreviewUrl?: string }
126
133
  | { readonly kind: 'text'; readonly text: string; readonly finishReason: string; readonly inputTokens?: number; readonly outputTokens?: number; readonly totalTokens?: number; readonly streamed: boolean; readonly sourceImage?: StudioManagedArtifact }
127
134
  // spaceId is absent only on records saved before the result retained it.
128
- | { readonly kind: 'embedding'; readonly vectorCount: number; readonly dimensions: number; readonly spaceId?: string; readonly sample: number[]; readonly totalTokens?: number }
135
+ | { readonly kind: 'embedding'; readonly vectorCount: number; readonly dimensions: number; readonly spaceId?: string; readonly sample: number[]; readonly totalTokens?: number; readonly retrieval?: StudioEmbeddingRetrieval }
129
136
  | { readonly kind: 'artifacts'; readonly sourceImage?: StudioManagedArtifact; readonly musicGeneration?: StudioMusicGeneration; readonly musicTranscription?: StudioMusicTranscription; readonly voiceConversion?: StudioVoiceConversion; readonly audioSeparation?: StudioAudioSeparation; readonly faceSwap?: StudioFaceSwap; readonly jobId: string; readonly jobState: string; readonly artifactCount: number; readonly artifacts: StudioManagedArtifact[]; readonly firstArtifact?: StudioManagedArtifact }
130
137
  // The complete annotation lives in the saved document; it is attached only
131
138
  // after the current run or a verified read of that document.
132
139
  | { readonly kind: 'text-annotation'; readonly jobId: string; readonly jobState: string; readonly language: string; readonly documentCount: number; readonly tokenCount: number; readonly sentenceCount: number; readonly document: StudioManagedArtifact; readonly annotation?: NimiLocalAppTextAnnotationResult }
133
- | { readonly kind: 'text-exchange'; readonly scenario: 'tool-call' | 'structured-output'; readonly steps: readonly StudioTextExchangeStep[]; readonly text: string; readonly structured?: StudioJsonValue }
140
+ | { readonly kind: 'text-exchange'; readonly scenario: 'tool-call' | 'structured-output' | 'json-object'; readonly steps: readonly StudioTextExchangeStep[]; readonly text: string; readonly structured?: StudioJsonValue }
134
141
  | { readonly kind: 'text-decision'; readonly answers: readonly StudioTextDecisionAnswer[] }
135
142
  | ({ readonly kind: 'session' } & StudioSessionSummary)
136
143
  | { readonly kind: 'transcript'; readonly text: string; readonly jobId: string; readonly jobState: string; readonly artifactCount: number; readonly transcription?: NimiLocalAppSpeechTranscript }
@@ -20,7 +20,7 @@ import {
20
20
  } from '@nimiplatform/kit/features/generation/runtime';
21
21
  import {
22
22
  createNimiLocalAppRuntimeScenarioJobClient,
23
- type NimiLocalAppClient,
23
+ type NimiLocalAppClient, type NimiAppRuntimeClient,
24
24
  } from '@nimiplatform/sdk/app';
25
25
  import type {
26
26
  StudioAudioSeparation,
@@ -68,12 +68,16 @@ export type StudioCapabilityNonSuccessFactory = (
68
68
  diagnostics?: StudioNonSuccessDiagnostics,
69
69
  ) => StudioNonSuccess;
70
70
 
71
+ export type StudioRuntimeClient = Pick<NimiAppRuntimeClient, 'aiConfig' | 'storage'> & {
72
+ readonly ai: Pick<NimiLocalAppClient['ai'], 'text' | 'scenario' | 'scenarioJobs' | 'artifacts' | 'voiceAssets'>;
73
+ };
74
+
71
75
  export type StudioRuntimeHost = {
72
76
  readonly appId: string;
73
77
  readonly surfaceId: string;
74
78
  readonly abortReason: string;
75
79
  readonly translate: (key: string, values?: Readonly<Record<string, unknown>>) => string;
76
- readonly client: NimiLocalAppClient;
80
+ readonly client: StudioRuntimeClient;
77
81
  readonly createScenarioJobClient: typeof createNimiLocalAppRuntimeScenarioJobClient;
78
82
  readonly runners: StudioRuntimeRunnerSet;
79
83
  readonly nonSuccess: StudioCapabilityNonSuccessFactory;
@@ -101,7 +105,7 @@ export type StudioCapabilityRuntimeOrchestrator = {
101
105
  readonly handlers: StudioCapabilityRuntimeHandlers;
102
106
  readonly resolveCapability: (capabilityId: string) => StudioRuntimeCapabilityDescriptor;
103
107
  readonly inspectRuntime: () => Promise<StudioRuntimeInspection>;
104
- readonly getClient: () => NimiLocalAppClient;
108
+ readonly getClient: () => StudioRuntimeClient;
105
109
  readonly createScenarioId: (capability: StudioRuntimeCapabilityDescriptor) => string;
106
110
  readonly createScenarioJobClient?: typeof createNimiLocalAppRuntimeScenarioJobClient;
107
111
  readonly runners?: Partial<StudioRuntimeRunnerSet>;
@@ -427,7 +431,7 @@ function withStudioKnownJob(result: StudioNonSuccess, error: unknown): StudioNon
427
431
  }
428
432
 
429
433
  function studioNonSuccessReasonFromRuntime(reason: string, diagnostics?: StudioNonSuccessDiagnostics): StudioNonSuccessReason {
430
- if (diagnostics && ['SDK_LOCAL_APP_INPUT_INVALID', 'AI_INPUT_INVALID', 'AI_INPUT_LIMIT_EXCEEDED', 'AI_VOICE_INPUT_INVALID', 'AI_VOICE_TARGET_MODEL_MISMATCH', 'AI_VOICE_ASSET_NOT_FOUND', 'AI_VOICE_ASSET_EXPIRED'].includes(diagnostics.reasonCode)) {
434
+ if (diagnostics && ['SDK_LOCAL_APP_INPUT_INVALID', 'AI_INPUT_INVALID', 'AI_INPUT_LIMIT_EXCEEDED', 'AI_MEDIA_SPEC_INVALID', 'AI_VOICE_INPUT_INVALID', 'AI_VOICE_TARGET_MODEL_MISMATCH', 'AI_VOICE_ASSET_NOT_FOUND', 'AI_VOICE_ASSET_EXPIRED'].includes(diagnostics.reasonCode)) {
431
435
  return 'input-invalid';
432
436
  }
433
437
  return studioNonSuccessReason(reason);
@@ -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) => (