effect-browserbase 0.1.0-beta.102

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.
Files changed (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +441 -0
  3. package/dist/Account.d.mts +34 -0
  4. package/dist/Account.mjs +41 -0
  5. package/dist/Account.mjs.map +1 -0
  6. package/dist/Acquisition-WBafHwXH.mjs +280 -0
  7. package/dist/Acquisition-WBafHwXH.mjs.map +1 -0
  8. package/dist/Agents.d.mts +156 -0
  9. package/dist/Agents.mjs +307 -0
  10. package/dist/Agents.mjs.map +1 -0
  11. package/dist/Allocation.d.mts +99 -0
  12. package/dist/Allocation.mjs +29 -0
  13. package/dist/Allocation.mjs.map +1 -0
  14. package/dist/Association-CEps4hYP.mjs +10 -0
  15. package/dist/Association-CEps4hYP.mjs.map +1 -0
  16. package/dist/Authorization-Ll5f_XNM.mjs +12 -0
  17. package/dist/Authorization-Ll5f_XNM.mjs.map +1 -0
  18. package/dist/Bootstrap-BXuzZojd.mjs +194 -0
  19. package/dist/Bootstrap-BXuzZojd.mjs.map +1 -0
  20. package/dist/Bootstrap-m7lHgj0D.d.mts +177 -0
  21. package/dist/Bootstrap.d.mts +2 -0
  22. package/dist/Bootstrap.mjs +2 -0
  23. package/dist/Browser-joE4Zgys.mjs +1557 -0
  24. package/dist/Browser-joE4Zgys.mjs.map +1 -0
  25. package/dist/Browser.d.mts +195 -0
  26. package/dist/Browser.mjs +2 -0
  27. package/dist/BrowserBinding-qbQA6JhH.mjs +2452 -0
  28. package/dist/BrowserBinding-qbQA6JhH.mjs.map +1 -0
  29. package/dist/BrowserBinding.d.mts +40 -0
  30. package/dist/BrowserBinding.mjs +2 -0
  31. package/dist/BrowserData-LpcAuAub.d.mts +369 -0
  32. package/dist/BrowserData.d.mts +2 -0
  33. package/dist/BrowserData.mjs +442 -0
  34. package/dist/BrowserData.mjs.map +1 -0
  35. package/dist/Capture-CZJPuD7b.mjs +532 -0
  36. package/dist/Capture-CZJPuD7b.mjs.map +1 -0
  37. package/dist/Capture-Dr5MkIJb.d.mts +125 -0
  38. package/dist/Capture.d.mts +2 -0
  39. package/dist/Capture.mjs +2 -0
  40. package/dist/Certificates.d.mts +35 -0
  41. package/dist/Certificates.mjs +90 -0
  42. package/dist/Certificates.mjs.map +1 -0
  43. package/dist/Cleanup-G2YpTCuU.d.mts +24 -0
  44. package/dist/Cleanup.d.mts +2 -0
  45. package/dist/Cleanup.mjs +48 -0
  46. package/dist/Cleanup.mjs.map +1 -0
  47. package/dist/Client-Ca0zSg1n.d.mts +53 -0
  48. package/dist/Client-D1_xYM9o.mjs +424 -0
  49. package/dist/Client-D1_xYM9o.mjs.map +1 -0
  50. package/dist/Client.d.mts +2 -0
  51. package/dist/Client.mjs +2 -0
  52. package/dist/ContextCoordination.d.mts +16 -0
  53. package/dist/ContextCoordination.mjs +67 -0
  54. package/dist/ContextCoordination.mjs.map +1 -0
  55. package/dist/ContextWriter-BrQmoXRg.mjs +187 -0
  56. package/dist/ContextWriter-BrQmoXRg.mjs.map +1 -0
  57. package/dist/Contexts.d.mts +32 -0
  58. package/dist/Contexts.mjs +103 -0
  59. package/dist/Contexts.mjs.map +1 -0
  60. package/dist/Deadline-CrViaogr.mjs +13 -0
  61. package/dist/Deadline-CrViaogr.mjs.map +1 -0
  62. package/dist/Downloads.d.mts +44 -0
  63. package/dist/Downloads.mjs +142 -0
  64. package/dist/Downloads.mjs.map +1 -0
  65. package/dist/Errors.d.mts +123 -0
  66. package/dist/Errors.mjs +329 -0
  67. package/dist/Errors.mjs.map +1 -0
  68. package/dist/Extensions-ClZbYb1H.mjs +237 -0
  69. package/dist/Extensions-ClZbYb1H.mjs.map +1 -0
  70. package/dist/Extensions.d.mts +44 -0
  71. package/dist/Extensions.mjs +2 -0
  72. package/dist/Functions.d.mts +227 -0
  73. package/dist/Functions.mjs +332 -0
  74. package/dist/Functions.mjs.map +1 -0
  75. package/dist/Images-DgscEfSf.mjs +127 -0
  76. package/dist/Images-DgscEfSf.mjs.map +1 -0
  77. package/dist/Issued-DejqoMYL.mjs +15 -0
  78. package/dist/Issued-DejqoMYL.mjs.map +1 -0
  79. package/dist/Launch-BHcAEq05.mjs +111 -0
  80. package/dist/Launch-BHcAEq05.mjs.map +1 -0
  81. package/dist/Launch-C8CfaYxb.d.mts +132 -0
  82. package/dist/Launch.d.mts +2 -0
  83. package/dist/Launch.mjs +105 -0
  84. package/dist/Launch.mjs.map +1 -0
  85. package/dist/PageControl.d.mts +16 -0
  86. package/dist/PageControl.mjs +36 -0
  87. package/dist/PageControl.mjs.map +1 -0
  88. package/dist/PageControlAssociation-DabEg5AR.mjs +10 -0
  89. package/dist/PageControlAssociation-DabEg5AR.mjs.map +1 -0
  90. package/dist/PageFetch.d.mts +40 -0
  91. package/dist/PageFetch.mjs +64 -0
  92. package/dist/PageFetch.mjs.map +1 -0
  93. package/dist/Projects.d.mts +39 -0
  94. package/dist/Projects.mjs +71 -0
  95. package/dist/Projects.mjs.map +1 -0
  96. package/dist/Recordings.d.mts +28 -0
  97. package/dist/Recordings.mjs +131 -0
  98. package/dist/Recordings.mjs.map +1 -0
  99. package/dist/References-URDAtapt.d.mts +35 -0
  100. package/dist/References.d.mts +2 -0
  101. package/dist/References.mjs +41 -0
  102. package/dist/References.mjs.map +1 -0
  103. package/dist/Replays.d.mts +28 -0
  104. package/dist/Replays.mjs +109 -0
  105. package/dist/Replays.mjs.map +1 -0
  106. package/dist/Resource-DBksC4zB.mjs +50 -0
  107. package/dist/Resource-DBksC4zB.mjs.map +1 -0
  108. package/dist/Search.d.mts +38 -0
  109. package/dist/Search.mjs +53 -0
  110. package/dist/Search.mjs.map +1 -0
  111. package/dist/SessionData-DRKcKCqw.d.mts +39 -0
  112. package/dist/SessionData.d.mts +2 -0
  113. package/dist/SessionData.mjs +55 -0
  114. package/dist/SessionData.mjs.map +1 -0
  115. package/dist/Sessions-B8E4kMxo.d.mts +68 -0
  116. package/dist/Sessions-CtbseWEh.mjs +244 -0
  117. package/dist/Sessions-CtbseWEh.mjs.map +1 -0
  118. package/dist/Sessions.d.mts +3 -0
  119. package/dist/Sessions.mjs +3 -0
  120. package/dist/TransferPolicy-DQ06i7SZ.mjs +25 -0
  121. package/dist/TransferPolicy-DQ06i7SZ.mjs.map +1 -0
  122. package/dist/Transfers-Czv5IZzJ.d.mts +76 -0
  123. package/dist/Transfers.d.mts +2 -0
  124. package/dist/Transfers.mjs +101 -0
  125. package/dist/Transfers.mjs.map +1 -0
  126. package/dist/Uploads.d.mts +29 -0
  127. package/dist/Uploads.mjs +107 -0
  128. package/dist/Uploads.mjs.map +1 -0
  129. package/dist/Webhooks.d.mts +60 -0
  130. package/dist/Webhooks.mjs +143 -0
  131. package/dist/Webhooks.mjs.map +1 -0
  132. package/dist/WriterFacts-osvYAsIx.d.mts +61 -0
  133. package/dist/index.d.mts +30 -0
  134. package/dist/index.mjs +30 -0
  135. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  136. package/package.json +163 -0
@@ -0,0 +1,38 @@
1
+ import { PlatformError } from "./Errors.mjs";
2
+ import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
3
+ import { Context, Effect, Layer, Schema } from "effect";
4
+ declare namespace Search_d_exports {
5
+ export { BrowserbaseSearch, SearchQuery, SearchResult, SearchResults };
6
+ }
7
+ export declare const SearchQuery: Schema.Struct<{
8
+ readonly query: Schema.NonEmptyString;
9
+ /** 1–25; the provider defaults to 10. */
10
+ readonly numResults: Schema.optionalKey<Schema.Int>;
11
+ }>;
12
+ export type SearchQuery = typeof SearchQuery.Type;
13
+ declare const SearchResult_base: Schema.Class<SearchResult, Schema.Struct<{
14
+ readonly id: Schema.String;
15
+ readonly url: Schema.String;
16
+ readonly title: Schema.String;
17
+ readonly author: Schema.optionalKey<Schema.String>;
18
+ readonly publishedDate: Schema.optionalKey<Schema.String>;
19
+ readonly image: Schema.optionalKey<Schema.String>;
20
+ readonly favicon: Schema.optionalKey<Schema.String>;
21
+ }>, {}>;
22
+ export declare class SearchResult extends SearchResult_base {}
23
+ declare const SearchResults_base: Schema.Class<SearchResults, Schema.Struct<{
24
+ readonly requestId: Schema.String;
25
+ readonly query: Schema.String;
26
+ readonly results: Schema.$Array<typeof SearchResult>;
27
+ }>, {}>;
28
+ export declare class SearchResults extends SearchResults_base {}
29
+ declare const BrowserbaseSearch_base: Context.ServiceClass<BrowserbaseSearch, "effect-browserbase/Search", {
30
+ readonly web: (query: SearchQuery) => Effect.Effect<SearchResults, PlatformError>;
31
+ }>;
32
+ /** Browserbase web search. Each call is billed and is never retried. */
33
+ export declare class BrowserbaseSearch extends BrowserbaseSearch_base {
34
+ static readonly layer: Layer.Layer<BrowserbaseSearch, never, BrowserbaseClient>;
35
+ }
36
+ //#endregion
37
+ export { Search_d_exports as t };
38
+ //# sourceMappingURL=Search.d.mts.map
@@ -0,0 +1,53 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { PlatformError } from "./Errors.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
4
+ import { t as resource } from "./Resource-DBksC4zB.mjs";
5
+ import { Context, Effect, Layer, Schema } from "effect";
6
+ //#region src/Search.ts
7
+ var Search_exports = /* @__PURE__ */ __exportAll({
8
+ BrowserbaseSearch: () => BrowserbaseSearch,
9
+ SearchQuery: () => SearchQuery,
10
+ SearchResult: () => SearchResult,
11
+ SearchResults: () => SearchResults
12
+ });
13
+ const Text = Schema.String.check(Schema.isMaxLength(16384));
14
+ const SearchQuery = Schema.Struct({
15
+ query: Schema.NonEmptyString.check(Schema.isMaxLength(2048)),
16
+ /** 1–25; the provider defaults to 10. */
17
+ numResults: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
18
+ minimum: 1,
19
+ maximum: 25
20
+ })))
21
+ });
22
+ var SearchResult = class extends Schema.Class("BrowserbaseSearchResult")({
23
+ id: Text,
24
+ url: Text,
25
+ title: Text,
26
+ author: Schema.optionalKey(Text),
27
+ publishedDate: Schema.optionalKey(Text),
28
+ image: Schema.optionalKey(Text),
29
+ favicon: Schema.optionalKey(Text)
30
+ }) {};
31
+ var SearchResults = class extends Schema.Class("BrowserbaseSearchResults")({
32
+ requestId: Text,
33
+ query: Text,
34
+ results: Schema.Array(SearchResult).check(Schema.isMaxLength(25))
35
+ }) {};
36
+ /** Browserbase web search. Each call is billed and is never retried. */
37
+ var BrowserbaseSearch = class BrowserbaseSearch extends Context.Service()("effect-browserbase/Search") {
38
+ static layer = Layer.effect(BrowserbaseSearch, Effect.gen(function* () {
39
+ const api = resource(yield* BrowserbaseClient, (failure) => PlatformError.make({
40
+ ...failure,
41
+ service: "search"
42
+ }));
43
+ const web = Effect.fn("BrowserbaseSearch.web")(function* (query) {
44
+ const value = yield* api.input(SearchQuery, query, "search-web");
45
+ return yield* api.request("POST", "/v1/search", SearchResults, "search-web", value);
46
+ });
47
+ return BrowserbaseSearch.of({ web });
48
+ }));
49
+ };
50
+ //#endregion
51
+ export { BrowserbaseSearch, SearchQuery, SearchResult, SearchResults, Search_exports as t };
52
+
53
+ //# sourceMappingURL=Search.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Search.mjs","names":[],"sources":["../src/Search.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\n\nconst Text = Schema.String.check(Schema.isMaxLength(16_384));\n\nexport const SearchQuery = Schema.Struct({\n query: Schema.NonEmptyString.check(Schema.isMaxLength(2048)),\n /** 1–25; the provider defaults to 10. */\n numResults: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 25 }))),\n});\n\nexport type SearchQuery = typeof SearchQuery.Type;\n\nexport class SearchResult extends Schema.Class<SearchResult>(\"BrowserbaseSearchResult\")({\n id: Text,\n url: Text,\n title: Text,\n author: Schema.optionalKey(Text),\n publishedDate: Schema.optionalKey(Text),\n image: Schema.optionalKey(Text),\n favicon: Schema.optionalKey(Text),\n}) {}\n\nexport class SearchResults extends Schema.Class<SearchResults>(\"BrowserbaseSearchResults\")({\n requestId: Text,\n query: Text,\n results: Schema.Array(SearchResult).check(Schema.isMaxLength(25)),\n}) {}\n\n/** Browserbase web search. Each call is billed and is never retried. */\nexport class BrowserbaseSearch extends Context.Service<\n BrowserbaseSearch,\n {\n readonly web: (query: SearchQuery) => Effect.Effect<SearchResults, PlatformError>;\n }\n>()(\"effect-browserbase/Search\") {\n static readonly layer: Layer.Layer<BrowserbaseSearch, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseSearch,\n Effect.gen(function* () {\n const api = resource<PlatformError>(yield* BrowserbaseClient, (failure) =>\n PlatformError.make({ ...failure, service: \"search\" }),\n );\n\n const web = Effect.fn(\"BrowserbaseSearch.web\")(function* (query: SearchQuery) {\n const value = yield* api.input(SearchQuery, query, \"search-web\");\n\n return yield* api.request(\"POST\", \"/v1/search\", SearchResults, \"search-web\", value);\n });\n\n return BrowserbaseSearch.of({ web });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;AAMA,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,YAAY,KAAM,CAAC;AAE3D,MAAa,cAAc,OAAO,OAAO;CACvC,OAAO,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC;;CAE3D,YAAY,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAG,CAAC,CAAC,CAAC;AAChG,CAAC;AAID,IAAa,eAAb,cAAkC,OAAO,MAAoB,yBAAyB,CAAC,CAAC;CACtF,IAAI;CACJ,KAAK;CACL,OAAO;CACP,QAAQ,OAAO,YAAY,IAAI;CAC/B,eAAe,OAAO,YAAY,IAAI;CACtC,OAAO,OAAO,YAAY,IAAI;CAC9B,SAAS,OAAO,YAAY,IAAI;AAClC,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,gBAAb,cAAmC,OAAO,MAAqB,0BAA0B,CAAC,CAAC;CACzF,WAAW;CACX,OAAO;CACP,SAAS,OAAO,MAAM,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,CAAC;AAClE,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,oBAAb,MAAa,0BAA0B,QAAQ,QAK7C,CAAC,CAAC,2BAA2B,CAAC,CAAC;CAC/B,OAAgB,QAAkE,MAAM,OACtF,mBACA,OAAO,IAAI,aAAa;EACtB,MAAM,MAAM,SAAwB,OAAO,oBAAoB,YAC7D,cAAc,KAAK;GAAE,GAAG;GAAS,SAAS;EAAS,CAAC,CACtD;EAEA,MAAM,MAAM,OAAO,GAAG,uBAAuB,CAAC,CAAC,WAAW,OAAoB;GAC5E,MAAM,QAAQ,OAAO,IAAI,MAAM,aAAa,OAAO,YAAY;GAE/D,OAAO,OAAO,IAAI,QAAQ,QAAQ,cAAc,eAAe,cAAc,KAAK;EACpF,CAAC;EAED,OAAO,kBAAkB,GAAG,EAAE,IAAI,CAAC;CACrC,CAAC,CACH;AACF"}
@@ -0,0 +1,39 @@
1
+ import { o as SessionReference } from "./References-URDAtapt.mjs";
2
+ import { Schema } from "effect";
3
+ declare namespace SessionData_d_exports {
4
+ export { ProviderSession, SessionMetadata, SessionStatus, isTerminalSessionStatus };
5
+ }
6
+ declare const SessionStatus: Schema.Literals<readonly ["PENDING", "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]>;
7
+ type SessionStatus = typeof SessionStatus.Type;
8
+ declare const isTerminalSessionStatus: (status: SessionStatus) => boolean;
9
+ declare const ProviderSession: Schema.Struct<{
10
+ readonly id: Schema.NonEmptyString;
11
+ readonly projectId: Schema.NonEmptyString;
12
+ readonly status: Schema.Literals<readonly ["PENDING", "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]>;
13
+ readonly createdAt: Schema.String;
14
+ readonly updatedAt: Schema.String;
15
+ readonly expiresAt: Schema.String;
16
+ readonly startedAt: Schema.String;
17
+ readonly endedAt: Schema.optionalKey<Schema.String>;
18
+ readonly keepAlive: Schema.Boolean;
19
+ readonly proxyBytes: Schema.Finite;
20
+ readonly region: Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>;
21
+ readonly contextId: Schema.optionalKey<Schema.NonEmptyString>;
22
+ }>;
23
+ declare const SessionMetadata_base: Schema.Class<SessionMetadata, Schema.Struct<{
24
+ readonly reference: typeof SessionReference;
25
+ readonly status: Schema.Literals<readonly ["PENDING", "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]>;
26
+ readonly createdAt: Schema.String;
27
+ readonly updatedAt: Schema.String;
28
+ readonly expiresAt: Schema.String;
29
+ readonly startedAt: Schema.String;
30
+ readonly endedAt: Schema.optionalKey<Schema.String>;
31
+ readonly keepAlive: Schema.Boolean;
32
+ readonly proxyBytes: Schema.Finite;
33
+ readonly region: Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>;
34
+ readonly contextId: Schema.optionalKey<Schema.NonEmptyString>;
35
+ }>, {}>;
36
+ declare class SessionMetadata extends SessionMetadata_base {}
37
+ //#endregion
38
+ export { isTerminalSessionStatus as a, SessionStatus as i, SessionData_d_exports as n, SessionMetadata as r, ProviderSession as t };
39
+ //# sourceMappingURL=SessionData-DRKcKCqw.d.mts.map
@@ -0,0 +1,2 @@
1
+ import { a as isTerminalSessionStatus, i as SessionStatus, r as SessionMetadata, t as ProviderSession } from "./SessionData-DRKcKCqw.mjs";
2
+ export { ProviderSession, SessionMetadata, SessionStatus, isTerminalSessionStatus };
@@ -0,0 +1,55 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Identifier, SessionReference } from "./References.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/SessionData.ts
5
+ var SessionData_exports = /* @__PURE__ */ __exportAll({
6
+ ProviderSession: () => ProviderSession,
7
+ SessionMetadata: () => SessionMetadata,
8
+ SessionStatus: () => SessionStatus,
9
+ isTerminalSessionStatus: () => isTerminalSessionStatus
10
+ });
11
+ const SessionStatus = Schema.Literals([
12
+ "PENDING",
13
+ "RUNNING",
14
+ "ERROR",
15
+ "TIMED_OUT",
16
+ "COMPLETED"
17
+ ]);
18
+ const isTerminalSessionStatus = (status) => status === "COMPLETED" || status === "ERROR" || status === "TIMED_OUT";
19
+ const Timestamp = Schema.String.check(Schema.isMaxLength(64));
20
+ const ProviderSession = Schema.Struct({
21
+ id: Identifier,
22
+ projectId: Identifier,
23
+ status: SessionStatus,
24
+ createdAt: Timestamp,
25
+ updatedAt: Timestamp,
26
+ expiresAt: Timestamp,
27
+ startedAt: Timestamp,
28
+ endedAt: Schema.optionalKey(Timestamp),
29
+ keepAlive: Schema.Boolean,
30
+ proxyBytes: Schema.Finite,
31
+ region: Schema.Literals([
32
+ "us-west-2",
33
+ "us-east-1",
34
+ "eu-central-1",
35
+ "ap-southeast-1"
36
+ ]),
37
+ contextId: Schema.optionalKey(Identifier)
38
+ });
39
+ var SessionMetadata = class extends Schema.Class("BrowserbaseSessionMetadata")({
40
+ reference: SessionReference,
41
+ status: SessionStatus,
42
+ createdAt: Timestamp,
43
+ updatedAt: Timestamp,
44
+ expiresAt: Timestamp,
45
+ startedAt: Timestamp,
46
+ endedAt: Schema.optionalKey(Timestamp),
47
+ keepAlive: Schema.Boolean,
48
+ proxyBytes: Schema.Finite,
49
+ region: ProviderSession.fields.region,
50
+ contextId: Schema.optionalKey(Identifier)
51
+ }) {};
52
+ //#endregion
53
+ export { ProviderSession, SessionMetadata, SessionStatus, isTerminalSessionStatus, SessionData_exports as t };
54
+
55
+ //# sourceMappingURL=SessionData.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionData.mjs","names":[],"sources":["../src/SessionData.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { Identifier, SessionReference } from \"./References.ts\";\n\nexport const SessionStatus = Schema.Literals([\n \"PENDING\",\n \"RUNNING\",\n \"ERROR\",\n \"TIMED_OUT\",\n \"COMPLETED\",\n]);\n\nexport type SessionStatus = typeof SessionStatus.Type;\n\nexport const isTerminalSessionStatus = (status: SessionStatus): boolean =>\n status === \"COMPLETED\" || status === \"ERROR\" || status === \"TIMED_OUT\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\nexport const ProviderSession = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n status: SessionStatus,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n expiresAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n keepAlive: Schema.Boolean,\n proxyBytes: Schema.Finite,\n region: Schema.Literals([\"us-west-2\", \"us-east-1\", \"eu-central-1\", \"ap-southeast-1\"]),\n contextId: Schema.optionalKey(Identifier),\n});\n\nexport class SessionMetadata extends Schema.Class<SessionMetadata>(\"BrowserbaseSessionMetadata\")({\n reference: SessionReference,\n status: SessionStatus,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n expiresAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n keepAlive: Schema.Boolean,\n proxyBytes: Schema.Finite,\n region: ProviderSession.fields.region,\n contextId: Schema.optionalKey(Identifier),\n}) {}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,gBAAgB,OAAO,SAAS;CAC3C;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,MAAa,2BAA2B,WACtC,WAAW,eAAe,WAAW,WAAW,WAAW;AAE7D,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAE5D,MAAa,kBAAkB,OAAO,OAAO;CAC3C,IAAI;CACJ,WAAW;CACX,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,SAAS,OAAO,YAAY,SAAS;CACrC,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,QAAQ,OAAO,SAAS;EAAC;EAAa;EAAa;EAAgB;CAAgB,CAAC;CACpF,WAAW,OAAO,YAAY,UAAU;AAC1C,CAAC;AAED,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,WAAW;CACX,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,SAAS,OAAO,YAAY,SAAS;CACrC,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,QAAQ,gBAAgB,OAAO;CAC/B,WAAW,OAAO,YAAY,UAAU;AAC1C,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { o as SessionReference } from "./References-URDAtapt.mjs";
2
+ import { SessionError } from "./Errors.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
4
+ import { a as isTerminalSessionStatus, i as SessionStatus, r as SessionMetadata } from "./SessionData-DRKcKCqw.mjs";
5
+ import { Context, Effect, Layer, Redacted, Schema } from "effect";
6
+ //#region src/internal/browser/LiveView.d.ts
7
+ interface LiveView {
8
+ readonly session: Redacted.Redacted<string>;
9
+ readonly pages: ReadonlyArray<{
10
+ readonly liveViewPageId: string;
11
+ readonly url: Redacted.Redacted<string>;
12
+ }>;
13
+ readonly requestedTtlSeconds: number;
14
+ }
15
+ declare namespace Sessions_d_exports {
16
+ export { BrowserbaseSessions, LiveView, SessionListQuery, SessionLogEntry, SessionLogOptions, SessionMetadata, SessionStatus, SessionWaitOptions, isTerminalSessionStatus };
17
+ }
18
+ declare const SessionListQuery: Schema.Struct<{
19
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["PENDING", "RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]>>;
20
+ readonly q: Schema.optionalKey<Schema.NonEmptyString>;
21
+ }>;
22
+ type SessionListQuery = typeof SessionListQuery.Type;
23
+ declare const SessionWaitOptions: Schema.Struct<{
24
+ readonly timeoutMillis: Schema.Int;
25
+ readonly pollIntervalMillis: Schema.optionalKey<Schema.Int>;
26
+ }>;
27
+ type SessionWaitOptions = typeof SessionWaitOptions.Type;
28
+ declare const SessionLogEntry_base: Schema.Class<SessionLogEntry, Schema.Struct<{
29
+ readonly method: Schema.String;
30
+ readonly pageId: Schema.Int;
31
+ readonly frameId: Schema.optionalKey<Schema.String>;
32
+ readonly loaderId: Schema.optionalKey<Schema.String>;
33
+ readonly timestamp: Schema.optionalKey<Schema.Finite>;
34
+ readonly requestTimestamp: Schema.optionalKey<Schema.Finite>;
35
+ readonly responseTimestamp: Schema.optionalKey<Schema.Finite>;
36
+ readonly params: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
37
+ readonly result: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
38
+ }>, {}>;
39
+ /**
40
+ * One CDP-level log entry. Protocol payloads are present only when requested: they carry
41
+ * page content, cookies and typed input, so they are host evidence, never model input.
42
+ */
43
+ declare class SessionLogEntry extends SessionLogEntry_base {}
44
+ interface SessionLogOptions {
45
+ /** Include CDP `params`/`result` payloads. Off by default; see `SessionLogEntry`. */
46
+ readonly includePayloads?: boolean;
47
+ }
48
+ declare const BrowserbaseSessions_base: Context.ServiceClass<BrowserbaseSessions, "effect-browserbase/Sessions", {
49
+ readonly retrieve: (reference: SessionReference) => Effect.Effect<SessionMetadata, SessionError>;
50
+ readonly list: (query?: SessionListQuery) => Effect.Effect<ReadonlyArray<SessionMetadata>, SessionError>;
51
+ readonly requestRelease: (reference: SessionReference) => Effect.Effect<SessionMetadata, SessionError>;
52
+ readonly waitForTerminal: (reference: SessionReference, options: SessionWaitOptions) => Effect.Effect<SessionMetadata, SessionError>;
53
+ readonly waitUntilRunning: (reference: SessionReference, options: SessionWaitOptions) => Effect.Effect<SessionMetadata, SessionError>;
54
+ /** Session logs, bounded by the 1 MiB control-plane reply limit (`reason: "limit"`). */
55
+ readonly logs: (reference: SessionReference, options?: SessionLogOptions) => Effect.Effect<ReadonlyArray<SessionLogEntry>, SessionError>;
56
+ /**
57
+ * Redacted Live View URLs for any session in the project, owned or not. Issuing a URL
58
+ * grants view and input access to whoever holds it; it does not pause automation.
59
+ */
60
+ readonly liveUrls: (reference: SessionReference, expiresInSeconds?: number) => Effect.Effect<LiveView, SessionError>;
61
+ }>;
62
+ /** Passive inspection never releases a remote session. Release is a separate explicit mutation. */
63
+ declare class BrowserbaseSessions extends BrowserbaseSessions_base {
64
+ static readonly layer: Layer.Layer<BrowserbaseSessions, never, BrowserbaseClient>;
65
+ }
66
+ //#endregion
67
+ export { SessionWaitOptions as a, SessionLogOptions as i, SessionListQuery as n, Sessions_d_exports as o, SessionLogEntry as r, LiveView as s, BrowserbaseSessions as t };
68
+ //# sourceMappingURL=Sessions-B8E4kMxo.d.mts.map
@@ -0,0 +1,244 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Identifier, SessionReference } from "./References.mjs";
3
+ import { BrowserError, ClientError, SessionError } from "./Errors.mjs";
4
+ import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
5
+ import { ProviderSession, SessionMetadata, SessionStatus, isTerminalSessionStatus } from "./SessionData.mjs";
6
+ import { Clock, Context, Effect, Layer, Redacted, Schema } from "effect";
7
+ //#region src/internal/browser/LiveView.ts
8
+ const LiveUrl = Schema.String.check(Schema.isMaxLength(16384), Schema.makeFilter((value) => {
9
+ try {
10
+ const url = new URL(value);
11
+ return url.protocol === "https:" && !url.username && !url.password && (url.hostname === "browserbase.com" || url.hostname.endsWith(".browserbase.com"));
12
+ } catch {
13
+ return false;
14
+ }
15
+ }));
16
+ const Live = Schema.Struct({
17
+ debuggerFullscreenUrl: LiveUrl,
18
+ pages: Schema.Array(Schema.Struct({
19
+ id: Identifier,
20
+ debuggerFullscreenUrl: LiveUrl
21
+ })).check(Schema.isMaxLength(64))
22
+ });
23
+ /**
24
+ * Issuing a debugger URL is an authorization step, not proof that an operator took control.
25
+ * The URL is redacted here so it cannot be logged or returned as an ordinary model value.
26
+ */
27
+ const issueLiveUrls = Effect.fnUntraced(function* (client, reference, expiresInSeconds) {
28
+ if (!Number.isSafeInteger(expiresInSeconds) || expiresInSeconds < 1 || expiresInSeconds > 21600) return yield* ClientError.make({
29
+ operation: "provider-read",
30
+ reason: "configuration",
31
+ outcome: "undispatched"
32
+ });
33
+ if (reference.projectId !== client.projectId) return yield* ClientError.make({
34
+ operation: "provider-read",
35
+ reason: "authorization",
36
+ outcome: "undispatched"
37
+ });
38
+ const raw = yield* client.json("GET", `/v1/sessions/${encodeURIComponent(reference.sessionId)}/debug?expiresIn=${expiresInSeconds}`);
39
+ const value = yield* Schema.decodeUnknownEffect(Live)(raw).pipe(Effect.mapError(() => ClientError.make({
40
+ operation: "provider-read",
41
+ reason: "malformed"
42
+ })));
43
+ return {
44
+ session: Redacted.make(value.debuggerFullscreenUrl),
45
+ pages: value.pages.map((page) => ({
46
+ liveViewPageId: page.id,
47
+ url: Redacted.make(page.debuggerFullscreenUrl)
48
+ })),
49
+ requestedTtlSeconds: expiresInSeconds
50
+ };
51
+ });
52
+ const issueLiveView = (client, reference, expiresInSeconds) => issueLiveUrls(client, reference, expiresInSeconds).pipe(Effect.mapError((error) => BrowserError.make({
53
+ operation: "live-view",
54
+ reason: error.reason
55
+ })));
56
+ //#endregion
57
+ //#region src/Sessions.ts
58
+ var Sessions_exports = /* @__PURE__ */ __exportAll({
59
+ BrowserbaseSessions: () => BrowserbaseSessions,
60
+ SessionListQuery: () => SessionListQuery,
61
+ SessionLogEntry: () => SessionLogEntry,
62
+ SessionMetadata: () => SessionMetadata,
63
+ SessionStatus: () => SessionStatus,
64
+ SessionWaitOptions: () => SessionWaitOptions,
65
+ isTerminalSessionStatus: () => isTerminalSessionStatus
66
+ });
67
+ const SessionListQuery = Schema.Struct({
68
+ status: Schema.optionalKey(SessionStatus),
69
+ q: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(2048)))
70
+ });
71
+ const SessionWaitOptions = Schema.Struct({
72
+ timeoutMillis: Schema.Int.check(Schema.isBetween({
73
+ minimum: 1,
74
+ maximum: 6e5
75
+ })),
76
+ pollIntervalMillis: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
77
+ minimum: 25,
78
+ maximum: 5e3
79
+ })))
80
+ });
81
+ const Millis = Schema.Finite;
82
+ /**
83
+ * One CDP-level log entry. Protocol payloads are present only when requested: they carry
84
+ * page content, cookies and typed input, so they are host evidence, never model input.
85
+ */
86
+ var SessionLogEntry = class extends Schema.Class("BrowserbaseSessionLogEntry")({
87
+ method: Schema.String.check(Schema.isMaxLength(256)),
88
+ pageId: Schema.Int,
89
+ frameId: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(256))),
90
+ loaderId: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(256))),
91
+ timestamp: Schema.optionalKey(Millis),
92
+ requestTimestamp: Schema.optionalKey(Millis),
93
+ responseTimestamp: Schema.optionalKey(Millis),
94
+ params: Schema.optionalKey(Schema.Json),
95
+ result: Schema.optionalKey(Schema.Json)
96
+ }) {};
97
+ const ProviderLog = Schema.Struct({
98
+ method: SessionLogEntry.fields.method,
99
+ pageId: Schema.Int,
100
+ sessionId: Schema.String,
101
+ frameId: SessionLogEntry.fields.frameId,
102
+ loaderId: SessionLogEntry.fields.loaderId,
103
+ timestamp: Schema.optionalKey(Millis),
104
+ request: Schema.optionalKey(Schema.Struct({
105
+ params: Schema.optionalKey(Schema.Json),
106
+ timestamp: Schema.optionalKey(Millis)
107
+ })),
108
+ response: Schema.optionalKey(Schema.Struct({
109
+ result: Schema.optionalKey(Schema.Json),
110
+ timestamp: Schema.optionalKey(Millis)
111
+ }))
112
+ });
113
+ const now = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1e6));
114
+ const fromClient = (operation, error) => SessionError.make({
115
+ operation,
116
+ reason: error.reason,
117
+ ...error.outcome === void 0 ? {} : { outcome: error.outcome },
118
+ ...error.status === void 0 ? {} : { status: error.status },
119
+ ...error.retryAfterMillis === void 0 ? {} : { retryAfterMillis: error.retryAfterMillis }
120
+ });
121
+ const malformed = (operation, mutation = false) => SessionError.make({
122
+ operation,
123
+ reason: "malformed",
124
+ ...mutation ? { outcome: "unknown" } : {}
125
+ });
126
+ const configuration = (operation) => SessionError.make({
127
+ operation,
128
+ reason: "configuration",
129
+ outcome: "undispatched"
130
+ });
131
+ /** Passive inspection never releases a remote session. Release is a separate explicit mutation. */
132
+ var BrowserbaseSessions = class BrowserbaseSessions extends Context.Service()("effect-browserbase/Sessions") {
133
+ static layer = Layer.effect(BrowserbaseSessions, Effect.gen(function* () {
134
+ const client = yield* BrowserbaseClient;
135
+ const validate = Effect.fnUntraced(function* (reference, operation) {
136
+ const ref = yield* Schema.decodeEffect(SessionReference)(reference, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration(operation)));
137
+ if (ref.projectId !== client.projectId) return yield* SessionError.make({
138
+ operation,
139
+ reason: "authorization",
140
+ outcome: "undispatched"
141
+ });
142
+ return ref;
143
+ });
144
+ const decode = Effect.fnUntraced(function* (raw, operation, expected, mutation = false) {
145
+ const value = yield* Schema.decodeUnknownEffect(ProviderSession)(raw).pipe(Effect.mapError(() => malformed(operation, mutation)));
146
+ if (value.projectId !== client.projectId || expected !== void 0 && (value.id !== expected.sessionId || value.projectId !== expected.projectId)) return yield* malformed(operation, mutation);
147
+ const { id, projectId, ...metadata } = value;
148
+ return SessionMetadata.make({
149
+ reference: SessionReference.make({
150
+ provider: "browserbase",
151
+ projectId,
152
+ sessionId: id
153
+ }),
154
+ ...metadata
155
+ });
156
+ });
157
+ const read = Effect.fnUntraced(function* (reference, deadline) {
158
+ const ref = yield* validate(reference, "session-retrieve");
159
+ const raw = yield* client.json("GET", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, void 0, deadline).pipe(Effect.mapError((error) => fromClient("session-retrieve", error)));
160
+ return yield* decode(raw, "session-retrieve", ref);
161
+ });
162
+ const retrieve = Effect.fn("BrowserbaseSessions.retrieve")(function* (reference) {
163
+ return yield* read(reference);
164
+ });
165
+ const list = Effect.fn("BrowserbaseSessions.list")(function* (query = {}) {
166
+ const checked = yield* Schema.decodeEffect(SessionListQuery)(query, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration("session-list")));
167
+ const search = new URLSearchParams();
168
+ if (checked.status !== void 0) search.set("status", checked.status);
169
+ if (checked.q !== void 0) search.set("q", checked.q);
170
+ const raw = yield* client.json("GET", `/v1/sessions${search.size === 0 ? "" : `?${search}`}`).pipe(Effect.mapError((error) => fromClient("session-list", error)));
171
+ const rows = yield* Schema.decodeUnknownEffect(Schema.Array(ProviderSession).check(Schema.isMaxLength(1024)))(raw).pipe(Effect.mapError(() => malformed("session-list")));
172
+ if (new Set(rows.map((row) => row.id)).size !== rows.length) return yield* malformed("session-list");
173
+ const output = [];
174
+ for (const row of rows) output.push(yield* decode(row, "session-list"));
175
+ return output;
176
+ });
177
+ const requestRelease = Effect.fn("BrowserbaseSessions.requestRelease")(function* (reference) {
178
+ const ref = yield* validate(reference, "session-release");
179
+ const raw = yield* client.json("POST", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, {
180
+ projectId: ref.projectId,
181
+ status: "REQUEST_RELEASE"
182
+ }).pipe(Effect.mapError((error) => fromClient("session-release", error)));
183
+ return yield* decode(raw, "session-release", ref, true);
184
+ });
185
+ const wait = Effect.fnUntraced(function* (reference, options, untilRunning) {
186
+ const bounds = yield* Schema.decodeEffect(SessionWaitOptions)(options, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration("session-wait")));
187
+ const deadline = (yield* now) + bounds.timeoutMillis;
188
+ for (;;) {
189
+ const remaining = deadline - (yield* now);
190
+ if (remaining <= 0) return yield* SessionError.make({
191
+ operation: "session-wait",
192
+ reason: "timeout"
193
+ });
194
+ const metadata = yield* read(reference, deadline).pipe(Effect.timeoutOrElse({
195
+ duration: remaining,
196
+ orElse: () => Effect.fail(SessionError.make({
197
+ operation: "session-wait",
198
+ reason: "timeout"
199
+ }))
200
+ }));
201
+ if (untilRunning ? metadata.status === "RUNNING" : isTerminalSessionStatus(metadata.status)) return metadata;
202
+ if (untilRunning && isTerminalSessionStatus(metadata.status)) return yield* SessionError.make({
203
+ operation: "session-wait",
204
+ reason: "expired"
205
+ });
206
+ yield* Effect.sleep(Math.max(0, Math.min(bounds.pollIntervalMillis ?? 250, deadline - (yield* now))));
207
+ }
208
+ });
209
+ const logs = Effect.fn("BrowserbaseSessions.logs")(function* (reference, options = {}) {
210
+ const ref = yield* validate(reference, "session-logs");
211
+ const raw = yield* client.json("GET", `/v1/sessions/${encodeURIComponent(ref.sessionId)}/logs`).pipe(Effect.mapError((error) => fromClient("session-logs", error)));
212
+ const rows = yield* Schema.decodeUnknownEffect(Schema.Array(ProviderLog).check(Schema.isMaxLength(1e5)))(raw).pipe(Effect.mapError(() => malformed("session-logs")));
213
+ if (rows.some((row) => row.sessionId !== ref.sessionId)) return yield* malformed("session-logs");
214
+ return rows.map((row) => SessionLogEntry.make({
215
+ method: row.method,
216
+ pageId: row.pageId,
217
+ ...row.frameId === void 0 ? {} : { frameId: row.frameId },
218
+ ...row.loaderId === void 0 ? {} : { loaderId: row.loaderId },
219
+ ...row.timestamp === void 0 ? {} : { timestamp: row.timestamp },
220
+ ...row.request?.timestamp === void 0 ? {} : { requestTimestamp: row.request.timestamp },
221
+ ...row.response?.timestamp === void 0 ? {} : { responseTimestamp: row.response.timestamp },
222
+ ...options.includePayloads === true && row.request?.params !== void 0 ? { params: row.request.params } : {},
223
+ ...options.includePayloads === true && row.response?.result !== void 0 ? { result: row.response.result } : {}
224
+ }));
225
+ });
226
+ const liveUrls = Effect.fn("BrowserbaseSessions.liveUrls")(function* (reference, expiresInSeconds = 300) {
227
+ const ref = yield* validate(reference, "session-live-view");
228
+ return yield* issueLiveUrls(client, ref, expiresInSeconds).pipe(Effect.mapError((error) => fromClient("session-live-view", error)));
229
+ });
230
+ return BrowserbaseSessions.of({
231
+ logs,
232
+ liveUrls,
233
+ retrieve,
234
+ list,
235
+ requestRelease,
236
+ waitForTerminal: (ref, options) => wait(ref, options, false),
237
+ waitUntilRunning: (ref, options) => wait(ref, options, true)
238
+ });
239
+ }));
240
+ };
241
+ //#endregion
242
+ export { Sessions_exports as a, SessionWaitOptions as i, SessionListQuery as n, issueLiveView as o, SessionLogEntry as r, BrowserbaseSessions as t };
243
+
244
+ //# sourceMappingURL=Sessions-CtbseWEh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sessions-CtbseWEh.mjs","names":[],"sources":["../src/internal/browser/LiveView.ts","../src/Sessions.ts"],"sourcesContent":["import { Effect, Redacted, Schema } from \"effect\";\n\nimport type { BrowserbaseClient } from \"../../Client.ts\";\nimport { BrowserError, ClientError } from \"../../Errors.ts\";\nimport { Identifier, type SessionReference } from \"../../References.ts\";\n\nconst LiveUrl = Schema.String.check(\n Schema.isMaxLength(16384),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return (\n url.protocol === \"https:\" &&\n !url.username &&\n !url.password &&\n (url.hostname === \"browserbase.com\" || url.hostname.endsWith(\".browserbase.com\"))\n );\n } catch {\n return false;\n }\n }),\n);\n\nconst Live = Schema.Struct({\n debuggerFullscreenUrl: LiveUrl,\n pages: Schema.Array(Schema.Struct({ id: Identifier, debuggerFullscreenUrl: LiveUrl })).check(\n Schema.isMaxLength(64),\n ),\n});\n\nexport interface LiveView {\n readonly session: Redacted.Redacted<string>;\n readonly pages: ReadonlyArray<{\n readonly liveViewPageId: string;\n readonly url: Redacted.Redacted<string>;\n }>;\n readonly requestedTtlSeconds: number;\n}\n\n/**\n * Issuing a debugger URL is an authorization step, not proof that an operator took control.\n * The URL is redacted here so it cannot be logged or returned as an ordinary model value.\n */\nexport const issueLiveUrls = Effect.fnUntraced(function* (\n client: BrowserbaseClient[\"Service\"],\n reference: SessionReference,\n expiresInSeconds: number,\n) {\n if (!Number.isSafeInteger(expiresInSeconds) || expiresInSeconds < 1 || expiresInSeconds > 21600)\n return yield* ClientError.make({\n operation: \"provider-read\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n });\n if (reference.projectId !== client.projectId)\n return yield* ClientError.make({\n operation: \"provider-read\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n const raw = yield* client.json(\n \"GET\",\n `/v1/sessions/${encodeURIComponent(reference.sessionId)}/debug?expiresIn=${expiresInSeconds}`,\n );\n\n const value = yield* Schema.decodeUnknownEffect(Live)(raw).pipe(\n Effect.mapError(() => ClientError.make({ operation: \"provider-read\", reason: \"malformed\" })),\n );\n\n return {\n session: Redacted.make(value.debuggerFullscreenUrl),\n pages: value.pages.map((page) => ({\n liveViewPageId: page.id,\n url: Redacted.make(page.debuggerFullscreenUrl),\n })),\n requestedTtlSeconds: expiresInSeconds,\n } satisfies LiveView;\n});\n\nexport const issueLiveView = (\n client: BrowserbaseClient[\"Service\"],\n reference: SessionReference,\n expiresInSeconds: number,\n) =>\n issueLiveUrls(client, reference, expiresInSeconds).pipe(\n Effect.mapError((error) => BrowserError.make({ operation: \"live-view\", reason: error.reason })),\n );\n","import { Clock, Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport type { ClientError } from \"./Errors.ts\";\nimport { SessionError } from \"./Errors.ts\";\nimport { issueLiveUrls, type LiveView } from \"./internal/browser/LiveView.ts\";\nexport type { LiveView } from \"./internal/browser/LiveView.ts\";\nimport { SessionReference } from \"./References.ts\";\nimport {\n ProviderSession,\n SessionMetadata,\n SessionStatus,\n isTerminalSessionStatus,\n} from \"./SessionData.ts\";\nexport { SessionMetadata, SessionStatus, isTerminalSessionStatus } from \"./SessionData.ts\";\n\nexport const SessionListQuery = Schema.Struct({\n status: Schema.optionalKey(SessionStatus),\n q: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(2048))),\n});\n\nexport type SessionListQuery = typeof SessionListQuery.Type;\n\nexport const SessionWaitOptions = Schema.Struct({\n timeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600000 })),\n pollIntervalMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 25, maximum: 5000 })),\n ),\n});\n\nexport type SessionWaitOptions = typeof SessionWaitOptions.Type;\n\nconst Millis = Schema.Finite;\n\n/**\n * One CDP-level log entry. Protocol payloads are present only when requested: they carry\n * page content, cookies and typed input, so they are host evidence, never model input.\n */\nexport class SessionLogEntry extends Schema.Class<SessionLogEntry>(\"BrowserbaseSessionLogEntry\")({\n method: Schema.String.check(Schema.isMaxLength(256)),\n pageId: Schema.Int,\n frameId: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(256))),\n loaderId: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(256))),\n timestamp: Schema.optionalKey(Millis),\n requestTimestamp: Schema.optionalKey(Millis),\n responseTimestamp: Schema.optionalKey(Millis),\n params: Schema.optionalKey(Schema.Json),\n result: Schema.optionalKey(Schema.Json),\n}) {}\n\nconst ProviderLog = Schema.Struct({\n method: SessionLogEntry.fields.method,\n pageId: Schema.Int,\n sessionId: Schema.String,\n frameId: SessionLogEntry.fields.frameId,\n loaderId: SessionLogEntry.fields.loaderId,\n timestamp: Schema.optionalKey(Millis),\n request: Schema.optionalKey(\n Schema.Struct({\n params: Schema.optionalKey(Schema.Json),\n timestamp: Schema.optionalKey(Millis),\n }),\n ),\n response: Schema.optionalKey(\n Schema.Struct({\n result: Schema.optionalKey(Schema.Json),\n timestamp: Schema.optionalKey(Millis),\n }),\n ),\n});\n\nexport interface SessionLogOptions {\n /** Include CDP `params`/`result` payloads. Off by default; see `SessionLogEntry`. */\n readonly includePayloads?: boolean;\n}\n\nconst now = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1000000));\n\nconst fromClient = (operation: SessionError[\"operation\"], error: ClientError): SessionError =>\n SessionError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\nconst malformed = (operation: SessionError[\"operation\"], mutation = false) =>\n SessionError.make({\n operation,\n reason: \"malformed\",\n ...(mutation ? { outcome: \"unknown\" as const } : {}),\n });\n\nconst configuration = (operation: SessionError[\"operation\"]) =>\n SessionError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" });\n\n/** Passive inspection never releases a remote session. Release is a separate explicit mutation. */\nexport class BrowserbaseSessions extends Context.Service<\n BrowserbaseSessions,\n {\n readonly retrieve: (\n reference: SessionReference,\n ) => Effect.Effect<SessionMetadata, SessionError>;\n readonly list: (\n query?: SessionListQuery,\n ) => Effect.Effect<ReadonlyArray<SessionMetadata>, SessionError>;\n readonly requestRelease: (\n reference: SessionReference,\n ) => Effect.Effect<SessionMetadata, SessionError>;\n readonly waitForTerminal: (\n reference: SessionReference,\n options: SessionWaitOptions,\n ) => Effect.Effect<SessionMetadata, SessionError>;\n readonly waitUntilRunning: (\n reference: SessionReference,\n options: SessionWaitOptions,\n ) => Effect.Effect<SessionMetadata, SessionError>;\n /** Session logs, bounded by the 1 MiB control-plane reply limit (`reason: \"limit\"`). */\n readonly logs: (\n reference: SessionReference,\n options?: SessionLogOptions,\n ) => Effect.Effect<ReadonlyArray<SessionLogEntry>, SessionError>;\n /**\n * Redacted Live View URLs for any session in the project, owned or not. Issuing a URL\n * grants view and input access to whoever holds it; it does not pause automation.\n */\n readonly liveUrls: (\n reference: SessionReference,\n expiresInSeconds?: number,\n ) => Effect.Effect<LiveView, SessionError>;\n }\n>()(\"effect-browserbase/Sessions\") {\n static readonly layer: Layer.Layer<BrowserbaseSessions, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseSessions,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const validate = Effect.fnUntraced(function* (\n reference: SessionReference,\n operation: SessionError[\"operation\"],\n ) {\n const ref = yield* Schema.decodeEffect(SessionReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(operation)));\n\n if (ref.projectId !== client.projectId)\n return yield* SessionError.make({\n operation,\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n return ref;\n });\n\n const decode = Effect.fnUntraced(function* (\n raw: unknown,\n operation: SessionError[\"operation\"],\n expected?: SessionReference,\n mutation = false,\n ) {\n const value = yield* Schema.decodeUnknownEffect(ProviderSession)(raw).pipe(\n Effect.mapError(() => malformed(operation, mutation)),\n );\n\n if (\n value.projectId !== client.projectId ||\n (expected !== undefined &&\n (value.id !== expected.sessionId || value.projectId !== expected.projectId))\n )\n return yield* malformed(operation, mutation);\n const { id, projectId, ...metadata } = value;\n\n return SessionMetadata.make({\n reference: SessionReference.make({ provider: \"browserbase\", projectId, sessionId: id }),\n ...metadata,\n });\n });\n\n const read = Effect.fnUntraced(function* (reference: SessionReference, deadline?: number) {\n const ref = yield* validate(reference, \"session-retrieve\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, undefined, deadline)\n .pipe(Effect.mapError((error) => fromClient(\"session-retrieve\", error)));\n\n return yield* decode(raw, \"session-retrieve\", ref);\n });\n\n const retrieve = Effect.fn(\"BrowserbaseSessions.retrieve\")(function* (\n reference: SessionReference,\n ) {\n return yield* read(reference);\n });\n\n const list = Effect.fn(\"BrowserbaseSessions.list\")(function* (query: SessionListQuery = {}) {\n const checked = yield* Schema.decodeEffect(SessionListQuery)(query, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(\"session-list\")));\n\n const search = new URLSearchParams();\n\n if (checked.status !== undefined) search.set(\"status\", checked.status);\n if (checked.q !== undefined) search.set(\"q\", checked.q);\n\n const raw = yield* client\n .json(\"GET\", `/v1/sessions${search.size === 0 ? \"\" : `?${search}`}`)\n .pipe(Effect.mapError((error) => fromClient(\"session-list\", error)));\n\n const rows = yield* Schema.decodeUnknownEffect(\n Schema.Array(ProviderSession).check(Schema.isMaxLength(1024)),\n )(raw).pipe(Effect.mapError(() => malformed(\"session-list\")));\n\n if (new Set(rows.map((row) => row.id)).size !== rows.length)\n return yield* malformed(\"session-list\");\n const output: SessionMetadata[] = [];\n\n for (const row of rows) output.push(yield* decode(row, \"session-list\"));\n\n return output;\n });\n\n const requestRelease = Effect.fn(\"BrowserbaseSessions.requestRelease\")(function* (\n reference: SessionReference,\n ) {\n const ref = yield* validate(reference, \"session-release\");\n\n const raw = yield* client\n .json(\"POST\", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, {\n projectId: ref.projectId,\n status: \"REQUEST_RELEASE\",\n })\n .pipe(Effect.mapError((error) => fromClient(\"session-release\", error)));\n\n return yield* decode(raw, \"session-release\", ref, true);\n });\n\n const wait = Effect.fnUntraced(function* (\n reference: SessionReference,\n options: SessionWaitOptions,\n untilRunning: boolean,\n ) {\n const bounds = yield* Schema.decodeEffect(SessionWaitOptions)(options, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(\"session-wait\")));\n\n const deadline = (yield* now) + bounds.timeoutMillis;\n\n for (;;) {\n const remaining = deadline - (yield* now);\n\n if (remaining <= 0)\n return yield* SessionError.make({ operation: \"session-wait\", reason: \"timeout\" });\n\n // The deadline bounds the provider read too, not just sleeps between reads.\n const metadata = yield* read(reference, deadline).pipe(\n Effect.timeoutOrElse({\n duration: remaining,\n orElse: () =>\n Effect.fail(SessionError.make({ operation: \"session-wait\", reason: \"timeout\" })),\n }),\n );\n\n if (\n untilRunning ? metadata.status === \"RUNNING\" : isTerminalSessionStatus(metadata.status)\n )\n return metadata;\n if (untilRunning && isTerminalSessionStatus(metadata.status))\n return yield* SessionError.make({ operation: \"session-wait\", reason: \"expired\" });\n yield* Effect.sleep(\n Math.max(0, Math.min(bounds.pollIntervalMillis ?? 250, deadline - (yield* now))),\n );\n }\n });\n\n const logs = Effect.fn(\"BrowserbaseSessions.logs\")(function* (\n reference: SessionReference,\n options: SessionLogOptions = {},\n ) {\n const ref = yield* validate(reference, \"session-logs\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/sessions/${encodeURIComponent(ref.sessionId)}/logs`)\n .pipe(Effect.mapError((error) => fromClient(\"session-logs\", error)));\n\n const rows = yield* Schema.decodeUnknownEffect(\n Schema.Array(ProviderLog).check(Schema.isMaxLength(100_000)),\n )(raw).pipe(Effect.mapError(() => malformed(\"session-logs\")));\n\n if (rows.some((row) => row.sessionId !== ref.sessionId))\n return yield* malformed(\"session-logs\");\n\n return rows.map((row) =>\n SessionLogEntry.make({\n method: row.method,\n pageId: row.pageId,\n ...(row.frameId === undefined ? {} : { frameId: row.frameId }),\n ...(row.loaderId === undefined ? {} : { loaderId: row.loaderId }),\n ...(row.timestamp === undefined ? {} : { timestamp: row.timestamp }),\n ...(row.request?.timestamp === undefined\n ? {}\n : { requestTimestamp: row.request.timestamp }),\n ...(row.response?.timestamp === undefined\n ? {}\n : { responseTimestamp: row.response.timestamp }),\n ...(options.includePayloads === true && row.request?.params !== undefined\n ? { params: row.request.params }\n : {}),\n ...(options.includePayloads === true && row.response?.result !== undefined\n ? { result: row.response.result }\n : {}),\n }),\n );\n });\n\n const liveUrls = Effect.fn(\"BrowserbaseSessions.liveUrls\")(function* (\n reference: SessionReference,\n expiresInSeconds = 300,\n ) {\n const ref = yield* validate(reference, \"session-live-view\");\n\n return yield* issueLiveUrls(client, ref, expiresInSeconds).pipe(\n Effect.mapError((error) => fromClient(\"session-live-view\", error)),\n );\n });\n\n return BrowserbaseSessions.of({\n logs,\n liveUrls,\n retrieve,\n list,\n requestRelease,\n waitForTerminal: (ref, options) => wait(ref, options, false),\n waitUntilRunning: (ref, options) => wait(ref, options, true),\n });\n }),\n );\n}\n"],"mappings":";;;;;;;AAMA,MAAM,UAAU,OAAO,OAAO,MAC5B,OAAO,YAAY,KAAK,GACxB,OAAO,YAAY,UAAU;CAC3B,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,OACE,IAAI,aAAa,YACjB,CAAC,IAAI,YACL,CAAC,IAAI,aACJ,IAAI,aAAa,qBAAqB,IAAI,SAAS,SAAS,kBAAkB;CAEnF,QAAQ;EACN,OAAO;CACT;AACF,CAA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AAI,EAAE,WAAW,IAAI,UAAU;IAClE,GAAI,IAAI,SAAS,cAAc,KAAA,IAC3B,CAAC,IACD,EAAE,kBAAkB,IAAI,QAAQ,UAAU;IAC9C,GAAI,IAAI,UAAU,cAAc,KAAA,IAC5B,CAAC,IACD,EAAE,mBAAmB,IAAI,SAAS,UAAU;IAChD,GAAI,QAAQ,oBAAoB,QAAQ,IAAI,SAAS,WAAW,KAAA,IAC5D,EAAE,QAAQ,IAAI,QAAQ,OAAO,IAC7B,CAAC;IACL,GAAI,QAAQ,oBAAoB,QAAQ,IAAI,UAAU,WAAW,KAAA,IAC7D,EAAE,QAAQ,IAAI,SAAS,OAAO,IAC9B,CAAC;GACP,CAAC,CACH;EACF,CAAC;EAED,MAAM,WAAW,OAAO,GAAG,8BAA8B,CAAC,CAAC,WACzD,WACA,mBAAmB,KACnB;GACA,MAAM,MAAM,OAAO,SAAS,WAAW,mBAAmB;GAE1D,OAAO,OAAO,cAAc,QAAQ,KAAK,gBAAgB,CAAC,CAAC,KACzD,OAAO,UAAU,UAAU,WAAW,qBAAqB,KAAK,CAAC,CACnE;EACF,CAAC;EAED,OAAO,oBAAoB,GAAG;GAC5B;GACA;GACA;GACA;GACA;GACA,kBAAkB,KAAK,YAAY,KAAK,KAAK,SAAS,KAAK;GAC3D,mBAAmB,KAAK,YAAY,KAAK,KAAK,SAAS,IAAI;EAC7D,CAAC;CACH,CAAC,CACH;AACF"}
@@ -0,0 +1,3 @@
1
+ import { a as SessionWaitOptions, i as SessionLogOptions, n as SessionListQuery, r as SessionLogEntry, s as LiveView, t as BrowserbaseSessions } from "./Sessions-B8E4kMxo.mjs";
2
+ import { a as isTerminalSessionStatus, i as SessionStatus, r as SessionMetadata } from "./SessionData-DRKcKCqw.mjs";
3
+ export { BrowserbaseSessions, type LiveView, SessionListQuery, SessionLogEntry, SessionLogOptions, SessionMetadata, SessionStatus, SessionWaitOptions, isTerminalSessionStatus };
@@ -0,0 +1,3 @@
1
+ import { SessionMetadata, SessionStatus, isTerminalSessionStatus } from "./SessionData.mjs";
2
+ import { i as SessionWaitOptions, n as SessionListQuery, r as SessionLogEntry, t as BrowserbaseSessions } from "./Sessions-CtbseWEh.mjs";
3
+ export { BrowserbaseSessions, SessionListQuery, SessionLogEntry, SessionMetadata, SessionStatus, SessionWaitOptions, isTerminalSessionStatus };
@@ -0,0 +1,25 @@
1
+ import { ArtifactTransferPolicy } from "./Transfers.mjs";
2
+ import { Effect, Schema } from "effect";
3
+ //#region src/internal/artifact/TransferPolicy.ts
4
+ const DownloadTransferPolicy = Schema.Struct({
5
+ ...ArtifactTransferPolicy.fields,
6
+ mimeTypes: Schema.Array(Schema.String).check(Schema.isMinLength(1), Schema.isMaxLength(32))
7
+ });
8
+ /**
9
+ * Own the validated scalars before crossing an asynchronous provider boundary. The caller
10
+ * supplies its own declared failure so recordings, replays and files keep separate channels.
11
+ */
12
+ const transferPolicy = (policy, invalid) => Schema.decodeEffect(ArtifactTransferPolicy)(policy).pipe(Effect.map(({ maxBytes, timeoutMillis }) => Object.freeze({
13
+ maxBytes,
14
+ timeoutMillis: timeoutMillis ?? 6e4
15
+ })), Effect.mapError(invalid));
16
+ /** Preserve the existing case-sensitive allowlist while owning its contents. */
17
+ const downloadTransferPolicy = (policy, invalid) => Schema.decodeEffect(DownloadTransferPolicy)(policy).pipe(Effect.map(({ maxBytes, timeoutMillis, mimeTypes }) => Object.freeze({
18
+ maxBytes,
19
+ timeoutMillis: timeoutMillis ?? 6e4,
20
+ mimeTypes: Object.freeze([...mimeTypes])
21
+ })), Effect.mapError(invalid));
22
+ //#endregion
23
+ export { transferPolicy as n, downloadTransferPolicy as t };
24
+
25
+ //# sourceMappingURL=TransferPolicy-DQ06i7SZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransferPolicy-DQ06i7SZ.mjs","names":[],"sources":["../src/internal/artifact/TransferPolicy.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\n\nimport { ArtifactTransferPolicy } from \"../../Transfers.ts\";\n\nconst DownloadTransferPolicy = Schema.Struct({\n ...ArtifactTransferPolicy.fields,\n mimeTypes: Schema.Array(Schema.String).check(Schema.isMinLength(1), Schema.isMaxLength(32)),\n});\n\n/**\n * Own the validated scalars before crossing an asynchronous provider boundary. The caller\n * supplies its own declared failure so recordings, replays and files keep separate channels.\n */\nexport const transferPolicy = <E>(policy: ArtifactTransferPolicy, invalid: () => E) =>\n Schema.decodeEffect(ArtifactTransferPolicy)(policy).pipe(\n Effect.map(({ maxBytes, timeoutMillis }) =>\n Object.freeze({ maxBytes, timeoutMillis: timeoutMillis ?? 60_000 }),\n ),\n Effect.mapError(invalid),\n );\n\n/** Preserve the existing case-sensitive allowlist while owning its contents. */\nexport const downloadTransferPolicy = <E>(\n policy: ArtifactTransferPolicy & { readonly mimeTypes: ReadonlyArray<string> },\n invalid: () => E,\n) =>\n Schema.decodeEffect(DownloadTransferPolicy)(policy).pipe(\n Effect.map(({ maxBytes, timeoutMillis, mimeTypes }) =>\n Object.freeze({\n maxBytes,\n timeoutMillis: timeoutMillis ?? 60_000,\n mimeTypes: Object.freeze([...mimeTypes]),\n }),\n ),\n Effect.mapError(invalid),\n );\n"],"mappings":";;;AAIA,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG,uBAAuB;CAC1B,WAAW,OAAO,MAAM,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,GAAG,OAAO,YAAY,EAAE,CAAC;AAC5F,CAAC;;;;;AAMD,MAAa,kBAAqB,QAAgC,YAChE,OAAO,aAAa,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,KAClD,OAAO,KAAK,EAAE,UAAU,oBACtB,OAAO,OAAO;CAAE;CAAU,eAAe,iBAAiB;AAAO,CAAC,CACpE,GACA,OAAO,SAAS,OAAO,CACzB;;AAGF,MAAa,0BACX,QACA,YAEA,OAAO,aAAa,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,KAClD,OAAO,KAAK,EAAE,UAAU,eAAe,gBACrC,OAAO,OAAO;CACZ;CACA,eAAe,iBAAiB;CAChC,WAAW,OAAO,OAAO,CAAC,GAAG,SAAS,CAAC;AACzC,CAAC,CACH,GACA,OAAO,SAAS,OAAO,CACzB"}