effect-agent 0.1.0-beta.12 → 0.1.0-beta.121
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-1DMSO_Fl.mjs +86 -0
- package/dist/Agent-1DMSO_Fl.mjs.map +1 -0
- package/dist/Agent-D9cXqfF3.d.mts +252 -0
- package/dist/AgentError-Bn1ytXRD.d.mts +117 -0
- package/dist/AgentPolicy-BqDoSXO6.d.mts +96 -0
- package/dist/AgentRuntime-BUxDdLpw.d.mts +346 -0
- package/dist/AgentRuntime-Cp1hAb-W.mjs +4739 -0
- package/dist/AgentRuntime-Cp1hAb-W.mjs.map +1 -0
- package/dist/AgentUpdates-DMJ-_xow.d.mts +53 -0
- package/dist/ContextCompactor-WwSIG_Z2.d.mts +161 -0
- package/dist/ContextWindow-DRQ5Mbm2.d.mts +58 -0
- package/dist/DurableAgentRuntime-B-9w7jDt.mjs +7061 -0
- package/dist/DurableAgentRuntime-B-9w7jDt.mjs.map +1 -0
- package/dist/DurableFailpoint-Cnr3wx1L.d.mts +41 -0
- package/dist/DurableStep-Cry_iol4.d.mts +103 -0
- package/dist/EventSource-CnlZ3Kma.d.mts +51 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs +274 -0
- package/dist/FailureDiagnostic-BElLOoED.mjs.map +1 -0
- package/dist/FailureDiagnostic-CaAkzGHL.d.mts +223 -0
- package/dist/Identifiers-CN2s30fF.d.mts +40 -0
- package/dist/InMemory.d.mts +24 -0
- package/dist/InMemory.mjs +24 -0
- package/dist/InMemory.mjs.map +1 -0
- package/dist/MemoryNamespace-BbRW5p71.d.mts +36 -0
- package/dist/MemoryReference-B8Q3UJoJ.d.mts +79 -0
- package/dist/Messaging-Dkg87ebg.d.mts +221 -0
- package/dist/Messaging-JYYN3oYS.d.mts +1067 -0
- package/dist/MessagingHost-CqzpxbGz.d.mts +74 -0
- package/dist/MessagingHost-DfsbMPvq.mjs +110 -0
- package/dist/MessagingHost-DfsbMPvq.mjs.map +1 -0
- package/dist/OperationAuthorizer-TzcQtpX5.d.mts +61 -0
- package/dist/Output-V-6YL1_Z.d.mts +25 -0
- package/dist/PageCapture-Df8Xwskw.d.mts +583 -0
- package/dist/PageScreenshot-BpgZKAxl.d.mts +48 -0
- package/dist/PreparedInputAdmission-BQLGldl-.d.mts +42 -0
- package/dist/Receipt-BAHyigAF.d.mts +33 -0
- package/dist/Records-D88mgvyS.d.mts +4214 -0
- package/dist/RunEvent-DIrzkjLr.d.mts +460 -0
- package/dist/RunEventSink-D5aVhISG.d.mts +108 -0
- package/dist/RunJournal-BXrq0VIK.mjs +931 -0
- package/dist/RunJournal-BXrq0VIK.mjs.map +1 -0
- package/dist/RunOptions-CSBsSj0X.d.mts +935 -0
- package/dist/RunPolicyUsage-ClZxyR46.d.mts +21 -0
- package/dist/Sandbox-CEsDWBLq.d.mts +173 -0
- package/dist/Schedule-BIOHA6RR.d.mts +847 -0
- package/dist/Scheduling-DPb2QyAK.mjs +691 -0
- package/dist/Scheduling-DPb2QyAK.mjs.map +1 -0
- package/dist/Subagent-CNik9RiA.d.mts +1635 -0
- package/dist/Subagent-DCrB7an7.mjs +1498 -0
- package/dist/Subagent-DCrB7an7.mjs.map +1 -0
- package/dist/SubagentContract-DdT7Cqe6.d.mts +116 -0
- package/dist/SubagentHost-4WB8Hj0C.d.mts +164 -0
- package/dist/Subscription-CRteOKRf.d.mts +948 -0
- package/dist/SubscriptionInput-oNcwTPti.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 +8 -0
- package/dist/ToolExposure.mjs +21 -0
- package/dist/ToolExposure.mjs.map +1 -0
- package/dist/ToolReconciler-BmVRAHKs.d.mts +80 -0
- package/dist/ToolResult-BKdqWRff.d.mts +78 -0
- package/dist/Usage-Dx0aknfk.d.mts +121 -0
- package/dist/WakeScheduler-EjUF-GhC.d.mts +56 -0
- package/dist/Worker-CfwzMZEK.mjs +271 -0
- package/dist/Worker-CfwzMZEK.mjs.map +1 -0
- package/dist/Worker-fwWkBg12.d.mts +472 -0
- package/dist/agent-registration-CKNsrpwo.mjs +201 -0
- package/dist/agent-registration-CKNsrpwo.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 +259 -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 +152 -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 +124 -0
- package/dist/capabilities/ToolDiscovery.mjs +230 -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 +115 -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 +134 -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/FailureDiagnostic.d.mts +2 -0
- package/dist/core/FailureDiagnostic.mjs +2 -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 +156 -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 +3 -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 +330 -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 +110 -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 +102 -0
- package/dist/durable/DurableFailpoint.mjs.map +1 -0
- package/dist/durable/DurableFailpointTestControl.d.mts +14 -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 +185 -0
- package/dist/durable/GitHubWorkflowSource.mjs +209 -0
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -0
- package/dist/durable/MessageDelivery.d.mts +893 -0
- package/dist/durable/MessageDelivery.mjs +557 -0
- package/dist/durable/MessageDelivery.mjs.map +1 -0
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +378 -0
- package/dist/durable/MessageDeliveryStoreConformance.mjs +270 -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 +38 -0
- package/dist/durable/PreparedInputAdmission.mjs.map +1 -0
- package/dist/durable/Records.d.mts +2 -0
- package/dist/durable/Records.mjs +848 -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 +391 -0
- package/dist/durable/Schedule.mjs.map +1 -0
- package/dist/durable/ScheduleStoreConformance.d.mts +17 -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 +29 -0
- package/dist/durable/SqlMemoryStore.mjs +436 -0
- package/dist/durable/SqlMemoryStore.mjs.map +1 -0
- package/dist/durable/SqlMessageDeliveryStore.d.mts +42 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs +179 -0
- package/dist/durable/SqlMessageDeliveryStore.mjs.map +1 -0
- package/dist/durable/SqlStorageV2Upgrade.d.mts +21 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs +459 -0
- package/dist/durable/SqlStorageV2Upgrade.mjs.map +1 -0
- package/dist/durable/SqlSubscriptionStore.d.mts +62 -0
- package/dist/durable/SqlSubscriptionStore.mjs +751 -0
- package/dist/durable/SqlSubscriptionStore.mjs.map +1 -0
- package/dist/durable/SqlThreadNativeReads.d.mts +53 -0
- package/dist/durable/SqlThreadNativeReads.mjs +159 -0
- package/dist/durable/SqlThreadNativeReads.mjs.map +1 -0
- package/dist/durable/SubmissionLedger.d.mts +3 -0
- package/dist/durable/SubmissionLedger.mjs +959 -0
- package/dist/durable/SubmissionLedger.mjs.map +1 -0
- package/dist/durable/SubmissionLedgerConformance.d.mts +29 -0
- package/dist/durable/SubmissionLedgerConformance.mjs +2187 -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 +16 -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 +76 -0
- package/dist/durable/ThreadInvariants.mjs +246 -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 +355 -0
- package/dist/durable/ThreadStore.mjs.map +1 -0
- package/dist/durable/ThreadStoreConformance.d.mts +28 -0
- package/dist/durable/ThreadStoreConformance.mjs +503 -0
- package/dist/durable/ThreadStoreConformance.mjs.map +1 -0
- package/dist/durable/ToolReconciler.d.mts +2 -0
- package/dist/durable/ToolReconciler.mjs +85 -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 +124 -0
- package/dist/engine/RunOptions.mjs.map +1 -0
- package/dist/engine/SubagentHost.d.mts +2 -0
- package/dist/engine/SubagentHost.mjs +76 -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 +91 -6
- package/dist/index.mjs +100 -6
- 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 +257 -0
- package/dist/sandbox/InteractiveBrowser.mjs +236 -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 +283 -0
- package/dist/sandbox/ProtectedBrowser.mjs +298 -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 -40
- package/src/InMemory.ts +19 -0
- package/src/ToolExposure.ts +2 -0
- 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 +426 -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 +2489 -0
- package/src/capabilities/SubagentReservations.ts +850 -0
- package/src/capabilities/ToolDiscovery.ts +369 -0
- package/src/capabilities/WebCapture.ts +722 -0
- package/src/capabilities/WebSearch.ts +190 -0
- package/src/capabilities/internal/subagent-background.ts +1273 -0
- package/src/capabilities/internal/subagent-contract.ts +146 -0
- package/src/capabilities/internal/subagent-policy.ts +235 -0
- package/src/capabilities/internal/subagent-reporting.ts +136 -0
- package/src/capabilities/internal/utf8.ts +10 -0
- package/src/core/Agent.ts +602 -0
- package/src/core/AgentError.ts +172 -0
- package/src/core/AgentPolicy.ts +153 -0
- package/src/core/AgentUpdates.ts +100 -0
- package/src/core/FailureDiagnostic.ts +343 -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 +72 -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 +190 -0
- package/src/core/Usage.ts +529 -0
- package/src/core/Worker.ts +240 -0
- package/src/core/internal/agent-updates.ts +34 -0
- package/src/core/internal/message-status.ts +60 -0
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/core/internal/utf8.ts +23 -0
- package/src/durable/ActivityStore.ts +160 -0
- package/src/durable/Admin.ts +505 -0
- package/src/durable/AgentRegistration.ts +14 -0
- package/src/durable/Certification.ts +210 -0
- package/src/durable/CommittedActivity.ts +296 -0
- package/src/durable/Digest.ts +87 -0
- package/src/durable/DurableAgentRuntime.ts +11275 -0
- package/src/durable/DurableFailpoint.ts +111 -0
- package/src/durable/DurableFailpointTestControl.ts +39 -0
- package/src/durable/EventSource.ts +172 -0
- package/src/durable/GitHubWorkflowSource.ts +447 -0
- package/src/durable/MessageDelivery.ts +832 -0
- package/src/durable/MessageDeliveryStoreConformance.ts +410 -0
- package/src/durable/OperationAuthorizer.ts +85 -0
- package/src/durable/PersistentHistory.ts +260 -0
- package/src/durable/PreparedInputAdmission.ts +57 -0
- package/src/durable/Records.ts +1075 -0
- package/src/durable/Recovery.ts +1018 -0
- package/src/durable/RunJournal.ts +1631 -0
- package/src/durable/Schedule.ts +513 -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 +778 -0
- package/src/durable/SqlMessageDeliveryStore.ts +335 -0
- package/src/durable/SqlStorageV2Upgrade.ts +500 -0
- package/src/durable/SqlSubscriptionStore.ts +1440 -0
- package/src/durable/SqlThreadNativeReads.ts +270 -0
- package/src/durable/SubmissionLedger.ts +1265 -0
- package/src/durable/SubmissionLedgerConformance.ts +4820 -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 +507 -0
- package/src/durable/ThreadProjection.ts +269 -0
- package/src/durable/ThreadProjectionMaintenance.ts +67 -0
- package/src/durable/ThreadStore.ts +573 -0
- package/src/durable/ThreadStoreConformance.ts +1156 -0
- package/src/durable/ToolReconciler.ts +109 -0
- package/src/durable/WakeScheduler.ts +134 -0
- package/src/durable/WorkerHost.ts +171 -0
- package/src/durable/internal/agent-registration.ts +587 -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 +117 -0
- package/src/durable/internal/message-status.ts +20 -0
- package/src/durable/internal/messaging-host.ts +637 -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 +2885 -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 +1101 -0
- package/src/engine/SubagentHost.ts +230 -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 +10500 -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 +99 -21
- package/src/sandbox/CodeExecutor.ts +352 -0
- package/src/sandbox/InteractiveBrowser.ts +339 -0
- package/src/sandbox/PageCapture.ts +691 -0
- package/src/sandbox/PageCrawl.ts +148 -0
- package/src/sandbox/PageScreenshot.ts +81 -0
- package/src/sandbox/ProtectedBrowser.ts +452 -0
- package/src/sandbox/Sandbox.ts +241 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cause as EffectCause,
|
|
3
|
+
Exit,
|
|
4
|
+
Predicate,
|
|
5
|
+
Redacted,
|
|
6
|
+
Schema,
|
|
7
|
+
SchemaTransformation,
|
|
8
|
+
} from "effect";
|
|
9
|
+
|
|
10
|
+
import { strictSchema } from "./internal/strict-schema.ts";
|
|
11
|
+
|
|
12
|
+
const Text = Schema.String.check(Schema.isMaxLength(16 * 1024));
|
|
13
|
+
const Name = Schema.String.check(Schema.isMaxLength(1_024));
|
|
14
|
+
const Scalar = Schema.Union([Text, Schema.Finite, Schema.Boolean, Schema.Null]);
|
|
15
|
+
|
|
16
|
+
/** Correlation only: never include inputs, tool parameters, request bodies, or credentials. */
|
|
17
|
+
export const Context = Schema.Struct({
|
|
18
|
+
agentId: Schema.optionalKey(Name),
|
|
19
|
+
threadId: Schema.optionalKey(Name),
|
|
20
|
+
runId: Schema.optionalKey(Name),
|
|
21
|
+
submissionId: Schema.optionalKey(Name),
|
|
22
|
+
attemptId: Schema.optionalKey(Name),
|
|
23
|
+
turnId: Schema.optionalKey(Name),
|
|
24
|
+
toolCallId: Schema.optionalKey(Name),
|
|
25
|
+
toolName: Schema.optionalKey(Name),
|
|
26
|
+
callId: Schema.optionalKey(Name),
|
|
27
|
+
check: Schema.optionalKey(Name),
|
|
28
|
+
operation: Schema.optionalKey(Name),
|
|
29
|
+
}).pipe(strictSchema);
|
|
30
|
+
|
|
31
|
+
export type Context = typeof Context.Type;
|
|
32
|
+
|
|
33
|
+
type CauseReason =
|
|
34
|
+
| { readonly _tag: "Fail"; readonly error: Diagnostic }
|
|
35
|
+
| { readonly _tag: "Die"; readonly defect: Diagnostic }
|
|
36
|
+
| { readonly _tag: "Interrupt"; readonly fiberId?: number };
|
|
37
|
+
|
|
38
|
+
/** A private diagnostic projection, not a JavaScript error reconstruction or model response. */
|
|
39
|
+
export type Diagnostic =
|
|
40
|
+
| {
|
|
41
|
+
readonly _tag: "Error";
|
|
42
|
+
readonly errorTag?: string;
|
|
43
|
+
readonly name?: string;
|
|
44
|
+
readonly message?: string;
|
|
45
|
+
readonly stack?: string;
|
|
46
|
+
readonly reason?: Diagnostic;
|
|
47
|
+
readonly code?: string | number;
|
|
48
|
+
readonly cause?: Diagnostic;
|
|
49
|
+
readonly errors?: ReadonlyArray<Diagnostic>;
|
|
50
|
+
readonly context?: Context;
|
|
51
|
+
readonly omittedFields?: ReadonlyArray<string>;
|
|
52
|
+
readonly truncated?: true;
|
|
53
|
+
}
|
|
54
|
+
| {
|
|
55
|
+
readonly _tag: "Cause";
|
|
56
|
+
readonly reasons: ReadonlyArray<CauseReason>;
|
|
57
|
+
readonly truncated?: true;
|
|
58
|
+
}
|
|
59
|
+
| { readonly _tag: "Value"; readonly value: string | number | boolean | null }
|
|
60
|
+
| { readonly _tag: "Omitted"; readonly reason: "redacted" | "cycle" | "limit" | "unsupported" };
|
|
61
|
+
|
|
62
|
+
const diagnosticSchema = <Nested extends Schema.Top>(nested: Nested) =>
|
|
63
|
+
Schema.Union([
|
|
64
|
+
Schema.Struct({
|
|
65
|
+
_tag: Schema.Literal("Error"),
|
|
66
|
+
errorTag: Schema.optionalKey(Name),
|
|
67
|
+
name: Schema.optionalKey(Name),
|
|
68
|
+
message: Schema.optionalKey(Text),
|
|
69
|
+
stack: Schema.optionalKey(Text),
|
|
70
|
+
reason: Schema.optionalKey(nested),
|
|
71
|
+
code: Schema.optionalKey(Schema.Union([Name, Schema.Finite])),
|
|
72
|
+
cause: Schema.optionalKey(nested),
|
|
73
|
+
errors: Schema.optionalKey(Schema.Array(nested).check(Schema.isMaxLength(128))),
|
|
74
|
+
context: Schema.optionalKey(Context),
|
|
75
|
+
omittedFields: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(32))),
|
|
76
|
+
truncated: Schema.optionalKey(Schema.Literal(true)),
|
|
77
|
+
}),
|
|
78
|
+
Schema.Struct({
|
|
79
|
+
_tag: Schema.Literal("Cause"),
|
|
80
|
+
reasons: Schema.Array(
|
|
81
|
+
Schema.Union([
|
|
82
|
+
Schema.Struct({ _tag: Schema.Literal("Fail"), error: nested }),
|
|
83
|
+
Schema.Struct({ _tag: Schema.Literal("Die"), defect: nested }),
|
|
84
|
+
Schema.Struct({
|
|
85
|
+
_tag: Schema.Literal("Interrupt"),
|
|
86
|
+
fiberId: Schema.optionalKey(Schema.Finite),
|
|
87
|
+
}),
|
|
88
|
+
]),
|
|
89
|
+
).check(Schema.isMaxLength(128)),
|
|
90
|
+
truncated: Schema.optionalKey(Schema.Literal(true)),
|
|
91
|
+
}),
|
|
92
|
+
Schema.Struct({ _tag: Schema.Literal("Value"), value: Scalar }),
|
|
93
|
+
Schema.Struct({
|
|
94
|
+
_tag: Schema.Literal("Omitted"),
|
|
95
|
+
reason: Schema.Literals(["redacted", "cycle", "limit", "unsupported"]),
|
|
96
|
+
}),
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
/** Structured, allowlisted Error fields and ordered Effect Fail/Die/Interrupt reasons. */
|
|
100
|
+
export const Diagnostic: Schema.Codec<Diagnostic> = Schema.suspend(() =>
|
|
101
|
+
diagnosticSchema(Diagnostic),
|
|
102
|
+
).pipe(strictSchema);
|
|
103
|
+
|
|
104
|
+
// Inspect one encoded node only; recursion must share capture's depth/node/text budgets.
|
|
105
|
+
const decodeDiagnosticNode = Schema.decodeUnknownExit(
|
|
106
|
+
diagnosticSchema(Schema.Unknown).pipe(strictSchema),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
/** Remove common credential forms; hosts must keep arbitrary private payloads out of error text. */
|
|
110
|
+
export const redactText = (text: string): string =>
|
|
111
|
+
text
|
|
112
|
+
.replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]")
|
|
113
|
+
.replace(/(https?:\/\/)[^\s/@]+:[^\s/@]+@/gi, "$1[REDACTED]@")
|
|
114
|
+
.replace(
|
|
115
|
+
/([?&](?:access_token|api_key|apikey|token|key|secret|password|signature)=)[^\s&#]*/gi,
|
|
116
|
+
"$1[REDACTED]",
|
|
117
|
+
)
|
|
118
|
+
.replace(
|
|
119
|
+
/\b((?:api[_-]?key|access[_-]?token|authorization|password|secret)\s*[=:]\s*)[^\s,;}]+/gi,
|
|
120
|
+
"$1[REDACTED]",
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Capture only diagnostic fields. Local values are never mutated. Cycles and exhausted limits
|
|
125
|
+
* are explicit, not silently dropped; capture visits at most 1,024 nodes, with 56 JSON levels
|
|
126
|
+
* and 128 KiB text. Inner causes have priority over outer stacks when the text budget is exhausted.
|
|
127
|
+
* Text remains operator-private. No generic serializer can identify secrets embedded in arbitrary
|
|
128
|
+
* prose: application error messages must exclude payloads, and hosts may supply stricter redaction.
|
|
129
|
+
*/
|
|
130
|
+
export const capture = (
|
|
131
|
+
value: unknown,
|
|
132
|
+
options?: { readonly redactText?: (text: string) => string },
|
|
133
|
+
): Diagnostic => {
|
|
134
|
+
const seen = new WeakSet<object>();
|
|
135
|
+
let remainingNodes = 1_024;
|
|
136
|
+
let remainingText = 128 * 1024;
|
|
137
|
+
|
|
138
|
+
const text = (value: string, limit = 16 * 1024): string => {
|
|
139
|
+
const safe = (options?.redactText ?? redactText)(value);
|
|
140
|
+
const length = Math.max(0, Math.min(limit, remainingText));
|
|
141
|
+
|
|
142
|
+
const marker = "[truncated]".slice(0, length);
|
|
143
|
+
|
|
144
|
+
const result =
|
|
145
|
+
safe.length <= length ? safe : `${safe.slice(0, length - marker.length)}${marker}`;
|
|
146
|
+
|
|
147
|
+
remainingText -= result.length;
|
|
148
|
+
|
|
149
|
+
return result;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const visit = (value: unknown, depth: number): Diagnostic => {
|
|
153
|
+
if (remainingNodes <= 0 || depth >= 56) return { _tag: "Omitted", reason: "limit" };
|
|
154
|
+
remainingNodes--;
|
|
155
|
+
if (Redacted.isRedacted(value)) return { _tag: "Omitted", reason: "redacted" };
|
|
156
|
+
if (Predicate.isString(value)) return { _tag: "Value", value: text(value) };
|
|
157
|
+
if (
|
|
158
|
+
value === null ||
|
|
159
|
+
Predicate.isBoolean(value) ||
|
|
160
|
+
(Predicate.isNumber(value) && Number.isFinite(value))
|
|
161
|
+
)
|
|
162
|
+
return { _tag: "Value", value };
|
|
163
|
+
if (!Predicate.isObject(value)) return { _tag: "Omitted", reason: "unsupported" };
|
|
164
|
+
if (seen.has(value)) return { _tag: "Omitted", reason: "cycle" };
|
|
165
|
+
seen.add(value);
|
|
166
|
+
const nested = (value: unknown) => visit(value, depth + 1);
|
|
167
|
+
// Local errors retain their own tag, even when it happens to be "Error".
|
|
168
|
+
const decoded = value instanceof Error ? undefined : decodeDiagnosticNode(value);
|
|
169
|
+
const node = decoded !== undefined && Exit.isSuccess(decoded) ? decoded.value : undefined;
|
|
170
|
+
|
|
171
|
+
if (node?._tag === "Omitted" || node?._tag === "Value") {
|
|
172
|
+
seen.delete(value);
|
|
173
|
+
|
|
174
|
+
return node._tag === "Value" && typeof node.value === "string"
|
|
175
|
+
? { _tag: "Value", value: text(node.value) }
|
|
176
|
+
: node;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const originalReasons = EffectCause.isCause(value)
|
|
180
|
+
? value.reasons
|
|
181
|
+
: node?._tag === "Cause"
|
|
182
|
+
? node.reasons
|
|
183
|
+
: undefined;
|
|
184
|
+
|
|
185
|
+
if (originalReasons !== undefined) {
|
|
186
|
+
const reasons: Array<CauseReason> = [];
|
|
187
|
+
|
|
188
|
+
for (const reason of originalReasons) {
|
|
189
|
+
if (reasons.length >= 128 || remainingNodes <= 0) break;
|
|
190
|
+
remainingNodes--;
|
|
191
|
+
|
|
192
|
+
// reasons -> array item -> error/defect contributes three JSON levels.
|
|
193
|
+
switch (reason._tag) {
|
|
194
|
+
case "Fail":
|
|
195
|
+
reasons.push({ _tag: "Fail", error: visit(reason.error, depth + 3) });
|
|
196
|
+
break;
|
|
197
|
+
case "Die":
|
|
198
|
+
reasons.push({ _tag: "Die", defect: visit(reason.defect, depth + 3) });
|
|
199
|
+
break;
|
|
200
|
+
case "Interrupt":
|
|
201
|
+
reasons.push({
|
|
202
|
+
_tag: "Interrupt",
|
|
203
|
+
...(reason.fiberId === undefined ? {} : { fiberId: reason.fiberId }),
|
|
204
|
+
});
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const result: Diagnostic = {
|
|
210
|
+
_tag: "Cause",
|
|
211
|
+
...(originalReasons.length > reasons.length || (node?._tag === "Cause" && node.truncated)
|
|
212
|
+
? { truncated: true }
|
|
213
|
+
: {}),
|
|
214
|
+
reasons,
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
seen.delete(value);
|
|
218
|
+
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
const retained = node?._tag === "Error" ? node : undefined;
|
|
222
|
+
const omittedFields: Array<string> = [];
|
|
223
|
+
|
|
224
|
+
const read = (key: string): unknown => {
|
|
225
|
+
// A throwing accessor must not replace the original failure during diagnostic capture.
|
|
226
|
+
try {
|
|
227
|
+
return Reflect.get(value, key);
|
|
228
|
+
} catch {
|
|
229
|
+
omittedFields.push(key);
|
|
230
|
+
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const tag = retained === undefined ? read("_tag") : retained.errorTag;
|
|
236
|
+
const name = read("name");
|
|
237
|
+
const message = read("message");
|
|
238
|
+
const stack = read("stack");
|
|
239
|
+
const reason = read("reason");
|
|
240
|
+
const code = read("code");
|
|
241
|
+
const cause = read("cause");
|
|
242
|
+
const errors = read("errors");
|
|
243
|
+
const capturedCause = cause === undefined ? undefined : nested(cause);
|
|
244
|
+
const capturedReason = reason === undefined ? undefined : nested(reason);
|
|
245
|
+
const capturedErrors: Array<Diagnostic> = [];
|
|
246
|
+
|
|
247
|
+
if (Array.isArray(errors))
|
|
248
|
+
for (const error of errors) {
|
|
249
|
+
if (capturedErrors.length >= 128 || remainingNodes <= 0) break;
|
|
250
|
+
capturedErrors.push(visit(error, depth + 2));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
for (const field of retained?.omittedFields ?? []) omittedFields.push(text(field, 1_024));
|
|
254
|
+
|
|
255
|
+
const context: Record<string, string> = {};
|
|
256
|
+
|
|
257
|
+
for (const key of [
|
|
258
|
+
"agentId",
|
|
259
|
+
"threadId",
|
|
260
|
+
"runId",
|
|
261
|
+
"submissionId",
|
|
262
|
+
"attemptId",
|
|
263
|
+
"turnId",
|
|
264
|
+
"toolCallId",
|
|
265
|
+
"toolName",
|
|
266
|
+
"callId",
|
|
267
|
+
"check",
|
|
268
|
+
"operation",
|
|
269
|
+
] as const) {
|
|
270
|
+
const field = retained === undefined ? read(key) : retained.context?.[key];
|
|
271
|
+
|
|
272
|
+
if (Predicate.isString(field)) context[key] = text(field, 1_024);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const result: Diagnostic = {
|
|
276
|
+
_tag: "Error",
|
|
277
|
+
...(Predicate.isString(tag) ? { errorTag: text(tag, 1_024) } : {}),
|
|
278
|
+
...(Predicate.isString(name) ? { name: text(name, 1_024) } : {}),
|
|
279
|
+
...(Predicate.isString(message) ? { message: text(message) } : {}),
|
|
280
|
+
...(Predicate.isString(stack) ? { stack: text(stack) } : {}),
|
|
281
|
+
...(capturedReason === undefined ? {} : { reason: capturedReason }),
|
|
282
|
+
...(Predicate.isString(code)
|
|
283
|
+
? { code: text(code, 1_024) }
|
|
284
|
+
: Predicate.isNumber(code) && Number.isFinite(code)
|
|
285
|
+
? { code }
|
|
286
|
+
: {}),
|
|
287
|
+
...(capturedCause === undefined ? {} : { cause: capturedCause }),
|
|
288
|
+
...(Array.isArray(errors) ? { errors: capturedErrors } : {}),
|
|
289
|
+
...(Object.keys(context).length === 0 ? {} : { context }),
|
|
290
|
+
...(omittedFields.length === 0 ? {} : { omittedFields }),
|
|
291
|
+
...(retained?.truncated ||
|
|
292
|
+
(Array.isArray(errors) && errors.length > capturedErrors.length) ||
|
|
293
|
+
remainingText === 0
|
|
294
|
+
? { truncated: true }
|
|
295
|
+
: {}),
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
seen.delete(value);
|
|
299
|
+
|
|
300
|
+
return result;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
return visit(value, 0);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/** Bound and redact a diagnostic copy; canonical identities stay in their owning records. */
|
|
307
|
+
export const captureContext = (context: Context): Context => {
|
|
308
|
+
const diagnostic = capture(context);
|
|
309
|
+
|
|
310
|
+
return diagnostic._tag === "Error" ? (diagnostic.context ?? {}) : {};
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Preserve the original value in-process; across JSON retain its structured diagnostic projection.
|
|
315
|
+
* Decoding returns Diagnostic data, never claims to reconstruct an application error class.
|
|
316
|
+
*/
|
|
317
|
+
export const Value = Diagnostic.pipe(
|
|
318
|
+
Schema.decodeTo(
|
|
319
|
+
Schema.Unknown,
|
|
320
|
+
SchemaTransformation.transform({
|
|
321
|
+
decode: (diagnostic): unknown => diagnostic,
|
|
322
|
+
encode: (value: unknown) => capture(value),
|
|
323
|
+
}),
|
|
324
|
+
),
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
/** Original local Effect Cause; its JSON codec preserves ordered typed, defect and interrupt reasons. */
|
|
328
|
+
export const Cause = Schema.Cause(Value, Value).pipe(
|
|
329
|
+
Schema.decodeTo(
|
|
330
|
+
Schema.declare<EffectCause.Cause<unknown>>(EffectCause.isCause),
|
|
331
|
+
SchemaTransformation.transform({ decode: (cause) => cause, encode: (cause) => cause }),
|
|
332
|
+
),
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
/** Safe summary plus optional operator-private causal evidence retained at a terminal boundary. */
|
|
336
|
+
export const Failure = Schema.Struct({
|
|
337
|
+
errorTag: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
|
|
338
|
+
message: Text,
|
|
339
|
+
diagnostic: Schema.optionalKey(Diagnostic),
|
|
340
|
+
context: Schema.optionalKey(Context),
|
|
341
|
+
}).pipe(strictSchema);
|
|
342
|
+
|
|
343
|
+
export type Failure = typeof Failure.Type;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
import { IdGenerator as EffectAiIdGenerator } from "effect/unstable/ai";
|
|
3
|
+
|
|
4
|
+
import { ThreadId, RunId, TurnId } from "./Identifiers.ts";
|
|
5
|
+
|
|
6
|
+
/** Replaceable authority for creating runtime identities, including deterministic test IDs. */
|
|
7
|
+
export interface Service {
|
|
8
|
+
/** Create the identity for a new thread. */
|
|
9
|
+
readonly nextThreadId: Effect.Effect<ThreadId>;
|
|
10
|
+
/** Create the identity for a new run. */
|
|
11
|
+
readonly nextRunId: Effect.Effect<RunId>;
|
|
12
|
+
/** Create the identity for a new model turn. */
|
|
13
|
+
readonly nextTurnId: Effect.Effect<TurnId>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const defaultGenerator: Service = {
|
|
17
|
+
nextThreadId: EffectAiIdGenerator.defaultIdGenerator
|
|
18
|
+
.generateId()
|
|
19
|
+
.pipe(Effect.map((id) => Schema.decodeSync(ThreadId)(`thread-${id}`))),
|
|
20
|
+
nextRunId: EffectAiIdGenerator.defaultIdGenerator
|
|
21
|
+
.generateId()
|
|
22
|
+
.pipe(Effect.map((id) => Schema.decodeSync(RunId)(`run-${id}`))),
|
|
23
|
+
nextTurnId: EffectAiIdGenerator.defaultIdGenerator
|
|
24
|
+
.generateId()
|
|
25
|
+
.pipe(Effect.map((id) => Schema.decodeSync(TurnId)(`turn-${id}`))),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Runtime identities default to Effect AI's generator without requiring a Layer.
|
|
30
|
+
* Randomness is fiber-local and can be seeded in tests. Override this reference
|
|
31
|
+
* with Layer.succeed/Layer.effect or Effect.provideService for custom identities.
|
|
32
|
+
* The default holds only Effects: it allocates no mutable state or resources.
|
|
33
|
+
*/
|
|
34
|
+
export const IdGenerator = Context.Reference<Service>("@effect-agent/core/IdGenerator", {
|
|
35
|
+
defaultValue: () => defaultGenerator,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/** Explicitly select the default generator, replacing any enclosing override. */
|
|
39
|
+
export const layer: Layer.Layer<never> = Layer.succeed(IdGenerator, defaultGenerator);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
|
|
3
|
+
const identifier = <const Name extends string>(name: Name) =>
|
|
4
|
+
Schema.NonEmptyString.pipe(Schema.brand(`@effect-agent/core/${name}`));
|
|
5
|
+
|
|
6
|
+
/** Stable identity of an agent definition, distinct from a display name. */
|
|
7
|
+
export const AgentId = identifier("AgentId");
|
|
8
|
+
export type AgentId = typeof AgentId.Type;
|
|
9
|
+
|
|
10
|
+
/** Identity shared by runs that participate in one thread history. */
|
|
11
|
+
export const ThreadId = identifier("ThreadId");
|
|
12
|
+
export type ThreadId = typeof ThreadId.Type;
|
|
13
|
+
|
|
14
|
+
/** Identity of one accepted input submission. */
|
|
15
|
+
export const SubmissionId = identifier("SubmissionId");
|
|
16
|
+
export type SubmissionId = typeof SubmissionId.Type;
|
|
17
|
+
|
|
18
|
+
/** Durable identity returned once ledger admission and Thread readiness are committed. */
|
|
19
|
+
export const ReceiptId = identifier("ReceiptId");
|
|
20
|
+
export type ReceiptId = typeof ReceiptId.Type;
|
|
21
|
+
|
|
22
|
+
/** Identity of the single durable terminal outcome owed to one accepted Submission. */
|
|
23
|
+
export const SettlementId = identifier("SettlementId");
|
|
24
|
+
export type SettlementId = typeof SettlementId.Type;
|
|
25
|
+
|
|
26
|
+
/** Identity of one execution ownership period for accepted work. */
|
|
27
|
+
export const AttemptId = identifier("AttemptId");
|
|
28
|
+
export type AttemptId = typeof AttemptId.Type;
|
|
29
|
+
|
|
30
|
+
/** Identity of one logical agent run. */
|
|
31
|
+
export const RunId = identifier("RunId");
|
|
32
|
+
export type RunId = typeof RunId.Type;
|
|
33
|
+
|
|
34
|
+
/** Identity of one model turn within a run. */
|
|
35
|
+
export const TurnId = identifier("TurnId");
|
|
36
|
+
export type TurnId = typeof TurnId.Type;
|
|
37
|
+
|
|
38
|
+
/** Identity used to correlate a Tool Call with progress and its terminal outcome. */
|
|
39
|
+
export const ToolCallId = identifier("ToolCallId");
|
|
40
|
+
export type ToolCallId = typeof ToolCallId.Type;
|
|
41
|
+
|
|
42
|
+
/** Stable identity of one configured Subagent capability. */
|
|
43
|
+
export const DelegationId = identifier("DelegationId");
|
|
44
|
+
export type DelegationId = typeof DelegationId.Type;
|
|
45
|
+
|
|
46
|
+
/** Opaque position in a semantic event sequence. */
|
|
47
|
+
export const EventOffset = identifier("EventOffset");
|
|
48
|
+
export type EventOffset = typeof EventOffset.Type;
|