effect-agent 0.1.0-beta.90 → 0.1.0-beta.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AgentRuntime-CHipL2jG.mjs → AgentRuntime-BPjQM1Nv.mjs} +2 -2
- package/dist/AgentRuntime-BPjQM1Nv.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-D7gDKGjH.mjs → DurableAgentRuntime-CdrBuKZY.mjs} +4 -4
- package/dist/{DurableAgentRuntime-D7gDKGjH.mjs.map → DurableAgentRuntime-CdrBuKZY.mjs.map} +1 -1
- package/dist/{EventSource-OqS_P9ug.d.mts → EventSource-c6GRTCsl.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-C4HbjHgl.d.mts → PreparedInputAdmission-QzFbW2LQ.d.mts} +4 -4
- package/dist/Records-C9cezOEf.mjs +799 -0
- package/dist/Records-C9cezOEf.mjs.map +1 -0
- package/dist/{Records-BAGkekt8.d.mts → Records-vFp_ZQ9Y.d.mts} +21 -3
- package/dist/{RunJournal-Cgg1kNvc.mjs → RunJournal-lwbrh2hZ.mjs} +2 -2
- package/dist/{RunJournal-Cgg1kNvc.mjs.map → RunJournal-lwbrh2hZ.mjs.map} +1 -1
- package/dist/{Schedule-H3SEYX9g.d.mts → Schedule-BkZvKyMw.d.mts} +2 -2
- package/dist/{Scheduling-C9aIP8zT.mjs → Scheduling-D0QqOoeT.mjs} +2 -2
- package/dist/{Scheduling-C9aIP8zT.mjs.map → Scheduling-D0QqOoeT.mjs.map} +1 -1
- package/dist/{Subagent-U5qXOFE8.mjs → Subagent-CnTzCy8k.mjs} +2 -2
- package/dist/{Subagent-U5qXOFE8.mjs.map → Subagent-CnTzCy8k.mjs.map} +1 -1
- package/dist/{Subscription-BEP8oQO5.d.mts → Subscription-CKQ0KDHN.d.mts} +3 -3
- package/dist/{SubscriptionInput-vAAOBrK7.d.mts → SubscriptionInput-Cth8F_7b.d.mts} +3 -3
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/capabilities/WebSearch.d.mts +3 -3
- package/dist/capabilities/WebSearch.mjs +9 -6
- package/dist/capabilities/WebSearch.mjs.map +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/ActivityStore.mjs +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/Admin.mjs +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +1 -1
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/Digest.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/EventSource.mjs +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +48 -6
- package/dist/durable/GitHubWorkflowSource.mjs +13 -13
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -1
- package/dist/durable/MessageDelivery.d.mts +22 -22
- package/dist/durable/MessageDelivery.mjs +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PersistentHistory.mjs +2 -2
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Records.mjs +2 -795
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/RunJournal.mjs +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/Schedule.mjs +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.mjs +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/ScheduleTransition.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +2 -2
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SqlMemoryStore.mjs +4 -3
- package/dist/durable/SqlMemoryStore.mjs.map +1 -1
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.mjs +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/Subscription.mjs +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionInput.mjs +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/Subscriptions.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- package/dist/durable/ThreadInvariants.mjs +1 -1
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjection.mjs +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStore.mjs +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.mjs +1 -1
- package/dist/durable/ToolReconciler.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +6 -6
- package/dist/sandbox/InteractiveBrowser.mjs +2 -2
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -1
- package/dist/sandbox/PageCapture.mjs +4 -4
- package/dist/sandbox/PageCapture.mjs.map +1 -1
- package/dist/sandbox/ProtectedBrowser.mjs +1 -1
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/WebSearch.ts +23 -17
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/durable/GitHubWorkflowSource.ts +32 -38
- package/src/durable/Records.ts +8 -4
- package/src/durable/SqlMemoryStore.ts +7 -3
- package/src/engine/internal/primitive-delta.ts +1 -1
- package/src/sandbox/InteractiveBrowser.ts +2 -2
- package/src/sandbox/PageCapture.ts +6 -7
- package/src/sandbox/ProtectedBrowser.ts +1 -1
- package/dist/AgentRuntime-CHipL2jG.mjs.map +0 -1
- package/dist/durable/Records.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
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 /** 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 a unique enabled option value, then a unique exact trimmed label. Empty text clears.\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 }).pipe(Schema.annotate({ parseOptions: { onExcessProperty: \"error\" } })),\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\nexport class CredentialAccessError extends Schema.TaggedError<CredentialAccessError>()(\n \"CredentialAccessError\",\n {\n reason: Schema.Literals([\"denied\", \"missing-credential\", \"needs-attention\", \"resolver\"]),\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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,gBAAgB,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,CAAC;CACzE,UAAU;CACV,WAAW;AACb,CAAC,CAAC,CAAC,CAAC;AAoBJ,IAAa,mBAAb,cAAsC,QAAQ,QAW5C,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC;;AAG/C,IAAa,0BAAb,cAA6C,QAAQ,QAKnD,CAAC,CAAC,+CAA+C,CAAC,CAAC;CACnD,OAAO,MAAM,QAAkC;EAC7C,OAAO,MAAM,OAAO,IAAI,CAAC,CACvB,OAAO,IAAI,aAAa;GACtB,MAAM,UAAU,OAAO;GACvB,MAAM,SAAS,OAAO;GACtB,MAAM,QAAQ,OAAO,OAAO;GAE5B,MAAM,SAAS,OAAO,OAAO,OAC3B,QACG,KAAK,MAAM,CAAC,CACZ,KACC,OAAO,eAAe,yBAAyB,MAAM,GACrD,OAAO,eAAe,MAAM,OAAO,KAAK,CAC1C,CACJ;GAEA,OAAO,EACL,KAAK,OAAO,cACV,MAAM,MAAM,SAAS,WACjB,OAAO,KACL,IAAI,sBAAsB;IACxB,QAAQ;IACR,UAAU;IACV,WAAW;IACX,aAAa;IACb,SAAS;GACX,CAAC,CACH,IACA,MACN,EACF;EACF,CAAC,CACH;CACF;AACF"}
|
|
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 /** 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 a unique enabled option value, then a unique exact trimmed label. Empty text clears.\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\nexport class CredentialAccessError extends Schema.TaggedError<CredentialAccessError>()(\n \"CredentialAccessError\",\n {\n reason: Schema.Literals([\"denied\", \"missing-credential\", \"needs-attention\", \"resolver\"]),\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,CA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,QAW5C,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC;;AAG/C,IAAa,0BAAb,cAA6C,QAAQ,QAKnD,CAAC,CAAC,+CAA+C,CAAC,CAAC;CACnD,OAAO,MAAM,QAAkC;EAC7C,OAAO,MAAM,OAAO,IAAI,CAAC,CACvB,OAAO,IAAI,aAAa;GACtB,MAAM,UAAU,OAAO;GACvB,MAAM,SAAS,OAAO;GACtB,MAAM,QAAQ,OAAO,OAAO;GAE5B,MAAM,SAAS,OAAO,OAAO,OAC3B,QACG,KAAK,MAAM,CAAC,CACZ,KACC,OAAO,eAAe,yBAAyB,MAAM,GACrD,OAAO,eAAe,MAAM,OAAO,KAAK,CAC1C,CACJ;GAEA,OAAO,EACL,KAAK,OAAO,cACV,MAAM,MAAM,SAAS,WACjB,OAAO,KACL,IAAI,sBAAsB;IACxB,QAAQ;IACR,UAAU;IACV,WAAW;IACX,aAAa;IACb,SAAS;GACX,CAAC,CACH,IACA,MACN,EACF;EACF,CAAC,CACH;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"effect-agent","version":"0.1.0-beta.90","devDependencies":{"@effect/platform-node":"4.0.0-rc.112","@effect/vitest":"4.0.0-rc.112","effect":"4.0.0-rc.112","typescript":"7.0.2","vite-plus":"0.3.0"},"peerDependencies":{"effect":"^4.0.0-rc.112"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./activity-store":{"types":"./dist/durable/ActivityStore.d.mts","default":"./dist/durable/ActivityStore.mjs"},"./admin":{"types":"./dist/durable/Admin.d.mts","default":"./dist/durable/Admin.mjs"},"./agent":{"types":"./dist/core/Agent.d.mts","default":"./dist/core/Agent.mjs"},"./agent-error":{"types":"./dist/core/AgentError.d.mts","default":"./dist/core/AgentError.mjs"},"./agent-policy":{"types":"./dist/core/AgentPolicy.d.mts","default":"./dist/core/AgentPolicy.mjs"},"./agent-registration":{"types":"./dist/durable/AgentRegistration.d.mts","default":"./dist/durable/AgentRegistration.mjs"},"./agent-runtime":{"types":"./dist/engine/AgentRuntime.d.mts","default":"./dist/engine/AgentRuntime.mjs"},"./agent-updates":{"types":"./dist/core/AgentUpdates.d.mts","default":"./dist/core/AgentUpdates.mjs"},"./approval":{"types":"./dist/capabilities/Approval.d.mts","default":"./dist/capabilities/Approval.mjs"},"./budget":{"types":"./dist/capabilities/Budget.d.mts","default":"./dist/capabilities/Budget.mjs"},"./code-executor":{"types":"./dist/sandbox/CodeExecutor.d.mts","default":"./dist/sandbox/CodeExecutor.mjs"},"./code-mode":{"types":"./dist/capabilities/CodeMode.d.mts","default":"./dist/capabilities/CodeMode.mjs"},"./commands":{"types":"./dist/capabilities/Commands.d.mts","default":"./dist/capabilities/Commands.mjs"},"./committed-activity":{"types":"./dist/durable/CommittedActivity.d.mts","default":"./dist/durable/CommittedActivity.mjs"},"./compaction":{"types":"./dist/engine/Compaction.d.mts","default":"./dist/engine/Compaction.mjs"},"./context-compactor":{"types":"./dist/engine/ContextCompactor.d.mts","default":"./dist/engine/ContextCompactor.mjs"},"./context-history":{"types":"./dist/engine/ContextHistory.d.mts","default":"./dist/engine/ContextHistory.mjs"},"./context-tools":{"types":"./dist/capabilities/ContextTools.d.mts","default":"./dist/capabilities/ContextTools.mjs"},"./context-window":{"types":"./dist/engine/ContextWindow.d.mts","default":"./dist/engine/ContextWindow.mjs"},"./digest":{"types":"./dist/durable/Digest.d.mts","default":"./dist/durable/Digest.mjs"},"./durable-agent-runtime":{"types":"./dist/durable/DurableAgentRuntime.d.mts","default":"./dist/durable/DurableAgentRuntime.mjs"},"./durable-failpoint":{"types":"./dist/durable/DurableFailpoint.d.mts","default":"./dist/durable/DurableFailpoint.mjs"},"./durable-step":{"types":"./dist/engine/DurableStep.d.mts","default":"./dist/engine/DurableStep.mjs"},"./ephemeral":{"types":"./dist/Ephemeral.d.mts","default":"./dist/Ephemeral.mjs"},"./event-source":{"types":"./dist/durable/EventSource.d.mts","default":"./dist/durable/EventSource.mjs"},"./git-hub-workflow-source":{"types":"./dist/durable/GitHubWorkflowSource.d.mts","default":"./dist/durable/GitHubWorkflowSource.mjs"},"./id-generator":{"types":"./dist/core/IdGenerator.d.mts","default":"./dist/core/IdGenerator.mjs"},"./identifiers":{"types":"./dist/core/Identifiers.d.mts","default":"./dist/core/Identifiers.mjs"},"./interactive-browser":{"types":"./dist/sandbox/InteractiveBrowser.d.mts","default":"./dist/sandbox/InteractiveBrowser.mjs"},"./mcp":{"types":"./dist/capabilities/Mcp.d.mts","default":"./dist/capabilities/Mcp.mjs"},"./mcp-client":{"types":"./dist/capabilities/McpClient.d.mts","default":"./dist/capabilities/McpClient.mjs"},"./memory":{"types":"./dist/core/Memory.d.mts","default":"./dist/core/Memory.mjs"},"./memory-namespace":{"types":"./dist/core/MemoryNamespace.d.mts","default":"./dist/core/MemoryNamespace.mjs"},"./memory-notes":{"types":"./dist/capabilities/MemoryNotes.d.mts","default":"./dist/capabilities/MemoryNotes.mjs"},"./memory-reference":{"types":"./dist/core/MemoryReference.d.mts","default":"./dist/core/MemoryReference.mjs"},"./memory-revalidation":{"types":"./dist/core/MemoryRevalidation.d.mts","default":"./dist/core/MemoryRevalidation.mjs"},"./memory-store":{"types":"./dist/core/MemoryStore.d.mts","default":"./dist/core/MemoryStore.mjs"},"./message-delivery":{"types":"./dist/durable/MessageDelivery.d.mts","default":"./dist/durable/MessageDelivery.mjs"},"./messaging":{"types":"./dist/capabilities/Messaging.d.mts","default":"./dist/capabilities/Messaging.mjs"},"./messaging-host":{"types":"./dist/engine/MessagingHost.d.mts","default":"./dist/engine/MessagingHost.mjs"},"./model-context":{"types":"./dist/capabilities/ModelContext.d.mts","default":"./dist/capabilities/ModelContext.mjs"},"./operation-authorizer":{"types":"./dist/durable/OperationAuthorizer.d.mts","default":"./dist/durable/OperationAuthorizer.mjs"},"./output":{"types":"./dist/engine/Output.d.mts","default":"./dist/engine/Output.mjs"},"./page-capture":{"types":"./dist/sandbox/PageCapture.d.mts","default":"./dist/sandbox/PageCapture.mjs"},"./page-crawl":{"types":"./dist/sandbox/PageCrawl.d.mts","default":"./dist/sandbox/PageCrawl.mjs"},"./page-screenshot":{"types":"./dist/sandbox/PageScreenshot.d.mts","default":"./dist/sandbox/PageScreenshot.mjs"},"./persistent-history":{"types":"./dist/durable/PersistentHistory.d.mts","default":"./dist/durable/PersistentHistory.mjs"},"./prepared-input-admission":{"types":"./dist/durable/PreparedInputAdmission.d.mts","default":"./dist/durable/PreparedInputAdmission.mjs"},"./protected-browser":{"types":"./dist/sandbox/ProtectedBrowser.d.mts","default":"./dist/sandbox/ProtectedBrowser.mjs"},"./receipt":{"types":"./dist/core/Receipt.d.mts","default":"./dist/core/Receipt.mjs"},"./records":{"types":"./dist/durable/Records.d.mts","default":"./dist/durable/Records.mjs"},"./recovery":{"types":"./dist/durable/Recovery.d.mts","default":"./dist/durable/Recovery.mjs"},"./redaction":{"types":"./dist/capabilities/Redaction.d.mts","default":"./dist/capabilities/Redaction.mjs"},"./remembering":{"types":"./dist/capabilities/Remembering.d.mts","default":"./dist/capabilities/Remembering.mjs"},"./remembering-store":{"types":"./dist/core/RememberingStore.d.mts","default":"./dist/core/RememberingStore.mjs"},"./run-event":{"types":"./dist/core/RunEvent.d.mts","default":"./dist/core/RunEvent.mjs"},"./run-event-sink":{"types":"./dist/engine/RunEventSink.d.mts","default":"./dist/engine/RunEventSink.mjs"},"./run-hooks":{"types":"./dist/capabilities/RunHooks.d.mts","default":"./dist/capabilities/RunHooks.mjs"},"./run-journal":{"types":"./dist/durable/RunJournal.d.mts","default":"./dist/durable/RunJournal.mjs"},"./run-options":{"types":"./dist/engine/RunOptions.d.mts","default":"./dist/engine/RunOptions.mjs"},"./run-policy-usage":{"types":"./dist/core/RunPolicyUsage.d.mts","default":"./dist/core/RunPolicyUsage.mjs"},"./sandbox":{"types":"./dist/sandbox/Sandbox.d.mts","default":"./dist/sandbox/Sandbox.mjs"},"./schedule":{"types":"./dist/durable/Schedule.d.mts","default":"./dist/durable/Schedule.mjs"},"./schedule-transition":{"types":"./dist/durable/ScheduleTransition.d.mts","default":"./dist/durable/ScheduleTransition.mjs"},"./scheduling":{"types":"./dist/durable/Scheduling.d.mts","default":"./dist/durable/Scheduling.mjs"},"./semantic-memory":{"types":"./dist/capabilities/SemanticMemory.d.mts","default":"./dist/capabilities/SemanticMemory.mjs"},"./semantic-memory-index":{"types":"./dist/core/SemanticMemoryIndex.d.mts","default":"./dist/core/SemanticMemoryIndex.mjs"},"./semantic-memory-revalidation":{"types":"./dist/core/SemanticMemoryRevalidation.d.mts","default":"./dist/core/SemanticMemoryRevalidation.mjs"},"./sql-memory-store":{"types":"./dist/durable/SqlMemoryStore.d.mts","default":"./dist/durable/SqlMemoryStore.mjs"},"./sql-message-delivery-store":{"types":"./dist/durable/SqlMessageDeliveryStore.d.mts","default":"./dist/durable/SqlMessageDeliveryStore.mjs"},"./sql-storage-v2-upgrade":{"types":"./dist/durable/SqlStorageV2Upgrade.d.mts","default":"./dist/durable/SqlStorageV2Upgrade.mjs"},"./sql-subscription-store":{"types":"./dist/durable/SqlSubscriptionStore.d.mts","default":"./dist/durable/SqlSubscriptionStore.mjs"},"./subagent":{"types":"./dist/capabilities/Subagent.d.mts","default":"./dist/capabilities/Subagent.mjs"},"./subagent-contract":{"types":"./dist/core/SubagentContract.d.mts","default":"./dist/core/SubagentContract.mjs"},"./subagent-host":{"types":"./dist/engine/SubagentHost.d.mts","default":"./dist/engine/SubagentHost.mjs"},"./subagent-reservations":{"types":"./dist/capabilities/SubagentReservations.d.mts","default":"./dist/capabilities/SubagentReservations.mjs"},"./submission-ledger":{"types":"./dist/durable/SubmissionLedger.d.mts","default":"./dist/durable/SubmissionLedger.mjs"},"./submission-status":{"types":"./dist/durable/SubmissionStatus.d.mts","default":"./dist/durable/SubmissionStatus.mjs"},"./subscription":{"types":"./dist/durable/Subscription.d.mts","default":"./dist/durable/Subscription.mjs"},"./subscription-input":{"types":"./dist/durable/SubscriptionInput.d.mts","default":"./dist/durable/SubscriptionInput.mjs"},"./subscription-tools":{"types":"./dist/durable/SubscriptionTools.d.mts","default":"./dist/durable/SubscriptionTools.mjs"},"./subscription-transition":{"types":"./dist/durable/SubscriptionTransition.d.mts","default":"./dist/durable/SubscriptionTransition.mjs"},"./subscriptions":{"types":"./dist/durable/Subscriptions.d.mts","default":"./dist/durable/Subscriptions.mjs"},"./testing/certification":{"types":"./dist/durable/Certification.d.mts","default":"./dist/durable/Certification.mjs"},"./testing/durable-failpoint-test-control":{"types":"./dist/durable/DurableFailpointTestControl.d.mts","default":"./dist/durable/DurableFailpointTestControl.mjs"},"./testing/message-delivery-store-conformance":{"types":"./dist/durable/MessageDeliveryStoreConformance.d.mts","default":"./dist/durable/MessageDeliveryStoreConformance.mjs"},"./testing/schedule-store-conformance":{"types":"./dist/durable/ScheduleStoreConformance.d.mts","default":"./dist/durable/ScheduleStoreConformance.mjs"},"./testing/submission-ledger-conformance":{"types":"./dist/durable/SubmissionLedgerConformance.d.mts","default":"./dist/durable/SubmissionLedgerConformance.mjs"},"./testing/subscription-store-conformance":{"types":"./dist/durable/SubscriptionStoreConformance.d.mts","default":"./dist/durable/SubscriptionStoreConformance.mjs"},"./testing/thread-store-conformance":{"types":"./dist/durable/ThreadStoreConformance.d.mts","default":"./dist/durable/ThreadStoreConformance.mjs"},"./thread":{"types":"./dist/core/Thread.d.mts","default":"./dist/core/Thread.mjs"},"./thread-context-history":{"types":"./dist/durable/ThreadContextHistory.d.mts","default":"./dist/durable/ThreadContextHistory.mjs"},"./thread-context-history-projection":{"types":"./dist/durable/ThreadContextHistoryProjection.d.mts","default":"./dist/durable/ThreadContextHistoryProjection.mjs"},"./thread-history":{"types":"./dist/engine/ThreadHistory.d.mts","default":"./dist/engine/ThreadHistory.mjs"},"./thread-invariants":{"types":"./dist/durable/ThreadInvariants.d.mts","default":"./dist/durable/ThreadInvariants.mjs"},"./thread-projection":{"types":"./dist/durable/ThreadProjection.d.mts","default":"./dist/durable/ThreadProjection.mjs"},"./thread-projection-maintenance":{"types":"./dist/durable/ThreadProjectionMaintenance.d.mts","default":"./dist/durable/ThreadProjectionMaintenance.mjs"},"./thread-store":{"types":"./dist/durable/ThreadStore.d.mts","default":"./dist/durable/ThreadStore.mjs"},"./tool-broker":{"types":"./dist/engine/ToolBroker.d.mts","default":"./dist/engine/ToolBroker.mjs"},"./tool-discovery":{"types":"./dist/capabilities/ToolDiscovery.d.mts","default":"./dist/capabilities/ToolDiscovery.mjs"},"./tool-exposure":{"types":"./dist/ToolExposure.d.mts","default":"./dist/ToolExposure.mjs"},"./tool-reconciler":{"types":"./dist/durable/ToolReconciler.d.mts","default":"./dist/durable/ToolReconciler.mjs"},"./tool-result":{"types":"./dist/core/ToolResult.d.mts","default":"./dist/core/ToolResult.mjs"},"./usage":{"types":"./dist/core/Usage.d.mts","default":"./dist/core/Usage.mjs"},"./wake-scheduler":{"types":"./dist/durable/WakeScheduler.d.mts","default":"./dist/durable/WakeScheduler.mjs"},"./web-capture":{"types":"./dist/capabilities/WebCapture.d.mts","default":"./dist/capabilities/WebCapture.mjs"},"./web-search":{"types":"./dist/capabilities/WebSearch.d.mts","default":"./dist/capabilities/WebSearch.mjs"},"./worker":{"types":"./dist/core/Worker.d.mts","default":"./dist/core/Worker.mjs"},"./worker-host":{"types":"./dist/durable/WorkerHost.d.mts","default":"./dist/durable/WorkerHost.mjs"}},"description":"Effect-native agents, execution, subagents, and sandbox contracts in one tree-shakeable package.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/effect-agent"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests"}}
|
|
1
|
+
{"name":"effect-agent","version":"0.1.0-beta.92","devDependencies":{"@effect/platform-node":"4.0.0-rc.115","@effect/vitest":"4.0.0-rc.115","effect":"4.0.0-rc.115","typescript":"7.0.2","vite-plus":"0.3.0"},"peerDependencies":{"effect":"^4.0.0-rc.115"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./activity-store":{"types":"./dist/durable/ActivityStore.d.mts","default":"./dist/durable/ActivityStore.mjs"},"./admin":{"types":"./dist/durable/Admin.d.mts","default":"./dist/durable/Admin.mjs"},"./agent":{"types":"./dist/core/Agent.d.mts","default":"./dist/core/Agent.mjs"},"./agent-error":{"types":"./dist/core/AgentError.d.mts","default":"./dist/core/AgentError.mjs"},"./agent-policy":{"types":"./dist/core/AgentPolicy.d.mts","default":"./dist/core/AgentPolicy.mjs"},"./agent-registration":{"types":"./dist/durable/AgentRegistration.d.mts","default":"./dist/durable/AgentRegistration.mjs"},"./agent-runtime":{"types":"./dist/engine/AgentRuntime.d.mts","default":"./dist/engine/AgentRuntime.mjs"},"./agent-updates":{"types":"./dist/core/AgentUpdates.d.mts","default":"./dist/core/AgentUpdates.mjs"},"./approval":{"types":"./dist/capabilities/Approval.d.mts","default":"./dist/capabilities/Approval.mjs"},"./budget":{"types":"./dist/capabilities/Budget.d.mts","default":"./dist/capabilities/Budget.mjs"},"./code-executor":{"types":"./dist/sandbox/CodeExecutor.d.mts","default":"./dist/sandbox/CodeExecutor.mjs"},"./code-mode":{"types":"./dist/capabilities/CodeMode.d.mts","default":"./dist/capabilities/CodeMode.mjs"},"./commands":{"types":"./dist/capabilities/Commands.d.mts","default":"./dist/capabilities/Commands.mjs"},"./committed-activity":{"types":"./dist/durable/CommittedActivity.d.mts","default":"./dist/durable/CommittedActivity.mjs"},"./compaction":{"types":"./dist/engine/Compaction.d.mts","default":"./dist/engine/Compaction.mjs"},"./context-compactor":{"types":"./dist/engine/ContextCompactor.d.mts","default":"./dist/engine/ContextCompactor.mjs"},"./context-history":{"types":"./dist/engine/ContextHistory.d.mts","default":"./dist/engine/ContextHistory.mjs"},"./context-tools":{"types":"./dist/capabilities/ContextTools.d.mts","default":"./dist/capabilities/ContextTools.mjs"},"./context-window":{"types":"./dist/engine/ContextWindow.d.mts","default":"./dist/engine/ContextWindow.mjs"},"./digest":{"types":"./dist/durable/Digest.d.mts","default":"./dist/durable/Digest.mjs"},"./durable-agent-runtime":{"types":"./dist/durable/DurableAgentRuntime.d.mts","default":"./dist/durable/DurableAgentRuntime.mjs"},"./durable-failpoint":{"types":"./dist/durable/DurableFailpoint.d.mts","default":"./dist/durable/DurableFailpoint.mjs"},"./durable-step":{"types":"./dist/engine/DurableStep.d.mts","default":"./dist/engine/DurableStep.mjs"},"./ephemeral":{"types":"./dist/Ephemeral.d.mts","default":"./dist/Ephemeral.mjs"},"./event-source":{"types":"./dist/durable/EventSource.d.mts","default":"./dist/durable/EventSource.mjs"},"./git-hub-workflow-source":{"types":"./dist/durable/GitHubWorkflowSource.d.mts","default":"./dist/durable/GitHubWorkflowSource.mjs"},"./id-generator":{"types":"./dist/core/IdGenerator.d.mts","default":"./dist/core/IdGenerator.mjs"},"./identifiers":{"types":"./dist/core/Identifiers.d.mts","default":"./dist/core/Identifiers.mjs"},"./interactive-browser":{"types":"./dist/sandbox/InteractiveBrowser.d.mts","default":"./dist/sandbox/InteractiveBrowser.mjs"},"./mcp":{"types":"./dist/capabilities/Mcp.d.mts","default":"./dist/capabilities/Mcp.mjs"},"./mcp-client":{"types":"./dist/capabilities/McpClient.d.mts","default":"./dist/capabilities/McpClient.mjs"},"./memory":{"types":"./dist/core/Memory.d.mts","default":"./dist/core/Memory.mjs"},"./memory-namespace":{"types":"./dist/core/MemoryNamespace.d.mts","default":"./dist/core/MemoryNamespace.mjs"},"./memory-notes":{"types":"./dist/capabilities/MemoryNotes.d.mts","default":"./dist/capabilities/MemoryNotes.mjs"},"./memory-reference":{"types":"./dist/core/MemoryReference.d.mts","default":"./dist/core/MemoryReference.mjs"},"./memory-revalidation":{"types":"./dist/core/MemoryRevalidation.d.mts","default":"./dist/core/MemoryRevalidation.mjs"},"./memory-store":{"types":"./dist/core/MemoryStore.d.mts","default":"./dist/core/MemoryStore.mjs"},"./message-delivery":{"types":"./dist/durable/MessageDelivery.d.mts","default":"./dist/durable/MessageDelivery.mjs"},"./messaging":{"types":"./dist/capabilities/Messaging.d.mts","default":"./dist/capabilities/Messaging.mjs"},"./messaging-host":{"types":"./dist/engine/MessagingHost.d.mts","default":"./dist/engine/MessagingHost.mjs"},"./model-context":{"types":"./dist/capabilities/ModelContext.d.mts","default":"./dist/capabilities/ModelContext.mjs"},"./operation-authorizer":{"types":"./dist/durable/OperationAuthorizer.d.mts","default":"./dist/durable/OperationAuthorizer.mjs"},"./output":{"types":"./dist/engine/Output.d.mts","default":"./dist/engine/Output.mjs"},"./page-capture":{"types":"./dist/sandbox/PageCapture.d.mts","default":"./dist/sandbox/PageCapture.mjs"},"./page-crawl":{"types":"./dist/sandbox/PageCrawl.d.mts","default":"./dist/sandbox/PageCrawl.mjs"},"./page-screenshot":{"types":"./dist/sandbox/PageScreenshot.d.mts","default":"./dist/sandbox/PageScreenshot.mjs"},"./persistent-history":{"types":"./dist/durable/PersistentHistory.d.mts","default":"./dist/durable/PersistentHistory.mjs"},"./prepared-input-admission":{"types":"./dist/durable/PreparedInputAdmission.d.mts","default":"./dist/durable/PreparedInputAdmission.mjs"},"./protected-browser":{"types":"./dist/sandbox/ProtectedBrowser.d.mts","default":"./dist/sandbox/ProtectedBrowser.mjs"},"./receipt":{"types":"./dist/core/Receipt.d.mts","default":"./dist/core/Receipt.mjs"},"./records":{"types":"./dist/durable/Records.d.mts","default":"./dist/durable/Records.mjs"},"./recovery":{"types":"./dist/durable/Recovery.d.mts","default":"./dist/durable/Recovery.mjs"},"./redaction":{"types":"./dist/capabilities/Redaction.d.mts","default":"./dist/capabilities/Redaction.mjs"},"./remembering":{"types":"./dist/capabilities/Remembering.d.mts","default":"./dist/capabilities/Remembering.mjs"},"./remembering-store":{"types":"./dist/core/RememberingStore.d.mts","default":"./dist/core/RememberingStore.mjs"},"./run-event":{"types":"./dist/core/RunEvent.d.mts","default":"./dist/core/RunEvent.mjs"},"./run-event-sink":{"types":"./dist/engine/RunEventSink.d.mts","default":"./dist/engine/RunEventSink.mjs"},"./run-hooks":{"types":"./dist/capabilities/RunHooks.d.mts","default":"./dist/capabilities/RunHooks.mjs"},"./run-journal":{"types":"./dist/durable/RunJournal.d.mts","default":"./dist/durable/RunJournal.mjs"},"./run-options":{"types":"./dist/engine/RunOptions.d.mts","default":"./dist/engine/RunOptions.mjs"},"./run-policy-usage":{"types":"./dist/core/RunPolicyUsage.d.mts","default":"./dist/core/RunPolicyUsage.mjs"},"./sandbox":{"types":"./dist/sandbox/Sandbox.d.mts","default":"./dist/sandbox/Sandbox.mjs"},"./schedule":{"types":"./dist/durable/Schedule.d.mts","default":"./dist/durable/Schedule.mjs"},"./schedule-transition":{"types":"./dist/durable/ScheduleTransition.d.mts","default":"./dist/durable/ScheduleTransition.mjs"},"./scheduling":{"types":"./dist/durable/Scheduling.d.mts","default":"./dist/durable/Scheduling.mjs"},"./semantic-memory":{"types":"./dist/capabilities/SemanticMemory.d.mts","default":"./dist/capabilities/SemanticMemory.mjs"},"./semantic-memory-index":{"types":"./dist/core/SemanticMemoryIndex.d.mts","default":"./dist/core/SemanticMemoryIndex.mjs"},"./semantic-memory-revalidation":{"types":"./dist/core/SemanticMemoryRevalidation.d.mts","default":"./dist/core/SemanticMemoryRevalidation.mjs"},"./sql-memory-store":{"types":"./dist/durable/SqlMemoryStore.d.mts","default":"./dist/durable/SqlMemoryStore.mjs"},"./sql-message-delivery-store":{"types":"./dist/durable/SqlMessageDeliveryStore.d.mts","default":"./dist/durable/SqlMessageDeliveryStore.mjs"},"./sql-storage-v2-upgrade":{"types":"./dist/durable/SqlStorageV2Upgrade.d.mts","default":"./dist/durable/SqlStorageV2Upgrade.mjs"},"./sql-subscription-store":{"types":"./dist/durable/SqlSubscriptionStore.d.mts","default":"./dist/durable/SqlSubscriptionStore.mjs"},"./subagent":{"types":"./dist/capabilities/Subagent.d.mts","default":"./dist/capabilities/Subagent.mjs"},"./subagent-contract":{"types":"./dist/core/SubagentContract.d.mts","default":"./dist/core/SubagentContract.mjs"},"./subagent-host":{"types":"./dist/engine/SubagentHost.d.mts","default":"./dist/engine/SubagentHost.mjs"},"./subagent-reservations":{"types":"./dist/capabilities/SubagentReservations.d.mts","default":"./dist/capabilities/SubagentReservations.mjs"},"./submission-ledger":{"types":"./dist/durable/SubmissionLedger.d.mts","default":"./dist/durable/SubmissionLedger.mjs"},"./submission-status":{"types":"./dist/durable/SubmissionStatus.d.mts","default":"./dist/durable/SubmissionStatus.mjs"},"./subscription":{"types":"./dist/durable/Subscription.d.mts","default":"./dist/durable/Subscription.mjs"},"./subscription-input":{"types":"./dist/durable/SubscriptionInput.d.mts","default":"./dist/durable/SubscriptionInput.mjs"},"./subscription-tools":{"types":"./dist/durable/SubscriptionTools.d.mts","default":"./dist/durable/SubscriptionTools.mjs"},"./subscription-transition":{"types":"./dist/durable/SubscriptionTransition.d.mts","default":"./dist/durable/SubscriptionTransition.mjs"},"./subscriptions":{"types":"./dist/durable/Subscriptions.d.mts","default":"./dist/durable/Subscriptions.mjs"},"./testing/certification":{"types":"./dist/durable/Certification.d.mts","default":"./dist/durable/Certification.mjs"},"./testing/durable-failpoint-test-control":{"types":"./dist/durable/DurableFailpointTestControl.d.mts","default":"./dist/durable/DurableFailpointTestControl.mjs"},"./testing/message-delivery-store-conformance":{"types":"./dist/durable/MessageDeliveryStoreConformance.d.mts","default":"./dist/durable/MessageDeliveryStoreConformance.mjs"},"./testing/schedule-store-conformance":{"types":"./dist/durable/ScheduleStoreConformance.d.mts","default":"./dist/durable/ScheduleStoreConformance.mjs"},"./testing/submission-ledger-conformance":{"types":"./dist/durable/SubmissionLedgerConformance.d.mts","default":"./dist/durable/SubmissionLedgerConformance.mjs"},"./testing/subscription-store-conformance":{"types":"./dist/durable/SubscriptionStoreConformance.d.mts","default":"./dist/durable/SubscriptionStoreConformance.mjs"},"./testing/thread-store-conformance":{"types":"./dist/durable/ThreadStoreConformance.d.mts","default":"./dist/durable/ThreadStoreConformance.mjs"},"./thread":{"types":"./dist/core/Thread.d.mts","default":"./dist/core/Thread.mjs"},"./thread-context-history":{"types":"./dist/durable/ThreadContextHistory.d.mts","default":"./dist/durable/ThreadContextHistory.mjs"},"./thread-context-history-projection":{"types":"./dist/durable/ThreadContextHistoryProjection.d.mts","default":"./dist/durable/ThreadContextHistoryProjection.mjs"},"./thread-history":{"types":"./dist/engine/ThreadHistory.d.mts","default":"./dist/engine/ThreadHistory.mjs"},"./thread-invariants":{"types":"./dist/durable/ThreadInvariants.d.mts","default":"./dist/durable/ThreadInvariants.mjs"},"./thread-projection":{"types":"./dist/durable/ThreadProjection.d.mts","default":"./dist/durable/ThreadProjection.mjs"},"./thread-projection-maintenance":{"types":"./dist/durable/ThreadProjectionMaintenance.d.mts","default":"./dist/durable/ThreadProjectionMaintenance.mjs"},"./thread-store":{"types":"./dist/durable/ThreadStore.d.mts","default":"./dist/durable/ThreadStore.mjs"},"./tool-broker":{"types":"./dist/engine/ToolBroker.d.mts","default":"./dist/engine/ToolBroker.mjs"},"./tool-discovery":{"types":"./dist/capabilities/ToolDiscovery.d.mts","default":"./dist/capabilities/ToolDiscovery.mjs"},"./tool-exposure":{"types":"./dist/ToolExposure.d.mts","default":"./dist/ToolExposure.mjs"},"./tool-reconciler":{"types":"./dist/durable/ToolReconciler.d.mts","default":"./dist/durable/ToolReconciler.mjs"},"./tool-result":{"types":"./dist/core/ToolResult.d.mts","default":"./dist/core/ToolResult.mjs"},"./usage":{"types":"./dist/core/Usage.d.mts","default":"./dist/core/Usage.mjs"},"./wake-scheduler":{"types":"./dist/durable/WakeScheduler.d.mts","default":"./dist/durable/WakeScheduler.mjs"},"./web-capture":{"types":"./dist/capabilities/WebCapture.d.mts","default":"./dist/capabilities/WebCapture.mjs"},"./web-search":{"types":"./dist/capabilities/WebSearch.d.mts","default":"./dist/capabilities/WebSearch.mjs"},"./worker":{"types":"./dist/core/Worker.d.mts","default":"./dist/core/Worker.mjs"},"./worker-host":{"types":"./dist/durable/WorkerHost.d.mts","default":"./dist/durable/WorkerHost.mjs"}},"description":"Effect-native agents, execution, subagents, and sandbox contracts in one tree-shakeable package.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/effect-agent"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests"}}
|
|
@@ -71,9 +71,9 @@ export const tool = Tool.make("WebSearch", {
|
|
|
71
71
|
|
|
72
72
|
export const toolkit = Toolkit.make(tool);
|
|
73
73
|
|
|
74
|
-
export interface Options {
|
|
74
|
+
export interface Options<T extends Tool.AnyProviderDefined = Tool.AnyProviderDefined> {
|
|
75
75
|
/** Native upstream hosted search tool, for example OpenAiTool.WebSearch or AnthropicTool.WebSearch_20250305. */
|
|
76
|
-
readonly tool:
|
|
76
|
+
readonly tool: T;
|
|
77
77
|
/** One model request, with no automatic retries; defaults to 30 seconds. */
|
|
78
78
|
readonly timeoutMillis?: number;
|
|
79
79
|
/** Maximum encoded result size, including citations and usage; defaults to 32 KiB. */
|
|
@@ -97,7 +97,7 @@ const decodeSearchStatus = Schema.decodeUnknownOption(Schema.Struct({ status: Sc
|
|
|
97
97
|
* Defects and interruption propagate; expected failures become failed tool results. Search
|
|
98
98
|
* model usage is returned for host accounting, not silently charged to the parent Run budget.
|
|
99
99
|
*/
|
|
100
|
-
export const layer = (options: Options) => {
|
|
100
|
+
export const layer = <T extends Tool.AnyProviderDefined>(options: Options<T>) => {
|
|
101
101
|
if (
|
|
102
102
|
!Tool.isProviderDefined(options.tool) ||
|
|
103
103
|
!["web_search", "web_search_preview"].includes(options.tool.providerName)
|
|
@@ -119,26 +119,32 @@ export const layer = (options: Options) => {
|
|
|
119
119
|
Effect.gen(function* () {
|
|
120
120
|
const model = yield* LanguageModel.LanguageModel;
|
|
121
121
|
|
|
122
|
+
const generate = (query: string) =>
|
|
123
|
+
model.generateText({
|
|
124
|
+
prompt: query,
|
|
125
|
+
toolkit: searchToolkit,
|
|
126
|
+
toolChoice: "required",
|
|
127
|
+
disableToolCallResolution: true,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const encodingContext = yield* Effect.context<Effect.Services<ReturnType<typeof generate>>>();
|
|
131
|
+
|
|
132
|
+
const generateWithContext = (query: string) =>
|
|
133
|
+
Effect.provide(generate(query), encodingContext);
|
|
134
|
+
|
|
122
135
|
return {
|
|
123
136
|
WebSearch: Effect.fn("WebSearch.search")(function* (input) {
|
|
124
137
|
const { query } = yield* Schema.decodeEffect(Parameters)(input).pipe(
|
|
125
138
|
Effect.mapError(() => new Failure({ reason: "invalid-query" })),
|
|
126
139
|
);
|
|
127
140
|
|
|
128
|
-
const response = yield*
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.pipe(
|
|
136
|
-
Effect.mapError(() => new Failure({ reason: "provider" })),
|
|
137
|
-
Effect.timeoutOrElse({
|
|
138
|
-
duration: timeoutMillis,
|
|
139
|
-
orElse: () => Effect.fail(new Failure({ reason: "timeout" })),
|
|
140
|
-
}),
|
|
141
|
-
);
|
|
141
|
+
const response = yield* generateWithContext(query).pipe(
|
|
142
|
+
Effect.mapError(() => new Failure({ reason: "provider" })),
|
|
143
|
+
Effect.timeoutOrElse({
|
|
144
|
+
duration: timeoutMillis,
|
|
145
|
+
orElse: () => Effect.fail(new Failure({ reason: "timeout" })),
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
142
148
|
|
|
143
149
|
if (
|
|
144
150
|
response.toolResults.some((result) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema, SchemaParser, SchemaTransformation } from "effect";
|
|
2
|
+
|
|
3
|
+
/** Keep strict parsing on nested values even when an outer parser uses its defaults. */
|
|
4
|
+
export const strictSchema = <S extends Schema.Top>(schema: S) =>
|
|
5
|
+
Schema.declareConstructor<S["Type"], S["Encoded"]>()(
|
|
6
|
+
[schema],
|
|
7
|
+
([codec]) =>
|
|
8
|
+
(value, _ast, options) =>
|
|
9
|
+
SchemaParser.decodeUnknownEffect(codec)(value, { ...options, onExcessProperty: "error" }),
|
|
10
|
+
{
|
|
11
|
+
toCodecJson: ([codec]) =>
|
|
12
|
+
Schema.link<S["Encoded"]>()(codec, SchemaTransformation.passthrough()),
|
|
13
|
+
},
|
|
14
|
+
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Context, Effect, Encoding,
|
|
1
|
+
import { Context, Effect, Encoding, ByteSize, Layer, Redacted, Schema } from "effect";
|
|
2
2
|
import { HttpClient, HttpIncomingMessage, HttpClientRequest } from "effect/unstable/http";
|
|
3
3
|
|
|
4
|
+
import { strictSchema } from "../core/internal/strict-schema.ts";
|
|
4
5
|
import { makeEventSource, type EventSource } from "./EventSource.ts";
|
|
5
6
|
import type { Principal } from "./SubmissionLedger.ts";
|
|
6
7
|
import type { EventAcknowledgement } from "./Subscription.ts";
|
|
@@ -18,28 +19,21 @@ const GitCommitSha = Schema.String.check(Schema.isPattern(/^(?:[0-9a-f]{40}|[0-9
|
|
|
18
19
|
const GitHubConclusion = Schema.NonEmptyString.check(Schema.isMaxLength(64));
|
|
19
20
|
const GitHubStatus = Schema.NonEmptyString.check(Schema.isMaxLength(32));
|
|
20
21
|
|
|
21
|
-
const strict = <S extends Schema.Top>(schema: S) =>
|
|
22
|
-
schema.pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } }));
|
|
23
|
-
|
|
24
22
|
/** One repository whose identity and credentials are selected by the host. */
|
|
25
|
-
export const GitHubRepository =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
23
|
+
export const GitHubRepository = Schema.Struct({
|
|
24
|
+
id: PositiveId,
|
|
25
|
+
owner: GitHubName,
|
|
26
|
+
name: GitHubName,
|
|
27
|
+
}).pipe(strictSchema);
|
|
32
28
|
|
|
33
29
|
export type GitHubRepository = typeof GitHubRepository.Type;
|
|
34
30
|
|
|
35
31
|
/** Exact workflow attempt requested by an Agent through a host-permitted source. */
|
|
36
|
-
export const GitHubWorkflowRunWatch =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
);
|
|
32
|
+
export const GitHubWorkflowRunWatch = Schema.Struct({
|
|
33
|
+
runId: PositiveId,
|
|
34
|
+
attempt: PositiveId,
|
|
35
|
+
expectedHeadSha: GitCommitSha,
|
|
36
|
+
}).pipe(strictSchema);
|
|
43
37
|
|
|
44
38
|
export type GitHubWorkflowRunWatch = typeof GitHubWorkflowRunWatch.Type;
|
|
45
39
|
|
|
@@ -47,15 +41,13 @@ export type GitHubWorkflowRunWatch = typeof GitHubWorkflowRunWatch.Type;
|
|
|
47
41
|
* Small canonical completion shared by webhook intake and REST reconciliation. Provider delivery
|
|
48
42
|
* IDs, URLs, actors, and mutable metadata are deliberately omitted from durable event identity.
|
|
49
43
|
*/
|
|
50
|
-
export const GitHubWorkflowRunCompletion =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
44
|
+
export const GitHubWorkflowRunCompletion = Schema.Struct({
|
|
45
|
+
repositoryId: PositiveId,
|
|
46
|
+
runId: PositiveId,
|
|
47
|
+
attempt: PositiveId,
|
|
48
|
+
headSha: GitCommitSha,
|
|
49
|
+
conclusion: GitHubConclusion,
|
|
50
|
+
}).pipe(strictSchema);
|
|
59
51
|
|
|
60
52
|
export type GitHubWorkflowRunCompletion = typeof GitHubWorkflowRunCompletion.Type;
|
|
61
53
|
|
|
@@ -144,18 +136,18 @@ export const githubWorkflowRunsHttpLayer = (
|
|
|
144
136
|
Effect.gen(function* () {
|
|
145
137
|
const client = yield* HttpClient.HttpClient;
|
|
146
138
|
|
|
147
|
-
const permittedRepository = yield* Schema.decodeEffect(GitHubRepository
|
|
148
|
-
|
|
149
|
-
).pipe(Effect.mapError(() => httpFailure("invalid-response", false)));
|
|
139
|
+
const permittedRepository = yield* Schema.decodeEffect(GitHubRepository, {
|
|
140
|
+
onExcessProperty: "error",
|
|
141
|
+
})(options.repository).pipe(Effect.mapError(() => httpFailure("invalid-response", false)));
|
|
150
142
|
|
|
151
143
|
const apiUrl = (options.apiUrl ?? "https://api.github.com").replace(/\/$/, "");
|
|
152
144
|
|
|
153
145
|
const getAttempt = Effect.fn("GitHubWorkflowRuns.getAttempt")(function* (
|
|
154
146
|
request: GitHubWorkflowRunAttemptRequest,
|
|
155
147
|
) {
|
|
156
|
-
const repository = yield* Schema.decodeEffect(GitHubRepository
|
|
157
|
-
|
|
158
|
-
);
|
|
148
|
+
const repository = yield* Schema.decodeEffect(GitHubRepository, {
|
|
149
|
+
onExcessProperty: "error",
|
|
150
|
+
})(request.repository).pipe(Effect.mapError(() => httpFailure("invalid-response", false)));
|
|
159
151
|
|
|
160
152
|
if (
|
|
161
153
|
repository.id !== permittedRepository.id ||
|
|
@@ -165,7 +157,9 @@ export const githubWorkflowRunsHttpLayer = (
|
|
|
165
157
|
return yield* httpFailure("unauthorized", false);
|
|
166
158
|
}
|
|
167
159
|
|
|
168
|
-
const watch = yield* Schema.decodeEffect(GitHubWorkflowRunWatch
|
|
160
|
+
const watch = yield* Schema.decodeEffect(GitHubWorkflowRunWatch, {
|
|
161
|
+
onExcessProperty: "error",
|
|
162
|
+
})({
|
|
169
163
|
runId: request.runId,
|
|
170
164
|
attempt: request.attempt,
|
|
171
165
|
expectedHeadSha: "0".repeat(40),
|
|
@@ -203,7 +197,7 @@ export const githubWorkflowRunsHttpLayer = (
|
|
|
203
197
|
}
|
|
204
198
|
|
|
205
199
|
return yield* response.json.pipe(
|
|
206
|
-
Effect.provideService(HttpIncomingMessage.MaxBodySize,
|
|
200
|
+
Effect.provideService(HttpIncomingMessage.MaxBodySize, ByteSize.mebibytes(1)),
|
|
207
201
|
Effect.mapError(() => httpFailure("invalid-response", false)),
|
|
208
202
|
Effect.flatMap(Schema.decodeUnknownEffect(GitHubWorkflowRunAttempt)),
|
|
209
203
|
Effect.mapError(() => httpFailure("invalid-response", false)),
|
|
@@ -261,9 +255,9 @@ export interface GitHubWorkflowRunSourceOptions {
|
|
|
261
255
|
export const makeGitHubWorkflowRunSource = Effect.fn("makeGitHubWorkflowRunSource")(function* (
|
|
262
256
|
options: GitHubWorkflowRunSourceOptions,
|
|
263
257
|
): Effect.fn.Return<EventSource, SubscriptionSourceError, GitHubWorkflowRuns> {
|
|
264
|
-
const repository = yield* Schema.decodeEffect(GitHubRepository)(
|
|
265
|
-
|
|
266
|
-
);
|
|
258
|
+
const repository = yield* Schema.decodeEffect(GitHubRepository, { onExcessProperty: "error" })(
|
|
259
|
+
options.repository,
|
|
260
|
+
).pipe(Effect.mapError(() => sourceError("github-repository-configuration", false)));
|
|
267
261
|
|
|
268
262
|
const runs = yield* GitHubWorkflowRuns;
|
|
269
263
|
|
package/src/durable/Records.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
2
|
import { Prompt } from "effect/unstable/ai";
|
|
3
3
|
|
|
4
4
|
import { InputMessage } from "../capabilities/Messaging.ts";
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
ToolCallId,
|
|
18
18
|
TurnId,
|
|
19
19
|
} from "../core/Identifiers.ts";
|
|
20
|
+
import { strictSchema } from "../core/internal/strict-schema.ts";
|
|
20
21
|
import { utf8ByteLength } from "../core/internal/utf8.ts";
|
|
21
22
|
import { IdempotencyKey, Principal } from "../core/Receipt.ts";
|
|
22
23
|
import { ExhaustedLimit } from "../core/RunEvent.ts";
|
|
@@ -95,9 +96,9 @@ export const SettlementFailureDiagnostic = Schema.Struct({
|
|
|
95
96
|
errorTag: SettlementFailureTag,
|
|
96
97
|
message: SettlementFailureMessage,
|
|
97
98
|
}).pipe(
|
|
99
|
+
strictSchema,
|
|
98
100
|
Schema.annotate({
|
|
99
101
|
identifier: "@effect-agent/thread/SettlementFailureDiagnostic",
|
|
100
|
-
parseOptions: { onExcessProperty: "error" },
|
|
101
102
|
}),
|
|
102
103
|
);
|
|
103
104
|
|
|
@@ -594,7 +595,9 @@ const isPolicyFailureProjection = Schema.is(
|
|
|
594
595
|
Schema.Struct({ errorTag: Schema.Literal("AgentPolicyError") }),
|
|
595
596
|
);
|
|
596
597
|
|
|
597
|
-
const
|
|
598
|
+
const decodeSettlementFailureDiagnostic = Schema.decodeUnknownOption(SettlementFailureDiagnostic, {
|
|
599
|
+
onExcessProperty: "error",
|
|
600
|
+
});
|
|
598
601
|
|
|
599
602
|
const hasValidSettlementFamily = (settled: typeof RawSubmissionSettled.Type): boolean =>
|
|
600
603
|
(settled.finishReason === undefined || settled.outcome === "completed") &&
|
|
@@ -607,7 +610,8 @@ const hasValidSettlementFamily = (settled: typeof RawSubmissionSettled.Type): bo
|
|
|
607
610
|
settled.finishReason === undefined &&
|
|
608
611
|
settled.runId !== undefined &&
|
|
609
612
|
settled.result !== undefined)) &&
|
|
610
|
-
(settled.outcome !== "failed" ||
|
|
613
|
+
(settled.outcome !== "failed" ||
|
|
614
|
+
Option.isSome(decodeSettlementFailureDiagnostic(settled.result))) &&
|
|
611
615
|
(settled.outcome !== "aborted" || settled.result === undefined) &&
|
|
612
616
|
(settled.policyLimit === undefined ||
|
|
613
617
|
(settled.outcome === "failed" && isPolicyFailureProjection(settled.result)));
|
|
@@ -32,7 +32,10 @@ const EncodedMemoryChange = Schema.Struct({
|
|
|
32
32
|
resultJson: StoredJson,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const equivalentContent = Schema.toEquivalence(
|
|
35
|
+
const equivalentContent = Schema.toEquivalence(
|
|
36
|
+
Schema.toEncoded(MemoryWrite.Wire.members[0].fields.content),
|
|
37
|
+
);
|
|
38
|
+
|
|
36
39
|
const equivalentScopes = Schema.toEquivalence(MemoryWrite.Wire.members[0].fields.scopes);
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -616,13 +619,14 @@ const makeMemoryServices = Effect.fn("SqliteMemoryStore.make")(function* () {
|
|
|
616
619
|
|
|
617
620
|
const bytes = utf8ByteLength;
|
|
618
621
|
const identityBytes = bytes(next.key.namespace.address) + bytes(next.key.id);
|
|
619
|
-
const
|
|
622
|
+
const resultBytes = bytes(resultJson);
|
|
623
|
+
const documentBytes = identityBytes + resultBytes + 128;
|
|
620
624
|
|
|
621
625
|
const receiptBytes =
|
|
622
626
|
identityBytes +
|
|
623
627
|
bytes(decodedWrite.operationId) +
|
|
624
628
|
bytes(commandJson) +
|
|
625
|
-
|
|
629
|
+
resultBytes +
|
|
626
630
|
128;
|
|
627
631
|
|
|
628
632
|
if (Math.max(documentBytes, receiptBytes) > limits.maxRowBytes) {
|
|
@@ -4,7 +4,7 @@ import { Response } from "effect/unstable/ai";
|
|
|
4
4
|
import { utf8ByteLength } from "../../core/internal/utf8.ts";
|
|
5
5
|
import { boundedValueFootprint } from "./bounded-value.ts";
|
|
6
6
|
|
|
7
|
-
const brand = "~effect/ai/
|
|
7
|
+
const brand = "~effect/ai/Response/Part";
|
|
8
8
|
const keys = [brand, "type", "id", "delta", "metadata"];
|
|
9
9
|
|
|
10
10
|
const decode = Schema.decodeUnknownOption(
|
|
@@ -75,7 +75,7 @@ export const InteractiveBrowserNetworkPolicy = Schema.Union([
|
|
|
75
75
|
}),
|
|
76
76
|
Schema.TaggedStruct("PublicWeb", {}),
|
|
77
77
|
Schema.TaggedStruct("Unrestricted", {}),
|
|
78
|
-
])
|
|
78
|
+
]);
|
|
79
79
|
|
|
80
80
|
export type InteractiveBrowserNetworkPolicy = typeof InteractiveBrowserNetworkPolicy.Type;
|
|
81
81
|
|
|
@@ -88,7 +88,7 @@ export class InteractiveBrowserPolicy extends Schema.Class<InteractiveBrowserPol
|
|
|
88
88
|
maxActions: PositiveInt.check(Schema.isLessThanOrEqualTo(1_000)),
|
|
89
89
|
maxElapsedMillis: PositiveInt.check(Schema.isLessThanOrEqualTo(60 * 60_000)),
|
|
90
90
|
maxReturnedBytes: PositiveInt.check(Schema.isLessThanOrEqualTo(8 * 1024 * 1024)),
|
|
91
|
-
})
|
|
91
|
+
}),
|
|
92
92
|
) {}
|
|
93
93
|
|
|
94
94
|
export class BrowserNavigateRequest extends Schema.Class<BrowserNavigateRequest>(
|
|
@@ -160,10 +160,7 @@ type ResponseFormatNode = Schema.JsonObject & {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
const ResponseFormatNode: Schema.Codec<ResponseFormatNode> = Schema.suspend(
|
|
163
|
-
(): Schema.Codec<ResponseFormatNode> =>
|
|
164
|
-
Schema.Struct(responseFormatFields()).pipe(
|
|
165
|
-
Schema.annotate({ parseOptions: { onExcessProperty: "error" } }),
|
|
166
|
-
),
|
|
163
|
+
(): Schema.Codec<ResponseFormatNode> => Schema.Struct(responseFormatFields()),
|
|
167
164
|
);
|
|
168
165
|
|
|
169
166
|
const responseFormatFields = () => {
|
|
@@ -257,9 +254,11 @@ const responseFormatFields = () => {
|
|
|
257
254
|
const ResponseFormatDocument = Schema.Struct({
|
|
258
255
|
...responseFormatFields(),
|
|
259
256
|
type: Schema.Literal("object"),
|
|
260
|
-
})
|
|
257
|
+
});
|
|
261
258
|
|
|
262
|
-
const
|
|
259
|
+
const decodeResponseFormatDocument = Schema.decodeUnknownOption(ResponseFormatDocument, {
|
|
260
|
+
onExcessProperty: "error",
|
|
261
|
+
});
|
|
263
262
|
|
|
264
263
|
/** Preflight graph bounds before recursively decoding an untrusted JSON Schema. */
|
|
265
264
|
const isBoundedResponseFormat = (input: unknown): input is typeof ResponseFormatDocument.Type => {
|
|
@@ -313,7 +312,7 @@ const isBoundedResponseFormat = (input: unknown): input is typeof ResponseFormat
|
|
|
313
312
|
}
|
|
314
313
|
}
|
|
315
314
|
|
|
316
|
-
if (
|
|
315
|
+
if (Option.isNone(decodeResponseFormatDocument(input))) return false;
|
|
317
316
|
const encoded = JSON.stringify(input);
|
|
318
317
|
|
|
319
318
|
return Encoding.encodeHex(encoded).length / 2 <= MAX_RESPONSE_FORMAT_BYTES;
|
|
@@ -140,7 +140,7 @@ export class ProtectedBrowserFill extends Schema.Class<ProtectedBrowserFill>(
|
|
|
140
140
|
Schema.Struct({
|
|
141
141
|
ref: BrowserReference,
|
|
142
142
|
value: Schema.String.check(Schema.isMaxLength(8192)),
|
|
143
|
-
})
|
|
143
|
+
}),
|
|
144
144
|
) {}
|
|
145
145
|
|
|
146
146
|
export const CredentialDispatch = Schema.Literals([
|