@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
@@ -9,12 +9,25 @@
9
9
  "exportSaved": "文件已保存:{{path}}",
10
10
  "exportSavedRevealFailed": "文件已保存到 {{path}},但无法显示所在文件夹。请从此路径打开;再次导出会创建另一份文件。",
11
11
  "assetRevealed": "已在文件夹中显示文件。",
12
+ "downloadRequested": "已发起下载,请查看浏览器下载列表。",
12
13
  "assetRevealFailed": "无法显示 {{path}} 所在的文件夹。文件未被修改,请在宿主可用后重试。"
13
14
  },
14
15
  "History": {
15
16
  "positionLoading": "正在读取这条已保存的结果…",
16
17
  "positionUnavailable": "这条已保存的结果不可用。可以重试读取,或后退到其他页面。",
17
18
  "title": "历史",
19
+ "closePanel": "关闭历史面板",
20
+ "moreActions": "更多历史操作",
21
+ "compareRuns": "比较运行",
22
+ "compareCount": "选择同一能力的两次运行(已选 {{count}} 项,共 2 项)。",
23
+ "openComparison": "查看比较",
24
+ "selectComparisonRun": "选择用于比较的运行 {{run}}",
25
+ "comparisonDescription": "对照两次运行已记录的输入、配置与结果。",
26
+ "compareInput": "输入",
27
+ "compareOutput": "结果",
28
+ "compareNoParameters": "未记录显式参数。",
29
+ "compareUnknown": "未记录",
30
+ "openRun": "打开运行",
18
31
  "panelAriaLabel": "Runtime 测试历史",
19
32
  "filterAriaLabel": "筛选历史",
20
33
  "filtersAriaLabel": "历史筛选",
@@ -29,7 +42,7 @@
29
42
  "filters": {
30
43
  "status": {
31
44
  "all": "全部状态",
32
- "ready": "Runtime 就绪",
45
+ "ready": "已完成",
33
46
  "failed": "失败",
34
47
  "canceled": "已取消",
35
48
  "timedOut": "已超时",
@@ -71,7 +84,8 @@
71
84
  "hideFailures": "隐藏失败",
72
85
  "showFailures": "显示失败",
73
86
  "unsupportedCapability": "这条记录的能力无法在此打开",
74
- "searchPlaceholder": "搜索提示词或结果",
87
+ "searchPlaceholder": "搜索提示词、模型或结果",
88
+ "showMoreRuns": "显示更多历史",
75
89
  "deleteRun": "删除这条记录",
76
90
  "deleteRecordOnly": "删除记录并保留托管资产",
77
91
  "deleteRecordAndAsset": "删除记录和托管资产",
@@ -108,6 +122,7 @@
108
122
  "recentRuns": "最近运行",
109
123
  "emptyNone": "还没有运行记录",
110
124
  "emptyFiltered": "没有符合这些筛选条件的运行",
125
+ "savedRefreshFailedTitle": "已保存,历史记录刷新失败",
111
126
  "loadFailedTitle": "历史加载失败",
112
127
  "saveFailedTitle": "历史保存失败",
113
128
  "deleteRecordAndDocument": "删除记录及其保存的结果",
@@ -138,13 +153,16 @@
138
153
  "runtimeTimeout": "这次任务已超时。",
139
154
  "streamInterrupted": "实时结果连接已结束,但 Runtime 尚未确认最终状态。",
140
155
  "runtimeCallFailed": "这次生成未能完成。",
156
+ "contentFilterBlocked": "内容过滤阻止了这次请求或响应。",
141
157
  "inputLimitExceeded": "当前配置的模型无法完整读取这次输入。输入没有被截断,也没有返回部分结果。",
142
158
  "textBehaviorUnsupported": "当前模型无法按现有设置运行这次请求:其中的工具调用、结构化输出、推理或生成参数不受支持。未接受部分回答。",
143
159
  "mediaOptionUnsupported": "当前模型不支持这次请求中的一项或多项媒体参数。",
160
+ "embeddingPurposeUnsupported": "所选模型不支持当前的检索用途设置。",
144
161
  "modalityUnsupported": "当前配置不支持这次请求中的一项或多项输入或参数。",
145
- "providerRateLimited": "云服务因达到速率或用量上限拒绝了本次请求。对 ChatGPT 计划连接来说,这是该计划在此 App 中的用量上限。",
162
+ "providerRateLimited": "云服务因速率、用量或账户余额限制拒绝了本次请求。",
146
163
  "mediaCodecUnavailable": "运行此请求时,所需的 Nimi 音视频工具不可用。",
147
164
  "localLoadFailed": "当前本机配置无法按这次请求运行。",
165
+ "localConfigurationMissing": "这项本机 AI 能力还没有可运行的配置。保存 App 的选择并不表示模型已经准备好。",
148
166
  "voiceInputRequired": "当前语音模型需要明确选择兼容的语音来源,才能合成音频。",
149
167
  "voiceTargetMismatch": "这个语音资产由另一语音模型创建,不能用于当前选中的模型。",
150
168
  "voiceUnavailable": "选择的音色已不可用。",
@@ -156,7 +174,13 @@
156
174
  "configInvalid": "此能力保存的 AI 配置无法在当前 Runtime 中运行,例如所用的云服务已不再支持。",
157
175
  "modelNotFound": "所选模型不可用:其云端账户未提供该模型,或没有可用的已准入实现。本次没有生成内容。",
158
176
  "fallback": "本次生成未完成。",
159
- "stoppedDirectCall": "已停止等待这次调用,之后返回的结果不会显示。"
177
+ "stoppedDirectCall": "已停止等待这次调用,之后返回的结果不会显示。",
178
+ "providerAuthFailed": "云服务拒绝了当前连接的凭据。API 密钥可能已过期、被撤销或无效。",
179
+ "mediaStorageMissing": "这次视频请求需要配置存储,用于上传参考音频或视频。",
180
+ "mediaStorageCredentials": "OSS 拒绝了参考素材存储的凭据。",
181
+ "mediaStorageVersioning": "参考素材存储需要使用从未启用版本控制的 Bucket。",
182
+ "mediaStorageUnavailable": "参考素材存储请求未能完成。",
183
+ "mediaStorageCleanup": "本任务未能确认已上传参考对象的归属或删除结果。"
160
184
  },
161
185
  "action": {
162
186
  "runtimeUnavailable": "返回 Desktop 确认本地 AI 已连接,然后重试。",
@@ -169,13 +193,16 @@
169
193
  "runtimeTimeout": "稍后重试;如果仍然超时,再展开 Runtime 详情查看原因。",
170
194
  "streamInterrupted": "请先检查任务状态;确认任务未完成后再重试。",
171
195
  "runtimeCallFailed": "先重试一次;如果仍然失败,再展开 Runtime 详情查看原因。",
196
+ "contentFilterBlocked": "请尝试移除或脱敏受限内容,或调整所选上下文后重新提交。",
172
197
  "inputLimitExceeded": "请缩短输入,或配置可接受更长输入的模型,然后重新运行。",
173
- "textBehaviorUnsupported": "打开参数并重置此模型不接受的设置,或在 Desktop 的 AI 能力中选择支持此行为的模型,再重新运行。",
198
+ "textBehaviorUnsupported": "打开「参数」并重置此模型不支持的设置,或在本 App 的 AI 配置中改选支持该行为的模型,再重新运行。",
174
199
  "mediaOptionUnsupported": "打开「参数」重置不受支持的设置后重新运行,也可以在 App AI 配置中选择支持这些设置的模型。",
200
+ "embeddingPurposeUnsupported": "打开「参数」,按任务选择「待检索内容」(建立索引)或「检索问题」(搜索),再重新运行。如果仍不支持该用途,可在 App AI 配置中选择支持它的模型。",
175
201
  "modalityUnsupported": "请先修改输入,或在「参数」中重置不受支持的设置后再运行,也可以选择支持这次请求的配置。",
176
- "providerRateLimited": "请稍后再试。ChatGPT 计划连接可在 {{usageUrl}} 查看用量。也可以打开 App AI 配置改选其他模型。",
202
+ "providerRateLimited": "请检查当前服务商的速率限制、账户余额、套餐和分配给本 App 的用量额度。解除相应限制后再重新运行。",
177
203
  "mediaCodecUnavailable": "在 Nimi Desktop 打开「AI 能力」→「高级与诊断」→「音频与视频组件」;如组件未就绪,选择「安装或修复」,等显示已安装后再运行此请求。",
178
- "localLoadFailed": "请确认输入和参数与所选模型匹配,并在 Desktop 的 AI 能力中检查模型及组件是否已准备好;如需修复配置,完成后再运行。Runtime 详情保留了本次失败信息。",
204
+ "localLoadFailed": "请确认输入和参数与所选模型匹配;如需检查公共模型和组件,请在主机 Nimi Home 的「AI 能力」中处理,完成后再运行。Runtime 详情保留了本次失败信息。",
205
+ "localConfigurationMissing": "请在 Nimi Home 的「AI 能力」中完成这项能力的本机模型配置,确认已可用后,返回这里重新提交当前输入。Runtime 详情保留了本次失败信息。",
179
206
  "voiceInputRequired": "打开「参数」选择当前模型支持的预设语音或兼容的本地语音资产;如该模型需要资产而列表为空,先到「创建语音」创建,再返回重试。",
180
207
  "voiceTargetMismatch": "选择与当前语音模型兼容的资产,或先在「创建语音」中创建一个,再重试。",
181
208
  "voiceUnavailable": "打开「参数」选择当前模型兼容的有效音色;重复使用已删除或过期的音色无法恢复它。",
@@ -187,7 +214,13 @@
187
214
  "configInvalid": "打开 App AI 配置,为此能力重新选择模型,然后重新运行。",
188
215
  "modelNotFound": "打开 App AI 配置,为此能力选择一个可用的模型,然后重新运行。",
189
216
  "fallback": "请重试;如果仍然失败,再展开 Runtime 详情查看原因。",
190
- "stoppedDirectCall": "准备好后可以直接重新运行。"
217
+ "stoppedDirectCall": "准备好后可以直接重新运行。",
218
+ "providerAuthFailed": "先在 Nimi 的「云服务」中更新此连接的密钥或重新登录,再提交新请求。",
219
+ "mediaStorageMissing": "在 Nimi「云服务」中打开当前连接,配置「参考音视频存储」,再提交新请求。",
220
+ "mediaStorageCredentials": "在当前连接的「参考音视频存储」中更新 OSS 凭据,并检查 Bucket 权限。",
221
+ "mediaStorageVersioning": "为当前连接配置从未启用版本控制的 OSS Bucket。",
222
+ "mediaStorageUnavailable": "先在 Nimi「云服务」检查 OSS 地域、Bucket 和权限,再提交新请求。",
223
+ "mediaStorageCleanup": "查看 Nimi 诊断中的本任务清理结果及所配置的 OSS Bucket。重新生成不能证明旧素材已被删除。"
191
224
  },
192
225
  "hint": {
193
226
  "runtimeUnavailable": "恢复受保护的 Runtime 连接后重试同一请求。",
@@ -215,15 +248,22 @@
215
248
  "expandGeneratedImage": "展开生成的图片",
216
249
  "imagePreview": "图片预览",
217
250
  "imagePreviewFailed": "无法打开图片预览,请重试。",
251
+ "mediaPreviewFailed": "未能加载已保存的媒体,请重试读取原结果。",
218
252
  "closeImagePreview": "关闭图片预览",
219
253
  "emptyBody": "(空内容)",
220
254
  "emptyTranscript": "(空转写)",
221
255
  "contextLabel": "上下文",
222
- "requestSettings": "请求设置",
256
+ "requestSettings": "运行配置与参数",
257
+ "modelNotRecorded": "模型目标未记录",
258
+ "parametersNotRecorded": "这条记录没有保存请求参数。",
259
+ "configuredDefaults": "提交时的应用默认值",
260
+ "recordedConfigScope": "这里显示提交时的设置。实际执行模型和服务端补齐的默认值未记录。",
223
261
  "showRequestSettings": "显示请求设置",
224
262
  "hideRequestSettings": "隐藏请求设置",
225
263
  "legacyRecordHint": "这条较早的历史记录仅包含状态元数据。重新运行一次即可保存类型化的结果快照。",
226
264
  "historyInputTruncated": "历史只保留这段长输入的开头部分,因此这条记录不能用作草稿或重新运行。",
265
+ "recordedInput": "当次输入",
266
+ "editNextRun": "编辑下一次运行",
227
267
  "historyAdditionalDocumentsNotRetained": "只能将第一篇文档用作草稿。重新运行前请再次添加其他文档。",
228
268
  "generationFailed": "生成未能完成",
229
269
  "generationCanceled": "生成已取消",
@@ -236,10 +276,10 @@
236
276
  "downloadGeneration": "下载生成结果",
237
277
  "revealAsset": "在文件夹中显示",
238
278
  "revealGeneration": "在文件夹中显示生成文件",
239
- "regenerate": "重新生成",
240
- "newRun": "新建运行",
241
- "useAsDraft": "用作草稿",
242
- "intentLabel": "意图",
279
+ "regenerate": "按当前配置再次运行",
280
+ "newRun": "返回草稿",
281
+ "useAsDraft": "复用输入",
282
+ "intentLabel": "当次配置",
243
283
  "embeddingSuccess": "向量嵌入生成成功。",
244
284
  "voiceAssetSuccess": "这次运行创建了一个音色。",
245
285
  "voiceExpiry": "提供方有效期:{{date}}。实际使用可能延长有效期。",
@@ -254,7 +294,7 @@
254
294
  "promptLabel": "提示词",
255
295
  "requestLabel": "请求",
256
296
  "generationLabel": "生成结果",
257
- "runStatusReady": "Runtime 就绪",
297
+ "runStatusReady": "已完成",
258
298
  "runStatusUnavailable": "SDK 不可用",
259
299
  "runStatusFailed": "失败",
260
300
  "runStatusCanceled": "已取消",
@@ -281,14 +321,21 @@
281
321
  "runtimeOwnedIntent": "由 Runtime 拥有的能力意图",
282
322
  "openIntentConfig": "打开 AI 意图配置",
283
323
  "configureIntent": "配置能力意图",
324
+ "inputRequired": "请添加本次实验所需的输入。",
284
325
  "context": "上下文",
285
326
  "contextAttached": "已附加上下文",
286
- "attachContext": "附加上下文",
327
+ "attachContext": "添加附件",
328
+ "inputTitle": "实验输入",
329
+ "sourceUrl": "来源链接",
330
+ "runShortcut": "Ctrl / ⌘ + Enter",
287
331
  "removeAttachment": "移除 {{name}}",
288
332
  "requestAriaLabel": "{{capability}}请求",
289
333
  "startAriaLabel": "{{capability}}起始页",
290
334
  "contextPlaceholder": "可选的上下文、受众、来源笔记或约束",
291
- "intentSummary": "意图:{{intent}}"
335
+ "intentSummary": "下次运行 · {{intent}}",
336
+ "routeLocal": "本地",
337
+ "routeCloud": "云端",
338
+ "routeUnknown": "路由未知"
292
339
  },
293
340
  "parameters": {
294
341
  "title": "参数",
@@ -307,7 +354,12 @@
307
354
  }
308
355
  },
309
356
  "run": {
310
- "aiConfigLoadFailed": "App AIConfig 加载失败。"
357
+ "aiConfigLoadFailed": "无法读取此应用的 AI 配置。",
358
+ "runtimeConnected": "Runtime 已连接",
359
+ "runtimeChecking": "正在检查 Runtime",
360
+ "runtimeUnavailable": "Runtime 不可用",
361
+ "effectiveTargetUnavailable": "已配置的目标不可用。请检查所选模型或 Loadout。",
362
+ "retryPreparation": "重新检查"
311
363
  },
312
364
  "drawerError": {
313
365
  "title": "模型配置不可用",
@@ -318,6 +370,7 @@
318
370
  "admissionLabel": "准入",
319
371
  "reasonLabel": "原因",
320
372
  "traceLabel": "追踪",
373
+ "jobLabel": "Runtime 任务",
321
374
  "verboseConsoleNote": "详细控制台:能力 {{capability}};{{state}}。",
322
375
  "verboseTypedSuccess": "类型化成功",
323
376
  "verboseFailClosed": "失败关闭:{{reason}}",
@@ -354,6 +407,7 @@
354
407
  "statState": "状态",
355
408
  "stateUnknown": "未知",
356
409
  "statVoices": "语音",
410
+ "metricCharacters": "{{count}} 字符",
357
411
  "metricWords_one": "{{count}} 个词",
358
412
  "metricWords_other": "{{count}} 个词",
359
413
  "metricArtifacts_one": "{{count}} 个产物",
@@ -428,7 +482,8 @@
428
482
  "toolResult": "工具结果 {{name}} · {{id}}",
429
483
  "toolError": "工具错误 {{name}} · {{id}}",
430
484
  "structured": "解析后的结构化结果",
431
- "finalText": "最终文本"
485
+ "finalText": "最终文本",
486
+ "jsonObjectScenario": "JSON 对象测试:App 已解析最终文本并确认其为对象。"
432
487
  },
433
488
  "decision": {
434
489
  "title": "判断结果",
@@ -454,7 +509,12 @@
454
509
  "nothingObserved": "未观察到任何结果。",
455
510
  "notRestorable": "已关闭的会话无法恢复。如需再次测试,请打开新会话。",
456
511
  "stateClosed": "已关闭",
457
- "stateTerminated": "已终止"
512
+ "stateTerminated": "已终止",
513
+ "audioUsageFinal": "供方最终报告的累计音频:{{seconds}} 秒。此值不是 token 数或费用估算。",
514
+ "audioUsagePartial": "服务商目前报告的累计音频:{{seconds}} 秒。该用量尚未标为最终值。",
515
+ "localClosureUnconfirmed": "会话已结束,本地资源释放尚未确认。",
516
+ "providerClosureConfirmed": "本地资源已释放,并已收到供方会话关闭回执。",
517
+ "localClosureConfirmed": "本地连接与资源已释放。服务商尚未确认会话已关闭。"
458
518
  },
459
519
  "faceSwap": {
460
520
  "inputs": "换脸输入",
@@ -27,6 +27,7 @@ export type CapabilityStudioProfile = {
27
27
  readonly footnoteKey: string;
28
28
  readonly statusLabelKey?: string;
29
29
  readonly pendingLabelKey?: string;
30
+ readonly primaryParameters?: 'all' | 'partial';
30
31
  // The capability runs only when its parameter panel supplies the input
31
32
  // (for example selected media) rather than the composer prompt.
32
33
  readonly requiresParameterInput?: boolean;
@@ -1,4 +1,3 @@
1
- import { NIMI_CHATGPT_PLAN_USAGE_URL } from '@nimiplatform/sdk/runtime';
2
1
  import type {
3
2
  StudioNonSuccess,
4
3
  StudioNonSuccessDiagnostics,
@@ -36,6 +35,16 @@ export function isStoppedDirectCall(reason: string, capabilityId?: string): bool
36
35
  return reason === 'operation-aborted' && capabilityId !== undefined && DIRECT_CALL_CAPABILITIES.has(capabilityId);
37
36
  }
38
37
 
38
+ export function studioTerminalStatusKey(reason?: StudioNonSuccessReason, capabilityId?: string): string {
39
+ if (!reason) return 'Studio.result.status.runtimeResult';
40
+ if (reason === 'runtime-canceled') return 'Studio.result.status.runtimeCanceled';
41
+ if (reason === 'runtime-timeout') return 'Studio.result.status.runtimeTimedOut';
42
+ if (reason === 'operation-aborted') return isStoppedDirectCall(reason, capabilityId)
43
+ ? 'Studio.result.status.stoppedDirectCall'
44
+ : 'Studio.result.status.operationAborted';
45
+ return 'Studio.result.status.runtimeBlocked';
46
+ }
47
+
39
48
  export function studioNonSuccessReasonTitle(reason: StudioNonSuccessReason, translate: StudioTranslate, capabilityId?: string): string {
40
49
  if (isStoppedDirectCall(reason, capabilityId)) return translate('NonSuccess.title.stoppedDirectCall');
41
50
  return translate(`NonSuccess.title.${reasonKeySegment(reason)}`);
@@ -49,17 +58,20 @@ const MEDIA_OPTION_UNSUPPORTED_REASON_CODE = 'AI_MEDIA_OPTION_UNSUPPORTED';
49
58
  const MODALITY_UNSUPPORTED_REASON_CODE = 'AI_MODALITY_NOT_SUPPORTED';
50
59
  const MEDIA_CODEC_UNAVAILABLE_REASON_CODE = 'AI_MEDIA_CODEC_UNAVAILABLE';
51
60
  const LOCAL_LOAD_FAILED_REASON_CODE = 'AI_LOCAL_EXECUTION_LOAD_FAILED';
61
+ const LOCAL_CONFIGURATION_MISSING_REASON_CODE = 'AI_LOCAL_CONFIGURATION_NOT_CONFIGURED';
62
+ const CONTENT_FILTER_BLOCKED_REASON_CODE = 'AI_CONTENT_FILTER_BLOCKED';
52
63
  const VOICE_INPUT_INVALID_REASON_CODE = 'AI_VOICE_INPUT_INVALID';
53
64
  const VOICE_TARGET_MISMATCH_REASON_CODE = 'AI_VOICE_TARGET_MODEL_MISMATCH';
54
65
  const UNAVAILABLE_VOICE_REASON_CODES: ReadonlySet<string> = new Set(['AI_VOICE_ASSET_NOT_FOUND', 'AI_VOICE_ASSET_EXPIRED']);
55
- // The cloud service refused the request under its rate or usage limit, which
56
- // for a ChatGPT plan Connector is the plan's usage limit for this app.
66
+ // This reason covers rate, usage and credit limits. It does not identify a
67
+ // provider or account, so recovery guidance must stay with the selected service.
57
68
  const PROVIDER_RATE_LIMITED_REASON_CODE = 'AI_PROVIDER_RATE_LIMITED';
58
69
 
59
70
  // A committed target that Runtime can no longer run is recovered by choosing a
60
71
  // target again (or repairing its Connector in Desktop), never by retrying the
61
72
  // same request.
62
73
  const TARGET_RESELECTION_KEY_SEGMENTS: ReadonlyMap<string, string> = new Map([
74
+ ['AI_PROVIDER_AUTH_FAILED', 'providerAuthFailed'],
63
75
  ['AI_REMOTE_MODEL_CATALOG_STALE', 'catalogStale'],
64
76
  ['CAPABILITY_CATALOG_MISMATCH', 'catalogMismatch'],
65
77
  ['AI_CONNECTOR_DISABLED', 'connectorDisabled'],
@@ -77,19 +89,37 @@ export function studioNonSuccessNeedsTargetReselection(diagnostics?: StudioNonSu
77
89
  return targetReselectionKeySegment(diagnostics) !== '';
78
90
  }
79
91
 
92
+ function mediaStorageKeySegment(diagnostics?: StudioNonSuccessDiagnostics): string {
93
+ switch (diagnostics?.reasonCode) {
94
+ case 'AI_MEDIA_STORAGE_NOT_CONFIGURED': return 'mediaStorageMissing';
95
+ case 'AI_MEDIA_STORAGE_AUTH_FAILED': return 'mediaStorageCredentials';
96
+ case 'AI_MEDIA_STORAGE_UNAVAILABLE': return 'mediaStorageUnavailable';
97
+ case 'AI_MEDIA_STORAGE_OPTION_UNSUPPORTED': return 'mediaStorageVersioning';
98
+ case 'AI_MEDIA_STORAGE_CLEANUP_UNCONFIRMED': return 'mediaStorageCleanup';
99
+ default: return '';
100
+ }
101
+ }
102
+
80
103
  export function studioNonSuccessReasonUserMessage(reason: string, translate: StudioTranslate, capabilityId?: string, diagnostics?: StudioNonSuccessDiagnostics, appInputMessage?: string): string {
104
+ const storage = capabilityId === 'video.generate' ? mediaStorageKeySegment(diagnostics) : '';
105
+ if (storage) return translate(`NonSuccess.message.${storage}`);
81
106
  if (capabilityId === 'audio.synthesize' && diagnostics && UNAVAILABLE_VOICE_REASON_CODES.has(diagnostics.reasonCode)) return translate('NonSuccess.message.voiceUnavailable');
82
- if (reason === 'input-invalid' && capabilityId === 'video.generate' && !diagnostics && appInputMessage) return appInputMessage;
107
+ if (reason === 'input-invalid' && (capabilityId === 'video.generate' || capabilityId === 'music.generate') && !diagnostics && appInputMessage) return appInputMessage;
83
108
  if (reason === 'input-invalid' && capabilityId === 'audio.transcribe') return translate('NonSuccess.message.transcriptionInputInvalid');
84
109
  if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_INPUT_INVALID_REASON_CODE) return translate('NonSuccess.message.voiceInputRequired');
85
110
  if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_TARGET_MISMATCH_REASON_CODE) return translate('NonSuccess.message.voiceTargetMismatch');
86
111
  if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === 'AI_LOCAL_SELECTION_NOT_FOUND') return translate('VisionLocate.modelSelectionRequired');
87
112
  if (isStoppedDirectCall(reason, capabilityId)) return translate('NonSuccess.message.stoppedDirectCall');
113
+ // @nimi-authority: rule.nimi.runtime.ai-provider.text-content-boundaries
114
+ if (diagnostics?.reasonCode === CONTENT_FILTER_BLOCKED_REASON_CODE) return translate('NonSuccess.message.contentFilterBlocked');
88
115
  if (diagnostics?.reasonCode === INPUT_LIMIT_EXCEEDED_REASON_CODE) return translate('NonSuccess.message.inputLimitExceeded');
89
116
  if (diagnostics?.reasonCode === TEXT_BEHAVIOR_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.textBehaviorUnsupported');
90
117
  if (diagnostics?.reasonCode === MEDIA_CODEC_UNAVAILABLE_REASON_CODE) return translate('NonSuccess.message.mediaCodecUnavailable');
91
118
  if (diagnostics?.reasonCode === LOCAL_LOAD_FAILED_REASON_CODE) return translate('NonSuccess.message.localLoadFailed');
119
+ if (diagnostics?.reasonCode === LOCAL_CONFIGURATION_MISSING_REASON_CODE) return translate('NonSuccess.message.localConfigurationMissing');
92
120
  if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('VisionLocate.geometryUnsupported');
121
+ // @nimi-authority: rule.nimi.runtime.ai-provider.embedding-retrieval-purpose
122
+ if (capabilityId === 'text.embed' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.embeddingPurposeUnsupported');
93
123
  if (diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.mediaOptionUnsupported');
94
124
  if (diagnostics?.reasonCode === MODALITY_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.message.modalityUnsupported');
95
125
  if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.message.providerRateLimited');
@@ -101,20 +131,25 @@ export function studioNonSuccessReasonUserMessage(reason: string, translate: Stu
101
131
  }
102
132
 
103
133
  export function studioNonSuccessReasonUserAction(reason: string, translate: StudioTranslate, capabilityId?: string, diagnostics?: StudioNonSuccessDiagnostics): string {
134
+ const storage = capabilityId === 'video.generate' ? mediaStorageKeySegment(diagnostics) : '';
135
+ if (storage) return translate(`NonSuccess.action.${storage}`);
104
136
  if (capabilityId === 'audio.synthesize' && diagnostics && UNAVAILABLE_VOICE_REASON_CODES.has(diagnostics.reasonCode)) return translate('NonSuccess.action.voiceUnavailable');
105
137
  if (reason === 'input-invalid' && capabilityId === 'audio.transcribe') return translate('NonSuccess.action.transcriptionInputInvalid');
106
138
  if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_INPUT_INVALID_REASON_CODE) return translate('NonSuccess.action.voiceInputRequired');
107
139
  if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_TARGET_MISMATCH_REASON_CODE) return translate('NonSuccess.action.voiceTargetMismatch');
108
140
  if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === 'AI_LOCAL_SELECTION_NOT_FOUND') return translate('VisionLocate.selectModelAction');
109
141
  if (isStoppedDirectCall(reason, capabilityId)) return translate('NonSuccess.action.stoppedDirectCall');
142
+ if (diagnostics?.reasonCode === CONTENT_FILTER_BLOCKED_REASON_CODE) return translate('NonSuccess.action.contentFilterBlocked');
110
143
  if (diagnostics?.reasonCode === INPUT_LIMIT_EXCEEDED_REASON_CODE) return translate('NonSuccess.action.inputLimitExceeded');
111
144
  if (diagnostics?.reasonCode === TEXT_BEHAVIOR_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.textBehaviorUnsupported');
112
145
  if (diagnostics?.reasonCode === MEDIA_CODEC_UNAVAILABLE_REASON_CODE) return translate('NonSuccess.action.mediaCodecUnavailable');
113
146
  if (diagnostics?.reasonCode === LOCAL_LOAD_FAILED_REASON_CODE) return translate('NonSuccess.action.localLoadFailed');
147
+ if (diagnostics?.reasonCode === LOCAL_CONFIGURATION_MISSING_REASON_CODE) return translate('NonSuccess.action.localConfigurationMissing');
114
148
  if (capabilityId === 'vision.locate' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('VisionLocate.chooseSupportedGeometry');
149
+ if (capabilityId === 'text.embed' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.embeddingPurposeUnsupported');
115
150
  if (diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.mediaOptionUnsupported');
116
151
  if (diagnostics?.reasonCode === MODALITY_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.modalityUnsupported');
117
- if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.action.providerRateLimited', { usageUrl: NIMI_CHATGPT_PLAN_USAGE_URL });
152
+ if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.action.providerRateLimited');
118
153
  const reselection = targetReselectionKeySegment(diagnostics);
119
154
  if (reselection) return translate(`NonSuccess.action.${reselection}`);
120
155
  if (reason === 'input-invalid' && capabilityId === 'vision.locate') return translate('VisionLocate.correctInput');
@@ -20,6 +20,7 @@ export type StudioParameterPanelProps = {
20
20
  readonly parameters: StudioParameterValue;
21
21
  readonly disabled: boolean;
22
22
  readonly onChange: (parameters: StudioParameterValue) => void;
23
+ readonly onInputPreparationStart?: () => () => void;
23
24
  };
24
25
 
25
26
  export type StudioParameterFieldDefinition = {
@@ -32,22 +33,27 @@ export function StudioParameterPanelFrame({
32
33
  translate,
33
34
  disabled,
34
35
  onReset,
36
+ primary,
35
37
  children,
36
38
  }: {
37
39
  readonly translate: StudioParameterTranslate;
38
40
  readonly disabled: boolean;
39
41
  readonly onReset: () => void;
42
+ readonly primary?: ReactNode;
40
43
  readonly children: ReactNode;
41
44
  }) {
42
45
  return (
43
46
  <section className="studio-parameters" aria-label={translate('Studio.parameters.title')}>
44
- <div className="studio-parameters__head">
45
- <span>{translate('Studio.parameters.presenceHint')}</span>
46
- <Button type="button" tone="ghost" size="sm" disabled={disabled} onClick={onReset}>
47
- {translate('Studio.parameters.reset')}
48
- </Button>
47
+ {primary}
48
+ <div className="studio-parameters__advanced">
49
+ <div className="studio-parameters__head">
50
+ <span>{translate('Studio.parameters.presenceHint')}</span>
51
+ <Button type="button" tone="ghost" size="sm" disabled={disabled} onClick={onReset}>
52
+ {translate('Studio.parameters.reset')}
53
+ </Button>
54
+ </div>
55
+ {children}
49
56
  </div>
50
- {children}
51
57
  </section>
52
58
  );
53
59
  }
@@ -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);