effect-agent 0.1.0-beta.121 → 0.1.0-beta.123

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.
@@ -1,283 +0,0 @@
1
- import { InteractiveBrowserPolicy } from "./InteractiveBrowser.mjs";
2
- import { Context, Effect, Layer, Redacted, Schema, Scope } from "effect";
3
- declare namespace ProtectedBrowser_d_exports {
4
- export { BrowserCredentialAccess, BrowserCredentialMaterial, BrowserReference, CardCredential, CredentialAccessError, CredentialAccessRequest, CredentialDispatch, CredentialFieldRole, CredentialKind, CredentialMilestone, CredentialObservationDecision, CredentialObservationGrant, CredentialOffer, CredentialOfferMetadata, CredentialOrigin, CredentialTarget, CredentialUseAuthorization, CredentialUseResult, ListCredentialOffers, LoginCredential, ProtectedBrowser, ProtectedBrowserAction, ProtectedBrowserCheckpoint, ProtectedBrowserClick, ProtectedBrowserControl, ProtectedBrowserError, ProtectedBrowserFill, ProtectedBrowserHandle, ProtectedBrowserNavigate, ProtectedBrowserObservation, ProtectedBrowserSession, ProtectedCleanup, ProtectedObservationState, UseCredential };
5
- }
6
- /** Canonical HTTPS origin, including a non-default port. Host grants match exactly. */
7
- export declare const CredentialOrigin: Schema.String;
8
- export declare const BrowserReference: Schema.String;
9
- export declare const CredentialKind: Schema.Literals<readonly ["login", "card"]>;
10
- export declare const CredentialFieldRole: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
11
- declare const CredentialTarget_base: Schema.Class<CredentialTarget, Schema.Struct<{
12
- readonly topOrigin: Schema.String;
13
- readonly frameOrigin: Schema.String;
14
- readonly recipientOrigin: Schema.String;
15
- readonly document: Schema.String;
16
- readonly frame: Schema.String;
17
- readonly form: Schema.String;
18
- }>, {}>;
19
- export declare class CredentialTarget extends CredentialTarget_base {}
20
- declare const ProtectedBrowserControl_base: Schema.Class<ProtectedBrowserControl, Schema.Struct<{
21
- readonly ref: Schema.String;
22
- readonly target: typeof CredentialTarget;
23
- readonly role: Schema.Union<readonly [Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>, Schema.Literals<readonly ["text", "select", "radio", "checkbox", "submit", "link", "button", "unsupported"]>]>;
24
- readonly label: Schema.String;
25
- /** Current native radio/checkbox state; field values are never included. */
26
- readonly checked: Schema.optionalKey<Schema.Boolean>;
27
- /**
28
- * Ordinary select choices only; credential choices and raw option values remain private.
29
- * Omitted choices or labels beyond the bounds set the observation's truncated flag.
30
- */
31
- readonly options: Schema.optionalKey<Schema.$Array<Schema.Struct<{
32
- readonly label: Schema.String;
33
- readonly selected: Schema.Boolean;
34
- readonly disabled: Schema.Boolean;
35
- }>>>;
36
- /** Resolved HTTPS destination for a native link; target.recipientOrigin is its origin. */
37
- readonly url: Schema.optionalKey<Schema.NonEmptyString>;
38
- }>, {}>;
39
- export declare class ProtectedBrowserControl extends ProtectedBrowserControl_base {}
40
- declare const ProtectedBrowserObservation_base: Schema.Class<ProtectedBrowserObservation, Schema.Struct<{
41
- readonly document: Schema.String;
42
- readonly topOrigin: Schema.String;
43
- readonly text: Schema.String;
44
- readonly controls: Schema.$Array<typeof ProtectedBrowserControl>;
45
- readonly truncated: Schema.Boolean;
46
- readonly observation: Schema.Literals<readonly ["before-exposure", "approved-after-exposure"]>;
47
- }>, {}>;
48
- export declare class ProtectedBrowserObservation extends ProtectedBrowserObservation_base {}
49
- declare const CredentialOfferMetadata_base: Schema.Class<CredentialOfferMetadata, Schema.Struct<{
50
- readonly label: Schema.String;
51
- readonly brand: Schema.optionalKey<Schema.String>;
52
- readonly lastFour: Schema.optionalKey<Schema.String>;
53
- /** Plaintext metadata disclosed only when the host authorizes listing this offer. */
54
- readonly billingAddress: Schema.optionalKey<Schema.Struct<{
55
- readonly name: Schema.optionalKey<Schema.String>;
56
- readonly line1: Schema.optionalKey<Schema.String>;
57
- readonly line2: Schema.optionalKey<Schema.String>;
58
- readonly city: Schema.optionalKey<Schema.String>;
59
- readonly region: Schema.optionalKey<Schema.String>;
60
- readonly postalCode: Schema.optionalKey<Schema.String>;
61
- readonly country: Schema.optionalKey<Schema.String>;
62
- }>>;
63
- }>, {}>;
64
- export declare class CredentialOfferMetadata extends CredentialOfferMetadata_base {}
65
- declare const CredentialOffer_base: Schema.Class<CredentialOffer, Schema.Struct<{
66
- readonly ref: Schema.String;
67
- readonly kind: Schema.Literals<readonly ["login", "card"]>;
68
- readonly metadata: typeof CredentialOfferMetadata;
69
- }>, {}>;
70
- export declare class CredentialOffer extends CredentialOffer_base {}
71
- declare const ListCredentialOffers_base: Schema.Class<ListCredentialOffers, Schema.Struct<{
72
- readonly kind: Schema.Literals<readonly ["login", "card"]>;
73
- readonly target: Schema.String;
74
- }>, {}>;
75
- export declare class ListCredentialOffers extends ListCredentialOffers_base {}
76
- declare const UseCredential_base: Schema.Class<UseCredential, Schema.Struct<{
77
- readonly offer: Schema.String;
78
- readonly fields: Schema.$Array<Schema.Struct<{
79
- readonly ref: Schema.String;
80
- readonly role: Schema.Literals<readonly ["username", "password", "card-name", "card-number", "card-expiry", "card-expiry-month", "card-expiry-year", "card-security-code"]>;
81
- }>>;
82
- readonly submit: Schema.optionalKey<Schema.String>;
83
- }>, {}>;
84
- export declare class UseCredential extends UseCredential_base {}
85
- declare const ProtectedBrowserNavigate_base: Schema.Class<ProtectedBrowserNavigate, Schema.Struct<{
86
- readonly url: Schema.String;
87
- }>, {}>;
88
- export declare class ProtectedBrowserNavigate extends ProtectedBrowserNavigate_base {}
89
- declare const ProtectedBrowserClick_base: Schema.Class<ProtectedBrowserClick, Schema.Struct<{
90
- readonly ref: Schema.String;
91
- }>, {}>;
92
- export declare class ProtectedBrowserClick extends ProtectedBrowserClick_base {}
93
- declare const ProtectedBrowserFill_base: Schema.Class<ProtectedBrowserFill, Schema.Struct<{
94
- readonly ref: Schema.String;
95
- readonly value: Schema.String;
96
- }>, {}>;
97
- /**
98
- * Non-secret text for an ordinary text control or native single select in the current observation.
99
- * Never pass credential material. Credential roles, including username, require useCredential.
100
- * Selects match one enabled option's exact observed label. Empty text clears text controls.
101
- */
102
- export declare class ProtectedBrowserFill extends ProtectedBrowserFill_base {}
103
- export declare const CredentialDispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
104
- export declare const CredentialMilestone: Schema.Literals<readonly ["none", "partial-fill", "filled", "submission-dispatched"]>;
105
- export declare const ProtectedObservationState: Schema.Literals<readonly ["before-exposure", "protected", "approved-after-exposure", "closed"]>;
106
- export declare const ProtectedCleanup: Schema.Literals<readonly ["not-requested", "confirmed", "unconfirmed"]>;
107
- declare const ProtectedBrowserError_base: Schema.Class<ProtectedBrowserError, Schema.TaggedStruct<"ProtectedBrowserError", {
108
- readonly dispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
109
- readonly milestone: Schema.Literals<readonly ["none", "partial-fill", "filled", "submission-dispatched"]>;
110
- readonly observation: Schema.Literals<readonly ["before-exposure", "protected", "approved-after-exposure", "closed"]>;
111
- readonly cleanup: Schema.Literals<readonly ["not-requested", "confirmed", "unconfirmed"]>;
112
- readonly reason: Schema.Literals<readonly ["denied", "missing-credential", "stale-reference", "unsupported", "needs-attention", "busy", "closed", "limit", "timeout", "provider", "resolver", "outcome-unknown", "observation-blocked"]>;
113
- }>, import("effect/Cause").YieldableError>;
114
- /** No foreign message/cause or page data may enter this failure. Closure does not undo dispatch. */
115
- export declare class ProtectedBrowserError extends ProtectedBrowserError_base {}
116
- declare const CredentialUseResult_base: Schema.Class<CredentialUseResult, Schema.Struct<{
117
- readonly dispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
118
- readonly milestone: Schema.Literals<readonly ["none", "partial-fill", "filled", "submission-dispatched"]>;
119
- readonly observation: Schema.Literals<readonly ["before-exposure", "protected", "approved-after-exposure", "closed"]>;
120
- readonly cleanup: Schema.Literals<readonly ["not-requested", "confirmed", "unconfirmed"]>;
121
- readonly authentication: Schema.Literal<"unverified">;
122
- }>, {}>;
123
- export declare class CredentialUseResult extends CredentialUseResult_base {}
124
- /** Host-only material. Never encode it into Tool results, checkpoints, or storage. */
125
- export declare const LoginCredential: Schema.TaggedStruct<"LoginCredential", {
126
- readonly username: Schema.Redacted<Schema.NonEmptyString>;
127
- readonly password: Schema.Redacted<Schema.NonEmptyString>;
128
- }>;
129
- /** Security codes are transient, never persisted. Dummy tests are not PCI compliance evidence. */
130
- export declare const CardCredential: Schema.TaggedStruct<"CardCredential", {
131
- readonly name: Schema.Redacted<Schema.NonEmptyString>;
132
- readonly number: Schema.Redacted<Schema.String>;
133
- readonly expiry: Schema.Redacted<Schema.NonEmptyString>;
134
- readonly expiryMonth: Schema.Redacted<Schema.String>;
135
- readonly expiryYear: Schema.Redacted<Schema.String>;
136
- readonly securityCode: Schema.optionalKey<Schema.Redacted<Schema.String>>;
137
- }>;
138
- export declare const BrowserCredentialMaterial: Schema.Union<readonly [Schema.TaggedStruct<"LoginCredential", {
139
- readonly username: Schema.Redacted<Schema.NonEmptyString>;
140
- readonly password: Schema.Redacted<Schema.NonEmptyString>;
141
- }>, Schema.TaggedStruct<"CardCredential", {
142
- readonly name: Schema.Redacted<Schema.NonEmptyString>;
143
- readonly number: Schema.Redacted<Schema.String>;
144
- readonly expiry: Schema.Redacted<Schema.NonEmptyString>;
145
- readonly expiryMonth: Schema.Redacted<Schema.String>;
146
- readonly expiryYear: Schema.Redacted<Schema.String>;
147
- readonly securityCode: Schema.optionalKey<Schema.Redacted<Schema.String>>;
148
- }>]>;
149
- export type BrowserCredentialMaterial = typeof BrowserCredentialMaterial.Type;
150
- declare const CredentialAccessError_base: Schema.Class<CredentialAccessError, Schema.TaggedStruct<"CredentialAccessError", {
151
- readonly reason: Schema.Literals<readonly ["denied", "missing-credential", "needs-attention", "busy", "resolver"]>;
152
- }>, import("effect/Cause").YieldableError>;
153
- /** Use busy for transient host-authority unavailability; return promptly without waiting for Tool completion. */
154
- export declare class CredentialAccessError extends CredentialAccessError_base {}
155
- export interface CredentialAccessRequest {
156
- readonly caller: Redacted.Redacted<string>;
157
- readonly kind: typeof CredentialKind.Type;
158
- readonly target: CredentialTarget;
159
- }
160
- export interface CredentialUseAuthorization extends CredentialAccessRequest {
161
- readonly key: Redacted.Redacted<string>;
162
- readonly roles: ReadonlyArray<typeof CredentialFieldRole.Type>;
163
- readonly submit: boolean;
164
- }
165
- /** Exact current action proposed to host authority; no ordinary fill value or secret is included. */
166
- export declare const ProtectedBrowserAction: Schema.Union<readonly [Schema.TaggedStruct<"Navigate", {
167
- readonly url: Schema.String;
168
- }>, Schema.TaggedStruct<"Fill", {
169
- readonly ref: Schema.String;
170
- readonly target: typeof CredentialTarget;
171
- readonly role: Schema.Literals<readonly ["text", "select"]>;
172
- }>, Schema.TaggedStruct<"Click", {
173
- readonly ref: Schema.String;
174
- readonly target: typeof CredentialTarget;
175
- readonly role: Schema.Literals<readonly ["button", "radio", "checkbox"]>;
176
- }>, Schema.TaggedStruct<"Click", {
177
- readonly ref: Schema.String;
178
- readonly target: typeof CredentialTarget;
179
- readonly role: Schema.Literal<"link">;
180
- readonly url: Schema.NonEmptyString;
181
- }>, Schema.TaggedStruct<"Submit", {
182
- readonly ref: Schema.String;
183
- readonly target: typeof CredentialTarget;
184
- }>]>;
185
- export type ProtectedBrowserAction = typeof ProtectedBrowserAction.Type;
186
- declare const CredentialObservationGrant_base: Schema.Class<CredentialObservationGrant, Schema.Struct<{
187
- readonly decision: Schema.Literal<"trust-recipient-no-credential-echo">;
188
- readonly origins: Schema.$Array<Schema.String>;
189
- }>, {}>;
190
- /**
191
- * Trust only these current observation origins. The top origin must be included. Other frames
192
- * supply neither text nor usable refs. This does not expand network policy or credential grants.
193
- */
194
- export declare class CredentialObservationGrant extends CredentialObservationGrant_base {}
195
- export declare const CredentialObservationDecision: Schema.Union<readonly [Schema.Literals<readonly ["trust-recipient-no-credential-echo", "deny"]>, typeof CredentialObservationGrant]>;
196
- declare const BrowserCredentialAccess_base: Context.ServiceClass<BrowserCredentialAccess, "@effect-agent/sandbox/BrowserCredentialAccess", {
197
- readonly caller: Effect.Effect<Redacted.Redacted<string>, CredentialAccessError>;
198
- readonly list: (request: CredentialAccessRequest) => Effect.Effect<ReadonlyArray<{
199
- readonly key: Redacted.Redacted<string>;
200
- readonly metadata: CredentialOfferMetadata;
201
- }>, CredentialAccessError>;
202
- readonly authorize: (request: CredentialUseAuthorization) => Effect.Effect<void, CredentialAccessError>;
203
- readonly resolve: (request: CredentialUseAuthorization) => Effect.Effect<BrowserCredentialMaterial, CredentialAccessError>;
204
- /**
205
- * Optional host authority for every ordinary navigate/fill/click, mandatory for Submit.
206
- * Recheck caller ownership, user intent, current submission/continuation grants for ALL prior
207
- * exposures, and this exact target. Exposures may come from separate credential frames/forms.
208
- * Without this hook, ordinary actions retain their observation gate and Submit is unsupported.
209
- * Observation trust alone never authorizes a new native submit. Called again on each action;
210
- * approvals are not cached. The pass revalidates caller and target after this hook returns.
211
- */
212
- readonly authorizeAction?: (request: {
213
- readonly caller: Redacted.Redacted<string>;
214
- readonly action: ProtectedBrowserAction;
215
- readonly exposures: ReadonlyArray<CredentialTarget>;
216
- }) => Effect.Effect<void, CredentialAccessError>;
217
- /**
218
- * Explicitly trust all observed destinations not to echo credentials, including transformed
219
- * or delayed echoes. Called for every observation and non-secret action after exposure.
220
- * The string grant trusts all current observed origins. Return CredentialObservationGrant
221
- * to select an explicit subset instead. This is recipient trust, not submission authority,
222
- * a universal secrecy guarantee, or a login verifier.
223
- */
224
- readonly observation: (request: {
225
- readonly caller: Redacted.Redacted<string>;
226
- readonly topOrigin: typeof CredentialOrigin.Type;
227
- readonly frameOrigins: ReadonlyArray<typeof CredentialOrigin.Type>;
228
- readonly exposures: ReadonlyArray<CredentialTarget>;
229
- /** A human may have entered secrets; explicitly authorize observation even with no vault exposures. */
230
- readonly humanExposure?: boolean;
231
- /** Origins present when the human received control, retained across durable suspension. */
232
- readonly humanOrigins?: ReadonlyArray<typeof CredentialOrigin.Type>;
233
- }) => Effect.Effect<typeof CredentialObservationDecision.Type, CredentialAccessError>;
234
- }>;
235
- /**
236
- * Host-only vault and grant port. Derive caller from the authorized invocation, never Tool input.
237
- * Recheck account ownership, current grants, merchant/frame/recipient pairing, and any side
238
- * effects caused by filling. Listing authorizes metadata only. Grant checks never widen network
239
- * policy. Implementations must not log material or put it in defects/traces.
240
- */
241
- export declare class BrowserCredentialAccess extends BrowserCredentialAccess_base {}
242
- declare const ProtectedBrowserCheckpoint_base: Schema.Class<ProtectedBrowserCheckpoint, Schema.Struct<{
243
- readonly policy: typeof InteractiveBrowserPolicy;
244
- readonly startedAt: Schema.Natural;
245
- readonly actions: Schema.Natural;
246
- readonly exposures: Schema.$Array<typeof CredentialTarget>;
247
- readonly humanExposure: Schema.Boolean;
248
- readonly humanOrigins: Schema.$Array<Schema.String>;
249
- readonly dispatch: Schema.Literals<readonly ["not-dispatched", "possibly-dispatched", "dispatched"]>;
250
- readonly milestone: Schema.Literals<readonly ["none", "partial-fill", "filled", "submission-dispatched"]>;
251
- }>, {}>;
252
- /**
253
- * Host-only suspended-pass state. Persist with the host's fenced controller receipt, never in
254
- * a Tool result. It contains no credential material, offers, DOM references usable after resume,
255
- * cookies, page text, or provider capability. A host must restore its own credential exposure
256
- * ledger as well. The original deadline and action allowance include time spent with the human.
257
- */
258
- export declare class ProtectedBrowserCheckpoint extends ProtectedBrowserCheckpoint_base {}
259
- /** A private ephemeral pass. No selectors, JavaScript, screenshots, viewer, or provider identity. */
260
- export interface ProtectedBrowserHandle {
261
- readonly navigate: (request: ProtectedBrowserNavigate) => Effect.Effect<void, ProtectedBrowserError>;
262
- readonly observe: Effect.Effect<ProtectedBrowserObservation, ProtectedBrowserError>;
263
- readonly click: (request: ProtectedBrowserClick) => Effect.Effect<void, ProtectedBrowserError>;
264
- /** Uses the same lock, budgets, current-target checks and post-exposure grant as other actions. */
265
- readonly fill: (request: ProtectedBrowserFill) => Effect.Effect<void, ProtectedBrowserError>;
266
- readonly listCredentialOffers: (request: ListCredentialOffers) => Effect.Effect<ReadonlyArray<CredentialOffer>, ProtectedBrowserError>;
267
- readonly useCredential: (request: UseCredential) => Effect.Effect<CredentialUseResult, ProtectedBrowserError>;
268
- readonly close: Effect.Effect<typeof ProtectedCleanup.Type>;
269
- }
270
- declare const ProtectedBrowser_base: Context.ServiceClass<ProtectedBrowser, "@effect-agent/sandbox/ProtectedBrowser", {
271
- readonly open: (policy: InteractiveBrowserPolicy) => Effect.Effect<ProtectedBrowserHandle, ProtectedBrowserError, Scope.Scope | BrowserCredentialAccess>;
272
- }>;
273
- export declare class ProtectedBrowser extends ProtectedBrowser_base {}
274
- declare const ProtectedBrowserSession_base: Context.ServiceClass<ProtectedBrowserSession, "@effect-agent/sandbox/ProtectedBrowserSession", {
275
- readonly get: Effect.Effect<ProtectedBrowserHandle, ProtectedBrowserError>;
276
- }>;
277
- /** Build once in an execution/Attempt Layer. Acquires lazily and shares one pass across Tools. */
278
- export declare class ProtectedBrowserSession extends ProtectedBrowserSession_base {
279
- static layer(policy: InteractiveBrowserPolicy): Layer.Layer<ProtectedBrowserSession, never, BrowserCredentialAccess | ProtectedBrowser>;
280
- }
281
- //#endregion
282
- export { ProtectedBrowser_d_exports as t };
283
- //# sourceMappingURL=ProtectedBrowser.d.mts.map
@@ -1,298 +0,0 @@
1
- import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { InteractiveBrowserHost, InteractiveBrowserPolicy, InteractiveBrowserTargetUrl } from "./InteractiveBrowser.mjs";
3
- import { Context, Effect, Layer, Schema, Scope } from "effect";
4
- //#region src/sandbox/ProtectedBrowser.ts
5
- var ProtectedBrowser_exports = /* @__PURE__ */ __exportAll({
6
- BrowserCredentialAccess: () => BrowserCredentialAccess,
7
- BrowserCredentialMaterial: () => BrowserCredentialMaterial,
8
- BrowserReference: () => BrowserReference,
9
- CardCredential: () => CardCredential,
10
- CredentialAccessError: () => CredentialAccessError,
11
- CredentialDispatch: () => CredentialDispatch,
12
- CredentialFieldRole: () => CredentialFieldRole,
13
- CredentialKind: () => CredentialKind,
14
- CredentialMilestone: () => CredentialMilestone,
15
- CredentialObservationDecision: () => CredentialObservationDecision,
16
- CredentialObservationGrant: () => CredentialObservationGrant,
17
- CredentialOffer: () => CredentialOffer,
18
- CredentialOfferMetadata: () => CredentialOfferMetadata,
19
- CredentialOrigin: () => CredentialOrigin,
20
- CredentialTarget: () => CredentialTarget,
21
- CredentialUseResult: () => CredentialUseResult,
22
- ListCredentialOffers: () => ListCredentialOffers,
23
- LoginCredential: () => LoginCredential,
24
- ProtectedBrowser: () => ProtectedBrowser,
25
- ProtectedBrowserAction: () => ProtectedBrowserAction,
26
- ProtectedBrowserCheckpoint: () => ProtectedBrowserCheckpoint,
27
- ProtectedBrowserClick: () => ProtectedBrowserClick,
28
- ProtectedBrowserControl: () => ProtectedBrowserControl,
29
- ProtectedBrowserError: () => ProtectedBrowserError,
30
- ProtectedBrowserFill: () => ProtectedBrowserFill,
31
- ProtectedBrowserNavigate: () => ProtectedBrowserNavigate,
32
- ProtectedBrowserObservation: () => ProtectedBrowserObservation,
33
- ProtectedBrowserSession: () => ProtectedBrowserSession,
34
- ProtectedCleanup: () => ProtectedCleanup,
35
- ProtectedObservationState: () => ProtectedObservationState,
36
- UseCredential: () => UseCredential
37
- });
38
- /** Canonical HTTPS origin, including a non-default port. Host grants match exactly. */
39
- const CredentialOrigin = Schema.String.check(Schema.makeFilter((value) => value.startsWith("https://") && Schema.is(InteractiveBrowserHost)(value.slice(8))));
40
- const BrowserReference = Schema.String.check(Schema.isUUID());
41
- const CredentialKind = Schema.Literals(["login", "card"]);
42
- const CredentialFieldRole = Schema.Literals([
43
- "username",
44
- "password",
45
- "card-name",
46
- "card-number",
47
- "card-expiry",
48
- "card-expiry-month",
49
- "card-expiry-year",
50
- "card-security-code"
51
- ]);
52
- const Label = Schema.String.check(Schema.isMaxLength(200));
53
- const LinkUrl = InteractiveBrowserTargetUrl.check(Schema.isStartsWith("https://"));
54
- var CredentialTarget = class extends Schema.Class("CredentialTarget")({
55
- topOrigin: CredentialOrigin,
56
- frameOrigin: CredentialOrigin,
57
- recipientOrigin: CredentialOrigin,
58
- document: BrowserReference,
59
- frame: BrowserReference,
60
- form: BrowserReference
61
- }) {};
62
- var ProtectedBrowserControl = class extends Schema.Class("ProtectedBrowserControl")({
63
- ref: BrowserReference,
64
- target: CredentialTarget,
65
- role: Schema.Union([CredentialFieldRole, Schema.Literals([
66
- "text",
67
- "select",
68
- "radio",
69
- "checkbox",
70
- "submit",
71
- "link",
72
- "button",
73
- "unsupported"
74
- ])]),
75
- label: Label,
76
- /** Current native radio/checkbox state; field values are never included. */
77
- checked: Schema.optionalKey(Schema.Boolean),
78
- /**
79
- * Ordinary select choices only; credential choices and raw option values remain private.
80
- * Omitted choices or labels beyond the bounds set the observation's truncated flag.
81
- */
82
- options: Schema.optionalKey(Schema.Array(Schema.Struct({
83
- label: Label,
84
- selected: Schema.Boolean,
85
- disabled: Schema.Boolean
86
- })).check(Schema.isMaxLength(256))),
87
- /** Resolved HTTPS destination for a native link; target.recipientOrigin is its origin. */
88
- url: Schema.optionalKey(LinkUrl)
89
- }) {};
90
- var ProtectedBrowserObservation = class extends Schema.Class("ProtectedBrowserObservation")({
91
- document: BrowserReference,
92
- topOrigin: CredentialOrigin,
93
- text: Schema.String.check(Schema.isMaxLength(65536)),
94
- controls: Schema.Array(ProtectedBrowserControl).check(Schema.isMaxLength(64)),
95
- truncated: Schema.Boolean,
96
- observation: Schema.Literals(["before-exposure", "approved-after-exposure"])
97
- }) {};
98
- var CredentialOfferMetadata = class extends Schema.Class("CredentialOfferMetadata")({
99
- label: Label,
100
- brand: Schema.optionalKey(Label),
101
- lastFour: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^\d{4}$/))),
102
- /** Plaintext metadata disclosed only when the host authorizes listing this offer. */
103
- billingAddress: Schema.optionalKey(Schema.Struct({
104
- name: Schema.optionalKey(Label),
105
- line1: Schema.optionalKey(Label),
106
- line2: Schema.optionalKey(Label),
107
- city: Schema.optionalKey(Label),
108
- region: Schema.optionalKey(Label),
109
- postalCode: Schema.optionalKey(Label),
110
- country: Schema.optionalKey(Label)
111
- }))
112
- }) {};
113
- var CredentialOffer = class extends Schema.Class("CredentialOffer")({
114
- ref: BrowserReference,
115
- kind: CredentialKind,
116
- metadata: CredentialOfferMetadata
117
- }) {};
118
- var ListCredentialOffers = class extends Schema.Class("ListCredentialOffers")({
119
- kind: CredentialKind,
120
- target: BrowserReference
121
- }) {};
122
- var UseCredential = class extends Schema.Class("UseCredential")({
123
- offer: BrowserReference,
124
- fields: Schema.Array(Schema.Struct({
125
- ref: BrowserReference,
126
- role: CredentialFieldRole
127
- })).check(Schema.isMinLength(1), Schema.isMaxLength(8)),
128
- submit: Schema.optionalKey(BrowserReference)
129
- }) {};
130
- var ProtectedBrowserNavigate = class extends Schema.Class("ProtectedBrowserNavigate")({ url: Schema.String.check(Schema.isMaxLength(8192)) }) {};
131
- var ProtectedBrowserClick = class extends Schema.Class("ProtectedBrowserClick")({ ref: BrowserReference }) {};
132
- /**
133
- * Non-secret text for an ordinary text control or native single select in the current observation.
134
- * Never pass credential material. Credential roles, including username, require useCredential.
135
- * Selects match one enabled option's exact observed label. Empty text clears text controls.
136
- */
137
- var ProtectedBrowserFill = class extends Schema.Class("ProtectedBrowserFill")(Schema.Struct({
138
- ref: BrowserReference,
139
- value: Schema.String.check(Schema.isMaxLength(8192))
140
- })) {};
141
- const CredentialDispatch = Schema.Literals([
142
- "not-dispatched",
143
- "possibly-dispatched",
144
- "dispatched"
145
- ]);
146
- const CredentialMilestone = Schema.Literals([
147
- "none",
148
- "partial-fill",
149
- "filled",
150
- "submission-dispatched"
151
- ]);
152
- const ProtectedObservationState = Schema.Literals([
153
- "before-exposure",
154
- "protected",
155
- "approved-after-exposure",
156
- "closed"
157
- ]);
158
- const ProtectedCleanup = Schema.Literals([
159
- "not-requested",
160
- "confirmed",
161
- "unconfirmed"
162
- ]);
163
- const Evidence = {
164
- dispatch: CredentialDispatch,
165
- milestone: CredentialMilestone,
166
- observation: ProtectedObservationState,
167
- cleanup: ProtectedCleanup
168
- };
169
- /** No foreign message/cause or page data may enter this failure. Closure does not undo dispatch. */
170
- var ProtectedBrowserError = class extends Schema.TaggedError()("ProtectedBrowserError", {
171
- reason: Schema.Literals([
172
- "denied",
173
- "missing-credential",
174
- "stale-reference",
175
- "unsupported",
176
- "needs-attention",
177
- "busy",
178
- "closed",
179
- "limit",
180
- "timeout",
181
- "provider",
182
- "resolver",
183
- "outcome-unknown",
184
- "observation-blocked"
185
- ]),
186
- ...Evidence
187
- }) {};
188
- var CredentialUseResult = class extends Schema.Class("CredentialUseResult")({
189
- ...Evidence,
190
- authentication: Schema.Literal("unverified")
191
- }) {};
192
- const SecretText = Schema.Redacted(Schema.NonEmptyString.check(Schema.isMaxLength(1024)));
193
- /** Host-only material. Never encode it into Tool results, checkpoints, or storage. */
194
- const LoginCredential = Schema.TaggedStruct("LoginCredential", {
195
- username: SecretText,
196
- password: SecretText
197
- });
198
- /** Security codes are transient, never persisted. Dummy tests are not PCI compliance evidence. */
199
- const CardCredential = Schema.TaggedStruct("CardCredential", {
200
- name: SecretText,
201
- number: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{12,19}$/))),
202
- expiry: SecretText,
203
- expiryMonth: Schema.Redacted(Schema.String.check(Schema.isPattern(/^(0[1-9]|1[0-2])$/))),
204
- expiryYear: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{4}$/))),
205
- securityCode: Schema.optionalKey(Schema.Redacted(Schema.String.check(Schema.isPattern(/^\d{3,4}$/))))
206
- });
207
- const BrowserCredentialMaterial = Schema.Union([LoginCredential, CardCredential]);
208
- /** Use busy for transient host-authority unavailability; return promptly without waiting for Tool completion. */
209
- var CredentialAccessError = class extends Schema.TaggedError()("CredentialAccessError", { reason: Schema.Literals([
210
- "denied",
211
- "missing-credential",
212
- "needs-attention",
213
- "busy",
214
- "resolver"
215
- ]) }) {};
216
- /** Exact current action proposed to host authority; no ordinary fill value or secret is included. */
217
- const ProtectedBrowserAction = Schema.Union([
218
- Schema.TaggedStruct("Navigate", { url: ProtectedBrowserNavigate.fields.url }),
219
- Schema.TaggedStruct("Fill", {
220
- ref: BrowserReference,
221
- target: CredentialTarget,
222
- role: Schema.Literals(["text", "select"])
223
- }),
224
- Schema.TaggedStruct("Click", {
225
- ref: BrowserReference,
226
- target: CredentialTarget,
227
- role: Schema.Literals([
228
- "button",
229
- "radio",
230
- "checkbox"
231
- ])
232
- }),
233
- Schema.TaggedStruct("Click", {
234
- ref: BrowserReference,
235
- target: CredentialTarget,
236
- role: Schema.Literal("link"),
237
- url: LinkUrl
238
- }),
239
- Schema.TaggedStruct("Submit", {
240
- ref: BrowserReference,
241
- target: CredentialTarget
242
- })
243
- ]);
244
- /**
245
- * Trust only these current observation origins. The top origin must be included. Other frames
246
- * supply neither text nor usable refs. This does not expand network policy or credential grants.
247
- */
248
- var CredentialObservationGrant = class extends Schema.Class("CredentialObservationGrant")({
249
- decision: Schema.Literal("trust-recipient-no-credential-echo"),
250
- origins: Schema.Array(CredentialOrigin).check(Schema.isMinLength(1), Schema.isMaxLength(16), Schema.isUnique())
251
- }) {};
252
- const CredentialObservationDecision = Schema.Union([Schema.Literals(["trust-recipient-no-credential-echo", "deny"]), CredentialObservationGrant]);
253
- /**
254
- * Host-only vault and grant port. Derive caller from the authorized invocation, never Tool input.
255
- * Recheck account ownership, current grants, merchant/frame/recipient pairing, and any side
256
- * effects caused by filling. Listing authorizes metadata only. Grant checks never widen network
257
- * policy. Implementations must not log material or put it in defects/traces.
258
- */
259
- var BrowserCredentialAccess = class extends Context.Service()("@effect-agent/sandbox/BrowserCredentialAccess") {};
260
- /**
261
- * Host-only suspended-pass state. Persist with the host's fenced controller receipt, never in
262
- * a Tool result. It contains no credential material, offers, DOM references usable after resume,
263
- * cookies, page text, or provider capability. A host must restore its own credential exposure
264
- * ledger as well. The original deadline and action allowance include time spent with the human.
265
- */
266
- var ProtectedBrowserCheckpoint = class extends Schema.Class("ProtectedBrowserCheckpoint")({
267
- policy: InteractiveBrowserPolicy,
268
- startedAt: Schema.Natural,
269
- actions: Schema.Natural,
270
- exposures: Schema.Array(CredentialTarget).check(Schema.isMaxLength(1e3)),
271
- humanExposure: Schema.Boolean,
272
- humanOrigins: Schema.Array(CredentialOrigin).check(Schema.isMaxLength(16)),
273
- dispatch: CredentialDispatch,
274
- milestone: CredentialMilestone
275
- }) {};
276
- var ProtectedBrowser = class extends Context.Service()("@effect-agent/sandbox/ProtectedBrowser") {};
277
- /** Build once in an execution/Attempt Layer. Acquires lazily and shares one pass across Tools. */
278
- var ProtectedBrowserSession = class extends Context.Service()("@effect-agent/sandbox/ProtectedBrowserSession") {
279
- static layer(policy) {
280
- return Layer.effect(this)(Effect.gen(function* () {
281
- const browser = yield* ProtectedBrowser;
282
- const access = yield* BrowserCredentialAccess;
283
- const scope = yield* Effect.scope;
284
- const cached = yield* Effect.cached(browser.open(policy).pipe(Effect.provideService(BrowserCredentialAccess, access), Effect.provideService(Scope.Scope, scope)));
285
- return { get: Effect.suspend(() => scope.state._tag === "Closed" ? Effect.fail(new ProtectedBrowserError({
286
- reason: "closed",
287
- dispatch: "not-dispatched",
288
- milestone: "none",
289
- observation: "closed",
290
- cleanup: "not-requested"
291
- })) : cached) };
292
- }));
293
- }
294
- };
295
- //#endregion
296
- export { BrowserCredentialAccess, BrowserCredentialMaterial, BrowserReference, CardCredential, CredentialAccessError, CredentialDispatch, CredentialFieldRole, CredentialKind, CredentialMilestone, CredentialObservationDecision, CredentialObservationGrant, CredentialOffer, CredentialOfferMetadata, CredentialOrigin, CredentialTarget, CredentialUseResult, ListCredentialOffers, LoginCredential, ProtectedBrowser, ProtectedBrowserAction, ProtectedBrowserCheckpoint, ProtectedBrowserClick, ProtectedBrowserControl, ProtectedBrowserError, ProtectedBrowserFill, ProtectedBrowserNavigate, ProtectedBrowserObservation, ProtectedBrowserSession, ProtectedCleanup, ProtectedObservationState, UseCredential, ProtectedBrowser_exports as t };
297
-
298
- //# sourceMappingURL=ProtectedBrowser.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProtectedBrowser.mjs","names":[],"sources":["../../src/sandbox/ProtectedBrowser.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema, Scope, type Redacted } from \"effect\";\n\nimport {\n InteractiveBrowserHost,\n InteractiveBrowserTargetUrl,\n InteractiveBrowserPolicy,\n} from \"./InteractiveBrowser.ts\";\n\n/** Canonical HTTPS origin, including a non-default port. Host grants match exactly. */\nexport const CredentialOrigin = Schema.String.check(\n Schema.makeFilter(\n (value) => value.startsWith(\"https://\") && Schema.is(InteractiveBrowserHost)(value.slice(8)),\n ),\n);\n\nexport const BrowserReference = Schema.String.check(Schema.isUUID());\nexport const CredentialKind = Schema.Literals([\"login\", \"card\"]);\n\nexport const CredentialFieldRole = Schema.Literals([\n \"username\",\n \"password\",\n \"card-name\",\n \"card-number\",\n \"card-expiry\",\n \"card-expiry-month\",\n \"card-expiry-year\",\n \"card-security-code\",\n]);\n\nconst Label = Schema.String.check(Schema.isMaxLength(200));\nconst LinkUrl = InteractiveBrowserTargetUrl.check(Schema.isStartsWith(\"https://\"));\n\nexport class CredentialTarget extends Schema.Class<CredentialTarget>(\"CredentialTarget\")({\n topOrigin: CredentialOrigin,\n frameOrigin: CredentialOrigin,\n recipientOrigin: CredentialOrigin,\n document: BrowserReference,\n frame: BrowserReference,\n form: BrowserReference,\n}) {}\n\nexport class ProtectedBrowserControl extends Schema.Class<ProtectedBrowserControl>(\n \"ProtectedBrowserControl\",\n)({\n ref: BrowserReference,\n target: CredentialTarget,\n role: Schema.Union([\n CredentialFieldRole,\n Schema.Literals([\n \"text\",\n \"select\",\n \"radio\",\n \"checkbox\",\n \"submit\",\n \"link\",\n \"button\",\n \"unsupported\",\n ]),\n ]),\n label: Label,\n /** Current native radio/checkbox state; field values are never included. */\n checked: Schema.optionalKey(Schema.Boolean),\n /**\n * Ordinary select choices only; credential choices and raw option values remain private.\n * Omitted choices or labels beyond the bounds set the observation's truncated flag.\n */\n options: Schema.optionalKey(\n Schema.Array(\n Schema.Struct({ label: Label, selected: Schema.Boolean, disabled: Schema.Boolean }),\n ).check(Schema.isMaxLength(256)),\n ),\n /** Resolved HTTPS destination for a native link; target.recipientOrigin is its origin. */\n url: Schema.optionalKey(LinkUrl),\n}) {}\n\nexport class ProtectedBrowserObservation extends Schema.Class<ProtectedBrowserObservation>(\n \"ProtectedBrowserObservation\",\n)({\n document: BrowserReference,\n topOrigin: CredentialOrigin,\n text: Schema.String.check(Schema.isMaxLength(64 * 1024)),\n controls: Schema.Array(ProtectedBrowserControl).check(Schema.isMaxLength(64)),\n truncated: Schema.Boolean,\n observation: Schema.Literals([\"before-exposure\", \"approved-after-exposure\"]),\n}) {}\n\nexport class CredentialOfferMetadata extends Schema.Class<CredentialOfferMetadata>(\n \"CredentialOfferMetadata\",\n)({\n label: Label,\n brand: Schema.optionalKey(Label),\n lastFour: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^\\d{4}$/))),\n /** Plaintext metadata disclosed only when the host authorizes listing this offer. */\n billingAddress: Schema.optionalKey(\n Schema.Struct({\n name: Schema.optionalKey(Label),\n line1: Schema.optionalKey(Label),\n line2: Schema.optionalKey(Label),\n city: Schema.optionalKey(Label),\n region: Schema.optionalKey(Label),\n postalCode: Schema.optionalKey(Label),\n country: Schema.optionalKey(Label),\n }),\n ),\n}) {}\n\nexport class CredentialOffer extends Schema.Class<CredentialOffer>(\"CredentialOffer\")({\n ref: BrowserReference,\n kind: CredentialKind,\n metadata: CredentialOfferMetadata,\n}) {}\n\nexport class ListCredentialOffers extends Schema.Class<ListCredentialOffers>(\n \"ListCredentialOffers\",\n)({\n kind: CredentialKind,\n target: BrowserReference,\n}) {}\n\nexport class UseCredential extends Schema.Class<UseCredential>(\"UseCredential\")({\n offer: BrowserReference,\n fields: Schema.Array(Schema.Struct({ ref: BrowserReference, role: CredentialFieldRole })).check(\n Schema.isMinLength(1),\n Schema.isMaxLength(8),\n ),\n submit: Schema.optionalKey(BrowserReference),\n}) {}\n\nexport class ProtectedBrowserNavigate extends Schema.Class<ProtectedBrowserNavigate>(\n \"ProtectedBrowserNavigate\",\n)({\n url: Schema.String.check(Schema.isMaxLength(8192)),\n}) {}\n\nexport class ProtectedBrowserClick extends Schema.Class<ProtectedBrowserClick>(\n \"ProtectedBrowserClick\",\n)({\n ref: BrowserReference,\n}) {}\n\n/**\n * Non-secret text for an ordinary text control or native single select in the current observation.\n * Never pass credential material. Credential roles, including username, require useCredential.\n * Selects match one enabled option's exact observed label. Empty text clears text controls.\n */\nexport class ProtectedBrowserFill extends Schema.Class<ProtectedBrowserFill>(\n \"ProtectedBrowserFill\",\n)(\n Schema.Struct({\n ref: BrowserReference,\n value: Schema.String.check(Schema.isMaxLength(8192)),\n }),\n) {}\n\nexport const CredentialDispatch = Schema.Literals([\n \"not-dispatched\",\n \"possibly-dispatched\",\n \"dispatched\",\n]);\n\nexport const CredentialMilestone = Schema.Literals([\n \"none\",\n \"partial-fill\",\n \"filled\",\n \"submission-dispatched\",\n]);\n\nexport const ProtectedObservationState = Schema.Literals([\n \"before-exposure\",\n \"protected\",\n \"approved-after-exposure\",\n \"closed\",\n]);\n\nexport const ProtectedCleanup = Schema.Literals([\"not-requested\", \"confirmed\", \"unconfirmed\"]);\n\nconst Evidence = {\n dispatch: CredentialDispatch,\n milestone: CredentialMilestone,\n observation: ProtectedObservationState,\n cleanup: ProtectedCleanup,\n};\n\n/** No foreign message/cause or page data may enter this failure. Closure does not undo dispatch. */\nexport class ProtectedBrowserError extends Schema.TaggedError<ProtectedBrowserError>()(\n \"ProtectedBrowserError\",\n {\n reason: Schema.Literals([\n \"denied\",\n \"missing-credential\",\n \"stale-reference\",\n \"unsupported\",\n \"needs-attention\",\n \"busy\",\n \"closed\",\n \"limit\",\n \"timeout\",\n \"provider\",\n \"resolver\",\n \"outcome-unknown\",\n \"observation-blocked\",\n ]),\n ...Evidence,\n },\n) {}\n\nexport class CredentialUseResult extends Schema.Class<CredentialUseResult>(\"CredentialUseResult\")({\n ...Evidence,\n authentication: Schema.Literal(\"unverified\"),\n}) {}\n\nconst SecretText = Schema.Redacted(Schema.NonEmptyString.check(Schema.isMaxLength(1024)));\n\n/** Host-only material. Never encode it into Tool results, checkpoints, or storage. */\nexport const LoginCredential = Schema.TaggedStruct(\"LoginCredential\", {\n username: SecretText,\n password: SecretText,\n});\n\n/** Security codes are transient, never persisted. Dummy tests are not PCI compliance evidence. */\nexport const CardCredential = Schema.TaggedStruct(\"CardCredential\", {\n name: SecretText,\n number: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{12,19}$/))),\n expiry: SecretText,\n expiryMonth: Schema.Redacted(Schema.String.check(Schema.isPattern(/^(0[1-9]|1[0-2])$/))),\n expiryYear: Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{4}$/))),\n securityCode: Schema.optionalKey(\n Schema.Redacted(Schema.String.check(Schema.isPattern(/^\\d{3,4}$/))),\n ),\n});\n\nexport const BrowserCredentialMaterial = Schema.Union([LoginCredential, CardCredential]);\nexport type BrowserCredentialMaterial = typeof BrowserCredentialMaterial.Type;\n\n/** Use busy for transient host-authority unavailability; return promptly without waiting for Tool completion. */\nexport class CredentialAccessError extends Schema.TaggedError<CredentialAccessError>()(\n \"CredentialAccessError\",\n {\n reason: Schema.Literals([\n \"denied\",\n \"missing-credential\",\n \"needs-attention\",\n \"busy\",\n \"resolver\",\n ]),\n },\n) {}\n\nexport interface CredentialAccessRequest {\n readonly caller: Redacted.Redacted<string>;\n readonly kind: typeof CredentialKind.Type;\n readonly target: CredentialTarget;\n}\n\nexport interface CredentialUseAuthorization extends CredentialAccessRequest {\n readonly key: Redacted.Redacted<string>;\n readonly roles: ReadonlyArray<typeof CredentialFieldRole.Type>;\n readonly submit: boolean;\n}\n\n/** Exact current action proposed to host authority; no ordinary fill value or secret is included. */\nexport const ProtectedBrowserAction = Schema.Union([\n Schema.TaggedStruct(\"Navigate\", { url: ProtectedBrowserNavigate.fields.url }),\n Schema.TaggedStruct(\"Fill\", {\n ref: BrowserReference,\n target: CredentialTarget,\n role: Schema.Literals([\"text\", \"select\"]),\n }),\n Schema.TaggedStruct(\"Click\", {\n ref: BrowserReference,\n target: CredentialTarget,\n role: Schema.Literals([\"button\", \"radio\", \"checkbox\"]),\n }),\n Schema.TaggedStruct(\"Click\", {\n ref: BrowserReference,\n target: CredentialTarget,\n role: Schema.Literal(\"link\"),\n url: LinkUrl,\n }),\n Schema.TaggedStruct(\"Submit\", { ref: BrowserReference, target: CredentialTarget }),\n]);\n\nexport type ProtectedBrowserAction = typeof ProtectedBrowserAction.Type;\n\n/**\n * Trust only these current observation origins. The top origin must be included. Other frames\n * supply neither text nor usable refs. This does not expand network policy or credential grants.\n */\nexport class CredentialObservationGrant extends Schema.Class<CredentialObservationGrant>(\n \"CredentialObservationGrant\",\n)({\n decision: Schema.Literal(\"trust-recipient-no-credential-echo\"),\n origins: Schema.Array(CredentialOrigin).check(\n Schema.isMinLength(1),\n Schema.isMaxLength(16),\n Schema.isUnique(),\n ),\n}) {}\n\nexport const CredentialObservationDecision = Schema.Union([\n Schema.Literals([\"trust-recipient-no-credential-echo\", \"deny\"]),\n CredentialObservationGrant,\n]);\n\n/**\n * Host-only vault and grant port. Derive caller from the authorized invocation, never Tool input.\n * Recheck account ownership, current grants, merchant/frame/recipient pairing, and any side\n * effects caused by filling. Listing authorizes metadata only. Grant checks never widen network\n * policy. Implementations must not log material or put it in defects/traces.\n */\nexport class BrowserCredentialAccess extends Context.Service<\n BrowserCredentialAccess,\n {\n readonly caller: Effect.Effect<Redacted.Redacted<string>, CredentialAccessError>;\n readonly list: (request: CredentialAccessRequest) => Effect.Effect<\n ReadonlyArray<{\n readonly key: Redacted.Redacted<string>;\n readonly metadata: CredentialOfferMetadata;\n }>,\n CredentialAccessError\n >;\n readonly authorize: (\n request: CredentialUseAuthorization,\n ) => Effect.Effect<void, CredentialAccessError>;\n readonly resolve: (\n request: CredentialUseAuthorization,\n ) => Effect.Effect<BrowserCredentialMaterial, CredentialAccessError>;\n /**\n * Optional host authority for every ordinary navigate/fill/click, mandatory for Submit.\n * Recheck caller ownership, user intent, current submission/continuation grants for ALL prior\n * exposures, and this exact target. Exposures may come from separate credential frames/forms.\n * Without this hook, ordinary actions retain their observation gate and Submit is unsupported.\n * Observation trust alone never authorizes a new native submit. Called again on each action;\n * approvals are not cached. The pass revalidates caller and target after this hook returns.\n */\n readonly authorizeAction?: (request: {\n readonly caller: Redacted.Redacted<string>;\n readonly action: ProtectedBrowserAction;\n readonly exposures: ReadonlyArray<CredentialTarget>;\n }) => Effect.Effect<void, CredentialAccessError>;\n /**\n * Explicitly trust all observed destinations not to echo credentials, including transformed\n * or delayed echoes. Called for every observation and non-secret action after exposure.\n * The string grant trusts all current observed origins. Return CredentialObservationGrant\n * to select an explicit subset instead. This is recipient trust, not submission authority,\n * a universal secrecy guarantee, or a login verifier.\n */\n readonly observation: (request: {\n readonly caller: Redacted.Redacted<string>;\n readonly topOrigin: typeof CredentialOrigin.Type;\n readonly frameOrigins: ReadonlyArray<typeof CredentialOrigin.Type>;\n readonly exposures: ReadonlyArray<CredentialTarget>;\n /** A human may have entered secrets; explicitly authorize observation even with no vault exposures. */\n readonly humanExposure?: boolean;\n /** Origins present when the human received control, retained across durable suspension. */\n readonly humanOrigins?: ReadonlyArray<typeof CredentialOrigin.Type>;\n }) => Effect.Effect<typeof CredentialObservationDecision.Type, CredentialAccessError>;\n }\n>()(\"@effect-agent/sandbox/BrowserCredentialAccess\") {}\n\n/**\n * Host-only suspended-pass state. Persist with the host's fenced controller receipt, never in\n * a Tool result. It contains no credential material, offers, DOM references usable after resume,\n * cookies, page text, or provider capability. A host must restore its own credential exposure\n * ledger as well. The original deadline and action allowance include time spent with the human.\n */\nexport class ProtectedBrowserCheckpoint extends Schema.Class<ProtectedBrowserCheckpoint>(\n \"ProtectedBrowserCheckpoint\",\n)({\n policy: InteractiveBrowserPolicy,\n startedAt: Schema.Natural,\n actions: Schema.Natural,\n exposures: Schema.Array(CredentialTarget).check(Schema.isMaxLength(1000)),\n humanExposure: Schema.Boolean,\n humanOrigins: Schema.Array(CredentialOrigin).check(Schema.isMaxLength(16)),\n dispatch: CredentialDispatch,\n milestone: CredentialMilestone,\n}) {}\n\n/** A private ephemeral pass. No selectors, JavaScript, screenshots, viewer, or provider identity. */\nexport interface ProtectedBrowserHandle {\n readonly navigate: (\n request: ProtectedBrowserNavigate,\n ) => Effect.Effect<void, ProtectedBrowserError>;\n readonly observe: Effect.Effect<ProtectedBrowserObservation, ProtectedBrowserError>;\n readonly click: (request: ProtectedBrowserClick) => Effect.Effect<void, ProtectedBrowserError>;\n /** Uses the same lock, budgets, current-target checks and post-exposure grant as other actions. */\n readonly fill: (request: ProtectedBrowserFill) => Effect.Effect<void, ProtectedBrowserError>;\n readonly listCredentialOffers: (\n request: ListCredentialOffers,\n ) => Effect.Effect<ReadonlyArray<CredentialOffer>, ProtectedBrowserError>;\n readonly useCredential: (\n request: UseCredential,\n ) => Effect.Effect<CredentialUseResult, ProtectedBrowserError>;\n readonly close: Effect.Effect<typeof ProtectedCleanup.Type>;\n}\n\nexport class ProtectedBrowser extends Context.Service<\n ProtectedBrowser,\n {\n readonly open: (\n policy: InteractiveBrowserPolicy,\n ) => Effect.Effect<\n ProtectedBrowserHandle,\n ProtectedBrowserError,\n Scope.Scope | BrowserCredentialAccess\n >;\n }\n>()(\"@effect-agent/sandbox/ProtectedBrowser\") {}\n\n/** Build once in an execution/Attempt Layer. Acquires lazily and shares one pass across Tools. */\nexport class ProtectedBrowserSession extends Context.Service<\n ProtectedBrowserSession,\n {\n readonly get: Effect.Effect<ProtectedBrowserHandle, ProtectedBrowserError>;\n }\n>()(\"@effect-agent/sandbox/ProtectedBrowserSession\") {\n static layer(policy: InteractiveBrowserPolicy) {\n return Layer.effect(this)(\n Effect.gen(function* () {\n const browser = yield* ProtectedBrowser;\n const access = yield* BrowserCredentialAccess;\n const scope = yield* Effect.scope;\n\n const cached = yield* Effect.cached(\n browser\n .open(policy)\n .pipe(\n Effect.provideService(BrowserCredentialAccess, access),\n Effect.provideService(Scope.Scope, scope),\n ),\n );\n\n return {\n get: Effect.suspend(() =>\n scope.state._tag === \"Closed\"\n ? Effect.fail(\n new ProtectedBrowserError({\n reason: \"closed\",\n dispatch: \"not-dispatched\",\n milestone: \"none\",\n observation: \"closed\",\n cleanup: \"not-requested\",\n }),\n )\n : cached,\n ),\n };\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,mBAAmB,OAAO,OAAO,MAC5C,OAAO,YACJ,UAAU,MAAM,WAAW,UAAU,KAAK,OAAO,GAAG,sBAAsB,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAC7F,CACF;AAEA,MAAa,mBAAmB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC;AACnE,MAAa,iBAAiB,OAAO,SAAS,CAAC,SAAS,MAAM,CAAC;AAE/D,MAAa,sBAAsB,OAAO,SAAS;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,QAAQ,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;AACzD,MAAM,UAAU,4BAA4B,MAAM,OAAO,aAAa,UAAU,CAAC;AAEjF,IAAa,mBAAb,cAAsC,OAAO,MAAwB,kBAAkB,CAAC,CAAC;CACvF,WAAW;CACX,aAAa;CACb,iBAAiB;CACjB,UAAU;CACV,OAAO;CACP,MAAM;AACR,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,0BAAb,cAA6C,OAAO,MAClD,yBACF,CAAC,CAAC;CACA,KAAK;CACL,QAAQ;CACR,MAAM,OAAO,MAAM,CACjB,qBACA,OAAO,SAAS;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CACH,CAAC;CACD,OAAO;;CAEP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