@nimiplatform/sdk 0.22.1 → 0.24.0-rc.10
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/CHANGELOG.md +218 -0
- package/README.md +30 -1
- package/dist/core/ai/capability-configuration.d.ts +35 -1
- package/dist/core/ai/capability-configuration.d.ts.map +1 -1
- package/dist/core/ai/capability-configuration.js +58 -3
- package/dist/core/ai/capability-configuration.js.map +1 -1
- package/dist/core/ai/index.d.ts +1 -0
- package/dist/core/ai/index.d.ts.map +1 -1
- package/dist/core/ai/index.js +1 -0
- package/dist/core/ai/index.js.map +1 -1
- package/dist/core/ai/local-app-model.d.ts +3 -0
- package/dist/core/ai/local-app-model.d.ts.map +1 -1
- package/dist/core/ai/local-app-model.js +7 -7
- package/dist/core/ai/local-app-model.js.map +1 -1
- package/dist/core/ai/reasoning.d.ts +3 -1
- package/dist/core/ai/reasoning.d.ts.map +1 -1
- package/dist/core/ai/reasoning.js +2 -1
- package/dist/core/ai/reasoning.js.map +1 -1
- package/dist/core/app/desktop-open.d.ts +17 -4
- package/dist/core/app/desktop-open.d.ts.map +1 -1
- package/dist/core/app/desktop-open.js +46 -6
- package/dist/core/app/desktop-open.js.map +1 -1
- package/dist/core/app/index.d.ts +8 -2
- package/dist/core/app/index.d.ts.map +1 -1
- package/dist/core/app/index.js +3 -0
- package/dist/core/app/index.js.map +1 -1
- package/dist/core/app/local-app-agent-work-input.d.ts +1 -1
- package/dist/core/app/local-app-agent-work-input.d.ts.map +1 -1
- package/dist/core/app/local-app-agent-work-input.js +5 -2
- package/dist/core/app/local-app-agent-work-input.js.map +1 -1
- package/dist/core/app/local-app-character-discovery.d.ts +44 -0
- package/dist/core/app/local-app-character-discovery.d.ts.map +1 -0
- package/dist/core/app/local-app-character-discovery.js +82 -0
- package/dist/core/app/local-app-character-discovery.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-activity-view.d.ts +2 -0
- package/dist/core/app/local-app-runtime-platform-activity-view.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity-view.js +4 -1
- package/dist/core/app/local-app-runtime-platform-activity-view.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity.d.ts +2 -2
- package/dist/core/app/local-app-runtime-platform-activity.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity.js +2 -0
- package/dist/core/app/local-app-runtime-platform-activity.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-agent-work.js +1 -1
- package/dist/core/app/local-app-runtime-platform-agent-work.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-ai-config.d.ts +3 -3
- package/dist/core/app/local-app-runtime-platform-ai-config.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-ai-config.js +19 -7
- package/dist/core/app/local-app-runtime-platform-ai-config.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-ai.d.ts +28 -2
- package/dist/core/app/local-app-runtime-platform-ai.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-ai.js +112 -25
- package/dist/core/app/local-app-runtime-platform-ai.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-assets.d.ts +2 -0
- package/dist/core/app/local-app-runtime-platform-assets.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-assets.js +5 -2
- package/dist/core/app/local-app-runtime-platform-assets.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-ai-realtime.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-ai-realtime.js +33 -4
- package/dist/core/app/local-app-runtime-platform-direct-ai-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-realtime-shared.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-realtime-shared.js +1 -0
- package/dist/core/app/local-app-runtime-platform-direct-realtime-shared.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-integration.d.ts +13 -0
- package/dist/core/app/local-app-runtime-platform-integration.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-integration.js +89 -15
- package/dist/core/app/local-app-runtime-platform-integration.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-realm-realtime.js +1 -1
- package/dist/core/app/local-app-runtime-platform-realm-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-realtime.d.ts +55 -10
- package/dist/core/app/local-app-runtime-platform-realtime.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-realtime.js +66 -23
- package/dist/core/app/local-app-runtime-platform-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-utopia.d.ts +208 -0
- package/dist/core/app/local-app-runtime-platform-utopia.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-utopia.js +629 -0
- package/dist/core/app/local-app-runtime-platform-utopia.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-world-creator.d.ts +2 -0
- package/dist/core/app/local-app-runtime-platform-world-creator.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-world-creator.js +8 -6
- package/dist/core/app/local-app-runtime-platform-world-creator.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform.d.ts +7 -3
- package/dist/core/app/local-app-runtime-platform.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform.js +23 -113
- package/dist/core/app/local-app-runtime-platform.js.map +1 -1
- package/dist/core/app/local-app-text-candidate.d.ts +3 -0
- package/dist/core/app/local-app-text-candidate.d.ts.map +1 -0
- package/dist/core/app/local-app-text-candidate.js +100 -0
- package/dist/core/app/local-app-text-candidate.js.map +1 -0
- package/dist/core/app/local-app-text.d.ts +6 -0
- package/dist/core/app/local-app-text.d.ts.map +1 -1
- package/dist/core/app/local-app-text.js +19 -4
- package/dist/core/app/local-app-text.js.map +1 -1
- package/dist/core/app/portable-client.d.ts +17 -0
- package/dist/core/app/portable-client.d.ts.map +1 -0
- package/dist/core/app/portable-client.js +2 -0
- package/dist/core/app/portable-client.js.map +1 -0
- package/dist/core/app/runtime-account-realm-source-readiness.generated.d.ts +2 -2
- package/dist/core/app/runtime-account-realm-source-readiness.generated.d.ts.map +1 -1
- package/dist/core/app/runtime-account-realm-source-readiness.generated.js +11 -1
- package/dist/core/app/runtime-account-realm-source-readiness.generated.js.map +1 -1
- package/dist/core/contracts/primitives.d.ts +8 -0
- package/dist/core/contracts/primitives.d.ts.map +1 -1
- package/dist/core/contracts/primitives.js.map +1 -1
- package/dist/core-client/index.d.ts +3 -1
- package/dist/core-client/index.d.ts.map +1 -1
- package/dist/core-client/index.js +13 -2
- package/dist/core-client/index.js.map +1 -1
- package/dist/core-generated/realm-client.d.ts.map +1 -1
- package/dist/core-generated/realm-client.js +166 -4
- package/dist/core-generated/realm-client.js.map +1 -1
- package/dist/core-generated/realm-typed-client.d.ts +712 -28
- package/dist/core-generated/realm-typed-client.d.ts.map +1 -1
- package/dist/core-generated/realm-typed-client.js +333 -6
- package/dist/core-generated/realm-typed-client.js.map +1 -1
- package/dist/core-generated/runtime-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-client.js +112 -0
- package/dist/core-generated/runtime-client.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.d.ts +137 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.js +314 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.d.ts +154 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.js +343 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_utopia.d.ts +985 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_utopia.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_utopia.js +2132 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_utopia.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.d.ts +315 -3
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.js +569 -7
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai_realtime.d.ts +229 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai_realtime.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai_realtime.js +432 -7
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai_realtime.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/app.d.ts +33 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/app.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/app.js +74 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/app.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.d.ts +31 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.js +62 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/auth.d.ts +33 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/auth.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/auth.js +76 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/auth.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.d.ts +151 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.js +281 -5
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.d.ts +31 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.js +30 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.d.ts +298 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.js +611 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.d.ts +146 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.js +296 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime.d.ts +12 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime.js +25 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realtime_control.d.ts +5 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realtime_control.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realtime_control.js +4 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/realtime_control.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/remote_access.d.ts +552 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/remote_access.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/remote_access.js +1097 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/remote_access.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.d.ts +4 -3
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.js.map +1 -1
- package/dist/core-generated/runtime-public-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-client.js +104 -0
- package/dist/core-generated/runtime-public-client.js.map +1 -1
- package/dist/core-generated/runtime-public-rpc-auth-posture.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-rpc-auth-posture.js +13 -0
- package/dist/core-generated/runtime-public-rpc-auth-posture.js.map +1 -1
- package/dist/core-generated/runtime-public-wire-codecs.d.ts +18 -3
- package/dist/core-generated/runtime-public-wire-codecs.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-wire-codecs.js +18 -3
- package/dist/core-generated/runtime-public-wire-codecs.js.map +1 -1
- package/dist/core-generated/runtime-rpc-auth-posture.d.ts.map +1 -1
- package/dist/core-generated/runtime-rpc-auth-posture.js +14 -0
- package/dist/core-generated/runtime-rpc-auth-posture.js.map +1 -1
- package/dist/core-generated/runtime-typed-client.d.ts +37 -18
- package/dist/core-generated/runtime-typed-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-typed-client.js +159 -8
- package/dist/core-generated/runtime-typed-client.js.map +1 -1
- package/dist/core-generated/runtime-wire-codecs.d.ts +20 -4
- package/dist/core-generated/runtime-wire-codecs.d.ts.map +1 -1
- package/dist/core-generated/runtime-wire-codecs.js +20 -4
- package/dist/core-generated/runtime-wire-codecs.js.map +1 -1
- package/dist/features/generation/runtime-image-generation.d.ts +8 -1
- package/dist/features/generation/runtime-image-generation.d.ts.map +1 -1
- package/dist/features/generation/runtime-image-generation.js +7 -0
- package/dist/features/generation/runtime-image-generation.js.map +1 -1
- package/dist/features/generation/runtime-scenarios.d.ts +8 -1
- package/dist/features/generation/runtime-scenarios.d.ts.map +1 -1
- package/dist/features/generation/runtime-scenarios.js +17 -1
- package/dist/features/generation/runtime-scenarios.js.map +1 -1
- package/dist/realm/account-settings.d.ts +2 -2
- package/dist/realm/account-settings.d.ts.map +1 -1
- package/dist/realm/auth.d.ts.map +1 -1
- package/dist/realm/auth.js +1 -0
- package/dist/realm/auth.js.map +1 -1
- package/dist/realm/index.d.ts +5 -4
- package/dist/realm/index.d.ts.map +1 -1
- package/dist/realm/index.js +7 -1
- package/dist/realm/index.js.map +1 -1
- package/dist/realm/media-delivery.d.ts.map +1 -1
- package/dist/realm/media-delivery.js +15 -7
- package/dist/realm/media-delivery.js.map +1 -1
- package/dist/realm/notifications.d.ts +2 -0
- package/dist/realm/notifications.d.ts.map +1 -1
- package/dist/realm/notifications.js +8 -3
- package/dist/realm/notifications.js.map +1 -1
- package/dist/realm/resource-upload.d.ts +13 -0
- package/dist/realm/resource-upload.d.ts.map +1 -1
- package/dist/realm/resource-upload.js +35 -21
- package/dist/realm/resource-upload.js.map +1 -1
- package/dist/realm/runtime-client.d.ts +57 -0
- package/dist/realm/runtime-client.d.ts.map +1 -0
- package/dist/realm/runtime-client.js +241 -0
- package/dist/realm/runtime-client.js.map +1 -0
- package/dist/realm/social-types.d.ts +1 -1
- package/dist/realm/social-types.d.ts.map +1 -1
- package/dist/realm/social.d.ts +17 -3
- package/dist/realm/social.d.ts.map +1 -1
- package/dist/realm/social.js +66 -114
- package/dist/realm/social.js.map +1 -1
- package/dist/runtime/config-projections.d.ts +25 -0
- package/dist/runtime/config-projections.d.ts.map +1 -1
- package/dist/runtime/config-projections.js +4 -0
- package/dist/runtime/config-projections.js.map +1 -1
- package/dist/runtime/connector-inventory.d.ts +14 -3
- package/dist/runtime/connector-inventory.d.ts.map +1 -1
- package/dist/runtime/connector-inventory.js +13 -0
- package/dist/runtime/connector-inventory.js.map +1 -1
- package/dist/runtime/desktop-first-party-runtime.d.ts +2 -0
- package/dist/runtime/desktop-first-party-runtime.d.ts.map +1 -1
- package/dist/runtime/desktop-first-party-runtime.js +12 -0
- package/dist/runtime/desktop-first-party-runtime.js.map +1 -1
- package/dist/runtime/electron-ipc.d.ts.map +1 -1
- package/dist/runtime/electron-ipc.js +61 -26
- package/dist/runtime/electron-ipc.js.map +1 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.d.ts +275 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.d.ts.map +1 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.js +74 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/reason-messages.d.ts +5 -0
- package/dist/runtime/reason-messages.d.ts.map +1 -1
- package/dist/runtime/reason-messages.js +10 -0
- package/dist/runtime/reason-messages.js.map +1 -1
- package/dist/runtime/remote-app.d.ts +63 -0
- package/dist/runtime/remote-app.d.ts.map +1 -0
- package/dist/runtime/remote-app.js +184 -0
- package/dist/runtime/remote-app.js.map +1 -0
- package/dist/runtime/remote-data-channel.d.ts +25 -0
- package/dist/runtime/remote-data-channel.d.ts.map +1 -0
- package/dist/runtime/remote-data-channel.js +406 -0
- package/dist/runtime/remote-data-channel.js.map +1 -0
- package/dist/runtime/remote-realm.d.ts +9 -0
- package/dist/runtime/remote-realm.d.ts.map +1 -0
- package/dist/runtime/remote-realm.js +82 -0
- package/dist/runtime/remote-realm.js.map +1 -0
- package/dist/runtime/remote.d.ts +114 -0
- package/dist/runtime/remote.d.ts.map +1 -0
- package/dist/runtime/remote.js +177 -0
- package/dist/runtime/remote.js.map +1 -0
- package/dist/runtime/runtime-agent-consume-streams.d.ts.map +1 -1
- package/dist/runtime/runtime-agent-consume-streams.js +37 -15
- package/dist/runtime/runtime-agent-consume-streams.js.map +1 -1
- package/dist/runtime/runtime-agent-context-projections.d.ts +1 -1
- package/dist/runtime/runtime-agent-context-projections.d.ts.map +1 -1
- package/dist/runtime/runtime-agent-context-projections.js +5 -1
- package/dist/runtime/runtime-agent-context-projections.js.map +1 -1
- package/dist/runtime/wire-types/agent-participation-types.d.ts +4 -2
- package/dist/runtime/wire-types/agent-participation-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-enums.d.ts +58 -4
- package/dist/runtime/wire-types/ai-scenario-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-enums.js +60 -0
- package/dist/runtime/wire-types/ai-scenario-enums.js.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-types.d.ts +10 -8
- package/dist/runtime/wire-types/ai-scenario-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/identity-app-types.d.ts +8 -8
- package/dist/runtime/wire-types/identity-app-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/reason-code-enums.d.ts +8 -1
- package/dist/runtime/wire-types/reason-code-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/reason-code-enums.js +7 -0
- package/dist/runtime/wire-types/reason-code-enums.js.map +1 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +1 -0
- package/dist/types/errors.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/reason-code.d.ts +5 -0
- package/dist/types/reason-code.d.ts.map +1 -1
- package/dist/types/reason-code.js +5 -0
- package/dist/types/reason-code.js.map +1 -1
- package/package.json +12 -2
|
@@ -410,6 +410,17 @@ function validateScenarioSpec(spec, execute) {
|
|
|
410
410
|
}
|
|
411
411
|
assertNoAuthorityMaterial(record);
|
|
412
412
|
switch (record.type) {
|
|
413
|
+
// @nimi-authority: rule.nimi.runtime.ai-provider.media-upscale-contract
|
|
414
|
+
case 'image-upscale':
|
|
415
|
+
case 'video-upscale':
|
|
416
|
+
if (execute)
|
|
417
|
+
invalidAIInput('super-resolution requires an async Job');
|
|
418
|
+
assertExactKeys(record, ['type', 'sourceArtifactId', 'scale', 'seed'], 'super-resolution spec');
|
|
419
|
+
boundedIdentifier(record.sourceArtifactId, 'sourceArtifactId');
|
|
420
|
+
if (record.scale !== 2 && record.scale !== 4)
|
|
421
|
+
invalidAIInput('super-resolution scale must be 2 or 4');
|
|
422
|
+
optionalBoundedInteger(record.seed, 'super-resolution seed', 0, 2147483647);
|
|
423
|
+
break;
|
|
413
424
|
// @nimi-authority: rule.nimi.runtime.ai-provider.face-swap-video-job
|
|
414
425
|
case 'video-face-swap':
|
|
415
426
|
if (execute)
|
|
@@ -457,7 +468,16 @@ function validateScenarioSpec(spec, execute) {
|
|
|
457
468
|
case 'image-generate':
|
|
458
469
|
if (execute)
|
|
459
470
|
invalidAIInput('image-generate requires an async Job');
|
|
460
|
-
assertExactKeys(record, ['type', 'prompt', 'negativePrompt', 'n', 'size', 'aspectRatio', 'quality', 'style', 'seed', 'referenceImages', 'referenceImageArtifactId', 'mask', 'maskArtifactId', 'strength', 'responseFormat'], 'image spec');
|
|
471
|
+
assertExactKeys(record, ['type', 'prompt', 'negativePrompt', 'n', 'size', 'aspectRatio', 'quality', 'style', 'seed', 'referenceImages', 'referenceImageArtifactId', 'mask', 'maskArtifactId', 'strength', 'responseFormat', 'complexity', 'outputFormat', 'markup', 'markupArtifactId', 'frameCount', 'frameDurationMs', 'controlImage'], 'image spec');
|
|
472
|
+
if (record.controlImage !== undefined) {
|
|
473
|
+
const control = asRecord(record.controlImage);
|
|
474
|
+
assertExactKeys(control, ['imageArtifactId', 'type', 'strength'], 'image control');
|
|
475
|
+
boundedIdentifier(control.imageArtifactId, 'control image artifact');
|
|
476
|
+
if (typeof control.type !== 'number' || !Number.isInteger(control.type) || control.type < 1 || control.type > 8)
|
|
477
|
+
invalidAIInput('image control type is invalid');
|
|
478
|
+
if (control.strength !== undefined && (typeof control.strength !== 'number' || !Number.isFinite(control.strength) || control.strength < 0 || control.strength > 2))
|
|
479
|
+
invalidAIInput('image control strength is invalid');
|
|
480
|
+
}
|
|
461
481
|
boundedContent(record.prompt, 'image prompt', 32 * 1024);
|
|
462
482
|
optionalBoundedText(record.negativePrompt, 'image negativePrompt', 32 * 1024);
|
|
463
483
|
optionalBoundedInteger(record.n, 'image n', 0, 4);
|
|
@@ -492,6 +512,22 @@ function validateScenarioSpec(spec, execute) {
|
|
|
492
512
|
invalidAIInput('image strength requires referenceImageArtifactId');
|
|
493
513
|
if (!['', 'b64_json', 'url'].includes(String(record.responseFormat)))
|
|
494
514
|
invalidAIInput('image responseFormat is invalid');
|
|
515
|
+
if (record.complexity !== undefined && (typeof record.complexity !== 'string' || !['', 'low', 'medium', 'high'].includes(record.complexity)))
|
|
516
|
+
invalidAIInput('image complexity is invalid');
|
|
517
|
+
if (record.outputFormat !== undefined && (typeof record.outputFormat !== 'string' || !['', 'png', 'jpeg', 'webp', 'gif', 'svg'].includes(record.outputFormat)))
|
|
518
|
+
invalidAIInput('image outputFormat is invalid');
|
|
519
|
+
if (record.markup !== undefined && record.markup !== '')
|
|
520
|
+
boundedHttpsUrl(record.markup, 'image markup');
|
|
521
|
+
if (record.markupArtifactId !== undefined && record.markupArtifactId !== '')
|
|
522
|
+
boundedIdentifier(record.markupArtifactId, 'image markupArtifactId');
|
|
523
|
+
if (record.markup && record.markupArtifactId)
|
|
524
|
+
invalidAIInput('image markup carriers are mutually exclusive');
|
|
525
|
+
if ((record.markup || record.markupArtifactId) && (record.mask || record.maskArtifactId || (record.referenceImages.length === 0 && record.referenceImageArtifactId === '')))
|
|
526
|
+
invalidAIInput('image markup requires a source and excludes masks');
|
|
527
|
+
optionalBoundedInteger(record.frameCount, 'image frameCount', 2, 64);
|
|
528
|
+
optionalBoundedInteger(record.frameDurationMs, 'image frameDurationMs', 20, 2000);
|
|
529
|
+
if ((record.frameCount !== undefined || record.frameDurationMs !== undefined) && record.outputFormat !== 'gif')
|
|
530
|
+
invalidAIInput('image animation controls require GIF output');
|
|
495
531
|
break;
|
|
496
532
|
case 'video-generate':
|
|
497
533
|
if (execute)
|
|
@@ -728,7 +764,7 @@ function validateVideoSpec(record) {
|
|
|
728
764
|
optionalBoundedText(record.prompt, 'video prompt', 32 * 1024);
|
|
729
765
|
optionalBoundedText(record.negativePrompt, 'video negativePrompt', 32 * 1024);
|
|
730
766
|
if (!['t2v', 'i2v-first-frame', 'i2v-first-last', 'i2v-reference'].includes(String(record.mode))
|
|
731
|
-
|| !Array.isArray(record.content) || record.content.length >
|
|
767
|
+
|| !Array.isArray(record.content) || record.content.length > 51)
|
|
732
768
|
invalidAIInput('video spec is invalid');
|
|
733
769
|
record.content.forEach((entry, index) => {
|
|
734
770
|
const content = asRecord(entry);
|
|
@@ -756,7 +792,7 @@ function validateVideoSpec(record) {
|
|
|
756
792
|
assertExactKeys(options, ['resolution', 'ratio', 'durationSec', 'frames', 'fps', 'seed', 'cameraFixed', 'watermark', 'generateAudio', 'draft', 'returnLastFrame'], 'video options');
|
|
757
793
|
boundedToken(options.resolution, 'video resolution', 64);
|
|
758
794
|
boundedToken(options.ratio, 'video ratio', 64);
|
|
759
|
-
optionalBoundedInteger(options.durationSec, 'video durationSec',
|
|
795
|
+
optionalBoundedInteger(options.durationSec, 'video durationSec', -1, 600);
|
|
760
796
|
optionalBoundedInteger(options.frames, 'video frames', 0, 100_000);
|
|
761
797
|
optionalBoundedInteger(options.fps, 'video fps', 0, 120);
|
|
762
798
|
optionalBoundedInteger(options.seed, 'video seed', -1, 4_294_967_295);
|
|
@@ -888,6 +924,15 @@ function projectSubscription(subscription, projector) {
|
|
|
888
924
|
};
|
|
889
925
|
return Object.freeze(projected);
|
|
890
926
|
}
|
|
927
|
+
export function projectCapture(value) {
|
|
928
|
+
const r = asRecord(value);
|
|
929
|
+
if (!r || typeof r.configRef !== 'string' || !/^(main|[a-f0-9]{32})$/.test(r.configRef) ||
|
|
930
|
+
typeof r.revision !== 'string' || !/^[1-9][0-9]*$/.test(r.revision) || (r.localLoadoutRef === undefined) !== (r.localLoadoutRevision === undefined) ||
|
|
931
|
+
(r.localLoadoutRef !== undefined && (typeof r.localLoadoutRef !== 'string' || typeof r.localLoadoutRevision !== 'string')))
|
|
932
|
+
return localAppProjectionError('invalid configuration capture');
|
|
933
|
+
assertExactProjectionKeys(r, ['configRef', 'revision', ...(r.localLoadoutRef === undefined ? [] : ['localLoadoutRef', 'localLoadoutRevision'])], 'configuration capture');
|
|
934
|
+
return { configRef: r.configRef, revision: r.revision, ...(typeof r.localLoadoutRef === 'string' ? { localLoadoutRef: r.localLoadoutRef, localLoadoutRevision: r.localLoadoutRevision } : {}) };
|
|
935
|
+
}
|
|
891
936
|
function projectTextTurnEvent(value) {
|
|
892
937
|
const record = asRecord(value);
|
|
893
938
|
if (!record || !/^[1-9][0-9]*$/u.test(String(record.sequence)))
|
|
@@ -914,10 +959,10 @@ function projectTextTurnEvent(value) {
|
|
|
914
959
|
return Object.freeze({ ...base, type: 'reasoning-continuity', itemIndex: projectionInteger(record.itemIndex, 'continuity item index', 0, 4_294_967_295), carrier: projectLocalAppContinuity(record.carrier) });
|
|
915
960
|
}
|
|
916
961
|
if (record.type === 'completed') {
|
|
917
|
-
assertExactProjectionKeys(record, ['type', 'sequence', 'traceId', 'finishReason'], 'text-turn completed');
|
|
962
|
+
assertExactProjectionKeys(record, ['type', 'sequence', 'traceId', 'finishReason', ...(record.configuration ? ['configuration'] : []), ...(record.usage !== undefined ? ['usage'] : [])], 'text-turn completed');
|
|
918
963
|
if (!['stop', 'length', 'tool-calls', 'content-filter'].includes(String(record.finishReason)))
|
|
919
964
|
localAppProjectionError('text-turn finishReason');
|
|
920
|
-
return Object.freeze({ ...base, type: 'completed', finishReason: record.finishReason });
|
|
965
|
+
return Object.freeze({ ...base, type: 'completed', finishReason: record.finishReason, ...(record.configuration ? { configuration: projectCapture(record.configuration) } : {}), ...(record.usage === undefined ? {} : { usage: projectTokenUsage(record.usage) }) });
|
|
921
966
|
}
|
|
922
967
|
if (record.type === 'failed') {
|
|
923
968
|
assertExactProjectionKeys(record, ['type', 'sequence', 'traceId', 'reasonCode', 'actionHint', ...(Object.hasOwn(record, 'interruption') ? ['interruption'] : [])], 'text-turn failed');
|
|
@@ -939,12 +984,12 @@ function projectScenarioExecute(value, decide) {
|
|
|
939
984
|
return Object.freeze({ output: validateNimiLocalAppTextDecideOutput(output, decide), traceId });
|
|
940
985
|
}
|
|
941
986
|
if (output.type === 'text-generate') {
|
|
942
|
-
assertExactProjectionKeys(output, ['type', 'items', 'finishReason'], 'text generate output');
|
|
987
|
+
assertExactProjectionKeys(output, ['type', 'items', 'finishReason', ...(output.usage !== undefined ? ['usage'] : [])], 'text generate output');
|
|
943
988
|
const items = projectLocalAppTextItems(output.items);
|
|
944
989
|
if (!['stop', 'length', 'tool-calls', 'content-filter'].includes(String(output.finishReason))
|
|
945
990
|
|| (output.finishReason === 'tool-calls' && !items.some((item) => item.type === 'tool-call')))
|
|
946
991
|
localAppProjectionError('text finish reason');
|
|
947
|
-
return Object.freeze({ output: Object.freeze({ type: 'text-generate', items, finishReason: output.finishReason }), traceId });
|
|
992
|
+
return Object.freeze({ output: Object.freeze({ type: 'text-generate', items, finishReason: output.finishReason, ...(output.usage === undefined ? {} : { usage: projectTokenUsage(output.usage) }) }), traceId });
|
|
948
993
|
}
|
|
949
994
|
assertSafeProjection(record);
|
|
950
995
|
if (output.type === 'text-embed') {
|
|
@@ -958,7 +1003,7 @@ function projectScenarioExecute(value, decide) {
|
|
|
958
1003
|
localAppProjectionError('text embed vector');
|
|
959
1004
|
return Object.freeze([...vector]);
|
|
960
1005
|
});
|
|
961
|
-
const usage = output.usage === undefined ? undefined :
|
|
1006
|
+
const usage = output.usage === undefined ? undefined : projectTokenUsage(output.usage);
|
|
962
1007
|
return Object.freeze({ output: Object.freeze({ type: 'text-embed', vectors: Object.freeze(vectors), spaceId, ...(usage ? { usage } : {}) }), traceId });
|
|
963
1008
|
}
|
|
964
1009
|
return localAppProjectionError('scenario execute output type');
|
|
@@ -1366,6 +1411,8 @@ function runtimeTextTurnRequest(input) {
|
|
|
1366
1411
|
const format = input.responseFormat;
|
|
1367
1412
|
return {
|
|
1368
1413
|
messages,
|
|
1414
|
+
...(input.configuration ? { configuration: { configRef: input.configuration.configRef, expectedRevision: input.configuration.expectedRevision ?? '',
|
|
1415
|
+
expectedLocalLoadoutRef: input.configuration.expectedLocalLoadoutRef ?? '', expectedLocalLoadoutRevision: input.configuration.expectedLocalLoadoutRevision ?? '' } } : {}),
|
|
1369
1416
|
tools: toRuntimeTools(input.tools),
|
|
1370
1417
|
...(input.reasoning === undefined ? {} : { reasoning: toRuntimeReasoningConfig(input.reasoning, (detail) => localAppError(detail, 'SDK_LOCAL_APP_INPUT_INVALID', 'provide_admitted_local_app_text_input')) }),
|
|
1371
1418
|
toolChoice: choice === 'none' ? ToolChoiceMode.NONE : choice === 'auto' ? ToolChoiceMode.AUTO
|
|
@@ -1386,14 +1433,20 @@ function runtimeTextTurnRequest(input) {
|
|
|
1386
1433
|
...(input.seed === undefined ? {} : { seed: String(input.seed) }),
|
|
1387
1434
|
};
|
|
1388
1435
|
}
|
|
1389
|
-
function
|
|
1436
|
+
function runtimeTokenUsage(usage) {
|
|
1437
|
+
return {
|
|
1438
|
+
promptTokens: Number(usage.inputTokens), completionTokens: Number(usage.outputTokens),
|
|
1439
|
+
totalTokens: Number(usage.inputTokens) + Number(usage.outputTokens),
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
function projectTokenUsage(value) {
|
|
1390
1443
|
const usage = asRecord(value);
|
|
1391
|
-
assertExactProjectionKeys(usage, ['promptTokens', 'completionTokens', 'totalTokens'], '
|
|
1392
|
-
const promptTokens = projectionInteger(usage.promptTokens, '
|
|
1393
|
-
const completionTokens = projectionInteger(usage.completionTokens, '
|
|
1394
|
-
const totalTokens = projectionInteger(usage.totalTokens, '
|
|
1444
|
+
assertExactProjectionKeys(usage, ['promptTokens', 'completionTokens', 'totalTokens'], 'token usage');
|
|
1445
|
+
const promptTokens = projectionInteger(usage.promptTokens, 'prompt tokens', 0, Number.MAX_SAFE_INTEGER);
|
|
1446
|
+
const completionTokens = projectionInteger(usage.completionTokens, 'completion tokens', 0, Number.MAX_SAFE_INTEGER);
|
|
1447
|
+
const totalTokens = projectionInteger(usage.totalTokens, 'total tokens', 0, Number.MAX_SAFE_INTEGER);
|
|
1395
1448
|
if (totalTokens !== promptTokens + completionTokens)
|
|
1396
|
-
localAppProjectionError('
|
|
1449
|
+
localAppProjectionError('total tokens');
|
|
1397
1450
|
return Object.freeze({ promptTokens, completionTokens, totalTokens });
|
|
1398
1451
|
}
|
|
1399
1452
|
function runtimeExecuteRequest(spec, timeoutMs) {
|
|
@@ -1413,6 +1466,10 @@ function runtimeLocalJobSpec(spec) {
|
|
|
1413
1466
|
return { oneofKind: 'videoFaceSwap', videoFaceSwap: { referenceImageArtifactId: spec.referenceImageArtifactId, targetVideoArtifactId: spec.targetVideoArtifactId, noFacePolicy: spec.noFacePolicy === 'fail' ? FaceSwapNoFacePolicy.FAIL : FaceSwapNoFacePolicy.PRESERVE_FRAME } };
|
|
1414
1467
|
case 'image-face-swap':
|
|
1415
1468
|
return { oneofKind: 'imageFaceSwap', imageFaceSwap: { referenceImageArtifactId: spec.referenceImageArtifactId, targetImageArtifactId: spec.targetImageArtifactId } };
|
|
1469
|
+
case 'image-upscale':
|
|
1470
|
+
return { oneofKind: 'imageUpscale', imageUpscale: { sourceArtifactId: spec.sourceArtifactId, scale: spec.scale, seed: spec.seed === undefined ? undefined : String(spec.seed) } };
|
|
1471
|
+
case 'video-upscale':
|
|
1472
|
+
return { oneofKind: 'videoUpscale', videoUpscale: { sourceArtifactId: spec.sourceArtifactId, scale: spec.scale, seed: spec.seed === undefined ? undefined : String(spec.seed) } };
|
|
1416
1473
|
case 'vision-locate':
|
|
1417
1474
|
return { oneofKind: 'visionLocate', visionLocate: { imageArtifactId: spec.imageArtifactId, query: spec.query, geometry: spec.geometry === 'box' ? VisionLocateGeometry.BOX : VisionLocateGeometry.POINT } };
|
|
1418
1475
|
case 'image-generate':
|
|
@@ -1549,6 +1606,7 @@ function runtimeLocalJobSpec(spec) {
|
|
|
1549
1606
|
}
|
|
1550
1607
|
function runtimeImageSpec(spec) {
|
|
1551
1608
|
return {
|
|
1609
|
+
...(spec.controlImage === undefined ? {} : { controlImage: { ...spec.controlImage } }),
|
|
1552
1610
|
prompt: spec.prompt,
|
|
1553
1611
|
negativePrompt: spec.negativePrompt,
|
|
1554
1612
|
...(spec.n === undefined ? {} : { n: spec.n }),
|
|
@@ -1563,6 +1621,12 @@ function runtimeImageSpec(spec) {
|
|
|
1563
1621
|
...(spec.strength === undefined ? {} : { strength: spec.strength }),
|
|
1564
1622
|
responseFormat: spec.responseFormat,
|
|
1565
1623
|
referenceImageArtifactId: spec.referenceImageArtifactId,
|
|
1624
|
+
complexity: spec.complexity ?? '',
|
|
1625
|
+
outputFormat: spec.outputFormat ?? '',
|
|
1626
|
+
markup: spec.markup ?? '',
|
|
1627
|
+
markupArtifactId: spec.markupArtifactId ?? '',
|
|
1628
|
+
...(spec.frameCount === undefined ? {} : { frameCount: spec.frameCount }),
|
|
1629
|
+
...(spec.frameDurationMs === undefined ? {} : { frameDurationMs: spec.frameDurationMs }),
|
|
1566
1630
|
};
|
|
1567
1631
|
}
|
|
1568
1632
|
function runtimeVideoMode(value) {
|
|
@@ -1629,6 +1693,8 @@ function projectRuntimeTextTurnEvent(event) {
|
|
|
1629
1693
|
...base,
|
|
1630
1694
|
type: 'completed',
|
|
1631
1695
|
finishReason: runtimeFinishReason(event.payload.completed.finishReason),
|
|
1696
|
+
...(event.payload.completed.configuration ? { configuration: event.payload.completed.configuration } : {}),
|
|
1697
|
+
...(event.payload.completed.usage ? { usage: runtimeTokenUsage(event.payload.completed.usage) } : {}),
|
|
1632
1698
|
};
|
|
1633
1699
|
case 'failed':
|
|
1634
1700
|
return {
|
|
@@ -1645,18 +1711,14 @@ function projectRuntimeTextTurnEvent(event) {
|
|
|
1645
1711
|
function projectRuntimeScenarioExecuteResponse(response) {
|
|
1646
1712
|
switch (response.output.oneofKind) {
|
|
1647
1713
|
case 'textGenerate':
|
|
1648
|
-
return { output: { type: 'text-generate', items: toNimiTextOutputItems(response.output.textGenerate.items).map(modelTextOutputToLocalApp), finishReason: runtimeFinishReason(response.output.textGenerate.finishReason) }, traceId: response.traceId };
|
|
1714
|
+
return { output: { type: 'text-generate', items: toNimiTextOutputItems(response.output.textGenerate.items).map(modelTextOutputToLocalApp), finishReason: runtimeFinishReason(response.output.textGenerate.finishReason), ...(response.output.textGenerate.usage ? { usage: runtimeTokenUsage(response.output.textGenerate.usage) } : {}) }, traceId: response.traceId };
|
|
1649
1715
|
case 'textEmbed':
|
|
1650
1716
|
return {
|
|
1651
1717
|
output: {
|
|
1652
1718
|
type: 'text-embed',
|
|
1653
1719
|
vectors: response.output.textEmbed.vectors.map((vector) => [...vector.values]),
|
|
1654
1720
|
spaceId: response.output.textEmbed.spaceId,
|
|
1655
|
-
...(response.output.textEmbed.usage ? { usage: {
|
|
1656
|
-
promptTokens: Number(response.output.textEmbed.usage.inputTokens),
|
|
1657
|
-
completionTokens: Number(response.output.textEmbed.usage.outputTokens),
|
|
1658
|
-
totalTokens: Number(response.output.textEmbed.usage.inputTokens) + Number(response.output.textEmbed.usage.outputTokens),
|
|
1659
|
-
} } : {}),
|
|
1721
|
+
...(response.output.textEmbed.usage ? { usage: runtimeTokenUsage(response.output.textEmbed.usage) } : {}),
|
|
1660
1722
|
},
|
|
1661
1723
|
traceId: response.traceId,
|
|
1662
1724
|
};
|
|
@@ -1686,7 +1748,7 @@ function projectRuntimeLocalJob(job) {
|
|
|
1686
1748
|
updatedAt: plainRuntimeTimestamp(job.updatedAt),
|
|
1687
1749
|
...(job.recoveryExpiresAt ? { recoveryExpiresAt: plainRuntimeTimestamp(job.recoveryExpiresAt) } : {}),
|
|
1688
1750
|
transcriptionText: job.transcriptionText,
|
|
1689
|
-
...(job.textAnnotation ? { textAnnotation: job.textAnnotation } : {}),
|
|
1751
|
+
...(job.textAnnotation ? { textAnnotation: copyTextAnnotationResult(job.textAnnotation) } : {}),
|
|
1690
1752
|
...(job.speakerEmbedding ? { speakerEmbedding: validateNimiLocalAppSpeakerEmbedding({ vector: job.speakerEmbedding.vector?.values, spaceId: job.speakerEmbedding.spaceId }) } : {}),
|
|
1691
1753
|
...(job.audioSeparation ? { audioSeparation: localAudioSeparation(job.audioSeparation) } : {}),
|
|
1692
1754
|
...(job.musicGeneration ? { musicGeneration: localMusicGeneration(job.musicGeneration) } : {}),
|
|
@@ -1735,6 +1797,8 @@ function runtimeScenarioTypeName(value) {
|
|
|
1735
1797
|
const types = {
|
|
1736
1798
|
[ScenarioType.VIDEO_FACE_SWAP]: 'video-face-swap',
|
|
1737
1799
|
[ScenarioType.IMAGE_FACE_SWAP]: 'image-face-swap',
|
|
1800
|
+
[ScenarioType.IMAGE_UPSCALE]: 'image-upscale',
|
|
1801
|
+
[ScenarioType.VIDEO_UPSCALE]: 'video-upscale',
|
|
1738
1802
|
[ScenarioType.VISION_LOCATE]: 'vision-locate',
|
|
1739
1803
|
[ScenarioType.IMAGE_GENERATE]: 'image-generate',
|
|
1740
1804
|
[ScenarioType.VIDEO_GENERATE]: 'video-generate',
|
|
@@ -1826,7 +1890,7 @@ function localVoiceCreationSource(source) {
|
|
|
1826
1890
|
return 'text-description';
|
|
1827
1891
|
return localAppProjectionError('voice asset creationSource');
|
|
1828
1892
|
}
|
|
1829
|
-
const LOCAL_SCENARIO_TYPES = ['image-generate', 'image-face-swap', 'video-face-swap', 'vision-locate', 'video-generate', 'speech-synthesize', 'speech-transcribe', 'text-annotate', 'audio-speaker-embed', 'audio-separate', 'voice-create', 'music-generate', 'music-transcribe', 'audio-voice-convert', 'world-generate'];
|
|
1893
|
+
const LOCAL_SCENARIO_TYPES = ['image-generate', 'image-upscale', 'video-upscale', 'image-face-swap', 'video-face-swap', 'vision-locate', 'video-generate', 'speech-synthesize', 'speech-transcribe', 'text-annotate', 'audio-speaker-embed', 'audio-separate', 'voice-create', 'music-generate', 'music-transcribe', 'audio-voice-convert', 'world-generate'];
|
|
1830
1894
|
const LOCAL_JOB_STATUSES = ['submitted', 'queued', 'running', 'completed', 'failed', 'canceled', 'timeout'];
|
|
1831
1895
|
export function validateNimiLocalAppSpeakerEmbedSpec(value) {
|
|
1832
1896
|
if (asRecord(value)?.type !== 'audio-speaker-embed')
|
|
@@ -1871,6 +1935,16 @@ function localJobSpecFromRuntimeRequest(request) {
|
|
|
1871
1935
|
case 'imageFaceSwap':
|
|
1872
1936
|
requireScenarioType(request, ScenarioType.IMAGE_FACE_SWAP);
|
|
1873
1937
|
return validateScenarioSpec({ type: 'image-face-swap', referenceImageArtifactId: spec.imageFaceSwap.referenceImageArtifactId, targetImageArtifactId: spec.imageFaceSwap.targetImageArtifactId }, false);
|
|
1938
|
+
case 'imageUpscale':
|
|
1939
|
+
requireScenarioType(request, ScenarioType.IMAGE_UPSCALE);
|
|
1940
|
+
if (spec.imageUpscale.scale !== 2 && spec.imageUpscale.scale !== 4)
|
|
1941
|
+
invalidAIInput('super-resolution scale must be 2 or 4');
|
|
1942
|
+
return validateScenarioSpec({ type: 'image-upscale', sourceArtifactId: spec.imageUpscale.sourceArtifactId, scale: spec.imageUpscale.scale, ...(spec.imageUpscale.seed === undefined ? {} : { seed: Number(spec.imageUpscale.seed) }) }, false);
|
|
1943
|
+
case 'videoUpscale':
|
|
1944
|
+
requireScenarioType(request, ScenarioType.VIDEO_UPSCALE);
|
|
1945
|
+
if (spec.videoUpscale.scale !== 2 && spec.videoUpscale.scale !== 4)
|
|
1946
|
+
invalidAIInput('super-resolution scale must be 2 or 4');
|
|
1947
|
+
return validateScenarioSpec({ type: 'video-upscale', sourceArtifactId: spec.videoUpscale.sourceArtifactId, scale: spec.videoUpscale.scale, ...(spec.videoUpscale.seed === undefined ? {} : { seed: Number(spec.videoUpscale.seed) }) }, false);
|
|
1874
1948
|
case 'visionLocate':
|
|
1875
1949
|
requireScenarioType(request, ScenarioType.VISION_LOCATE);
|
|
1876
1950
|
return validateScenarioSpec({ type: 'vision-locate', imageArtifactId: spec.visionLocate.imageArtifactId, query: spec.visionLocate.query, geometry: localLocateGeometry(spec.visionLocate.geometry) }, false);
|
|
@@ -1891,6 +1965,13 @@ function localJobSpecFromRuntimeRequest(request) {
|
|
|
1891
1965
|
...(spec.imageGenerate.maskArtifactId === '' ? {} : { maskArtifactId: spec.imageGenerate.maskArtifactId }),
|
|
1892
1966
|
...(spec.imageGenerate.strength === undefined ? {} : { strength: spec.imageGenerate.strength }),
|
|
1893
1967
|
responseFormat: spec.imageGenerate.responseFormat,
|
|
1968
|
+
...(spec.imageGenerate.complexity === '' || spec.imageGenerate.complexity === undefined ? {} : { complexity: spec.imageGenerate.complexity }),
|
|
1969
|
+
...(spec.imageGenerate.outputFormat === '' || spec.imageGenerate.outputFormat === undefined ? {} : { outputFormat: spec.imageGenerate.outputFormat }),
|
|
1970
|
+
...(spec.imageGenerate.markup === '' || spec.imageGenerate.markup === undefined ? {} : { markup: spec.imageGenerate.markup }),
|
|
1971
|
+
...(spec.imageGenerate.markupArtifactId === '' || spec.imageGenerate.markupArtifactId === undefined ? {} : { markupArtifactId: spec.imageGenerate.markupArtifactId }),
|
|
1972
|
+
...(spec.imageGenerate.frameCount === undefined ? {} : { frameCount: spec.imageGenerate.frameCount }),
|
|
1973
|
+
...(spec.imageGenerate.frameDurationMs === undefined ? {} : { frameDurationMs: spec.imageGenerate.frameDurationMs }),
|
|
1974
|
+
...(spec.imageGenerate.controlImage === undefined ? {} : { controlImage: { ...spec.imageGenerate.controlImage } }),
|
|
1894
1975
|
}, false);
|
|
1895
1976
|
case 'videoGenerate':
|
|
1896
1977
|
requireScenarioType(request, ScenarioType.VIDEO_GENERATE);
|
|
@@ -2075,7 +2156,7 @@ function runtimeJobFromLocal(job) {
|
|
|
2075
2156
|
musicGeneration: runtimeMusicGeneration(job.musicGeneration),
|
|
2076
2157
|
musicTranscription: runtimeMusicTranscription(job.musicTranscription),
|
|
2077
2158
|
voiceConversion: runtimeVoiceConversion(job.voiceConversion),
|
|
2078
|
-
textAnnotation:
|
|
2159
|
+
textAnnotation: copyTextAnnotationResult(job.textAnnotation),
|
|
2079
2160
|
};
|
|
2080
2161
|
}
|
|
2081
2162
|
function runtimeVoiceAssetFromLocal(asset) {
|
|
@@ -2105,6 +2186,8 @@ function runtimeOutput(type, artifacts, transcriptionText, videoFaceSwapSummary,
|
|
|
2105
2186
|
switch (type) {
|
|
2106
2187
|
case 'video-face-swap': return videoFaceSwapSummary ? { output: { oneofKind: 'videoFaceSwap', videoFaceSwap: { artifacts, summary: { ...videoFaceSwapSummary, durationUs: String(videoFaceSwapSummary.durationUs) } } } } : undefined;
|
|
2107
2188
|
case 'image-face-swap': return { output: { oneofKind: 'imageFaceSwap', imageFaceSwap: { artifacts } } };
|
|
2189
|
+
case 'image-upscale': return { output: { oneofKind: 'imageUpscale', imageUpscale: { artifacts } } };
|
|
2190
|
+
case 'video-upscale': return { output: { oneofKind: 'videoUpscale', videoUpscale: { artifacts } } };
|
|
2108
2191
|
case 'image-generate': return { output: { oneofKind: 'imageGenerate', imageGenerate: { artifacts } } };
|
|
2109
2192
|
case 'video-generate': return { output: { oneofKind: 'videoGenerate', videoGenerate: { artifacts } } };
|
|
2110
2193
|
case 'speech-synthesize': return { output: { oneofKind: 'speechSynthesize', speechSynthesize: { artifacts } } };
|
|
@@ -2113,7 +2196,7 @@ function runtimeOutput(type, artifacts, transcriptionText, videoFaceSwapSummary,
|
|
|
2113
2196
|
localAppProjectionError('speech transcription text');
|
|
2114
2197
|
return { output: { oneofKind: 'speechTranscribe', speechTranscribe: { text: transcriptionText, artifacts, transcription: runtimeTranscriptionFromLocal(transcription) } } };
|
|
2115
2198
|
}
|
|
2116
|
-
case 'text-annotate': return { output: { oneofKind: 'textAnnotation', textAnnotation:
|
|
2199
|
+
case 'text-annotate': return { output: { oneofKind: 'textAnnotation', textAnnotation: copyTextAnnotationResult(textAnnotation) } };
|
|
2117
2200
|
case 'audio-speaker-embed': return speakerEmbedding ? { output: { oneofKind: 'audioSpeakerEmbed', audioSpeakerEmbed: { vector: { values: [...speakerEmbedding.vector] }, spaceId: speakerEmbedding.spaceId } } } : undefined;
|
|
2118
2201
|
case 'audio-separate': return { output: { oneofKind: 'audioSeparate', audioSeparate: { artifacts, separation: runtimeAudioSeparation(audioSeparation) } } };
|
|
2119
2202
|
case 'music-transcribe': return { output: { oneofKind: 'musicTranscribe', musicTranscribe: { artifacts, transcription: runtimeMusicTranscription(musicTranscription) } } };
|
|
@@ -2123,6 +2206,10 @@ function runtimeOutput(type, artifacts, transcriptionText, videoFaceSwapSummary,
|
|
|
2123
2206
|
}
|
|
2124
2207
|
}
|
|
2125
2208
|
function runtimeScenarioType(type) {
|
|
2209
|
+
if (type === 'image-upscale')
|
|
2210
|
+
return ScenarioType.IMAGE_UPSCALE;
|
|
2211
|
+
if (type === 'video-upscale')
|
|
2212
|
+
return ScenarioType.VIDEO_UPSCALE;
|
|
2126
2213
|
return ({ 'image-generate': ScenarioType.IMAGE_GENERATE, 'image-face-swap': ScenarioType.IMAGE_FACE_SWAP, 'video-face-swap': ScenarioType.VIDEO_FACE_SWAP, 'vision-locate': ScenarioType.VISION_LOCATE, 'video-generate': ScenarioType.VIDEO_GENERATE, 'speech-synthesize': ScenarioType.SPEECH_SYNTHESIZE, 'speech-transcribe': ScenarioType.SPEECH_TRANSCRIBE, 'text-annotate': ScenarioType.TEXT_ANNOTATE, 'audio-speaker-embed': ScenarioType.AUDIO_SPEAKER_EMBED, 'audio-separate': ScenarioType.AUDIO_SEPARATE, 'voice-create': ScenarioType.VOICE_CREATE, 'music-generate': ScenarioType.MUSIC_GENERATE, 'music-transcribe': ScenarioType.MUSIC_TRANSCRIBE, 'audio-voice-convert': ScenarioType.AUDIO_VOICE_CONVERT, 'world-generate': ScenarioType.WORLD_GENERATE })[type];
|
|
2127
2214
|
}
|
|
2128
2215
|
function runtimeJobStatus(status) {
|
|
@@ -2329,7 +2416,7 @@ function runtimeTranscriptionFromLocal(value) {
|
|
|
2329
2416
|
return value ? { status: value.status === 'transcribed' ? SpeechTranscriptStatus.TRANSCRIBED : SpeechTranscriptStatus.NO_SPEECH, text: value.text, language: value.language, words: value.words.map((word) => ({ ...word })),
|
|
2330
2417
|
...(value.diarization ? { diarization: { status: value.diarization.status === 'diarized' ? SpeechDiarizationStatus.DIARIZED : SpeechDiarizationStatus.NO_SPEAKERS, durationSeconds: value.diarization.durationSeconds, intervals: value.diarization.intervals.map((interval) => ({ ...interval })) } } : {}) } : undefined;
|
|
2331
2418
|
}
|
|
2332
|
-
function
|
|
2419
|
+
function copyTextAnnotationResult(value) {
|
|
2333
2420
|
return value ? { documents: value.documents.map((doc) => ({ text: doc.text, language: doc.language,
|
|
2334
2421
|
tokens: doc.tokens.map((token) => ({ ...token })), sentences: doc.sentences.map((sentence) => ({ ...sentence })) })) } : undefined;
|
|
2335
2422
|
}
|