effect-browser 0.0.0-reserved.0 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +664 -3
- package/dist/Association-zlgInoaj.mjs +134 -0
- package/dist/Association-zlgInoaj.mjs.map +1 -0
- package/dist/Bootstrap-B9UUXsvF.d.mts +183 -0
- package/dist/Bootstrap-Be-2Ddmh.mjs +187 -0
- package/dist/Bootstrap-Be-2Ddmh.mjs.map +1 -0
- package/dist/Bootstrap.d.mts +3 -0
- package/dist/Bootstrap.mjs +2 -0
- package/dist/Browser.d.mts +177 -0
- package/dist/Browser.mjs +14 -0
- package/dist/Browser.mjs.map +1 -0
- package/dist/BrowserData-DJAnUHoZ.d.mts +412 -0
- package/dist/BrowserData.d.mts +3 -0
- package/dist/BrowserData.mjs +494 -0
- package/dist/BrowserData.mjs.map +1 -0
- package/dist/BrowserRuntime-fZz1b0VI.mjs +5169 -0
- package/dist/BrowserRuntime-fZz1b0VI.mjs.map +1 -0
- package/dist/BrowserRuntime.d.mts +139 -0
- package/dist/BrowserRuntime.mjs +2 -0
- package/dist/Capture.d.mts +40 -0
- package/dist/Capture.mjs +476 -0
- package/dist/Capture.mjs.map +1 -0
- package/dist/CaptureData-AmqVP_Ba.mjs +162 -0
- package/dist/CaptureData-AmqVP_Ba.mjs.map +1 -0
- package/dist/CaptureData.d.mts +148 -0
- package/dist/CaptureData.mjs +2 -0
- package/dist/Chromium.d.mts +84 -0
- package/dist/Chromium.mjs +381 -0
- package/dist/Chromium.mjs.map +1 -0
- package/dist/Errors.d.mts +106 -0
- package/dist/Errors.mjs +155 -0
- package/dist/Errors.mjs.map +1 -0
- package/dist/PageControl.d.mts +15 -0
- package/dist/PageControl.mjs +28 -0
- package/dist/PageControl.mjs.map +1 -0
- package/dist/PageControlAssociation-DabEg5AR.mjs +10 -0
- package/dist/PageControlAssociation-DabEg5AR.mjs.map +1 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +9 -0
- package/package.json +67 -5
package/dist/Errors.mjs
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
//#region src/Errors.ts
|
|
3
|
+
/**
|
|
4
|
+
* What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it
|
|
5
|
+
* when it admits an operation, so a native step's own name can never become API, and a new
|
|
6
|
+
* spelling is a deliberate edit here rather than a string that merely compiles.
|
|
7
|
+
*/
|
|
8
|
+
const BrowserOperation = Schema.Literals([
|
|
9
|
+
"configure",
|
|
10
|
+
"launch",
|
|
11
|
+
"connect",
|
|
12
|
+
"reconnect",
|
|
13
|
+
"detach",
|
|
14
|
+
"disconnect",
|
|
15
|
+
"close",
|
|
16
|
+
"handoff",
|
|
17
|
+
"resume",
|
|
18
|
+
"live-view",
|
|
19
|
+
"target",
|
|
20
|
+
"handle",
|
|
21
|
+
"list-pages",
|
|
22
|
+
"list-frames",
|
|
23
|
+
"select-page",
|
|
24
|
+
"select-frame",
|
|
25
|
+
"new-page",
|
|
26
|
+
"close-page",
|
|
27
|
+
"resize",
|
|
28
|
+
"ready",
|
|
29
|
+
"observe",
|
|
30
|
+
"checkpoint",
|
|
31
|
+
"control-facts",
|
|
32
|
+
"revalidate",
|
|
33
|
+
"read-text",
|
|
34
|
+
"screenshot",
|
|
35
|
+
"wait",
|
|
36
|
+
"navigate",
|
|
37
|
+
"navigate-stop",
|
|
38
|
+
"click",
|
|
39
|
+
"fill",
|
|
40
|
+
"select-option",
|
|
41
|
+
"scroll",
|
|
42
|
+
"click-and-wait",
|
|
43
|
+
"download-action",
|
|
44
|
+
"select-files",
|
|
45
|
+
"file-chooser",
|
|
46
|
+
"action-result",
|
|
47
|
+
"pointer-move",
|
|
48
|
+
"hover",
|
|
49
|
+
"wheel",
|
|
50
|
+
"press",
|
|
51
|
+
"type",
|
|
52
|
+
"page-control",
|
|
53
|
+
"page-state",
|
|
54
|
+
"page-suspend",
|
|
55
|
+
"page-resume",
|
|
56
|
+
"capture",
|
|
57
|
+
"capture-start",
|
|
58
|
+
"capture-stop",
|
|
59
|
+
"capture-consume"
|
|
60
|
+
]);
|
|
61
|
+
/** Dispatch evidence belongs to the operation, independently of its failure reason. */
|
|
62
|
+
const BrowserOutcome = Schema.Literals([
|
|
63
|
+
"undispatched",
|
|
64
|
+
"rejected",
|
|
65
|
+
"unknown"
|
|
66
|
+
]);
|
|
67
|
+
/** Limits report measured producer facts; an unavailable measurement is never invented. */
|
|
68
|
+
const LimitDimension = Schema.Literals([
|
|
69
|
+
"actions",
|
|
70
|
+
"elapsed",
|
|
71
|
+
"returned-bytes",
|
|
72
|
+
"pages",
|
|
73
|
+
"frames",
|
|
74
|
+
"frame-depth",
|
|
75
|
+
"buffered-frames",
|
|
76
|
+
"buffered-bytes",
|
|
77
|
+
"host-reads",
|
|
78
|
+
"controls",
|
|
79
|
+
"text",
|
|
80
|
+
"captures",
|
|
81
|
+
"frame-bytes",
|
|
82
|
+
"width",
|
|
83
|
+
"height",
|
|
84
|
+
"pixels"
|
|
85
|
+
]);
|
|
86
|
+
const SchemaPath = Schema.String.check(Schema.isMaxLength(512));
|
|
87
|
+
/** Validated constructors for host reasons. The model receives a separate bounded projection. */
|
|
88
|
+
const Reasons = {
|
|
89
|
+
Configuration: Schema.TaggedStruct("Configuration", { path: Schema.optionalKey(SchemaPath) }),
|
|
90
|
+
UnregisteredSession: Schema.TaggedStruct("UnregisteredSession", {}),
|
|
91
|
+
Unsupported: Schema.TaggedStruct("Unsupported", {}),
|
|
92
|
+
Busy: Schema.TaggedStruct("Busy", {}),
|
|
93
|
+
Closed: Schema.TaggedStruct("Closed", {}),
|
|
94
|
+
Stale: Schema.TaggedStruct("Stale", {}),
|
|
95
|
+
NotFound: Schema.TaggedStruct("NotFound", {}),
|
|
96
|
+
Ambiguous: Schema.TaggedStruct("Ambiguous", {}),
|
|
97
|
+
Malformed: Schema.TaggedStruct("Malformed", { path: Schema.optionalKey(SchemaPath) }),
|
|
98
|
+
Limit: Schema.TaggedStruct("Limit", {
|
|
99
|
+
dimension: LimitDimension,
|
|
100
|
+
maximum: Schema.Natural,
|
|
101
|
+
observed: Schema.Natural
|
|
102
|
+
}),
|
|
103
|
+
Timeout: Schema.TaggedStruct("Timeout", {}),
|
|
104
|
+
Transport: Schema.TaggedStruct("Transport", { status: Schema.optionalKey(Schema.Int) }),
|
|
105
|
+
Provider: Schema.TaggedStruct("Provider", { status: Schema.optionalKey(Schema.Int) }),
|
|
106
|
+
Authorization: Schema.TaggedStruct("Authorization", {}),
|
|
107
|
+
RateLimited: Schema.TaggedStruct("RateLimited", { retryAfterMillis: Schema.optionalKey(Schema.Natural) }),
|
|
108
|
+
Disconnected: Schema.TaggedStruct("Disconnected", {}),
|
|
109
|
+
Active: Schema.TaggedStruct("Active", {}),
|
|
110
|
+
Disabled: Schema.TaggedStruct("Disabled", {}),
|
|
111
|
+
Expired: Schema.TaggedStruct("Expired", {}),
|
|
112
|
+
Failed: Schema.TaggedStruct("Failed", {}),
|
|
113
|
+
UnsafeUrl: Schema.TaggedStruct("UnsafeUrl", {}),
|
|
114
|
+
ContentType: Schema.TaggedStruct("ContentType", {}),
|
|
115
|
+
Timestamp: Schema.TaggedStruct("Timestamp", {}),
|
|
116
|
+
Resized: Schema.TaggedStruct("Resized", {}),
|
|
117
|
+
TargetChanged: Schema.TaggedStruct("TargetChanged", {}),
|
|
118
|
+
Interrupted: Schema.TaggedStruct("Interrupted", {}),
|
|
119
|
+
ContextLease: Schema.TaggedStruct("ContextLease", {}),
|
|
120
|
+
NotVisible: Schema.TaggedStruct("NotVisible", {}),
|
|
121
|
+
Denied: Schema.TaggedStruct("Denied", {}),
|
|
122
|
+
NotFocused: Schema.TaggedStruct("NotFocused", {})
|
|
123
|
+
};
|
|
124
|
+
const BrowserReason = Schema.Union(Object.values(Reasons));
|
|
125
|
+
var BrowserError = class extends Schema.TaggedError()("BrowserError", {
|
|
126
|
+
operation: BrowserOperation,
|
|
127
|
+
reason: BrowserReason,
|
|
128
|
+
outcome: BrowserOutcome
|
|
129
|
+
}) {};
|
|
130
|
+
var InitializationError = class extends Schema.TaggedError()("InitializationError", {
|
|
131
|
+
operation: Schema.Literals([
|
|
132
|
+
"configure",
|
|
133
|
+
"register",
|
|
134
|
+
"ready",
|
|
135
|
+
"callback",
|
|
136
|
+
"dispose"
|
|
137
|
+
]),
|
|
138
|
+
step: Schema.String.check(Schema.isMaxLength(128)),
|
|
139
|
+
reason: Schema.Literals([
|
|
140
|
+
"configuration",
|
|
141
|
+
"unsupported",
|
|
142
|
+
"origin",
|
|
143
|
+
"stale",
|
|
144
|
+
"busy",
|
|
145
|
+
"closed",
|
|
146
|
+
"timeout",
|
|
147
|
+
"input",
|
|
148
|
+
"output",
|
|
149
|
+
"native"
|
|
150
|
+
])
|
|
151
|
+
}) {};
|
|
152
|
+
//#endregion
|
|
153
|
+
export { BrowserError, BrowserOperation, BrowserOutcome, BrowserReason, InitializationError, LimitDimension, Reasons };
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=Errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.mjs","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n/**\n * What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it\n * when it admits an operation, so a native step's own name can never become API, and a new\n * spelling is a deliberate edit here rather than a string that merely compiles.\n */\nexport const BrowserOperation = Schema.Literals([\n // configuration and lifetime\n \"configure\",\n \"launch\",\n \"connect\",\n \"reconnect\",\n \"detach\",\n \"disconnect\",\n \"close\",\n \"handoff\",\n \"resume\",\n \"live-view\",\n // targets\n \"target\",\n \"handle\",\n \"list-pages\",\n \"list-frames\",\n \"select-page\",\n \"select-frame\",\n \"new-page\",\n \"close-page\",\n \"resize\",\n // reading\n \"ready\",\n \"observe\",\n \"checkpoint\",\n \"control-facts\",\n \"revalidate\",\n \"read-text\",\n \"screenshot\",\n \"wait\",\n // input\n \"navigate\",\n \"navigate-stop\",\n \"click\",\n \"fill\",\n \"select-option\",\n \"scroll\",\n \"click-and-wait\",\n \"download-action\",\n \"select-files\",\n \"file-chooser\",\n \"action-result\",\n // native pointer input\n \"pointer-move\",\n \"hover\",\n \"wheel\",\n // native key input\n \"press\",\n \"type\",\n // page control\n \"page-control\",\n \"page-state\",\n \"page-suspend\",\n \"page-resume\",\n // capture\n \"capture\",\n \"capture-start\",\n \"capture-stop\",\n \"capture-consume\",\n]);\n\nexport type BrowserOperation = typeof BrowserOperation.Type;\n\n/** Dispatch evidence belongs to the operation, independently of its failure reason. */\nexport const BrowserOutcome = Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"]);\n\nexport type BrowserOutcome = typeof BrowserOutcome.Type;\n\n/** Limits report measured producer facts; an unavailable measurement is never invented. */\nexport const LimitDimension = Schema.Literals([\n \"actions\",\n \"elapsed\",\n \"returned-bytes\",\n \"pages\",\n \"frames\",\n \"frame-depth\",\n \"buffered-frames\",\n \"buffered-bytes\",\n \"host-reads\",\n \"controls\",\n \"text\",\n \"captures\",\n \"frame-bytes\",\n \"width\",\n \"height\",\n \"pixels\",\n]);\n\nconst SchemaPath = Schema.String.check(Schema.isMaxLength(512));\n\n/** Validated constructors for host reasons. The model receives a separate bounded projection. */\nexport const Reasons = {\n Configuration: Schema.TaggedStruct(\"Configuration\", { path: Schema.optionalKey(SchemaPath) }),\n UnregisteredSession: Schema.TaggedStruct(\"UnregisteredSession\", {}),\n Unsupported: Schema.TaggedStruct(\"Unsupported\", {}),\n Busy: Schema.TaggedStruct(\"Busy\", {}),\n Closed: Schema.TaggedStruct(\"Closed\", {}),\n Stale: Schema.TaggedStruct(\"Stale\", {}),\n NotFound: Schema.TaggedStruct(\"NotFound\", {}),\n Ambiguous: Schema.TaggedStruct(\"Ambiguous\", {}),\n Malformed: Schema.TaggedStruct(\"Malformed\", { path: Schema.optionalKey(SchemaPath) }),\n Limit: Schema.TaggedStruct(\"Limit\", {\n dimension: LimitDimension,\n maximum: Schema.Natural,\n observed: Schema.Natural,\n }),\n Timeout: Schema.TaggedStruct(\"Timeout\", {}),\n Transport: Schema.TaggedStruct(\"Transport\", { status: Schema.optionalKey(Schema.Int) }),\n Provider: Schema.TaggedStruct(\"Provider\", { status: Schema.optionalKey(Schema.Int) }),\n Authorization: Schema.TaggedStruct(\"Authorization\", {}),\n RateLimited: Schema.TaggedStruct(\"RateLimited\", {\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n }),\n Disconnected: Schema.TaggedStruct(\"Disconnected\", {}),\n Active: Schema.TaggedStruct(\"Active\", {}),\n Disabled: Schema.TaggedStruct(\"Disabled\", {}),\n Expired: Schema.TaggedStruct(\"Expired\", {}),\n Failed: Schema.TaggedStruct(\"Failed\", {}),\n UnsafeUrl: Schema.TaggedStruct(\"UnsafeUrl\", {}),\n ContentType: Schema.TaggedStruct(\"ContentType\", {}),\n Timestamp: Schema.TaggedStruct(\"Timestamp\", {}),\n Resized: Schema.TaggedStruct(\"Resized\", {}),\n TargetChanged: Schema.TaggedStruct(\"TargetChanged\", {}),\n Interrupted: Schema.TaggedStruct(\"Interrupted\", {}),\n ContextLease: Schema.TaggedStruct(\"ContextLease\", {}),\n NotVisible: Schema.TaggedStruct(\"NotVisible\", {}),\n Denied: Schema.TaggedStruct(\"Denied\", {}),\n NotFocused: Schema.TaggedStruct(\"NotFocused\", {}),\n} as const;\n\nexport const BrowserReason = Schema.Union(Object.values(Reasons));\n\nexport type BrowserReason = typeof BrowserReason.Type;\n\nexport class BrowserError extends Schema.TaggedError<BrowserError>()(\"BrowserError\", {\n operation: BrowserOperation,\n reason: BrowserReason,\n outcome: BrowserOutcome,\n}) {}\n\nexport class InitializationError extends Schema.TaggedError<InitializationError>()(\n \"InitializationError\",\n {\n operation: Schema.Literals([\"configure\", \"register\", \"ready\", \"callback\", \"dispose\"]),\n step: Schema.String.check(Schema.isMaxLength(128)),\n reason: Schema.Literals([\n \"configuration\",\n \"unsupported\",\n \"origin\",\n \"stale\",\n \"busy\",\n \"closed\",\n \"timeout\",\n \"input\",\n \"output\",\n \"native\",\n ]),\n },\n) {}\n"],"mappings":";;;;;;;AAOA,MAAa,mBAAmB,OAAO,SAAS;CAE9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;AACF,CAAC;;AAKD,MAAa,iBAAiB,OAAO,SAAS;CAAC;CAAgB;CAAY;AAAS,CAAC;;AAKrF,MAAa,iBAAiB,OAAO,SAAS;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,aAAa,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;;AAG9D,MAAa,UAAU;CACrB,eAAe,OAAO,aAAa,iBAAiB,EAAE,MAAM,OAAO,YAAY,UAAU,EAAE,CAAC;CAC5F,qBAAqB,OAAO,aAAa,uBAAuB,CAAC,CAAC;CAClE,aAAa,OAAO,aAAa,eAAe,CAAC,CAAC;CAClD,MAAM,OAAO,aAAa,QAAQ,CAAC,CAAC;CACpC,QAAQ,OAAO,aAAa,UAAU,CAAC,CAAC;CACxC,OAAO,OAAO,aAAa,SAAS,CAAC,CAAC;CACtC,UAAU,OAAO,aAAa,YAAY,CAAC,CAAC;CAC5C,WAAW,OAAO,aAAa,aAAa,CAAC,CAAC;CAC9C,WAAW,OAAO,aAAa,aAAa,EAAE,MAAM,OAAO,YAAY,UAAU,EAAE,CAAC;CACpF,OAAO,OAAO,aAAa,SAAS;EAClC,WAAW;EACX,SAAS,OAAO;EAChB,UAAU,OAAO;CACnB,CAAC;CACD,SAA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S;EAAC;EAAa;EAAY;EAAS;EAAY;CAAS,CAAC;CACpF,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;CACjD,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH,CACF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BrowserError } from "./Errors.mjs";
|
|
2
|
+
import { D as PageInfo, E as PageExecutionState, O as PageSuspension } from "./BrowserData-DJAnUHoZ.mjs";
|
|
3
|
+
import { BrowserSession } from "./Browser.mjs";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
//#region src/PageControl.d.ts
|
|
6
|
+
/** Last acknowledged state; no remote guarantee survives connection loss or external control. */
|
|
7
|
+
export declare const state: <E>(session: BrowserSession<E>, page: PageInfo) => Effect.Effect<PageExecutionState, BrowserError>;
|
|
8
|
+
/** Explicit host-only hold requiring InteractiveOptions.pageControl; capture ACKs never invoke it. */
|
|
9
|
+
export declare const suspend: <E>(session: BrowserSession<E>, page: PageInfo) => Effect.Effect<PageSuspension, BrowserError>;
|
|
10
|
+
/** Consumes the exact live receipt. Activation is intentional; stale receipts never replay commands. */
|
|
11
|
+
export declare const resume: <E>(session: BrowserSession<E>, receipt: PageSuspension) => Effect.Effect<void, BrowserError>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { PageExecutionState, PageSuspension };
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=PageControl.d.mts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PageExecutionState, PageInfo, PageSuspension } from "./BrowserData.mjs";
|
|
2
|
+
import { BrowserError, Reasons } from "./Errors.mjs";
|
|
3
|
+
import { n as pageControl } from "./PageControlAssociation-DabEg5AR.mjs";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
5
|
+
//#region src/PageControl.ts
|
|
6
|
+
const owner = (session) => Effect.suspend(() => {
|
|
7
|
+
const port = pageControl(session);
|
|
8
|
+
return port === void 0 ? Effect.fail(BrowserError.make({
|
|
9
|
+
operation: "page-control",
|
|
10
|
+
reason: Reasons.UnregisteredSession.make({}),
|
|
11
|
+
outcome: "undispatched"
|
|
12
|
+
})) : Effect.succeed(port);
|
|
13
|
+
});
|
|
14
|
+
const invalid = () => BrowserError.make({
|
|
15
|
+
operation: "page-control",
|
|
16
|
+
reason: Reasons.Configuration.make({}),
|
|
17
|
+
outcome: "undispatched"
|
|
18
|
+
});
|
|
19
|
+
/** Last acknowledged state; no remote guarantee survives connection loss or external control. */
|
|
20
|
+
const state = (session, page) => Schema.decodeEffect(PageInfo)(page).pipe(Effect.mapError(invalid), Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))), Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.state(value)))));
|
|
21
|
+
/** Explicit host-only hold requiring InteractiveOptions.pageControl; capture ACKs never invoke it. */
|
|
22
|
+
const suspend = (session, page) => Schema.decodeEffect(PageInfo)(page).pipe(Effect.mapError(invalid), Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))), Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.suspend(value)))));
|
|
23
|
+
/** Consumes the exact live receipt. Activation is intentional; stale receipts never replay commands. */
|
|
24
|
+
const resume = (session, receipt) => Schema.decodeEffect(PageSuspension)(receipt).pipe(Effect.mapError(invalid), Effect.map((value) => Object.freeze(PageSuspension.make({ ...value }))), Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.resume(value)))));
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PageExecutionState, PageSuspension, resume, state, suspend };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=PageControl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageControl.mjs","names":[],"sources":["../src/PageControl.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\n\nimport type { BrowserSession } from \"./Browser.ts\";\nimport { type PageExecutionState, PageInfo, PageSuspension } from \"./BrowserData.ts\";\nimport { BrowserError, Reasons } from \"./Errors.ts\";\nimport { pageControl } from \"./internal/browser/PageControlAssociation.ts\";\nexport { PageExecutionState, PageSuspension } from \"./BrowserData.ts\";\n\nconst owner = <E>(session: BrowserSession<E>) =>\n Effect.suspend(() => {\n const port = pageControl(session);\n\n return port === undefined\n ? Effect.fail(\n BrowserError.make({\n operation: \"page-control\",\n reason: Reasons.UnregisteredSession.make({}),\n outcome: \"undispatched\",\n }),\n )\n : Effect.succeed(port);\n });\n\nconst invalid = () =>\n BrowserError.make({\n operation: \"page-control\",\n reason: Reasons.Configuration.make({}),\n outcome: \"undispatched\",\n });\n\n/** Last acknowledged state; no remote guarantee survives connection loss or external control. */\nexport const state = <E>(\n session: BrowserSession<E>,\n page: PageInfo,\n): Effect.Effect<PageExecutionState, BrowserError> =>\n Schema.decodeEffect(PageInfo)(page).pipe(\n Effect.mapError(invalid),\n Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))),\n Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.state(value)))),\n );\n\n/** Explicit host-only hold requiring InteractiveOptions.pageControl; capture ACKs never invoke it. */\nexport const suspend = <E>(\n session: BrowserSession<E>,\n page: PageInfo,\n): Effect.Effect<PageSuspension, BrowserError> =>\n Schema.decodeEffect(PageInfo)(page).pipe(\n Effect.mapError(invalid),\n Effect.map((value) => Object.freeze(PageInfo.make({ ...value }))),\n Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.suspend(value)))),\n );\n\n/** Consumes the exact live receipt. Activation is intentional; stale receipts never replay commands. */\nexport const resume = <E>(\n session: BrowserSession<E>,\n receipt: PageSuspension,\n): Effect.Effect<void, BrowserError> =>\n Schema.decodeEffect(PageSuspension)(receipt).pipe(\n Effect.mapError(invalid),\n Effect.map((value) => Object.freeze(PageSuspension.make({ ...value }))),\n Effect.flatMap((value) => owner(session).pipe(Effect.flatMap((port) => port.resume(value)))),\n );\n"],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K,OAAO,KAAK,CAAC,CAAC,CAAC,CAC7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/internal/browser/PageControlAssociation.ts
|
|
2
|
+
const owners = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
const associatePageControl = (session, port) => {
|
|
4
|
+
owners.set(session, port);
|
|
5
|
+
};
|
|
6
|
+
const pageControl = (session) => owners.get(session);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { pageControl as n, associatePageControl as t };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=PageControlAssociation-DabEg5AR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageControlAssociation-DabEg5AR.mjs","names":[],"sources":["../src/internal/browser/PageControlAssociation.ts"],"sourcesContent":["import type { Effect } from \"effect\";\n\nimport type { PageExecutionState, PageInfo, PageSuspension } from \"../../BrowserData.ts\";\nimport type { BrowserError } from \"../../Errors.ts\";\n\nexport interface PageControlPort {\n readonly state: (page: PageInfo) => Effect.Effect<PageExecutionState, BrowserError>;\n readonly suspend: (page: PageInfo) => Effect.Effect<PageSuspension, BrowserError>;\n readonly resume: (receipt: PageSuspension) => Effect.Effect<void, BrowserError>;\n}\n\nconst owners = new WeakMap<object, PageControlPort>();\n\nexport const associatePageControl = (session: object, port: PageControlPort): void => {\n owners.set(session, port);\n};\n\nexport const pageControl = (session: object): PageControlPort | undefined => owners.get(session);\n"],"mappings":";AAWA,MAAM,yBAAS,IAAI,QAAiC;AAEpD,MAAa,wBAAwB,SAAiB,SAAgC;CACpF,OAAO,IAAI,SAAS,IAAI;AAC1B;AAEA,MAAa,eAAe,YAAiD,OAAO,IAAI,OAAO"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as Bootstrap from "./Bootstrap.mjs";
|
|
2
|
+
import * as Browser from "./Browser.mjs";
|
|
3
|
+
import * as BrowserData from "./BrowserData.mjs";
|
|
4
|
+
import * as BrowserRuntime from "./BrowserRuntime.mjs";
|
|
5
|
+
import * as Capture from "./Capture.mjs";
|
|
6
|
+
import * as CaptureData from "./CaptureData.mjs";
|
|
7
|
+
import * as Errors from "./Errors.mjs";
|
|
8
|
+
import * as PageControl from "./PageControl.mjs";
|
|
9
|
+
export { Bootstrap, Browser, BrowserData, BrowserRuntime, Capture, CaptureData, Errors, PageControl };
|
|
10
|
+
export {};
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Bootstrap from "./Bootstrap.mjs";
|
|
2
|
+
import * as Browser from "./Browser.mjs";
|
|
3
|
+
import * as BrowserData from "./BrowserData.mjs";
|
|
4
|
+
import * as BrowserRuntime from "./BrowserRuntime.mjs";
|
|
5
|
+
import * as Capture from "./Capture.mjs";
|
|
6
|
+
import * as CaptureData from "./CaptureData.mjs";
|
|
7
|
+
import * as Errors from "./Errors.mjs";
|
|
8
|
+
import * as PageControl from "./PageControl.mjs";
|
|
9
|
+
export { Bootstrap, Browser, BrowserData, BrowserRuntime, Capture, CaptureData, Errors, PageControl };
|
package/package.json
CHANGED
|
@@ -1,17 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-browser",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0-beta.0",
|
|
4
|
+
"description": "Shared Effect browser sessions, modeled control and capture with an isolated Chromium launcher.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/mannyc2/effect-agent-browserbase.git"
|
|
8
|
+
"url": "git+https://github.com/mannyc2/effect-agent-browserbase.git",
|
|
9
|
+
"directory": "packages/browser"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": [],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"effect": "^4.0.0-rc.115",
|
|
18
|
+
"playwright-core": "1.63.0"
|
|
19
|
+
},
|
|
20
|
+
"peerDependenciesMeta": {
|
|
21
|
+
"playwright-core": {
|
|
22
|
+
"optional": true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/mannyc2/effect-agent-browserbase#readme",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/mannyc2/effect-agent-browserbase/issues"
|
|
9
28
|
},
|
|
10
29
|
"files": [
|
|
11
|
-
"
|
|
30
|
+
"dist"
|
|
12
31
|
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./bootstrap": {
|
|
38
|
+
"types": "./dist/Bootstrap.d.mts",
|
|
39
|
+
"default": "./dist/Bootstrap.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./browser": {
|
|
42
|
+
"types": "./dist/Browser.d.mts",
|
|
43
|
+
"default": "./dist/Browser.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./browser-data": {
|
|
46
|
+
"types": "./dist/BrowserData.d.mts",
|
|
47
|
+
"default": "./dist/BrowserData.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./browser-runtime": {
|
|
50
|
+
"types": "./dist/BrowserRuntime.d.mts",
|
|
51
|
+
"default": "./dist/BrowserRuntime.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./capture": {
|
|
54
|
+
"types": "./dist/Capture.d.mts",
|
|
55
|
+
"default": "./dist/Capture.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./capture-data": {
|
|
58
|
+
"types": "./dist/CaptureData.d.mts",
|
|
59
|
+
"default": "./dist/CaptureData.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./chromium": {
|
|
62
|
+
"types": "./dist/Chromium.d.mts",
|
|
63
|
+
"default": "./dist/Chromium.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./errors": {
|
|
66
|
+
"types": "./dist/Errors.d.mts",
|
|
67
|
+
"default": "./dist/Errors.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./page-control": {
|
|
70
|
+
"types": "./dist/PageControl.d.mts",
|
|
71
|
+
"default": "./dist/PageControl.mjs"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
13
74
|
"publishConfig": {
|
|
14
75
|
"access": "public",
|
|
15
|
-
"
|
|
76
|
+
"registry": "https://registry.npmjs.org/",
|
|
77
|
+
"tag": "beta"
|
|
16
78
|
}
|
|
17
79
|
}
|