@yielded/agent-platform-cloudflare 0.1.0-beta.168 → 0.1.0-beta.170
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/dist/{Alarm-DxODgAZZ.mjs → Alarm-BMEAZo3p.mjs} +3 -1
- package/dist/Alarm-BMEAZo3p.mjs.map +1 -0
- package/dist/Alarm.d.mts +2 -0
- package/dist/Alarm.mjs +1 -1
- package/dist/{BrowserUse-AstK0jKX.mjs → BrowserUse-Bc2JdLW2.mjs} +84 -23
- package/dist/BrowserUse-Bc2JdLW2.mjs.map +1 -0
- package/dist/BrowserUse.mjs +1 -1
- package/dist/CloudflareScheduling.mjs +2 -2
- package/dist/CloudflareSubscriptions.mjs +2 -2
- package/dist/{CloudflareThreadClient-CZm0TvUe.mjs → CloudflareThreadClient-CLZpN9zU.mjs} +2 -2
- package/dist/{CloudflareThreadClient-CZm0TvUe.mjs.map → CloudflareThreadClient-CLZpN9zU.mjs.map} +1 -1
- package/dist/{CloudflareThreadClient-QsVzLGGZ.d.mts → CloudflareThreadClient-muBb_YIO.d.mts} +130 -130
- package/dist/CloudflareThreadClient.d.mts +1 -1
- package/dist/CloudflareThreadClient.mjs +1 -1
- package/dist/{ThreadObject-C0vrcDrw.mjs → ThreadObject-CgXZMlr4.mjs} +4 -4
- package/dist/{ThreadObject-C0vrcDrw.mjs.map → ThreadObject-CgXZMlr4.mjs.map} +1 -1
- package/dist/{ThreadObject-7s5XnlH-.d.mts → ThreadObject-o2IUA-N4.d.mts} +37 -37
- package/dist/ThreadObject.d.mts +1 -1
- package/dist/ThreadObject.mjs +1 -1
- package/dist/WakeScheduler.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/{prepared-admission-3UUq0zth.mjs → prepared-admission-B61A7y6O.mjs} +2 -2
- package/dist/{prepared-admission-3UUq0zth.mjs.map → prepared-admission-B61A7y6O.mjs.map} +1 -1
- package/package.json +1 -1
- package/src/Alarm.ts +2 -0
- package/src/BrowserUse.ts +58 -8
- package/src/internal/browser-dom.ts +50 -9
- package/src/internal/browser-jev-dom.ts +24 -6
- package/dist/Alarm-DxODgAZZ.mjs.map +0 -1
- package/dist/BrowserUse-AstK0jKX.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DurableObjectContext, ThreadObjectIdentity, ThreadObjectNamespace, ThreadObjectPlacement } from "./CloudflareBindings.mjs";
|
|
2
2
|
import { l as CloudflarePlatformConfigError, s as CloudflareDurableRuntimeConfig, t as AdmissionLimitExceeded } from "./CloudflareConfig-C9MvPbX8.mjs";
|
|
3
3
|
import { DurableAlarmError, DurableAlarmService, MaintenancePassFailure, ThreadMaintenance, ThreadMaintenanceAlarm, ThreadMaintenanceFailpoint, ThreadMaintenanceFailpointHandler, ThreadMutationGate, ThreadPublication, ThreadRecoveryEvents } from "./Alarm.mjs";
|
|
4
|
-
import { T as SubmitRequest, g as HostProtocolError } from "./CloudflareThreadClient-
|
|
4
|
+
import { T as SubmitRequest, g as HostProtocolError } from "./CloudflareThreadClient-muBb_YIO.mjs";
|
|
5
5
|
import { AgentRegistration } from "@yielded/agent/agent-registration";
|
|
6
6
|
import { ApprovalSuspensionError, DurableAgentRuntime, DurableRuntimeConfig, RecoveryBlocked, RecoveryReport } from "@yielded/agent/durable-agent-runtime";
|
|
7
7
|
import { SubmissionId, ThreadId } from "@yielded/agent/identifiers";
|
|
@@ -736,10 +736,43 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
736
736
|
} | {
|
|
737
737
|
readonly _tag: "AdminFailed";
|
|
738
738
|
readonly failure: {
|
|
739
|
+
readonly _tag: "DurableAlarmError";
|
|
740
|
+
readonly operation: string;
|
|
741
|
+
readonly message: string;
|
|
742
|
+
readonly cause?: Schema.Json | undefined;
|
|
743
|
+
} | {
|
|
744
|
+
readonly _tag: "HostProtocolError";
|
|
745
|
+
readonly message: string;
|
|
746
|
+
} | {
|
|
739
747
|
readonly _tag: "LedgerError";
|
|
740
748
|
readonly operation: string;
|
|
741
749
|
readonly message: string;
|
|
742
750
|
readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
|
|
751
|
+
} | {
|
|
752
|
+
readonly _tag: "AdmissionPolicyError";
|
|
753
|
+
readonly reason: "occupied" | "refused" | "unavailable";
|
|
754
|
+
readonly code: string;
|
|
755
|
+
readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
|
|
756
|
+
readonly stack?: string | undefined;
|
|
757
|
+
} | {
|
|
758
|
+
readonly _tag: "AppendConflict";
|
|
759
|
+
readonly threadId: string;
|
|
760
|
+
readonly batchId: string;
|
|
761
|
+
readonly reason: "batch-content" | "record-identity" | "stale-command" | "tail";
|
|
762
|
+
readonly actualTailSequence?: number | undefined;
|
|
763
|
+
} | {
|
|
764
|
+
readonly _tag: "DigestError";
|
|
765
|
+
readonly message: string;
|
|
766
|
+
readonly cause?: Schema.Json | undefined;
|
|
767
|
+
} | {
|
|
768
|
+
readonly _tag: "DurableRuntimeFailpointError";
|
|
769
|
+
readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-canonical-append" | "compaction:before-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "policy:after-reservation-append" | "policy:before-reservation-append" | "resolve:after-intent" | "run:after-duration-append" | "run:after-start-append" | "run:before-duration-append" | "run:before-start-append" | "step:after-step-append" | "subagent:after-admit" | "subagent:after-child-abort-intent" | "subagent:after-child-ready" | "subagent:after-join-append" | "subagent:after-release" | "subagent:after-release-pending" | "subagent:after-request-append" | "subagent:after-reserve" | "subagent:after-sibling-settle" | "subagent:after-start-append" | "subagent:after-suspend" | "subagent:before-join-append" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:before-publication" | "tools:after-dispatch-fence" | "tools:after-unavailable-append" | "tools:before-dispatch-fence" | "tools:before-unavailable-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append" | "update:after-canonical-append" | "update:after-delivery-insert" | "update:before-canonical-append" | "update:before-delivery-insert" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "worker:after-stop-append" | "worker:after-stop-seal" | "worker:after-subtree-append" | "worker:before-completion-append" | "worker:before-origin-append" | "worker:before-report-append" | "worker:before-report-delivery" | "worker:before-source-append" | "worker:before-stop-append" | "worker:before-stop-seal" | "worker:before-subtree-append";
|
|
770
|
+
} | {
|
|
771
|
+
readonly _tag: "OwnershipLost";
|
|
772
|
+
readonly submissionId: string;
|
|
773
|
+
} | {
|
|
774
|
+
readonly _tag: "ThreadNotMaterialized";
|
|
775
|
+
readonly threadId: string;
|
|
743
776
|
} | {
|
|
744
777
|
readonly _tag: "ThreadStoreError";
|
|
745
778
|
readonly operation: string;
|
|
@@ -753,27 +786,15 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
753
786
|
readonly sequence?: number | undefined;
|
|
754
787
|
} | undefined;
|
|
755
788
|
} | {
|
|
756
|
-
readonly _tag: "
|
|
757
|
-
readonly threadId: string;
|
|
758
|
-
} | {
|
|
759
|
-
readonly _tag: "AppendConflict";
|
|
760
|
-
readonly threadId: string;
|
|
761
|
-
readonly batchId: string;
|
|
762
|
-
readonly reason: "batch-content" | "record-identity" | "stale-command" | "tail";
|
|
763
|
-
readonly actualTailSequence?: number | undefined;
|
|
764
|
-
} | {
|
|
765
|
-
readonly _tag: "OwnershipLost";
|
|
789
|
+
readonly _tag: "SettlementConflict";
|
|
766
790
|
readonly submissionId: string;
|
|
791
|
+
readonly existingOutcome: "aborted" | "completed" | "failed";
|
|
767
792
|
} | {
|
|
768
793
|
readonly _tag: "OperationDenied";
|
|
769
794
|
readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
|
|
770
795
|
readonly reason: string;
|
|
771
796
|
readonly threadId?: string | undefined;
|
|
772
797
|
readonly submissionId?: string | undefined;
|
|
773
|
-
} | {
|
|
774
|
-
readonly _tag: "SettlementConflict";
|
|
775
|
-
readonly submissionId: string;
|
|
776
|
-
readonly existingOutcome: "aborted" | "completed" | "failed";
|
|
777
798
|
} | {
|
|
778
799
|
readonly _tag: "WorkDiscoveryUnavailable";
|
|
779
800
|
readonly threadId: string;
|
|
@@ -798,34 +819,13 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
798
819
|
readonly sequence?: number | undefined;
|
|
799
820
|
} | undefined;
|
|
800
821
|
};
|
|
801
|
-
} | {
|
|
802
|
-
readonly _tag: "AdmissionPolicyError";
|
|
803
|
-
readonly reason: "occupied" | "refused" | "unavailable";
|
|
804
|
-
readonly code: string;
|
|
805
|
-
readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
|
|
806
|
-
readonly stack?: string | undefined;
|
|
807
822
|
} | {
|
|
808
823
|
readonly _tag: "ApprovalSuspensionError";
|
|
809
824
|
readonly cause: Schema.Json;
|
|
810
|
-
} | {
|
|
811
|
-
readonly _tag: "DigestError";
|
|
812
|
-
readonly message: string;
|
|
813
|
-
readonly cause?: Schema.Json | undefined;
|
|
814
|
-
} | {
|
|
815
|
-
readonly _tag: "DurableRuntimeFailpointError";
|
|
816
|
-
readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-canonical-append" | "compaction:before-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "policy:after-reservation-append" | "policy:before-reservation-append" | "resolve:after-intent" | "run:after-duration-append" | "run:after-start-append" | "run:before-duration-append" | "run:before-start-append" | "step:after-step-append" | "subagent:after-admit" | "subagent:after-child-abort-intent" | "subagent:after-child-ready" | "subagent:after-join-append" | "subagent:after-release" | "subagent:after-release-pending" | "subagent:after-request-append" | "subagent:after-reserve" | "subagent:after-sibling-settle" | "subagent:after-start-append" | "subagent:after-suspend" | "subagent:before-join-append" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:before-publication" | "tools:after-dispatch-fence" | "tools:after-unavailable-append" | "tools:before-dispatch-fence" | "tools:before-unavailable-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append" | "update:after-canonical-append" | "update:after-delivery-insert" | "update:before-canonical-append" | "update:before-delivery-insert" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "worker:after-stop-append" | "worker:after-stop-seal" | "worker:after-subtree-append" | "worker:before-completion-append" | "worker:before-origin-append" | "worker:before-report-append" | "worker:before-report-delivery" | "worker:before-source-append" | "worker:before-stop-append" | "worker:before-stop-seal" | "worker:before-subtree-append";
|
|
817
825
|
} | {
|
|
818
826
|
readonly _tag: "RunJournalError";
|
|
819
827
|
readonly message: string;
|
|
820
828
|
readonly cause?: Schema.Json | undefined;
|
|
821
|
-
} | {
|
|
822
|
-
readonly _tag: "DurableAlarmError";
|
|
823
|
-
readonly operation: string;
|
|
824
|
-
readonly message: string;
|
|
825
|
-
readonly cause?: Schema.Json | undefined;
|
|
826
|
-
} | {
|
|
827
|
-
readonly _tag: "HostProtocolError";
|
|
828
|
-
readonly message: string;
|
|
829
829
|
} | {
|
|
830
830
|
readonly _tag: "RetryRefused";
|
|
831
831
|
readonly submissionId: string;
|
|
@@ -888,4 +888,4 @@ interface Class<EventServices = never> {
|
|
|
888
888
|
declare const make: <ApplicationServices, ApplicationError, EventServices = never, EventLayerError = never, AlarmServices = never, AlarmError = never>(applicationLayer: Layer.Layer<CloudflareDurableRuntimeServices | ApplicationServices, ApplicationError, CloudflareBootstrapServices | ThreadMaintenanceAlarm | NoInfer<AlarmServices> | DurableObjectState$1.DurableObjectState | WorkerEnvironment | DurableObjectContext | ThreadObjectNamespace>, options: Options<ApplicationServices, EventServices, EventLayerError, AlarmServices, AlarmError>) => Class<ApplicationServices | EventServices | AlarmServices>;
|
|
889
889
|
//#endregion
|
|
890
890
|
export { ThreadHostMutation as A, make as C, CloudflareDurableRuntimeInitializationError as D, CloudflareBootstrapServices as E, layerHostConfig as F, layerInHost as I, ThreadPublicationOptions as M, layer$1 as N, CloudflareDurableRuntimeOptions as O, layerConfig as P, handleRpc as S, submit as T, decodeAdminResponse as _, AdminVerifyRequest as a, decodeRetryCommand as b, Instance as c, RetryExecuted as d, ThreadObject_d_exports as f, decodeAdminExplainRequest as g, alarms as h, AdminResponse as i, ThreadObjectPorts as j, CloudflareDurableRuntimeServices as k, ObligationsScanned as l, VerifiedIntegrity as m, AdminFailed as n, Class as o, ThreadRpcOperation as p, AdminFailure as r, ExplainedRecovery as s, AdminExplainRequest as t, Options as u, decodeAdminVerifyRequest as v, portCall as w, encodeAdminResponse as x, decodeObligationThresholds as y };
|
|
891
|
-
//# sourceMappingURL=ThreadObject-
|
|
891
|
+
//# sourceMappingURL=ThreadObject-o2IUA-N4.d.mts.map
|
package/dist/ThreadObject.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ThreadHostMutation, C as make, D as CloudflareDurableRuntimeInitializationError, E as CloudflareBootstrapServices, F as layerHostConfig, I as layerInHost, M as ThreadPublicationOptions, N as layer, O as CloudflareDurableRuntimeOptions, P as layerConfig, S as handleRpc, T as submit, _ as decodeAdminResponse, a as AdminVerifyRequest, b as decodeRetryCommand, c as Instance, d as RetryExecuted, g as decodeAdminExplainRequest, h as alarms, i as AdminResponse, j as ThreadObjectPorts, k as CloudflareDurableRuntimeServices, l as ObligationsScanned, m as VerifiedIntegrity, n as AdminFailed, o as Class, p as ThreadRpcOperation, r as AdminFailure, s as ExplainedRecovery, t as AdminExplainRequest, u as Options, v as decodeAdminVerifyRequest, w as portCall, x as encodeAdminResponse, y as decodeObligationThresholds } from "./ThreadObject-
|
|
1
|
+
import { A as ThreadHostMutation, C as make, D as CloudflareDurableRuntimeInitializationError, E as CloudflareBootstrapServices, F as layerHostConfig, I as layerInHost, M as ThreadPublicationOptions, N as layer, O as CloudflareDurableRuntimeOptions, P as layerConfig, S as handleRpc, T as submit, _ as decodeAdminResponse, a as AdminVerifyRequest, b as decodeRetryCommand, c as Instance, d as RetryExecuted, g as decodeAdminExplainRequest, h as alarms, i as AdminResponse, j as ThreadObjectPorts, k as CloudflareDurableRuntimeServices, l as ObligationsScanned, m as VerifiedIntegrity, n as AdminFailed, o as Class, p as ThreadRpcOperation, r as AdminFailure, s as ExplainedRecovery, t as AdminExplainRequest, u as Options, v as decodeAdminVerifyRequest, w as portCall, x as encodeAdminResponse, y as decodeObligationThresholds } from "./ThreadObject-o2IUA-N4.mjs";
|
|
2
2
|
export { AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, type CloudflareBootstrapServices as BootstrapServices, Class, ExplainedRecovery, type CloudflareDurableRuntimeInitializationError as InitializationError, Instance, ObligationsScanned, Options, type ThreadPublicationOptions as PublicationOptions, RetryExecuted, type CloudflareDurableRuntimeOptions as RuntimeOptions, type CloudflareDurableRuntimeServices as Services, type ThreadHostMutation, ThreadObjectPorts, ThreadRpcOperation, VerifiedIntegrity, alarms, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeObligationThresholds, decodeRetryCommand, encodeAdminResponse, handleRpc, layer, layerConfig, layerHostConfig, layerInHost, make, portCall, submit };
|
package/dist/ThreadObject.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as ThreadObjectPorts, D as layerInHost, E as layerHostConfig, S as submit, T as layerConfig, _ as decodeRetryCommand, a as AdminVerifyRequest, b as make, c as RetryExecuted, d as VerifiedIntegrity, f as alarms, g as decodeObligationThresholds, h as decodeAdminVerifyRequest, i as AdminResponse, m as decodeAdminResponse, n as AdminFailed, o as ExplainedRecovery, p as decodeAdminExplainRequest, r as AdminFailure, s as ObligationsScanned, t as AdminExplainRequest, u as ThreadRpcOperation, v as encodeAdminResponse, w as layer, x as portCall, y as handleRpc } from "./ThreadObject-
|
|
1
|
+
import { C as ThreadObjectPorts, D as layerInHost, E as layerHostConfig, S as submit, T as layerConfig, _ as decodeRetryCommand, a as AdminVerifyRequest, b as make, c as RetryExecuted, d as VerifiedIntegrity, f as alarms, g as decodeObligationThresholds, h as decodeAdminVerifyRequest, i as AdminResponse, m as decodeAdminResponse, n as AdminFailed, o as ExplainedRecovery, p as decodeAdminExplainRequest, r as AdminFailure, s as ObligationsScanned, t as AdminExplainRequest, u as ThreadRpcOperation, v as encodeAdminResponse, w as layer, x as portCall, y as handleRpc } from "./ThreadObject-CgXZMlr4.mjs";
|
|
2
2
|
export { AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, ExplainedRecovery, ObligationsScanned, RetryExecuted, ThreadObjectPorts, ThreadRpcOperation, VerifiedIntegrity, alarms, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeObligationThresholds, decodeRetryCommand, encodeAdminResponse, handleRpc, layer, layerConfig, layerHostConfig, layerInHost, make, portCall, submit };
|
package/dist/WakeScheduler.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { ThreadObjectNamespace, ThreadObjectPlacement, callThreadObject } from "./CloudflareBindings.mjs";
|
|
3
3
|
import { r as safeCauseMessage } from "./boundary-BguazVkh.mjs";
|
|
4
|
-
import { r as DurableAlarmService } from "./Alarm-
|
|
4
|
+
import { r as DurableAlarmService } from "./Alarm-BMEAZo3p.mjs";
|
|
5
5
|
import "@yielded/agent/identifiers";
|
|
6
6
|
import { WakeScheduler, makeWakeSubscriptionHub } from "@yielded/agent/wake-scheduler";
|
|
7
7
|
import { Effect, Layer, PubSub, Schema, Stream } from "effect";
|
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ import { t as CloudflareCodeMode_d_exports } from "./CloudflareCodeMode.mjs";
|
|
|
10
10
|
import { t as CloudflareMemory_d_exports } from "./CloudflareMemory.mjs";
|
|
11
11
|
import { t as CloudflareScheduling_d_exports } from "./CloudflareScheduling.mjs";
|
|
12
12
|
import { t as CloudflareSubscriptions_d_exports } from "./CloudflareSubscriptions.mjs";
|
|
13
|
-
import { p as CloudflareThreadClient_d_exports } from "./CloudflareThreadClient-
|
|
14
|
-
import { f as ThreadObject_d_exports } from "./ThreadObject-
|
|
13
|
+
import { p as CloudflareThreadClient_d_exports } from "./CloudflareThreadClient-muBb_YIO.mjs";
|
|
14
|
+
import { f as ThreadObject_d_exports } from "./ThreadObject-o2IUA-N4.mjs";
|
|
15
15
|
import { t as WakeScheduler_d_exports } from "./WakeScheduler.mjs";
|
|
16
16
|
export { Alarm_d_exports as Alarm, BrowserCredentials_d_exports as BrowserCredentials, BrowserSession_d_exports as BrowserSession, BrowserUse_d_exports as BrowserUse, CloudflareAiGateway_d_exports as CloudflareAiGateway, CloudflareBindings_d_exports as CloudflareBindings, CloudflareBrowser_d_exports as CloudflareBrowser, CloudflareCodeMode_d_exports as CloudflareCodeMode, CloudflareConfig_d_exports as CloudflareConfig, CloudflareMemory_d_exports as CloudflareMemory, CloudflareScheduling_d_exports as CloudflareScheduling, CloudflareSubscriptions_d_exports as CloudflareSubscriptions, CloudflareThreadClient_d_exports as CloudflareThreadClient, ThreadObject_d_exports as ThreadObject, WakeScheduler_d_exports as WakeScheduler };
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as CloudflareBindings_exports } from "./CloudflareBindings.mjs";
|
|
2
2
|
import { t as CloudflareConfig_exports } from "./CloudflareConfig.mjs";
|
|
3
|
-
import { t as Alarm_exports } from "./Alarm-
|
|
3
|
+
import { t as Alarm_exports } from "./Alarm-BMEAZo3p.mjs";
|
|
4
4
|
import { t as CloudflareBrowser_exports } from "./CloudflareBrowser-Vt8qTdYW.mjs";
|
|
5
5
|
import { t as CloudflareCodeMode_exports } from "./CloudflareCodeMode.mjs";
|
|
6
6
|
import { t as CloudflareMemory_exports } from "./CloudflareMemory.mjs";
|
|
7
|
-
import { o as CloudflareThreadClient_exports } from "./CloudflareThreadClient-
|
|
7
|
+
import { o as CloudflareThreadClient_exports } from "./CloudflareThreadClient-CLZpN9zU.mjs";
|
|
8
8
|
import { t as CloudflareScheduling_exports } from "./CloudflareScheduling.mjs";
|
|
9
9
|
import { t as CloudflareSubscriptions_exports } from "./CloudflareSubscriptions.mjs";
|
|
10
10
|
import { t as WakeScheduler_exports } from "./WakeScheduler.mjs";
|
|
11
|
-
import { l as ThreadObject_exports } from "./ThreadObject-
|
|
11
|
+
import { l as ThreadObject_exports } from "./ThreadObject-CgXZMlr4.mjs";
|
|
12
12
|
import { t as CloudflareAiGateway_exports } from "./CloudflareAiGateway.mjs";
|
|
13
13
|
import { t as BrowserCredentials_exports } from "./BrowserCredentials.mjs";
|
|
14
14
|
import { i as BrowserSession_exports } from "./BrowserSession-BfNmyayH.mjs";
|
|
15
|
-
import { t as BrowserUse_exports } from "./BrowserUse-
|
|
15
|
+
import { t as BrowserUse_exports } from "./BrowserUse-Bc2JdLW2.mjs";
|
|
16
16
|
export { Alarm_exports as Alarm, BrowserCredentials_exports as BrowserCredentials, BrowserSession_exports as BrowserSession, BrowserUse_exports as BrowserUse, CloudflareAiGateway_exports as CloudflareAiGateway, CloudflareBindings_exports as CloudflareBindings, CloudflareBrowser_exports as CloudflareBrowser, CloudflareCodeMode_exports as CloudflareCodeMode, CloudflareConfig_exports as CloudflareConfig, CloudflareMemory_exports as CloudflareMemory, CloudflareScheduling_exports as CloudflareScheduling, CloudflareSubscriptions_exports as CloudflareSubscriptions, CloudflareThreadClient_exports as CloudflareThreadClient, ThreadObject_exports as ThreadObject, WakeScheduler_exports as WakeScheduler };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CloudflareThreadClient } from "./CloudflareThreadClient-
|
|
1
|
+
import { a as CloudflareThreadClient } from "./CloudflareThreadClient-CLZpN9zU.mjs";
|
|
2
2
|
import "@yielded/agent/durable-agent-runtime";
|
|
3
3
|
import "@yielded/agent/identifiers";
|
|
4
4
|
import { Effect, Layer } from "effect";
|
|
@@ -70,4 +70,4 @@ const cloudflareScheduledInputAdmissionLayer = Layer.effect(ScheduledInputAdmiss
|
|
|
70
70
|
//#endregion
|
|
71
71
|
export { cloudflareScheduledInputAdmissionLayer as n, cloudflarePreparedInputAdmissionLayer as t };
|
|
72
72
|
|
|
73
|
-
//# sourceMappingURL=prepared-admission-
|
|
73
|
+
//# sourceMappingURL=prepared-admission-B61A7y6O.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepared-admission-
|
|
1
|
+
{"version":3,"file":"prepared-admission-B61A7y6O.mjs","names":[],"sources":["../src/internal/prepared-admission.ts"],"sourcesContent":["import { type DurableSubmitAgent } from \"@yielded/agent/durable-agent-runtime\";\nimport { type AgentId } from \"@yielded/agent/identifiers\";\nimport { PreparedInputAdmission } from \"@yielded/agent/prepared-input-admission\";\nimport { PersistedJson } from \"@yielded/agent/records\";\nimport {\n type ScheduledEnvelope,\n ScheduledInputAdmission,\n ScheduledInputRetryable,\n ScheduledInputRefused,\n ScheduleStorageError,\n} from \"@yielded/agent/schedule\";\nimport { type PreparedInput } from \"@yielded/agent/subscription\";\nimport { Effect, Layer } from \"effect\";\n\nimport { CloudflareThreadClient, type ThreadClientError } from \"../CloudflareThreadClient.ts\";\n\nconst passthroughAgent = (agentId: AgentId): DurableSubmitAgent<typeof PersistedJson> => ({\n definition: { id: agentId, input: PersistedJson },\n});\n\n/** Ordinary prepared admission through one freshly addressed Thread Object call. */\nexport const cloudflarePreparedInputAdmissionLayer: Layer.Layer<\n PreparedInputAdmission,\n never,\n CloudflareThreadClient\n> = Layer.effect(\n PreparedInputAdmission,\n Effect.gen(function* () {\n const client = yield* CloudflareThreadClient;\n\n return PreparedInputAdmission.of({\n submissionStatus: (receipt) =>\n client\n .submissionStatus(receipt)\n .pipe(Effect.mapError(() => ScheduledInputRetryable.make({ reason: \"storage\" }))),\n submit: (envelope) =>\n client\n .submit(passthroughAgent(envelope.agentId), envelope.input, {\n threadId: envelope.threadId,\n principal: envelope.deliveryPrincipal,\n idempotencyKey: envelope.admissionKey,\n ...(envelope.admissionGroup === undefined\n ? {}\n : { admissionGroup: envelope.admissionGroup }),\n ...(envelope.admissionFence === undefined\n ? {}\n : { admissionFence: envelope.admissionFence }),\n ...(envelope.workerAdmission === undefined\n ? {}\n : { workerAdmission: envelope.workerAdmission }),\n ...(envelope.messageAdmission === undefined\n ? {}\n : { messageAdmission: envelope.messageAdmission }),\n definitions: envelope.definitions,\n })\n .pipe(\n Effect.catchTags({\n AdmissionConflict: () =>\n ScheduleStorageError.make({ operation: \"prepared admission\", reason: \"corrupt\" }),\n AdmissionLimitExceeded: () => ScheduledInputRetryable.make({ reason: \"capacity\" }),\n ThreadClientError: (error: ThreadClientError) =>\n ScheduledInputRetryable.make({\n reason: error.overloaded === true ? \"capacity\" : \"transport\",\n }),\n HostProtocolError: () => ScheduledInputRetryable.make({ reason: \"ambiguous\" }),\n AdmissionPolicyError: (error) =>\n error.reason === \"refused\"\n ? ScheduledInputRefused.make({ code: error.code })\n : ScheduledInputRetryable.make({\n reason: error.reason === \"occupied\" ? \"capacity\" : \"storage\",\n }),\n LedgerError: () => ScheduledInputRetryable.make({ reason: \"storage\" }),\n ThreadStoreError: () => ScheduledInputRetryable.make({ reason: \"storage\" }),\n DurableAlarmError: () => ScheduledInputRetryable.make({ reason: \"storage\" }),\n AgentInputError: () =>\n ScheduleStorageError.make({ operation: \"prepared admission\", reason: \"corrupt\" }),\n DigestError: () =>\n ScheduleStorageError.make({ operation: \"prepared admission\", reason: \"corrupt\" }),\n ThreadNotMaterialized: () => ScheduledInputRetryable.make({ reason: \"storage\" }),\n AppendConflict: () => ScheduledInputRetryable.make({ reason: \"ambiguous\" }),\n OwnershipLost: () => ScheduledInputRetryable.make({ reason: \"ambiguous\" }),\n DurableRuntimeFailpointError: () =>\n ScheduledInputRetryable.make({ reason: \"ambiguous\" }),\n }),\n ),\n });\n }),\n);\n\nconst preparedFromSchedule = (envelope: ScheduledEnvelope): PreparedInput => ({\n schemaVersion: 1,\n threadId: envelope.threadId,\n deliveryPrincipal: envelope.deliveryPrincipal,\n ...(envelope.admissionGroup === undefined ? {} : { admissionGroup: envelope.admissionGroup }),\n ...(envelope.admissionFence === undefined ? {} : { admissionFence: envelope.admissionFence }),\n agentId: envelope.agentId,\n definitions: envelope.definitions,\n input: envelope.input,\n inputDigest: envelope.inputDigest,\n admissionKey: envelope.admissionKey,\n authorization: envelope.authorization,\n});\n\n/** Compatibility adapter retaining Scheduling's public admission port. */\nexport const cloudflareScheduledInputAdmissionLayer: Layer.Layer<\n ScheduledInputAdmission,\n never,\n PreparedInputAdmission\n> = Layer.effect(\n ScheduledInputAdmission,\n Effect.map(PreparedInputAdmission, (admission) =>\n ScheduledInputAdmission.of({\n submit: (envelope) => admission.submit(preparedFromSchedule(envelope)),\n }),\n ),\n);\n"],"mappings":";;;;;;;;;AAgBA,MAAM,oBAAoB,aAAgE,EACxF,YAAY;CAAE,IAAI;CAAS,OAAO;AAAc,EAClD;;AAGA,MAAa,wCAIT,MAAM,OACR,wBACA,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;CAEtB,OAAO,uBAAuB,GAAG;EAC/B,mBAAmB,YACjB,OACG,iBAAiB,OAAO,CAAC,CACzB,KAAK,OAAO,eAAe,wBAAwB,KAAK,EAAE,QAAQ,UAAU,CAAC,CAAC,CAAC;EACpF,SAAS,aACP,OACG,OAAO,iBAAiB,SAAS,OAAO,GAAG,SAAS,OAAO;GAC1D,UAAU,SAAS;GACnB,WAAW,SAAS;GACpB,gBAAgB,SAAS;GACzB,GAAI,SAAS,mBAAmB,KAAA,IAC5B,CAAC,IACD,EAAE,gBAAgB,SAAS,eAAe;GAC9C,GAAI,SAAS,mBAAmB,KAAA,IAC5B,CAAC,IACD,EAAE,gBAAgB,SAAS,eAAe;GAC9C,GAAI,SAAS,oBAAoB,KAAA,IAC7B,CAAC,IACD,EAAE,iBAAiB,SAAS,gBAAgB;GAChD,GAAI,SAAS,qBAAqB,KAAA,IAC9B,CAAC,IACD,EAAE,kBAAkB,SAAS,iBAAiB;GAClD,aAAa,SAAS;EACxB,CAAC,CAAC,CACD,KACC,OAAO,UAAU;GACf,yBACE,qBAAqB,KAAK;IAAE,WAAW;IAAsB,QAAQ;GAAU,CAAC;GAClF,8BAA8B,wBAAwB,KAAK,EAAE,QAAQ,WAAW,CAAC;GACjF,oBAAoB,UAClB,wBAAwB,KAAK,EAC3B,QAAQ,MAAM,eAAe,OAAO,aAAa,YACnD,CAAC;GACH,yBAAyB,wBAAwB,KAAK,EAAE,QAAQ,YAAY,CAAC;GAC7E,uBAAuB,UACrB,MAAM,WAAW,YACb,sBAAsB,KAAK,EAAE,MAAM,MAAM,KAAK,CAAC,IAC/C,wBAAwB,KAAK,EAC3B,QAAQ,MAAM,WAAW,aAAa,aAAa,UACrD,CAAC;GACP,mBAAmB,wBAAwB,KAAK,EAAE,QAAQ,UAAU,CAAC;GACrE,wBAAwB,wBAAwB,KAAK,EAAE,QAAQ,UAAU,CAAC;GAC1E,yBAAyB,wBAAwB,KAAK,EAAE,QAAQ,UAAU,CAAC;GAC3E,uBACE,qBAAqB,KAAK;IAAE,WAAW;IAAsB,QAAQ;GAAU,CAAC;GAClF,mBACE,qBAAqB,KAAK;IAAE,WAAW;IAAsB,QAAQ;GAAU,CAAC;GAClF,6BAA6B,wBAAwB,KAAK,EAAE,QAAQ,UAAU,CAAC;GAC/E,sBAAsB,wBAAwB,KAAK,EAAE,QAAQ,YAAY,CAAC;GAC1E,qBAAqB,wBAAwB,KAAK,EAAE,QAAQ,YAAY,CAAC;GACzE,oCACE,wBAAwB,KAAK,EAAE,QAAQ,YAAY,CAAC;EACxD,CAAC,CACH;CACN,CAAC;AACH,CAAC,CACH;AAEA,MAAM,wBAAwB,cAAgD;CAC5E,eAAe;CACf,UAAU,SAAS;CACnB,mBAAmB,SAAS;CAC5B,GAAI,SAAS,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,SAAS,eAAe;CAC3F,GAAI,SAAS,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,SAAS,eAAe;CAC3F,SAAS,SAAS;CAClB,aAAa,SAAS;CACtB,OAAO,SAAS;CAChB,aAAa,SAAS;CACtB,cAAc,SAAS;CACvB,eAAe,SAAS;AAC1B;;AAGA,MAAa,yCAIT,MAAM,OACR,yBACA,OAAO,IAAI,yBAAyB,cAClC,wBAAwB,GAAG,EACzB,SAAS,aAAa,UAAU,OAAO,qBAAqB,QAAQ,CAAC,EACvE,CAAC,CACH,CACF"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@yielded/agent-platform-cloudflare","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@yielded/agent-platform-cloudflare","version":"0.1.0-beta.170","dependencies":{"@effect/platform-browser":"4.0.3","@effect/sql-sqlite-do":"4.0.3","@yielded/agent":"0.1.0-beta.170","@yielded/agent-storage-cloudflare":"0.1.0-beta.170","@yielded/agent-storage-sql":"0.1.0-beta.170","puppeteer-core":"24.29.0"},"devDependencies":{"@cloudflare/vitest-plugin":"1.4.0","@cloudflare/workers-types":"5.20260926.1","@effect/platform-node":"4.0.3","@effect/sql-d1":"4.0.3","@effect/vitest":"4.0.3","@yielded/agent-testing":"0.1.0-beta.170","effect":"4.0.3","effect-cf":"0.56.2","esbuild":"0.28.1","miniflare":"5.20260811.1-alpha","typescript":"7.0.2","vite":"npm:@voidzero-dev/vite-plus-core@1.1.0","vite-plus":"1.1.0","vitest":"5.0.3"},"peerDependencies":{"effect":"^4.0.3","effect-cf":"^0.56.0"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./alarm":{"types":"./dist/Alarm.d.mts","default":"./dist/Alarm.mjs"},"./browser-rest-capture":{"types":"./dist/BrowserRestCapture.d.mts","default":"./dist/BrowserRestCapture.mjs"},"./browser-rest-crawl":{"types":"./dist/BrowserRestCrawl.d.mts","default":"./dist/BrowserRestCrawl.mjs"},"./cloudflare-bindings":{"types":"./dist/CloudflareBindings.d.mts","default":"./dist/CloudflareBindings.mjs"},"./cloudflare-browser":{"types":"./dist/CloudflareBrowser.d.mts","default":"./dist/CloudflareBrowser.mjs"},"./cloudflare-code-mode":{"types":"./dist/CloudflareCodeMode.d.mts","default":"./dist/CloudflareCodeMode.mjs"},"./cloudflare-config":{"types":"./dist/CloudflareConfig.d.mts","default":"./dist/CloudflareConfig.mjs"},"./cloudflare-memory":{"types":"./dist/CloudflareMemory.d.mts","default":"./dist/CloudflareMemory.mjs"},"./cloudflare-scheduling":{"types":"./dist/CloudflareScheduling.d.mts","default":"./dist/CloudflareScheduling.mjs"},"./cloudflare-subscriptions":{"types":"./dist/CloudflareSubscriptions.d.mts","default":"./dist/CloudflareSubscriptions.mjs"},"./cloudflare-thread-client":{"types":"./dist/CloudflareThreadClient.d.mts","default":"./dist/CloudflareThreadClient.mjs"},"./interactive-browser":{"types":"./dist/InteractiveBrowser.d.mts","default":"./dist/InteractiveBrowser.mjs"},"./browser-session":{"types":"./dist/BrowserSession.d.mts","default":"./dist/BrowserSession.mjs"},"./browser-credentials":{"types":"./dist/BrowserCredentials.d.mts","default":"./dist/BrowserCredentials.mjs"},"./thread-object":{"types":"./dist/ThreadObject.d.mts","default":"./dist/ThreadObject.mjs"},"./wake-scheduler":{"types":"./dist/WakeScheduler.d.mts","default":"./dist/WakeScheduler.mjs"},"./cloudflare-ai-gateway":{"types":"./dist/CloudflareAiGateway.d.mts","default":"./dist/CloudflareAiGateway.mjs"},"./browser-use":{"types":"./dist/BrowserUse.d.mts","default":"./dist/BrowserUse.mjs"}},"description":"Cloudflare Layer assembly for Effect Agent: Durable Objects and Browser Run adapters.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/agent.git","directory":"packages/platform-cloudflare"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json"}}
|
package/src/Alarm.ts
CHANGED
|
@@ -586,6 +586,8 @@ const decodeRecoveryEvent = Schema.decodeUnknownSync(ThreadRecoveryFaultEvent);
|
|
|
586
586
|
* Object and sequence; callbacks may repeat after interruption. This is a trusted host hook,
|
|
587
587
|
* not pre-authorized UI data: the host owns recipient authorization and safe presentation.
|
|
588
588
|
* Capture services in the Layer. Do not call producers or write the raw alarm slot.
|
|
589
|
+
* Without this service, maintenance acknowledges and discards transitions. Install the
|
|
590
|
+
* handler before the first maintenance pass if the application needs that event stream.
|
|
589
591
|
*/
|
|
590
592
|
export class ThreadRecoveryEvents extends Context.Service<
|
|
591
593
|
ThreadRecoveryEvents,
|
package/src/BrowserUse.ts
CHANGED
|
@@ -99,6 +99,51 @@ const observedUrl = (url: string): string => {
|
|
|
99
99
|
: `${url.slice(0, Math.min(payload, 256))},[payload omitted]`;
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
+
// CDP can resolve closed roots without modifying the page's realm or attachShadow.
|
|
103
|
+
// Keep those nodes in the same isolated realm as native refs and discard old roots per read.
|
|
104
|
+
// The command deadline bounds this full-frame read; the node/root caps below only bound
|
|
105
|
+
// local adoption, not the CDP response size.
|
|
106
|
+
const discoverClosedRoots = async (frame: Frame): Promise<boolean> => {
|
|
107
|
+
const realm = frame.isolatedRealm();
|
|
108
|
+
|
|
109
|
+
await using document = await realm.evaluateHandle(() => globalThis.document);
|
|
110
|
+
|
|
111
|
+
const { node } = await frame.client.send("DOM.describeNode", {
|
|
112
|
+
objectId: document.remoteObject().objectId,
|
|
113
|
+
depth: -1,
|
|
114
|
+
pierce: true,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const pending = [node];
|
|
118
|
+
const roots: Array<number> = [];
|
|
119
|
+
let scanned = 0;
|
|
120
|
+
|
|
121
|
+
while (pending.length > 0 && scanned++ < 10_000 && roots.length < 256) {
|
|
122
|
+
const current = pending.pop();
|
|
123
|
+
|
|
124
|
+
if (current === undefined) break;
|
|
125
|
+
if (current.shadowRootType === "closed") roots.push(current.backendNodeId);
|
|
126
|
+
pending.push(...(current.children ?? []));
|
|
127
|
+
pending.push(
|
|
128
|
+
...(current.shadowRoots ?? []).filter((root) => root.shadowRootType !== "user-agent"),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
await realm.evaluate(() => {
|
|
132
|
+
Reflect.set(globalThis, "@effect-agent/native-browser-closed-roots", new Map());
|
|
133
|
+
});
|
|
134
|
+
for (const id of roots) {
|
|
135
|
+
await using root = await realm.adoptBackendNode(id);
|
|
136
|
+
|
|
137
|
+
await realm.evaluate((node) => {
|
|
138
|
+
if (!(node instanceof ShadowRoot) || node.mode !== "closed")
|
|
139
|
+
throw new Error("Closed shadow root is unavailable");
|
|
140
|
+
Reflect.get(globalThis, "@effect-agent/native-browser-closed-roots").set(node.host, node);
|
|
141
|
+
}, root);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return pending.length > 0;
|
|
145
|
+
};
|
|
146
|
+
|
|
102
147
|
/** One application-neutral controller over an existing scoped native attachment.
|
|
103
148
|
* No allocation, model, provider choice, input retry, or arbitrary page JS is exposed.
|
|
104
149
|
* Reads re-authorize at most five times when page/frame URLs change during authorization.
|
|
@@ -507,8 +552,12 @@ export const make = Effect.fnUntraced(function* <R>(
|
|
|
507
552
|
|
|
508
553
|
if (ref === undefined) continue;
|
|
509
554
|
|
|
510
|
-
const read = async (): Promise<unknown> =>
|
|
511
|
-
|
|
555
|
+
const read = async (): Promise<unknown> => {
|
|
556
|
+
const rootsTruncated = await discoverClosedRoots(frame);
|
|
557
|
+
|
|
558
|
+
truncated ||= rootsTruncated;
|
|
559
|
+
|
|
560
|
+
return limits.observationMode === "jev"
|
|
512
561
|
? frame
|
|
513
562
|
.isolatedRealm()
|
|
514
563
|
.evaluate(
|
|
@@ -528,6 +577,7 @@ export const make = Effect.fnUntraced(function* <R>(
|
|
|
528
577
|
request.optionFilter,
|
|
529
578
|
limits.viewportOnly,
|
|
530
579
|
);
|
|
580
|
+
};
|
|
531
581
|
|
|
532
582
|
let result = Schema.decodeUnknownSync(Observation)(await read());
|
|
533
583
|
|
|
@@ -610,14 +660,13 @@ export const make = Effect.fnUntraced(function* <R>(
|
|
|
610
660
|
let parent = current.parentFrame();
|
|
611
661
|
|
|
612
662
|
while (parent !== null) {
|
|
613
|
-
|
|
663
|
+
await discoverClosedRoots(parent);
|
|
664
|
+
await using owner = await current.frameElement();
|
|
614
665
|
|
|
615
666
|
if (owner === null) return false;
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
await owner.dispose();
|
|
620
|
-
}
|
|
667
|
+
await using isolatedOwner = await parent.isolatedRealm().adoptHandle(owner);
|
|
668
|
+
|
|
669
|
+
point = await isolatedOwner.evaluate(checkFrameDom, point, scroll);
|
|
621
670
|
if (point === false) return false;
|
|
622
671
|
current = parent;
|
|
623
672
|
parent = current.parentFrame();
|
|
@@ -1300,6 +1349,7 @@ export const make = Effect.fnUntraced(function* <R>(
|
|
|
1300
1349
|
const frame = frameRef === undefined ? page.mainFrame() : resolveFrame(page, frameRef);
|
|
1301
1350
|
|
|
1302
1351
|
if (frame === undefined) throw new Error("Frame detached");
|
|
1352
|
+
await discoverClosedRoots(frame);
|
|
1303
1353
|
|
|
1304
1354
|
try {
|
|
1305
1355
|
const handle = await frame.isolatedRealm().waitForFunction(
|
|
@@ -113,6 +113,12 @@ export const inspectDom = pageFunction(
|
|
|
113
113
|
Reflect.set(globalThis, "@effect-agent/native-browser", registry);
|
|
114
114
|
Reflect.set(globalThis, "@effect-agent/native-browser-name-checks", nameChecks);
|
|
115
115
|
const roots: Array<Document | ShadowRoot> = [document];
|
|
116
|
+
|
|
117
|
+
const closedRoots: ReadonlyMap<Element, ShadowRoot> | undefined = Reflect.get(
|
|
118
|
+
globalThis,
|
|
119
|
+
"@effect-agent/native-browser-closed-roots",
|
|
120
|
+
);
|
|
121
|
+
|
|
116
122
|
const visited = new Set<Node>();
|
|
117
123
|
let discoveredElements = 0;
|
|
118
124
|
const candidates: Array<HTMLElement> = [];
|
|
@@ -153,7 +159,11 @@ export const inspectDom = pageFunction(
|
|
|
153
159
|
truncated = true;
|
|
154
160
|
break;
|
|
155
161
|
}
|
|
156
|
-
if (node instanceof Element
|
|
162
|
+
if (node instanceof Element) {
|
|
163
|
+
const shadow = node.shadowRoot ?? closedRoots?.get(node);
|
|
164
|
+
|
|
165
|
+
if (shadow !== undefined && shadow !== null) roots.push(shadow);
|
|
166
|
+
}
|
|
157
167
|
node = discovery.nextNode();
|
|
158
168
|
}
|
|
159
169
|
}
|
|
@@ -186,7 +196,10 @@ export const inspectDom = pageFunction(
|
|
|
186
196
|
}
|
|
187
197
|
if (node instanceof Element) {
|
|
188
198
|
nodes.push(node);
|
|
189
|
-
|
|
199
|
+
const shadow = node.shadowRoot ?? closedRoots?.get(node);
|
|
200
|
+
|
|
201
|
+
if (selector === undefined && shadow !== undefined && shadow !== null)
|
|
202
|
+
roots.push(shadow);
|
|
190
203
|
} else if (node instanceof Text) {
|
|
191
204
|
const parent = node.parentElement;
|
|
192
205
|
|
|
@@ -613,7 +626,6 @@ export const checkDom = pageFunction(
|
|
|
613
626
|
kind !== expected.kind ||
|
|
614
627
|
associated.matches(":disabled") ||
|
|
615
628
|
associated.getAttribute("aria-disabled") === "true" ||
|
|
616
|
-
node.closest('[inert],[aria-hidden="true"]') !== null ||
|
|
617
629
|
!node.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true })
|
|
618
630
|
)
|
|
619
631
|
return false;
|
|
@@ -653,6 +665,8 @@ export const checkDom = pageFunction(
|
|
|
653
665
|
let ancestor: Node | null = node;
|
|
654
666
|
|
|
655
667
|
while (ancestor !== null) {
|
|
668
|
+
if (ancestor instanceof Element && ancestor.matches('[inert],[aria-hidden="true"]'))
|
|
669
|
+
return false;
|
|
656
670
|
ancestors.add(ancestor);
|
|
657
671
|
ancestor = ancestor instanceof ShadowRoot ? ancestor.host : ancestor.parentNode;
|
|
658
672
|
}
|
|
@@ -697,8 +711,13 @@ export const checkDom = pageFunction(
|
|
|
697
711
|
|
|
698
712
|
let hit = document.elementFromPoint(x, y);
|
|
699
713
|
|
|
700
|
-
while (hit
|
|
701
|
-
const
|
|
714
|
+
while (hit !== null && hit !== node && !node.contains(hit)) {
|
|
715
|
+
const shadow: ShadowRoot | undefined | null =
|
|
716
|
+
hit.shadowRoot ??
|
|
717
|
+
Reflect.get(globalThis, "@effect-agent/native-browser-closed-roots")?.get(hit);
|
|
718
|
+
|
|
719
|
+
if (shadow === undefined || shadow === null) break;
|
|
720
|
+
const next = shadow.elementFromPoint(x, y);
|
|
702
721
|
|
|
703
722
|
if (next === null || next === hit) break;
|
|
704
723
|
hit = next;
|
|
@@ -728,7 +747,6 @@ export const checkFrameDom = pageFunction(
|
|
|
728
747
|
if (
|
|
729
748
|
!(node instanceof HTMLElement) ||
|
|
730
749
|
!node.isConnected ||
|
|
731
|
-
node.closest('[inert],[aria-hidden="true"]') !== null ||
|
|
732
750
|
!node.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true })
|
|
733
751
|
)
|
|
734
752
|
return false;
|
|
@@ -752,6 +770,7 @@ export const checkFrameDom = pageFunction(
|
|
|
752
770
|
);
|
|
753
771
|
|
|
754
772
|
if (
|
|
773
|
+
ancestor.matches('[inert],[aria-hidden="true"]') ||
|
|
755
774
|
!(
|
|
756
775
|
matrix.m11 === 1 &&
|
|
757
776
|
matrix.m12 === 0 &&
|
|
@@ -775,7 +794,9 @@ export const checkFrameDom = pageFunction(
|
|
|
775
794
|
(current.zoom !== "1" && current.zoom !== "normal")
|
|
776
795
|
)
|
|
777
796
|
return false;
|
|
778
|
-
|
|
797
|
+
const root = ancestor.getRootNode();
|
|
798
|
+
|
|
799
|
+
ancestor = ancestor.parentElement ?? (root instanceof ShadowRoot ? root.host : null);
|
|
779
800
|
}
|
|
780
801
|
const rect = node.getBoundingClientRect();
|
|
781
802
|
|
|
@@ -783,7 +804,19 @@ export const checkFrameDom = pageFunction(
|
|
|
783
804
|
rect.left + parseFloat(style.borderLeftWidth) + parseFloat(style.paddingLeft) + point.x;
|
|
784
805
|
|
|
785
806
|
const y = rect.top + parseFloat(style.borderTopWidth) + parseFloat(style.paddingTop) + point.y;
|
|
786
|
-
|
|
807
|
+
let hit = document.elementFromPoint(x, y);
|
|
808
|
+
|
|
809
|
+
while (hit !== null && hit !== node && !node.contains(hit)) {
|
|
810
|
+
const shadow: ShadowRoot | undefined | null =
|
|
811
|
+
hit.shadowRoot ??
|
|
812
|
+
Reflect.get(globalThis, "@effect-agent/native-browser-closed-roots")?.get(hit);
|
|
813
|
+
|
|
814
|
+
if (shadow === undefined || shadow === null) break;
|
|
815
|
+
const next = shadow.elementFromPoint(x, y);
|
|
816
|
+
|
|
817
|
+
if (next === null || next === hit) break;
|
|
818
|
+
hit = next;
|
|
819
|
+
}
|
|
787
820
|
|
|
788
821
|
return hit === node ? { x, y } : false;
|
|
789
822
|
},
|
|
@@ -791,6 +824,12 @@ export const checkFrameDom = pageFunction(
|
|
|
791
824
|
|
|
792
825
|
export const waitDom = pageFunction((selector: string, state: string, text: string | undefined) => {
|
|
793
826
|
const roots: Array<Document | ShadowRoot> = [document];
|
|
827
|
+
|
|
828
|
+
const closedRoots: ReadonlyMap<Element, ShadowRoot> | undefined = Reflect.get(
|
|
829
|
+
globalThis,
|
|
830
|
+
"@effect-agent/native-browser-closed-roots",
|
|
831
|
+
);
|
|
832
|
+
|
|
794
833
|
const expectedText = text?.replace(/\s+/g, " ").trim();
|
|
795
834
|
let scanned = 0;
|
|
796
835
|
|
|
@@ -818,7 +857,9 @@ export const waitDom = pageFunction((selector: string, state: string, text: stri
|
|
|
818
857
|
while (node !== null) {
|
|
819
858
|
if (++scanned > 10_000) return false;
|
|
820
859
|
if (node instanceof Element) {
|
|
821
|
-
|
|
860
|
+
const shadow = node.shadowRoot ?? closedRoots?.get(node);
|
|
861
|
+
|
|
862
|
+
if (shadow !== undefined && shadow !== null) roots.push(shadow);
|
|
822
863
|
if (
|
|
823
864
|
node instanceof HTMLElement &&
|
|
824
865
|
node.matches(selector) &&
|
|
@@ -45,9 +45,18 @@ export const inspectJevDom = pageFunction(
|
|
|
45
45
|
Reflect.set(globalThis, "@effect-agent/native-browser", registry);
|
|
46
46
|
Reflect.set(globalThis, "@effect-agent/native-browser-name-checks", checks);
|
|
47
47
|
|
|
48
|
-
const visible = (node: Element) =>
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const visible = (node: Element) => {
|
|
49
|
+
let ancestor: Element | null = node;
|
|
50
|
+
|
|
51
|
+
while (ancestor !== null) {
|
|
52
|
+
if (ancestor.matches('[aria-hidden="true"],[inert]')) return false;
|
|
53
|
+
const root = ancestor.getRootNode();
|
|
54
|
+
|
|
55
|
+
ancestor = ancestor.parentElement ?? (root instanceof ShadowRoot ? root.host : null);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return node.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true });
|
|
59
|
+
};
|
|
51
60
|
|
|
52
61
|
const inView = (node: Element) => {
|
|
53
62
|
const rect = node.getBoundingClientRect();
|
|
@@ -154,9 +163,18 @@ export const inspectJevDom = pageFunction(
|
|
|
154
163
|
node.readOnly) ||
|
|
155
164
|
node.getAttribute("aria-readonly") === "true";
|
|
156
165
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
const closedRoots: ReadonlyMap<Element, ShadowRoot> | undefined = Reflect.get(
|
|
167
|
+
globalThis,
|
|
168
|
+
"@effect-agent/native-browser-closed-roots",
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const candidates = [document, ...(closedRoots?.values() ?? [])].flatMap((root) =>
|
|
172
|
+
Array.from(
|
|
173
|
+
root.querySelectorAll(
|
|
174
|
+
'a[href],button,input,textarea,select,summary,[contenteditable="true"],' +
|
|
175
|
+
roles.map((role) => `[role="${role}"]`).join(","),
|
|
176
|
+
),
|
|
177
|
+
),
|
|
160
178
|
);
|
|
161
179
|
|
|
162
180
|
const controls: Array<typeof Control.Type> = [];
|