agent-device 0.21.37 → 0.21.38
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/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.37.apk → agent-device-android-ime-helper-0.21.38.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.38.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.37.manifest.json → agent-device-android-ime-helper-0.21.38.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.37.apk → agent-device-android-snapshot-helper-0.21.38.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.38.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.37.manifest.json → agent-device-android-snapshot-helper-0.21.38.manifest.json} +7 -7
- package/apple/fold-helper/Fold.m +8 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerKeyboardReturnKey.swift +53 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +42 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +26 -18
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +42 -11
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +123 -22
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +7 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +570 -53
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +41 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.h +7 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m +17 -1
- package/dist/src/THIRD_PARTY_NOTICES.txt +2 -2
- package/dist/src/absence-observation-errors.js +1 -1
- package/dist/src/absence-observation.js +1 -1
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb-executor.js +1 -1
- package/dist/src/adb-failure.js +2 -2
- package/dist/src/adb-transport.js +1 -1
- package/dist/src/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/ai-sdk.d.ts +1 -1
- package/dist/src/ai-sdk.js +1 -1
- package/dist/src/alert-contract.js +1 -1
- package/dist/src/alert-tree-driver.js +1 -1
- package/dist/src/alert.js +1 -1
- package/dist/src/android-adb.d.ts +1 -1
- package/dist/src/android.js +1 -1
- package/dist/src/android2.js +1 -1
- package/dist/src/app-backend.js +1 -1
- package/dist/src/app-catalog.js +1 -1
- package/dist/src/app-deployment-resolution.js +1 -1
- package/dist/src/app-inventory.js +1 -1
- package/dist/src/app-launch.js +1 -1
- package/dist/src/app-lifecycle.js +4 -4
- package/dist/src/app-lifecycle2.js +2 -2
- package/dist/src/app-log-files.js +1 -1
- package/dist/src/app-log-runtime2.js +2 -2
- package/dist/src/app-log-session-resource.js +1 -1
- package/dist/src/app-resolution.js +1 -1
- package/dist/src/app-state-read.js +1 -1
- package/dist/src/app-state-runtime.d.ts +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/archive.js +1 -1
- package/dist/src/args.js +1 -1
- package/dist/src/artifact-download.js +1 -1
- package/dist/src/artifact-tracking.js +1 -1
- package/dist/src/auth-session.js +1 -1
- package/dist/src/auth.js +1 -1
- package/dist/src/automation-helper-artifact.js +1 -1
- package/dist/src/automation-helper.js +1 -1
- package/dist/src/await-with-signal.js +1 -1
- package/dist/src/backend-snapshot-options.js +1 -1
- package/dist/src/boot-diagnostics.js +1 -1
- package/dist/src/bridge-source.js +1 -1
- package/dist/src/browser-launch.js +1 -1
- package/dist/src/browserstack-device-features.js +1 -1
- package/dist/src/browserstack.js +1 -1
- package/dist/src/cache.js +1 -1
- package/dist/src/capture-disclosure.js +1 -1
- package/dist/src/capture-lifecycle.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +19 -16
- package/dist/src/cli-output.js +11 -11
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +2 -2
- package/dist/src/click-button.js +1 -1
- package/dist/src/client-metro-companion.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-options.js +1 -1
- package/dist/src/client-port.d.ts +246 -208
- package/dist/src/clipboard-shell-response.js +1 -1
- package/dist/src/cloud-artifacts.d.ts +7 -2
- package/dist/src/code-signature-cache.js +1 -1
- package/dist/src/command-schema.js +6 -4
- package/dist/src/command-tools.js +3 -3
- package/dist/src/command.js +1 -1
- package/dist/src/composed-inventory-gateways.js +1 -1
- package/dist/src/composite-resource-admission.js +1 -1
- package/dist/src/config.js +1 -1
- package/dist/src/connection-lease-transaction.js +1 -1
- package/dist/src/connection-metro-runtime.js +1 -1
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection-verification.js +1 -1
- package/dist/src/connection.js +3 -3
- package/dist/src/context.js +1 -1
- package/dist/src/contract.d.ts +2 -1
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-client-attach.js +1 -1
- package/dist/src/daemon-client-dispatch-disclosure.js +1 -1
- package/dist/src/daemon-client-ensure.js +1 -1
- package/dist/src/daemon-client-ensuring.js +1 -1
- package/dist/src/daemon-client-lease-beat.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-client-liveness-probe.js +1 -1
- package/dist/src/daemon-client-remote-health-cache.js +1 -0
- package/dist/src/daemon-client-remote-health-recovery.js +1 -0
- package/dist/src/daemon-client-transport.js +1 -1
- package/dist/src/daemon-command-registry.js +1 -1
- package/dist/src/daemon-composition.js +1 -1
- package/dist/src/daemon-diagnostics-scope.js +1 -1
- package/dist/src/daemon-http.js +1 -1
- package/dist/src/daemon-launch-spec.js +1 -1
- package/dist/src/daemon-lifecycle-errors.js +1 -1
- package/dist/src/daemon-policy-file.js +1 -1
- package/dist/src/daemon-registration-owner.js +3 -3
- package/dist/src/daemon-registration.js +1 -1
- package/dist/src/daemon-resolution.js +1 -1
- package/dist/src/daemon-startup-diagnostics.js +1 -1
- package/dist/src/daemon-stop.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/debug-symbols-facade.js +3 -3
- package/dist/src/device-claim-admission.js +1 -0
- package/dist/src/device-claim-reconciliation.js +1 -0
- package/dist/src/device-claim-recovery.js +1 -1
- package/dist/src/device-claim-rule.js +1 -1
- package/dist/src/device-claims.js +1 -1
- package/dist/src/device-input-state.d.ts +1 -1
- package/dist/src/device-inventory-context.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device-session.js +1 -1
- package/dist/src/device-shell.js +1 -1
- package/dist/src/device.js +1 -1
- package/dist/src/device3.js +3 -3
- package/dist/src/devicectl.js +1 -1
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/discovery.js +1 -1
- package/dist/src/dispatch-resolve.js +1 -1
- package/dist/src/display-inventory.js +1 -1
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/doctor2.js +1 -1
- package/dist/src/durable-capture-resource.js +1 -1
- package/dist/src/durable-capture.js +1 -1
- package/dist/src/durable-resource.js +1 -1
- package/dist/src/ended-lease.js +1 -1
- package/dist/src/engine-eval-script.js +1 -1
- package/dist/src/error.js +2 -2
- package/dist/src/errors.js +1 -1
- package/dist/src/explicit-session-resolution.js +1 -1
- package/dist/src/expo-dev-client-launch.js +1 -1
- package/dist/src/failure-output.js +1 -1
- package/dist/src/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/flag-registry.js +1 -1
- package/dist/src/focus-runtime.js +1 -1
- package/dist/src/fold-helper.js +1 -1
- package/dist/src/generic-settle.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/gesture-admission.js +1 -1
- package/dist/src/gesture-plan-types.d.ts +1 -1
- package/dist/src/gesture-plan.js +1 -1
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/hdc.js +1 -1
- package/dist/src/helper-artifacts.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/host-file.js +1 -1
- package/dist/src/host.js +1 -1
- package/dist/src/host2.js +1 -1
- package/dist/src/host3.js +1 -1
- package/dist/src/host4.js +1 -1
- package/dist/src/host5.js +1 -1
- package/dist/src/host6.js +1 -1
- package/dist/src/human-control-contract.js +1 -1
- package/dist/src/human-control.js +1 -1
- package/dist/src/ime-rebind.js +1 -1
- package/dist/src/ime-settings-record.js +1 -1
- package/dist/src/ime-state.js +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/install-artifact-facade.js +1 -1
- package/dist/src/install-source-network-transport.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-error.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction-ref-policy.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-binding.js +1 -1
- package/dist/src/interactor.js +5 -5
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactor3.js +1 -1
- package/dist/src/interactor4.js +1 -1
- package/dist/src/interactor5.js +1 -1
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/companion-tunnel.js +1 -1
- package/dist/src/internal/daemon.js +1 -1
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/internal/run-script-child.js +1 -1
- package/dist/src/inventory.js +1 -1
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory3.js +1 -1
- package/dist/src/inventory5.js +1 -1
- package/dist/src/ios-node-interpretation.js +1 -1
- package/dist/src/ios-simulator-accessibility.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-engine.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/launch-confirmation.js +1 -1
- package/dist/src/launch-services-registration.js +1 -1
- package/dist/src/lease-context.js +1 -1
- package/dist/src/lease-registry-scope.js +1 -1
- package/dist/src/lease-release2.js +1 -1
- package/dist/src/lease-scope.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/leased-recording-retention.js +1 -1
- package/dist/src/legacy.js +1 -1
- package/dist/src/limrun-download-file.js +1 -1
- package/dist/src/limrun-ios-files.js +1 -1
- package/dist/src/limrun-ios-runner.js +2 -2
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/local-simulator-apps.js +1 -1
- package/dist/src/local-simulator-files.js +1 -1
- package/dist/src/location-coordinates.js +1 -1
- package/dist/src/manifest.js +1 -1
- package/dist/src/mechanics.js +12 -12
- package/dist/src/merge-flags.js +1 -1
- package/dist/src/metro-reload-endpoints.js +1 -1
- package/dist/src/metro-session-hints.js +1 -1
- package/dist/src/metro.d.ts +1 -1
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/network-traffic.js +1 -1
- package/dist/src/node-http.js +1 -1
- package/dist/src/node-touch-point.js +1 -1
- package/dist/src/observation.js +1 -1
- package/dist/src/open-script.js +1 -1
- package/dist/src/open-target-device-resolution.js +1 -1
- package/dist/src/orientation.js +1 -1
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +1 -1
- package/dist/src/perf-runtime-operation-builder.js +1 -1
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/perf-target.js +2 -2
- package/dist/src/perf.js +1 -1
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-runtime-android-adb-host.js +1 -1
- package/dist/src/platform-runtime-app-log-process.js +1 -1
- package/dist/src/platform-runtime-apple-application-tools.js +1 -1
- package/dist/src/platform-runtime-claim-recovery.js +1 -1
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +3 -3
- package/dist/src/platform-runtime-runtime-hints.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
- package/dist/src/platform-runtime-shutdown-error.js +1 -1
- package/dist/src/platform-runtime-unavailable.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/plist.js +1 -1
- package/dist/src/plugins2.js +1 -1
- package/dist/src/png-crop-bytes.js +1 -1
- package/dist/src/png-resize.js +1 -1
- package/dist/src/png-size.js +1 -1
- package/dist/src/png-worker-client.js +1 -1
- package/dist/src/png.js +1 -1
- package/dist/src/post-gesture-stability.js +1 -1
- package/dist/src/process-executable-path.js +1 -0
- package/dist/src/process-exit.js +1 -1
- package/dist/src/provider-device-runtime.d.ts +2 -2
- package/dist/src/provider-limrun-credentials.js +1 -1
- package/dist/src/provider-plugin.d.ts +1 -1
- package/dist/src/provider-profile-fields.js +1 -1
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/provider.js +1 -1
- package/dist/src/proxy.js +2 -2
- package/dist/src/react-devtools-connection.js +1 -1
- package/dist/src/react-devtools-inspect-command.js +1 -1
- package/dist/src/react-native-overlay2.js +2 -2
- package/dist/src/react-native.js +1 -1
- package/dist/src/react-profile-command.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording-gestures.js +1 -1
- package/dist/src/recording.js +1 -1
- package/dist/src/rect-center.js +1 -1
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +1 -1
- package/dist/src/remote-config-core.js +1 -1
- package/dist/src/remote-config-flags.js +1 -1
- package/dist/src/remote-connection-state.js +1 -1
- package/dist/src/replay-backend-host.js +1 -1
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay-maestro-backend.js +2 -2
- package/dist/src/replay.d.ts +1 -1
- package/dist/src/replay2.js +1 -1
- package/dist/src/reporting.js +1 -1
- package/dist/src/request-dispatch-disclosure.js +1 -1
- package/dist/src/request-ended-leases.js +1 -1
- package/dist/src/request-providers.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/request.js +1 -1
- package/dist/src/result-serialization.js +2 -2
- package/dist/src/retry.js +1 -1
- package/dist/src/run-script-execution.js +6 -8
- package/dist/src/run-script-http.js +1 -1
- package/dist/src/runner-cache-metadata.js +1 -1
- package/dist/src/runner-cache-retention.js +1 -1
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-contract.js +1 -1
- package/dist/src/runner-dev-tools-security.js +1 -1
- package/dist/src/runner-device-readiness.js +1 -1
- package/dist/src/runner-device-set.js +1 -1
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-error-classification.js +2 -2
- package/dist/src/runner-exchange.js +1 -1
- package/dist/src/runner-io.js +1 -1
- package/dist/src/runner-launched-session.js +1 -1
- package/dist/src/runner-lease.js +1 -1
- package/dist/src/runner-lifecycle.js +1 -1
- package/dist/src/runner-operations-facade.js +1 -1
- package/dist/src/runner-panel.js +1 -1
- package/dist/src/runner-retention.js +1 -1
- package/dist/src/runner-runtime.js +1 -1
- package/dist/src/runner-selector-query.js +1 -1
- package/dist/src/runner-sequence.js +1 -1
- package/dist/src/runner-start-budget.js +1 -1
- package/dist/src/runner-startup-transport.js +1 -1
- package/dist/src/runner-toolchain-identity.js +1 -1
- package/dist/src/runtime-admission.js +1 -1
- package/dist/src/runtime-deployment.js +1 -1
- package/dist/src/runtime-factory.js +1 -1
- package/dist/src/runtime-session.js +1 -1
- package/dist/src/runtime-transport-hints.js +1 -1
- package/dist/src/runtime.js +2 -2
- package/dist/src/runtime10.js +1 -1
- package/dist/src/runtime11.js +1 -1
- package/dist/src/runtime12.js +1 -1
- package/dist/src/runtime13.js +2 -2
- package/dist/src/runtime2.js +2 -2
- package/dist/src/runtime4.js +3 -3
- package/dist/src/runtime5.js +1 -1
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +2 -2
- package/dist/src/runtime8.js +1 -1
- package/dist/src/runtime9.js +1 -1
- package/dist/src/screen-recording-admission-ledger.js +1 -0
- package/dist/src/screen-recording-completion.js +1 -1
- package/dist/src/screen-recording-options.js +1 -1
- package/dist/src/screen-recording-resource-recovery.js +1 -1
- package/dist/src/screen-recording-stop-recovery.js +1 -1
- package/dist/src/screen-recording-transport.js +1 -1
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot-image-size.js +1 -1
- package/dist/src/screenshot-image.js +1 -1
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot-runtime2.js +1 -1
- package/dist/src/screenshot.js +1 -1
- package/dist/src/screenshot2.js +1 -1
- package/dist/src/screenshot4.js +1 -1
- package/dist/src/script-source.js +1 -1
- package/dist/src/script.js +1 -1
- package/dist/src/scroll-command.js +1 -1
- package/dist/src/scroll-gesture.js +1 -1
- package/dist/src/sdk-batch-runner.d.ts +1 -1
- package/dist/src/sdk-batch-runner.js +2 -2
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +26 -2
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-io.js +5 -5
- package/dist/src/sdk-remote-config.d.ts +1 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +9 -6
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-pipeline-policy.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server-shutdown.js +1 -1
- package/dist/src/server-startup.js +2 -2
- package/dist/src/server.js +4 -4
- package/dist/src/session-allocation.js +1 -1
- package/dist/src/session-artifact-paths.js +1 -1
- package/dist/src/session-capture-binding.js +1 -1
- package/dist/src/session-device-resolution.js +1 -1
- package/dist/src/session-event-action.js +1 -1
- package/dist/src/session-open.js +1 -1
- package/dist/src/session-repair-tombstone.js +1 -1
- package/dist/src/session-replay-vars.js +1 -1
- package/dist/src/session-routing.js +1 -1
- package/dist/src/session-runtime-admission.js +1 -1
- package/dist/src/session-runtime.js +1 -1
- package/dist/src/session-script-destination.js +1 -0
- package/dist/src/session-selector.js +1 -1
- package/dist/src/session-store.js +3 -3
- package/dist/src/session-teardown.js +1 -1
- package/dist/src/session-tenant-scope.js +1 -1
- package/dist/src/session2.js +5 -5
- package/dist/src/settings-bluetooth.js +1 -1
- package/dist/src/settings-global-toggle.js +1 -1
- package/dist/src/settings.js +1 -1
- package/dist/src/settings2.js +1 -1
- package/dist/src/settle-observation-capture.js +1 -1
- package/dist/src/simctl-execution.js +1 -1
- package/dist/src/simctl-facade.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-app-budget.js +1 -1
- package/dist/src/simulator-boot.js +1 -1
- package/dist/src/simulator-facade.js +1 -1
- package/dist/src/simulator-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-baseline.js +1 -1
- package/dist/src/snapshot-chrome.js +1 -1
- package/dist/src/snapshot-desktop-projection.js +1 -1
- package/dist/src/snapshot-diagnostics.js +1 -1
- package/dist/src/snapshot-helper-install.js +3 -3
- package/dist/src/snapshot-helper-session.js +1 -1
- package/dist/src/snapshot-lines.js +1 -1
- package/dist/src/snapshot-node-lookup.js +1 -1
- package/dist/src/snapshot-occlusion.js +1 -1
- package/dist/src/snapshot-private-evidence.js +1 -1
- package/dist/src/snapshot-runtime-binding.js +1 -1
- package/dist/src/snapshot-runtime-capture-input.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-state.js +1 -1
- package/dist/src/snapshot.js +1 -1
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/snapshot3.js +2 -2
- package/dist/src/snapshot4.js +1 -1
- package/dist/src/source-channel.js +1 -1
- package/dist/src/src.js +1 -1
- package/dist/src/src10.js +1 -1
- package/dist/src/src11.js +1 -1
- package/dist/src/src2.js +1 -1
- package/dist/src/src3.js +5 -5
- package/dist/src/src4.js +2 -2
- package/dist/src/src5.js +1 -1
- package/dist/src/src6.js +1 -1
- package/dist/src/src8.js +1 -1
- package/dist/src/store-legacy.js +1 -1
- package/dist/src/store.js +1 -1
- package/dist/src/string-enum.js +1 -1
- package/dist/src/surface-snapshot.js +1 -1
- package/dist/src/surface-snapshot2.js +1 -1
- package/dist/src/sync-cache.js +1 -1
- package/dist/src/system-surface-foreground.js +2 -2
- package/dist/src/takeover.js +1 -1
- package/dist/src/tap-keyboard-occlusion.js +1 -1
- package/dist/src/target-evidence-tree.js +1 -1
- package/dist/src/target-evidence.js +1 -1
- package/dist/src/telephony-runtime.js +1 -1
- package/dist/src/tool-provider-facade.js +1 -1
- package/dist/src/tool-provider.js +3 -3
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -1
- package/dist/src/toolchain-probe.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/touch-runtime2.js +1 -1
- package/dist/src/transport.js +2 -2
- package/dist/src/tree.js +1 -1
- package/dist/src/tv-remote-runtime.js +1 -1
- package/dist/src/tv-remote.js +1 -1
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/unsupported-interactor.js +1 -1
- package/dist/src/update-check.js +1 -1
- package/dist/src/validation.js +1 -1
- package/dist/src/vars.js +1 -1
- package/dist/src/vega-executable.js +1 -1
- package/dist/src/verified-file.js +1 -1
- package/dist/src/video.js +2 -2
- package/dist/src/viewport.js +1 -1
- package/dist/src/web.js +1 -1
- package/dist/src/webdriver-source.js +1 -1
- package/package.json +2 -2
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.37.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.37.apk.sha256 +0 -1
- package/dist/src/capture-output-ownership.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{t}from"./provider-session-ownership.js";import{_ as n,a as r,c as i,d as a,h as o,i as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./lease-registry-scope.js";import{a as h,i as g,n as _,r as v}from"./human-control-contract.js";import{a as y}from"./capture-output-ownership.js";var b=class{active=new Map;waiters=new Map;async run(e,t){this.active.set(e,(this.active.get(e)??0)+1);try{return await t()}finally{let t=(this.active.get(e)??1)-1;if(t>0)this.active.set(e,t);else{this.active.delete(e);let t=this.waiters.get(e);this.waiters.delete(e);for(let e of t??[])e()}}}async wait(e,t){if(t?.throwIfAborted(),!this.active.has(e))return;let n=this.waiters.get(e)??new Set,r=()=>{},i=()=>{};try{await new Promise((a,o)=>{r=a,i=()=>o(t?.reason),n.add(r),this.waiters.set(e,n),t?.addEventListener(`abort`,i,{once:!0})})}finally{t?.removeEventListener(`abort`,i),n.delete(r),n.size===0&&this.waiters.get(e)===n&&this.waiters.delete(e)}}},x=class{entriesByLeaseId=new Map;retain(e,t){let n={wanted:t,released:!1},r=this.entriesByLeaseId.get(e)??new Set;return r.add(n),this.entriesByLeaseId.set(e,r),{leaseId:e,release:()=>this.releasePass(e,r,n)}}forget(e){let t=this.entriesByLeaseId.get(e);if(t){for(let e of t)e.released=!0;this.entriesByLeaseId.delete(e)}}isDeferred(e){let t=this.entriesByLeaseId.get(e);if(!t)return!1;for(let e of t)e.wanted()||t.delete(e);return t.size>0||(this.entriesByLeaseId.delete(e),!1)}releasePass(e,t,n){return!n.released&&(n.released=!0,t.delete(n),t.size===0&&this.entriesByLeaseId.get(e)===t&&this.entriesByLeaseId.delete(e),n.wanted())}},S=class{holdsByDevice=new Map;mutations=new b;inFlightWork=new x;leases=new Map;issuedLeaseIds=new Set;runBindings=new Map;deviceBindings=new Map;hostTtlMsByLeaseId=new Map;macOsAppTenantIds=new Set;maxActiveSimulatorLeases;resolveLeaseTtlMs;now;onLeaseExpired;onProviderLeasesChanged;providerSessionOwnership;constructor(e={}){this.maxActiveSimulatorLeases=Number.isInteger(e.maxActiveSimulatorLeases)?Math.max(0,Number(e.maxActiveSimulatorLeases)):0,this.resolveLeaseTtlMs=s(e),this.now=e.now??(()=>Date.now()),this.onLeaseExpired=e.onLeaseExpired,this.onProviderLeasesChanged=e.onProviderLeasesChanged,this.providerSessionOwnership=new t({now:this.now,retentionMs:e.providerSessionRetentionMs})}allocateLease(t){let{chosenLeaseId:n,normalized:r,leaseTtlMs:i}=this.prepareAllocation(t),a=this.refreshRequestedLease(n,r,i);if(a)return a;if(n&&this.issuedLeaseIds.has(n))throw new e(`INVALID_ARGS`,`Lease id already names a lease this daemon issued.`,{reason:`LEASE_ID_IN_USE`});this.assertHumanControlAdmission(r);let o=this.refreshExistingRunBinding(r,i);if(o)return o;this.assertDeviceAvailable(r),this.enforceCapacity(r.backend);let s=d(r,i,this.now(),n);return this.issueLease(s),{...s}}putHostLease(t,r){let i=n(t),o=a(r);this.cleanupExpiredLeases();let s=this.resolveLeaseTtlMs(o.ttlMs),c=this.leases.get(i);if(c){if(!l(c,o))throw new e(`INVALID_ARGS`,`Lease id already names a lease with another scope.`,{reason:`LEASE_SCOPE_MISMATCH`});return this.hostTtlMsByLeaseId.set(i,s),this.refreshLease(c,s)}if(this.assertHumanControlAdmission(o),this.assertDeviceAvailable(o),o.backend===`macos-app`&&this.macOsAppTenantIds.add(o.tenantId),this.runBindings.has(m(o)))throw new e(`DEVICE_IN_USE`,`This tenant run already holds a lease for the device.`,{reason:`DEVICE_LEASE_BUSY`});this.enforceCapacity(o.backend);let u=d(o,s,this.now(),i);return this.issueLease(u),this.hostTtlMsByLeaseId.set(i,s),{...u}}renewRequestedLease(e){let{chosenLeaseId:t,normalized:n,leaseTtlMs:r}=this.prepareAllocation(e);return this.refreshRequestedLease(t,n,r)}prepareAllocation(e){let t=e.leaseId===void 0?void 0:n(e.leaseId),r=a(e);return this.cleanupExpiredLeases(),{chosenLeaseId:t,normalized:r,leaseTtlMs:this.resolveLeaseTtlMs(r.ttlMs)}}refreshRequestedLease(e,t,n){let r=e===void 0?void 0:this.leases.get(e);if(!r)return;let a={...t,deviceKey:t.deviceKey??r.deviceKey};if(l(r,a))return this.assertHumanControlAdmission(r),this.refreshLease(t.retainOnClose?{...r,retainOnClose:!0}:r,t.ttlMs===void 0?i(r):n)}issueLease(e){this.issuedLeaseIds.add(e.leaseId),this.leases.set(e.leaseId,e),this.bindLease(e),this.reportProviderLeases(e)}reportProviderLeases(e){!e.leaseProvider||!this.onProviderLeasesChanged||this.onProviderLeasesChanged([...this.leases.values()].filter(e=>e.leaseProvider).map(e=>({...e})))}refreshExistingRunBinding(e,t){let n=m(e),i=this.runBindings.get(n);if(!i)return;let a=this.leases.get(i);if(!a){this.runBindings.delete(n);return}if(a.clientId===e.clientId)return this.refreshLease(e.retainOnClose?{...a,retainOnClose:!0}:a,t);if(a.deviceKey)throw r(a);return c(a,e),this.refreshLease(a,t)}heartbeatLease(e){let t=n(e.leaseId);this.cleanupExpiredLeases();let r=this.getActiveLease(t);p(r,e),c(r,e);let a=e.ttlMs===void 0?i(r):this.resolveLeaseTtlMs(e.ttlMs);return this.refreshLease(r,a)}retainLeaseWork(e,t){let n=this.inFlightWork.retain(e.leaseId,t);return{leaseId:n.leaseId,release:()=>{let t=n.release();return t&&this.refreshProtectedLease(e.leaseId,this.now()),t}}}releaseLease(e){let t=this.getLease(e);return t?(this.leases.delete(t.leaseId),this.unbindLease(t),this.inFlightWork.forget(t.leaseId),this.reportProviderLeases(t),{released:!0,lease:t}):{released:!1}}endProviderLease(e){let t=this.getLease(e);t&&(this.leases.delete(t.leaseId),this.unbindLease(t),this.inFlightWork.forget(t.leaseId),this.onLeaseExpired?.(t,`PROVIDER_INSTANCE_ENDED`),this.reportProviderLeases(t))}getLease(e){let t=n(e.leaseId);this.cleanupExpiredLeases();let r=this.leases.get(t);if(r)return p(r,e),c(r,e),{...r}}inspectLeaseForClose(e){let t=n(e.leaseId),r=this.leases.get(t);if(!(!r||this.wouldConsumeExpiredLease(r,this.now())))return p(r,e),c(r,e),{...r}}assertLeaseAdmission(e){let t=u(e);this.cleanupExpiredLeases(),c(this.getActiveLease(t.leaseId),t)}hasHeldMacOsAppLease(e){return this.macOsAppTenantIds.has(e)}inspectLeaseBackend(e){let t=o(e),n=t?this.leases.get(t):void 0;return n&&!this.wouldConsumeExpiredLease(n,this.now())?n.backend:void 0}hasRetainedLeases(){let e=this.now();return this.listActiveLeases().some(t=>t.retainOnClose===!0&&t.expiresAt>e)}listActiveLeases(){return this.cleanupExpiredLeases(),Array.from(this.leases.values()).map(e=>({...e}))}recordProviderSession(e,t){this.cleanupExpiredLeases();let n=e.expiresAt<=this.now()?e.expiresAt:void 0;this.providerSessionOwnership.record(e,t),this.leases.has(e.leaseId)||this.providerSessionOwnership.markLeaseReleased(e,n)}resolveProviderSession(e){return this.cleanupExpiredLeases(),this.providerSessionOwnership.resolve(e)}listHumanControlHolds(e){this.cleanupExpiredLeases();let t=e.kind===`lease`?f(this.requireHumanControlLease(e.leaseId)):void 0;return[...this.holdsByDevice.entries()].filter(([e])=>t===void 0||t===e).flatMap(([,e])=>[...e.values()].map(({hold:e})=>_(e))).sort((e,t)=>e.id.localeCompare(t.id))}async putHumanControlHold(t,n,r,i){i?.throwIfAborted();let a=g(n),o=h(r);this.cleanupExpiredLeases();let s=this.resolveHumanControlScope(t,o),c=f(s),l=this.findHumanControlHold(a);if(l&&(this.assertHoldAuthority(t,l),f(l.hold.scope)!==c))throw new e(`INVALID_ARGS`,`Release a hold before changing its device scope.`);let u=this.now(),d={...t.kind===`lease`?{ownerLeaseId:t.leaseId}:{},hold:{id:a,scope:s,state:`activating`,...o.reason?{reason:o.reason}:{},createdAt:l?.hold.createdAt??u,updatedAt:u}},p=this.holdsByDevice.get(c)??new Map,m=l?.hold.state===`active`?l:d;return this.holdsByDevice.set(c,p),p.set(a,m),await this.activateHumanControlHold(c,d,m,o.ttlMs,i)}async activateHumanControlHold(t,n,r,i,a){let o=this.holdsByDevice.get(t),{id:s}=n.hold;try{if(await this.mutations.wait(t,a),a?.throwIfAborted(),o.get(s)!==r)throw new e(`COMMAND_FAILED`,`Human-control hold changed before activation completed.`,{holdId:s});let c=this.now();return n.hold={...n.hold,state:`active`,updatedAt:c,...i===void 0?{}:{expiresAt:c+i}},o.set(s,n),this.refreshHeldLease(t,c),_(n.hold)}catch(e){throw o.get(s)===n&&this.deleteHumanControlHold(t,s),e}}removeHumanControlHold(e,t){let n=g(t);this.cleanupExpiredLeases();let r=this.findHumanControlHold(n);if(!r)return;this.assertHoldAuthority(e,r);let i=f(r.hold.scope);return this.deleteHumanControlHold(i,n),_(r.hold)}deleteHumanControlHold(e,t){let n=this.holdsByDevice.get(e);n.delete(t),n.size===0&&(this.holdsByDevice.delete(e),this.refreshHeldLease(e,this.now()))}assertHumanControlAdmission(e){this.expireHumanControlHolds();let t=f(e),n=t===void 0?void 0:this.holdsByDevice.get(t)?.values().next().value;if(n)throw v(n.hold)}async runDeviceMutation(e,t){if(!e)return await t();this.cleanupExpiredLeases();let n=this.getActiveLease(e.leaseId);this.assertHumanControlAdmission(n);let r=f(n);return r===void 0?await t():await this.mutations.run(r,t)}requireHumanControlLease(t){let n=this.getActiveLease(t);if(!n.deviceKey)throw new e(`UNSUPPORTED_OPERATION`,`Human control requires a device-scoped remote lease.`);return{...n,deviceKey:n.deviceKey}}resolveHumanControlScope(t,n){if(t.kind===`host`){if(!n.scope)throw new e(`INVALID_ARGS`,`Host human control requires a lease device scope.`);return n.scope}if(n.scope)throw new e(`INVALID_ARGS`,`Lease-owner human control uses the admitted lease device; do not supply scope.`);let r=this.requireHumanControlLease(t.leaseId);return{backend:r.backend,leaseProvider:r.leaseProvider,deviceKey:r.deviceKey}}assertHoldAuthority(t,n){if(t.kind===`host`)return;let r=this.requireHumanControlLease(t.leaseId);if(n.ownerLeaseId!==r.leaseId||f(r)!==f(n.hold.scope))throw new e(`UNAUTHORIZED`,`Human-control hold does not belong to the admitted lease.`,{reason:`LEASE_SCOPE_MISMATCH`})}findHumanControlHold(e){for(let t of this.holdsByDevice.values()){let n=t.get(e);if(n)return n}}isLeaseProtected(e,t){return!this.wouldConsumeExpiredLease(e,t)}wouldConsumeExpiredLease(e,t){if(e.expiresAt>t||this.inFlightWork.isDeferred(e.leaseId))return!1;let n=f(e),r=n?this.holdsByDevice.get(n):void 0,a=0;for(let{hold:e}of r?.values()??[]){if(e.expiresAt===void 0||e.expiresAt>t)return!1;a=Math.max(a,e.expiresAt)}if(a===0)return!0;let o=this.hostTtlMsByLeaseId.get(e.leaseId),s=i(e);return Math.max(a,e.heartbeatAt)+(o===void 0?s:Math.min(s,o))<=t}expireHumanControlHolds(e=this.now()){for(let[t,n]of this.holdsByDevice){let r=0;for(let[t,{hold:i}]of n)i.expiresAt===void 0||i.expiresAt>e||(r=Math.max(r,i.expiresAt),n.delete(t));n.size===0&&(this.holdsByDevice.delete(t),this.refreshHeldLease(t,r))}}refreshHeldLease(e,t){this.refreshProtectedLease(this.deviceBindings.get(e),t)}refreshProtectedLease(e,t){let n=e?this.leases.get(e):void 0;n&&this.refreshLease(n,i(n),Math.max(t,n.heartbeatAt))}consumeExpiredLeases(){this.expireHumanControlHolds();let e=this.now(),t=[];for(let n of this.leases.values()){if(this.isLeaseProtected(n,e))continue;this.leases.delete(n.leaseId),this.unbindLease(n,n.expiresAt);let r={...n};t.push(r),this.onLeaseExpired?.(r),this.reportProviderLeases(r)}return t}consumeExpiredLease(e,t){let n=o(e),r=n?this.leases.get(n):void 0,i=this.now();if(r&&t&&this.wouldConsumeExpiredLease(r,i)&&t(),this.expireHumanControlHolds(i),!n)return;let a=this.leases.get(n);if(!a||this.isLeaseProtected(a,i))return;this.leases.delete(a.leaseId),this.unbindLease(a,a.expiresAt);let s={...a};return this.onLeaseExpired?.(s),this.reportProviderLeases(s),s}cleanupExpiredLeases(){this.consumeExpiredLeases()}enforceCapacity(t){if(t!==`ios-simulator`||this.maxActiveSimulatorLeases<=0)return;let n=Array.from(this.leases.values()).filter(e=>e.backend===`ios-simulator`).length;if(!(n<this.maxActiveSimulatorLeases))throw new e(`DEVICE_IN_USE`,`No simulator lease capacity available`,{reason:`LEASE_CAPACITY_EXCEEDED`,activeLeases:n,maxActiveLeases:this.maxActiveSimulatorLeases,backend:t,hint:`Retry after releasing another simulator lease.`})}getActiveLease(t){let n=this.leases.get(t);if(n)return n;throw new e(`UNAUTHORIZED`,`Lease is not active`,{reason:`LEASE_NOT_FOUND`})}refreshLease(e,t,n=this.now()){let r=this.hostTtlMsByLeaseId.get(e.leaseId),i={...e,heartbeatAt:n,expiresAt:n+(r===void 0?t:Math.min(t,r))};return this.leases.set(i.leaseId,i),this.bindLease(i),{...i}}bindLease(e){this.runBindings.set(m(e),e.leaseId);let t=f(e);t&&this.deviceBindings.set(t,e.leaseId)}unbindLease(e,t=this.now()){this.hostTtlMsByLeaseId.delete(e.leaseId),this.runBindings.delete(m(e));let n=f(e);n&&this.deviceBindings.delete(n),this.providerSessionOwnership.markLeaseReleased(e,t)}assertDeviceAvailable(e){let t=f({backend:e.backend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey});if(!t)return;let n=this.deviceBindings.get(t);if(!n)return;let i=this.leases.get(n);if(!i){this.deviceBindings.delete(t);return}throw r(i)}};function C(){return y({displayName:`audio probe`})}function w(){return y({displayName:`perf capture`})}function T(e,t){e.internal?.endedLeases?.push({leaseId:t,outcome:`released`})}async function E(e,t){if(e.internal?.endedLeases)return await t(e);let n=[],r=await t({...e,internal:{...e.internal,endedLeases:n}});return n.length===0?r:r.ok?{ok:!0,data:{...r.data,endedLeases:n}}:{ok:!1,error:{...r.error,details:{...r.error.details,endedLeases:n}}}}function D(e,t){let n=t.internal?.endedLeases;return n?{...e,internal:{...e.internal,endedLeases:n}}:e}function O(e,t){return async n=>await e(D(n,t))}export{w as a,E as i,D as n,C as o,T as r,S as s,O as t};
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{t}from"./provider-session-ownership.js";import{_ as n,a as r,c as i,d as a,h as o,i as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./lease-registry-scope.js";import{a as h,i as g,n as _,r as v}from"./human-control-contract.js";import{n as y}from"./screen-recording-admission-ledger.js";var b=class{active=new Map;waiters=new Map;async run(e,t){this.active.set(e,(this.active.get(e)??0)+1);try{return await t()}finally{let t=(this.active.get(e)??1)-1;if(t>0)this.active.set(e,t);else{this.active.delete(e);let t=this.waiters.get(e);this.waiters.delete(e);for(let e of t??[])e()}}}async wait(e,t){if(t?.throwIfAborted(),!this.active.has(e))return;let n=this.waiters.get(e)??new Set,r=()=>{},i=()=>{};try{await new Promise((a,o)=>{r=a,i=()=>o(t?.reason),n.add(r),this.waiters.set(e,n),t?.addEventListener(`abort`,i,{once:!0})})}finally{t?.removeEventListener(`abort`,i),n.delete(r),n.size===0&&this.waiters.get(e)===n&&this.waiters.delete(e)}}},x=class{entriesByLeaseId=new Map;retain(e,t){let n={wanted:t,released:!1},r=this.entriesByLeaseId.get(e)??new Set;return r.add(n),this.entriesByLeaseId.set(e,r),{leaseId:e,release:()=>this.releasePass(e,r,n)}}forget(e){let t=this.entriesByLeaseId.get(e);if(t){for(let e of t)e.released=!0;this.entriesByLeaseId.delete(e)}}isDeferred(e){let t=this.entriesByLeaseId.get(e);if(!t)return!1;for(let e of t)e.wanted()||t.delete(e);return t.size>0||(this.entriesByLeaseId.delete(e),!1)}releasePass(e,t,n){return!n.released&&(n.released=!0,t.delete(n),t.size===0&&this.entriesByLeaseId.get(e)===t&&this.entriesByLeaseId.delete(e),n.wanted())}},S=class{holdsByDevice=new Map;mutations=new b;inFlightWork=new x;leases=new Map;issuedLeaseIds=new Set;runBindings=new Map;deviceBindings=new Map;hostTtlMsByLeaseId=new Map;macOsAppTenantIds=new Set;maxActiveSimulatorLeases;resolveLeaseTtlMs;now;onLeaseExpired;onProviderLeasesChanged;providerSessionOwnership;constructor(e={}){this.maxActiveSimulatorLeases=Number.isInteger(e.maxActiveSimulatorLeases)?Math.max(0,Number(e.maxActiveSimulatorLeases)):0,this.resolveLeaseTtlMs=s(e),this.now=e.now??(()=>Date.now()),this.onLeaseExpired=e.onLeaseExpired,this.onProviderLeasesChanged=e.onProviderLeasesChanged,this.providerSessionOwnership=new t({now:this.now,retentionMs:e.providerSessionRetentionMs})}allocateLease(t){let{chosenLeaseId:n,normalized:r,leaseTtlMs:i}=this.prepareAllocation(t),a=this.refreshRequestedLease(n,r,i);if(a)return a;if(n&&this.issuedLeaseIds.has(n))throw new e(`INVALID_ARGS`,`Lease id already names a lease this daemon issued.`,{reason:`LEASE_ID_IN_USE`});this.assertHumanControlAdmission(r);let o=this.refreshExistingRunBinding(r,i);if(o)return o;this.assertDeviceAvailable(r),this.enforceCapacity(r.backend);let s=d(r,i,this.now(),n);return this.issueLease(s),{...s}}putHostLease(t,r){let i=n(t),o=a(r);this.cleanupExpiredLeases();let s=this.resolveLeaseTtlMs(o.ttlMs),c=this.leases.get(i);if(c){if(!l(c,o))throw new e(`INVALID_ARGS`,`Lease id already names a lease with another scope.`,{reason:`LEASE_SCOPE_MISMATCH`});return this.hostTtlMsByLeaseId.set(i,s),this.refreshLease(c,s)}if(this.assertHumanControlAdmission(o),this.assertDeviceAvailable(o),o.backend===`macos-app`&&this.macOsAppTenantIds.add(o.tenantId),this.runBindings.has(m(o)))throw new e(`DEVICE_IN_USE`,`This tenant run already holds a lease for the device.`,{reason:`DEVICE_LEASE_BUSY`});this.enforceCapacity(o.backend);let u=d(o,s,this.now(),i);return this.issueLease(u),this.hostTtlMsByLeaseId.set(i,s),{...u}}renewRequestedLease(e){let{chosenLeaseId:t,normalized:n,leaseTtlMs:r}=this.prepareAllocation(e);return this.refreshRequestedLease(t,n,r)}prepareAllocation(e){let t=e.leaseId===void 0?void 0:n(e.leaseId),r=a(e);return this.cleanupExpiredLeases(),{chosenLeaseId:t,normalized:r,leaseTtlMs:this.resolveLeaseTtlMs(r.ttlMs)}}refreshRequestedLease(e,t,n){let r=e===void 0?void 0:this.leases.get(e);if(!r)return;let a={...t,deviceKey:t.deviceKey??r.deviceKey};if(l(r,a))return this.assertHumanControlAdmission(r),this.refreshLease(t.retainOnClose?{...r,retainOnClose:!0}:r,t.ttlMs===void 0?i(r):n)}issueLease(e){this.issuedLeaseIds.add(e.leaseId),this.leases.set(e.leaseId,e),this.bindLease(e),this.reportProviderLeases(e)}reportProviderLeases(e){!e.leaseProvider||!this.onProviderLeasesChanged||this.onProviderLeasesChanged([...this.leases.values()].filter(e=>e.leaseProvider).map(e=>({...e})))}refreshExistingRunBinding(e,t){let n=m(e),i=this.runBindings.get(n);if(!i)return;let a=this.leases.get(i);if(!a){this.runBindings.delete(n);return}if(a.clientId===e.clientId)return this.refreshLease(e.retainOnClose?{...a,retainOnClose:!0}:a,t);if(a.deviceKey)throw r(a);return c(a,e),this.refreshLease(a,t)}heartbeatLease(e){let t=n(e.leaseId);this.cleanupExpiredLeases();let r=this.getActiveLease(t);p(r,e),c(r,e);let a=e.ttlMs===void 0?i(r):this.resolveLeaseTtlMs(e.ttlMs);return this.refreshLease(r,a)}retainLeaseWork(e,t){let n=this.inFlightWork.retain(e.leaseId,t);return{leaseId:n.leaseId,release:()=>{let t=n.release();return t&&this.refreshProtectedLease(e.leaseId,this.now()),t}}}releaseLease(e){let t=this.getLease(e);return t?(this.leases.delete(t.leaseId),this.unbindLease(t),this.inFlightWork.forget(t.leaseId),this.reportProviderLeases(t),{released:!0,lease:t}):{released:!1}}endProviderLease(e){let t=this.getLease(e);t&&(this.leases.delete(t.leaseId),this.unbindLease(t),this.inFlightWork.forget(t.leaseId),this.onLeaseExpired?.(t,`PROVIDER_INSTANCE_ENDED`),this.reportProviderLeases(t))}getLease(e){let t=n(e.leaseId);this.cleanupExpiredLeases();let r=this.leases.get(t);if(r)return p(r,e),c(r,e),{...r}}inspectLeaseForClose(e){let t=n(e.leaseId),r=this.leases.get(t);if(!(!r||this.wouldConsumeExpiredLease(r,this.now())))return p(r,e),c(r,e),{...r}}assertLeaseAdmission(e){let t=u(e);this.cleanupExpiredLeases(),c(this.getActiveLease(t.leaseId),t)}hasHeldMacOsAppLease(e){return this.macOsAppTenantIds.has(e)}inspectLeaseBackend(e){let t=o(e),n=t?this.leases.get(t):void 0;return n&&!this.wouldConsumeExpiredLease(n,this.now())?n.backend:void 0}hasRetainedLeases(){let e=this.now();return this.listActiveLeases().some(t=>t.retainOnClose===!0&&t.expiresAt>e)}listActiveLeases(){return this.cleanupExpiredLeases(),Array.from(this.leases.values()).map(e=>({...e}))}recordProviderSession(e,t){this.cleanupExpiredLeases();let n=e.expiresAt<=this.now()?e.expiresAt:void 0;this.providerSessionOwnership.record(e,t),this.leases.has(e.leaseId)||this.providerSessionOwnership.markLeaseReleased(e,n)}resolveProviderSession(e){return this.cleanupExpiredLeases(),this.providerSessionOwnership.resolve(e)}listHumanControlHolds(e){this.cleanupExpiredLeases();let t=e.kind===`lease`?f(this.requireHumanControlLease(e.leaseId)):void 0;return[...this.holdsByDevice.entries()].filter(([e])=>t===void 0||t===e).flatMap(([,e])=>[...e.values()].map(({hold:e})=>_(e))).sort((e,t)=>e.id.localeCompare(t.id))}async putHumanControlHold(t,n,r,i){i?.throwIfAborted();let a=g(n),o=h(r);this.cleanupExpiredLeases();let s=this.resolveHumanControlScope(t,o),c=f(s),l=this.findHumanControlHold(a);if(l&&(this.assertHoldAuthority(t,l),f(l.hold.scope)!==c))throw new e(`INVALID_ARGS`,`Release a hold before changing its device scope.`);let u=this.now(),d={...t.kind===`lease`?{ownerLeaseId:t.leaseId}:{},hold:{id:a,scope:s,state:`activating`,...o.reason?{reason:o.reason}:{},createdAt:l?.hold.createdAt??u,updatedAt:u}},p=this.holdsByDevice.get(c)??new Map,m=l?.hold.state===`active`?l:d;return this.holdsByDevice.set(c,p),p.set(a,m),await this.activateHumanControlHold(c,d,m,o.ttlMs,i)}async activateHumanControlHold(t,n,r,i,a){let o=this.holdsByDevice.get(t),{id:s}=n.hold;try{if(await this.mutations.wait(t,a),a?.throwIfAborted(),o.get(s)!==r)throw new e(`COMMAND_FAILED`,`Human-control hold changed before activation completed.`,{holdId:s});let c=this.now();return n.hold={...n.hold,state:`active`,updatedAt:c,...i===void 0?{}:{expiresAt:c+i}},o.set(s,n),this.refreshHeldLease(t,c),_(n.hold)}catch(e){throw o.get(s)===n&&this.deleteHumanControlHold(t,s),e}}removeHumanControlHold(e,t){let n=g(t);this.cleanupExpiredLeases();let r=this.findHumanControlHold(n);if(!r)return;this.assertHoldAuthority(e,r);let i=f(r.hold.scope);return this.deleteHumanControlHold(i,n),_(r.hold)}deleteHumanControlHold(e,t){let n=this.holdsByDevice.get(e);n.delete(t),n.size===0&&(this.holdsByDevice.delete(e),this.refreshHeldLease(e,this.now()))}assertHumanControlAdmission(e){this.expireHumanControlHolds();let t=f(e),n=t===void 0?void 0:this.holdsByDevice.get(t)?.values().next().value;if(n)throw v(n.hold)}async runDeviceMutation(e,t){if(!e)return await t();this.cleanupExpiredLeases();let n=this.getActiveLease(e.leaseId);this.assertHumanControlAdmission(n);let r=f(n);return r===void 0?await t():await this.mutations.run(r,t)}requireHumanControlLease(t){let n=this.getActiveLease(t);if(!n.deviceKey)throw new e(`UNSUPPORTED_OPERATION`,`Human control requires a device-scoped remote lease.`);return{...n,deviceKey:n.deviceKey}}resolveHumanControlScope(t,n){if(t.kind===`host`){if(!n.scope)throw new e(`INVALID_ARGS`,`Host human control requires a lease device scope.`);return n.scope}if(n.scope)throw new e(`INVALID_ARGS`,`Lease-owner human control uses the admitted lease device; do not supply scope.`);let r=this.requireHumanControlLease(t.leaseId);return{backend:r.backend,leaseProvider:r.leaseProvider,deviceKey:r.deviceKey}}assertHoldAuthority(t,n){if(t.kind===`host`)return;let r=this.requireHumanControlLease(t.leaseId);if(n.ownerLeaseId!==r.leaseId||f(r)!==f(n.hold.scope))throw new e(`UNAUTHORIZED`,`Human-control hold does not belong to the admitted lease.`,{reason:`LEASE_SCOPE_MISMATCH`})}findHumanControlHold(e){for(let t of this.holdsByDevice.values()){let n=t.get(e);if(n)return n}}isLeaseProtected(e,t){return!this.wouldConsumeExpiredLease(e,t)}wouldConsumeExpiredLease(e,t){if(e.expiresAt>t||this.inFlightWork.isDeferred(e.leaseId))return!1;let n=f(e),r=n?this.holdsByDevice.get(n):void 0,a=0;for(let{hold:e}of r?.values()??[]){if(e.expiresAt===void 0||e.expiresAt>t)return!1;a=Math.max(a,e.expiresAt)}if(a===0)return!0;let o=this.hostTtlMsByLeaseId.get(e.leaseId),s=i(e);return Math.max(a,e.heartbeatAt)+(o===void 0?s:Math.min(s,o))<=t}expireHumanControlHolds(e=this.now()){for(let[t,n]of this.holdsByDevice){let r=0;for(let[t,{hold:i}]of n)i.expiresAt===void 0||i.expiresAt>e||(r=Math.max(r,i.expiresAt),n.delete(t));n.size===0&&(this.holdsByDevice.delete(t),this.refreshHeldLease(t,r))}}refreshHeldLease(e,t){this.refreshProtectedLease(this.deviceBindings.get(e),t)}refreshProtectedLease(e,t){let n=e?this.leases.get(e):void 0;n&&this.refreshLease(n,i(n),Math.max(t,n.heartbeatAt))}consumeExpiredLeases(){this.expireHumanControlHolds();let e=this.now(),t=[];for(let n of this.leases.values()){if(this.isLeaseProtected(n,e))continue;this.leases.delete(n.leaseId),this.unbindLease(n,n.expiresAt);let r={...n};t.push(r),this.onLeaseExpired?.(r),this.reportProviderLeases(r)}return t}consumeExpiredLease(e,t){let n=o(e),r=n?this.leases.get(n):void 0,i=this.now();if(r&&t&&this.wouldConsumeExpiredLease(r,i)&&t(),this.expireHumanControlHolds(i),!n)return;let a=this.leases.get(n);if(!a||this.isLeaseProtected(a,i))return;this.leases.delete(a.leaseId),this.unbindLease(a,a.expiresAt);let s={...a};return this.onLeaseExpired?.(s),this.reportProviderLeases(s),s}cleanupExpiredLeases(){this.consumeExpiredLeases()}enforceCapacity(t){if(t!==`ios-simulator`||this.maxActiveSimulatorLeases<=0)return;let n=Array.from(this.leases.values()).filter(e=>e.backend===`ios-simulator`).length;if(!(n<this.maxActiveSimulatorLeases))throw new e(`DEVICE_IN_USE`,`No simulator lease capacity available`,{reason:`LEASE_CAPACITY_EXCEEDED`,activeLeases:n,maxActiveLeases:this.maxActiveSimulatorLeases,backend:t,hint:`Retry after releasing another simulator lease.`})}getActiveLease(t){let n=this.leases.get(t);if(n)return n;throw new e(`UNAUTHORIZED`,`Lease is not active`,{reason:`LEASE_NOT_FOUND`})}refreshLease(e,t,n=this.now()){let r=this.hostTtlMsByLeaseId.get(e.leaseId),i={...e,heartbeatAt:n,expiresAt:n+(r===void 0?t:Math.min(t,r))};return this.leases.set(i.leaseId,i),this.bindLease(i),{...i}}bindLease(e){this.runBindings.set(m(e),e.leaseId);let t=f(e);t&&this.deviceBindings.set(t,e.leaseId)}unbindLease(e,t=this.now()){this.hostTtlMsByLeaseId.delete(e.leaseId),this.runBindings.delete(m(e));let n=f(e);n&&this.deviceBindings.delete(n),this.providerSessionOwnership.markLeaseReleased(e,t)}assertDeviceAvailable(e){let t=f({backend:e.backend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey});if(!t)return;let n=this.deviceBindings.get(t);if(!n)return;let i=this.leases.get(n);if(!i){this.deviceBindings.delete(t);return}throw r(i)}};function C(){return y({displayName:`audio probe`})}function w(){return y({displayName:`perf capture`})}function T(e,t){e.internal?.endedLeases?.push({leaseId:t,outcome:`released`})}async function E(e,t){if(e.internal?.endedLeases)return await t(e);let n=[],r=await t({...e,internal:{...e.internal,endedLeases:n}});return n.length===0?r:r.ok?{ok:!0,data:{...r.data,endedLeases:n}}:{ok:!1,error:{...r.error,details:{...r.error.details,endedLeases:n}}}}function D(e,t){let n=t.internal?.endedLeases;return n?{...e,internal:{...e.internal,endedLeases:n}}:e}function O(e,t){return async n=>await e(D(n,t))}export{w as a,E as i,D as n,C as o,T as r,S as s,O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./sdk-io.js";import{
|
|
1
|
+
import"./sdk-io.js";import{G as e}from"./sdk-device.js";import{t}from"./platform-runtime-android-mechanics.js";import{r as n,t as r}from"./register-builtins.js";function i(e={}){let t=e.providers??{},n=c(t);return Object.freeze({hasConfiguredResolvers:n,run:async(n,r)=>{let i=s(await a(t,e.defaultWebProvider,n),n),o={androidAdbExecutor:i.androidAdb?.executor};return await f(await u(i),async()=>await r(o))}})}async function a(t,n,r){let i=e(r.device.id);if(t.webProvider||!r.useDefaultWebProvider||!n||i===void 0)return t;let{createAgentBrowserWebProvider:a}=await import(`./src14.js`).then(e=>e.i),o=await a({host:n.host,session:i,stateDir:n.stateDir,openWebSessionNames:n.openWebSessionNames,ownedProcessRecords:n.ownedProcessRecords});return{...t,webProvider:()=>o}}const o=[{resolverKey:`androidAdbProvider`,resolve(e,t){let n=e.androidAdbProvider;if(!n||!l(`androidAdbProvider`,t.device))return{};let r=n(t);return{androidAdb:{provider:r,executor:typeof r==`function`?r:r?.exec,serial:t.device.id}}},async appendWrapper(e,n){if(!e.androidAdb?.provider)return;let{withAndroidAdbProvider:r}=await t();d(n,e.androidAdb,(t,n)=>r(t,{serial:e.androidAdb?.serial??``},n))}},{resolverKey:`appleRunnerProvider`,resolve(e,t){let n=e.appleRunnerProvider;return!n||!l(`appleRunnerProvider`,t.device)?{}:{appleRunner:{provider:n(t),deviceId:t.device.id,requestId:t.requestId}}},async appendWrapper(e,t){if(!e.appleRunner?.provider)return;let{withAppleRunnerProvider:n}=await import(`./src8.js`).then(e=>e.u),r=e.appleRunner;t.push(async e=>await n(r.provider,{deviceId:r.deviceId??``,requestId:r.requestId},e))}},{resolverKey:`appleToolProvider`,resolve(e,t){let n=e.appleToolProvider;return!n||!l(`appleToolProvider`,t.device)?{}:{appleTool:{provider:n(t)}}},async appendWrapper(e,t){if(!e.appleTool?.provider)return;let{withAppleToolProvider:n}=await import(`./tool-provider-facade.js`).then(e=>e.t);d(t,e.appleTool,n)}},{resolverKey:`vegaToolProvider`,resolve(e,t){let n=e.vegaToolProvider;return!n||!l(`vegaToolProvider`,t.device)?{}:{vegaTool:{provider:n(t)}}},async appendWrapper(e,t){if(!e.vegaTool?.provider)return;let{withVegaToolProvider:n}=await import(`./src13.js`).then(e=>e.r);d(t,e.vegaTool,n)}},{resolverKey:`linuxToolProvider`,resolve(e,t){let n=e.linuxToolProvider;return!n||!l(`linuxToolProvider`,t.device)?{}:{linuxTool:{provider:n(t)}}},async appendWrapper(e,t){if(!e.linuxTool?.provider)return;let{withLinuxToolProvider:n}=await import(`./src12.js`).then(e=>e.y);d(t,e.linuxTool,n)}},{resolverKey:`webProvider`,resolve(e,t){let n=e.webProvider;return!n||!l(`webProvider`,t.device)?{}:{web:{provider:n(t)}}},async appendWrapper(e,t){if(!e.web?.provider)return;let{withWebProvider:n}=await import(`./src14.js`).then(e=>e.i);d(t,e.web,n)}},{resolverKey:`appleRunnerScreenRecordingTransport`,resolve(e,t){let n=e.appleRunnerScreenRecordingTransport;return n?{appleRunnerScreenRecording:{provider:n(t)}}:{}},async appendWrapper(e,t){let n=e.appleRunnerScreenRecording?.provider;if(!n&&!e.appleRunner?.provider)return;let{withAppleRunnerScreenRecordingTransport:r}=await import(`./platform-runtime-screen-recording-apple-runner-transport.js`);t.push(async e=>await r(n,e))}},{resolverKey:`appleSimulatorScreenRecordingTransport`,resolve(e,t){let n=e.appleSimulatorScreenRecordingTransport;return n?{appleSimulatorScreenRecording:{provider:n(t)}}:{}},async appendWrapper(e,t){let n=e.appleSimulatorScreenRecording?.provider;if(!n&&!e.appleRunner?.provider)return;let{withAppleSimulatorScreenRecordingTransport:r}=await import(`./platform-runtime-screen-recording-apple-transport.js`);t.push(async e=>await r(n,e))}}];function s(e,t){return o.reduce((n,r)=>({...n,...r.resolve(e,t)}),{})}function c(e){return o.some(t=>!!e[t.resolverKey])}function l(e,t){return n(t.platform)?.providers?.platformGatedResolvers.includes(e)??!1}r();async function u(e){let t=[];for(let n of o)await n.appendWrapper(e,t);return t}function d(e,t,n){let r=t?.provider;r&&e.push(async e=>await n(r,e))}async function f(e,t){let n=t;for(let t of[...e].reverse()){let e=n;n=async()=>await t(e)}return await n()}export{i as createComposedRequestPlatformProviders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Tn as e}from"./sdk-batch.js";import{A as t}from"./sdk-contracts.js";import{J as n,Y as r}from"./sdk-device.js";import{t as i}from"./ttl-memo.js";import{n as a}from"./provider-device-admission.js";import{t as o}from"./async-lifecycle.js";const s=i({ttlMs:5e3});async function c(e,t){if(a(e))return;let n=u(e);s.get(n)!==!0&&await t.ensureLocalDeviceReady(e)&&l(n)}function l(e){s.set(e,!0)}function u(e){let t=e.kind===`simulator`?e.simulatorSetPath??``:``;return JSON.stringify([e.platform,e.kind,e.id,e.target??``,t])}const d=Object.freeze({acceptAlert:`mutates`,actionButton:`mutates`,appLogCleanup:`repeatable`,appLogDoctor:`repeatable`,appLogInspect:`repeatable`,appLogReattach:`repeatable`,appLogStart:`repeatable`,appState:`repeatable`,appSwitcher:`mutates`,applyRuntimeHints:`mutates`,audioProbeCleanup:`repeatable`,audioProbeQuery:`repeatable`,audioProbeReattach:`repeatable`,audioProbeStart:`repeatable`,awaitAlert:`repeatable`,back:`mutates`,bootTarget:`mutates`,bootTargetHeadless:`mutates`,captureScreenshot:`repeatable`,captureSnapshot:`repeatable`,captureSnapshotWithCustomActions:`repeatable`,captureSnapshotWithoutActiveApp:`repeatable`,clearRuntimeHints:`mutates`,closeApplication:`mutates`,configureProviderPortReverse:`repeatable`,deployApp:`mutates`,deployMaterializedApp:`mutates`,dismissAlert:`mutates`,ensureReady:`repeatable`,fillPoint:`mutates`,fillRef:`mutates`,finalizeApplicationClose:`mutates`,findText:`repeatable`,focusPoint:`mutates`,gestureViewport:`repeatable`,home:`mutates`,hoverPoint:`mutates`,hoverRef:`mutates`,keyboardDismiss:`mutates`,keyboardEnter:`mutates`,keyboardStatus:`repeatable`,listApps:`repeatable`,longPressPoint:`mutates`,materializeAppSource:`repeatable`,mediaFastForward:`mutates`,mediaNext:`mutates`,mediaPlayPause:`mutates`,mediaPrevious:`mutates`,mediaRewind:`mutates`,mute:`mutates`,networkDump:`repeatable`,openApplication:`mutates`,perfFrames:`repeatable`,perfMemorySample:`repeatable`,perfMemorySnapshot:`repeatable`,perfNativeCaptureCleanup:`repeatable`,perfNativeCaptureReattach:`repeatable`,perfNativeCaptureStart:`repeatable`,perfProfileReport:`repeatable`,performDirectionalFlingPlan:`mutates`,performGesturePlan:`mutates`,performMultiTouchGesturePlan:`mutates`,performTargetAuthoredDrag:`mutates`,power:`mutates`,prepareAppleRunner:`repeatable`,prepareApplicationOpen:`repeatable`,querySelector:`repeatable`,readAlert:`repeatable`,readClipboard:`repeatable`,readSetting:`repeatable`,readTextAtPoint:`repeatable`,resolveOpenTarget:`repeatable`,screenRecordingCleanup:`repeatable`,screenRecordingReattach:`repeatable`,screenRecordingStart:`repeatable`,scrollDirection:`mutates`,sendPushNotification:`mutates`,sendTelephonyEvent:`mutates`,setFoldPose:`mutates`,setOrientation:`mutates`,setSetting:`mutates`,setViewport:`mutates`,shutdownTarget:`mutates`,sleep:`mutates`,tapElementSelector:`mutates`,tapPoint:`mutates`,tapRef:`mutates`,triggerAppEvent:`mutates`,tvRemote:`mutates`,typeText:`mutates`,uninstallApp:`mutates`,unlockOrientation:`mutates`,volumeDown:`mutates`,volumeUp:`mutates`,wake:`mutates`,writeClipboard:`mutates`});function f(){return{dispatchedSteps:0}}function p(e){return e.internal?.dispatchLedger??f()}function m(e,t){let n={};for(let[r,i]of Object.entries(e.operations))n[r]=typeof i==`function`&&d[r]===`mutates`?h(i,t):i;return Object.freeze({...e,operations:Object.freeze(n)})}function h(e,t){return(...n)=>{let r=e(...n);return r instanceof Promise?r.then(e=>(t.dispatchedSteps+=1,e)):(t.dispatchedSteps+=1,r)}}function g(e,t){return async n=>{let r=f(),i=await e({...n,internal:{...n.internal,dispatchLedger:r}});return t.dispatchedSteps+=r.dispatchedSteps,i.ok||r.dispatchedSteps===0?i:_(i,r.dispatchedSteps)}}function _(e,t){let{dispatchedSteps:n,...r}=e.error.details??{},i=typeof n==`number`?n-t:0;return{...e,error:{...e.error,details:i>0?{...r,dispatchedSteps:i}:r}}}async function v(e,t){switch(e.owner.kind){case`provider-runtime`:return;case`local-family`:await c(e.device,t)}}function y(t){let i=new o,a=new Map,s=async e=>(await t.admitDeviceClaim(e.device,e.owner),e);return{inspectFacts:async e=>(t.admitDevice?.(e),await t.gateway.inspectFacts(e)),bindDevice:async(o,c)=>{t.admitDevice?.(o);let l=JSON.stringify([r(n(o)),o.booted===!0]),u=a.get(l);return u||(u=t.gateway.bind({device:o,intent:{kind:`ordinary`},scope:t.scope}).then(async e=>await b(i,e,t.scope)).then(s),a.set(l,u),u.catch(()=>{a.get(l)===u&&a.delete(l)})),m(e(await u,c),t.dispatchLedger)},bindExactDevice:async(n,r,a,o,c)=>{t.admitDevice?.(n);let l={kind:`exact-owner`,owner:r,fence:a},u=await t.gateway.bind({device:n,intent:l,scope:c}),d=await b(i,u,c),f=await s(d);return m(e(f,o),t.dispatchLedger)},[Symbol.asyncDispose]:async()=>{await i[Symbol.asyncDispose]()}}}async function b(e,n,r){try{return e.use(n)}catch(e){try{await n[Symbol.asyncDispose]()}catch(n){r.diagnostics.emit({level:`error`,phase:`request_runtime_late_binding_cleanup_failed`,data:{error:t(n),primaryError:t(e)}})}throw e}}export{p as i,v as n,g as r,y as t};
|
package/dist/src/request.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{C as t,F as n,N as r,P as i,S as a,_ as o,y as s}from"./sdk-contracts.js";import{n as c}from"./runtime-slots.js";import{AsyncLocalStorage as l}from"node:async_hooks";const u=Symbol(`requestCancel`),d=()=>c(u,()=>({canceledRequestIds:new Set,requestAbortControllers:new Map}),e=>{for(let t of e.requestAbortControllers.values())t.abort()}),f=()=>d().canceledRequestIds,p=()=>d().requestAbortControllers;function m(e,t){if(typeof e==`string`&&e.length>0)return e;let n=(typeof t==`string`?t:typeof t==`number`&&Number.isFinite(t)?String(t):`generated`).trim().replaceAll(/[^a-zA-Z0-9_-]/g,`_`).slice(0,32)||`generated`,r=Math.random().toString(36).slice(2,10);return`req:${n}:${process.pid}:${Date.now()}:${r}`}function h(e){if(e.size<=5e4)return;let t=0;for(let n of e){if(t>=1e4)break;e.delete(n),t++}}function g(e,t,n){if(!e)return;if(p().has(e))throw new o(`INVALID_ARGS`,`Request ID is already in flight: ${e}`,{requestId:e,reason:`duplicate_request_id`});let r=new AbortController,i=t?p().get(t):void 0;return r.executionDeadlineMs=i?.executionDeadlineMs,r.resultDeadlineMs=t?i?.resultDeadlineMs:n?.resultDeadlineMs,r.readOnly=t?i?.readOnly:n?.readOnly,p().set(e,r),f().has(e)&&r.abort(a()),{requestId:e,controller:r}}function _(e){e&&(h(f()),f().add(e),p().get(e)?.abort(a()))}function v(){for(let e of p().keys())_(e)}function y(e,t){e&&(t&&(t.requestId!==e||p().get(e)!==t.controller)||(f().delete(e),p().delete(e)))}function b(e){e&&y(e.requestId,e)}function x(e){return e?f().has(e)||S(e)?.aborted===!0:!1}function S(e){if(e)return p().get(e)?.signal}function C(e){return e?p().get(e)?.executionDeadlineMs:void 0}function w(e){return e?p().get(e)?.resultDeadlineMs:void 0}function T(e){let t=[C(e),w(e)].filter(e=>e!==void 0);return t.length>0?Math.min(...t):void 0}function E(e){if(!(!e||p().get(e)?.readOnly!==!0))return T(e)}function D(e){if(S(e)?.throwIfAborted(),x(e))throw a()}function O(e,r,a){let{hint:s,...c}=e instanceof o?e.details??{}:{};return t({...c,...typeof c.reason==`string`&&!n(c)?{causeReason:c.reason}:{},timeoutMs:r,requestId:a,...s===void 0||i(e)?{}:{hint:s}},e)}function k(e,i){if(e.ok)return e;let a=e.error.details?.reason,o=t();return{...e,error:{...e.error,...r(e.error.details)?{message:o.message,hint:String(o.details?.hint)}:{},details:{...e.error.details,...typeof a==`string`&&!n(e.error.details)?{causeReason:a}:{},reason:s,timeoutMs:i}}}}async function A(e,t,n){let r=p().has(e)?void 0:g(e),i=p().get(e),o=Math.min(i.executionDeadlineMs??1/0,Date.now()+t);i.executionDeadlineMs=o;let s=!1,c=()=>{i.signal.aborted||(s=!0,i.abort(a({timeoutMs:t,requestId:e})))},l=setTimeout(c,Math.max(0,o-Date.now()));try{i.signal.throwIfAborted();let e=await n();return Date.now()>=o&&c(),s?k(e,t):(i.signal.throwIfAborted(),e)}catch(n){throw Date.now()>=o&&c(),s?O(n,t,e):(i.signal.throwIfAborted(),n)}finally{clearTimeout(l),b(r)}}const j=new l;async function M(e,t){return await j.run(e,t)}function N(e){j.getStore()?.(e)}var P=e({throwIfRequestCanceled:()=>D});export{A as _,b as a,C as c,S as d,x as f,D as g,m as h,v as i,E as l,g as m,N as n,y as o,_ as p,M as r,T as s,P as t,w as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{t}from"./snapshot-capture-annotations.js";import"./capture.js";import{A as n}from"./sdk-device.js";import{i as r,r as i}from"./success-text.js";import{n as a,t as o}from"./deploy-result-target.js";var s=e({formatDeliveredArtifactLines:()=>
|
|
2
|
-
`))}}function
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{t}from"./snapshot-capture-annotations.js";import"./capture.js";import{A as n}from"./sdk-device.js";import{i as r,r as i}from"./success-text.js";import{n as a,t as o}from"./deploy-result-target.js";var s=e({formatDeliveredArtifactLines:()=>y,serializeCloseResult:()=>v,serializeDeployResult:()=>p,serializeDevice:()=>d,serializeInstallFromSourceResult:()=>m,serializeOpenResult:()=>h,serializeSessionListEntry:()=>u,serializeSnapshotResult:()=>f});function c(e,t={}){let n=t.includeSerial??!0,r=l(e);return{platform:e.platform,target:e.target,device:e.name,id:e.id,...e.kind?{kind:e.kind}:{},...e.model?{model:e.model}:{},...e.osVersion?{osVersion:e.osVersion}:{},...e.platform===`ios`?{device_udid:e.ios?.udid??e.id,ios_simulator_device_set:e.ios?.simulatorSetPath??null}:{},...n&&r?{serial:r}:{}}}function l(e){return n(e.platform)?e.identifiers.serial??e.id:void 0}function u(e){return{name:e.name,...e.address?{address:e.address}:{},...e.sessionStateDir?{sessionStateDir:e.sessionStateDir}:{},...e.runnerLogPath?{runnerLogPath:e.runnerLogPath}:{},...c(e.device,{includeSerial:!1}),createdAt:e.createdAt}}function d(e){return{platform:e.platform,...e.appleOs?{appleOs:e.appleOs}:{},id:e.id,name:e.name,kind:e.kind,target:e.target,...e.model?{model:e.model}:{},...e.osVersion?{osVersion:e.osVersion}:{},...typeof e.booted==`boolean`?{booted:e.booted}:{},...e.claimedBy?{claimedBy:e.claimedBy}:{}}}function f(e){return{nodes:e.nodes,...e.truncated===void 0?{}:{truncated:e.truncated},...e.appName?{appName:e.appName}:{},...e.appBundleId?{appBundleId:e.appBundleId}:{},...e.visibility?{visibility:e.visibility}:{},...e.keyboard?{keyboard:e.keyboard}:{},...e.viewport?{viewport:e.viewport}:{},...e.presentedSurface?{presentedSurface:e.presentedSurface}:{},...e.postGestureOutcome?{postGestureOutcome:e.postGestureOutcome}:{},...t({...e,...e.snapshotQuality?{quality:e.snapshotQuality}:{},...e.snapshotQualityNotes?{qualityNotes:e.snapshotQualityNotes}:{}}),...e.unchanged?{unchanged:e.unchanged}:{},...e.snapshotDiagnostics?{snapshotDiagnostics:e.snapshotDiagnostics}:{},..._(e),...e.fallbackScreenshotPath?{fallbackScreenshotPath:e.fallbackScreenshotPath}:{},...e.refsGeneration===void 0?{}:{refsGeneration:e.refsGeneration}}}function p(e){return r({app:e.app,appPath:e.appPath,platform:e.platform,...e.appId?{appId:e.appId}:{},...e.bundleId?{bundleId:e.bundleId}:{},...e.package?{package:e.package}:{}},`Installed: ${o(e)}`)}function m(e){return r({launchTarget:e.launchTarget,...e.appName?{appName:e.appName}:{},...e.appId?{appId:e.appId}:{},...e.bundleId?{bundleId:e.bundleId}:{},...e.packageName?{package:e.packageName}:{},...e.installablePath?{installablePath:e.installablePath}:{},...e.archivePath?{archivePath:e.archivePath}:{},...e.materializationId?{materializationId:e.materializationId}:{},...e.materializationExpiresAt?{materializationExpiresAt:e.materializationExpiresAt}:{}},`Installed: ${a(e)}`)}function h(e){let t=e.appName??e.appBundleId??e.session;return r({session:e.session,..._(e),...g(e),...e.appName?{appName:e.appName}:{},...e.appBundleId?{appBundleId:e.appBundleId}:{},...e.selection?{selection:e.selection}:{},...e.startup?{startup:e.startup}:{},...e.runtime?{runtime:e.runtime}:{},...e.device?c(e.device):{},...e.launchConfirmation?{launchConfirmation:e.launchConfirmation}:{},...e.launchConfirmation===`unanswered`&&e.launchConfirmationReason?{launchConfirmationReason:e.launchConfirmationReason}:{},...e.launchConfirmationProbeFailure?{launchConfirmationProbeFailure:e.launchConfirmationProbeFailure}:{},...e.snapshot?{snapshot:e.snapshot}:{},...e.initialSnapshotError?{initialSnapshotError:e.initialSnapshotError}:{}},t?`Opened: ${t}`:`Opened`)}function g(e){return{...e.sessionStateDir?{sessionStateDir:e.sessionStateDir}:{},...e.runnerLogPath?{runnerLogPath:e.runnerLogPath}:{},...e.requestLogPath?{requestLogPath:e.requestLogPath}:{},...e.eventLogPath?{eventLogPath:e.eventLogPath}:{}}}function _(e){return{...e.warnings?.length?{warnings:e.warnings}:{},...e.scriptDeliveryFailure?{scriptDeliveryFailure:e.scriptDeliveryFailure}:{}}}function v(e){return{session:e.session,...e.shutdown?{shutdown:e.shutdown}:{},...`provider`in e&&e.provider?{provider:e.provider}:{},..._(e),...i([e.session?`Closed: ${e.session}`:`Closed`,...y(`provider`in e?e.provider?.cloudArtifacts:void 0)].join(`
|
|
2
|
+
`))}}function y(e){return[...(e?.cloudArtifacts??[]).filter(e=>(e.availability??`ready`)===`ready`&&e.url).slice(0,3).map(e=>`${e.name}: ${e.url}`),...e?.message?[e.message]:[]]}export{s as n,d as r,y as t};
|
package/dist/src/retry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{G as t,H as n,K as r,U as i,W as a,q as o}from"./sdk-io.js";var s=e({Deadline:()=>n,RETRY_PHASE:()=>i,isEnvTruthy:()=>a,pollUntilSettled:()=>t,retryWithPolicy:()=>r,sleep:()=>o});export{s as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime.js";import{
|
|
2
|
-
`)}};a.defaultYaml={explicit:!1,version:`1.2`},a.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=a})),d=t((e=>{var t=c(),n=l();function r(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function i(e){let t=new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function a(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function o(e,n){let r=[],o=new Map,s=null;return{onAnchor:t=>{r.push(t),s??=i(e);let o=a(n,s);return s.add(o),o},setAnchors:()=>{for(let e of r){let n=o.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:o}}e.anchorIsValid=r,e.anchorNames=i,e.createNodeAnchors=o,e.findNewAnchor=a})),f=t((e=>{function t(e,n,r,i){if(i&&typeof i==`object`){if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let r=i[n],a=t(e,i,String(n),r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=t(e,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=t(e,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=t(e,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}}return e.call(n,r,i)}e.applyReviver=t})),p=t((e=>{var t=c();function n(e,r,i){if(Array.isArray(e))return e.map((e,t)=>n(e,String(t),i));if(e&&typeof e.toJSON==`function`){if(!i||!t.hasAnchor(e))return e.toJSON(r,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=e=>{n.res=e,delete i.onCreate};let a=e.toJSON(r,i);return i.onCreate&&i.onCreate(a),a}return typeof e==`bigint`&&!i?.keep?Number(e):e}e.toJS=n})),m=t((e=>{var t=f(),n=c(),r=p();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),h=t((e=>{var t=d(),n=l(),r=c(),i=m(),a=p(),o=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let
|
|
1
|
+
import{i as e,t}from"./rolldown-runtime.js";import{S as n,_ as r}from"./sdk-contracts.js";import{rt as i}from"./sdk-io.js";import"./command.js";import"./rect-center.js";import a from"node:fs";import o from"node:path";import{fileURLToPath as s}from"node:url";var c=t((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),c=e=>!!e&&typeof e==`object`&&e[s]===t,l=e=>!!e&&typeof e==`object`&&e[s]===n,u=e=>!!e&&typeof e==`object`&&e[s]===r,d=e=>!!e&&typeof e==`object`&&e[s]===i,f=e=>!!e&&typeof e==`object`&&e[s]===a,p=e=>!!e&&typeof e==`object`&&e[s]===o;function m(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function h(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(f(e)||m(e))&&!!e.anchor,e.isAlias=c,e.isCollection=m,e.isDocument=l,e.isMap=u,e.isNode=h,e.isPair=d,e.isScalar=f,e.isSeq=p})),l=t((e=>{var t=c();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function a(e,n){let r=u(n);t.isDocument(e)?o(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):o(null,e,r,Object.freeze([]))}a.BREAK=n,a.SKIP=r,a.REMOVE=i;function o(e,r,a,s){let c=d(e,r,a,s);if(t.isNode(c)||t.isPair(c))return f(e,s,c),o(e,c,a,s);if(typeof c!=`symbol`){if(t.isCollection(r)){s=Object.freeze(s.concat(r));for(let e=0;e<r.items.length;++e){let t=o(e,r.items[e],a,s);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){s=Object.freeze(s.concat(r));let e=o(`key`,r.key,a,s);if(e===n)return n;e===i&&(r.key=null);let t=o(`value`,r.value,a,s);if(t===n)return n;t===i&&(r.value=null)}}return c}async function s(e,n){let r=u(n);t.isDocument(e)?await l(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await l(null,e,r,Object.freeze([]))}s.BREAK=n,s.SKIP=r,s.REMOVE=i;async function l(e,r,a,o){let s=await d(e,r,a,o);if(t.isNode(s)||t.isPair(s))return f(e,o,s),l(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await l(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await l(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await l(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function u(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function d(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function f(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=a,e.visitAsync=s})),u=t((e=>{var t=c(),n=l();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},i=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var a=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+i(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
|
|
2
|
+
`)}};a.defaultYaml={explicit:!1,version:`1.2`},a.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=a})),d=t((e=>{var t=c(),n=l();function r(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function i(e){let t=new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function a(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function o(e,n){let r=[],o=new Map,s=null;return{onAnchor:t=>{r.push(t),s??=i(e);let o=a(n,s);return s.add(o),o},setAnchors:()=>{for(let e of r){let n=o.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:o}}e.anchorIsValid=r,e.anchorNames=i,e.createNodeAnchors=o,e.findNewAnchor=a})),f=t((e=>{function t(e,n,r,i){if(i&&typeof i==`object`){if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let r=i[n],a=t(e,i,String(n),r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=t(e,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=t(e,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=t(e,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}}return e.call(n,r,i)}e.applyReviver=t})),p=t((e=>{var t=c();function n(e,r,i){if(Array.isArray(e))return e.map((e,t)=>n(e,String(t),i));if(e&&typeof e.toJSON==`function`){if(!i||!t.hasAnchor(e))return e.toJSON(r,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=e=>{n.res=e,delete i.onCreate};let a=e.toJSON(r,i);return i.onCreate&&i.onCreate(a),a}return typeof e==`bigint`&&!i?.keep?Number(e):e}e.toJS=n})),m=t((e=>{var t=f(),n=c(),r=p();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),h=t((e=>{var t=d(),n=l(),r=c(),i=m(),a=p(),o=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o);if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=s(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function s(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=s(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=s(e,t.key,n),i=s(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=o})),g=t((e=>{var t=c(),n=m(),r=p();let i=e=>!e||typeof e!=`function`&&typeof e!=`object`;var a=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};a.BLOCK_FOLDED=`BLOCK_FOLDED`,a.BLOCK_LITERAL=`BLOCK_LITERAL`,a.PLAIN=`PLAIN`,a.QUOTE_DOUBLE=`QUOTE_DOUBLE`,a.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=a,e.isScalarValue=i})),_=t((e=>{var t=h(),n=c(),r=g();function i(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function a(e,a,o){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=o.schema[n.MAP].createNode?.(o.schema,null,o);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:c,onTagObj:l,schema:u,sourceObjects:d}=o,f;if(s&&e&&typeof e==`object`){if(f=d.get(e),f)return f.anchor??(f.anchor=c(e)),new t.Alias(f.anchor);f={anchor:null,node:null},d.set(e,f)}a?.startsWith(`!!`)&&(a=`tag:yaml.org,2002:`+a.slice(2));let p=i(e,a,u.tags);if(!p){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return f&&(f.node=t),t}p=e instanceof Map?u[n.MAP]:Symbol.iterator in Object(e)?u[n.SEQ]:u[n.MAP]}l&&(l(p),delete o.onTagObj);let m=p?.createNode?p.createNode(o.schema,e,o):typeof p?.nodeClass?.from==`function`?p.nodeClass.from(o.schema,e,o):new r.Scalar(e);return a?m.tag=a:p.default||(m.tag=p.tag),f&&(f.node=m),m}e.createNode=a})),v=t((e=>{var t=_(),n=c(),r=m();function i(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}let a=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(a(e))this.add(t);else{let[r,...a]=e,o=this.get(r,!0);if(n.isCollection(o))o.addIn(a,t);else if(o===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...a]=e;if(a.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(a,t);else if(e===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}},e.collectionFromPath=i,e.isEmptyPath=a})),y=t((e=>{let t=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function n(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=n,e.lineComment=(e,t,r)=>e.endsWith(`
|
|
3
3
|
`)?n(r,t):r.includes(`
|
|
4
4
|
`)?`
|
|
5
5
|
`+n(r,t):(e.endsWith(` `)?``:` `)+r,e.stringifyComment=t})),b=t((e=>{let t=`block`,n=`quoted`;function r(e,r,a=`flow`,{indentAtStart:o,lineWidth:s=80,minContentWidth:c=20,onFold:l,onOverflow:u}={}){if(!s||s<0)return e;s<c&&(c=0);let d=Math.max(1+c,1+s-r.length);if(e.length<=d)return e;let f=[],p={},m=s-r.length;typeof o==`number`&&(o>s-Math.max(2,c)?f.push(0):m=s-o);let h,g,_=!1,v=-1,y=-1,b=-1;a===t&&(v=i(e,v,r.length),v!==-1&&(m=v+d));for(let o;o=e[v+=1];){if(a===n&&o===`\\`){switch(y=v,e[v+1]){case`x`:v+=3;break;case`u`:v+=5;break;case`U`:v+=9;break;default:v+=1}b=v}if(o===`
|
|
@@ -61,11 +61,9 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
61
61
|
`+l[e][0].slice(d);m[m.length-1]!==`
|
|
62
62
|
`&&(m+=`
|
|
63
63
|
`);break;default:m+=`
|
|
64
|
-
`}let _=o+s.length+n.source.length;return{value:m,type:c,comment:s.comment,range:[o,_,_]}}function r({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function i(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}e.resolveBlockScalar=n})),Se=t((e=>{var t=g(),n=H();function r(e,r,o){let{offset:c,type:l,source:u,end:d}=e,f,p,m=(e,t,n)=>o(c+e,t,n);switch(l){case`scalar`:f=t.Scalar.PLAIN,p=i(u,m);break;case`single-quoted-scalar`:f=t.Scalar.QUOTE_SINGLE,p=a(u,m);break;case`double-quoted-scalar`:f=t.Scalar.QUOTE_DOUBLE,p=s(u,m);break;default:return o(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${l}`),{value:``,type:null,comment:``,range:[c,c+u.length,c+u.length]}}let h=c+u.length,g=n.resolveEnd(d,h,r,o);return{value:p,type:f,comment:g.comment,range:[c,h,g.offset]}}function i(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),o(e)}function a(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),o(e.slice(1,-1)).replace(/''/g,`'`)}function o(e){let t,n;try{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`?i+=a:a=`
|
|
68
|
-
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function s(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
|
|
64
|
+
`}let _=o+s.length+n.source.length;return{value:m,type:c,comment:s.comment,range:[o,_,_]}}function r({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function i(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}e.resolveBlockScalar=n})),Se=t((e=>{var t=g(),n=H();function r(e,r,o){let{offset:c,type:l,source:u,end:d}=e,f,p,m=(e,t,n)=>o(c+e,t,n);switch(l){case`scalar`:f=t.Scalar.PLAIN,p=i(u,m);break;case`single-quoted-scalar`:f=t.Scalar.QUOTE_SINGLE,p=a(u,m);break;case`double-quoted-scalar`:f=t.Scalar.QUOTE_DOUBLE,p=s(u,m);break;default:return o(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${l}`),{value:``,type:null,comment:``,range:[c,c+u.length,c+u.length]}}let h=c+u.length,g=n.resolveEnd(d,h,r,o);return{value:p,type:f,comment:g.comment,range:[c,h,g.offset]}}function i(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),o(e)}function a(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),o(e.slice(1,-1)).replace(/''/g,`'`)}function o(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
|
|
65
|
+
`?a+=o:o=`
|
|
66
|
+
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function s(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
|
|
69
67
|
`){if(i===`
|
|
70
68
|
`){let{fold:t,offset:i}=c(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=l[i];if(a)n+=a;else if(i===`
|
|
71
69
|
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
@@ -112,4 +110,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
112
110
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
113
111
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){u(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(a(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=l(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(a(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(s(t.key)&&!a(t.sep,`newline`)){let e=l(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):a(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!a(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){u(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||a(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=l(c(t));d(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
114
112
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
115
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=l(c(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=l(c(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),Pe=t((e=>{var t=De(),n=R(),r=z(),i=w(),a=c(),o=Me(),s=Ne();function l(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=l(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),u=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},c.streamInfo())}function d(e,n={}){let{lineCounter:i,prettyErrors:a}=l(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),u=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function f(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=d(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function p(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=f,e.parseAllDocuments=u,e.parseDocument=d,e.stringify=p})),Fe=t((e=>{var t=De(),n=R(),r=pe(),i=z(),a=h(),o=c(),s=D(),u=g(),d=O(),f=A();U();var p=je(),m=Me(),_=Ne(),v=Pe(),y=l();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=u.Scalar,e.YAMLMap=d.YAMLMap,e.YAMLSeq=f.YAMLSeq,e.Lexer=p.Lexer,e.LineCounter=m.LineCounter,e.Parser=_.Parser,e.parse=v.parse,e.parseAllDocuments=v.parseAllDocuments,e.parseDocument=v.parseDocument,e.stringify=v.stringify,e.visit=y.visit,e.visitAsync=y.visitAsync})),W=Fe();function Ie(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function Le(e){return e.trim().toLowerCase().replaceAll(/\s+/g,` `)}function Re(e){return[e.label,e.value,e.identifier].find(e=>typeof e==`string`&&e.length>0)?.trim()??``}function ze(e,t){return Be(e?.range?.[0],t)}function Be(e,t){let n=t.lineCounter.linePos(e!==void 0&&e>=0?e:0).line;return t.sourcePath===void 0?{line:n}:{path:t.sourcePath,line:n}}function G(e){return`${e.path===void 0?``:`${e.path}:`}line ${e.line}`}function K(e,t,r){throw new n(`INVALID_ARGS`,`${e} (${G(ze(t,r))})`)}function Ve(e,t,n){(0,W.isMap)(e)||K(`Maestro ${t} expects a map.`,e,n);let r=[];for(let i of e.items){let e=i.key;(0,W.isScalar)(e)||K(`Maestro ${t} map keys must be strings.`,void 0,n);let a=e.value;typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`&&K(`Maestro ${t} map keys must be strings.`,e,n),i.value!==null&&!(0,W.isNode)(i.value)&&K(`Maestro ${t} values must be YAML nodes.`,e,n),r.push({key:String(a),keyNode:e,value:i.value})}return r}function He(e,t,n){return(0,W.isSeq)(e)||K(`Maestro ${t} expects a list.`,e,n),e.items}function Ue(e,t,n){return He(e,t,n).map((e,r)=>Xe(e,`${t}[${r}]`,n))}function We(e,t,n,r){let i=new Set(n),a=new Set;for(let n of e)a.has(n.key)&&K(`Maestro ${t} contains duplicate field "${n.key}".`,n.keyNode,r),a.add(n.key),i.has(n.key)||K(`Maestro ${t} field "${n.key}" is not supported.`,n.keyNode,r)}function Ge(e,t){return e.some(e=>e.key===t)}function Ke(e,t){return e.find(e=>e.key===t)?.value}function qe(e,t,n){return Ge(e,t)?n(Ke(e,t)):void 0}function Je(e,t,n){return Ie({optional:qe(e,`optional`,e=>Qe(e,`${t}.optional`,n))})}function Ye(e){return e===null||(0,W.isScalar)(e)&&e.value===null}function q(e,t,n){if(e==null)return null;(0,W.isScalar)(e)||K(`Maestro ${t} expects a scalar value.`,e,n);let r=e.value;if(r===null||typeof r==`string`||typeof r==`number`||typeof r==`boolean`)return r;K(`Maestro ${t} contains an unsupported scalar value.`,e,n)}function Xe(e,t,n){let r=q(e,t,n);return typeof r!=`string`&&K(`Maestro ${t} expects a string.`,e,n),r}function Ze(e,t,n){let r=q(e,t,n);if(r!==null)return typeof r!=`string`&&K(`Maestro ${t} expects a string.`,e,n),r}function Qe(e,t,n){let r=q(e,t,n);if(r!==null)return typeof r!=`boolean`&&K(`Maestro ${t} expects a boolean.`,e,n),r}const J=/^\$\{[A-Za-z_][A-Za-z0-9_.]*\}$/,$e=new Set([`allow`,`deny`,`unset`,`always`,`inuse`,`never`,`limited`]),et=/^-?\d+(\.\d+)?$/,tt=/^-?\d+$/,nt=1e4,Y={"tapOn.index":{integer:!0,nonNegative:!0},"tapOn.repeat":{integer:!0,positive:!0},"tapOn.delay":{integer:!0,nonNegative:!0},"doubleTapOn.delay":{integer:!0,nonNegative:!0},eraseText:{integer:!0,positive:!0,max:nt},"eraseText.charactersToErase":{integer:!0,positive:!0,max:nt},"extendedWaitUntil.timeout":{nonNegative:!0},"scrollUntilVisible.timeout":{nonNegative:!0},waitForAnimationToEnd:{nonNegative:!0},"waitForAnimationToEnd.timeout":{nonNegative:!0},"swipe.duration":{nonNegative:!0},"repeat.times":{integer:!0,nonNegative:!0},"retry.maxRetries":{integer:!0,nonNegative:!0}};function X(e){let t=rt(e);return e.max===void 0?t:`${t} up to ${e.max}`}function rt(e){return e.positive&&e.integer?`a positive integer`:e.positive?`a positive number`:e.nonNegative&&e.integer?`a non-negative integer`:e.nonNegative?`a non-negative finite number`:e.integer?`an integer`:`a finite number`}function it(e,t,n,r,i){at(e,i)||K(`Maestro ${t} expects ${X(i)} or a variable expression.`,n,r)}function at(e,t){return!Number.isFinite(e)||Math.abs(e)>2**53-1||t.integer&&!Number.isSafeInteger(e)||t.nonNegative&&e<0||t.positive&&e<=0?!1:t.max===void 0||e<=t.max}function ot(e,t,n,r,i){if(typeof e==`number`)return it(e,t,n,r,i),e;if(typeof e==`string`){if(J.test(e))return e;if((i.integer?tt:et).test(e)){let a=Number(e);return it(a,t,n,r,i),a}}K(`Maestro ${t} expects ${X(i)} or a variable expression.`,n,r)}function st(e,t,n,r=Y[t]??{}){let i=q(e,t,n);if(i!==null)return ot(i,t,e,n,r)}function ct(e,t,n){let r=Y[t]??{},i=q(e,t,n);return i===null&&K(`Maestro ${t} expects ${X(r)} or a variable expression.`,e,n),ot(i,t,e,n,r)}function lt(e,t,n){let r=q(e,t,n);return r===null&&K(`Maestro ${t} requires a condition.`,e,n),typeof r==`string`&&r.includes("${")&&!J.test(r)&&K(`Maestro ${t} only supports a literal value or a bare \${VAR} lookup; JavaScript expressions are not supported — compute it in a runScript and reference \${output.x}.`,e,n),r}function ut(e,t,n){let r=Ve(e,t,n),i={};for(let e of r){let r=q(e.value,`${t}.${e.key}`,n);r===null&&K(`Maestro ${t}.${e.key} expects a string, number, or boolean.`,e.value,n),i[e.key]=r}return i}function dt(e,t){try{return new bt(pt(ft(e)),t).parse()}catch(e){if(e instanceof n&&e.code===`INVALID_ARGS`)return;throw e}}function ft(e){let t=e.trim();return t.startsWith("${")&&t.endsWith(`}`)?t.slice(2,-1).trim():t}function pt(e){let t=[],r=0;for(;r<e.length;){let i=e.slice(r),a=/^\s+/.exec(i)?.[0].length??0;if(a>0){r+=a;continue}let o=mt(i);if(!o)throw new n(`INVALID_ARGS`,`Unsupported runFlow.when.true expression near "${i.slice(0,24)}".`);t.push(o.value),r+=o.length}return t}function mt(e){return ht(e)??gt(e)??_t(e)??vt(e)??yt(e)}function ht(e){return e.startsWith(`maestro.platform`)?{value:{type:`platform`},length:16}:null}function gt(e){let t=/^(==|!=|&&|\|\|)/.exec(e)?.[1];return t?{value:{type:`operator`,value:t},length:t.length}:null}function _t(e){let t=e[0];return t===`(`||t===`)`?{value:{type:`paren`,value:t},length:1}:null}function vt(e){let t=/^(['"])(.*?)\1/.exec(e);return t?{value:{type:`string`,value:t[2]??``},length:t[0].length}:null}function yt(e){let t=/^(true|false)\b/.exec(e)?.[1];return t?{value:{type:`boolean`,value:t===`true`},length:t.length}:null}var bt=class{index=0;tokens;platform;constructor(e,t){this.tokens=e,this.platform=t}parse(){let e=this.parseOr();if(this.peek())throw new n(`INVALID_ARGS`,`Unsupported trailing runFlow.when.true expression.`);return e}parseOr(){let e=this.parseAnd();for(;this.consumeOperator(`||`);)e=this.parseAnd()||e;return e}parseAnd(){let e=this.parsePrimary();for(;this.consumeOperator(`&&`);)e=this.parsePrimary()&&e;return e}parsePrimary(){let e=this.peek();if(!e)throw new n(`INVALID_ARGS`,`Incomplete runFlow.when.true expression.`);if(e.type===`boolean`)return this.index+=1,e.value;if(e.type===`paren`&&e.value===`(`){this.index+=1;let e=this.parseOr();if(!this.consumeParen(`)`))throw new n(`INVALID_ARGS`,`Unclosed runFlow.when.true parenthesis.`);return e}return this.parsePlatformComparison()}parsePlatformComparison(){this.consumePlatformToken();let e=this.consumeComparisonOperator(),t=this.consumeStringLiteral(),n=this.platform===t.toLowerCase();return e.value===`==`?n:!n}consumePlatformToken(){if(this.peek()?.type!==`platform`)throw new n(`INVALID_ARGS`,`runFlow.when.true supports maestro.platform comparisons.`);this.index+=1}consumeComparisonOperator(){let e=this.peek();if(e?.type!==`operator`||e.value!==`==`&&e.value!==`!=`)throw new n(`INVALID_ARGS`,`runFlow.when.true comparison requires == or !=.`);return this.index+=1,e}consumeStringLiteral(){let e=this.peek();if(e?.type!==`string`)throw new n(`INVALID_ARGS`,`runFlow.when.true comparison requires a string literal.`);return this.index+=1,e.value}consumeOperator(e){let t=this.peek();return t?.type!==`operator`||t.value!==e?!1:(this.index+=1,!0)}consumeParen(e){let t=this.peek();return t?.type!==`paren`||t.value!==e?!1:(this.index+=1,!0)}peek(){return this.tokens[this.index]}};const xt=new Set([``,`false`,`0`,`null`,`undefined`]);function Z(e){return typeof e==`boolean`?e:typeof e==`number`?e!==0&&!Number.isNaN(e):!xt.has(e)}function St(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`?Z(e):typeof e==`bigint`?e!==0n:e!=null}function Ct(e,t){return{...$(e,t),source:e.source}}function wt(e,t,r){if(e===void 0)return;let i=r??Y[t]??{},a=X(i),o;if(typeof e==`number`)o=e;else{let r=e.trim();if(r===``)throw new n(`INVALID_ARGS`,`Maestro ${t} must be ${a}.`);o=Number(r)}if(!at(o,i))throw new n(`INVALID_ARGS`,`Maestro ${t} must be ${a}.`);return o}function Tt(e,t,n,r){return wt(e===void 0?t:n.resolve(String(e)),r)}function Et(e){if(e?.aborted)throw r()}async function Dt(e,t){if(e.include.kind===`commands`)return{kind:`program`,source:e.source,config:{},commands:e.include.commands};if(!t.loadProgram)throw new n(`INVALID_ARGS`,`Maestro file runFlow requires a program loader.`);return Et(t.signal),t.signal?await t.loadProgram(e.include.path,e.source.path,t.signal):await t.loadProgram(e.include.path,e.source.path)}function Ot(e,t,n){if(e.include.kind===`file`)return o.resolve(t?o.dirname(t):n,e.include.path)}function kt(e){return e===void 0?void 0:o.resolve(e)}function At(e,t,r){let i=Ot(e,e.source.path,r);if(i&&t.has(i))throw new n(`INVALID_ARGS`,`Maestro runFlow cycle detected at ${i}.`);return i}function jt(e,t,r,i){let a=e.include.kind===`file`?kt(t.source.path):void 0,o=new Set([r,a].filter(e=>e!==void 0)),s=[...o].find(e=>i.has(e));if(s)throw new n(`INVALID_ARGS`,`Maestro runFlow cycle detected at ${s}.`);return o.forEach(e=>i.add(e)),o}function Q(e,t){if(e.trustedScripts===!1)throw new n(`UNAUTHORIZED`,`Maestro ${t} is not permitted for flows received over the remote daemon surface: node:vm is not a security sandbox, so an untrusted expression can escape to the host.`)}async function Mt(e,t,n,r){if(e===void 0)return!0;if(typeof e==`boolean`)return e;let i=Nt(e,n);if(i!==void 0){let e=dt(i,r.platform);if(e!==void 0)return e;if(!i.includes("${"))return Z(i)}Q(r,t);let{evaluateMaestroConditionScript:a}=await import(`./engine-eval-script.js`),o=await a(e,n.values,r.platform,t);return n.replaceOutput(o.outputEnv),St(o.value)}function Nt(e,t){try{return t.resolve(e)}catch(e){if(e instanceof n&&e.code===`INVALID_ARGS`)return;throw e}}function Pt(e,t){return[...e.visible?[{kind:`visible`,selector:$(e.visible,t)}]:[],...e.notVisible?[{kind:`notVisible`,selector:$(e.notVisible,t)}]:[]]}function $(e,t){return typeof e==`string`?t.resolve(e):Array.isArray(e)?e.map(e=>$(e,t)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,$(n,t)])):e}const Ft=3e4;async function It(e){let{signal:t,...r}=e;Q({trustedScripts:!r.publicNetworkOnly},`runScript`);let a=await i(process.execPath,Rt(`run-script-child`),{stdin:JSON.stringify(r),signal:t,timeoutMs:65e3,detached:!0,allowFailure:!0}),o=Lt(a.stdout);if(o&&`outputEnv`in o)return o.outputEnv;throw o?new n(o.error.code,o.error.message,o.error.details):new n(`COMMAND_FAILED`,`Maestro runScript process exited without a result`,{scriptPath:r.scriptPath,exitCode:a.exitCode,stderr:a.stderr.slice(0,1e3)})}function Lt(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&(`outputEnv`in t||`error`in t)?t:void 0}catch{return}}function Rt(e){let t=zt(e,import.meta.url);if(!t)throw new n(`COMMAND_FAILED`,`Maestro runScript helper entrypoint ${e} is unavailable; rebuild the package`);return t.endsWith(`.ts`)?[`--experimental-strip-types`,t]:[t]}function zt(e,t){try{let n=s(t),r=o.extname(n)||`.js`;return[o.join(o.dirname(n),e+r),o.join(o.dirname(n),`internal`,e+r)].find(e=>a.existsSync(e))??null}catch{return null}}export{st as A,Re as B,K as C,Qe as D,Ve as E,q as F,Ie as H,He as I,Ue as L,ct as M,Xe as N,Je as O,ut as P,ze as R,Ge as S,lt as T,Fe as U,Le as V,$e as _,Q as a,Ke as b,Pt as c,jt as d,Ct as f,dt as g,Z as h,At as i,Ze as j,qe as k,Dt as l,kt as m,It as n,Et as o,wt as p,Rt as r,Mt as s,Ft as t,Tt as u,J as v,Ye as w,G as x,We as y,Be as z};
|
|
113
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=l(c(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=l(c(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),Pe=t((e=>{var t=De(),n=R(),r=z(),i=w(),a=c(),o=Me(),s=Ne();function l(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=l(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),u=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},c.streamInfo())}function d(e,n={}){let{lineCounter:i,prettyErrors:a}=l(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),u=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function f(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=d(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function p(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=f,e.parseAllDocuments=u,e.parseDocument=d,e.stringify=p})),Fe=t((e=>{var t=De(),n=R(),r=pe(),i=z(),a=h(),o=c(),s=D(),u=g(),d=O(),f=A();U();var p=je(),m=Me(),_=Ne(),v=Pe(),y=l();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=u.Scalar,e.YAMLMap=d.YAMLMap,e.YAMLSeq=f.YAMLSeq,e.Lexer=p.Lexer,e.LineCounter=m.LineCounter,e.Parser=_.Parser,e.parse=v.parse,e.parseAllDocuments=v.parseAllDocuments,e.parseDocument=v.parseDocument,e.stringify=v.stringify,e.visit=y.visit,e.visitAsync=y.visitAsync})),W=Fe();function Ie(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function Le(e){return e.trim().toLowerCase().replaceAll(/\s+/g,` `)}function Re(e){return[e.label,e.value,e.identifier].find(e=>typeof e==`string`&&e.length>0)?.trim()??``}function ze(e,t){return Be(e?.range?.[0],t)}function Be(e,t){let n=t.lineCounter.linePos(e!==void 0&&e>=0?e:0).line;return t.sourcePath===void 0?{line:n}:{path:t.sourcePath,line:n}}function G(e){return`${e.path===void 0?``:`${e.path}:`}line ${e.line}`}function K(e,t,n){throw new r(`INVALID_ARGS`,`${e} (${G(ze(t,n))})`)}function Ve(e,t,n){(0,W.isMap)(e)||K(`Maestro ${t} expects a map.`,e,n);let r=[];for(let i of e.items){let e=i.key;(0,W.isScalar)(e)||K(`Maestro ${t} map keys must be strings.`,void 0,n);let a=e.value;typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`&&K(`Maestro ${t} map keys must be strings.`,e,n),i.value!==null&&!(0,W.isNode)(i.value)&&K(`Maestro ${t} values must be YAML nodes.`,e,n),r.push({key:String(a),keyNode:e,value:i.value})}return r}function He(e,t,n){return(0,W.isSeq)(e)||K(`Maestro ${t} expects a list.`,e,n),e.items}function Ue(e,t,n){return He(e,t,n).map((e,r)=>Xe(e,`${t}[${r}]`,n))}function We(e,t,n,r){let i=new Set(n),a=new Set;for(let n of e)a.has(n.key)&&K(`Maestro ${t} contains duplicate field "${n.key}".`,n.keyNode,r),a.add(n.key),i.has(n.key)||K(`Maestro ${t} field "${n.key}" is not supported.`,n.keyNode,r)}function Ge(e,t){return e.some(e=>e.key===t)}function Ke(e,t){return e.find(e=>e.key===t)?.value}function qe(e,t,n){return Ge(e,t)?n(Ke(e,t)):void 0}function Je(e,t,n){return Ie({optional:qe(e,`optional`,e=>Qe(e,`${t}.optional`,n))})}function Ye(e){return e===null||(0,W.isScalar)(e)&&e.value===null}function q(e,t,n){if(e==null)return null;(0,W.isScalar)(e)||K(`Maestro ${t} expects a scalar value.`,e,n);let r=e.value;if(r===null||typeof r==`string`||typeof r==`number`||typeof r==`boolean`)return r;K(`Maestro ${t} contains an unsupported scalar value.`,e,n)}function Xe(e,t,n){let r=q(e,t,n);return typeof r!=`string`&&K(`Maestro ${t} expects a string.`,e,n),r}function Ze(e,t,n){let r=q(e,t,n);if(r!==null)return typeof r!=`string`&&K(`Maestro ${t} expects a string.`,e,n),r}function Qe(e,t,n){let r=q(e,t,n);if(r!==null)return typeof r!=`boolean`&&K(`Maestro ${t} expects a boolean.`,e,n),r}const J=/^\$\{[A-Za-z_][A-Za-z0-9_.]*\}$/,$e=new Set([`allow`,`deny`,`unset`,`always`,`inuse`,`never`,`limited`]),et=/^-?\d+(\.\d+)?$/,tt=/^-?\d+$/,nt=1e4,Y={"tapOn.index":{integer:!0,nonNegative:!0},"tapOn.repeat":{integer:!0,positive:!0},"tapOn.delay":{integer:!0,nonNegative:!0},"doubleTapOn.delay":{integer:!0,nonNegative:!0},eraseText:{integer:!0,positive:!0,max:nt},"eraseText.charactersToErase":{integer:!0,positive:!0,max:nt},"extendedWaitUntil.timeout":{nonNegative:!0},"scrollUntilVisible.timeout":{nonNegative:!0},waitForAnimationToEnd:{nonNegative:!0},"waitForAnimationToEnd.timeout":{nonNegative:!0},"swipe.duration":{nonNegative:!0},"repeat.times":{integer:!0,nonNegative:!0},"retry.maxRetries":{integer:!0,nonNegative:!0}};function X(e){let t=rt(e);return e.max===void 0?t:`${t} up to ${e.max}`}function rt(e){return e.positive&&e.integer?`a positive integer`:e.positive?`a positive number`:e.nonNegative&&e.integer?`a non-negative integer`:e.nonNegative?`a non-negative finite number`:e.integer?`an integer`:`a finite number`}function it(e,t,n,r,i){at(e,i)||K(`Maestro ${t} expects ${X(i)} or a variable expression.`,n,r)}function at(e,t){return!Number.isFinite(e)||Math.abs(e)>2**53-1||t.integer&&!Number.isSafeInteger(e)||t.nonNegative&&e<0||t.positive&&e<=0?!1:t.max===void 0||e<=t.max}function ot(e,t,n,r,i){if(typeof e==`number`)return it(e,t,n,r,i),e;if(typeof e==`string`){if(J.test(e))return e;if((i.integer?tt:et).test(e)){let a=Number(e);return it(a,t,n,r,i),a}}K(`Maestro ${t} expects ${X(i)} or a variable expression.`,n,r)}function st(e,t,n,r=Y[t]??{}){let i=q(e,t,n);if(i!==null)return ot(i,t,e,n,r)}function ct(e,t,n){let r=Y[t]??{},i=q(e,t,n);return i===null&&K(`Maestro ${t} expects ${X(r)} or a variable expression.`,e,n),ot(i,t,e,n,r)}function lt(e,t,n){let r=q(e,t,n);return r===null&&K(`Maestro ${t} requires a condition.`,e,n),typeof r==`string`&&r.includes("${")&&!J.test(r)&&K(`Maestro ${t} only supports a literal value or a bare \${VAR} lookup; JavaScript expressions are not supported — compute it in a runScript and reference \${output.x}.`,e,n),r}function ut(e,t,n){let r=Ve(e,t,n),i={};for(let e of r){let r=q(e.value,`${t}.${e.key}`,n);r===null&&K(`Maestro ${t}.${e.key} expects a string, number, or boolean.`,e.value,n),i[e.key]=r}return i}function dt(e,t){try{return new bt(pt(ft(e)),t).parse()}catch(e){if(e instanceof r&&e.code===`INVALID_ARGS`)return;throw e}}function ft(e){let t=e.trim();return t.startsWith("${")&&t.endsWith(`}`)?t.slice(2,-1).trim():t}function pt(e){let t=[],n=0;for(;n<e.length;){let i=e.slice(n),a=/^\s+/.exec(i)?.[0].length??0;if(a>0){n+=a;continue}let o=mt(i);if(!o)throw new r(`INVALID_ARGS`,`Unsupported runFlow.when.true expression near "${i.slice(0,24)}".`);t.push(o.value),n+=o.length}return t}function mt(e){return ht(e)??gt(e)??_t(e)??vt(e)??yt(e)}function ht(e){return e.startsWith(`maestro.platform`)?{value:{type:`platform`},length:16}:null}function gt(e){let t=/^(==|!=|&&|\|\|)/.exec(e)?.[1];return t?{value:{type:`operator`,value:t},length:t.length}:null}function _t(e){let t=e[0];return t===`(`||t===`)`?{value:{type:`paren`,value:t},length:1}:null}function vt(e){let t=/^(['"])(.*?)\1/.exec(e);return t?{value:{type:`string`,value:t[2]??``},length:t[0].length}:null}function yt(e){let t=/^(true|false)\b/.exec(e)?.[1];return t?{value:{type:`boolean`,value:t===`true`},length:t.length}:null}var bt=class{index=0;tokens;platform;constructor(e,t){this.tokens=e,this.platform=t}parse(){let e=this.parseOr();if(this.peek())throw new r(`INVALID_ARGS`,`Unsupported trailing runFlow.when.true expression.`);return e}parseOr(){let e=this.parseAnd();for(;this.consumeOperator(`||`);)e=this.parseAnd()||e;return e}parseAnd(){let e=this.parsePrimary();for(;this.consumeOperator(`&&`);)e=this.parsePrimary()&&e;return e}parsePrimary(){let e=this.peek();if(!e)throw new r(`INVALID_ARGS`,`Incomplete runFlow.when.true expression.`);if(e.type===`boolean`)return this.index+=1,e.value;if(e.type===`paren`&&e.value===`(`){this.index+=1;let e=this.parseOr();if(!this.consumeParen(`)`))throw new r(`INVALID_ARGS`,`Unclosed runFlow.when.true parenthesis.`);return e}return this.parsePlatformComparison()}parsePlatformComparison(){this.consumePlatformToken();let e=this.consumeComparisonOperator(),t=this.consumeStringLiteral(),n=this.platform===t.toLowerCase();return e.value===`==`?n:!n}consumePlatformToken(){if(this.peek()?.type!==`platform`)throw new r(`INVALID_ARGS`,`runFlow.when.true supports maestro.platform comparisons.`);this.index+=1}consumeComparisonOperator(){let e=this.peek();if(e?.type!==`operator`||e.value!==`==`&&e.value!==`!=`)throw new r(`INVALID_ARGS`,`runFlow.when.true comparison requires == or !=.`);return this.index+=1,e}consumeStringLiteral(){let e=this.peek();if(e?.type!==`string`)throw new r(`INVALID_ARGS`,`runFlow.when.true comparison requires a string literal.`);return this.index+=1,e.value}consumeOperator(e){let t=this.peek();return t?.type!==`operator`||t.value!==e?!1:(this.index+=1,!0)}consumeParen(e){let t=this.peek();return t?.type!==`paren`||t.value!==e?!1:(this.index+=1,!0)}peek(){return this.tokens[this.index]}};const xt=new Set([``,`false`,`0`,`null`,`undefined`]);function Z(e){return typeof e==`boolean`?e:typeof e==`number`?e!==0&&!Number.isNaN(e):!xt.has(e)}function St(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`?Z(e):typeof e==`bigint`?e!==0n:e!=null}function Ct(e,t){return{...$(e,t),source:e.source}}function wt(e,t,n){if(e===void 0)return;let i=n??Y[t]??{},a=X(i),o;if(typeof e==`number`)o=e;else{let n=e.trim();if(n===``)throw new r(`INVALID_ARGS`,`Maestro ${t} must be ${a}.`);o=Number(n)}if(!at(o,i))throw new r(`INVALID_ARGS`,`Maestro ${t} must be ${a}.`);return o}function Tt(e,t,n,r){return wt(e===void 0?t:n.resolve(String(e)),r)}function Et(e){if(e?.aborted)throw n()}async function Dt(e,t){if(e.include.kind===`commands`)return{kind:`program`,source:e.source,config:{},commands:e.include.commands};if(!t.loadProgram)throw new r(`INVALID_ARGS`,`Maestro file runFlow requires a program loader.`);return Et(t.signal),t.signal?await t.loadProgram(e.include.path,e.source.path,t.signal):await t.loadProgram(e.include.path,e.source.path)}function Ot(e,t,n){if(e.include.kind===`file`)return o.resolve(t?o.dirname(t):n,e.include.path)}function kt(e){return e===void 0?void 0:o.resolve(e)}function At(e,t,n){let i=Ot(e,e.source.path,n);if(i&&t.has(i))throw new r(`INVALID_ARGS`,`Maestro runFlow cycle detected at ${i}.`);return i}function jt(e,t,n,i){let a=e.include.kind===`file`?kt(t.source.path):void 0,o=new Set([n,a].filter(e=>e!==void 0)),s=[...o].find(e=>i.has(e));if(s)throw new r(`INVALID_ARGS`,`Maestro runFlow cycle detected at ${s}.`);return o.forEach(e=>i.add(e)),o}function Q(e,t){if(e.trustedScripts===!1)throw new r(`UNAUTHORIZED`,`Maestro ${t} is not permitted for flows received over the remote daemon surface: node:vm is not a security sandbox, so an untrusted expression can escape to the host.`)}async function Mt(e,t,n,r){if(e===void 0)return!0;if(typeof e==`boolean`)return e;let i=Nt(e,n);if(i!==void 0){let e=dt(i,r.platform);if(e!==void 0)return e;if(!i.includes("${"))return Z(i)}Q(r,t);let{evaluateMaestroConditionScript:a}=await import(`./engine-eval-script.js`),o=await a(e,n.values,r.platform,t);return n.replaceOutput(o.outputEnv),St(o.value)}function Nt(e,t){try{return t.resolve(e)}catch(e){if(e instanceof r&&e.code===`INVALID_ARGS`)return;throw e}}function Pt(e,t){return[...e.visible?[{kind:`visible`,selector:$(e.visible,t)}]:[],...e.notVisible?[{kind:`notVisible`,selector:$(e.notVisible,t)}]:[]]}function $(e,t){return typeof e==`string`?t.resolve(e):Array.isArray(e)?e.map(e=>$(e,t)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,$(n,t)])):e}const Ft=3e4;async function It(e){let{signal:t,...n}=e;Q({trustedScripts:!n.publicNetworkOnly},`runScript`);let a=await i(process.execPath,Rt(`run-script-child`),{stdin:JSON.stringify(n),signal:t,timeoutMs:65e3,detached:!0,allowFailure:!0}),o=Lt(a.stdout);if(o&&`outputEnv`in o)return o.outputEnv;throw o?new r(o.error.code,o.error.message,o.error.details):new r(`COMMAND_FAILED`,`Maestro runScript process exited without a result`,{scriptPath:n.scriptPath,exitCode:a.exitCode,stderr:a.stderr.slice(0,1e3)})}function Lt(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&(`outputEnv`in t||`error`in t)?t:void 0}catch{return}}function Rt(e){let t=zt(e,import.meta.url);if(!t)throw new r(`COMMAND_FAILED`,`Maestro runScript helper entrypoint ${e} is unavailable; rebuild the package`);return t.endsWith(`.ts`)?[`--experimental-strip-types`,t]:[t]}function zt(e,t){try{let n=s(t),r=o.extname(n)||`.js`;return[o.join(o.dirname(n),e+r),o.join(o.dirname(n),`internal`,e+r)].find(e=>a.existsSync(e))??null}catch{return null}}export{st as A,Re as B,K as C,Qe as D,Ve as E,q as F,Ie as H,He as I,Ue as L,ct as M,Xe as N,Je as O,ut as P,ze as R,Ge as S,lt as T,Fe as U,Le as V,$e as _,Q as a,Ke as b,Pt as c,jt as d,Ct as f,dt as g,Z as h,At as i,Ze as j,qe as k,Dt as l,kt as m,It as n,Et as o,wt as p,Rt as r,Mt as s,Ft as t,Tt as u,J as v,Ye as w,G as x,We as y,Be as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{n as t,r as n}from"./install-source-network-transport.js";import{t as r}from"./undici.js";import i from"node:net";var a=r();const o=8388608,s=3e4;async function c(t,n){try{return{response:await l(JSON.parse(t),n)}}catch(t){if(!(t instanceof e))throw t;return{error:{code:t.code,message:t.message,details:t.details}}}}async function l(e,t){return e.publicNetworkOnly?await d(e,t):await u(e)}async function u(e){if(typeof fetch!=`function`)throw Error(`global fetch is required for Maestro runScript http helpers`);return await b(await fetch(e.url,{...f(e),signal:AbortSignal.timeout(s)}),o)}async function d(t,n){let r=y(t.url),i=AbortSignal.timeout(s),c=new p(r.protocol===`https:`,i,n);try{return await b(await(0,a.fetch)(r,{...f(t),dispatcher:c,signal:i}),o)}catch(t){throw t instanceof TypeError&&t.cause instanceof e?t.cause:t}finally{await c.dispose()}}function f(e){return{method:e.method,headers:e.headers,...e.body===void 0?{}:{body:e.body}}}var p=class extends a.Dispatcher{#e=new Set;#t;#n;#r;constructor(e,t,n){super(),this.#t=e,this.#n=t,this.#r=n}dispatch(e,t){return this.dispatchApproved(e,t).catch(e=>{t.onError?.(e instanceof Error?e:Error(String(e)))}),!0}async dispose(){await Promise.all([...this.#e].map(async e=>await e.close()))}async dispatchApproved(r,i){let a=v(r);if(this.#t&&a.protocol!==`https:`)throw new e(`COMMAND_FAILED`,`Maestro runScript HTTP redirect downgraded HTTPS`);a.protocol===`https:`&&(this.#t=!0);let o=await n(a,this.#n),s=t(a,this.#r),c=s?h(s,a):m(o.address,o.family);this.#e.add(c),c.dispatch(s?g(r,a,o.address,o.family):r,i)}};function m(e,t){return new a.Agent({connect:{lookup:(n,r,i)=>{if(r.all){i(null,[{address:e,family:t}]);return}i(null,e,t)}}})}function h(e,t){let n=_(t.hostname);return new a.ProxyAgent({uri:e,proxyTunnel:!0,requestTls:t.protocol===`https:`&&i.isIP(n)===0?{servername:n}:void 0})}function g(e,t,n,r){let i=new URL(t);i.hostname=r===6?`[${_(n)}]`:n;let a=Array.isArray(e.headers)?[...e.headers,`host`,t.host]:{...e.headers,host:t.host};return{...e,origin:i.origin,headers:a}}function _(e){return e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e}function v(t){if(!t.origin)throw new e(`INVALID_ARGS`,`Invalid Maestro runScript HTTP URL`);return new URL(t.path,t.origin)}function y(t){try{return new URL(t)}catch{throw new e(`INVALID_ARGS`,`Invalid Maestro runScript HTTP URL`)}}async function b(e,t){return{status:e.status,body:await x(e,t),headers:Object.fromEntries(e.headers.entries())}}async function x(t,n){let r=[],i=0,a=t.body?.getReader();if(!a)return``;for(;;){let{done:o,value:s}=await a.read();if(o)break;if(i+=s.byteLength,i>n)throw await a.cancel(),new e(`COMMAND_FAILED`,`Maestro runScript HTTP response exceeded ${n} bytes`,{limitBytes:n,status:t.status});r.push(s)}return Buffer.concat(r,i).toString(`utf8`)}export{s as n,c as r,o as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{T as t,V as n,y as r,z as i}from"./sdk-device.js";import{O as a,_ as o,f as s,j as c,y as l}from"./host2.js";import{n as ee}from"./runner-toolchain-identity.js";import u from"node:crypto";import d from"node:fs";import te from"node:os";import f from"node:path";const p=[`SnapshotBridgeRequest.h`,`SnapshotBridgeRequest.m`,`SnapshotBridgeRuntime.h`,`SnapshotBridgeRuntime.m`,`SnapshotBridgeCapture.h`,`SnapshotBridgeCapture.m`,`SnapshotBridgeSurfaceHosts.h`,`SnapshotBridgeSurfaceHosts.m`,`ForegroundApplicationGeometry.h`],m={iOS:{sdkName:{simulator:`iphonesimulator`,device:`iphoneos`},derivedBaseName:{simulator:`ios-simulator`,device:`ios-device`},xctestrunHints:{simulator:{preferred:[`iphonesimulator`],disallowed:[`iphoneos`,`appletvos`,`appletvsimulator`,`macos`]},device:{preferred:[`iphoneos`],disallowed:[`iphonesimulator`,`appletvos`,`appletvsimulator`,`macos`]}}},tvOS:{sdkName:{simulator:`appletvsimulator`,device:`appletvos`},derivedBaseName:{simulator:`tvos-simulator`,device:`tvos-device`},xctestrunHints:{simulator:{preferred:[`appletvsimulator`],disallowed:[`appletvos`,`iphoneos`,`iphonesimulator`,`macos`]},device:{preferred:[`appletvos`],disallowed:[`appletvsimulator`,`iphoneos`,`iphonesimulator`,`macos`]}}},macOS:{sdkName:{simulator:`macosx`,device:`macosx`},derivedBaseName:{simulator:`macos`,device:`macos`},xctestrunHints:{simulator:{preferred:[`macos`],disallowed:[`iphoneos`,`iphonesimulator`,`appletvos`,`appletvsimulator`]},device:{preferred:[`macos`],disallowed:[`iphoneos`,`iphonesimulator`,`appletvos`,`appletvsimulator`]}}},visionOS:{sdkName:{simulator:`xrsimulator`,device:`xros`},derivedBaseName:{simulator:`visionos-simulator`,device:`visionos-device`},xctestrunHints:{simulator:{preferred:[`xrsimulator`],disallowed:[`xros`,`iphoneos`,`iphonesimulator`,`appletvos`,`appletvsimulator`,`macos`]},device:{preferred:[`xros`],disallowed:[`xrsimulator`,`iphoneos`,`iphonesimulator`,`appletvos`,`appletvsimulator`,`macos`]}}}};function h(e){let t=e.AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH?.trim();return t?f.resolve(t):void 0}function g(n){if(!r(n.platform))throw new e(`UNSUPPORTED_PLATFORM`,`Unsupported platform for Apple runner: ${n.platform}`);return t(n)?`macOS`:i(n.target,n.appleOs)}function ne(e){if(!r(e.platform))return{handoff:!1,reason:`non_apple_target`};if(e.kind===`simulator`)return{handoff:!0,lane:`simulator`};if(t(e))return{handoff:!1,reason:`macos_host`};let i=n(e);return i!==`ios`&&i!==`ipados`?{handoff:!1,reason:`physical_non_ios_os`}:e.iosPhysicalDeviceBackend===`xctest`?{handoff:!1,reason:`xctest_backend`}:{handoff:!0,lane:`physical_coredevice`}}function re(e,t){return m[e].sdkName[b(t)]}function _(e){return m[g(e)].derivedBaseName[b(e.kind)]}function v(e){return m[g(e)].xctestrunHints[b(e.kind)]}function y(e){let t=g(e);return t===`macOS`?`platform=macOS,arch=${x()}`:e.kind===`simulator`?`platform=${t} Simulator,id=${e.id}`:`platform=${t},id=${e.id}`}function ie(e){let t=g(e);return t===`macOS`?`platform=macOS,arch=${x()}`:e.kind===`simulator`?`platform=${t} Simulator,id=${e.id}`:`generic/platform=${t}`}function ae(e){let t=g(e);return t===`macOS`?`platform=macOS,arch=${x()}`:e.kind===`simulator`?`generic/platform=${t} Simulator`:`generic/platform=${t}`}function b(e){return e===`simulator`?`simulator`:`device`}function x(){return a()===`arm64`?`arm64`:`x86_64`}const oe=f.join(`apple`,`runner`,`AgentDeviceRunner`),se=f.join(`dist`,`apple`,`runner`,`AgentDeviceRunner`),ce=f.join(`apple`,`snapshot-presentation`),le=f.join(`dist`,`apple`,`snapshot-presentation`),ue=p.map(e=>f.join(`apple`,`snapshot-bridge`,e));function S(e){let t=f.join(e,oe);return d.existsSync(t)?t:f.join(e,se)}function de(e){return f.join(S(e),`AgentDeviceRunner.xcodeproj`)}function fe(e){let t=f.join(e,ce);return d.existsSync(t)?t:f.join(e,le)}const pe=new Set([`.build`,`.swiftpm`,`xcuserdata`]),me=new Set([`.DS_Store`]),he=new Set([`.xcuserstate`]),ge=new Set([`.build`,`.swiftpm`,`SnapshotPresentationConformance`,`Tests`,`xcuserdata`]),C=new Map;function _e(e){let t=[{path:S(e),ignoredDirectoryNames:pe},{path:fe(e),ignoredDirectoryNames:ge}],n=w(t);for(let t of ue){let r=f.join(e,t);d.existsSync(r)&&n.push(r)}n.sort((e,t)=>e.localeCompare(t));let r=ve(e,n),i=JSON.stringify(t.map(({path:e})=>e)),a=C.get(i);if(a?.fileStatsFingerprint===r)return a.sourceFingerprint;let o=u.createHash(`sha256`);for(let t of n){let n=f.relative(e,t);o.update(n),o.update(`\0`),o.update(d.readFileSync(t)),o.update(`\0`)}let s=o.digest(`hex`);return C.set(i,{fileStatsFingerprint:r,sourceFingerprint:s}),s}function ve(e,t){let n=u.createHash(`sha256`);for(let r of t){let t=f.relative(e,r),i=d.statSync(r);n.update(t),n.update(`\0`),n.update(String(i.size)),n.update(`\0`),n.update(String(Math.trunc(i.mtimeMs))),n.update(`\0`)}return n.digest(`hex`)}function w(e){return[...new Set(e.flatMap(({path:e,ignoredDirectoryNames:t})=>T(e,t)))].sort((e,t)=>e.localeCompare(t))}function T(e,t){return d.existsSync(e)?E(e,t,!1):[]}function E(e,t,n){let r=[];for(let i of d.readdirSync(e,{withFileTypes:!0})){let a=f.join(e,i.name);if(i.isDirectory()){if(t.has(i.name))continue;let e=n||O(i.name);r.push(...E(a,t,e))}else if(i.isFile()){if(n?D(i.name):!A(i.name))continue;r.push(a)}}return r}function D(e){return me.has(e)||he.has(f.extname(e))}function O(e){return e.endsWith(`.xcodeproj`)||e.endsWith(`.xcworkspace`)}const k=new Set([`.jpg`,`.json`,`.png`,`.swift`,`.m`,`.h`,`.plist`,`.entitlements`,`.xctestplan`,`.xcconfig`,`.storyboard`,`.xib`,`.xcscheme`,`.xcworkspacedata`]);function A(e){return k.has(f.extname(e))}const j=f.join(te.homedir(),`.agent-device`,`apple-runner`),M=`.agent-device-runner-cache.json`,N=[`-IDEPackageSupportDisableManifestSandbox=1`,`-IDEPackageSupportDisablePluginExecutionSandbox=1`,`ENABLE_USER_SCRIPT_SANDBOXING=NO`],P=`$(inherited) -disable-sandbox -D AGENT_DEVICE_RUNNER_ISOLATION_CANARY`,F=`${P} -D AGENT_DEVICE_RUNNER_UNIT_TESTS`;function I(e){return e?.trim()??``}function L(e=o().env){return I(e.AGENT_DEVICE_IOS_BUNDLE_ID)||I(e.AGENT_DEVICE_IOS_RUNNER_APP_BUNDLE_ID)||`com.callstack.agentdevice.runner`}function R(e=o().env){return I(e.AGENT_DEVICE_IOS_RUNNER_TEST_BUNDLE_ID)||`${L(e)}.uitests`}function ye(e){let t=L(e),n=R(e);return Array.from(new Set([I(e.AGENT_DEVICE_IOS_RUNNER_CONTAINER_BUNDLE_ID),`${n}.xctrunner`,t].filter(e=>e.length>0)))}function be(e,t=s(),n){let r=g(e),{env:i}=o();return{schemaVersion:3,packageVersion:c(t),runnerSourceFingerprint:_e(t),...ee(re(r,e.kind),n?.signal),platformName:r,deviceKind:e.kind,target:e.target??`mobile`,buildDestinationFamily:ae(e),runnerBundleBuildSettings:q(i),runnerSigningBuildSettings:K(i,e.kind===`device`,e),runnerPerformanceBuildSettings:J(),runnerArchBuildSettings:Y(i),runnerSandboxBuildArgs:X(i)}}function xe(e,t){return h(o().env)??z(e,t)}function z(e,t){return f.join(Se(e),B(t))}function Se(e){return f.join(j,`derived`,_(e))}function B(e){return`cache-${u.createHash(`sha256`).update(W(V(e))).digest(`hex`).slice(0,16)}`}function V(e){let{artifacts:t,packageVersion:n,...r}=e;return r}function Ce(e,t){let n=V(e),r=V(t);return[...new Set([...Object.keys(n),...Object.keys(r)])].sort((e,t)=>e.localeCompare(t)).flatMap(e=>{let t=H(n[e]),i=H(r[e]);return t===i?[]:[{key:e,expected:U(t),actual:U(i)}]})}function H(e){return e===void 0?`(absent)`:W(e)}function U(e){return e.length<=300?e:`${e.slice(0,149)}…${e.slice(-149)}`}function W(e){return JSON.stringify(G(e))}function G(e){return Array.isArray(e)?e.map(e=>G(e)):!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,G(t)]))}function we(e){return t(e)||e.kind===`device`?`-maximum-concurrent-test-device-destinations`:`-maximum-concurrent-test-simulator-destinations`}function K(e=o().env,n=!1,r={platform:`apple`}){if(t(r))return[`CODE_SIGNING_ALLOWED=NO`,`CODE_SIGNING_REQUIRED=NO`,`CODE_SIGN_IDENTITY=`,`DEVELOPMENT_TEAM=`];if(!n)return[];let i=e.AGENT_DEVICE_IOS_TEAM_ID?.trim()||``,a=e.AGENT_DEVICE_IOS_SIGNING_IDENTITY?.trim()||``,s=e.AGENT_DEVICE_IOS_PROVISIONING_PROFILE?.trim()||``,c=[`CODE_SIGN_STYLE=${s?`Manual`:`Automatic`}`];return i&&c.push(`DEVELOPMENT_TEAM=${i}`),a&&c.push(`CODE_SIGN_IDENTITY=${a}`),s&&c.push(`PROVISIONING_PROFILE_SPECIFIER=${s}`),c}function q(e=o().env){let t=L(e),n=R(e);return[`AGENT_DEVICE_IOS_RUNNER_APP_BUNDLE_ID=${t}`,`AGENT_DEVICE_IOS_RUNNER_TEST_BUNDLE_ID=${n}`]}function J(){return[`COMPILER_INDEX_STORE_ENABLE=NO`,`ENABLE_CODE_COVERAGE=NO`,`ONLY_ACTIVE_ARCH=YES`,`ENABLE_PREVIEWS=NO`,`ENABLE_DEBUG_DYLIB=NO`]}function Y(e=o().env){let t=e.AGENT_DEVICE_XCUITEST_ARCHS?.trim();return t?[`ARCHS=${t}`]:[]}function Te(e){let t=f.join(e,`Build`,`Intermediates.noindex`);return[`SYMROOT=${f.join(e,`Build`,`Products`)}`,`OBJROOT=${t}`,`SHARED_PRECOMPS_DIR=${f.join(t,`PrecompiledHeaders`)}`]}function X(e=o().env){let t=`OTHER_SWIFT_FLAGS=${Ee(e)}`;return l(e.AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS)?[...N,t,`OTHER_CFLAGS=$(inherited) -D AGENT_DEVICE_RUNNER_UNIT_TESTS`]:[...N,t]}function Ee(e){return l(e.AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS)?F:P}const De=/^\s*Build settings from command line:\s*$/,Oe=/^\s+([A-Z][A-Z0-9_]*)\s*=\s*(.*)$/,Z=/^([A-Z][A-Z0-9_]*)=(.*)$/,Q=/^\s*Command line invocation:\s*$/;function ke(e){let t;try{t=d.readFileSync(e,`utf8`)}catch{return null}let n=t.split(`
|
|
2
2
|
`),r=new Map,i=!1,a=``;for(let[e,t]of n.entries()){if(Q.test(t)){a=n[e+1]??``;continue}if(De.test(t)){i=!0;continue}if(!i)continue;let o=Oe.exec(t);if(!o)break;r.set(o[1],o[2].trimEnd())}return i?{settings:r,invocationLine:a}:null}function $(e){return[...e.runnerBundleBuildSettings,...e.runnerSigningBuildSettings,...e.runnerPerformanceBuildSettings,...e.runnerArchBuildSettings,...e.runnerSandboxBuildArgs]}function Ae(e){let t={};for(let n of $(e)){let e=Z.exec(n);e&&(t[e[1]]=e[2])}return t}function je(e,t){return $(e).filter(e=>!Z.test(e)).filter(e=>!t.includes(e)).map(e=>({key:`(invocation flag)`,expected:e,actual:`absent from the "Command line invocation:" line`}))}function Me(e,t){let n=ke(t);return n?[...Object.entries(Ae(e)).filter(([e,t])=>{let r=n.settings.get(e);return r===void 0?t!==``:r!==t}).map(([e,t])=>({key:e,expected:t,actual:n.settings.get(e)??`(absent)`})),...je(e,n.invocationLine)]:[{key:`(build log)`,expected:`a "Build settings from command line:" block`,actual:`missing or unreadable log`}]}function Ne(t,n){let r=Me(t,n);if(r.length!==0)throw new e(`COMMAND_FAILED`,`The Apple runner build did not use the settings its cache identity records`,{reason:`runner_build_settings_mismatch`,buildLogPath:n,differences:r,hint:`Align the build invocation with the runner cache identity resolvers, or rebuild without the cache.`})}export{y as C,h as S,v as T,K as _,be as a,p as b,Te as c,ye as d,xe as f,X as g,J as h,Ne as i,q as l,we as m,V as n,L as o,z as p,Ce as r,Y as s,M as t,B as u,W as v,ne as w,ie as x,de as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e,l as t}from"./host2.js";import{S as n}from"./runner-cache-metadata.js";import{D as r,S as i,c as a,v as o}from"./runner-lease.js";import s from"node:fs";import c from"node:path";const l=864e5,u=/^cache-[0-9a-f]{16}$/;function d(t=e().env){let n=t.AGENT_DEVICE_IOS_RUNNER_CACHE_KEEP?.trim();return!n||!/^\d+$/.test(n)?3:Number(n)}async function f(t,r=e().env,i=Date.now()){let a=d(r);if(a===0||n(r))return[];let o=m(c.dirname(t)).filter(e=>e.derived!==t).sort((e,t)=>t.lastUsedMs-e.lastUsedMs).slice(a-1).filter(e=>i-e.lastUsedMs>=l),s=[];for(let{derived:e}of o)try{await g(e,i)&&s.push(e)}catch(t){p(e,t)}return s}function p(e,n){t({level:`warn`,phase:`runner_xctestrun_cache_eviction_failed`,data:{derived:e,error:n instanceof Error?n.message:String(n)}})}function m(e){let t;try{t=s.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()&&u.test(e.name)).map(e=>e.name)}catch{return[]}return t.map(t=>{let n=c.join(e,t);return{derived:n,lastUsedMs:h(n)}})}function h(e){try{return s.statSync(r(e)).mtimeMs}catch{return 0}}async function g(e,t){let n;try{n=await o(e,0)}catch{return!1}try{if(t-h(e)<l)return!1;let n=c.basename(e);return!a().some(({xctestrunPath:t,cacheKey:r})=>r===n||t.startsWith(`${e}${c.sep}`))&&(await s.promises.rm(r(e),{force:!0}),await s.promises.rm(e,{recursive:!0,force:!0}),i(`clean`,`stale_cache_evicted`,{derived:e}),!0)}finally{await n().catch(()=>void 0)}}export{f as evictStaleRunnerCaches};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{_ as t}from"./sdk-contracts.js";import{y as n}from"./sdk-batch-runner.js";import{A as r,C as i,H as a,I as o,K as s,L as c,N as l,Ot as u,Q as d,St as f,W as p,Y as m,et as h,gt as g,it as _,lt as v,s as y,st as b,vt as x,w as S}from"./sdk-io.js";import"./diagnostics.js";import{n as C,o as w}from"./file.js";import"./command.js";import{a as T,r as E}from"./version.js";import{s as D}from"./device-shell.js";import{n as O}from"./keyed-lock.js";import{n as k}from"./runtime-slots.js";import"./retry.js";import{n as A,t as ee}from"./boot-diagnostics.js";import{d as j,f as M,l as N,n as P}from"./request.js";import{r as F}from"./host2.js";import{b as I}from"./runner-contract.js";import{D as L}from"./runner-error-classification.js";import{l as R}from"./src8.js";import{i as z}from"./runner-lease.js";import{a as B}from"./runner-lifecycle.js";import{a as V,c as H,i as U,s as W}from"./tool-provider.js";import{t as G}from"./physical-device-control.js";import{n as K,r as q,t as J}from"./runner-owner-state.js";import{d as Y,r as X}from"./simctl.js";const Z={runCmdStreaming:b,runCmdBackground:_,requireExecSuccess:h,isCommandTimeoutError:d,commandDeveloperDir:m,hostEnvironment:()=>{let e=J();if(!e)throw new t(`COMMAND_FAILED`,`Apple runner configuration has no bound host.`,{reason:`apple_runner_host_unbound`});return e},shellQuote:D,emitDiagnostic:f,withDiagnosticTimer:u,retryWithPolicy:s,isEnvTruthy:p,deadlineFromTimeoutMs:(e,t)=>a.fromTimeoutMs(e,t),isProcessAlive:i,isProcessGroupAlive:S,readProcessStartTime:o,readProcessCommand:l,signalPidsBestEffort:c,signalProcessGroupBestEffort:v,findProjectRoot:E,readVersion:T,acquireProcessLock:C,withProcessLock:w,withKeyedLock:O,publishFileSync:g,classifyOwnerLiveness:y,readHostCpuArchSync:r,parseBooleanLiteral:x,isRecord:n,emitRequestProgress:P,getRequestReadOnlyDeadlineMs:N,getRequestSignal:j,isRequestCanceled:M,classifyBootFailure:A,bootFailureHint:ee,runAppleToolCommand:W,runXcrun:H,enableIosSimulatorAppAccessibility:async e=>{let{enableIosSimulatorAppAccessibility:t}=await import(`./ios-simulator-accessibility.js`);await t(e)},readApplePlistJson:V,hasScopedAppleToolProvider:U,buildSimctlArgsForDevice:X,simulatorAddressFor:Y,resolveIosPhysicalDeviceControl:G,leaseOwnerStateDir:q,runnerRuntimeSlot:k,hasDeviceClaimAuthority:e=>K()?.(e)??!1};var Q=e({RUNNER_STARTUP_TIMEOUT_MS:()=>RUNNER_STARTUP_TIMEOUT_MS,cleanupRunnerLeasesForOwner:()=>z,readRunnerSessionLiveness:()=>B,runAppleRunnerCommand:()=>$});F(Z);async function $(e,t,n={}){switch(L(t)){case`none`:case`resolved-modal`:return await R(e,t,n)}let{nameRunnerRequestLitPanel:r}=await import(`./runner-panel.js`);return await R(e,await r(e,t,I(n)),n)}export{Q as n,$ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as e,S as t,Y as n,_ as r}from"./sdk-contracts.js";import{c as i,r as a,u as o}from"./alert-contract.js";import{C as s,m as c}from"./host2.js";import l from"node:crypto";const u=`RUNNER_BUSY`,d=`MAIN_THREAD_TIMEOUT`,ee=`COMMAND_ALREADY_FINISHED`,f=1e3,p=`RUNNER_WEDGED`,m=`APP_NOT_RUNNING`;function te(e){let t=c(e.requestId);return e.signal?!t||t===e.signal?e.signal:AbortSignal.any([t,e.signal]):t}function h(e){return e instanceof DOMException&&e.name===`TimeoutError`}function g(e){return s(e.requestId)||c(e.requestId)?.aborted?!1:e.signal?.aborted===!0&&h(e.signal.reason)}function _(e){let t=c(e.requestId),n=e.signal;if(!n||n===t)return t;let r=new AbortController,i=()=>{h(n.reason)||r.abort(n.reason)};return n.aborted?i():n.addEventListener(`abort`,i,{once:!0}),t?AbortSignal.any([t,r.signal]):r.signal}const v=`SCROLL_KEYBOARD_OCCLUDES_SURFACE`,y=`KEYBOARD_DISMISS_UNAVAILABLE`,b=`KEYBOARD_RETURN_UNAVAILABLE`,x=`HARDWARE_CONTROL_UNAVAILABLE`,S=`IN_APP_BACK_CONTROL_UNAVAILABLE`,C=new Set([`APP_SCREEN_WINDOW_UNRESOLVED`,`APP_SCREEN_UNRESOLVED`,`APP_SCREEN_CAPTURE_UNRENDERABLE`,`APP_SCREEN_OFF_LIT_PANEL`]),w=`NO_TEXT_INPUT_AT_POINT`,T=`TEXT_INPUT_PROBE_UNAVAILABLE`,E=`SYNTHESIZED_GESTURE_NOT_DISPATCHED`,D=`SYNTHESIZED_GESTURE_OUTCOME_UNKNOWN`,O=`BACK_SWIPE_NO_CHANGE`,k=`BACK_SWIPE_UNVERIFIED`,A=`BACK_SWIPE_NOT_DISPATCHED`,j=new Map([[u,{retriable:!0}],[d,{}],[m,{retriable:!0}],[i,{}],[v,{}],[y,{}],[b,{}],[x,{}],[S,{}],[E,{}],[D,{}],[O,{}],[k,{}],[A,{}],...[...C].map(e=>[e,{}])]),M=new Map([[y,`UNSUPPORTED_OPERATION`],[b,`UNSUPPORTED_OPERATION`],[x,`UNSUPPORTED_OPERATION`]]),ne=new Map([[u,`runner_busy`],[d,`runner_main_thread_timeout`],[w,`no_text_input_at_point`],[T,`text_input_probe_unavailable`],[E,`synthesized_gesture_not_dispatched`],[D,`synthesized_gesture_outcome_unknown`],[O,`back_swipe_no_change`],[k,`back_swipe_unverified`],[A,`back_swipe_not_dispatched`],[y,`keyboard_dismiss_unavailable`],[b,`keyboard_return_unavailable`],[x,`hardware_control_unavailable`],[S,`in_app_back_control_unavailable`]]),N=new Map([[`INVALID_ARGS`,`no`],[`ELEMENT_NOT_FOUND`,`no`],[`ELEMENT_OFFSCREEN`,`no`],[`AMBIGUOUS_MATCH`,`no`],[u,`no`],[p,`no`],[m,`no`],[`OBSERVATION_UNAVAILABLE`,`no`],[v,`no`],[i,`no`],[w,`no`],[T,`no`],[a,`no`],[o,`no`],[E,`no`],[A,`no`],[y,`no`],[x,`no`],[S,`no`],...[...C].map(e=>[e,`no`])]);function P(e){let t=e===void 0?void 0:j.get(e),r=e===void 0?void 0:M.get(e),i=e===void 0?void 0:ne.get(e);return Object.freeze({code:t?r??`COMMAND_FAILED`:n(e),details:Object.freeze({runnerErrorCode:e,...t?.retriable===!0?{retriable:!0}:{},...i===void 0?{}:{reason:i},dispatched:(e===void 0?void 0:N.get(e))??`unknown`})})}function F(e){let t;try{t=JSON.parse(e)}catch{throw new r(`COMMAND_FAILED`,`Invalid runner response`,{text:e})}if(!I(t))throw new r(`COMMAND_FAILED`,`Invalid runner response`,{text:e});return t}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function L(e){return e.ok===!0}function R(e){return!e.data||typeof e.data!=`object`||Array.isArray(e.data)?{}:e.data}function z(e,t){let n=B(e.error?.code),i=typeof e.error?.message==`string`?e.error.message:void 0,a=typeof e.error?.hint==`string`?e.error.hint:void 0,o=P(n);return new r(o.code,i??`Runner error`,{runner:e,...o.details,xcodebuild:{exitCode:1,stdout:``,stderr:``},hint:a,logPath:t})}function B(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function V(e){return e.command===`status`||e.commandId?.trim()?e:{...e,commandId:H()}}function H(){return`runner-${l.randomUUID()}`}function U(e){if(s(e))throw t()}const W=`runner_token_unsupported`;function G(){return l.randomBytes(24).toString(`base64url`)}function K(e,t){return{AGENT_DEVICE_RUNNER_PORT:String(e.port),AGENT_DEVICE_RUNNER_TOKEN:e.token,...t?{AGENT_DEVICE_RUNNER_BIND_IP:t}:{}}}function q(e){return{"Content-Type":`application/json`,"X-Agent-Device-Runner-Token":e.token}}function J(e){if(e.headers.get(`X-Agent-Device-Runner-Auth`)===`required`)return e;throw new r(`COMMAND_FAILED`,`XCTest runner does not require a listener token`,{reason:W,hint:`Rebuild the runner with this agent-device version. A configured iosXctestrunFile must come from the same version.`})}const Y=[`tap`,`doubleTap`,`longPress`];function X(e){return typeof e==`string`&&Y.includes(e)}function Z(t,n){return e(new r(`INVALID_ARGS`,t,{...n,reason:`runner_sequence_invalid`}),`no`)}function Q(e,t,n){return Z(n,{stepIndex:e,kind:typeof t==`string`?t:void 0})}function re(e){if(!Array.isArray(e)||e.length===0)throw Z(`sequence requires at least one step`,{stepCount:Array.isArray(e)?e.length:0});if(e.length>20)throw Z(`sequence accepts at most 20 steps, received ${e.length}`,{stepCount:e.length,maxSteps:20});e.forEach((e,t)=>ie(e,t))}function ie(e,t){if(!X(e.kind))throw Q(t,e.kind,`sequence step ${t} has unsupported kind "${String(e.kind)}"; allowed: ${Y.join(`, `)}`);if(!Number.isFinite(e.x)||!Number.isFinite(e.y))throw Q(t,e.kind,`sequence step ${t} (${e.kind}) requires finite x and y`);e.durationMs!==void 0&&$(e.durationMs,0,1e4,t,e.kind,`durationMs`),e.pauseMs!==void 0&&$(e.pauseMs,0,1e4,t,e.kind,`pauseMs`)}function $(e,t,n,r,i,a){if(!Number.isFinite(e)||e<t||e>n)throw Q(r,i,`sequence step ${r} (${i}) ${a} must be between ${t} and ${n}`)}function ae(e,t){return re(e),{command:`sequence`,steps:e,appBundleId:t}}function oe(e){let t=le(e.sequenceResults),n=typeof e.completedSteps==`number`&&Number.isFinite(e.completedSteps)?e.completedSteps:t.filter(e=>e.ok).length,r=t.findIndex(e=>!e.ok),i=typeof e.failedStepIndex==`number`&&Number.isFinite(e.failedStepIndex)?e.failedStepIndex:r>=0?r:void 0;if(i!==void 0)throw se(t,n,i);let a=e.sequenceOrientation;return{results:t,completedSteps:n,failedStepIndex:i,...a===1||a===2||a===3||a===4?{sequenceOrientation:a}:{}}}function se(e,t,i){let a=e[i],o=a?.kind??`step`,s=a?.errorMessage??`sequence step ${i} (${o}) failed`,c=n(a?.errorCode),l=P(a?.errorCode),u=l.code!==c;return new r(u?l.code:c,s,{...u?{runnerErrorCode:a?.errorCode,...l.details.reason===void 0?{}:{reason:l.details.reason}}:{},...ce(a?.errorCode)?{dispatched:l.details.dispatched}:{},failedStepIndex:i,failedStepKind:o,completedSteps:t,sequenceResults:e,hint:a?.errorHint??`Run snapshot -i to inspect the current UI, then continue from the observed state.`})}function ce(e){return e!==void 0&&(N.has(e)||e===D)}function le(e){return Array.isArray(e)?e.map(e=>{let t=e??{};return{ok:t.ok===!0,kind:typeof t.kind==`string`?t.kind:`unknown`,errorCode:typeof t.errorCode==`string`?t.errorCode:void 0,errorMessage:typeof t.errorMessage==`string`?t.errorMessage:void 0,errorHint:typeof t.errorHint==`string`?t.errorHint:void 0,gestureStartUptimeMs:typeof t.gestureStartUptimeMs==`number`?t.gestureStartUptimeMs:void 0,gestureEndUptimeMs:typeof t.gestureEndUptimeMs==`number`?t.gestureEndUptimeMs:void 0}}):[]}export{q as C,K as S,oe as _,W as a,te as b,U as c,g as d,P as f,G as g,L as h,f as i,z as l,h as m,d as n,p as o,F as p,u as r,v as s,ee as t,ae as u,R as v,V as w,_ as x,J as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{w as t}from"./sdk-device.js";import{F as n}from"./host2.js";import{r}from"./runner-error-classification.js";const i=`Developer mode is disabled for Apple development tools`;async function a(e){if(!t(e)||e.kind!==`device`)return;let r=await n(`DevToolsSecurity`,[`-status`],{allowFailure:!0,timeoutMs:2e3}),i=`${r.stdout}\n${r.stderr}`;if(/developer mode is currently disabled/i.test(i))throw o(i.trim())}function o(t){let n=new e(`COMMAND_FAILED`,i,{devToolsSecurityStatus:t}),{reason:a,hint:o}=r(n);return new e(`COMMAND_FAILED`,i,{reason:a,hint:o,devToolsSecurityStatus:t})}export{a as assertDevToolsSecurityForIosRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e}from"./sdk-contracts.js";import{w as t}from"./sdk-device.js";import{N as n}from"./host2.js";import"./runner-error-classification.js";async function r(r,a){if(!t(r)||r.kind!==`device`)return;let o=await n(r).readDeviceReadiness(r,a.budgetMs,a.signal);if(a.signal?.throwIfAborted(),!o.available)return;let s=i(o);if(s)throw new e(`COMMAND_FAILED`,s.message,{reason:s.reason,hint:s.hint,deviceId:r.id,developerMode:o.developerMode,developerDiskImage:o.developerDiskImage});return{developerMode:o.developerMode,developerDiskImage:o.developerDiskImage,developerDiskImageHint:o.remedies.developerDiskImageUnavailable}}function i(e){if(e.developerMode===`disabled`)return{reason:`device_developer_mode_disabled`,message:`The iOS device reports that Developer Mode is turned off`,hint:e.remedies.developerModeOff}}export{r as preflightIosRunnerDeviceReadiness};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{U as e}from"./host2.js";import{t}from"./runner-toolchain-identity.js";function n(t){return e(t).simulatorSetPath}function r(t,n){let r=e(t),i=e(n);return r.udid===i.udid&&r.simulatorSetPath===i.simulatorSetPath}function i(e,t){let r=n(e);return r===void 0?[`-destination`,t]:[`-destination`,t,`-DVTSimulatorSetLocation=${r}`]}function a(e){let r=n(e);if(r===void 0)return{};let i=t();return i===void 0?{simulatorSetPath:r}:{simulatorSetPath:r,xcodeVersion:i}}function o(e){return{...a(e),simulatorUdid:e.id}}export{i as a,n as i,o as n,a as r,r as t};
|