@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.
- package/README.md +48 -5
- package/bin/nimi-app.mjs +26 -10
- package/lib/app-access-declaration.mjs +3 -0
- package/lib/app-dependency-combinations.mjs +70 -24
- package/lib/app-doctor-update.mjs +92 -36
- package/lib/app-host-support.mjs +6 -0
- package/lib/app-identifiers.mjs +27 -0
- package/lib/app-lifecycle-guidance.mjs +1 -1
- package/lib/app-pack.mjs +14 -36
- package/lib/app-project-lifecycle.mjs +141 -243
- package/lib/app-scaffold-capabilities.mjs +13 -109
- package/lib/app-scaffold-profiles.mjs +81 -115
- package/lib/app-scaffold.mjs +68 -164
- package/lib/app-toolchain-updates.mjs +45 -0
- package/lib/canonical-capability-ids.generated.mjs +2 -0
- package/lib/development-environment.d.mts +10 -0
- package/lib/development-environment.mjs +39 -0
- package/lib/hosted-web-release.mjs +98 -0
- package/lib/index.mjs +40 -1
- package/lib/mobile-development.mjs +19 -0
- package/lib/realm-environments.generated.mjs +5 -0
- package/lib/web-coordination.mjs +59 -0
- package/lib/web-development.d.mts +23 -0
- package/lib/web-development.mjs +118 -0
- package/lib/web-scaffold.mjs +125 -0
- package/package.json +32 -21
- package/scripts/dev-shell.mjs +4 -1
- package/scripts/sync-scaffold-versions.mjs +0 -2
- package/skills/nimi-app-lifecycle/SKILL.md +3 -1
- package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
- package/skills/nimi-app-lifecycle/references/adapt.md +5 -3
- package/skills/nimi-app-lifecycle/references/audit.md +3 -2
- package/skills/nimi-app-lifecycle/references/create.md +6 -2
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +12 -7
- package/templates/app-source/src/ai-studio-core/ai-studio-core.css +87 -52
- package/templates/app-source/src/ai-studio-core/history-policy.ts +45 -11
- package/templates/app-source/src/ai-studio-core/history.ts +22 -11
- package/templates/app-source/src/ai-studio-core/host-context.tsx +9 -4
- package/templates/app-source/src/ai-studio-core/index.ts +2 -0
- package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -5
- package/templates/app-source/src/ai-studio-core/job-recovery.ts +2 -2
- package/templates/app-source/src/ai-studio-core/messages/en.json +73 -19
- package/templates/app-source/src/ai-studio-core/messages/zh.json +73 -19
- package/templates/app-source/src/ai-studio-core/module-registration.ts +1 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +30 -5
- package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +12 -6
- package/templates/app-source/src/ai-studio-core/parameters.ts +4 -0
- package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +42 -0
- package/templates/app-source/src/ai-studio-core/runtime-types.ts +9 -2
- package/templates/app-source/src/ai-studio-core/runtime.ts +8 -4
- package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +98 -90
- package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +1 -1
- package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +205 -48
- package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +1 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +36 -14
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +96 -75
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +59 -16
- package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +2 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +12 -21
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +2 -2
- package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +3 -3
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +158 -76
- package/templates/app-source/src/ai-studio-core/workspace.tsx +49 -22
- package/templates/app-source/src/product-modules/agent-center/index.tsx +2 -3
- package/templates/app-source/src/product-modules/agent-conversation/index.tsx +2 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -5
- package/templates/app-source/src/studio-modules/studio-media/messages/en.json +59 -8
- package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +59 -8
- package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +2 -1
- package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +271 -83
- package/templates/app-source/src/studio-modules/studio-media/parameters.ts +120 -2
- package/templates/app-source/src/studio-modules/studio-media/registration.ts +1 -0
- package/templates/app-source/src/studio-modules/studio-media/runtime.ts +24 -14
- package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +1 -1
- package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +46 -23
- package/templates/app-source/src/studio-modules/studio-voice/registration.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +2 -2
- package/templates/app-source/src/workbench-core/workbench-core.tsx +27 -3
- package/templates/default-starter/AGENTS.md +3 -3
- package/templates/default-starter/README.md +1 -1
- package/templates/default-starter/src/shell/App.tsx +6 -18
- package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
- package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
- package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
- package/templates/default-starter.manifest.json +0 -16
- package/templates/hosted-web-release.yml +88 -0
- package/templates/default-starter/src-tauri/Cargo.toml +0 -17
- package/templates/default-starter/src-tauri/build.rs +0 -32
- package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
- 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": "
|
|
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": "删除记录及其保存的结果",
|
|
@@ -144,7 +159,7 @@
|
|
|
144
159
|
"mediaOptionUnsupported": "当前模型不支持这次请求中的一项或多项媒体参数。",
|
|
145
160
|
"embeddingPurposeUnsupported": "所选模型不支持当前的检索用途设置。",
|
|
146
161
|
"modalityUnsupported": "当前配置不支持这次请求中的一项或多项输入或参数。",
|
|
147
|
-
"providerRateLimited": "
|
|
162
|
+
"providerRateLimited": "云服务因速率、用量或账户余额限制拒绝了本次请求。",
|
|
148
163
|
"mediaCodecUnavailable": "运行此请求时,所需的 Nimi 音视频工具不可用。",
|
|
149
164
|
"localLoadFailed": "当前本机配置无法按这次请求运行。",
|
|
150
165
|
"localConfigurationMissing": "这项本机 AI 能力还没有可运行的配置。保存 App 的选择并不表示模型已经准备好。",
|
|
@@ -159,7 +174,13 @@
|
|
|
159
174
|
"configInvalid": "此能力保存的 AI 配置无法在当前 Runtime 中运行,例如所用的云服务已不再支持。",
|
|
160
175
|
"modelNotFound": "所选模型不可用:其云端账户未提供该模型,或没有可用的已准入实现。本次没有生成内容。",
|
|
161
176
|
"fallback": "本次生成未完成。",
|
|
162
|
-
"stoppedDirectCall": "已停止等待这次调用,之后返回的结果不会显示。"
|
|
177
|
+
"stoppedDirectCall": "已停止等待这次调用,之后返回的结果不会显示。",
|
|
178
|
+
"providerAuthFailed": "云服务拒绝了当前连接的凭据。API 密钥可能已过期、被撤销或无效。",
|
|
179
|
+
"mediaStorageMissing": "这次视频请求需要配置存储,用于上传参考音频或视频。",
|
|
180
|
+
"mediaStorageCredentials": "OSS 拒绝了参考素材存储的凭据。",
|
|
181
|
+
"mediaStorageVersioning": "参考素材存储需要使用从未启用版本控制的 Bucket。",
|
|
182
|
+
"mediaStorageUnavailable": "参考素材存储请求未能完成。",
|
|
183
|
+
"mediaStorageCleanup": "本任务未能确认已上传参考对象的归属或删除结果。"
|
|
163
184
|
},
|
|
164
185
|
"action": {
|
|
165
186
|
"runtimeUnavailable": "返回 Desktop 确认本地 AI 已连接,然后重试。",
|
|
@@ -174,13 +195,13 @@
|
|
|
174
195
|
"runtimeCallFailed": "先重试一次;如果仍然失败,再展开 Runtime 详情查看原因。",
|
|
175
196
|
"contentFilterBlocked": "请尝试移除或脱敏受限内容,或调整所选上下文后重新提交。",
|
|
176
197
|
"inputLimitExceeded": "请缩短输入,或配置可接受更长输入的模型,然后重新运行。",
|
|
177
|
-
"textBehaviorUnsupported": "
|
|
198
|
+
"textBehaviorUnsupported": "打开「参数」并重置此模型不支持的设置,或在本 App 的 AI 配置中改选支持该行为的模型,再重新运行。",
|
|
178
199
|
"mediaOptionUnsupported": "打开「参数」重置不受支持的设置后重新运行,也可以在 App AI 配置中选择支持这些设置的模型。",
|
|
179
200
|
"embeddingPurposeUnsupported": "打开「参数」,按任务选择「待检索内容」(建立索引)或「检索问题」(搜索),再重新运行。如果仍不支持该用途,可在 App AI 配置中选择支持它的模型。",
|
|
180
201
|
"modalityUnsupported": "请先修改输入,或在「参数」中重置不受支持的设置后再运行,也可以选择支持这次请求的配置。",
|
|
181
|
-
"providerRateLimited": "
|
|
202
|
+
"providerRateLimited": "请检查当前服务商的速率限制、账户余额、套餐和分配给本 App 的用量额度。解除相应限制后再重新运行。",
|
|
182
203
|
"mediaCodecUnavailable": "在 Nimi Desktop 打开「AI 能力」→「高级与诊断」→「音频与视频组件」;如组件未就绪,选择「安装或修复」,等显示已安装后再运行此请求。",
|
|
183
|
-
"localLoadFailed": "
|
|
204
|
+
"localLoadFailed": "请确认输入和参数与所选模型匹配;如需检查公共模型和组件,请在主机 Nimi Home 的「AI 能力」中处理,完成后再运行。Runtime 详情保留了本次失败信息。",
|
|
184
205
|
"localConfigurationMissing": "请在 Nimi Home 的「AI 能力」中完成这项能力的本机模型配置,确认已可用后,返回这里重新提交当前输入。Runtime 详情保留了本次失败信息。",
|
|
185
206
|
"voiceInputRequired": "打开「参数」选择当前模型支持的预设语音或兼容的本地语音资产;如该模型需要资产而列表为空,先到「创建语音」创建,再返回重试。",
|
|
186
207
|
"voiceTargetMismatch": "选择与当前语音模型兼容的资产,或先在「创建语音」中创建一个,再重试。",
|
|
@@ -193,7 +214,13 @@
|
|
|
193
214
|
"configInvalid": "打开 App AI 配置,为此能力重新选择模型,然后重新运行。",
|
|
194
215
|
"modelNotFound": "打开 App AI 配置,为此能力选择一个可用的模型,然后重新运行。",
|
|
195
216
|
"fallback": "请重试;如果仍然失败,再展开 Runtime 详情查看原因。",
|
|
196
|
-
"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。重新生成不能证明旧素材已被删除。"
|
|
197
224
|
},
|
|
198
225
|
"hint": {
|
|
199
226
|
"runtimeUnavailable": "恢复受保护的 Runtime 连接后重试同一请求。",
|
|
@@ -221,15 +248,22 @@
|
|
|
221
248
|
"expandGeneratedImage": "展开生成的图片",
|
|
222
249
|
"imagePreview": "图片预览",
|
|
223
250
|
"imagePreviewFailed": "无法打开图片预览,请重试。",
|
|
251
|
+
"mediaPreviewFailed": "未能加载已保存的媒体,请重试读取原结果。",
|
|
224
252
|
"closeImagePreview": "关闭图片预览",
|
|
225
253
|
"emptyBody": "(空内容)",
|
|
226
254
|
"emptyTranscript": "(空转写)",
|
|
227
255
|
"contextLabel": "上下文",
|
|
228
|
-
"requestSettings": "
|
|
256
|
+
"requestSettings": "运行配置与参数",
|
|
257
|
+
"modelNotRecorded": "模型目标未记录",
|
|
258
|
+
"parametersNotRecorded": "这条记录没有保存请求参数。",
|
|
259
|
+
"configuredDefaults": "提交时的应用默认值",
|
|
260
|
+
"recordedConfigScope": "这里显示提交时的设置。实际执行模型和服务端补齐的默认值未记录。",
|
|
229
261
|
"showRequestSettings": "显示请求设置",
|
|
230
262
|
"hideRequestSettings": "隐藏请求设置",
|
|
231
263
|
"legacyRecordHint": "这条较早的历史记录仅包含状态元数据。重新运行一次即可保存类型化的结果快照。",
|
|
232
264
|
"historyInputTruncated": "历史只保留这段长输入的开头部分,因此这条记录不能用作草稿或重新运行。",
|
|
265
|
+
"recordedInput": "当次输入",
|
|
266
|
+
"editNextRun": "编辑下一次运行",
|
|
233
267
|
"historyAdditionalDocumentsNotRetained": "只能将第一篇文档用作草稿。重新运行前请再次添加其他文档。",
|
|
234
268
|
"generationFailed": "生成未能完成",
|
|
235
269
|
"generationCanceled": "生成已取消",
|
|
@@ -242,10 +276,10 @@
|
|
|
242
276
|
"downloadGeneration": "下载生成结果",
|
|
243
277
|
"revealAsset": "在文件夹中显示",
|
|
244
278
|
"revealGeneration": "在文件夹中显示生成文件",
|
|
245
|
-
"regenerate": "
|
|
246
|
-
"newRun": "
|
|
247
|
-
"useAsDraft": "
|
|
248
|
-
"intentLabel": "
|
|
279
|
+
"regenerate": "按当前配置再次运行",
|
|
280
|
+
"newRun": "返回草稿",
|
|
281
|
+
"useAsDraft": "复用输入",
|
|
282
|
+
"intentLabel": "当次配置",
|
|
249
283
|
"embeddingSuccess": "向量嵌入生成成功。",
|
|
250
284
|
"voiceAssetSuccess": "这次运行创建了一个音色。",
|
|
251
285
|
"voiceExpiry": "提供方有效期:{{date}}。实际使用可能延长有效期。",
|
|
@@ -260,7 +294,7 @@
|
|
|
260
294
|
"promptLabel": "提示词",
|
|
261
295
|
"requestLabel": "请求",
|
|
262
296
|
"generationLabel": "生成结果",
|
|
263
|
-
"runStatusReady": "
|
|
297
|
+
"runStatusReady": "已完成",
|
|
264
298
|
"runStatusUnavailable": "SDK 不可用",
|
|
265
299
|
"runStatusFailed": "失败",
|
|
266
300
|
"runStatusCanceled": "已取消",
|
|
@@ -287,14 +321,21 @@
|
|
|
287
321
|
"runtimeOwnedIntent": "由 Runtime 拥有的能力意图",
|
|
288
322
|
"openIntentConfig": "打开 AI 意图配置",
|
|
289
323
|
"configureIntent": "配置能力意图",
|
|
324
|
+
"inputRequired": "请添加本次实验所需的输入。",
|
|
290
325
|
"context": "上下文",
|
|
291
326
|
"contextAttached": "已附加上下文",
|
|
292
|
-
"attachContext": "
|
|
327
|
+
"attachContext": "添加附件",
|
|
328
|
+
"inputTitle": "实验输入",
|
|
329
|
+
"sourceUrl": "来源链接",
|
|
330
|
+
"runShortcut": "Ctrl / ⌘ + Enter",
|
|
293
331
|
"removeAttachment": "移除 {{name}}",
|
|
294
332
|
"requestAriaLabel": "{{capability}}请求",
|
|
295
333
|
"startAriaLabel": "{{capability}}起始页",
|
|
296
334
|
"contextPlaceholder": "可选的上下文、受众、来源笔记或约束",
|
|
297
|
-
"intentSummary": "
|
|
335
|
+
"intentSummary": "下次运行 · {{intent}}",
|
|
336
|
+
"routeLocal": "本地",
|
|
337
|
+
"routeCloud": "云端",
|
|
338
|
+
"routeUnknown": "路由未知"
|
|
298
339
|
},
|
|
299
340
|
"parameters": {
|
|
300
341
|
"title": "参数",
|
|
@@ -313,7 +354,12 @@
|
|
|
313
354
|
}
|
|
314
355
|
},
|
|
315
356
|
"run": {
|
|
316
|
-
"aiConfigLoadFailed": "
|
|
357
|
+
"aiConfigLoadFailed": "无法读取此应用的 AI 配置。",
|
|
358
|
+
"runtimeConnected": "Runtime 已连接",
|
|
359
|
+
"runtimeChecking": "正在检查 Runtime",
|
|
360
|
+
"runtimeUnavailable": "Runtime 不可用",
|
|
361
|
+
"effectiveTargetUnavailable": "已配置的目标不可用。请检查所选模型或 Loadout。",
|
|
362
|
+
"retryPreparation": "重新检查"
|
|
317
363
|
},
|
|
318
364
|
"drawerError": {
|
|
319
365
|
"title": "模型配置不可用",
|
|
@@ -324,6 +370,7 @@
|
|
|
324
370
|
"admissionLabel": "准入",
|
|
325
371
|
"reasonLabel": "原因",
|
|
326
372
|
"traceLabel": "追踪",
|
|
373
|
+
"jobLabel": "Runtime 任务",
|
|
327
374
|
"verboseConsoleNote": "详细控制台:能力 {{capability}};{{state}}。",
|
|
328
375
|
"verboseTypedSuccess": "类型化成功",
|
|
329
376
|
"verboseFailClosed": "失败关闭:{{reason}}",
|
|
@@ -360,6 +407,7 @@
|
|
|
360
407
|
"statState": "状态",
|
|
361
408
|
"stateUnknown": "未知",
|
|
362
409
|
"statVoices": "语音",
|
|
410
|
+
"metricCharacters": "{{count}} 字符",
|
|
363
411
|
"metricWords_one": "{{count}} 个词",
|
|
364
412
|
"metricWords_other": "{{count}} 个词",
|
|
365
413
|
"metricArtifacts_one": "{{count}} 个产物",
|
|
@@ -434,7 +482,8 @@
|
|
|
434
482
|
"toolResult": "工具结果 {{name}} · {{id}}",
|
|
435
483
|
"toolError": "工具错误 {{name}} · {{id}}",
|
|
436
484
|
"structured": "解析后的结构化结果",
|
|
437
|
-
"finalText": "最终文本"
|
|
485
|
+
"finalText": "最终文本",
|
|
486
|
+
"jsonObjectScenario": "JSON 对象测试:App 已解析最终文本并确认其为对象。"
|
|
438
487
|
},
|
|
439
488
|
"decision": {
|
|
440
489
|
"title": "判断结果",
|
|
@@ -460,7 +509,12 @@
|
|
|
460
509
|
"nothingObserved": "未观察到任何结果。",
|
|
461
510
|
"notRestorable": "已关闭的会话无法恢复。如需再次测试,请打开新会话。",
|
|
462
511
|
"stateClosed": "已关闭",
|
|
463
|
-
"stateTerminated": "已终止"
|
|
512
|
+
"stateTerminated": "已终止",
|
|
513
|
+
"audioUsageFinal": "供方最终报告的累计音频:{{seconds}} 秒。此值不是 token 数或费用估算。",
|
|
514
|
+
"audioUsagePartial": "服务商目前报告的累计音频:{{seconds}} 秒。该用量尚未标为最终值。",
|
|
515
|
+
"localClosureUnconfirmed": "会话已结束,本地资源释放尚未确认。",
|
|
516
|
+
"providerClosureConfirmed": "本地资源已释放,并已收到供方会话关闭回执。",
|
|
517
|
+
"localClosureConfirmed": "本地连接与资源已释放。服务商尚未确认会话已关闭。"
|
|
464
518
|
},
|
|
465
519
|
"faceSwap": {
|
|
466
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)}`);
|
|
@@ -54,14 +63,15 @@ const CONTENT_FILTER_BLOCKED_REASON_CODE = 'AI_CONTENT_FILTER_BLOCKED';
|
|
|
54
63
|
const VOICE_INPUT_INVALID_REASON_CODE = 'AI_VOICE_INPUT_INVALID';
|
|
55
64
|
const VOICE_TARGET_MISMATCH_REASON_CODE = 'AI_VOICE_TARGET_MODEL_MISMATCH';
|
|
56
65
|
const UNAVAILABLE_VOICE_REASON_CODES: ReadonlySet<string> = new Set(['AI_VOICE_ASSET_NOT_FOUND', 'AI_VOICE_ASSET_EXPIRED']);
|
|
57
|
-
//
|
|
58
|
-
//
|
|
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.
|
|
59
68
|
const PROVIDER_RATE_LIMITED_REASON_CODE = 'AI_PROVIDER_RATE_LIMITED';
|
|
60
69
|
|
|
61
70
|
// A committed target that Runtime can no longer run is recovered by choosing a
|
|
62
71
|
// target again (or repairing its Connector in Desktop), never by retrying the
|
|
63
72
|
// same request.
|
|
64
73
|
const TARGET_RESELECTION_KEY_SEGMENTS: ReadonlyMap<string, string> = new Map([
|
|
74
|
+
['AI_PROVIDER_AUTH_FAILED', 'providerAuthFailed'],
|
|
65
75
|
['AI_REMOTE_MODEL_CATALOG_STALE', 'catalogStale'],
|
|
66
76
|
['CAPABILITY_CATALOG_MISMATCH', 'catalogMismatch'],
|
|
67
77
|
['AI_CONNECTOR_DISABLED', 'connectorDisabled'],
|
|
@@ -79,9 +89,22 @@ export function studioNonSuccessNeedsTargetReselection(diagnostics?: StudioNonSu
|
|
|
79
89
|
return targetReselectionKeySegment(diagnostics) !== '';
|
|
80
90
|
}
|
|
81
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
|
+
|
|
82
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}`);
|
|
83
106
|
if (capabilityId === 'audio.synthesize' && diagnostics && UNAVAILABLE_VOICE_REASON_CODES.has(diagnostics.reasonCode)) return translate('NonSuccess.message.voiceUnavailable');
|
|
84
|
-
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;
|
|
85
108
|
if (reason === 'input-invalid' && capabilityId === 'audio.transcribe') return translate('NonSuccess.message.transcriptionInputInvalid');
|
|
86
109
|
if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_INPUT_INVALID_REASON_CODE) return translate('NonSuccess.message.voiceInputRequired');
|
|
87
110
|
if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_TARGET_MISMATCH_REASON_CODE) return translate('NonSuccess.message.voiceTargetMismatch');
|
|
@@ -108,6 +131,8 @@ export function studioNonSuccessReasonUserMessage(reason: string, translate: Stu
|
|
|
108
131
|
}
|
|
109
132
|
|
|
110
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}`);
|
|
111
136
|
if (capabilityId === 'audio.synthesize' && diagnostics && UNAVAILABLE_VOICE_REASON_CODES.has(diagnostics.reasonCode)) return translate('NonSuccess.action.voiceUnavailable');
|
|
112
137
|
if (reason === 'input-invalid' && capabilityId === 'audio.transcribe') return translate('NonSuccess.action.transcriptionInputInvalid');
|
|
113
138
|
if (capabilityId === 'audio.synthesize' && diagnostics?.reasonCode === VOICE_INPUT_INVALID_REASON_CODE) return translate('NonSuccess.action.voiceInputRequired');
|
|
@@ -124,7 +149,7 @@ export function studioNonSuccessReasonUserAction(reason: string, translate: Stud
|
|
|
124
149
|
if (capabilityId === 'text.embed' && diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.embeddingPurposeUnsupported');
|
|
125
150
|
if (diagnostics?.reasonCode === MEDIA_OPTION_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.mediaOptionUnsupported');
|
|
126
151
|
if (diagnostics?.reasonCode === MODALITY_UNSUPPORTED_REASON_CODE) return translate('NonSuccess.action.modalityUnsupported');
|
|
127
|
-
if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.action.providerRateLimited'
|
|
152
|
+
if (diagnostics?.reasonCode === PROVIDER_RATE_LIMITED_REASON_CODE) return translate('NonSuccess.action.providerRateLimited');
|
|
128
153
|
const reselection = targetReselectionKeySegment(diagnostics);
|
|
129
154
|
if (reselection) return translate(`NonSuccess.action.${reselection}`);
|
|
130
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
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
{translate('Studio.parameters.
|
|
48
|
-
|
|
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:
|
|
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: () =>
|
|
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);
|