effect-agent 0.1.0-beta.85 → 0.1.0-beta.87
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/Agent-CN0EWRsR.d.mts +226 -0
- package/dist/Agent-RklVROrm.mjs +83 -0
- package/dist/Agent-RklVROrm.mjs.map +1 -0
- package/dist/AgentError-CggcAQ7V.d.mts +101 -0
- package/dist/AgentPolicy-CetmQrf3.d.mts +96 -0
- package/dist/AgentRuntime-BLyETCPo.mjs +4562 -0
- package/dist/AgentRuntime-BLyETCPo.mjs.map +1 -0
- package/dist/AgentRuntime-uxR_a4VM.d.mts +346 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-Dxu5zhOL.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-uggeJpv3.mjs +6368 -0
- package/dist/DurableAgentRuntime-uggeJpv3.mjs.map +1 -0
- package/dist/DurableFailpoint-Oinuuedm.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/Ephemeral.d.mts +22 -0
- package/dist/Ephemeral.mjs +22 -0
- package/dist/Ephemeral.mjs.map +1 -0
- package/dist/EventSource-OqS_P9ug.d.mts +51 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-CkcIdt4I.d.mts +490 -0
- package/dist/MessagingHost-CRk0kXzT.d.mts +246 -0
- package/dist/MessagingHost-CWi_PP3g.mjs +137 -0
- package/dist/MessagingHost-CWi_PP3g.mjs.map +1 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-D6SkedVx.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-C4HbjHgl.d.mts +38 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-BAGkekt8.d.mts +3570 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-Cgg1kNvc.mjs +825 -0
- package/dist/RunJournal-Cgg1kNvc.mjs.map +1 -0
- package/dist/RunOptions-g1aigcKI.d.mts +915 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-H3SEYX9g.d.mts +842 -0
- package/dist/Scheduling-C9aIP8zT.mjs +691 -0
- package/dist/Scheduling-C9aIP8zT.mjs.map +1 -0
- package/dist/Subagent-Cy_hU1tv.mjs +1469 -0
- package/dist/Subagent-Cy_hU1tv.mjs.map +1 -0
- package/dist/Subagent-DyfzHNdv.d.mts +826 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-CJUBQlcc.d.mts +140 -0
- package/dist/Subscription-BEP8oQO5.d.mts +921 -0
- package/dist/SubscriptionInput-vAAOBrK7.d.mts +41 -0
- package/dist/Thread-DOBQ0QUY.d.mts +96 -0
- package/dist/ThreadHistory-tS1KwxHR.d.mts +60 -0
- package/dist/ToolBroker-DWs4tZra.d.mts +133 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs +10 -0
- package/dist/ToolExposure-9uF_Yo0T.mjs.map +1 -0
- package/dist/ToolExposure-C93U1sPu.mjs +30 -0
- package/dist/ToolExposure-C93U1sPu.mjs.map +1 -0
- package/dist/ToolExposure-UCN12eCd.d.mts +39 -0
- package/dist/ToolExposure-r2eOWk4F.d.mts +46 -0
- package/dist/ToolExposure.d.mts +6 -5
- package/dist/ToolExposure.mjs +17 -9
- package/dist/ToolExposure.mjs.map +1 -1
- package/dist/ToolReconciler-DQVaJfpE.d.mts +76 -0
- package/dist/ToolResult-DmmgoChv.d.mts +61 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-CaPYykpe.d.mts +228 -0
- package/dist/agent-registration-CWDMOAZA.mjs +172 -0
- package/dist/agent-registration-CWDMOAZA.mjs.map +1 -0
- package/dist/capabilities/Approval.d.mts +114 -0
- package/dist/capabilities/Approval.mjs +226 -0
- package/dist/capabilities/Approval.mjs.map +1 -0
- package/dist/capabilities/Budget.d.mts +112 -0
- package/dist/capabilities/Budget.mjs +346 -0
- package/dist/capabilities/Budget.mjs.map +1 -0
- package/dist/capabilities/CodeMode.d.mts +157 -0
- package/dist/capabilities/CodeMode.mjs +522 -0
- package/dist/capabilities/CodeMode.mjs.map +1 -0
- package/dist/capabilities/Commands.d.mts +55 -0
- package/dist/capabilities/Commands.mjs +57 -0
- package/dist/capabilities/Commands.mjs.map +1 -0
- package/dist/capabilities/ContextTools.d.mts +321 -0
- package/dist/capabilities/ContextTools.mjs +126 -0
- package/dist/capabilities/ContextTools.mjs.map +1 -0
- package/dist/capabilities/Mcp.d.mts +108 -0
- package/dist/capabilities/Mcp.mjs +260 -0
- package/dist/capabilities/Mcp.mjs.map +1 -0
- package/dist/capabilities/McpClient.d.mts +115 -0
- package/dist/capabilities/McpClient.mjs +506 -0
- package/dist/capabilities/McpClient.mjs.map +1 -0
- package/dist/capabilities/MemoryNotes.d.mts +424 -0
- package/dist/capabilities/MemoryNotes.mjs +128 -0
- package/dist/capabilities/MemoryNotes.mjs.map +1 -0
- package/dist/capabilities/Messaging.d.mts +3 -0
- package/dist/capabilities/Messaging.mjs +151 -0
- package/dist/capabilities/Messaging.mjs.map +1 -0
- package/dist/capabilities/ModelContext.d.mts +89 -0
- package/dist/capabilities/ModelContext.mjs +168 -0
- package/dist/capabilities/ModelContext.mjs.map +1 -0
- package/dist/capabilities/Redaction.d.mts +37 -0
- package/dist/capabilities/Redaction.mjs +104 -0
- package/dist/capabilities/Redaction.mjs.map +1 -0
- package/dist/capabilities/Remembering.d.mts +434 -0
- package/dist/capabilities/Remembering.mjs +290 -0
- package/dist/capabilities/Remembering.mjs.map +1 -0
- package/dist/capabilities/RunHooks.d.mts +82 -0
- package/dist/capabilities/RunHooks.mjs +144 -0
- package/dist/capabilities/RunHooks.mjs.map +1 -0
- package/dist/capabilities/SemanticMemory.d.mts +431 -0
- package/dist/capabilities/SemanticMemory.mjs +315 -0
- package/dist/capabilities/SemanticMemory.mjs.map +1 -0
- package/dist/capabilities/Subagent.d.mts +4 -0
- package/dist/capabilities/Subagent.mjs +5 -0
- package/dist/capabilities/SubagentReservations.d.mts +186 -0
- package/dist/capabilities/SubagentReservations.mjs +479 -0
- package/dist/capabilities/SubagentReservations.mjs.map +1 -0
- package/dist/capabilities/ToolDiscovery.d.mts +109 -0
- package/dist/capabilities/ToolDiscovery.mjs +211 -0
- package/dist/capabilities/ToolDiscovery.mjs.map +1 -0
- package/dist/capabilities/WebCapture.d.mts +163 -0
- package/dist/capabilities/WebCapture.mjs +335 -0
- package/dist/capabilities/WebCapture.mjs.map +1 -0
- package/dist/capabilities/WebSearch.d.mts +71 -0
- package/dist/capabilities/WebSearch.mjs +112 -0
- package/dist/capabilities/WebSearch.mjs.map +1 -0
- package/dist/compaction-C2OTceKw.mjs +505 -0
- package/dist/compaction-C2OTceKw.mjs.map +1 -0
- package/dist/core/Agent.d.mts +2 -0
- package/dist/core/Agent.mjs +2 -0
- package/dist/core/AgentError.d.mts +2 -0
- package/dist/core/AgentError.mjs +117 -0
- package/dist/core/AgentError.mjs.map +1 -0
- package/dist/core/AgentPolicy.d.mts +2 -0
- package/dist/core/AgentPolicy.mjs +94 -0
- package/dist/core/AgentPolicy.mjs.map +1 -0
- package/dist/core/AgentUpdates.d.mts +2 -0
- package/dist/core/AgentUpdates.mjs +63 -0
- package/dist/core/AgentUpdates.mjs.map +1 -0
- package/dist/core/IdGenerator.d.mts +26 -0
- package/dist/core/IdGenerator.mjs +27 -0
- package/dist/core/IdGenerator.mjs.map +1 -0
- package/dist/core/Identifiers.d.mts +2 -0
- package/dist/core/Identifiers.mjs +43 -0
- package/dist/core/Identifiers.mjs.map +1 -0
- package/dist/core/Memory.d.mts +57 -0
- package/dist/core/Memory.mjs +203 -0
- package/dist/core/Memory.mjs.map +1 -0
- package/dist/core/MemoryNamespace.d.mts +2 -0
- package/dist/core/MemoryNamespace.mjs +116 -0
- package/dist/core/MemoryNamespace.mjs.map +1 -0
- package/dist/core/MemoryReference.d.mts +2 -0
- package/dist/core/MemoryReference.mjs +109 -0
- package/dist/core/MemoryReference.mjs.map +1 -0
- package/dist/core/MemoryRevalidation.d.mts +65 -0
- package/dist/core/MemoryRevalidation.mjs +126 -0
- package/dist/core/MemoryRevalidation.mjs.map +1 -0
- package/dist/core/MemoryStore.d.mts +186 -0
- package/dist/core/MemoryStore.mjs +243 -0
- package/dist/core/MemoryStore.mjs.map +1 -0
- package/dist/core/Receipt.d.mts +2 -0
- package/dist/core/Receipt.mjs +36 -0
- package/dist/core/Receipt.mjs.map +1 -0
- package/dist/core/RememberingStore.d.mts +1562 -0
- package/dist/core/RememberingStore.mjs +190 -0
- package/dist/core/RememberingStore.mjs.map +1 -0
- package/dist/core/RunEvent.d.mts +2 -0
- package/dist/core/RunEvent.mjs +337 -0
- package/dist/core/RunEvent.mjs.map +1 -0
- package/dist/core/RunPolicyUsage.d.mts +2 -0
- package/dist/core/RunPolicyUsage.mjs +21 -0
- package/dist/core/RunPolicyUsage.mjs.map +1 -0
- package/dist/core/SemanticMemoryIndex.d.mts +826 -0
- package/dist/core/SemanticMemoryIndex.mjs +185 -0
- package/dist/core/SemanticMemoryIndex.mjs.map +1 -0
- package/dist/core/SemanticMemoryRevalidation.d.mts +45 -0
- package/dist/core/SemanticMemoryRevalidation.mjs +191 -0
- package/dist/core/SemanticMemoryRevalidation.mjs.map +1 -0
- package/dist/core/SubagentContract.d.mts +2 -0
- package/dist/core/SubagentContract.mjs +148 -0
- package/dist/core/SubagentContract.mjs.map +1 -0
- package/dist/core/Thread.d.mts +2 -0
- package/dist/core/Thread.mjs +250 -0
- package/dist/core/Thread.mjs.map +1 -0
- package/dist/core/ToolResult.d.mts +2 -0
- package/dist/core/ToolResult.mjs +140 -0
- package/dist/core/ToolResult.mjs.map +1 -0
- package/dist/core/Usage.d.mts +2 -0
- package/dist/core/Usage.mjs +319 -0
- package/dist/core/Usage.mjs.map +1 -0
- package/dist/core/Worker.d.mts +3 -0
- package/dist/core/Worker.mjs +147 -0
- package/dist/core/Worker.mjs.map +1 -0
- package/dist/durable/ActivityStore.d.mts +116 -0
- package/dist/durable/ActivityStore.mjs +131 -0
- package/dist/durable/ActivityStore.mjs.map +1 -0
- package/dist/durable/Admin.d.mts +2 -0
- package/dist/durable/Admin.mjs +328 -0
- package/dist/durable/Admin.mjs.map +1 -0
- package/dist/durable/AgentRegistration.d.mts +2 -0
- package/dist/durable/AgentRegistration.mjs +14 -0
- package/dist/durable/AgentRegistration.mjs.map +1 -0
- package/dist/durable/Certification.d.mts +111 -0
- package/dist/durable/Certification.mjs +159 -0
- package/dist/durable/Certification.mjs.map +1 -0
- package/dist/durable/CommittedActivity.d.mts +62 -0
- package/dist/durable/CommittedActivity.mjs +159 -0
- package/dist/durable/CommittedActivity.mjs.map +1 -0
- package/dist/durable/Digest.d.mts +2 -0
- package/dist/durable/Digest.mjs +50 -0
- package/dist/durable/Digest.mjs.map +1 -0
- package/dist/durable/DurableAgentRuntime.d.mts +3 -0
- package/dist/durable/DurableAgentRuntime.mjs +3 -0
- package/dist/durable/DurableFailpoint.d.mts +2 -0
- package/dist/durable/DurableFailpoint.mjs +94 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +15 -0
- package/dist/durable/DurableFailpointTestControl.mjs +19 -0
- package/dist/durable/DurableFailpointTestControl.mjs.map +1 -0
- package/dist/durable/EventSource.d.mts +2 -0
- package/dist/durable/EventSource.mjs +65 -0
- package/dist/durable/EventSource.mjs.map +1 -0
- package/dist/durable/GitHubWorkflowSource.d.mts +144 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +492 -0
- package/dist/durable/MessageDelivery.mjs +495 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +358 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +243 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs.map +1 -0
- package/dist/durable/OperationAuthorizer.d.mts +2 -0
- package/dist/durable/OperationAuthorizer.mjs +70 -0
- package/dist/durable/OperationAuthorizer.mjs.map +1 -0
- package/dist/durable/PersistentHistory.d.mts +16 -0
- package/dist/durable/PersistentHistory.mjs +125 -0
- package/dist/durable/PersistentHistory.mjs.map +1 -0
- package/dist/durable/PreparedInputAdmission.d.mts +2 -0
- package/dist/durable/PreparedInputAdmission.mjs +34 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +795 -0
- package/dist/durable/Records.mjs.map +1 -0
- package/dist/durable/Recovery.d.mts +2 -0
- package/dist/durable/Recovery.mjs +739 -0
- package/dist/durable/Recovery.mjs.map +1 -0
- package/dist/durable/RunJournal.d.mts +2 -0
- package/dist/durable/RunJournal.mjs +2 -0
- package/dist/durable/Schedule.d.mts +2 -0
- package/dist/durable/Schedule.mjs +382 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +18 -0
- package/dist/durable/ScheduleStoreConformance.mjs +420 -0
- package/dist/durable/ScheduleStoreConformance.mjs.map +1 -0
- package/dist/durable/ScheduleTransition.d.mts +24 -0
- package/dist/durable/ScheduleTransition.mjs +180 -0
- package/dist/durable/ScheduleTransition.mjs.map +1 -0
- package/dist/durable/Scheduling.d.mts +54 -0
- package/dist/durable/Scheduling.mjs +2 -0
- package/dist/durable/SqlMemoryStore.d.mts +30 -0
- package/dist/durable/SqlMemoryStore.mjs +435 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +40 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +167 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +22 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +63 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +914 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +30 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +1986 -0
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -0
- package/dist/durable/SubmissionStatus.d.mts +2 -0
- package/dist/durable/SubmissionStatus.mjs +18 -0
- package/dist/durable/SubmissionStatus.mjs.map +1 -0
- package/dist/durable/Subscription.d.mts +2 -0
- package/dist/durable/Subscription.mjs +360 -0
- package/dist/durable/Subscription.mjs.map +1 -0
- package/dist/durable/SubscriptionInput.d.mts +2 -0
- package/dist/durable/SubscriptionInput.mjs +52 -0
- package/dist/durable/SubscriptionInput.mjs.map +1 -0
- package/dist/durable/SubscriptionStoreConformance.d.mts +17 -0
- package/dist/durable/SubscriptionStoreConformance.mjs +625 -0
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -0
- package/dist/durable/SubscriptionTools.d.mts +273 -0
- package/dist/durable/SubscriptionTools.mjs +190 -0
- package/dist/durable/SubscriptionTools.mjs.map +1 -0
- package/dist/durable/SubscriptionTransition.d.mts +21 -0
- package/dist/durable/SubscriptionTransition.mjs +148 -0
- package/dist/durable/SubscriptionTransition.mjs.map +1 -0
- package/dist/durable/Subscriptions.d.mts +73 -0
- package/dist/durable/Subscriptions.mjs +627 -0
- package/dist/durable/Subscriptions.mjs.map +1 -0
- package/dist/durable/ThreadContextHistory.d.mts +32 -0
- package/dist/durable/ThreadContextHistory.mjs +152 -0
- package/dist/durable/ThreadContextHistory.mjs.map +1 -0
- package/dist/durable/ThreadContextHistoryProjection.d.mts +60 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs +149 -0
- package/dist/durable/ThreadContextHistoryProjection.mjs.map +1 -0
- package/dist/durable/ThreadInvariants.d.mts +74 -0
- package/dist/durable/ThreadInvariants.mjs +200 -0
- package/dist/durable/ThreadInvariants.mjs.map +1 -0
- package/dist/durable/ThreadProjection.d.mts +78 -0
- package/dist/durable/ThreadProjection.mjs +158 -0
- package/dist/durable/ThreadProjection.mjs.map +1 -0
- package/dist/durable/ThreadProjectionMaintenance.d.mts +49 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs +33 -0
- package/dist/durable/ThreadProjectionMaintenance.mjs.map +1 -0
- package/dist/durable/ThreadStore.d.mts +2 -0
- package/dist/durable/ThreadStore.mjs +147 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +29 -0
- package/dist/durable/ThreadStoreConformance.mjs +248 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +81 -0
- package/dist/durable/ToolReconciler.mjs.map +1 -0
- package/dist/durable/WakeScheduler.d.mts +2 -0
- package/dist/durable/WakeScheduler.mjs +85 -0
- package/dist/durable/WakeScheduler.mjs.map +1 -0
- package/dist/durable/WorkerHost.d.mts +129 -0
- package/dist/durable/WorkerHost.mjs +77 -0
- package/dist/durable/WorkerHost.mjs.map +1 -0
- package/dist/engine/AgentRuntime.d.mts +2 -0
- package/dist/engine/AgentRuntime.mjs +2 -0
- package/dist/engine/Compaction.d.mts +7 -0
- package/dist/engine/Compaction.mjs +16 -0
- package/dist/engine/Compaction.mjs.map +1 -0
- package/dist/engine/ContextCompactor.d.mts +2 -0
- package/dist/engine/ContextCompactor.mjs +119 -0
- package/dist/engine/ContextCompactor.mjs.map +1 -0
- package/dist/engine/ContextHistory.d.mts +65 -0
- package/dist/engine/ContextHistory.mjs +76 -0
- package/dist/engine/ContextHistory.mjs.map +1 -0
- package/dist/engine/ContextWindow.d.mts +2 -0
- package/dist/engine/ContextWindow.mjs +59 -0
- package/dist/engine/ContextWindow.mjs.map +1 -0
- package/dist/engine/DurableStep.d.mts +2 -0
- package/dist/engine/DurableStep.mjs +62 -0
- package/dist/engine/DurableStep.mjs.map +1 -0
- package/dist/engine/MessagingHost.d.mts +2 -0
- package/dist/engine/MessagingHost.mjs +2 -0
- package/dist/engine/Output.d.mts +2 -0
- package/dist/engine/Output.mjs +8 -0
- package/dist/engine/Output.mjs.map +1 -0
- package/dist/engine/RunEventSink.d.mts +2 -0
- package/dist/engine/RunEventSink.mjs +22 -0
- package/dist/engine/RunEventSink.mjs.map +1 -0
- package/dist/engine/RunOptions.d.mts +2 -0
- package/dist/engine/RunOptions.mjs +122 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +72 -0
- package/dist/engine/SubagentHost.mjs.map +1 -0
- package/dist/engine/ThreadHistory.d.mts +2 -0
- package/dist/engine/ThreadHistory.mjs +67 -0
- package/dist/engine/ThreadHistory.mjs.map +1 -0
- package/dist/engine/ToolBroker.d.mts +2 -0
- package/dist/engine/ToolBroker.mjs +42 -0
- package/dist/engine/ToolBroker.mjs.map +1 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs +37 -0
- package/dist/foreign-diagnostic-DBQ1XHKh.mjs.map +1 -0
- package/dist/index.d.mts +88 -54
- package/dist/index.mjs +97 -54
- package/dist/output-contract-BC7tjlGw.mjs +84 -0
- package/dist/output-contract-BC7tjlGw.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/sandbox/CodeExecutor.d.mts +194 -0
- package/dist/sandbox/CodeExecutor.mjs +278 -0
- package/dist/sandbox/CodeExecutor.mjs.map +1 -0
- package/dist/sandbox/InteractiveBrowser.d.mts +142 -0
- package/dist/sandbox/InteractiveBrowser.mjs +165 -0
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -0
- package/dist/sandbox/PageCapture.d.mts +2 -0
- package/dist/sandbox/PageCapture.mjs +450 -0
- package/dist/sandbox/PageCapture.mjs.map +1 -0
- package/dist/sandbox/PageCrawl.d.mts +88 -0
- package/dist/sandbox/PageCrawl.mjs +124 -0
- package/dist/sandbox/PageCrawl.mjs.map +1 -0
- package/dist/sandbox/PageScreenshot.d.mts +2 -0
- package/dist/sandbox/PageScreenshot.mjs +53 -0
- package/dist/sandbox/PageScreenshot.mjs.map +1 -0
- package/dist/sandbox/ProtectedBrowser.d.mts +252 -0
- package/dist/sandbox/ProtectedBrowser.mjs +270 -0
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -0
- package/dist/sandbox/Sandbox.d.mts +2 -0
- package/dist/sandbox/Sandbox.mjs +208 -0
- package/dist/sandbox/Sandbox.mjs.map +1 -0
- package/dist/utf8-BYfhEkcj.mjs +11 -0
- package/dist/utf8-BYfhEkcj.mjs.map +1 -0
- package/dist/utf8-DchGZRBd.mjs +23 -0
- package/dist/utf8-DchGZRBd.mjs.map +1 -0
- package/package.json +1 -1
- package/src/Ephemeral.ts +17 -0
- package/src/ToolExposure.ts +2 -2
- package/src/capabilities/Approval.ts +352 -0
- package/src/capabilities/Budget.ts +536 -0
- package/src/capabilities/CodeMode.ts +1090 -0
- package/src/capabilities/Commands.ts +86 -0
- package/src/capabilities/ContextTools.ts +184 -0
- package/src/capabilities/Mcp.ts +427 -0
- package/src/capabilities/McpClient.ts +967 -0
- package/src/capabilities/MemoryNotes.ts +174 -0
- package/src/capabilities/Messaging.ts +261 -0
- package/src/capabilities/ModelContext.ts +354 -0
- package/src/capabilities/Redaction.ts +157 -0
- package/src/capabilities/Remembering.ts +550 -0
- package/src/capabilities/RunHooks.ts +280 -0
- package/src/capabilities/SemanticMemory.ts +447 -0
- package/src/capabilities/Subagent.ts +2277 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +339 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +184 -0
- package/src/capabilities/internal/subagent-background.ts +1106 -0
- package/src/capabilities/internal/subagent-contract.ts +142 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +261 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +575 -0
- package/src/core/AgentError.ts +152 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -0
- package/src/core/IdGenerator.ts +39 -0
- package/src/core/Identifiers.ts +48 -0
- package/src/core/Memory.ts +290 -0
- package/src/core/MemoryNamespace.ts +196 -0
- package/src/core/MemoryReference.ts +121 -0
- package/src/core/MemoryRevalidation.ts +185 -0
- package/src/core/MemoryStore.ts +368 -0
- package/src/core/Messaging.ts +90 -0
- package/src/core/Receipt.ts +42 -0
- package/src/core/RememberingStore.ts +300 -0
- package/src/core/RunEvent.ts +366 -0
- package/src/core/RunPolicyUsage.ts +17 -0
- package/src/core/SemanticMemoryIndex.ts +250 -0
- package/src/core/SemanticMemoryRevalidation.ts +254 -0
- package/src/core/SubagentContract.ts +196 -0
- package/src/core/Thread.ts +371 -0
- package/src/core/ToolExposure.ts +74 -0
- package/src/core/ToolResult.ts +170 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +173 -0
- package/src/core/internal/agent-updates.ts +32 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +496 -0
- package/src/durable/AgentRegistration.ts +13 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +93 -0
- package/src/durable/DurableAgentRuntime.ts +10340 -0
- package/src/durable/DurableFailpoint.ts +103 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +453 -0
- package/src/durable/MessageDelivery.ts +708 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +363 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +44 -0
- package/src/durable/Records.ts +1010 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1479 -0
- package/src/durable/Schedule.ts +504 -0
- package/src/durable/ScheduleStoreConformance.ts +638 -0
- package/src/durable/ScheduleTransition.ts +265 -0
- package/src/durable/Scheduling.ts +1077 -0
- package/src/durable/SqlMemoryStore.ts +774 -0
- package/src/durable/SqlMessageDeliveryStore.ts +302 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SubmissionLedger.ts +1201 -0
- package/src/durable/SubmissionLedgerConformance.ts +4579 -0
- package/src/durable/SubmissionStatus.ts +14 -0
- package/src/durable/Subscription.ts +544 -0
- package/src/durable/SubscriptionInput.ts +144 -0
- package/src/durable/SubscriptionStoreConformance.ts +945 -0
- package/src/durable/SubscriptionTools.ts +327 -0
- package/src/durable/SubscriptionTransition.ts +302 -0
- package/src/durable/Subscriptions.ts +1210 -0
- package/src/durable/ThreadContextHistory.ts +227 -0
- package/src/durable/ThreadContextHistoryProjection.ts +216 -0
- package/src/durable/ThreadInvariants.ts +442 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +242 -0
- package/src/durable/ThreadStoreConformance.ts +710 -0
- package/src/durable/ToolReconciler.ts +105 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +525 -0
- package/src/durable/internal/agent-updates.ts +302 -0
- package/src/durable/internal/foreign-diagnostic.ts +47 -0
- package/src/durable/internal/journal-checkpoint.ts +104 -0
- package/src/durable/internal/journal-metadata.ts +107 -0
- package/src/durable/internal/messaging-host.ts +608 -0
- package/src/durable/internal/schedule-time.ts +303 -0
- package/src/durable/internal/storage-v2-layout.ts +163 -0
- package/src/durable/internal/storage-v2.ts +73 -0
- package/src/durable/internal/worker-host.ts +2467 -0
- package/src/durable/internal/worker-runtime.ts +9 -0
- package/src/engine/AgentRuntime.ts +37 -0
- package/src/engine/Compaction.ts +11 -0
- package/src/engine/ContextCompactor.ts +277 -0
- package/src/engine/ContextHistory.ts +73 -0
- package/src/engine/ContextWindow.ts +72 -0
- package/src/engine/DurableStep.ts +132 -0
- package/src/engine/MessagingHost.ts +110 -0
- package/src/engine/Output.ts +2 -0
- package/src/engine/RunEventSink.ts +132 -0
- package/src/engine/RunOptions.ts +1077 -0
- package/src/engine/SubagentHost.ts +181 -0
- package/src/engine/ThreadHistory.ts +120 -0
- package/src/engine/ToolBroker.ts +157 -0
- package/src/engine/ToolExposure.ts +48 -0
- package/src/engine/internal/agent-runtime.ts +10117 -0
- package/src/engine/internal/bounded-value.ts +315 -0
- package/src/engine/internal/compaction.ts +678 -0
- package/src/engine/internal/error-diagnostic.ts +39 -0
- package/src/engine/internal/output-contract.ts +173 -0
- package/src/engine/internal/primitive-delta.ts +80 -0
- package/src/engine/internal/provider-result-staging.ts +211 -0
- package/src/engine/internal/tool-derivative.ts +106 -0
- package/src/engine/internal/tool-exposure.ts +224 -0
- package/src/engine/internal/tool-telemetry.ts +484 -0
- package/src/index.ts +96 -53
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +257 -0
- package/src/sandbox/PageCapture.ts +692 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +413 -0
- package/src/sandbox/Sandbox.ts +241 -0
- package/dist/Agent.d.mts +0 -5
- package/dist/Agent.mjs +0 -10
- package/dist/Agent.mjs.map +0 -1
- package/dist/AgentError.d.mts +0 -5
- package/dist/AgentError.mjs +0 -10
- package/dist/AgentError.mjs.map +0 -1
- package/dist/AgentPolicy.d.mts +0 -5
- package/dist/AgentPolicy.mjs +0 -10
- package/dist/AgentPolicy.mjs.map +0 -1
- package/dist/AgentRuntime.d.mts +0 -5
- package/dist/AgentRuntime.mjs +0 -10
- package/dist/AgentRuntime.mjs.map +0 -1
- package/dist/AgentUpdates.d.mts +0 -5
- package/dist/AgentUpdates.mjs +0 -10
- package/dist/AgentUpdates.mjs.map +0 -1
- package/dist/Approval.d.mts +0 -5
- package/dist/Approval.mjs +0 -10
- package/dist/Approval.mjs.map +0 -1
- package/dist/Budget.d.mts +0 -5
- package/dist/Budget.mjs +0 -10
- package/dist/Budget.mjs.map +0 -1
- package/dist/CodeMode.d.mts +0 -5
- package/dist/CodeMode.mjs +0 -10
- package/dist/CodeMode.mjs.map +0 -1
- package/dist/Commands.d.mts +0 -5
- package/dist/Commands.mjs +0 -10
- package/dist/Commands.mjs.map +0 -1
- package/dist/Compaction.d.mts +0 -5
- package/dist/Compaction.mjs +0 -10
- package/dist/Compaction.mjs.map +0 -1
- package/dist/ContextCompactor.d.mts +0 -5
- package/dist/ContextCompactor.mjs +0 -10
- package/dist/ContextCompactor.mjs.map +0 -1
- package/dist/ContextHistory.d.mts +0 -5
- package/dist/ContextHistory.mjs +0 -10
- package/dist/ContextHistory.mjs.map +0 -1
- package/dist/ContextTools.d.mts +0 -5
- package/dist/ContextTools.mjs +0 -10
- package/dist/ContextTools.mjs.map +0 -1
- package/dist/ContextWindow.d.mts +0 -5
- package/dist/ContextWindow.mjs +0 -10
- package/dist/ContextWindow.mjs.map +0 -1
- package/dist/DurableStep.d.mts +0 -5
- package/dist/DurableStep.mjs +0 -10
- package/dist/DurableStep.mjs.map +0 -1
- package/dist/EphemeralThreads.d.mts +0 -5
- package/dist/EphemeralThreads.mjs +0 -10
- package/dist/EphemeralThreads.mjs.map +0 -1
- package/dist/IdGenerator.d.mts +0 -5
- package/dist/IdGenerator.mjs +0 -10
- package/dist/IdGenerator.mjs.map +0 -1
- package/dist/Identifiers.d.mts +0 -5
- package/dist/Identifiers.mjs +0 -10
- package/dist/Identifiers.mjs.map +0 -1
- package/dist/Mcp.d.mts +0 -5
- package/dist/Mcp.mjs +0 -10
- package/dist/Mcp.mjs.map +0 -1
- package/dist/McpClient.d.mts +0 -5
- package/dist/McpClient.mjs +0 -10
- package/dist/McpClient.mjs.map +0 -1
- package/dist/Memory.d.mts +0 -5
- package/dist/Memory.mjs +0 -10
- package/dist/Memory.mjs.map +0 -1
- package/dist/MemoryNamespace.d.mts +0 -5
- package/dist/MemoryNamespace.mjs +0 -10
- package/dist/MemoryNamespace.mjs.map +0 -1
- package/dist/MemoryNotes.d.mts +0 -5
- package/dist/MemoryNotes.mjs +0 -10
- package/dist/MemoryNotes.mjs.map +0 -1
- package/dist/MemoryReference.d.mts +0 -5
- package/dist/MemoryReference.mjs +0 -10
- package/dist/MemoryReference.mjs.map +0 -1
- package/dist/MemoryRevalidation.d.mts +0 -5
- package/dist/MemoryRevalidation.mjs +0 -10
- package/dist/MemoryRevalidation.mjs.map +0 -1
- package/dist/MemoryStore.d.mts +0 -5
- package/dist/MemoryStore.mjs +0 -10
- package/dist/MemoryStore.mjs.map +0 -1
- package/dist/Messaging.d.mts +0 -5
- package/dist/Messaging.mjs +0 -10
- package/dist/Messaging.mjs.map +0 -1
- package/dist/MessagingHost.d.mts +0 -5
- package/dist/MessagingHost.mjs +0 -10
- package/dist/MessagingHost.mjs.map +0 -1
- package/dist/ModelContext.d.mts +0 -5
- package/dist/ModelContext.mjs +0 -10
- package/dist/ModelContext.mjs.map +0 -1
- package/dist/Receipt.d.mts +0 -5
- package/dist/Receipt.mjs +0 -10
- package/dist/Receipt.mjs.map +0 -1
- package/dist/Redaction.d.mts +0 -5
- package/dist/Redaction.mjs +0 -10
- package/dist/Redaction.mjs.map +0 -1
- package/dist/Remembering.d.mts +0 -5
- package/dist/Remembering.mjs +0 -10
- package/dist/Remembering.mjs.map +0 -1
- package/dist/RememberingStore.d.mts +0 -5
- package/dist/RememberingStore.mjs +0 -10
- package/dist/RememberingStore.mjs.map +0 -1
- package/dist/RunEvent.d.mts +0 -5
- package/dist/RunEvent.mjs +0 -10
- package/dist/RunEvent.mjs.map +0 -1
- package/dist/RunEventSink.d.mts +0 -5
- package/dist/RunEventSink.mjs +0 -10
- package/dist/RunEventSink.mjs.map +0 -1
- package/dist/RunHooks.d.mts +0 -5
- package/dist/RunHooks.mjs +0 -10
- package/dist/RunHooks.mjs.map +0 -1
- package/dist/RunOptions.d.mts +0 -5
- package/dist/RunOptions.mjs +0 -10
- package/dist/RunOptions.mjs.map +0 -1
- package/dist/RunPolicyUsage.d.mts +0 -5
- package/dist/RunPolicyUsage.mjs +0 -10
- package/dist/RunPolicyUsage.mjs.map +0 -1
- package/dist/SemanticMemory.d.mts +0 -5
- package/dist/SemanticMemory.mjs +0 -10
- package/dist/SemanticMemory.mjs.map +0 -1
- package/dist/SemanticMemoryIndex.d.mts +0 -5
- package/dist/SemanticMemoryIndex.mjs +0 -10
- package/dist/SemanticMemoryIndex.mjs.map +0 -1
- package/dist/SemanticMemoryRevalidation.d.mts +0 -5
- package/dist/SemanticMemoryRevalidation.mjs +0 -10
- package/dist/SemanticMemoryRevalidation.mjs.map +0 -1
- package/dist/Subagent.d.mts +0 -5
- package/dist/Subagent.mjs +0 -10
- package/dist/Subagent.mjs.map +0 -1
- package/dist/SubagentContract.d.mts +0 -5
- package/dist/SubagentContract.mjs +0 -10
- package/dist/SubagentContract.mjs.map +0 -1
- package/dist/SubagentHost.d.mts +0 -5
- package/dist/SubagentHost.mjs +0 -10
- package/dist/SubagentHost.mjs.map +0 -1
- package/dist/SubagentReservations.d.mts +0 -5
- package/dist/SubagentReservations.mjs +0 -10
- package/dist/SubagentReservations.mjs.map +0 -1
- package/dist/ThreadHistory.d.mts +0 -5
- package/dist/ThreadHistory.mjs +0 -10
- package/dist/ThreadHistory.mjs.map +0 -1
- package/dist/ToolBroker.d.mts +0 -5
- package/dist/ToolBroker.mjs +0 -10
- package/dist/ToolBroker.mjs.map +0 -1
- package/dist/ToolDiscovery.d.mts +0 -5
- package/dist/ToolDiscovery.mjs +0 -10
- package/dist/ToolDiscovery.mjs.map +0 -1
- package/dist/ToolResult.d.mts +0 -5
- package/dist/ToolResult.mjs +0 -10
- package/dist/ToolResult.mjs.map +0 -1
- package/dist/Usage.d.mts +0 -5
- package/dist/Usage.mjs +0 -10
- package/dist/Usage.mjs.map +0 -1
- package/dist/WebCapture.d.mts +0 -5
- package/dist/WebCapture.mjs +0 -10
- package/dist/WebCapture.mjs.map +0 -1
- package/dist/WebSearch.d.mts +0 -5
- package/dist/WebSearch.mjs +0 -10
- package/dist/WebSearch.mjs.map +0 -1
- package/dist/Worker.d.mts +0 -5
- package/dist/Worker.mjs +0 -10
- package/dist/Worker.mjs.map +0 -1
- package/dist/rolldown-runtime-BBjsoOtd.mjs +0 -27
- package/src/Agent.ts +0 -1
- package/src/AgentError.ts +0 -1
- package/src/AgentPolicy.ts +0 -1
- package/src/AgentRuntime.ts +0 -1
- package/src/AgentUpdates.ts +0 -1
- package/src/Approval.ts +0 -1
- package/src/Budget.ts +0 -1
- package/src/CodeMode.ts +0 -1
- package/src/Commands.ts +0 -1
- package/src/Compaction.ts +0 -1
- package/src/ContextCompactor.ts +0 -1
- package/src/ContextHistory.ts +0 -1
- package/src/ContextTools.ts +0 -1
- package/src/ContextWindow.ts +0 -1
- package/src/DurableStep.ts +0 -1
- package/src/EphemeralThreads.ts +0 -1
- package/src/IdGenerator.ts +0 -1
- package/src/Identifiers.ts +0 -1
- package/src/Mcp.ts +0 -1
- package/src/McpClient.ts +0 -1
- package/src/Memory.ts +0 -1
- package/src/MemoryNamespace.ts +0 -1
- package/src/MemoryNotes.ts +0 -1
- package/src/MemoryReference.ts +0 -1
- package/src/MemoryRevalidation.ts +0 -1
- package/src/MemoryStore.ts +0 -1
- package/src/Messaging.ts +0 -1
- package/src/MessagingHost.ts +0 -1
- package/src/ModelContext.ts +0 -1
- package/src/Receipt.ts +0 -1
- package/src/Redaction.ts +0 -1
- package/src/Remembering.ts +0 -1
- package/src/RememberingStore.ts +0 -1
- package/src/RunEvent.ts +0 -1
- package/src/RunEventSink.ts +0 -1
- package/src/RunHooks.ts +0 -1
- package/src/RunOptions.ts +0 -1
- package/src/RunPolicyUsage.ts +0 -1
- package/src/SemanticMemory.ts +0 -1
- package/src/SemanticMemoryIndex.ts +0 -1
- package/src/SemanticMemoryRevalidation.ts +0 -1
- package/src/Subagent.ts +0 -1
- package/src/SubagentContract.ts +0 -1
- package/src/SubagentHost.ts +0 -1
- package/src/SubagentReservations.ts +0 -1
- package/src/ThreadHistory.ts +0 -1
- package/src/ToolBroker.ts +0 -1
- package/src/ToolDiscovery.ts +0 -1
- package/src/ToolResult.ts +0 -1
- package/src/Usage.ts +0 -1
- package/src/WebCapture.ts +0 -1
- package/src/WebSearch.ts +0 -1
- package/src/Worker.ts +0 -1
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
import { Context, Encoding, Option, Predicate, Schema, type Effect } from "effect";
|
|
2
|
+
|
|
3
|
+
import { SANDBOX_DIAGNOSTIC_MAX_LENGTH, SandboxImplementation } from "./Sandbox.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Page capture (capability spec §9.2): one stateless, schema-first rendering
|
|
7
|
+
* pass over a remote or supplied page — navigate (or load raw HTML), render
|
|
8
|
+
* with JavaScript, and return exactly one bounded output. It is a sibling of
|
|
9
|
+
* the command-shaped `Sandbox` and callback-shaped `CodeExecutor` ports: a
|
|
10
|
+
* browser is intrinsically an egress device, so it carries its own explicit
|
|
11
|
+
* capture contract instead of widening the sandbox network policy that every
|
|
12
|
+
* existing adapter rejects.
|
|
13
|
+
*
|
|
14
|
+
* Everything a capture returns is untrusted, attacker-influenced content
|
|
15
|
+
* (security spec §9). Stateful browser sessions, screenshots, PDFs, snapshot
|
|
16
|
+
* bundles, crawling, and accessibility trees are deliberately outside this
|
|
17
|
+
* port's first slice.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
21
|
+
const MAX_LINKS = 4_096;
|
|
22
|
+
const MAX_SCRAPE_SELECTORS = 64;
|
|
23
|
+
const MAX_SCRAPE_ELEMENTS = 4_096;
|
|
24
|
+
const MAX_SCRAPE_ATTRIBUTES = 64;
|
|
25
|
+
const MAX_RESPONSE_FORMAT_BYTES = 64 * 1024;
|
|
26
|
+
const MAX_RESPONSE_FORMAT_DEPTH = 32;
|
|
27
|
+
const MAX_RESPONSE_FORMAT_NODES = 4_096;
|
|
28
|
+
const MAX_RESPONSE_FORMAT_COLLECTION_LENGTH = 256;
|
|
29
|
+
// Schema `isMaxLength` counts UTF-16 elements: these are transport sanity
|
|
30
|
+
// bounds. The authoritative byte budget is `PageCaptureLimits.maxOutputBytes`,
|
|
31
|
+
// which adapters enforce on the UTF-8 encoded response.
|
|
32
|
+
const BoundedOutputText = Schema.String.check(Schema.isMaxLength(MAX_OUTPUT_BYTES));
|
|
33
|
+
const BoundedUrl = Schema.NonEmptyString.check(Schema.isMaxLength(8 * 1024));
|
|
34
|
+
const BoundedHtml = Schema.NonEmptyString.check(Schema.isMaxLength(2 * 1024 * 1024));
|
|
35
|
+
const BoundedPrompt = Schema.NonEmptyString.check(Schema.isMaxLength(8 * 1024));
|
|
36
|
+
const BoundedSelector = Schema.NonEmptyString.check(Schema.isMaxLength(1_024));
|
|
37
|
+
const BoundedAttributeName = Schema.NonEmptyString.check(Schema.isMaxLength(1_024));
|
|
38
|
+
const BoundedAttributeValue = Schema.String.check(Schema.isMaxLength(64 * 1_024));
|
|
39
|
+
const BoundedScrapeText = Schema.String.check(Schema.isMaxLength(1024 * 1_024));
|
|
40
|
+
const BoundedScrapeHtml = Schema.String.check(Schema.isMaxLength(2 * 1024 * 1_024));
|
|
41
|
+
const BoundedPattern = Schema.NonEmptyString.check(Schema.isMaxLength(1_024));
|
|
42
|
+
const BoundedMessage = Schema.String.check(Schema.isMaxLength(SANDBOX_DIAGNOSTIC_MAX_LENGTH));
|
|
43
|
+
const BoundedInferenceProvider = Schema.NonEmptyString.check(Schema.isMaxLength(256));
|
|
44
|
+
const BoundedSchemaProperty = Schema.NonEmptyString.check(Schema.isMaxLength(256));
|
|
45
|
+
const BoundedSchemaText = Schema.String.check(Schema.isMaxLength(8 * 1024));
|
|
46
|
+
const BoundedSchemaReference = Schema.NonEmptyString.check(Schema.isMaxLength(8 * 1024));
|
|
47
|
+
const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));
|
|
48
|
+
/** Bounded by the platform's 60-second browser inactivity ceiling. */
|
|
49
|
+
const BoundedTimeoutMillis = PositiveInt.check(Schema.isLessThanOrEqualTo(60_000));
|
|
50
|
+
|
|
51
|
+
const decodeUrl = Schema.decodeUnknownOption(Schema.URLFromString);
|
|
52
|
+
|
|
53
|
+
const isCredentialFreeWebUrl = (value: string, allowHttp: boolean): boolean => {
|
|
54
|
+
const parsed = decodeUrl(value);
|
|
55
|
+
|
|
56
|
+
if (Option.isNone(parsed)) return false;
|
|
57
|
+
const url = parsed.value;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
(url.protocol === "https:" || (allowHttp && url.protocol === "http:")) &&
|
|
61
|
+
url.hostname.length > 0 &&
|
|
62
|
+
url.username === "" &&
|
|
63
|
+
url.password === ""
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** Absolute, bounded HTTPS navigation URL that never carries embedded credentials. */
|
|
68
|
+
export const PageCaptureTargetUrl = BoundedUrl.check(
|
|
69
|
+
Schema.makeFilter((value) => isCredentialFreeWebUrl(value, false), {
|
|
70
|
+
title: "an absolute HTTPS URL without embedded credentials",
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
export type PageCaptureTargetUrl = typeof PageCaptureTargetUrl.Type;
|
|
75
|
+
|
|
76
|
+
/** Discovered HTTP(S) links are data, never navigation authority, and carry no credentials. */
|
|
77
|
+
export const PageCaptureLinkUrl = BoundedUrl.check(
|
|
78
|
+
Schema.makeFilter((value) => isCredentialFreeWebUrl(value, true), {
|
|
79
|
+
title: "an absolute HTTP or HTTPS URL without embedded credentials",
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export type PageCaptureLinkUrl = typeof PageCaptureLinkUrl.Type;
|
|
84
|
+
|
|
85
|
+
const ResponseFormatPrimitive = Schema.Literals([
|
|
86
|
+
"string",
|
|
87
|
+
"number",
|
|
88
|
+
"boolean",
|
|
89
|
+
"array",
|
|
90
|
+
"object",
|
|
91
|
+
"null",
|
|
92
|
+
"integer",
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
const ResponseFormatPrimitiveList = Schema.Array(ResponseFormatPrimitive).check(
|
|
96
|
+
Schema.isMinLength(1),
|
|
97
|
+
Schema.isMaxLength(7),
|
|
98
|
+
Schema.isUnique(),
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
type ResponseFormatNode = Schema.JsonObject & {
|
|
102
|
+
readonly $schema?: string | undefined;
|
|
103
|
+
readonly $id?: string | undefined;
|
|
104
|
+
readonly $ref?: string | undefined;
|
|
105
|
+
readonly $anchor?: string | undefined;
|
|
106
|
+
readonly $dynamicRef?: string | undefined;
|
|
107
|
+
readonly $dynamicAnchor?: string | undefined;
|
|
108
|
+
readonly $comment?: string | undefined;
|
|
109
|
+
readonly title?: string | undefined;
|
|
110
|
+
readonly description?: string | undefined;
|
|
111
|
+
readonly default?: Schema.Json | undefined;
|
|
112
|
+
readonly deprecated?: boolean | undefined;
|
|
113
|
+
readonly readOnly?: boolean | undefined;
|
|
114
|
+
readonly writeOnly?: boolean | undefined;
|
|
115
|
+
readonly examples?: ReadonlyArray<Schema.Json> | undefined;
|
|
116
|
+
readonly type?:
|
|
117
|
+
| typeof ResponseFormatPrimitive.Type
|
|
118
|
+
| typeof ResponseFormatPrimitiveList.Type
|
|
119
|
+
| undefined;
|
|
120
|
+
readonly enum?: ReadonlyArray<Schema.Json> | undefined;
|
|
121
|
+
readonly const?: Schema.Json | undefined;
|
|
122
|
+
readonly multipleOf?: number | undefined;
|
|
123
|
+
readonly maximum?: number | undefined;
|
|
124
|
+
readonly exclusiveMaximum?: number | undefined;
|
|
125
|
+
readonly minimum?: number | undefined;
|
|
126
|
+
readonly exclusiveMinimum?: number | undefined;
|
|
127
|
+
readonly maxLength?: number | undefined;
|
|
128
|
+
readonly minLength?: number | undefined;
|
|
129
|
+
readonly pattern?: string | undefined;
|
|
130
|
+
readonly format?: string | undefined;
|
|
131
|
+
readonly maxItems?: number | undefined;
|
|
132
|
+
readonly minItems?: number | undefined;
|
|
133
|
+
readonly uniqueItems?: boolean | undefined;
|
|
134
|
+
readonly prefixItems?: ReadonlyArray<ResponseFormatNode> | undefined;
|
|
135
|
+
readonly properties?: Readonly<Record<string, ResponseFormatNode>> | undefined;
|
|
136
|
+
readonly patternProperties?: Readonly<Record<string, ResponseFormatNode>> | undefined;
|
|
137
|
+
readonly required?: ReadonlyArray<string> | undefined;
|
|
138
|
+
readonly dependentRequired?: Readonly<Record<string, ReadonlyArray<string>>> | undefined;
|
|
139
|
+
readonly dependentSchemas?: Readonly<Record<string, ResponseFormatNode>> | undefined;
|
|
140
|
+
readonly items?: ResponseFormatNode | boolean | undefined;
|
|
141
|
+
readonly additionalItems?: ResponseFormatNode | boolean | undefined;
|
|
142
|
+
readonly unevaluatedItems?: ResponseFormatNode | boolean | undefined;
|
|
143
|
+
readonly contains?: ResponseFormatNode | boolean | undefined;
|
|
144
|
+
readonly minContains?: number | undefined;
|
|
145
|
+
readonly maxContains?: number | undefined;
|
|
146
|
+
readonly additionalProperties?: ResponseFormatNode | boolean | undefined;
|
|
147
|
+
readonly unevaluatedProperties?: ResponseFormatNode | boolean | undefined;
|
|
148
|
+
readonly propertyNames?: ResponseFormatNode | boolean | undefined;
|
|
149
|
+
readonly minProperties?: number | undefined;
|
|
150
|
+
readonly maxProperties?: number | undefined;
|
|
151
|
+
readonly anyOf?: ReadonlyArray<ResponseFormatNode> | undefined;
|
|
152
|
+
readonly oneOf?: ReadonlyArray<ResponseFormatNode> | undefined;
|
|
153
|
+
readonly allOf?: ReadonlyArray<ResponseFormatNode> | undefined;
|
|
154
|
+
readonly not?: ResponseFormatNode | boolean | undefined;
|
|
155
|
+
readonly contentEncoding?: string | undefined;
|
|
156
|
+
readonly contentMediaType?: string | undefined;
|
|
157
|
+
readonly contentSchema?: ResponseFormatNode | boolean | undefined;
|
|
158
|
+
readonly $defs?: Readonly<Record<string, ResponseFormatNode>> | undefined;
|
|
159
|
+
readonly definitions?: Readonly<Record<string, ResponseFormatNode>> | undefined;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const ResponseFormatNode: Schema.Codec<ResponseFormatNode> = Schema.suspend(
|
|
163
|
+
(): Schema.Codec<ResponseFormatNode> =>
|
|
164
|
+
Schema.Struct(responseFormatFields()).pipe(
|
|
165
|
+
Schema.annotate({ parseOptions: { onExcessProperty: "error" } }),
|
|
166
|
+
),
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const responseFormatFields = () => {
|
|
170
|
+
const boundedNodes = Schema.Array(ResponseFormatNode).check(
|
|
171
|
+
Schema.isMinLength(1),
|
|
172
|
+
Schema.isMaxLength(MAX_RESPONSE_FORMAT_COLLECTION_LENGTH),
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
const boundedDefinitions = Schema.Record(BoundedSchemaProperty, ResponseFormatNode).check(
|
|
176
|
+
Schema.isMaxProperties(MAX_RESPONSE_FORMAT_COLLECTION_LENGTH),
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const boundedRequired = Schema.Array(BoundedSchemaProperty).check(
|
|
180
|
+
Schema.isMaxLength(MAX_RESPONSE_FORMAT_COLLECTION_LENGTH),
|
|
181
|
+
Schema.isUnique(),
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const subschema = Schema.Union([Schema.Boolean, ResponseFormatNode]);
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
$schema: Schema.optionalKey(BoundedSchemaReference),
|
|
188
|
+
$id: Schema.optionalKey(BoundedSchemaReference),
|
|
189
|
+
$ref: Schema.optionalKey(BoundedSchemaReference),
|
|
190
|
+
$anchor: Schema.optionalKey(BoundedSchemaReference),
|
|
191
|
+
$dynamicRef: Schema.optionalKey(BoundedSchemaReference),
|
|
192
|
+
$dynamicAnchor: Schema.optionalKey(BoundedSchemaReference),
|
|
193
|
+
$comment: Schema.optionalKey(BoundedSchemaText),
|
|
194
|
+
title: Schema.optionalKey(BoundedSchemaText),
|
|
195
|
+
description: Schema.optionalKey(BoundedSchemaText),
|
|
196
|
+
default: Schema.optionalKey(Schema.Json),
|
|
197
|
+
deprecated: Schema.optionalKey(Schema.Boolean),
|
|
198
|
+
readOnly: Schema.optionalKey(Schema.Boolean),
|
|
199
|
+
writeOnly: Schema.optionalKey(Schema.Boolean),
|
|
200
|
+
examples: Schema.optionalKey(
|
|
201
|
+
Schema.Array(Schema.Json).check(Schema.isMaxLength(MAX_RESPONSE_FORMAT_COLLECTION_LENGTH)),
|
|
202
|
+
),
|
|
203
|
+
type: Schema.optionalKey(Schema.Union([ResponseFormatPrimitive, ResponseFormatPrimitiveList])),
|
|
204
|
+
enum: Schema.optionalKey(
|
|
205
|
+
Schema.Array(Schema.Json).check(
|
|
206
|
+
Schema.isMinLength(1),
|
|
207
|
+
Schema.isMaxLength(MAX_RESPONSE_FORMAT_COLLECTION_LENGTH),
|
|
208
|
+
Schema.isUnique(),
|
|
209
|
+
),
|
|
210
|
+
),
|
|
211
|
+
const: Schema.optionalKey(Schema.Json),
|
|
212
|
+
multipleOf: Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThan(0))),
|
|
213
|
+
maximum: Schema.optionalKey(Schema.Finite),
|
|
214
|
+
exclusiveMaximum: Schema.optionalKey(Schema.Finite),
|
|
215
|
+
minimum: Schema.optionalKey(Schema.Finite),
|
|
216
|
+
exclusiveMinimum: Schema.optionalKey(Schema.Finite),
|
|
217
|
+
maxLength: Schema.optionalKey(Schema.Natural),
|
|
218
|
+
minLength: Schema.optionalKey(Schema.Natural),
|
|
219
|
+
pattern: Schema.optionalKey(BoundedSchemaText),
|
|
220
|
+
format: Schema.optionalKey(BoundedSchemaText),
|
|
221
|
+
maxItems: Schema.optionalKey(Schema.Natural),
|
|
222
|
+
minItems: Schema.optionalKey(Schema.Natural),
|
|
223
|
+
uniqueItems: Schema.optionalKey(Schema.Boolean),
|
|
224
|
+
prefixItems: Schema.optionalKey(boundedNodes),
|
|
225
|
+
items: Schema.optionalKey(subschema),
|
|
226
|
+
additionalItems: Schema.optionalKey(subschema),
|
|
227
|
+
unevaluatedItems: Schema.optionalKey(subschema),
|
|
228
|
+
contains: Schema.optionalKey(subschema),
|
|
229
|
+
minContains: Schema.optionalKey(Schema.Natural),
|
|
230
|
+
maxContains: Schema.optionalKey(Schema.Natural),
|
|
231
|
+
properties: Schema.optionalKey(boundedDefinitions),
|
|
232
|
+
patternProperties: Schema.optionalKey(boundedDefinitions),
|
|
233
|
+
required: Schema.optionalKey(boundedRequired),
|
|
234
|
+
dependentRequired: Schema.optionalKey(
|
|
235
|
+
Schema.Record(BoundedSchemaProperty, boundedRequired).check(
|
|
236
|
+
Schema.isMaxProperties(MAX_RESPONSE_FORMAT_COLLECTION_LENGTH),
|
|
237
|
+
),
|
|
238
|
+
),
|
|
239
|
+
dependentSchemas: Schema.optionalKey(boundedDefinitions),
|
|
240
|
+
additionalProperties: Schema.optionalKey(subschema),
|
|
241
|
+
unevaluatedProperties: Schema.optionalKey(subschema),
|
|
242
|
+
propertyNames: Schema.optionalKey(subschema),
|
|
243
|
+
minProperties: Schema.optionalKey(Schema.Natural),
|
|
244
|
+
maxProperties: Schema.optionalKey(Schema.Natural),
|
|
245
|
+
anyOf: Schema.optionalKey(boundedNodes),
|
|
246
|
+
oneOf: Schema.optionalKey(boundedNodes),
|
|
247
|
+
allOf: Schema.optionalKey(boundedNodes),
|
|
248
|
+
not: Schema.optionalKey(subschema),
|
|
249
|
+
contentEncoding: Schema.optionalKey(BoundedSchemaText),
|
|
250
|
+
contentMediaType: Schema.optionalKey(BoundedSchemaText),
|
|
251
|
+
contentSchema: Schema.optionalKey(subschema),
|
|
252
|
+
$defs: Schema.optionalKey(boundedDefinitions),
|
|
253
|
+
definitions: Schema.optionalKey(boundedDefinitions),
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const ResponseFormatDocument = Schema.Struct({
|
|
258
|
+
...responseFormatFields(),
|
|
259
|
+
type: Schema.Literal("object"),
|
|
260
|
+
}).pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } }));
|
|
261
|
+
|
|
262
|
+
const isResponseFormatDocument = Schema.is(ResponseFormatDocument);
|
|
263
|
+
|
|
264
|
+
/** Preflight graph bounds before recursively decoding an untrusted JSON Schema. */
|
|
265
|
+
const isBoundedResponseFormat = (input: unknown): input is typeof ResponseFormatDocument.Type => {
|
|
266
|
+
if (!Predicate.isObject(input)) return false;
|
|
267
|
+
|
|
268
|
+
const pending: Array<{ readonly value: unknown; readonly depth: number }> = [
|
|
269
|
+
{ value: input, depth: 0 },
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
const visited = new WeakSet<object>();
|
|
273
|
+
let nodes = 0;
|
|
274
|
+
let textUnits = 0;
|
|
275
|
+
|
|
276
|
+
try {
|
|
277
|
+
while (pending.length > 0) {
|
|
278
|
+
const current = pending.pop();
|
|
279
|
+
|
|
280
|
+
if (
|
|
281
|
+
current === undefined ||
|
|
282
|
+
current.depth > MAX_RESPONSE_FORMAT_DEPTH ||
|
|
283
|
+
++nodes > MAX_RESPONSE_FORMAT_NODES
|
|
284
|
+
) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const value = current.value;
|
|
289
|
+
|
|
290
|
+
if (value === null || typeof value === "boolean") continue;
|
|
291
|
+
if (typeof value === "number") {
|
|
292
|
+
if (!Number.isFinite(value)) return false;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (typeof value === "string") {
|
|
296
|
+
textUnits += value.length;
|
|
297
|
+
if (textUnits > MAX_RESPONSE_FORMAT_BYTES) return false;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (!Predicate.isObjectOrArray(value) || visited.has(value)) return false;
|
|
301
|
+
visited.add(value);
|
|
302
|
+
|
|
303
|
+
const entries = Array.isArray(value)
|
|
304
|
+
? value.map((entry, index) => [index, entry] as const)
|
|
305
|
+
: Object.entries(value);
|
|
306
|
+
|
|
307
|
+
if (entries.length > MAX_RESPONSE_FORMAT_COLLECTION_LENGTH) return false;
|
|
308
|
+
|
|
309
|
+
for (const [key, entry] of entries) {
|
|
310
|
+
textUnits += typeof key === "string" ? key.length : 0;
|
|
311
|
+
if (textUnits > MAX_RESPONSE_FORMAT_BYTES) return false;
|
|
312
|
+
pending.push({ value: entry, depth: current.depth + 1 });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (!isResponseFormatDocument(input)) return false;
|
|
317
|
+
const encoded = JSON.stringify(input);
|
|
318
|
+
|
|
319
|
+
return Encoding.encodeHex(encoded).length / 2 <= MAX_RESPONSE_FORMAT_BYTES;
|
|
320
|
+
} catch {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/** A platform-supported object JSON Schema with bounded depth, entries, nodes, and UTF-8 bytes. */
|
|
326
|
+
export const PageCaptureResponseFormat = Schema.declare(isBoundedResponseFormat, {
|
|
327
|
+
identifier: "@effect-agent/sandbox/PageCaptureResponseFormat",
|
|
328
|
+
description: "An object JSON Schema bounded to 64 KiB, depth 32, and 4096 nodes",
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
export type PageCaptureResponseFormat = typeof PageCaptureResponseFormat.Type;
|
|
332
|
+
|
|
333
|
+
/** Capture a URL after a full render, the common case. */
|
|
334
|
+
export class PageUrlTarget extends Schema.TaggedClass<PageUrlTarget>()("PageUrlTarget", {
|
|
335
|
+
url: PageCaptureTargetUrl,
|
|
336
|
+
}) {}
|
|
337
|
+
|
|
338
|
+
/** Render caller-supplied HTML instead of navigating. */
|
|
339
|
+
export class PageHtmlTarget extends Schema.TaggedClass<PageHtmlTarget>()("PageHtmlTarget", {
|
|
340
|
+
html: BoundedHtml,
|
|
341
|
+
}) {}
|
|
342
|
+
|
|
343
|
+
/** What the pass renders: a navigated URL or raw HTML. */
|
|
344
|
+
export const PageCaptureTarget = Schema.Union([PageUrlTarget, PageHtmlTarget]);
|
|
345
|
+
export type PageCaptureTarget = typeof PageCaptureTarget.Type;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The rendering engine. `chromium` is the full headless browser; `kitesurf`
|
|
349
|
+
* is a lightweight stateless engine an adapter may support for lower-cost
|
|
350
|
+
* captures. An adapter that cannot honor the requested engine
|
|
351
|
+
* rejects it typed rather than silently substituting the other.
|
|
352
|
+
*/
|
|
353
|
+
export const PageCaptureEngine = Schema.Literals(["chromium", "kitesurf"]);
|
|
354
|
+
export type PageCaptureEngine = typeof PageCaptureEngine.Type;
|
|
355
|
+
|
|
356
|
+
/** Return the fully rendered HTML document. */
|
|
357
|
+
export class CapturePageContent extends Schema.TaggedClass<CapturePageContent>()(
|
|
358
|
+
"CapturePageContent",
|
|
359
|
+
{},
|
|
360
|
+
) {}
|
|
361
|
+
|
|
362
|
+
/** Return the rendered page converted to Markdown. */
|
|
363
|
+
export class CapturePageMarkdown extends Schema.TaggedClass<CapturePageMarkdown>()(
|
|
364
|
+
"CapturePageMarkdown",
|
|
365
|
+
{},
|
|
366
|
+
) {}
|
|
367
|
+
|
|
368
|
+
/** Return the hyperlinks discovered on the rendered page. */
|
|
369
|
+
export class CapturePageLinks extends Schema.TaggedClass<CapturePageLinks>()("CapturePageLinks", {
|
|
370
|
+
visibleLinksOnly: Schema.optionalKey(Schema.Boolean),
|
|
371
|
+
}) {}
|
|
372
|
+
|
|
373
|
+
/** Return rendered element records grouped by their requested CSS selector. */
|
|
374
|
+
export class CapturePageScrape extends Schema.TaggedClass<CapturePageScrape>()(
|
|
375
|
+
"CapturePageScrape",
|
|
376
|
+
{
|
|
377
|
+
selectors: Schema.Array(BoundedSelector).check(
|
|
378
|
+
Schema.isMinLength(1),
|
|
379
|
+
Schema.isMaxLength(MAX_SCRAPE_SELECTORS),
|
|
380
|
+
),
|
|
381
|
+
},
|
|
382
|
+
) {}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Extract structured data from the rendered page. `responseFormat` is a
|
|
386
|
+
* bounded, object-shaped JSON Schema document, typically derived from an
|
|
387
|
+
* Effect Schema. The untrusted result must still be decoded by the caller
|
|
388
|
+
* through the original Effect Schema.
|
|
389
|
+
*/
|
|
390
|
+
export class CapturePageStructured extends Schema.TaggedClass<CapturePageStructured>()(
|
|
391
|
+
"CapturePageStructured",
|
|
392
|
+
{
|
|
393
|
+
responseFormat: PageCaptureResponseFormat,
|
|
394
|
+
prompt: Schema.optionalKey(BoundedPrompt),
|
|
395
|
+
},
|
|
396
|
+
) {}
|
|
397
|
+
|
|
398
|
+
/** Exactly one bounded output per pass. */
|
|
399
|
+
export const PageCaptureAction = Schema.Union([
|
|
400
|
+
CapturePageContent,
|
|
401
|
+
CapturePageMarkdown,
|
|
402
|
+
CapturePageLinks,
|
|
403
|
+
CapturePageScrape,
|
|
404
|
+
CapturePageStructured,
|
|
405
|
+
]);
|
|
406
|
+
|
|
407
|
+
export type PageCaptureAction = typeof PageCaptureAction.Type;
|
|
408
|
+
|
|
409
|
+
/** Wait for one CSS selector to appear before capturing. */
|
|
410
|
+
export class PageSelectorWait extends Schema.Class<PageSelectorWait>("PageSelectorWait")({
|
|
411
|
+
selector: BoundedSelector,
|
|
412
|
+
timeoutMillis: Schema.optionalKey(BoundedTimeoutMillis),
|
|
413
|
+
}) {}
|
|
414
|
+
|
|
415
|
+
/** Navigation and readiness options applied before the capture. */
|
|
416
|
+
export class PageNavigationOptions extends Schema.Class<PageNavigationOptions>(
|
|
417
|
+
"PageNavigationOptions",
|
|
418
|
+
)({
|
|
419
|
+
waitUntil: Schema.optionalKey(
|
|
420
|
+
Schema.Literals(["load", "domcontentloaded", "networkidle0", "networkidle2"]),
|
|
421
|
+
),
|
|
422
|
+
timeoutMillis: Schema.optionalKey(BoundedTimeoutMillis),
|
|
423
|
+
waitForSelector: Schema.optionalKey(PageSelectorWait),
|
|
424
|
+
}) {}
|
|
425
|
+
|
|
426
|
+
/** The rendered viewport. */
|
|
427
|
+
export class PageViewport extends Schema.Class<PageViewport>("PageViewport")({
|
|
428
|
+
width: PositiveInt.check(Schema.isLessThanOrEqualTo(7_680)),
|
|
429
|
+
height: PositiveInt.check(Schema.isLessThanOrEqualTo(7_680)),
|
|
430
|
+
}) {}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Request egress policy for the render. Rejected resource types are never
|
|
434
|
+
* fetched; when request patterns are given, only matching navigation,
|
|
435
|
+
* redirect, and subresource requests are allowed. Calling capabilities own
|
|
436
|
+
* the capture-target allowlist and project it into this policy so rendered
|
|
437
|
+
* JavaScript cannot escape the same construction-time authority.
|
|
438
|
+
*/
|
|
439
|
+
export class PageResourcePolicy extends Schema.Class<PageResourcePolicy>("PageResourcePolicy")({
|
|
440
|
+
rejectResourceTypes: Schema.optionalKey(
|
|
441
|
+
Schema.Array(
|
|
442
|
+
Schema.Literals([
|
|
443
|
+
"document",
|
|
444
|
+
"stylesheet",
|
|
445
|
+
"image",
|
|
446
|
+
"media",
|
|
447
|
+
"font",
|
|
448
|
+
"script",
|
|
449
|
+
"texttrack",
|
|
450
|
+
"xhr",
|
|
451
|
+
"fetch",
|
|
452
|
+
"eventsource",
|
|
453
|
+
"websocket",
|
|
454
|
+
"manifest",
|
|
455
|
+
"other",
|
|
456
|
+
]),
|
|
457
|
+
).check(Schema.isMaxLength(16)),
|
|
458
|
+
),
|
|
459
|
+
allowRequestPatterns: Schema.optionalKey(
|
|
460
|
+
Schema.Array(BoundedPattern).check(Schema.isMaxLength(64)),
|
|
461
|
+
),
|
|
462
|
+
}) {}
|
|
463
|
+
|
|
464
|
+
/** Limits an adapter must either enforce or reject. Bytes are UTF-8 encoded. */
|
|
465
|
+
export class PageCaptureLimits extends Schema.Class<PageCaptureLimits>("PageCaptureLimits")({
|
|
466
|
+
maxOutputBytes: PositiveInt.check(Schema.isLessThanOrEqualTo(MAX_OUTPUT_BYTES)),
|
|
467
|
+
}) {}
|
|
468
|
+
|
|
469
|
+
/** Schema-first page capture request: one target, one action, one output. */
|
|
470
|
+
export class PageCaptureRequest extends Schema.Class<PageCaptureRequest>("PageCaptureRequest")({
|
|
471
|
+
target: PageCaptureTarget,
|
|
472
|
+
action: PageCaptureAction,
|
|
473
|
+
engine: PageCaptureEngine,
|
|
474
|
+
limits: PageCaptureLimits,
|
|
475
|
+
navigation: Schema.optionalKey(PageNavigationOptions),
|
|
476
|
+
viewport: Schema.optionalKey(PageViewport),
|
|
477
|
+
resourcePolicy: Schema.optionalKey(PageResourcePolicy),
|
|
478
|
+
}) {}
|
|
479
|
+
|
|
480
|
+
/** The rendered HTML document. */
|
|
481
|
+
export class PageContentCaptured extends Schema.TaggedClass<PageContentCaptured>()(
|
|
482
|
+
"PageContentCaptured",
|
|
483
|
+
{
|
|
484
|
+
html: BoundedOutputText,
|
|
485
|
+
},
|
|
486
|
+
) {}
|
|
487
|
+
|
|
488
|
+
/** The rendered page as Markdown. */
|
|
489
|
+
export class PageMarkdownCaptured extends Schema.TaggedClass<PageMarkdownCaptured>()(
|
|
490
|
+
"PageMarkdownCaptured",
|
|
491
|
+
{
|
|
492
|
+
markdown: BoundedOutputText,
|
|
493
|
+
},
|
|
494
|
+
) {}
|
|
495
|
+
|
|
496
|
+
/** The hyperlinks discovered on the rendered page. */
|
|
497
|
+
export class PageLinksCaptured extends Schema.TaggedClass<PageLinksCaptured>()(
|
|
498
|
+
"PageLinksCaptured",
|
|
499
|
+
{
|
|
500
|
+
links: Schema.Array(PageCaptureLinkUrl).check(Schema.isMaxLength(MAX_LINKS)),
|
|
501
|
+
},
|
|
502
|
+
) {}
|
|
503
|
+
|
|
504
|
+
/** The extracted structured value; untrusted until decoded by the caller. */
|
|
505
|
+
export class PageStructuredCaptured extends Schema.TaggedClass<PageStructuredCaptured>()(
|
|
506
|
+
"PageStructuredCaptured",
|
|
507
|
+
{
|
|
508
|
+
value: Schema.Json,
|
|
509
|
+
},
|
|
510
|
+
) {}
|
|
511
|
+
|
|
512
|
+
/** One bounded HTML attribute returned by a selector scrape. */
|
|
513
|
+
export class PageScrapeAttribute extends Schema.Class<PageScrapeAttribute>("PageScrapeAttribute")({
|
|
514
|
+
name: BoundedAttributeName,
|
|
515
|
+
value: BoundedAttributeValue,
|
|
516
|
+
}) {}
|
|
517
|
+
|
|
518
|
+
/** One rendered element returned by a selector scrape. */
|
|
519
|
+
export class PageScrapeElement extends Schema.Class<PageScrapeElement>("PageScrapeElement")({
|
|
520
|
+
text: BoundedScrapeText,
|
|
521
|
+
html: BoundedScrapeHtml,
|
|
522
|
+
attributes: Schema.Array(PageScrapeAttribute).check(Schema.isMaxLength(MAX_SCRAPE_ATTRIBUTES)),
|
|
523
|
+
left: Schema.Finite,
|
|
524
|
+
top: Schema.Finite,
|
|
525
|
+
width: Schema.Finite,
|
|
526
|
+
height: Schema.Finite,
|
|
527
|
+
}) {}
|
|
528
|
+
|
|
529
|
+
/** All rendered elements matched by one requested selector. */
|
|
530
|
+
export class PageScrapeGroup extends Schema.Class<PageScrapeGroup>("PageScrapeGroup")({
|
|
531
|
+
selector: BoundedSelector,
|
|
532
|
+
results: Schema.Array(PageScrapeElement).check(Schema.isMaxLength(MAX_SCRAPE_ELEMENTS)),
|
|
533
|
+
}) {}
|
|
534
|
+
|
|
535
|
+
const PageScrapeGroups = Schema.Array(PageScrapeGroup).check(
|
|
536
|
+
Schema.isMaxLength(MAX_SCRAPE_SELECTORS),
|
|
537
|
+
Schema.makeFilter(
|
|
538
|
+
(groups) =>
|
|
539
|
+
groups.reduce((total, group) => total + group.results.length, 0) <= MAX_SCRAPE_ELEMENTS,
|
|
540
|
+
{ title: "at most 4096 aggregate scraped elements" },
|
|
541
|
+
),
|
|
542
|
+
);
|
|
543
|
+
|
|
544
|
+
/** Bounded rendered element records, preserving selector grouping. */
|
|
545
|
+
export class PageScrapeCaptured extends Schema.TaggedClass<PageScrapeCaptured>()(
|
|
546
|
+
"PageScrapeCaptured",
|
|
547
|
+
{
|
|
548
|
+
groups: PageScrapeGroups,
|
|
549
|
+
},
|
|
550
|
+
) {}
|
|
551
|
+
|
|
552
|
+
/** Exactly one output kind per pass, matching the requested action. */
|
|
553
|
+
export const PageCaptureOutput = Schema.Union([
|
|
554
|
+
PageContentCaptured,
|
|
555
|
+
PageMarkdownCaptured,
|
|
556
|
+
PageLinksCaptured,
|
|
557
|
+
PageScrapeCaptured,
|
|
558
|
+
PageStructuredCaptured,
|
|
559
|
+
]);
|
|
560
|
+
|
|
561
|
+
export type PageCaptureOutput = typeof PageCaptureOutput.Type;
|
|
562
|
+
|
|
563
|
+
/** Explicit accounting for model inference performed by a capture adapter. */
|
|
564
|
+
export class PageCaptureInferenceUse extends Schema.Class<PageCaptureInferenceUse>(
|
|
565
|
+
"PageCaptureInferenceUse",
|
|
566
|
+
)({
|
|
567
|
+
provider: BoundedInferenceProvider,
|
|
568
|
+
modelCalls: PositiveInt,
|
|
569
|
+
}) {}
|
|
570
|
+
|
|
571
|
+
/** Accounting an adapter observed for one capture. */
|
|
572
|
+
export class PageCaptureResourceUse extends Schema.Class<PageCaptureResourceUse>(
|
|
573
|
+
"PageCaptureResourceUse",
|
|
574
|
+
)({
|
|
575
|
+
browserMillis: Schema.optionalKey(Schema.Natural),
|
|
576
|
+
inference: Schema.optionalKey(PageCaptureInferenceUse),
|
|
577
|
+
}) {}
|
|
578
|
+
|
|
579
|
+
/** The bounded outcome of one capture pass. */
|
|
580
|
+
export class PageCaptureResult extends Schema.Class<PageCaptureResult>("PageCaptureResult")({
|
|
581
|
+
implementation: SandboxImplementation,
|
|
582
|
+
output: PageCaptureOutput,
|
|
583
|
+
resourceUse: PageCaptureResourceUse,
|
|
584
|
+
}) {}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* The platform refused the pass for rate or quota reasons. `retryAfterMillis`
|
|
588
|
+
* carries the platform's own backoff hint when one exists; retrying earlier
|
|
589
|
+
* only re-fails.
|
|
590
|
+
*/
|
|
591
|
+
export class PageCaptureRateLimitedError extends Schema.TaggedError<PageCaptureRateLimitedError>()(
|
|
592
|
+
"PageCaptureRateLimitedError",
|
|
593
|
+
{
|
|
594
|
+
implementation: SandboxImplementation,
|
|
595
|
+
reason: Schema.Literals(["rate", "quota"]),
|
|
596
|
+
retryAfterMillis: Schema.optionalKey(Schema.Natural),
|
|
597
|
+
message: BoundedMessage,
|
|
598
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
599
|
+
},
|
|
600
|
+
) {}
|
|
601
|
+
|
|
602
|
+
/** Navigation, readiness, or capture of the target page failed. */
|
|
603
|
+
export class PageCaptureNavigationError extends Schema.TaggedError<PageCaptureNavigationError>()(
|
|
604
|
+
"PageCaptureNavigationError",
|
|
605
|
+
{
|
|
606
|
+
implementation: SandboxImplementation,
|
|
607
|
+
message: BoundedMessage,
|
|
608
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
609
|
+
},
|
|
610
|
+
) {}
|
|
611
|
+
|
|
612
|
+
/** Host authorization or accounting blocked provider inference before capture. */
|
|
613
|
+
export class PageCaptureInferencePolicyError extends Schema.TaggedError<PageCaptureInferencePolicyError>()(
|
|
614
|
+
"PageCaptureInferencePolicyError",
|
|
615
|
+
{
|
|
616
|
+
implementation: SandboxImplementation,
|
|
617
|
+
provider: BoundedInferenceProvider,
|
|
618
|
+
reason: Schema.Literals(["authorization", "accounting"]),
|
|
619
|
+
message: BoundedMessage,
|
|
620
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
621
|
+
},
|
|
622
|
+
) {}
|
|
623
|
+
|
|
624
|
+
/** The adapter cannot honestly honor one requested feature (CAP-010 idiom). */
|
|
625
|
+
export class PageCaptureUnsupportedError extends Schema.TaggedError<PageCaptureUnsupportedError>()(
|
|
626
|
+
"PageCaptureUnsupportedError",
|
|
627
|
+
{
|
|
628
|
+
implementation: SandboxImplementation,
|
|
629
|
+
feature: Schema.Literals([
|
|
630
|
+
"engine",
|
|
631
|
+
"action",
|
|
632
|
+
"target",
|
|
633
|
+
"navigation",
|
|
634
|
+
"viewport",
|
|
635
|
+
"resource-policy",
|
|
636
|
+
]),
|
|
637
|
+
message: BoundedMessage,
|
|
638
|
+
},
|
|
639
|
+
) {}
|
|
640
|
+
|
|
641
|
+
/** The response exceeded the request's output byte budget. */
|
|
642
|
+
export class PageCaptureOutputLimitError extends Schema.TaggedError<PageCaptureOutputLimitError>()(
|
|
643
|
+
"PageCaptureOutputLimitError",
|
|
644
|
+
{
|
|
645
|
+
implementation: SandboxImplementation,
|
|
646
|
+
limit: PositiveInt,
|
|
647
|
+
observed: Schema.Natural,
|
|
648
|
+
},
|
|
649
|
+
) {}
|
|
650
|
+
|
|
651
|
+
/** The platform or transport produced a value outside the capture protocol. */
|
|
652
|
+
export class PageCaptureProtocolError extends Schema.TaggedError<PageCaptureProtocolError>()(
|
|
653
|
+
"PageCaptureProtocolError",
|
|
654
|
+
{
|
|
655
|
+
implementation: SandboxImplementation,
|
|
656
|
+
message: BoundedMessage,
|
|
657
|
+
cause: Schema.optionalKey(Schema.Defect()),
|
|
658
|
+
},
|
|
659
|
+
) {}
|
|
660
|
+
|
|
661
|
+
/** Expected capture failures. Interruption stays an Effect interruption. */
|
|
662
|
+
export const PageCaptureError = Schema.Union([
|
|
663
|
+
PageCaptureRateLimitedError,
|
|
664
|
+
PageCaptureNavigationError,
|
|
665
|
+
PageCaptureInferencePolicyError,
|
|
666
|
+
PageCaptureUnsupportedError,
|
|
667
|
+
PageCaptureOutputLimitError,
|
|
668
|
+
PageCaptureProtocolError,
|
|
669
|
+
]);
|
|
670
|
+
|
|
671
|
+
export type PageCaptureError = typeof PageCaptureError.Type;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Stateless page-capture port. One `capture` is one pass: the adapter owns no
|
|
675
|
+
* session, replay, approval, or Thread semantics, identifies its
|
|
676
|
+
* isolation posture honestly (CAP-010), enforces or rejects every requested
|
|
677
|
+
* limit and policy, and returns exactly one bounded output. Capture results
|
|
678
|
+
* are untrusted input to whatever reads them.
|
|
679
|
+
*/
|
|
680
|
+
export class PageCapture extends Context.Service<
|
|
681
|
+
PageCapture,
|
|
682
|
+
{
|
|
683
|
+
readonly capture: (
|
|
684
|
+
request: PageCaptureRequest,
|
|
685
|
+
) => Effect.Effect<PageCaptureResult, PageCaptureError>;
|
|
686
|
+
}
|
|
687
|
+
>()("@effect-agent/sandbox/PageCapture") {}
|
|
688
|
+
|
|
689
|
+
/** Type helper for implementations that preserve the public PageCapture contract. */
|
|
690
|
+
export type PageCaptureCapture = (
|
|
691
|
+
request: PageCaptureRequest,
|
|
692
|
+
) => Effect.Effect<PageCaptureResult, PageCaptureError>;
|