@nimiplatform/sdk 0.15.0 → 0.22.0
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 +500 -1
- package/README.md +181 -346
- package/dist/core/ai/capability-configuration.d.ts +15 -0
- package/dist/core/ai/capability-configuration.d.ts.map +1 -1
- package/dist/core/ai/capability-configuration.js +36 -0
- package/dist/core/ai/capability-configuration.js.map +1 -1
- package/dist/core/ai/embeddings.d.ts +6 -0
- package/dist/core/ai/embeddings.d.ts.map +1 -1
- package/dist/core/ai/embeddings.js +33 -4
- package/dist/core/ai/embeddings.js.map +1 -1
- package/dist/core/ai/index.d.ts +4 -0
- package/dist/core/ai/index.d.ts.map +1 -1
- package/dist/core/ai/index.js +3 -0
- package/dist/core/ai/index.js.map +1 -1
- package/dist/core/ai/local-app-model.d.ts +15 -4
- package/dist/core/ai/local-app-model.d.ts.map +1 -1
- package/dist/core/ai/local-app-model.js +57 -18
- package/dist/core/ai/local-app-model.js.map +1 -1
- package/dist/core/ai/music-input-wire.d.ts +4 -0
- package/dist/core/ai/music-input-wire.d.ts.map +1 -0
- package/dist/core/ai/music-input-wire.js +9 -0
- package/dist/core/ai/music-input-wire.js.map +1 -0
- package/dist/core/ai/music-input.d.ts +44 -0
- package/dist/core/ai/music-input.d.ts.map +1 -0
- package/dist/core/ai/music-input.js +69 -0
- package/dist/core/ai/music-input.js.map +1 -0
- package/dist/core/ai/reasoning.d.ts +32 -0
- package/dist/core/ai/reasoning.d.ts.map +1 -0
- package/dist/core/ai/reasoning.js +74 -0
- package/dist/core/ai/reasoning.js.map +1 -0
- package/dist/core/ai/runtime-model.d.ts +2 -19
- package/dist/core/ai/runtime-model.d.ts.map +1 -1
- package/dist/core/ai/runtime-model.js +3 -47
- package/dist/core/ai/runtime-model.js.map +1 -1
- package/dist/core/ai/speech-input.d.ts +9 -0
- package/dist/core/ai/speech-input.d.ts.map +1 -0
- package/dist/core/ai/speech-input.js +16 -0
- package/dist/core/ai/speech-input.js.map +1 -0
- package/dist/core/ai/text-runner.js +11 -4
- package/dist/core/ai/text-runner.js.map +1 -1
- package/dist/core/app/desktop-open.d.ts +11 -5
- package/dist/core/app/desktop-open.d.ts.map +1 -1
- package/dist/core/app/desktop-open.js +24 -16
- package/dist/core/app/desktop-open.js.map +1 -1
- package/dist/core/app/index.d.ts +32 -5
- package/dist/core/app/index.d.ts.map +1 -1
- package/dist/core/app/index.js +19 -1
- package/dist/core/app/index.js.map +1 -1
- package/dist/core/app/local-app-agent-introduction.d.ts +33 -0
- package/dist/core/app/local-app-agent-introduction.d.ts.map +1 -0
- package/dist/core/app/local-app-agent-introduction.js +94 -0
- package/dist/core/app/local-app-agent-introduction.js.map +1 -0
- package/dist/core/app/local-app-agent-work-input.d.ts +24 -0
- package/dist/core/app/local-app-agent-work-input.d.ts.map +1 -0
- package/dist/core/app/local-app-agent-work-input.js +50 -0
- package/dist/core/app/local-app-agent-work-input.js.map +1 -0
- package/dist/core/app/local-app-audio-separation.d.ts +9 -0
- package/dist/core/app/local-app-audio-separation.d.ts.map +1 -1
- package/dist/core/app/local-app-audio-separation.js +64 -3
- package/dist/core/app/local-app-audio-separation.js.map +1 -1
- package/dist/core/app/local-app-bytes.d.ts +10 -0
- package/dist/core/app/local-app-bytes.d.ts.map +1 -0
- package/dist/core/app/local-app-bytes.js +27 -0
- package/dist/core/app/local-app-bytes.js.map +1 -0
- package/dist/core/app/local-app-music-transcription.d.ts +43 -0
- package/dist/core/app/local-app-music-transcription.d.ts.map +1 -0
- package/dist/core/app/local-app-music-transcription.js +94 -0
- package/dist/core/app/local-app-music-transcription.js.map +1 -0
- package/dist/core/app/local-app-music.d.ts +50 -0
- package/dist/core/app/local-app-music.d.ts.map +1 -0
- package/dist/core/app/local-app-music.js +135 -0
- package/dist/core/app/local-app-music.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-activity-view.d.ts +59 -0
- package/dist/core/app/local-app-runtime-platform-activity-view.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-activity-view.js +285 -0
- package/dist/core/app/local-app-runtime-platform-activity-view.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-activity.d.ts +219 -0
- package/dist/core/app/local-app-runtime-platform-activity.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-activity.js +753 -0
- package/dist/core/app/local-app-runtime-platform-activity.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-agent-references.d.ts +4 -0
- package/dist/core/app/local-app-runtime-platform-agent-references.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-agent-references.js +21 -9
- package/dist/core/app/local-app-runtime-platform-agent-references.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-agent-work.d.ts +88 -0
- package/dist/core/app/local-app-runtime-platform-agent-work.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-agent-work.js +165 -0
- package/dist/core/app/local-app-runtime-platform-agent-work.js.map +1 -0
- 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 +55 -1
- 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 +154 -36
- package/dist/core/app/local-app-runtime-platform-ai.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-ai.js +738 -121
- package/dist/core/app/local-app-runtime-platform-ai.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-assets.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-assets.js +37 -12
- package/dist/core/app/local-app-runtime-platform-assets.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-configure.d.ts +38 -4
- package/dist/core/app/local-app-runtime-platform-configure.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-configure.js +130 -28
- package/dist/core/app/local-app-runtime-platform-configure.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-conversation.d.ts +74 -10
- package/dist/core/app/local-app-runtime-platform-conversation.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-conversation.js +176 -29
- package/dist/core/app/local-app-runtime-platform-conversation.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-agent-work.d.ts +5 -0
- package/dist/core/app/local-app-runtime-platform-direct-agent-work.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-direct-agent-work.js +38 -0
- package/dist/core/app/local-app-runtime-platform-direct-agent-work.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-direct-conversation.d.ts +4 -1
- package/dist/core/app/local-app-runtime-platform-direct-conversation.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-conversation.js +64 -11
- package/dist/core/app/local-app-runtime-platform-direct-conversation.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.d.ts +2 -0
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.js +10 -2
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-integration.d.ts +128 -0
- package/dist/core/app/local-app-runtime-platform-integration.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-integration.js +263 -0
- package/dist/core/app/local-app-runtime-platform-integration.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-life.d.ts +33 -0
- package/dist/core/app/local-app-runtime-platform-life.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-life.js +59 -0
- package/dist/core/app/local-app-runtime-platform-life.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-proactive.d.ts +28 -0
- package/dist/core/app/local-app-runtime-platform-proactive.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-proactive.js +42 -0
- package/dist/core/app/local-app-runtime-platform-proactive.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-realm-realtime.d.ts +6 -2
- package/dist/core/app/local-app-runtime-platform-realm-realtime.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-realm-realtime.js +15 -4
- package/dist/core/app/local-app-runtime-platform-realm-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-validation.d.ts +2 -0
- package/dist/core/app/local-app-runtime-platform-validation.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-validation.js +42 -3
- package/dist/core/app/local-app-runtime-platform-validation.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-vision.d.ts +1 -1
- package/dist/core/app/local-app-runtime-platform-vision.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-vision.js +5 -5
- package/dist/core/app/local-app-runtime-platform-vision.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform.d.ts +22 -17
- package/dist/core/app/local-app-runtime-platform.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform.js +22 -8
- package/dist/core/app/local-app-runtime-platform.js.map +1 -1
- package/dist/core/app/local-app-speaker-embedding.d.ts +6 -0
- package/dist/core/app/local-app-speaker-embedding.d.ts.map +1 -0
- package/dist/core/app/local-app-speaker-embedding.js +14 -0
- package/dist/core/app/local-app-speaker-embedding.js.map +1 -0
- package/dist/core/app/local-app-text-decision.d.ts +114 -0
- package/dist/core/app/local-app-text-decision.d.ts.map +1 -0
- package/dist/core/app/local-app-text-decision.js +444 -0
- package/dist/core/app/local-app-text-decision.js.map +1 -0
- package/dist/core/app/local-app-text.d.ts +7 -1
- package/dist/core/app/local-app-text.d.ts.map +1 -1
- package/dist/core/app/local-app-text.js +16 -15
- package/dist/core/app/local-app-text.js.map +1 -1
- package/dist/core/app/local-app-transcription.d.ts +11 -0
- package/dist/core/app/local-app-transcription.d.ts.map +1 -1
- package/dist/core/app/local-app-transcription.js +22 -2
- package/dist/core/app/local-app-transcription.js.map +1 -1
- package/dist/core/app/local-app-voice-convert.d.ts +61 -0
- package/dist/core/app/local-app-voice-convert.d.ts.map +1 -0
- package/dist/core/app/local-app-voice-convert.js +133 -0
- package/dist/core/app/local-app-voice-convert.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 +17 -12
- package/dist/core/app/runtime-account-realm-source-readiness.generated.js.map +1 -1
- package/dist/core/text-stream-cleanup.d.ts +3 -0
- package/dist/core/text-stream-cleanup.d.ts.map +1 -0
- package/dist/core/text-stream-cleanup.js +19 -0
- package/dist/core/text-stream-cleanup.js.map +1 -0
- package/dist/core-generated/realm-client.d.ts.map +1 -1
- package/dist/core-generated/realm-client.js +43 -103
- package/dist/core-generated/realm-client.js.map +1 -1
- package/dist/core-generated/realm-typed-client.d.ts +339 -457
- package/dist/core-generated/realm-typed-client.d.ts.map +1 -1
- package/dist/core-generated/realm-typed-client.js +72 -208
- 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 +388 -12
- package/dist/core-generated/runtime-client.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/field_mask.d.ts +16 -18
- package/dist/core-generated/runtime-protobuf/google/protobuf/field_mask.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/field_mask.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.d.ts +33 -22
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.js +8 -3
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/timestamp.d.ts +3 -3
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.d.ts +31 -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 +49 -5
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.d.ts +147 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.js +327 -14
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.d.ts +167 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.js +312 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.d.ts +606 -148
- 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 +1631 -722
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.d.ts +9 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.js +8 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_work.d.ts +625 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_work.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_work.js +1369 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_work.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.d.ts +1872 -106
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.js +4718 -1513
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/app.d.ts +40 -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 +72 -3
- package/dist/core-generated/runtime-protobuf/runtime/v1/app.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/app_activity.d.ts +859 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/app_activity.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/app_activity.js +1663 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/app_activity.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.d.ts +712 -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 +1461 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/auth.d.ts +20 -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 +38 -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 +548 -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 +1309 -242
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.d.ts +67 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.js +101 -10
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.d.ts +150 -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 +149 -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 +81 -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 +166 -5
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/development.d.ts +53 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/development.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/development.js +118 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/development.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.d.ts +1293 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.js +2898 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/integration.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime.d.ts +166 -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 +217 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime_recommendation.d.ts +8 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime_recommendation.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime_recommendation.js +9 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/local_runtime_recommendation.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.d.ts +181 -8
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.js +402 -18
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.d.ts +110 -0
- 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 +213 -0
- 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 +364 -20
- 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 +46 -3
- package/dist/core-generated/runtime-public-rpc-auth-posture.js.map +1 -1
- package/dist/core-generated/runtime-public-wire-codecs.d.ts +56 -10
- package/dist/core-generated/runtime-public-wire-codecs.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-wire-codecs.js +56 -10
- 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 +49 -2
- package/dist/core-generated/runtime-rpc-auth-posture.js.map +1 -1
- package/dist/core-generated/runtime-typed-client.d.ts +86 -26
- package/dist/core-generated/runtime-typed-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-typed-client.js +487 -11
- package/dist/core-generated/runtime-typed-client.js.map +1 -1
- package/dist/core-generated/runtime-wire-codecs.d.ts +60 -10
- package/dist/core-generated/runtime-wire-codecs.d.ts.map +1 -1
- package/dist/core-generated/runtime-wire-codecs.js +61 -11
- package/dist/core-generated/runtime-wire-codecs.js.map +1 -1
- package/dist/features/generation/index.d.ts +14 -2
- package/dist/features/generation/index.d.ts.map +1 -1
- package/dist/features/generation/index.js +14 -1
- package/dist/features/generation/index.js.map +1 -1
- package/dist/features/generation/media-params.d.ts +0 -3
- package/dist/features/generation/media-params.d.ts.map +1 -1
- package/dist/features/generation/media-params.js +8 -6
- package/dist/features/generation/media-params.js.map +1 -1
- package/dist/features/generation/runtime-generation-build.d.ts +0 -1
- package/dist/features/generation/runtime-generation-build.d.ts.map +1 -1
- package/dist/features/generation/runtime-generation-build.js +6 -1
- package/dist/features/generation/runtime-generation-build.js.map +1 -1
- package/dist/features/generation/runtime-image-generation.d.ts +5 -1
- package/dist/features/generation/runtime-image-generation.d.ts.map +1 -1
- package/dist/features/generation/runtime-image-generation.js +4 -0
- package/dist/features/generation/runtime-image-generation.js.map +1 -1
- package/dist/features/generation/runtime-job-builders.d.ts +0 -1
- package/dist/features/generation/runtime-job-builders.d.ts.map +1 -1
- package/dist/features/generation/runtime-job-builders.js +8 -10
- package/dist/features/generation/runtime-job-builders.js.map +1 -1
- package/dist/realm/account-settings.d.ts +5 -3
- package/dist/realm/account-settings.d.ts.map +1 -1
- package/dist/realm/account-settings.js +3 -3
- package/dist/realm/account-settings.js.map +1 -1
- package/dist/realm/generated.d.ts +1 -1
- package/dist/realm/generated.d.ts.map +1 -1
- package/dist/realm/generated.js.map +1 -1
- package/dist/realm/index.d.ts +4 -4
- package/dist/realm/index.d.ts.map +1 -1
- package/dist/realm/index.js +8 -17
- package/dist/realm/index.js.map +1 -1
- package/dist/realm/media-delivery.d.ts +4 -0
- package/dist/realm/media-delivery.d.ts.map +1 -0
- package/dist/realm/media-delivery.js +65 -0
- package/dist/realm/media-delivery.js.map +1 -0
- package/dist/realm/resource-upload.d.ts +12 -3
- package/dist/realm/resource-upload.d.ts.map +1 -1
- package/dist/realm/resource-upload.js +93 -241
- package/dist/realm/resource-upload.js.map +1 -1
- package/dist/realm/social-types.d.ts +1 -15
- package/dist/realm/social-types.d.ts.map +1 -1
- package/dist/realm/social.d.ts +3 -17
- package/dist/realm/social.d.ts.map +1 -1
- package/dist/realm/social.js +0 -175
- package/dist/realm/social.js.map +1 -1
- package/dist/runtime/chatgpt-plan.d.ts +7 -0
- package/dist/runtime/chatgpt-plan.d.ts.map +1 -0
- package/dist/runtime/chatgpt-plan.js +15 -0
- package/dist/runtime/chatgpt-plan.js.map +1 -0
- package/dist/runtime/config-projections.d.ts +12 -0
- package/dist/runtime/config-projections.d.ts.map +1 -1
- package/dist/runtime/config-projections.js +11 -3
- package/dist/runtime/config-projections.js.map +1 -1
- package/dist/runtime/connector-auth-acquisition-client.d.ts +3 -6
- package/dist/runtime/connector-auth-acquisition-client.d.ts.map +1 -1
- package/dist/runtime/connector-auth-acquisition-client.js +18 -11
- package/dist/runtime/connector-auth-acquisition-client.js.map +1 -1
- package/dist/runtime/connector-auth-acquisition-profiles.generated.d.ts +10 -11
- package/dist/runtime/connector-auth-acquisition-profiles.generated.d.ts.map +1 -1
- package/dist/runtime/connector-auth-acquisition-profiles.generated.js +13 -14
- package/dist/runtime/connector-auth-acquisition-profiles.generated.js.map +1 -1
- package/dist/runtime/connector-auth-acquisition.d.ts +26 -19
- package/dist/runtime/connector-auth-acquisition.d.ts.map +1 -1
- package/dist/runtime/connector-auth-acquisition.js +352 -269
- package/dist/runtime/connector-auth-acquisition.js.map +1 -1
- package/dist/runtime/connector-auth-profiles.generated.d.ts +1 -1
- package/dist/runtime/connector-auth-profiles.generated.d.ts.map +1 -1
- package/dist/runtime/connector-auth-profiles.generated.js +4 -4
- package/dist/runtime/connector-auth-profiles.generated.js.map +1 -1
- package/dist/runtime/connector-inventory.d.ts +19 -3
- package/dist/runtime/connector-inventory.d.ts.map +1 -1
- package/dist/runtime/connector-inventory.js +77 -25
- package/dist/runtime/connector-inventory.js.map +1 -1
- package/dist/runtime/desktop-audit.js +4 -1
- package/dist/runtime/desktop-audit.js.map +1 -1
- package/dist/runtime/desktop-first-party-runtime.d.ts +8 -1
- package/dist/runtime/desktop-first-party-runtime.d.ts.map +1 -1
- package/dist/runtime/desktop-first-party-runtime.js +80 -2
- package/dist/runtime/desktop-first-party-runtime.js.map +1 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.d.ts +174 -10
- package/dist/runtime/first-party-protected-runtime-profiles.generated.d.ts.map +1 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.js +45 -4
- package/dist/runtime/first-party-protected-runtime-profiles.generated.js.map +1 -1
- package/dist/runtime/generated.d.ts +2 -2
- package/dist/runtime/generated.d.ts.map +1 -1
- package/dist/runtime/generated.js +1 -1
- package/dist/runtime/generated.js.map +1 -1
- package/dist/runtime/host.d.ts +3 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/host.js +4 -0
- package/dist/runtime/host.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +12 -10
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/machine-loadouts.d.ts +18 -0
- package/dist/runtime/machine-loadouts.d.ts.map +1 -1
- package/dist/runtime/machine-loadouts.js +26 -0
- package/dist/runtime/machine-loadouts.js.map +1 -1
- package/dist/runtime/node-grpc-errors.js +3 -3
- package/dist/runtime/node-grpc-errors.js.map +1 -1
- package/dist/runtime/node-grpc.d.ts.map +1 -1
- package/dist/runtime/node-grpc.js +24 -4
- package/dist/runtime/node-grpc.js.map +1 -1
- package/dist/runtime/product-control-projection.d.ts.map +1 -1
- package/dist/runtime/product-control-projection.js +11 -2
- package/dist/runtime/product-control-projection.js.map +1 -1
- package/dist/runtime/product-control-types.d.ts +13 -2
- package/dist/runtime/product-control-types.d.ts.map +1 -1
- package/dist/runtime/product-control-types.js.map +1 -1
- package/dist/runtime/reason-messages.d.ts +6 -0
- package/dist/runtime/reason-messages.d.ts.map +1 -1
- package/dist/runtime/reason-messages.js +17 -2
- package/dist/runtime/reason-messages.js.map +1 -1
- package/dist/runtime/runtime-agent-inspect-projection.d.ts +2 -3
- package/dist/runtime/runtime-agent-inspect-projection.d.ts.map +1 -1
- package/dist/runtime/runtime-agent-inspect-projection.js +2 -27
- package/dist/runtime/runtime-agent-inspect-projection.js.map +1 -1
- package/dist/runtime/runtime-agent-inspect-types.d.ts +4 -32
- package/dist/runtime/runtime-agent-inspect-types.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client-projections.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client-projections.js +19 -19
- package/dist/runtime/runtime-local-environment-client-projections.js.map +1 -1
- package/dist/runtime/runtime-local-environment-client-types.d.ts +48 -21
- package/dist/runtime/runtime-local-environment-client-types.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client-values.d.ts +3 -1
- package/dist/runtime/runtime-local-environment-client-values.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client-values.js +43 -0
- package/dist/runtime/runtime-local-environment-client-values.js.map +1 -1
- package/dist/runtime/runtime-local-environment-client.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client.js +27 -4
- package/dist/runtime/runtime-local-environment-client.js.map +1 -1
- package/dist/runtime/runtime-local-recommendation-types.d.ts +3 -0
- package/dist/runtime/runtime-local-recommendation-types.d.ts.map +1 -1
- package/dist/runtime/runtime-local-recommendation.d.ts.map +1 -1
- package/dist/runtime/runtime-local-recommendation.js +1 -0
- package/dist/runtime/runtime-local-recommendation.js.map +1 -1
- package/dist/runtime/runtime-method-modules.d.ts +1 -1
- package/dist/runtime/runtime-method-modules.d.ts.map +1 -1
- package/dist/runtime/runtime-method-modules.js +4 -2
- package/dist/runtime/runtime-method-modules.js.map +1 -1
- package/dist/runtime/scenario-jobs.d.ts +23 -1
- package/dist/runtime/scenario-jobs.d.ts.map +1 -1
- package/dist/runtime/scenario-jobs.js +227 -264
- package/dist/runtime/scenario-jobs.js.map +1 -1
- package/dist/runtime/shared-local-agent-ai-config.d.ts.map +1 -1
- package/dist/runtime/shared-local-agent-ai-config.js +3 -0
- package/dist/runtime/shared-local-agent-ai-config.js.map +1 -1
- package/dist/runtime/wire-types/agent-participation-enums.d.ts +3 -1
- package/dist/runtime/wire-types/agent-participation-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/agent-participation-enums.js +3 -1
- package/dist/runtime/wire-types/agent-participation-enums.js.map +1 -1
- package/dist/runtime/wire-types/agent-participation-types.d.ts +8 -4
- package/dist/runtime/wire-types/agent-participation-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-enums.d.ts +130 -3
- package/dist/runtime/wire-types/ai-scenario-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-enums.js +149 -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-enums.d.ts +47 -0
- package/dist/runtime/wire-types/identity-app-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/identity-app-enums.js +55 -0
- package/dist/runtime/wire-types/identity-app-enums.js.map +1 -1
- package/dist/runtime/wire-types/identity-app-types.d.ts +8 -6
- package/dist/runtime/wire-types/identity-app-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/local-memory-enums.d.ts +40 -1
- package/dist/runtime/wire-types/local-memory-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/local-memory-enums.js +44 -0
- package/dist/runtime/wire-types/local-memory-enums.js.map +1 -1
- package/dist/runtime/wire-types/reason-code-enums.d.ts +29 -1
- package/dist/runtime/wire-types/reason-code-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/reason-code-enums.js +28 -0
- package/dist/runtime/wire-types/reason-code-enums.js.map +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +2 -2
- package/dist/types/errors.js.map +1 -1
- package/dist/types/reason-code.d.ts +2 -0
- package/dist/types/reason-code.d.ts.map +1 -1
- package/dist/types/reason-code.js +2 -0
- package/dist/types/reason-code.js.map +1 -1
- package/dist/types/sha256.d.ts +6 -1
- package/dist/types/sha256.d.ts.map +1 -1
- package/dist/types/sha256.js +60 -25
- package/dist/types/sha256.js.map +1 -1
- package/package.json +5 -5
- package/dist/realm/feed.d.ts +0 -4
- package/dist/realm/feed.d.ts.map +0 -1
- package/dist/realm/feed.js +0 -10
- package/dist/realm/feed.js.map +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { ScenarioJobStatus, type CancelScenarioJobRequest, type CancelScenarioJobResponse, type GetScenarioArtifactsRequest, type GetScenarioArtifactsResponse, type GetScenarioJobRequest, type GetScenarioJobResponse, type ScenarioArtifact, type ScenarioJob, type ScenarioJobEvent, type ScenarioOutput, type SubmitScenarioJobRequest, type SubmitScenarioJobResponse, type RuntimeTypedCallOptions, type VoiceAsset, type VoiceReference, type VisionLocateResult } from '../core-generated/runtime-typed-client.js';
|
|
1
|
+
import { ScenarioJobStatus, ScenarioType, type CancelScenarioJobRequest, type CancelScenarioJobResponse, type GetScenarioArtifactsRequest, type GetScenarioArtifactsResponse, type GetScenarioJobRequest, type GetScenarioJobResponse, type ScenarioArtifact, type ScenarioJob, type ScenarioJobEvent, type ScenarioOutput, type SubmitScenarioJobRequest, type SubmitScenarioJobResponse, type RuntimeTypedCallOptions, type VoiceAsset, type VoiceReference, type VisionLocateResult, type VisionLocateScenarioSpec } from '../core-generated/runtime-typed-client.js';
|
|
2
2
|
export declare const NIMI_RUNTIME_SCENARIO_JOB_STREAM_INTERRUPTED_REASON = "SDK_RUNTIME_SCENARIO_JOB_STREAM_INTERRUPTED";
|
|
3
|
+
/** Default Get cadence for every implementation; events are only hints. */
|
|
4
|
+
export declare const NIMI_RUNTIME_SCENARIO_JOB_GET_INTERVAL_MS = 1000;
|
|
5
|
+
export type NimiRuntimeScenarioJobObservation = Awaited<ReturnType<NimiScenarioJobClient['getScenarioJob']>>;
|
|
3
6
|
export type NimiRuntimeScenarioJobErrorTerminalStatus = ScenarioJobStatus.FAILED | ScenarioJobStatus.CANCELED | ScenarioJobStatus.TIMEOUT;
|
|
4
7
|
export type NimiRuntimeScenarioJob = ScenarioJob;
|
|
5
8
|
export type NimiRuntimeScenarioArtifact = ScenarioArtifact;
|
|
@@ -25,6 +28,7 @@ export interface NimiProtectedLocalScenarioJobClient extends Omit<NimiRuntimeSce
|
|
|
25
28
|
}
|
|
26
29
|
export type NimiScenarioJobClient = NimiRuntimeScenarioJobClient | NimiProtectedLocalScenarioJobClient;
|
|
27
30
|
export interface NimiRuntimeScenarioJobResult {
|
|
31
|
+
readonly response: NimiRuntimeScenarioJobObservation;
|
|
28
32
|
readonly job: NimiRuntimeScenarioJob;
|
|
29
33
|
readonly artifacts: readonly NimiRuntimeScenarioArtifact[];
|
|
30
34
|
readonly traceId?: string;
|
|
@@ -37,13 +41,31 @@ export interface NimiRuntimeScenarioJobRunnerInput {
|
|
|
37
41
|
readonly ai: NimiScenarioJobClient;
|
|
38
42
|
readonly request: NimiRuntimeScenarioJobSubmitRequest;
|
|
39
43
|
readonly callOptions?: RuntimeTypedCallOptions;
|
|
44
|
+
/** Explicit run cancellation: abort sends the common Cancel operation. */
|
|
40
45
|
readonly signal?: AbortSignal;
|
|
46
|
+
/** Stops observation only; admitted work is not canceled. */
|
|
47
|
+
readonly observationSignal?: AbortSignal;
|
|
48
|
+
readonly getIntervalMs?: number;
|
|
49
|
+
readonly onObservation?: (response: NimiRuntimeScenarioJobObservation) => void;
|
|
41
50
|
readonly abortReason?: string;
|
|
42
51
|
readonly onJobUpdate?: (job: NimiRuntimeScenarioJob) => void;
|
|
43
52
|
}
|
|
53
|
+
export type NimiRuntimeScenarioJobObservationInput = Omit<NimiRuntimeScenarioJobRunnerInput, 'request' | 'observationSignal' | 'signal'> & {
|
|
54
|
+
/** Ends this observation only, without canceling the Job. */
|
|
55
|
+
readonly signal?: AbortSignal;
|
|
56
|
+
/** Optional explicit user Cancel action, separate from observer disposal. */
|
|
57
|
+
readonly cancelSignal?: AbortSignal;
|
|
58
|
+
readonly jobId: string;
|
|
59
|
+
readonly scenarioType: ScenarioType;
|
|
60
|
+
readonly expectedVision?: Pick<VisionLocateScenarioSpec, 'imageArtifactId' | 'geometry'>;
|
|
61
|
+
};
|
|
44
62
|
export declare function withNimiRuntimeIdempotencyMetadata(options: RuntimeTypedCallOptions | undefined, idempotencyKey: string | undefined): RuntimeTypedCallOptions;
|
|
45
63
|
export declare function isNimiRuntimeScenarioJobTerminalStatus(status: ScenarioJobStatus): boolean;
|
|
46
64
|
export declare function getNimiRuntimeScenarioJobTerminalStatusFromError(error: unknown): NimiRuntimeScenarioJobErrorTerminalStatus | null;
|
|
47
65
|
export declare function runNimiRuntimeScenarioJob(input: NimiRuntimeScenarioJobRunnerInput): Promise<NimiRuntimeScenarioJobResult>;
|
|
66
|
+
/** Observe an existing author action without submitting or replaying it.
|
|
67
|
+
* The expected scenario and optional Locate geometry verify the observed result.
|
|
68
|
+
*/
|
|
69
|
+
export declare function observeNimiRuntimeScenarioJob(input: NimiRuntimeScenarioJobObservationInput): Promise<NimiRuntimeScenarioJobResult>;
|
|
48
70
|
export {};
|
|
49
71
|
//# sourceMappingURL=scenario-jobs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario-jobs.d.ts","sourceRoot":"","sources":["../../runtime/scenario-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"scenario-jobs.d.ts","sourceRoot":"","sources":["../../runtime/scenario-jobs.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReasonCode as RuntimeGeneratedReasonCode, ScenarioJobStatus, ScenarioJobEventType, ScenarioType, VoiceAssetPersistence, VoiceAssetStatus, VoiceCreationSource, VoiceReferenceKind, } from '../core-generated/runtime-typed-client.js';
|
|
2
2
|
import { localVisionLocateFromRuntime, localLocateGeometry, localInterruptionFromRuntime } from '../core/app/local-app-runtime-platform-vision.js';
|
|
3
|
-
import { createNimiError, ReasonCode } from '../types/index.js';
|
|
3
|
+
import { asNimiError, createNimiError, ReasonCode } from '../types/index.js';
|
|
4
4
|
import { fromNimiRuntimeProtoStruct } from './runtime-agent-values.js';
|
|
5
5
|
const NIMI_RUNTIME_SCENARIO_JOB_STATUS_DETAIL_KEY = 'scenarioJobStatus';
|
|
6
6
|
export const NIMI_RUNTIME_SCENARIO_JOB_STREAM_INTERRUPTED_REASON = 'SDK_RUNTIME_SCENARIO_JOB_STREAM_INTERRUPTED';
|
|
7
|
-
|
|
7
|
+
/** Default Get cadence for every implementation; events are only hints. */
|
|
8
|
+
export const NIMI_RUNTIME_SCENARIO_JOB_GET_INTERVAL_MS = 1_000;
|
|
8
9
|
export function withNimiRuntimeIdempotencyMetadata(options, idempotencyKey) {
|
|
9
10
|
const normalized = normalizeText(idempotencyKey);
|
|
10
11
|
if (!normalized) {
|
|
@@ -47,7 +48,9 @@ export function getNimiRuntimeScenarioJobTerminalStatusFromError(error) {
|
|
|
47
48
|
// @nimi-authority: rule.nimi.sdks.feature-clients.r002
|
|
48
49
|
// @nimi-authority: rule.nimi.sdks.feature-clients.r069
|
|
49
50
|
export async function runNimiRuntimeScenarioJob(input) {
|
|
51
|
+
scenarioGetInterval(input.getIntervalMs);
|
|
50
52
|
throwIfAborted(input.signal);
|
|
53
|
+
throwIfAborted(input.observationSignal);
|
|
51
54
|
const submitResponse = await input.ai.submitScenarioJob(input.request, withNimiRuntimeIdempotencyMetadata(input.callOptions, input.request.idempotencyKey));
|
|
52
55
|
const submitted = submitResponse.job;
|
|
53
56
|
const jobId = normalizeText(submitted?.jobId);
|
|
@@ -59,149 +62,239 @@ export async function runNimiRuntimeScenarioJob(input) {
|
|
|
59
62
|
source: 'sdk',
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
observedTerminalEvent = true;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
65
|
+
const spec = input.request.spec?.spec;
|
|
66
|
+
return observeSubmittedScenarioJob({ ...input, signal: input.observationSignal, cancelSignal: input.signal, scenarioType: input.request.scenarioType, cancelKey: input.request.idempotencyKey,
|
|
67
|
+
...(spec?.oneofKind === 'visionLocate' ? { expectedVision: spec.visionLocate } : {}) }, submitted);
|
|
68
|
+
}
|
|
69
|
+
/** Observe an existing author action without submitting or replaying it.
|
|
70
|
+
* The expected scenario and optional Locate geometry verify the observed result.
|
|
71
|
+
*/
|
|
72
|
+
export async function observeNimiRuntimeScenarioJob(input) {
|
|
73
|
+
scenarioGetInterval(input.getIntervalMs);
|
|
74
|
+
if (!input.jobId || input.jobId !== input.jobId.trim())
|
|
75
|
+
throw runtimeScenarioJobResponseError('An existing Job identifier is required');
|
|
76
|
+
return observeSubmittedScenarioJob({ ...input, jobId: input.jobId });
|
|
77
|
+
}
|
|
78
|
+
async function observeSubmittedScenarioJob(input, submitted) {
|
|
79
|
+
const jobId = submitted?.jobId ?? input.jobId;
|
|
80
|
+
const interval = scenarioGetInterval(input.getIntervalMs);
|
|
81
|
+
const lifetime = new AbortController();
|
|
82
|
+
const signal = AbortSignal.any([lifetime.signal, ...[input.signal, input.callOptions?.signal].filter((value) => Boolean(value))]);
|
|
83
|
+
const options = { ...input.callOptions, signal };
|
|
84
|
+
let active = true;
|
|
85
|
+
let lastJob = submitted;
|
|
86
|
+
let terminalResponse;
|
|
87
|
+
let nextGetAt = 0;
|
|
88
|
+
let terminalHint = submitted ? isNimiRuntimeScenarioJobTerminalStatus(submitted.status) : false;
|
|
89
|
+
let terminalStatus = terminalHint ? submitted.status : undefined;
|
|
90
|
+
let cancelSent = false;
|
|
91
|
+
let cancellation;
|
|
92
|
+
let cancelFailure;
|
|
93
|
+
let wake;
|
|
94
|
+
let iterator;
|
|
95
|
+
let eventReady;
|
|
96
|
+
const readNext = () => {
|
|
97
|
+
void Promise.resolve().then(() => iterator.next()).then(result => { if (active) {
|
|
98
|
+
eventReady = { kind: 'event', result };
|
|
99
|
+
wake?.();
|
|
100
|
+
} }, () => { if (active) {
|
|
101
|
+
eventReady = { kind: 'stream-ended' };
|
|
102
|
+
wake?.();
|
|
103
|
+
} });
|
|
104
|
+
};
|
|
105
|
+
const validateJob = (job) => {
|
|
106
|
+
if (!job || job.jobId !== jobId || job.scenarioType !== input.scenarioType) {
|
|
107
|
+
throw runtimeScenarioJobResponseError('Observed Job does not match the original identity and scenario');
|
|
108
108
|
}
|
|
109
|
+
if (![ScenarioJobStatus.SUBMITTED, ScenarioJobStatus.QUEUED, ScenarioJobStatus.RUNNING,
|
|
110
|
+
ScenarioJobStatus.COMPLETED, ScenarioJobStatus.FAILED, ScenarioJobStatus.CANCELED, ScenarioJobStatus.TIMEOUT].includes(job.status)) {
|
|
111
|
+
throw runtimeScenarioJobResponseError('Observed Job has an unknown status');
|
|
112
|
+
}
|
|
113
|
+
return job;
|
|
114
|
+
};
|
|
115
|
+
const requestCancel = () => {
|
|
116
|
+
if (!active || cancelSent)
|
|
117
|
+
return;
|
|
118
|
+
cancelSent = true;
|
|
119
|
+
// An explicit control call outlives this observer's disposal, with only
|
|
120
|
+
// its caller-supplied technical call constraints. Never retry it here.
|
|
121
|
+
cancellation = Promise.resolve().then(() => input.ai.cancelScenarioJob({ jobId, reason: input.abortReason || 'caller_requested_cancel' }, withNimiRuntimeIdempotencyMetadata(input.callOptions, `cancel:${input.cancelKey ?? jobId}:${jobId}`)))
|
|
122
|
+
.then(response => {
|
|
123
|
+
validateJob(response.job);
|
|
124
|
+
if (!active)
|
|
125
|
+
return;
|
|
126
|
+
terminalHint = isNimiRuntimeScenarioJobTerminalStatus(response.job.status);
|
|
127
|
+
if (terminalHint)
|
|
128
|
+
terminalStatus = response.job.status;
|
|
129
|
+
nextGetAt = 0;
|
|
130
|
+
wake?.();
|
|
131
|
+
}).catch(error => {
|
|
132
|
+
cancelFailure = error;
|
|
133
|
+
if (active)
|
|
134
|
+
lifetime.abort();
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
const disposeObservation = () => {
|
|
138
|
+
if (!active)
|
|
139
|
+
return;
|
|
140
|
+
active = false;
|
|
141
|
+
input.cancelSignal?.removeEventListener('abort', requestCancel);
|
|
142
|
+
lifetime.abort();
|
|
143
|
+
void iterator?.return?.().catch(() => undefined);
|
|
109
144
|
};
|
|
110
145
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
146
|
+
if (submitted)
|
|
147
|
+
validateJob(submitted);
|
|
148
|
+
input.cancelSignal?.addEventListener('abort', requestCancel, { once: true });
|
|
149
|
+
if (input.cancelSignal?.aborted)
|
|
150
|
+
requestCancel();
|
|
151
|
+
throwIfAborted(signal);
|
|
152
|
+
if (submitted)
|
|
153
|
+
input.onJobUpdate?.(submitted);
|
|
154
|
+
let subscriptionStarted = false;
|
|
155
|
+
const subscribe = () => {
|
|
156
|
+
if (subscriptionStarted)
|
|
157
|
+
return;
|
|
158
|
+
subscriptionStarted = true;
|
|
159
|
+
try {
|
|
160
|
+
iterator = input.ai.subscribeScenarioJobEvents({ jobId }, options)[Symbol.asyncIterator]();
|
|
161
|
+
readNext();
|
|
127
162
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
163
|
+
catch { /* Get remains authoritative when subscriptions are unavailable. */ }
|
|
164
|
+
};
|
|
165
|
+
if (submitted && !terminalHint)
|
|
166
|
+
subscribe();
|
|
167
|
+
while (!terminalResponse?.job || !isNimiRuntimeScenarioJobTerminalStatus(terminalResponse.job.status)) {
|
|
168
|
+
throwIfAborted(signal);
|
|
169
|
+
if (terminalHint || Date.now() >= nextGetAt) {
|
|
170
|
+
const expectedTerminal = terminalStatus;
|
|
171
|
+
const response = await observationCall(input.ai.getScenarioJob({ jobId }, options), signal, jobId);
|
|
172
|
+
const job = validateJob(response.job);
|
|
173
|
+
if (expectedTerminal !== undefined && job.status !== expectedTerminal) {
|
|
174
|
+
throw runtimeScenarioJobResponseError('Terminal Get disagrees with the observed terminal state');
|
|
175
|
+
}
|
|
176
|
+
// A backlog event may be stale; only a full Get can finalize a result.
|
|
177
|
+
lastJob = job;
|
|
178
|
+
terminalResponse = response;
|
|
179
|
+
input.onObservation?.(response);
|
|
180
|
+
throwIfAborted(signal);
|
|
181
|
+
input.onJobUpdate?.(job);
|
|
182
|
+
terminalHint = terminalStatus !== undefined && !isNimiRuntimeScenarioJobTerminalStatus(job.status);
|
|
183
|
+
nextGetAt = Date.now() + interval;
|
|
184
|
+
if (isNimiRuntimeScenarioJobTerminalStatus(job.status))
|
|
185
|
+
break;
|
|
186
|
+
subscribe();
|
|
137
187
|
}
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
188
|
+
const outcome = await new Promise((resolve, reject) => {
|
|
189
|
+
let settled = false;
|
|
190
|
+
const finish = (value) => {
|
|
191
|
+
if (settled)
|
|
192
|
+
return;
|
|
193
|
+
settled = true;
|
|
194
|
+
clearTimeout(timer);
|
|
195
|
+
signal.removeEventListener('abort', abort);
|
|
196
|
+
wake = undefined;
|
|
197
|
+
resolve(value ?? { kind: 'wake' });
|
|
198
|
+
};
|
|
199
|
+
const abort = () => {
|
|
200
|
+
if (settled)
|
|
201
|
+
return;
|
|
202
|
+
settled = true;
|
|
203
|
+
clearTimeout(timer);
|
|
204
|
+
signal.removeEventListener('abort', abort);
|
|
205
|
+
wake = undefined;
|
|
206
|
+
reject(abortedNimiRuntimeScenarioJobError(jobId));
|
|
207
|
+
};
|
|
208
|
+
const timer = setTimeout(finish, Math.max(0, nextGetAt - Date.now()));
|
|
209
|
+
wake = () => finish(eventReady);
|
|
210
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
211
|
+
if (signal.aborted)
|
|
212
|
+
abort();
|
|
213
|
+
if (eventReady)
|
|
214
|
+
finish(eventReady);
|
|
215
|
+
});
|
|
216
|
+
if (outcome.kind === 'stream-ended' || (outcome.kind === 'event' && outcome.result.done)) {
|
|
217
|
+
eventReady = undefined;
|
|
148
218
|
}
|
|
149
|
-
else {
|
|
150
|
-
|
|
219
|
+
else if (outcome.kind === 'event') {
|
|
220
|
+
eventReady = undefined;
|
|
221
|
+
const event = outcome.result.value;
|
|
222
|
+
const job = validateJob(event.job);
|
|
223
|
+
if (!scenarioJobEventMatchesStatus(event.eventType, job.status))
|
|
224
|
+
throw runtimeScenarioJobResponseError('Job event status is inconsistent');
|
|
225
|
+
if (isNimiRuntimeScenarioJobTerminalStatus(job.status)) {
|
|
226
|
+
terminalHint = true;
|
|
227
|
+
terminalStatus = job.status;
|
|
228
|
+
}
|
|
229
|
+
else if ((!lastJob || scenarioJobEventIsNewer(job, lastJob))) {
|
|
230
|
+
lastJob = job;
|
|
231
|
+
input.onJobUpdate?.(job);
|
|
232
|
+
}
|
|
233
|
+
readNext();
|
|
151
234
|
}
|
|
152
235
|
}
|
|
153
|
-
|
|
154
|
-
|
|
236
|
+
throwIfAborted(signal);
|
|
237
|
+
const job = validateJob(terminalResponse.job);
|
|
238
|
+
ensureCompletedNimiRuntimeScenarioJob(job);
|
|
239
|
+
validateScenarioJobTerminalResult(job, terminalResponse.asset, terminalResponse.voiceReference, input.ai.terminalVoiceAssetProjection ?? 'runtime-full');
|
|
240
|
+
if (job.scenarioType === ScenarioType.VISION_LOCATE) {
|
|
241
|
+
const spec = input.expectedVision;
|
|
242
|
+
if (!terminalResponse.visionLocate || !spec || job.artifacts.length !== 0)
|
|
243
|
+
throw runtimeScenarioJobResponseError('Locate Job omitted its typed result');
|
|
244
|
+
const result = localVisionLocateFromRuntime(terminalResponse.visionLocate);
|
|
245
|
+
if (result.imageArtifactId !== spec.imageArtifactId || result.locations.some(location => location.type !== localLocateGeometry(spec.geometry)))
|
|
246
|
+
throw runtimeScenarioJobResponseError('Locate result does not match the submitted image and geometry');
|
|
155
247
|
}
|
|
248
|
+
else if (terminalResponse.visionLocate)
|
|
249
|
+
throw runtimeScenarioJobResponseError('Non-Locate Job returned a Locate result');
|
|
250
|
+
const artifacts = job.scenarioType === ScenarioType.VOICE_CREATE || job.scenarioType === ScenarioType.VISION_LOCATE
|
|
251
|
+
? { artifacts: job.artifacts, traceId: job.traceId, output: undefined }
|
|
252
|
+
: await observationCall(input.ai.getScenarioArtifacts({ jobId }, options), signal, jobId);
|
|
253
|
+
await cancellation;
|
|
254
|
+
if (cancelFailure)
|
|
255
|
+
throw cancelFailure;
|
|
256
|
+
throwIfAborted(signal);
|
|
257
|
+
return { response: terminalResponse, job, artifacts: artifacts.artifacts, traceId: normalizeText(artifacts.traceId) || undefined, output: artifacts.output,
|
|
258
|
+
...(terminalResponse.asset ? { asset: terminalResponse.asset } : {}),
|
|
259
|
+
...(terminalResponse.voiceReference ? { voiceReference: terminalResponse.voiceReference } : {}),
|
|
260
|
+
...(terminalResponse.visionLocate ? { visionLocate: terminalResponse.visionLocate } : {}),
|
|
261
|
+
};
|
|
156
262
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
terminalJob = refreshed.job;
|
|
166
|
-
recoveredTerminalResponse = refreshed;
|
|
167
|
-
observedTerminalEvent = true;
|
|
168
|
-
input.onJobUpdate?.(refreshed.job);
|
|
169
|
-
}
|
|
170
|
-
ensureCompletedNimiRuntimeScenarioJob(terminalJob);
|
|
171
|
-
const eventStatus = terminalJob?.status;
|
|
172
|
-
const terminalResponse = recoveredTerminalResponse
|
|
173
|
-
?? await input.ai.getScenarioJob({ jobId }, input.callOptions);
|
|
174
|
-
terminalJob = terminalResponse.job;
|
|
175
|
-
if (normalizeText(terminalJob?.jobId) !== jobId || terminalJob?.scenarioType !== input.request.scenarioType) {
|
|
176
|
-
throw runtimeScenarioJobResponseError('Runtime Scenario job terminal result does not match the submitted Job');
|
|
263
|
+
catch (cause) {
|
|
264
|
+
// Release observation immediately, but settle the one explicit Cancel that
|
|
265
|
+
// was already requested so a refusal is not hidden by a view abort.
|
|
266
|
+
disposeObservation();
|
|
267
|
+
await cancellation;
|
|
268
|
+
const error = asNimiError(cancelFailure ?? cause);
|
|
269
|
+
throw createNimiError({ ...error, message: error.message, details: { ...error.details, jobId } });
|
|
177
270
|
}
|
|
178
|
-
|
|
179
|
-
|
|
271
|
+
finally {
|
|
272
|
+
disposeObservation();
|
|
180
273
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
274
|
+
}
|
|
275
|
+
function scenarioJobEventIsNewer(job, current) {
|
|
276
|
+
if (job.status < current.status)
|
|
277
|
+
return false;
|
|
278
|
+
if (!job.updatedAt || !current.updatedAt)
|
|
279
|
+
return job.status > current.status;
|
|
280
|
+
const time = (value) => BigInt(value.seconds) * 1000000000n + BigInt(value.nanos);
|
|
281
|
+
return time(job.updatedAt) > time(current.updatedAt);
|
|
282
|
+
}
|
|
283
|
+
function scenarioGetInterval(value) {
|
|
284
|
+
const interval = value ?? NIMI_RUNTIME_SCENARIO_JOB_GET_INTERVAL_MS;
|
|
285
|
+
if (!Number.isSafeInteger(interval) || interval < 1 || interval > 2_147_483_647) {
|
|
286
|
+
throw createNimiError({ message: 'getIntervalMs must be a positive timer interval', reasonCode: ReasonCode.SDK_AI_INPUT_INVALID, source: 'sdk' });
|
|
190
287
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
...(terminalResponse.asset ? { asset: terminalResponse.asset } : {}),
|
|
202
|
-
...(terminalResponse.voiceReference ? { voiceReference: terminalResponse.voiceReference } : {}),
|
|
203
|
-
...(terminalResponse.visionLocate ? { visionLocate: terminalResponse.visionLocate } : {}),
|
|
204
|
-
};
|
|
288
|
+
return interval;
|
|
289
|
+
}
|
|
290
|
+
function observationCall(call, signal, jobId) {
|
|
291
|
+
return new Promise((resolve, reject) => {
|
|
292
|
+
const abort = () => reject(abortedNimiRuntimeScenarioJobError(jobId));
|
|
293
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
294
|
+
if (signal.aborted)
|
|
295
|
+
abort();
|
|
296
|
+
call.then(resolve, reject).finally(() => signal.removeEventListener('abort', abort)).catch(() => undefined);
|
|
297
|
+
});
|
|
205
298
|
}
|
|
206
299
|
function scenarioJobEventMatchesStatus(eventType, status) {
|
|
207
300
|
switch (eventType) {
|
|
@@ -257,42 +350,6 @@ function runtimeScenarioJobResponseError(message) {
|
|
|
257
350
|
source: 'sdk',
|
|
258
351
|
});
|
|
259
352
|
}
|
|
260
|
-
async function queryMatchingScenarioJob(input, jobId) {
|
|
261
|
-
let response;
|
|
262
|
-
try {
|
|
263
|
-
response = await input.ai.getScenarioJob({ jobId }, input.callOptions);
|
|
264
|
-
}
|
|
265
|
-
catch {
|
|
266
|
-
return undefined;
|
|
267
|
-
}
|
|
268
|
-
const job = response.job;
|
|
269
|
-
if (normalizeText(job?.jobId) !== jobId || job?.scenarioType !== input.request.scenarioType) {
|
|
270
|
-
throw runtimeScenarioJobResponseError('Runtime Scenario job recovery result does not match the submitted Job');
|
|
271
|
-
}
|
|
272
|
-
return response;
|
|
273
|
-
}
|
|
274
|
-
function runtimeScenarioJobStreamInterruptedError(jobId) {
|
|
275
|
-
return createNimiError({
|
|
276
|
-
message: 'The Runtime Scenario job event stream ended before a terminal state could be confirmed.',
|
|
277
|
-
reasonCode: NIMI_RUNTIME_SCENARIO_JOB_STREAM_INTERRUPTED_REASON,
|
|
278
|
-
actionHint: 'query_runtime_scenario_job',
|
|
279
|
-
retryable: true,
|
|
280
|
-
source: 'sdk',
|
|
281
|
-
details: { jobId },
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
async function cancelNimiRuntimeScenarioJob(input, jobId) {
|
|
285
|
-
try {
|
|
286
|
-
return await input.ai.cancelScenarioJob({
|
|
287
|
-
jobId,
|
|
288
|
-
reason: input.abortReason || 'aborted_by_abort_signal',
|
|
289
|
-
}, withNimiRuntimeIdempotencyMetadata(input.callOptions, `cancel:${input.request.idempotencyKey}:${jobId}`));
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
292
|
-
// Preserve the original abort/error path; Runtime remains job authority.
|
|
293
|
-
return undefined;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
353
|
function ensureCompletedNimiRuntimeScenarioJob(job) {
|
|
297
354
|
if (!job) {
|
|
298
355
|
throw createNimiError({
|
|
@@ -319,6 +376,7 @@ function ensureCompletedNimiRuntimeScenarioJob(job) {
|
|
|
319
376
|
retryable,
|
|
320
377
|
source: 'runtime',
|
|
321
378
|
details: {
|
|
379
|
+
jobId: job.jobId,
|
|
322
380
|
[NIMI_RUNTIME_SCENARIO_JOB_STATUS_DETAIL_KEY]: ScenarioJobStatus[job.status] || String(job.status),
|
|
323
381
|
...(Object.keys(reasonMetadata).length > 0 ? { reasonMetadata } : {}),
|
|
324
382
|
...(interruption ? { interruption: { ...interruption } } : {}),
|
|
@@ -351,7 +409,7 @@ function throwIfAborted(signal) {
|
|
|
351
409
|
}
|
|
352
410
|
function abortedNimiRuntimeScenarioJobError(jobId) {
|
|
353
411
|
return createNimiError({
|
|
354
|
-
message: '
|
|
412
|
+
message: 'Observation ended; the Runtime Job remains independently controlled.',
|
|
355
413
|
reasonCode: ReasonCode.OPERATION_ABORTED,
|
|
356
414
|
actionHint: 'query_runtime_scenario_job',
|
|
357
415
|
retryable: false,
|
|
@@ -359,101 +417,6 @@ function abortedNimiRuntimeScenarioJobError(jobId) {
|
|
|
359
417
|
...(jobId ? { details: { jobId } } : {}),
|
|
360
418
|
});
|
|
361
419
|
}
|
|
362
|
-
function nextWithAbort(iterator, signal, onAbort) {
|
|
363
|
-
if (!signal) {
|
|
364
|
-
return iterator.next();
|
|
365
|
-
}
|
|
366
|
-
if (signal.aborted) {
|
|
367
|
-
return onAbort().then((terminal) => terminal
|
|
368
|
-
? Promise.reject(abortedNimiRuntimeScenarioJobError())
|
|
369
|
-
: iterator.next());
|
|
370
|
-
}
|
|
371
|
-
return new Promise((resolve, reject) => {
|
|
372
|
-
let settled = false;
|
|
373
|
-
let aborting = false;
|
|
374
|
-
let cancellationComplete = false;
|
|
375
|
-
let pendingResult;
|
|
376
|
-
let pendingError;
|
|
377
|
-
let hasPendingError = false;
|
|
378
|
-
let convergenceTimer;
|
|
379
|
-
const cleanup = () => {
|
|
380
|
-
signal.removeEventListener('abort', abort);
|
|
381
|
-
if (convergenceTimer !== undefined) {
|
|
382
|
-
clearTimeout(convergenceTimer);
|
|
383
|
-
convergenceTimer = undefined;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
const finishPending = () => {
|
|
387
|
-
if (settled || !cancellationComplete)
|
|
388
|
-
return;
|
|
389
|
-
if (hasPendingError) {
|
|
390
|
-
settled = true;
|
|
391
|
-
cleanup();
|
|
392
|
-
reject(pendingError);
|
|
393
|
-
}
|
|
394
|
-
else if (pendingResult) {
|
|
395
|
-
settled = true;
|
|
396
|
-
cleanup();
|
|
397
|
-
resolve(pendingResult);
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
const abort = () => {
|
|
401
|
-
if (settled)
|
|
402
|
-
return;
|
|
403
|
-
aborting = true;
|
|
404
|
-
cleanup();
|
|
405
|
-
onAbort().then((terminal) => {
|
|
406
|
-
if (settled)
|
|
407
|
-
return;
|
|
408
|
-
if (terminal) {
|
|
409
|
-
settled = true;
|
|
410
|
-
reject(abortedNimiRuntimeScenarioJobError());
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
cancellationComplete = true;
|
|
414
|
-
convergenceTimer = setTimeout(() => {
|
|
415
|
-
if (settled)
|
|
416
|
-
return;
|
|
417
|
-
settled = true;
|
|
418
|
-
cleanup();
|
|
419
|
-
reject(abortedNimiRuntimeScenarioJobError());
|
|
420
|
-
}, NIMI_RUNTIME_SCENARIO_JOB_CANCEL_CONVERGENCE_TIMEOUT_MS);
|
|
421
|
-
finishPending();
|
|
422
|
-
}
|
|
423
|
-
}, (error) => {
|
|
424
|
-
if (settled)
|
|
425
|
-
return;
|
|
426
|
-
settled = true;
|
|
427
|
-
reject(error);
|
|
428
|
-
});
|
|
429
|
-
};
|
|
430
|
-
signal.addEventListener('abort', abort, { once: true });
|
|
431
|
-
iterator.next().then((result) => {
|
|
432
|
-
if (settled)
|
|
433
|
-
return;
|
|
434
|
-
if (aborting) {
|
|
435
|
-
pendingResult = result;
|
|
436
|
-
finishPending();
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
settled = true;
|
|
440
|
-
cleanup();
|
|
441
|
-
resolve(result);
|
|
442
|
-
}, (error) => {
|
|
443
|
-
if (settled)
|
|
444
|
-
return;
|
|
445
|
-
if (aborting) {
|
|
446
|
-
pendingError = error;
|
|
447
|
-
hasPendingError = true;
|
|
448
|
-
finishPending();
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
settled = true;
|
|
452
|
-
cleanup();
|
|
453
|
-
reject(error);
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
420
|
function normalizeText(value) {
|
|
458
421
|
return typeof value === 'string' ? value.trim() : '';
|
|
459
422
|
}
|