effect-browserbase 0.2.0-beta.9 → 0.3.0-beta.11

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 (155) hide show
  1. package/README.md +277 -319
  2. package/dist/Browserbase-CaPKwEY9.mjs +544 -0
  3. package/dist/Browserbase-CaPKwEY9.mjs.map +1 -0
  4. package/dist/Browserbase.d.mts +110 -0
  5. package/dist/Browserbase.mjs +3 -0
  6. package/dist/BrowserbaseClient-CtAQ2rg4.d.mts +195 -0
  7. package/dist/BrowserbaseClient.d.mts +2 -0
  8. package/dist/BrowserbaseClient.mjs +190 -0
  9. package/dist/BrowserbaseClient.mjs.map +1 -0
  10. package/dist/BrowserbaseError-D1EOrLNc.d.mts +79 -0
  11. package/dist/BrowserbaseError.d.mts +2 -0
  12. package/dist/BrowserbaseError.mjs +101 -0
  13. package/dist/BrowserbaseError.mjs.map +1 -0
  14. package/dist/ContextLease.d.mts +42 -0
  15. package/dist/ContextLease.mjs +80 -0
  16. package/dist/ContextLease.mjs.map +1 -0
  17. package/dist/index.d.mts +5 -27
  18. package/dist/index.mjs +5 -26
  19. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  20. package/dist/testing/index.d.mts +136 -0
  21. package/dist/testing/index.mjs +440 -0
  22. package/dist/testing/index.mjs.map +1 -0
  23. package/package.json +51 -121
  24. package/src/Browserbase.ts +729 -0
  25. package/src/BrowserbaseClient.ts +559 -0
  26. package/src/BrowserbaseError.ts +108 -0
  27. package/src/ContextLease.ts +118 -0
  28. package/src/index.ts +7 -0
  29. package/src/internal/captureConnection.ts +214 -0
  30. package/src/testing/BrowserbaseContract.ts +170 -0
  31. package/src/testing/TestBrowserbase.ts +509 -0
  32. package/src/testing/index.ts +7 -0
  33. package/dist/Account.d.mts +0 -32
  34. package/dist/Account.mjs +0 -36
  35. package/dist/Account.mjs.map +0 -1
  36. package/dist/Acquisition-BOABu_qJ.mjs +0 -244
  37. package/dist/Acquisition-BOABu_qJ.mjs.map +0 -1
  38. package/dist/Agents-CPaTOH_g.d.mts +0 -156
  39. package/dist/Agents.d.mts +0 -3
  40. package/dist/Agents.mjs +0 -292
  41. package/dist/Agents.mjs.map +0 -1
  42. package/dist/Allocation.d.mts +0 -97
  43. package/dist/Allocation.mjs +0 -27
  44. package/dist/Allocation.mjs.map +0 -1
  45. package/dist/Authorization-Ll5f_XNM.mjs +0 -12
  46. package/dist/Authorization-Ll5f_XNM.mjs.map +0 -1
  47. package/dist/Browser-ByrWJ0ss.mjs +0 -274
  48. package/dist/Browser-ByrWJ0ss.mjs.map +0 -1
  49. package/dist/Browser.d.mts +0 -83
  50. package/dist/Browser.mjs +0 -3
  51. package/dist/BrowserBinding.d.mts +0 -13
  52. package/dist/BrowserBinding.mjs +0 -31
  53. package/dist/BrowserBinding.mjs.map +0 -1
  54. package/dist/Certificates-D4NQmyeA.d.mts +0 -34
  55. package/dist/Certificates.d.mts +0 -3
  56. package/dist/Certificates.mjs +0 -85
  57. package/dist/Certificates.mjs.map +0 -1
  58. package/dist/Cleanup-DMTDBir8.d.mts +0 -23
  59. package/dist/Cleanup.d.mts +0 -3
  60. package/dist/Cleanup.mjs +0 -43
  61. package/dist/Cleanup.mjs.map +0 -1
  62. package/dist/Client-BEC4Q8ZS.mjs +0 -564
  63. package/dist/Client-BEC4Q8ZS.mjs.map +0 -1
  64. package/dist/Client-B_f6bBLT.d.mts +0 -52
  65. package/dist/Client.d.mts +0 -3
  66. package/dist/Client.mjs +0 -2
  67. package/dist/Connection-sxyxtwlk.mjs +0 -56
  68. package/dist/Connection-sxyxtwlk.mjs.map +0 -1
  69. package/dist/ContextCoordination.d.mts +0 -29
  70. package/dist/ContextCoordination.mjs +0 -94
  71. package/dist/ContextCoordination.mjs.map +0 -1
  72. package/dist/ContextWriter-CiEma24z.mjs +0 -204
  73. package/dist/ContextWriter-CiEma24z.mjs.map +0 -1
  74. package/dist/Contexts-DqdL7cyX.d.mts +0 -31
  75. package/dist/Contexts.d.mts +0 -3
  76. package/dist/Contexts.mjs +0 -97
  77. package/dist/Contexts.mjs.map +0 -1
  78. package/dist/Deadline-CrViaogr.mjs +0 -13
  79. package/dist/Deadline-CrViaogr.mjs.map +0 -1
  80. package/dist/Downloads-CX52GOFJ.d.mts +0 -43
  81. package/dist/Downloads.d.mts +0 -3
  82. package/dist/Downloads.mjs +0 -137
  83. package/dist/Downloads.mjs.map +0 -1
  84. package/dist/Errors.d.mts +0 -100
  85. package/dist/Errors.mjs +0 -194
  86. package/dist/Errors.mjs.map +0 -1
  87. package/dist/Extensions-BTUn9zhK.mjs +0 -231
  88. package/dist/Extensions-BTUn9zhK.mjs.map +0 -1
  89. package/dist/Extensions-DBXuVM1f.d.mts +0 -43
  90. package/dist/Extensions.d.mts +0 -3
  91. package/dist/Extensions.mjs +0 -2
  92. package/dist/Functions-CsKMMUuZ.d.mts +0 -226
  93. package/dist/Functions.d.mts +0 -3
  94. package/dist/Functions.mjs +0 -318
  95. package/dist/Functions.mjs.map +0 -1
  96. package/dist/Issued-DejqoMYL.mjs +0 -15
  97. package/dist/Issued-DejqoMYL.mjs.map +0 -1
  98. package/dist/Launch-cAdE2rrZ.mjs +0 -115
  99. package/dist/Launch-cAdE2rrZ.mjs.map +0 -1
  100. package/dist/Launch.d.mts +0 -127
  101. package/dist/Launch.mjs +0 -97
  102. package/dist/Launch.mjs.map +0 -1
  103. package/dist/PageFetch-CjAM_0DS.d.mts +0 -40
  104. package/dist/PageFetch.d.mts +0 -3
  105. package/dist/PageFetch.mjs +0 -59
  106. package/dist/PageFetch.mjs.map +0 -1
  107. package/dist/Projects-tm5bTDH0.d.mts +0 -38
  108. package/dist/Projects.d.mts +0 -3
  109. package/dist/Projects.mjs +0 -65
  110. package/dist/Projects.mjs.map +0 -1
  111. package/dist/Recordings-B9k5aODB.d.mts +0 -27
  112. package/dist/Recordings.d.mts +0 -3
  113. package/dist/Recordings.mjs +0 -144
  114. package/dist/Recordings.mjs.map +0 -1
  115. package/dist/References-DOH3Wu44.d.mts +0 -34
  116. package/dist/References.d.mts +0 -3
  117. package/dist/References.mjs +0 -33
  118. package/dist/References.mjs.map +0 -1
  119. package/dist/Replays-mV93WGtx.d.mts +0 -27
  120. package/dist/Replays.d.mts +0 -3
  121. package/dist/Replays.mjs +0 -107
  122. package/dist/Replays.mjs.map +0 -1
  123. package/dist/Resource-J7Kkk5mu.mjs +0 -54
  124. package/dist/Resource-J7Kkk5mu.mjs.map +0 -1
  125. package/dist/Search-B64e7g-h.d.mts +0 -37
  126. package/dist/Search.d.mts +0 -3
  127. package/dist/Search.mjs +0 -46
  128. package/dist/Search.mjs.map +0 -1
  129. package/dist/SessionData-5xYZDshJ.d.mts +0 -38
  130. package/dist/SessionData.d.mts +0 -3
  131. package/dist/SessionData.mjs +0 -48
  132. package/dist/SessionData.mjs.map +0 -1
  133. package/dist/Sessions-D2H5m6rF.mjs +0 -260
  134. package/dist/Sessions-D2H5m6rF.mjs.map +0 -1
  135. package/dist/Sessions-oJEUmZth.d.mts +0 -69
  136. package/dist/Sessions.d.mts +0 -4
  137. package/dist/Sessions.mjs +0 -3
  138. package/dist/Testing.d.mts +0 -119
  139. package/dist/Testing.mjs +0 -206
  140. package/dist/Testing.mjs.map +0 -1
  141. package/dist/TransferPolicy-DQ06i7SZ.mjs +0 -25
  142. package/dist/TransferPolicy-DQ06i7SZ.mjs.map +0 -1
  143. package/dist/Transfers-GVqzrDWl.d.mts +0 -89
  144. package/dist/Transfers.d.mts +0 -3
  145. package/dist/Transfers.mjs +0 -85
  146. package/dist/Transfers.mjs.map +0 -1
  147. package/dist/Uploads-C2_bACgv.d.mts +0 -28
  148. package/dist/Uploads.d.mts +0 -3
  149. package/dist/Uploads.mjs +0 -105
  150. package/dist/Uploads.mjs.map +0 -1
  151. package/dist/Webhooks-BoeRAxzG.d.mts +0 -59
  152. package/dist/Webhooks.d.mts +0 -3
  153. package/dist/Webhooks.mjs +0 -134
  154. package/dist/Webhooks.mjs.map +0 -1
  155. package/dist/WriterFacts-BBJRDZYY.d.mts +0 -54
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContextWriter-CiEma24z.mjs","names":[],"sources":["../src/internal/session/WriterFacts.ts","../src/internal/session/ContextWriter.ts"],"sourcesContent":["import { type Effect, Schema } from \"effect\";\n\nimport { CleanupResult } from \"../../Cleanup.ts\";\nimport { AllocationAttempt, ContextReference, SessionReference } from \"../../References.ts\";\n\n/**\n * The writer vocabulary both the public coordination entry point and the permit\n * implementation need. Keeping it here leaves one direction of dependency:\n * `ContextCoordination` and `ContextWriter` both read this module, never each other.\n */\nexport const PersistenceEvidence = Schema.Union([\n Schema.TaggedStruct(\"NotRequested\", {}),\n Schema.TaggedStruct(\"Unconfirmed\", {\n reason: Schema.Literals([\"writer-active\", \"writer-unknown\", \"flush-unacknowledged\"]),\n }),\n Schema.TaggedStruct(\"Observed\", {\n method: Schema.Literal(\"consumer-readback\"),\n observedAtMillis: Schema.Finite,\n }),\n]);\n\nexport type PersistenceEvidence = typeof PersistenceEvidence.Type;\n\nexport class WriterAttemptFacts extends Schema.Class<WriterAttemptFacts>(\n \"BrowserbaseWriterAttemptFacts\",\n)({\n attempt: AllocationAttempt,\n session: Schema.optionalKey(SessionReference),\n state: Schema.Literals([\"admitted\", \"rejected\", \"unknown\", \"terminal\"]),\n cleanup: Schema.optionalKey(CleanupResult),\n}) {}\n\nexport class WriterSettlementFacts extends Schema.Class<WriterSettlementFacts>(\n \"BrowserbaseWriterSettlementFacts\",\n)({\n reference: ContextReference,\n attempts: Schema.Array(WriterAttemptFacts).check(Schema.isMaxLength(64)),\n persistence: PersistenceEvidence,\n disposition: Schema.Literals([\"release\", \"quarantine\"]),\n}) {}\n\nexport interface WriterLease<E, R> {\n readonly settle: (facts: WriterSettlementFacts) => Effect.Effect<void, E, R>;\n}\n\nexport interface ContextWriterBackend<E, R> {\n readonly acquire: (reference: ContextReference) => Effect.Effect<WriterLease<E, R>, E, R>;\n}\n\nexport interface ContextWriterPermit {\n readonly _tag: \"ContextWriterPermit\";\n readonly reference: ContextReference;\n}\n\nexport interface WriterOptions<A, VerifyE, VerifyR> {\n /** Bounded consumer-controlled readback, not a provider-wide flush acknowledgement. */\n readonly verify?: (value: A) => Effect.Effect<void, VerifyE, VerifyR>;\n readonly settlementTimeoutMillis?: number;\n}\n","import { Effect } from \"effect\";\n\nimport type { CleanupResult } from \"../../Cleanup.ts\";\nimport { ContextError } from \"../../Errors.ts\";\nimport type { AllocationAttempt, ContextReference, SessionReference } from \"../../References.ts\";\nimport {\n type ContextWriterPermit,\n type PersistenceEvidence,\n WriterAttemptFacts,\n WriterSettlementFacts,\n} from \"./WriterFacts.ts\";\n\n/** There is one record per exact allocation attempt, not parallel uncorrelated arrays. */\ninterface AttemptRecord {\n readonly attempt: AllocationAttempt;\n session?: SessionReference;\n state: \"admitted\" | \"rejected\" | \"unknown\" | \"terminal\";\n cleanup?: CleanupResult;\n}\n\nexport interface ContextWriterPermitInternal extends ContextWriterPermit {\n readonly recordAttempt: (attempt: AllocationAttempt) => Effect.Effect<void, ContextError>;\n readonly recordSession: (attempt: AllocationAttempt, reference: SessionReference) => void;\n readonly rejected: (attempt: AllocationAttempt) => void;\n readonly uncertain: (attempt: AllocationAttempt) => void;\n readonly completed: (attempt: AllocationAttempt, cleanup: CleanupResult) => void;\n readonly confirmReadback: (atMillis: number) => Effect.Effect<void, ContextError>;\n readonly quarantine: Effect.Effect<void>;\n readonly snapshot: Effect.Effect<WriterSettlementFacts>;\n}\n\n/** A writer retired without release. Its permit keeps collecting late evidence for reconciliation. */\ninterface Quarantine {\n readonly _tag: \"Quarantined\";\n readonly permit: ContextWriterPermitInternal;\n}\n\n/** Holds a Context while reconciliation checks it, so no writer is admitted against that evidence. */\ninterface Reconciliation {\n readonly _tag: \"Reconciling\";\n}\n\nconst authentic = new WeakMap<ContextWriterPermit, ContextWriterPermitInternal>();\nconst active = new Map<string, ContextWriterPermitInternal | Quarantine | Reconciliation>();\nconst key = (ref: ContextReference) => `${ref.projectId}/${ref.contextId}`;\n\nexport const isContextWriterBusy = (ref: ContextReference): boolean => active.has(key(ref));\n\nexport const makeContextWriterPermit = (\n reference: ContextReference,\n): Effect.Effect<ContextWriterPermitInternal, ContextError> =>\n Effect.suspend(() => {\n if (active.has(key(reference)) || active.size >= 2048)\n return Effect.fail(\n ContextError.make({ operation: \"writer\", reason: \"active\", outcome: \"undispatched\" }),\n );\n const owned = Object.freeze(reference);\n const attempts = new Map<string, AttemptRecord>();\n\n let closed = false,\n quarantined = false;\n\n let persistence: PersistenceEvidence = { _tag: \"NotRequested\" };\n\n const unknown = () => {\n quarantined = true;\n persistence = { _tag: \"Unconfirmed\", reason: \"writer-unknown\" };\n };\n\n const noActive = () =>\n [...attempts.values()].every(\n (entry) => entry.state === \"rejected\" || entry.state === \"terminal\",\n );\n\n const permit: ContextWriterPermitInternal = {\n _tag: \"ContextWriterPermit\",\n reference: owned,\n recordAttempt: (attempt) =>\n Effect.suspend(() => {\n if (\n closed ||\n quarantined ||\n !noActive() ||\n attempt.projectId !== owned.projectId ||\n (attempts.size > 0 && persistence._tag === \"Unconfirmed\")\n ) {\n return Effect.fail(\n ContextError.make({\n operation: \"writer-admit\",\n reason: \"active\",\n outcome: \"undispatched\",\n }),\n );\n }\n if (attempts.has(attempt.attemptId) || attempts.size >= 64)\n return Effect.fail(\n ContextError.make({\n operation: \"writer-admit\",\n reason: \"limit\",\n outcome: \"undispatched\",\n }),\n );\n const copy = Object.freeze(attempt);\n\n attempts.set(copy.attemptId, { attempt: copy, state: \"admitted\" });\n persistence = { _tag: \"Unconfirmed\", reason: \"writer-active\" };\n\n return Effect.void;\n }),\n recordSession: (attempt, session) => {\n const record = attempts.get(attempt.attemptId);\n\n if (\n record === undefined ||\n record.attempt !== attempt ||\n session.projectId !== owned.projectId ||\n (record.session !== undefined && record.session.sessionId !== session.sessionId)\n ) {\n unknown();\n\n return;\n }\n // Retain identity even when cancellation/quarantine races a late allocation reply.\n record.session = Object.freeze(session);\n },\n rejected: (attempt) => {\n const record = attempts.get(attempt.attemptId);\n\n if (record === undefined || record.attempt !== attempt || record.session !== undefined) {\n unknown();\n\n return;\n }\n record.state = \"rejected\";\n if ([...attempts.values()].every((item) => item.state === \"rejected\"))\n persistence = { _tag: \"NotRequested\" };\n },\n uncertain: (attempt) => {\n const record = attempts.get(attempt.attemptId);\n\n if (record !== undefined && record.attempt === attempt) record.state = \"unknown\";\n unknown();\n },\n completed: (attempt, cleanup) => {\n const record = attempts.get(attempt.attemptId);\n\n if (\n record === undefined ||\n record.attempt !== attempt ||\n cleanup.ownership !== \"owned\" ||\n record.session === undefined ||\n record.session.sessionId !== cleanup.reference.sessionId ||\n cleanup.reference.projectId !== owned.projectId\n ) {\n unknown();\n\n return;\n }\n record.cleanup = cleanup;\n if (cleanup.remote !== \"confirmed\") {\n record.state = \"unknown\";\n unknown();\n\n return;\n }\n record.state = \"terminal\";\n if (cleanup.observedStatus !== \"COMPLETED\") {\n unknown();\n\n return;\n }\n if (!quarantined) persistence = { _tag: \"Unconfirmed\", reason: \"flush-unacknowledged\" };\n },\n confirmReadback: (atMillis) =>\n Effect.suspend(() => {\n if (\n closed ||\n quarantined ||\n !noActive() ||\n !Number.isFinite(atMillis) ||\n attempts.size === 0 ||\n [...attempts.values()].some(\n (entry) =>\n entry.state === \"terminal\" && entry.cleanup?.observedStatus !== \"COMPLETED\",\n )\n ) {\n return Effect.fail(\n ContextError.make({\n operation: \"writer-readback\",\n reason: \"active\",\n outcome: \"undispatched\",\n }),\n );\n }\n persistence = {\n _tag: \"Observed\",\n method: \"consumer-readback\",\n observedAtMillis: atMillis,\n };\n\n return Effect.void;\n }),\n quarantine: Effect.sync(unknown),\n snapshot: Effect.sync(() =>\n WriterSettlementFacts.make({\n reference: owned,\n attempts: [...attempts.values()].map((entry) =>\n WriterAttemptFacts.make({\n attempt: entry.attempt,\n state: entry.state,\n ...(entry.session === undefined ? {} : { session: entry.session }),\n ...(entry.cleanup === undefined ? {} : { cleanup: entry.cleanup }),\n }),\n ),\n persistence,\n disposition:\n quarantined || !noActive() || persistence._tag === \"Unconfirmed\"\n ? \"quarantine\"\n : \"release\",\n }),\n ),\n };\n\n Object.freeze(permit);\n authentic.set(permit, permit);\n active.set(key(owned), permit);\n // Explicit retirement closes admission without losing evidence attached to escaped permits.\n retirement.set(permit, (released) => {\n closed = true;\n if (active.get(key(owned)) !== permit) return;\n if (released) active.delete(key(owned));\n else active.set(key(owned), { _tag: \"Quarantined\", permit });\n });\n\n return Effect.succeed(permit);\n });\n\nconst retirement = new WeakMap<ContextWriterPermitInternal, (released: boolean) => void>();\n\nexport const closeContextWriterPermit = (\n permit: ContextWriterPermitInternal,\n released: boolean,\n): void => retirement.get(permit)?.(released);\n\nexport interface ReconciliationClaim {\n /** What the quarantined writer has recorded by now; empty when this process holds no quarantine. */\n readonly attempts: Effect.Effect<ReadonlyArray<WriterAttemptFacts>>;\n /** Lifts the quarantine, or puts it back when reconciliation did not succeed. */\n readonly finish: (reconciled: boolean) => void;\n}\n\nexport const claimReconciliation = (\n reference: ContextReference,\n): Effect.Effect<ReconciliationClaim, ContextError> =>\n Effect.suspend(() => {\n const held = active.get(key(reference));\n\n if (\n held?._tag === \"ContextWriterPermit\" ||\n held?._tag === \"Reconciling\" ||\n (held === undefined && active.size >= 2048)\n ) {\n return Effect.fail(\n ContextError.make({\n operation: \"writer-reconcile\",\n reason: \"active\",\n outcome: \"undispatched\",\n }),\n );\n }\n const claim: Reconciliation = { _tag: \"Reconciling\" };\n\n active.set(key(reference), claim);\n\n return Effect.succeed({\n attempts:\n held === undefined\n ? Effect.succeed([])\n : held.permit.snapshot.pipe(Effect.map((facts) => facts.attempts)),\n finish: (reconciled) => {\n if (active.get(key(reference)) !== claim) return;\n if (reconciled || held === undefined) active.delete(key(reference));\n else active.set(key(reference), held);\n },\n });\n });\n\nexport const requireContextWriterPermit = (\n permit: ContextWriterPermit,\n reference: ContextReference,\n): Effect.Effect<ContextWriterPermitInternal, ContextError> =>\n Effect.suspend(() => {\n const actual = authentic.get(permit);\n\n return actual !== undefined &&\n active.get(key(reference)) === actual &&\n actual.reference.contextId === reference.contextId &&\n actual.reference.projectId === reference.projectId\n ? Effect.succeed(actual)\n : Effect.fail(\n ContextError.make({\n operation: \"writer-authority\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n }),\n );\n });\n"],"mappings":";;;;;;;;;;AAUA,MAAa,sBAAsB,OAAO,MAAM;CAC9C,OAAO,aAAa,gBAAgB,CAAC,CAAC;CACtC,OAAO,aAAa,eAAe,EACjC,QAAQ,OAAO,SAAS;EAAC;EAAiB;EAAkB;CAAsB,CAAC,EACrF,CAAC;CACD,OAAO,aAAa,YAAY;EAC9B,QAAQ,OAAO,QAAQ,mBAAmB;EAC1C,kBAAkB,OAAO;CAC3B,CAAC;AACH,CAAC;AAID,IAAa,qBAAb,cAAwC,OAAO,MAC7C,+BACF,CAAC,CAAC;CACA,SAAS;CACT,SAAS,OAAO,YAAY,gBAAgB;CAC5C,OAAO,OAAO,SAAS;EAAC;EAAY;EAAY;EAAW;CAAU,CAAC;CACtE,SAAS,OAAO,YAAY,aAAa;AAC3C,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,wBAAb,cAA2C,OAAO,MAChD,kCACF,CAAC,CAAC;CACA,WAAW;CACX,UAAU,OAAO,MAAM,kBAAkB,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,CAAC;CACvE,aAAa;CACb,aAAa,OAAO,SAAS,CAAC,WAAW,YAAY,CAAC;AACxD,CAAC,CAAC,CAAC,CAAC;;;ACGJ,MAAM,4BAAY,IAAI,QAA0D;AAChF,MAAM,yBAAS,IAAI,IAAuE;AAC1F,MAAM,OAAO,QAA0B,GAAG,IAAI,UAAU,GAAG,IAAI;AAE/D,MAAa,uBAAuB,QAAmC,OAAO,IAAI,IAAI,GAAG,CAAC;AAE1F,MAAa,2BACX,cAEA,OAAO,cAAc;CACnB,IAAI,OAAO,IAAI,IAAI,SAAS,CAAC,KAAK,OAAO,QAAQ,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EACR,SAAS;CACX,CAAC,CACH;CAEF,MAAM,QAAwB,EAAE,MAAM,cAAc;CAEpD,OAAO,IAAI,IAAI,SAAS,GAAG,KAAK;CAEhC,OAAO,OAAO,QAAQ;EACpB,UACE,SAAS,KAAA,IACL,OAAO,QAAQ,CAAC,CAAC,IACjB,KAAK,OAAO,SAAS,KAAK,OAAO,KAAK,UAAU,MAAM,QAAQ,CAAC;EACrE,SAAS,eAAe;GACtB,IAAI,OAAO,IAAI,IAAI,SAAS,CAAC,MAAM,OAAO;GAC1C,IAAI,cAAc,SAAS,KAAA,GAAW,OAAO,OAAO,IAAI,SAAS,CAAC;QAC7D,OAAO,IAAI,IAAI,SAAS,GAAG,IAAI;EACtC;CACF,CAAC;AACH,CAAC;AAEH,MAAa,8BACX,QACA,cAEA,OAAO,cAAc;CACnB,MAAM,SAAS,UAAU,IAAI,MAAM;CAEnC,OAAO,WAAW,KAAA,KAChB,OAAO,IAAI,IAAI,SAAS,CAAC,MAAM,UAC/B,OAAO,UAAU,cAAc,UAAU,aACzC,OAAO,UAAU,cAAc,UAAU,YACvC,OAAO,QAAQ,MAAM,IACrB,OAAO,KACL,aAAa,KAAK;EAChB,WAAW;EACX,QAAQ;EACR,SAAS;CACX,CAAC,CACH;AACN,CAAC"}
@@ -1,31 +0,0 @@
1
- import { n as ContextReference } from "./References-DOH3Wu44.mjs";
2
- import { ContextError } from "./Errors.mjs";
3
- import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
4
- import { Context, Effect, Layer, Schema } from "effect";
5
- //#region src/Contexts.d.ts
6
- declare const ContextMetadata_base: Schema.Class<ContextMetadata, Schema.Struct<{
7
- readonly reference: typeof ContextReference;
8
- readonly createdAt: Schema.String;
9
- readonly updatedAt: Schema.String;
10
- readonly name: Schema.optionalKey<Schema.String>;
11
- }>, {}>;
12
- declare class ContextMetadata extends ContextMetadata_base {}
13
- declare const ContextCreation_base: Schema.Class<ContextCreation, Schema.Struct<{
14
- readonly reference: typeof ContextReference;
15
- }>, {}>;
16
- declare class ContextCreation extends ContextCreation_base {}
17
- declare const BrowserbaseContexts_base: Context.ServiceClass<BrowserbaseContexts, "effect-browserbase/Contexts", {
18
- readonly create: (options?: {
19
- readonly name?: string;
20
- }) => Effect.Effect<ContextCreation, ContextError>;
21
- readonly retrieve: (reference: ContextReference) => Effect.Effect<ContextMetadata, ContextError>;
22
- readonly delete: (reference: ContextReference) => Effect.Effect<void, ContextError>;
23
- }>;
24
- /** Context administration is independent of any live browser connection. */
25
- declare class BrowserbaseContexts extends BrowserbaseContexts_base {
26
- static readonly layer: Layer.Layer<BrowserbaseContexts, never, BrowserbaseClient>;
27
- }
28
- //#endregion
29
- export { ContextCreation as n, ContextMetadata as r, BrowserbaseContexts as t };
30
- export {};
31
- //# sourceMappingURL=Contexts-DqdL7cyX.d.mts.map
@@ -1,3 +0,0 @@
1
- import { n as ContextCreation, r as ContextMetadata, t as BrowserbaseContexts } from "./Contexts-DqdL7cyX.mjs";
2
- export { BrowserbaseContexts, ContextCreation, ContextMetadata };
3
- export {};
package/dist/Contexts.mjs DELETED
@@ -1,97 +0,0 @@
1
- import { ContextReference, Identifier } from "./References.mjs";
2
- import { ContextError } from "./Errors.mjs";
3
- import { r as span, t as BrowserbaseClient } from "./Client-BEC4Q8ZS.mjs";
4
- import { r as isContextWriterBusy } from "./ContextWriter-CiEma24z.mjs";
5
- import { Context, Effect, Layer, Schema } from "effect";
6
- //#region src/Contexts.ts
7
- const Timestamp = Schema.String.check(Schema.isMaxLength(64));
8
- const ContextName = Schema.NonEmptyString.check(Schema.isMaxLength(1024), Schema.makeFilter((value) => value.trim().length > 0));
9
- const ProviderContext = Schema.Struct({
10
- id: Identifier,
11
- projectId: Identifier,
12
- createdAt: Timestamp,
13
- updatedAt: Timestamp,
14
- name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024)))
15
- });
16
- var ContextMetadata = class extends Schema.Class("BrowserbaseContextMetadata")({
17
- reference: ContextReference,
18
- createdAt: Timestamp,
19
- updatedAt: Timestamp,
20
- name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024)))
21
- }) {};
22
- var ContextCreation = class extends Schema.Class("BrowserbaseContextCreation")({ reference: ContextReference }) {};
23
- const fromClient = (operation, error) => ContextError.make({
24
- operation,
25
- reason: error.reason,
26
- ...error.outcome === void 0 ? {} : { outcome: error.outcome },
27
- ...error.status === void 0 ? {} : { status: error.status },
28
- ...error.retryAfterMillis === void 0 ? {} : { retryAfterMillis: error.retryAfterMillis }
29
- });
30
- const configuration = (operation) => ContextError.make({
31
- operation,
32
- reason: "configuration",
33
- outcome: "undispatched"
34
- });
35
- const malformed = (operation, mutation = false) => ContextError.make({
36
- operation,
37
- reason: "malformed",
38
- ...mutation ? { outcome: "unknown" } : {}
39
- });
40
- /** Context administration is independent of any live browser connection. */
41
- var BrowserbaseContexts = class BrowserbaseContexts extends Context.Service()("effect-browserbase/Contexts") {
42
- static layer = Layer.effect(BrowserbaseContexts, Effect.gen(function* () {
43
- const client = yield* BrowserbaseClient;
44
- const validate = Effect.fnUntraced(function* (reference, operation) {
45
- const ref = yield* Schema.decodeEffect(ContextReference)(reference, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration(operation)));
46
- if (ref.projectId !== client.projectId) return yield* ContextError.make({
47
- operation,
48
- reason: "authorization",
49
- outcome: "undispatched"
50
- });
51
- return ref;
52
- });
53
- const create = Effect.fnUntraced(function* (options = {}) {
54
- const value = yield* Schema.decodeEffect(Schema.Struct({ name: Schema.optionalKey(ContextName) }))(options, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration("context-create")));
55
- const raw = yield* client.json("POST", "/v1/contexts", {
56
- projectId: client.projectId,
57
- ...value.name === void 0 ? {} : { name: value.name.trim() }
58
- }).pipe(Effect.mapError((error) => fromClient("context-create", error)));
59
- const created = yield* Schema.decodeUnknownEffect(Schema.Struct({ id: Identifier }))(raw).pipe(Effect.mapError(() => malformed("context-create", true)));
60
- return ContextCreation.make({ reference: ContextReference.make({
61
- provider: "browserbase",
62
- projectId: client.projectId,
63
- contextId: created.id
64
- }) });
65
- }, span("BrowserbaseContexts.create"));
66
- const retrieve = Effect.fnUntraced(function* (reference) {
67
- const ref = yield* validate(reference, "context-retrieve");
68
- const raw = yield* client.json("GET", `/v1/contexts/${encodeURIComponent(ref.contextId)}`).pipe(Effect.mapError((error) => fromClient("context-retrieve", error)));
69
- const value = yield* Schema.decodeUnknownEffect(ProviderContext)(raw).pipe(Effect.mapError(() => malformed("context-retrieve")));
70
- if (value.id !== ref.contextId || value.projectId !== ref.projectId) return yield* malformed("context-retrieve");
71
- return ContextMetadata.make({
72
- reference: ref,
73
- createdAt: value.createdAt,
74
- updatedAt: value.updatedAt,
75
- ...value.name === void 0 ? {} : { name: value.name }
76
- });
77
- }, span("BrowserbaseContexts.retrieve"));
78
- const remove = Effect.fnUntraced(function* (reference) {
79
- const ref = yield* validate(reference, "context-delete");
80
- if (isContextWriterBusy(ref)) return yield* ContextError.make({
81
- operation: "context-delete",
82
- reason: "active",
83
- outcome: "undispatched"
84
- });
85
- yield* client.noContent("DELETE", `/v1/contexts/${encodeURIComponent(ref.contextId)}`).pipe(Effect.mapError((error) => fromClient("context-delete", error)));
86
- }, span("BrowserbaseContexts.delete"));
87
- return BrowserbaseContexts.of({
88
- create,
89
- retrieve,
90
- delete: remove
91
- });
92
- }));
93
- };
94
- //#endregion
95
- export { BrowserbaseContexts, ContextCreation, ContextMetadata };
96
-
97
- //# sourceMappingURL=Contexts.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Contexts.mjs","names":["Trace.span"],"sources":["../src/Contexts.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, ContextError } from \"./Errors.ts\";\nimport { isContextWriterBusy } from \"./internal/session/ContextWriter.ts\";\nimport * as Trace from \"./internal/Trace.ts\";\nimport { ContextReference, Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\nconst ContextName = Schema.NonEmptyString.check(\n Schema.isMaxLength(1024),\n Schema.makeFilter((value) => value.trim().length > 0),\n);\n\nconst ProviderContext = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n});\n\nexport class ContextMetadata extends Schema.Class<ContextMetadata>(\"BrowserbaseContextMetadata\")({\n reference: ContextReference,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n}) {}\n\nexport class ContextCreation extends Schema.Class<ContextCreation>(\"BrowserbaseContextCreation\")({\n reference: ContextReference,\n}) {}\n\nconst fromClient = (operation: ContextError[\"operation\"], error: ClientError): ContextError =>\n ContextError.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 configuration = (operation: ContextError[\"operation\"]) =>\n ContextError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" });\n\nconst malformed = (operation: ContextError[\"operation\"], mutation = false) =>\n ContextError.make({\n operation,\n reason: \"malformed\",\n ...(mutation ? { outcome: \"unknown\" as const } : {}),\n });\n\n/** Context administration is independent of any live browser connection. */\nexport class BrowserbaseContexts extends Context.Service<\n BrowserbaseContexts,\n {\n readonly create: (options?: {\n readonly name?: string;\n }) => Effect.Effect<ContextCreation, ContextError>;\n readonly retrieve: (\n reference: ContextReference,\n ) => Effect.Effect<ContextMetadata, ContextError>;\n readonly delete: (reference: ContextReference) => Effect.Effect<void, ContextError>;\n }\n>()(\"effect-browserbase/Contexts\") {\n static readonly layer: Layer.Layer<BrowserbaseContexts, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseContexts,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const validate = Effect.fnUntraced(function* (\n reference: ContextReference,\n operation: ContextError[\"operation\"],\n ) {\n const ref = yield* Schema.decodeEffect(ContextReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(operation)));\n\n if (ref.projectId !== client.projectId)\n return yield* ContextError.make({\n operation,\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n return ref;\n });\n\n const create = Effect.fnUntraced(function* (options: { readonly name?: string } = {}) {\n const value = yield* Schema.decodeEffect(\n Schema.Struct({ name: Schema.optionalKey(ContextName) }),\n )(options, { onExcessProperty: \"error\" }).pipe(\n Effect.mapError(() => configuration(\"context-create\")),\n );\n\n const raw = yield* client\n .json(\"POST\", \"/v1/contexts\", {\n projectId: client.projectId,\n ...(value.name === undefined ? {} : { name: value.name.trim() }),\n })\n .pipe(Effect.mapError((error) => fromClient(\"context-create\", error)));\n\n const created = yield* Schema.decodeUnknownEffect(Schema.Struct({ id: Identifier }))(\n raw,\n ).pipe(Effect.mapError(() => malformed(\"context-create\", true)));\n\n return ContextCreation.make({\n reference: ContextReference.make({\n provider: \"browserbase\",\n projectId: client.projectId,\n contextId: created.id,\n }),\n });\n }, Trace.span(\"BrowserbaseContexts.create\"));\n\n const retrieve = Effect.fnUntraced(function* (reference: ContextReference) {\n const ref = yield* validate(reference, \"context-retrieve\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/contexts/${encodeURIComponent(ref.contextId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"context-retrieve\", error)));\n\n const value = yield* Schema.decodeUnknownEffect(ProviderContext)(raw).pipe(\n Effect.mapError(() => malformed(\"context-retrieve\")),\n );\n\n if (value.id !== ref.contextId || value.projectId !== ref.projectId)\n return yield* malformed(\"context-retrieve\");\n\n return ContextMetadata.make({\n reference: ref,\n createdAt: value.createdAt,\n updatedAt: value.updatedAt,\n ...(value.name === undefined ? {} : { name: value.name }),\n });\n }, Trace.span(\"BrowserbaseContexts.retrieve\"));\n\n const remove = Effect.fnUntraced(function* (reference: ContextReference) {\n const ref = yield* validate(reference, \"context-delete\");\n\n if (isContextWriterBusy(ref))\n return yield* ContextError.make({\n operation: \"context-delete\",\n reason: \"active\",\n outcome: \"undispatched\",\n });\n yield* client\n .noContent(\"DELETE\", `/v1/contexts/${encodeURIComponent(ref.contextId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"context-delete\", error)));\n }, Trace.span(\"BrowserbaseContexts.delete\"));\n\n return BrowserbaseContexts.of({ create, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;AAQA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAE5D,MAAM,cAAc,OAAO,eAAe,MACxC,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CACtD;AAEA,MAAM,kBAAkB,OAAO,OAAO;CACpC,IAAI;CACJ,WAAW;CACX,WAAW;CACX,WAAW;CACX,MAAM,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,WAAW;CACX,WAAW;CACX,WAAW;CACX,MAAM,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC,EAC/F,WAAW,iBACb,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,WAAsC,UACxD,aAAa,KAAK;CAChB;CACA,QAAQ,MAAM;CACd,GAAI,MAAM,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,MAAM,QAAQ;CAChE,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;CAC7D,GAAI,MAAM,qBAAqB,KAA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ACxE,KAAK,OAAO,UAAU,UAAU,WAAW,kBAAkB,KAAK,CAAC,CAAC;EACzE,GAAGA,KAAW,4BAA4B,CAAC;EAE3C,OAAO,oBAAoB,GAAG;GAAE;GAAQ;GAAU,QAAQ;EAAO,CAAC;CACpE,CAAC,CACH;AACF"}
@@ -1,13 +0,0 @@
1
- import { Clock, Duration, Effect } from "effect";
2
- //#region src/internal/Deadline.ts
3
- /** Monotonic elapsed time is distinct from provider dates and document presentation time. */
4
- const nowMillis = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1e6));
5
- const deadlineAfter = (millis) => nowMillis.pipe(Effect.map((now) => now + millis));
6
- const until = (effect, deadline, timeout) => nowMillis.pipe(Effect.flatMap((now) => deadline <= now ? Effect.fail(timeout()) : effect.pipe(Effect.timeoutOrElse({
7
- duration: Duration.millis(deadline - now),
8
- orElse: () => Effect.fail(timeout())
9
- }))));
10
- //#endregion
11
- export { nowMillis as n, until as r, deadlineAfter as t };
12
-
13
- //# sourceMappingURL=Deadline-CrViaogr.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Deadline-CrViaogr.mjs","names":[],"sources":["../src/internal/Deadline.ts"],"sourcesContent":["import { Clock, Duration, Effect } from \"effect\";\n\n/** Monotonic elapsed time is distinct from provider dates and document presentation time. */\nexport const nowMillis = Clock.monotonicTimeNanos.pipe(\n Effect.map((value) => Number(value) / 1_000_000),\n);\n\nexport const deadlineAfter = (millis: number) => nowMillis.pipe(Effect.map((now) => now + millis));\n\nexport const until = <A, E, R, Timeout>(\n effect: Effect.Effect<A, E, R>,\n deadline: number,\n timeout: () => Timeout,\n): Effect.Effect<A, E | Timeout, R> =>\n nowMillis.pipe(\n Effect.flatMap((now) =>\n deadline <= now\n ? Effect.fail(timeout())\n : effect.pipe(\n Effect.timeoutOrElse({\n duration: Duration.millis(deadline - now),\n orElse: () => Effect.fail(timeout()),\n }),\n ),\n ),\n );\n"],"mappings":";;;AAGA,MAAa,YAAY,MAAM,mBAAmB,KAChD,OAAO,KAAK,UAAU,OAAO,KAAK,IAAI,GAAS,CACjD;AAEA,MAAa,iBAAiB,WAAmB,UAAU,KAAK,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAC;AAEjG,MAAa,SACX,QACA,UACA,YAEA,UAAU,KACR,OAAO,SAAS,QACd,YAAY,MACR,OAAO,KAAK,QAAQ,CAAC,IACrB,OAAO,KACL,OAAO,cAAc;CACnB,UAAU,SAAS,OAAO,WAAW,GAAG;CACxC,cAAc,OAAO,KAAK,QAAQ,CAAC;AACrC,CAAC,CACH,CACN,CACF"}
@@ -1,43 +0,0 @@
1
- import { a as SessionReference } from "./References-DOH3Wu44.mjs";
2
- import { FileError } from "./Errors.mjs";
3
- import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
4
- import { t as BrowserbaseSessions } from "./Sessions-oJEUmZth.mjs";
5
- import { n as DownloadMetadata, t as ArtifactTransferPolicy } from "./Transfers-GVqzrDWl.mjs";
6
- import { Context, Effect, Layer, Schema, Stream } from "effect";
7
- //#region src/Downloads.d.ts
8
- interface DownloadPolicy extends ArtifactTransferPolicy {
9
- readonly mimeTypes: ReadonlyArray<string>;
10
- }
11
- interface DownloadListing {
12
- readonly downloads: ReadonlyArray<DownloadMetadata>;
13
- readonly total: number;
14
- readonly offset: number;
15
- readonly complete: boolean;
16
- }
17
- /** Provider-side filters over one session's files; every bound is optional. */
18
- declare const DownloadQuery: Schema.Struct<{
19
- readonly offset: Schema.optionalKey<Schema.Int>;
20
- readonly filename: Schema.optionalKey<Schema.NonEmptyString>;
21
- readonly mimeType: Schema.optionalKey<Schema.NonEmptyString>;
22
- readonly minSize: Schema.optionalKey<Schema.Natural>;
23
- readonly maxSize: Schema.optionalKey<Schema.Natural>;
24
- readonly createdAfter: Schema.optionalKey<Schema.String>;
25
- readonly createdBefore: Schema.optionalKey<Schema.String>;
26
- }>;
27
- type DownloadQuery = typeof DownloadQuery.Type;
28
- declare const BrowserbaseDownloads_base: Context.ServiceClass<BrowserbaseDownloads, "effect-browserbase/Downloads", {
29
- readonly list: (reference: SessionReference, query?: DownloadQuery) => Effect.Effect<DownloadListing, FileError>;
30
- readonly metadata: (reference: SessionReference, downloadId: string) => Effect.Effect<DownloadMetadata, FileError>;
31
- readonly stream: (reference: SessionReference, downloadId: string, policy: DownloadPolicy) => Stream.Stream<Uint8Array, FileError>;
32
- /** Deletes one stored file. A lost reply is `outcome: "unknown"` and is never retried. */
33
- readonly delete: (reference: SessionReference, downloadId: string) => Effect.Effect<void, FileError>;
34
- readonly waitForNew: (reference: SessionReference, previousIds: ReadonlyArray<string>, timeoutMillis?: number) => Effect.Effect<ReadonlyArray<DownloadMetadata>, FileError>;
35
- }>;
36
- /** Website files are not session-recording MP4s. They retain their own provider download ID. */
37
- declare class BrowserbaseDownloads extends BrowserbaseDownloads_base {
38
- static readonly layer: Layer.Layer<BrowserbaseDownloads, never, BrowserbaseClient | BrowserbaseSessions>;
39
- }
40
- //#endregion
41
- export { DownloadQuery as i, DownloadListing as n, DownloadPolicy as r, BrowserbaseDownloads as t };
42
- export {};
43
- //# sourceMappingURL=Downloads-CX52GOFJ.d.mts.map
@@ -1,3 +0,0 @@
1
- import { i as DownloadQuery, n as DownloadListing, r as DownloadPolicy, t as BrowserbaseDownloads } from "./Downloads-CX52GOFJ.mjs";
2
- export { BrowserbaseDownloads, DownloadListing, DownloadPolicy, DownloadQuery };
3
- export {};
@@ -1,137 +0,0 @@
1
- import { Identifier } from "./References.mjs";
2
- import { FileError } from "./Errors.mjs";
3
- import { i as stream, r as span, t as BrowserbaseClient } from "./Client-BEC4Q8ZS.mjs";
4
- import { DownloadMetadata } from "./Transfers.mjs";
5
- import { t as downloadTransferPolicy } from "./TransferPolicy-DQ06i7SZ.mjs";
6
- import { n as nowMillis, r as until, t as deadlineAfter } from "./Deadline-CrViaogr.mjs";
7
- import { t as BrowserbaseSessions } from "./Sessions-D2H5m6rF.mjs";
8
- import { Context, Effect, Layer, Schema, Stream } from "effect";
9
- //#region src/Downloads.ts
10
- const Timestamp = Schema.String.check(Schema.isMaxLength(64));
11
- /** Provider-side filters over one session's files; every bound is optional. */
12
- const DownloadQuery = Schema.Struct({
13
- offset: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
14
- minimum: 0,
15
- maximum: 1e4
16
- }))),
17
- filename: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1024))),
18
- mimeType: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256))),
19
- minSize: Schema.optionalKey(Schema.Natural),
20
- maxSize: Schema.optionalKey(Schema.Natural),
21
- createdAfter: Schema.optionalKey(Timestamp),
22
- createdBefore: Schema.optionalKey(Timestamp)
23
- });
24
- const Listing = Schema.Struct({
25
- downloads: Schema.Array(DownloadMetadata).check(Schema.isMaxLength(100)),
26
- total: Schema.Natural
27
- });
28
- const failure = (operation, reason) => FileError.make({
29
- operation,
30
- reason
31
- });
32
- const fromClient = (operation) => (error) => FileError.make({
33
- operation,
34
- reason: error.reason,
35
- ...error.outcome === void 0 ? {} : { outcome: error.outcome },
36
- ...error.status === void 0 ? {} : { status: error.status },
37
- ...error.retryAfterMillis === void 0 ? {} : { retryAfterMillis: error.retryAfterMillis }
38
- });
39
- const within = (effect, deadline, operation) => until(effect, deadline, () => failure(operation, "timeout"));
40
- /** Website files are not session-recording MP4s. They retain their own provider download ID. */
41
- var BrowserbaseDownloads = class BrowserbaseDownloads extends Context.Service()("effect-browserbase/Downloads") {
42
- static layer = Layer.effect(BrowserbaseDownloads, Effect.gen(function* () {
43
- const client = yield* BrowserbaseClient;
44
- const sessions = yield* BrowserbaseSessions;
45
- const owned = (ref, operation) => sessions.retrieve(ref).pipe(Effect.mapError((error) => FileError.make({
46
- operation,
47
- reason: error.reason
48
- })), Effect.asVoid);
49
- const list = Effect.fnUntraced(function* (ref, query = {}) {
50
- const checked = yield* Schema.decodeEffect(DownloadQuery)(query, { onExcessProperty: "error" }).pipe(Effect.mapError(() => failure("downloads-list", "configuration")));
51
- const offset = checked.offset ?? 0;
52
- yield* owned(ref, "downloads-list");
53
- const search = new URLSearchParams({
54
- sessionId: ref.sessionId,
55
- limit: "100",
56
- offset: String(offset)
57
- });
58
- for (const key of [
59
- "filename",
60
- "mimeType",
61
- "minSize",
62
- "maxSize",
63
- "createdAfter",
64
- "createdBefore"
65
- ]) {
66
- const value = checked[key];
67
- if (value !== void 0) search.set(key, String(value));
68
- }
69
- const raw = yield* client.json("GET", `/v1/downloads?${search}`).pipe(Effect.mapError(fromClient("downloads-list")), Effect.flatMap((value) => Schema.decodeUnknownEffect(Listing)(value).pipe(Effect.mapError(() => failure("downloads-list", "malformed")))));
70
- if (raw.downloads.some((entry) => entry.sessionId !== ref.sessionId) || new Set(raw.downloads.map((entry) => entry.id)).size !== raw.downloads.length) return yield* failure("downloads-list", "malformed");
71
- return {
72
- ...raw,
73
- offset,
74
- complete: offset + raw.downloads.length >= raw.total
75
- };
76
- }, span("BrowserbaseDownloads.list"));
77
- const metadata = Effect.fnUntraced(function* (ref, id) {
78
- yield* Schema.decodeEffect(Identifier)(id).pipe(Effect.mapError(() => failure("download-metadata", "configuration")));
79
- yield* owned(ref, "download-metadata");
80
- const value = yield* client.json("GET", `/v1/downloads/${encodeURIComponent(id)}`).pipe(Effect.mapError(fromClient("download-metadata")), Effect.flatMap((raw) => Schema.decodeUnknownEffect(DownloadMetadata)(raw).pipe(Effect.mapError(() => failure("download-metadata", "malformed")))));
81
- if (value.id !== id || value.sessionId !== ref.sessionId) return yield* failure("download-metadata", "malformed");
82
- return value;
83
- }, span("BrowserbaseDownloads.metadata"));
84
- const stream$1 = (ref, id, policy) => Stream.unwrap(Effect.gen(function* () {
85
- const { maxBytes, timeoutMillis, mimeTypes } = yield* downloadTransferPolicy(policy, () => failure("download", "configuration"));
86
- const deadline = yield* deadlineAfter(timeoutMillis);
87
- const file = yield* within(metadata(ref, id), deadline, "download");
88
- if (!mimeTypes.includes(file.mimeType.toLowerCase())) return yield* failure("download", "content-type");
89
- if (file.size > maxBytes) return yield* failure("download", "limit");
90
- let received = 0;
91
- return client.bytes(`/v1/downloads/${encodeURIComponent(id)}`, maxBytes, ["application/octet-stream", file.mimeType.toLowerCase()], timeoutMillis, deadline).pipe(Stream.mapError(fromClient("download")), Stream.tap((chunk) => Effect.sync(() => {
92
- received += chunk.byteLength;
93
- })), Stream.concat(Stream.fromEffect(Effect.suspend(() => received === file.size ? Effect.void : Effect.fail(failure("download", "malformed")))).pipe(Stream.drain)));
94
- })).pipe(stream("BrowserbaseDownloads.stream"));
95
- const waitForNew = Effect.fnUntraced(function* (ref, previousIds, timeoutMillis = 3e4) {
96
- if (previousIds.length > 1e4 || !Number.isSafeInteger(timeoutMillis) || timeoutMillis < 1 || timeoutMillis > 3e5) return yield* failure("download-wait", "configuration");
97
- const previous = new Set(previousIds);
98
- const deadline = yield* deadlineAfter(timeoutMillis);
99
- do {
100
- const result = yield* within(list(ref), deadline, "download-wait").pipe(Effect.withTracerEnabled(false));
101
- if (!result.complete) return yield* failure("download-wait", "limit");
102
- const fresh = result.downloads.filter((entry) => !previous.has(entry.id));
103
- if (fresh.length > 0) return fresh;
104
- const remaining = deadline - (yield* nowMillis);
105
- if (remaining <= 0) break;
106
- yield* Effect.sleep(Math.min(500, remaining));
107
- } while ((yield* nowMillis) < deadline);
108
- return yield* failure("download-wait", "timeout");
109
- }, span("BrowserbaseDownloads.waitForNew"));
110
- const remove = Effect.fnUntraced(function* (ref, id) {
111
- yield* Schema.decodeEffect(Identifier)(id).pipe(Effect.mapError(() => FileError.make({
112
- operation: "download-delete",
113
- reason: "configuration",
114
- outcome: "undispatched"
115
- })));
116
- yield* metadata(ref, id).pipe(Effect.mapError((error) => FileError.make({
117
- operation: "download-delete",
118
- reason: error.reason,
119
- outcome: "undispatched",
120
- ...error.status === void 0 ? {} : { status: error.status },
121
- ...error.retryAfterMillis === void 0 ? {} : { retryAfterMillis: error.retryAfterMillis }
122
- })));
123
- yield* client.noContent("DELETE", `/v1/downloads/${encodeURIComponent(id)}`).pipe(Effect.mapError(fromClient("download-delete")));
124
- }, span("BrowserbaseDownloads.delete"));
125
- return BrowserbaseDownloads.of({
126
- list,
127
- metadata,
128
- stream: stream$1,
129
- waitForNew,
130
- delete: remove
131
- });
132
- }));
133
- };
134
- //#endregion
135
- export { BrowserbaseDownloads, DownloadQuery };
136
-
137
- //# sourceMappingURL=Downloads.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Downloads.mjs","names":["Trace.span","stream","Trace.stream"],"sources":["../src/Downloads.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema, Stream } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, FileError } from \"./Errors.ts\";\nimport { downloadTransferPolicy } from \"./internal/artifact/TransferPolicy.ts\";\nimport { deadlineAfter, nowMillis, until } from \"./internal/Deadline.ts\";\nimport * as Trace from \"./internal/Trace.ts\";\nimport { Identifier, type SessionReference } from \"./References.ts\";\nimport { BrowserbaseSessions } from \"./Sessions.ts\";\nimport { type ArtifactTransferPolicy, DownloadMetadata } from \"./Transfers.ts\";\n\nexport interface DownloadPolicy extends ArtifactTransferPolicy {\n readonly mimeTypes: ReadonlyArray<string>;\n}\n\nexport interface DownloadListing {\n readonly downloads: ReadonlyArray<DownloadMetadata>;\n readonly total: number;\n readonly offset: number;\n readonly complete: boolean;\n}\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** Provider-side filters over one session's files; every bound is optional. */\nexport const DownloadQuery = Schema.Struct({\n offset: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 10_000 }))),\n filename: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1024))),\n mimeType: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256))),\n minSize: Schema.optionalKey(Schema.Natural),\n maxSize: Schema.optionalKey(Schema.Natural),\n createdAfter: Schema.optionalKey(Timestamp),\n createdBefore: Schema.optionalKey(Timestamp),\n});\n\nexport type DownloadQuery = typeof DownloadQuery.Type;\n\nconst Listing = Schema.Struct({\n downloads: Schema.Array(DownloadMetadata).check(Schema.isMaxLength(100)),\n total: Schema.Natural,\n});\n\nconst failure = (operation: FileError[\"operation\"], reason: FileError[\"reason\"]) =>\n FileError.make({ operation, reason });\n\nconst fromClient = (operation: FileError[\"operation\"]) => (error: ClientError) =>\n FileError.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 within = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n deadline: number,\n operation: FileError[\"operation\"],\n) => until(effect, deadline, () => failure(operation, \"timeout\"));\n\n/** Website files are not session-recording MP4s. They retain their own provider download ID. */\nexport class BrowserbaseDownloads extends Context.Service<\n BrowserbaseDownloads,\n {\n readonly list: (\n reference: SessionReference,\n query?: DownloadQuery,\n ) => Effect.Effect<DownloadListing, FileError>;\n readonly metadata: (\n reference: SessionReference,\n downloadId: string,\n ) => Effect.Effect<DownloadMetadata, FileError>;\n readonly stream: (\n reference: SessionReference,\n downloadId: string,\n policy: DownloadPolicy,\n ) => Stream.Stream<Uint8Array, FileError>;\n /** Deletes one stored file. A lost reply is `outcome: \"unknown\"` and is never retried. */\n readonly delete: (\n reference: SessionReference,\n downloadId: string,\n ) => Effect.Effect<void, FileError>;\n readonly waitForNew: (\n reference: SessionReference,\n previousIds: ReadonlyArray<string>,\n timeoutMillis?: number,\n ) => Effect.Effect<ReadonlyArray<DownloadMetadata>, FileError>;\n }\n>()(\"effect-browserbase/Downloads\") {\n static readonly layer: Layer.Layer<\n BrowserbaseDownloads,\n never,\n BrowserbaseClient | BrowserbaseSessions\n > = Layer.effect(\n BrowserbaseDownloads,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const sessions = yield* BrowserbaseSessions;\n\n // Files are readable while the session runs; only the exact owning session is admitted.\n const owned = (ref: SessionReference, operation: FileError[\"operation\"]) =>\n sessions.retrieve(ref).pipe(\n Effect.mapError((error) => FileError.make({ operation, reason: error.reason })),\n Effect.asVoid,\n );\n\n const list = Effect.fnUntraced(function* (ref: SessionReference, query: DownloadQuery = {}) {\n const checked = yield* Schema.decodeEffect(DownloadQuery)(query, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => failure(\"downloads-list\", \"configuration\")));\n\n const offset = checked.offset ?? 0;\n\n yield* owned(ref, \"downloads-list\");\n\n const search = new URLSearchParams({\n sessionId: ref.sessionId,\n limit: \"100\",\n offset: String(offset),\n });\n\n for (const key of [\n \"filename\",\n \"mimeType\",\n \"minSize\",\n \"maxSize\",\n \"createdAfter\",\n \"createdBefore\",\n ] as const) {\n const value = checked[key];\n\n if (value !== undefined) search.set(key, String(value));\n }\n\n const raw = yield* client.json(\"GET\", `/v1/downloads?${search}`).pipe(\n Effect.mapError(fromClient(\"downloads-list\")),\n Effect.flatMap((value) =>\n Schema.decodeUnknownEffect(Listing)(value).pipe(\n Effect.mapError(() => failure(\"downloads-list\", \"malformed\")),\n ),\n ),\n );\n\n if (\n raw.downloads.some((entry) => entry.sessionId !== ref.sessionId) ||\n new Set(raw.downloads.map((entry) => entry.id)).size !== raw.downloads.length\n ) {\n return yield* failure(\"downloads-list\", \"malformed\");\n }\n\n return { ...raw, offset, complete: offset + raw.downloads.length >= raw.total };\n }, Trace.span(\"BrowserbaseDownloads.list\"));\n\n const metadata = Effect.fnUntraced(function* (ref: SessionReference, id: string) {\n yield* Schema.decodeEffect(Identifier)(id).pipe(\n Effect.mapError(() => failure(\"download-metadata\", \"configuration\")),\n );\n\n yield* owned(ref, \"download-metadata\");\n\n const value = yield* client.json(\"GET\", `/v1/downloads/${encodeURIComponent(id)}`).pipe(\n Effect.mapError(fromClient(\"download-metadata\")),\n Effect.flatMap((raw) =>\n Schema.decodeUnknownEffect(DownloadMetadata)(raw).pipe(\n Effect.mapError(() => failure(\"download-metadata\", \"malformed\")),\n ),\n ),\n );\n\n if (value.id !== id || value.sessionId !== ref.sessionId)\n return yield* failure(\"download-metadata\", \"malformed\");\n\n return value;\n }, Trace.span(\"BrowserbaseDownloads.metadata\"));\n\n const stream = (ref: SessionReference, id: string, policy: DownloadPolicy) =>\n Stream.unwrap(\n Effect.gen(function* () {\n const { maxBytes, timeoutMillis, mimeTypes } = yield* downloadTransferPolicy(\n policy,\n () => failure(\"download\", \"configuration\"),\n );\n\n const deadline = yield* deadlineAfter(timeoutMillis);\n const file = yield* within(metadata(ref, id), deadline, \"download\");\n\n if (!mimeTypes.includes(file.mimeType.toLowerCase()))\n return yield* failure(\"download\", \"content-type\");\n if (file.size > maxBytes) return yield* failure(\"download\", \"limit\");\n let received = 0;\n\n return client\n .bytes(\n `/v1/downloads/${encodeURIComponent(id)}`,\n maxBytes,\n [\"application/octet-stream\", file.mimeType.toLowerCase()],\n timeoutMillis,\n deadline,\n )\n .pipe(\n Stream.mapError(fromClient(\"download\")),\n Stream.tap((chunk) =>\n Effect.sync(() => {\n received += chunk.byteLength;\n }),\n ),\n Stream.concat(\n Stream.fromEffect(\n Effect.suspend(() =>\n received === file.size\n ? Effect.void\n : Effect.fail(failure(\"download\", \"malformed\")),\n ),\n ).pipe(Stream.drain),\n ),\n );\n }),\n ).pipe(Trace.stream(\"BrowserbaseDownloads.stream\"));\n\n const waitForNew = Effect.fnUntraced(function* (\n ref: SessionReference,\n previousIds: ReadonlyArray<string>,\n timeoutMillis: number = 30_000,\n ) {\n if (\n previousIds.length > 10_000 ||\n !Number.isSafeInteger(timeoutMillis) ||\n timeoutMillis < 1 ||\n timeoutMillis > 300_000\n ) {\n return yield* failure(\"download-wait\", \"configuration\");\n }\n const previous = new Set(previousIds);\n const deadline = yield* deadlineAfter(timeoutMillis);\n\n do {\n const result = yield* within(list(ref), deadline, \"download-wait\").pipe(\n Effect.withTracerEnabled(false),\n );\n\n // Never claim a complete candidate set from a partial listing.\n if (!result.complete) return yield* failure(\"download-wait\", \"limit\");\n const fresh = result.downloads.filter((entry) => !previous.has(entry.id));\n\n if (fresh.length > 0) return fresh;\n const remaining = deadline - (yield* nowMillis);\n\n if (remaining <= 0) break;\n yield* Effect.sleep(Math.min(500, remaining));\n } while ((yield* nowMillis) < deadline);\n\n return yield* failure(\"download-wait\", \"timeout\");\n }, Trace.span(\"BrowserbaseDownloads.waitForNew\"));\n\n const remove = Effect.fnUntraced(function* (ref: SessionReference, id: string) {\n yield* Schema.decodeEffect(Identifier)(id).pipe(\n Effect.mapError(() =>\n FileError.make({\n operation: \"download-delete\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n\n // Ownership is proved by reading the file's session before any mutation.\n yield* metadata(ref, id).pipe(\n Effect.mapError((error) =>\n FileError.make({\n operation: \"download-delete\",\n reason: error.reason,\n outcome: \"undispatched\",\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined\n ? {}\n : { retryAfterMillis: error.retryAfterMillis }),\n }),\n ),\n );\n\n yield* client\n .noContent(\"DELETE\", `/v1/downloads/${encodeURIComponent(id)}`)\n .pipe(Effect.mapError(fromClient(\"download-delete\")));\n }, Trace.span(\"BrowserbaseDownloads.delete\"));\n\n return BrowserbaseDownloads.of({ list, metadata, stream, waitForNew, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;;AAG5D,MAAa,gBAAgB,OAAO,OAAO;CACzC,QAAQ,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAO,CAAC,CAAC,CAAC;CAC9F,UAAU,OAAO,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;CAClF,UAAU,OAAO,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC,CAAC;CACjF,SAAS,OAAO,YAAY,OAAO,OAAO;CAC1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W,iBAAiB,CAAC,CAAC;EACxD,GAAGA,KAAW,6BAA6B,CAAC;EAE5C,OAAO,qBAAqB,GAAG;GAAE;GAAM;GAAU,QAAA;GAAQ;GAAY,QAAQ;EAAO,CAAC;CACvF,CAAC,CACH;AACF"}
package/dist/Errors.d.mts DELETED
@@ -1,100 +0,0 @@
1
- import { a as SessionReference, t as AllocationAttempt } from "./References-DOH3Wu44.mjs";
2
- import { Schema } from "effect";
3
- //#region src/Errors.d.ts
4
- declare const ClientError_base: Schema.Class<ClientError, Schema.TaggedStruct<"ClientError", {
5
- operation: Schema.Literals<readonly ["configure", "provider-read", "provider-mutation", "provider-upload", "media-download"]>;
6
- reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
7
- outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
8
- status: Schema.optionalKey<Schema.Int>;
9
- retryAfterMillis: Schema.optionalKey<Schema.Natural>;
10
- }>, import("effect/Cause").YieldableError>;
11
- /** Credential-free control-plane failures; response bodies and native causes never escape. */
12
- export declare class ClientError extends ClientError_base {}
13
- declare const SessionError_base: Schema.Class<SessionError, Schema.TaggedStruct<"SessionError", {
14
- operation: Schema.Literals<readonly ["session-retrieve", "session-list", "session-release", "session-wait", "session-logs", "session-live-view", "session-connect", "session-attach"]>;
15
- reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
16
- outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
17
- status: Schema.optionalKey<Schema.Int>;
18
- retryAfterMillis: Schema.optionalKey<Schema.Natural>;
19
- }>, import("effect/Cause").YieldableError>;
20
- export declare class SessionError extends SessionError_base {}
21
- declare const ContextError_base: Schema.Class<ContextError, Schema.TaggedStruct<"ContextError", {
22
- operation: Schema.Literals<readonly ["context-create", "context-retrieve", "context-delete", "writer", "writer-admit", "writer-authority", "writer-readback", "writer-settle", "writer-reconcile"]>;
23
- reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
24
- outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
25
- status: Schema.optionalKey<Schema.Int>;
26
- retryAfterMillis: Schema.optionalKey<Schema.Natural>;
27
- }>, import("effect/Cause").YieldableError>;
28
- export declare class ContextError extends ContextError_base {}
29
- declare const ExtensionError_base: Schema.Class<ExtensionError, Schema.TaggedStruct<"ExtensionError", {
30
- readonly operation: Schema.Literals<readonly ["extension-archive", "extension-register", "extension-retrieve", "extension-delete"]>;
31
- readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
32
- readonly status: Schema.optionalKey<Schema.Int>;
33
- readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
34
- readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type", "unsafe-filename"]>;
35
- }>, import("effect/Cause").YieldableError>;
36
- /**
37
- * `extension-archive` is the local inspection of the bytes a caller supplied, before any
38
- * request. Why an archive was refused is its reason, never a second operation.
39
- */
40
- export declare class ExtensionError extends ExtensionError_base {}
41
- declare const ProjectError_base: Schema.Class<ProjectError, Schema.TaggedStruct<"ProjectError", {
42
- operation: Schema.Literals<readonly ["project-list", "project-retrieve", "project-usage"]>;
43
- reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
44
- outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
45
- status: Schema.optionalKey<Schema.Int>;
46
- retryAfterMillis: Schema.optionalKey<Schema.Natural>;
47
- }>, import("effect/Cause").YieldableError>;
48
- /** Project inspection and usage. */
49
- export declare class ProjectError extends ProjectError_base {}
50
- declare const CertificateError_base: Schema.Class<CertificateError, Schema.TaggedStruct<"CertificateError", {
51
- operation: Schema.Literals<readonly ["certificate-create", "certificate-list", "certificate-retrieve", "certificate-delete"]>;
52
- reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
53
- outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
54
- status: Schema.optionalKey<Schema.Int>;
55
- retryAfterMillis: Schema.optionalKey<Schema.Natural>;
56
- }>, import("effect/Cause").YieldableError>;
57
- /** Proxy CA certificate administration. */
58
- export declare class CertificateError extends CertificateError_base {}
59
- declare const PlatformError_base: Schema.Class<PlatformError, Schema.TaggedStruct<"PlatformError", {
60
- readonly operation: Schema.Literals<readonly ["search-web", "fetch", "agent-create", "agent-list", "agent-retrieve", "agent-update", "agent-delete", "agent-run", "agent-run-list", "agent-run-retrieve", "agent-run-messages", "agent-run-stop", "agent-run-wait", "function-list", "function-retrieve", "function-versions", "function-version", "function-builds", "function-build", "function-build-logs", "function-invoke", "function-invocations", "function-invocation", "function-invocation-logs", "function-wait", "webhook-create", "webhook-list", "webhook-retrieve", "webhook-update", "webhook-delete", "webhook-rotate-secret"]>;
61
- readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
62
- readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
63
- readonly status: Schema.optionalKey<Schema.Int>;
64
- readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
65
- readonly service: Schema.Literals<readonly ["search", "fetch", "agents", "functions", "webhooks"]>;
66
- }>, import("effect/Cause").YieldableError>;
67
- /**
68
- * Browserbase platform services outside a browser session: Search, Fetch, Agents, Functions
69
- * and Webhooks. `service` names which one; these are host APIs, never model-facing tools.
70
- */
71
- export declare class PlatformError extends PlatformError_base {}
72
- declare const FileError_base: Schema.Class<FileError, Schema.TaggedStruct<"FileError", {
73
- readonly operation: Schema.Literals<readonly ["upload", "downloads-list", "download-metadata", "download", "download-wait", "download-delete"]>;
74
- readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
75
- readonly status: Schema.optionalKey<Schema.Int>;
76
- readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
77
- readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type", "unsafe-filename", "ambiguous", "checksum", "unsupported"]>;
78
- }>, import("effect/Cause").YieldableError>;
79
- export declare class FileError extends FileError_base {}
80
- declare const ArtifactError_base: Schema.Class<ArtifactError, Schema.TaggedStruct<"ArtifactError", {
81
- readonly operation: Schema.Literals<readonly ["recording-request", "recording-status", "recording-wait", "recording", "recording-download", "replay-metadata", "replay", "replay-playlist", "replay-media"]>;
82
- readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
83
- readonly status: Schema.optionalKey<Schema.Int>;
84
- readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
85
- readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type", "failed", "byos", "assembly-unknown", "unsupported", "ambiguous"]>;
86
- }>, import("effect/Cause").YieldableError>;
87
- export declare class ArtifactError extends ArtifactError_base {}
88
- declare const AllocationError_base: Schema.Class<AllocationError, Schema.TaggedStruct<"AllocationError", {
89
- readonly attempt: typeof AllocationAttempt;
90
- readonly reference: Schema.optionalKey<typeof SessionReference>;
91
- readonly outcome: Schema.Literals<readonly ["rejected", "unknown"]>;
92
- readonly reason: Schema.Literals<readonly ["authorization", "rate-limited", "configuration", "provider", "transport", "timeout", "malformed"]>;
93
- readonly status: Schema.optionalKey<Schema.Int>;
94
- readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
95
- }>, import("effect/Cause").YieldableError>;
96
- /** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */
97
- export declare class AllocationError extends AllocationError_base {}
98
- //#endregion
99
- export {};
100
- //# sourceMappingURL=Errors.d.mts.map