@yielded/agent 0.1.0-beta.173 → 0.1.0-beta.175
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/{Admin-BX9ns28E.d.mts → Admin-Qa3I1oA5.d.mts} +61 -21
- package/dist/{Agent-9aBoIi74.d.mts → Agent-B39jRnFv.d.mts} +2 -2
- package/dist/{Agent-0WvBWWbM.mjs → Agent-BiRbr73L.mjs} +7 -6
- package/dist/Agent-BiRbr73L.mjs.map +1 -0
- package/dist/{AgentRuntime-BfP14534.d.mts → AgentRuntime-CHDyRbSf.d.mts} +12 -12
- package/dist/{AgentRuntime-CQ-qcETl.mjs → AgentRuntime-DaDKMasp.mjs} +290 -273
- package/dist/AgentRuntime-DaDKMasp.mjs.map +1 -0
- package/dist/{Digest-DCuPlhNk.mjs → Digest-C3EODOee.mjs} +42 -15
- package/dist/Digest-C3EODOee.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-BAmSkWYr.mjs → DurableAgentRuntime-CPlw5_7e.mjs} +1557 -1458
- package/dist/DurableAgentRuntime-CPlw5_7e.mjs.map +1 -0
- package/dist/{EventSource-BwliwQz9.d.mts → EventSource-BTu68yDW.d.mts} +2 -2
- package/dist/InMemory.d.mts +2 -2
- package/dist/{MessageDelivery-B943ebI_.d.mts → MessageDelivery-DjAZJ4Fd.d.mts} +42 -42
- package/dist/{Messaging-C_6OOg_s.d.mts → Messaging-SVu6rWV8.d.mts} +12 -6
- package/dist/{MessagingHost-B8oKM7AC.d.mts → MessagingHost-C6SOAcoG.d.mts} +2 -2
- package/dist/{MessagingHost-CRUK4JBi.mjs → MessagingHost-CZCyrnvJ.mjs} +27 -26
- package/dist/MessagingHost-CZCyrnvJ.mjs.map +1 -0
- package/dist/{Output-Dsx6k52t.d.mts → Output-CRamN1Fy.d.mts} +2 -2
- package/dist/{PreparedInputAdmission-CxSJSiTl.d.mts → PreparedInputAdmission-wgY4JMZY.d.mts} +3 -3
- package/dist/{Records-BiuJDWNe.mjs → Records-DzL4Kbtw.mjs} +2 -2
- package/dist/{Records-BiuJDWNe.mjs.map → Records-DzL4Kbtw.mjs.map} +1 -1
- package/dist/{RunContinuation-FHM7XPjq.d.mts → RunContinuation-3jB5pULC.d.mts} +13 -7
- package/dist/{RunContinuation-DHYNAQFi.mjs → RunContinuation-BiyKJK32.mjs} +173 -82
- package/dist/RunContinuation-BiyKJK32.mjs.map +1 -0
- package/dist/{RunJournal-kfKVxJj7.mjs → RunJournal-CPMKcfd0.mjs} +106 -73
- package/dist/RunJournal-CPMKcfd0.mjs.map +1 -0
- package/dist/{RunOptions-D8zxFIrZ.d.mts → RunOptions-Be77lKVZ.d.mts} +2 -2
- package/dist/{RunStorage-uqPxps09.mjs → RunStorage-CzutHJBE.mjs} +10 -6
- package/dist/RunStorage-CzutHJBE.mjs.map +1 -0
- package/dist/{Scheduling-CVyfXlBR.mjs → Scheduling-07_dsGED.mjs} +12 -12
- package/dist/Scheduling-07_dsGED.mjs.map +1 -0
- package/dist/{Subagent-vpffemql.mjs → Subagent-CexndZSp.mjs} +53 -40
- package/dist/Subagent-CexndZSp.mjs.map +1 -0
- package/dist/{Subagent-E6tvd7-k.d.mts → Subagent-xhN_aD1r.d.mts} +20 -9
- package/dist/{SubagentHost-B6w2m-SI.d.mts → SubagentHost-D1xBgn9g.d.mts} +2 -2
- package/dist/{Subscription-DONig54Q.d.mts → Subscription-DmIHlOJK.d.mts} +2 -2
- package/dist/{SubscriptionInput-mJIRxWJM.d.mts → SubscriptionInput-DgcQhvbe.d.mts} +2 -2
- package/dist/{Thread-dk-QiNml.d.mts → Thread-DzdJAY4J.d.mts} +4 -3
- package/dist/{ThreadHistory-ByxS8HU1.d.mts → ThreadHistory-KPPBJLJb.d.mts} +12 -2
- package/dist/{ThreadImport-DckUMEqJ.mjs → ThreadImport-CjlG57vH.mjs} +9 -9
- package/dist/ThreadImport-CjlG57vH.mjs.map +1 -0
- package/dist/{ThreadImport-DpHxjBrA.d.mts → ThreadImport-DP-vOk2F.d.mts} +5 -5
- package/dist/{ThreadStore-CEekRa80.mjs → ThreadStore-EuUilthA.mjs} +162 -85
- package/dist/ThreadStore-EuUilthA.mjs.map +1 -0
- package/dist/{ThreadTransfer-B4gTQLIl.mjs → ThreadTransfer-DB_zsrtJ.mjs} +4 -4
- package/dist/{ThreadTransfer-B4gTQLIl.mjs.map → ThreadTransfer-DB_zsrtJ.mjs.map} +1 -1
- package/dist/{WorkerAdmission-DFVbbVh2.mjs → WorkerAdmission-eBeXt_mu.mjs} +5 -5
- package/dist/{WorkerAdmission-DFVbbVh2.mjs.map → WorkerAdmission-eBeXt_mu.mjs.map} +1 -1
- package/dist/{agent-registration-ByMZ_cK5.mjs → agent-registration-a6QYaG3h.mjs} +70 -57
- package/dist/agent-registration-a6QYaG3h.mjs.map +1 -0
- package/dist/capabilities/Approval.mjs +2 -2
- package/dist/capabilities/Approval.mjs.map +1 -1
- package/dist/capabilities/BrowserUse.d.mts +102 -1867
- package/dist/capabilities/BrowserUse.mjs +74 -798
- package/dist/capabilities/BrowserUse.mjs.map +1 -1
- package/dist/capabilities/Budget.mjs +3 -1
- package/dist/capabilities/Budget.mjs.map +1 -1
- package/dist/capabilities/CodeMode.d.mts +1 -1
- package/dist/capabilities/CodeMode.mjs +16 -9
- package/dist/capabilities/CodeMode.mjs.map +1 -1
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/McpClient.mjs +1 -1
- package/dist/capabilities/McpClient.mjs.map +1 -1
- package/dist/capabilities/Messaging.d.mts +1 -1
- package/dist/capabilities/Messaging.mjs +5 -5
- package/dist/capabilities/Messaging.mjs.map +1 -1
- package/dist/capabilities/ModelContext.d.mts +1 -1
- package/dist/capabilities/ModelContext.mjs +7 -5
- package/dist/capabilities/ModelContext.mjs.map +1 -1
- package/dist/capabilities/Redaction.mjs +49 -19
- package/dist/capabilities/Redaction.mjs.map +1 -1
- package/dist/capabilities/RunHooks.d.mts +2 -2
- package/dist/capabilities/RunHooks.mjs +1 -1
- package/dist/capabilities/RunHooks.mjs.map +1 -1
- package/dist/capabilities/Subagent.d.mts +1 -1
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/capabilities/SubagentReservations.mjs +3 -1
- package/dist/capabilities/SubagentReservations.mjs.map +1 -1
- package/dist/capabilities/WebCapture.mjs.map +1 -1
- package/dist/capabilities/WebSearch.mjs +7 -7
- package/dist/capabilities/WebSearch.mjs.map +1 -1
- package/dist/core/Agent.d.mts +1 -1
- package/dist/core/Agent.mjs +1 -1
- package/dist/core/AgentUpdates.mjs +8 -8
- package/dist/core/AgentUpdates.mjs.map +1 -1
- package/dist/core/Thread.d.mts +2 -2
- package/dist/core/Thread.mjs +6 -4
- package/dist/core/Thread.mjs.map +1 -1
- package/dist/core/Usage.mjs +2 -2
- package/dist/core/Usage.mjs.map +1 -1
- package/dist/durable/ActivityStore.mjs +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/Admin.mjs +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/AgentRegistration.mjs +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +3 -3
- package/dist/durable/Digest.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +2 -2
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/EventSource.mjs +7 -7
- package/dist/durable/EventSource.mjs.map +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/LifecyclePublication.d.mts +1 -1
- package/dist/durable/LifecyclePublication.mjs +2 -2
- package/dist/durable/MessageDelivery.d.mts +1 -1
- package/dist/durable/MessageDelivery.mjs +2 -2
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +40 -40
- package/dist/durable/MessageDeliveryStoreConformance.mjs +2 -2
- package/dist/durable/PersistentHistory.d.mts +2 -2
- package/dist/durable/PersistentHistory.mjs +4 -4
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/RecordFormat.mjs +3 -3
- package/dist/durable/RecordFormat.mjs.map +1 -1
- package/dist/durable/Records.mjs +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +1 -1
- package/dist/durable/RunContinuation.d.mts +2 -2
- package/dist/durable/RunContinuation.mjs +3 -3
- package/dist/durable/RunJournal.d.mts +2 -2
- package/dist/durable/RunJournal.mjs +2 -2
- package/dist/durable/RunStorage.d.mts +1 -1
- package/dist/durable/RunStorage.mjs +1 -1
- package/dist/durable/Schedule.mjs +1 -1
- package/dist/durable/ScheduleStoreConformance.mjs +1 -1
- package/dist/durable/ScheduleTransition.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +1 -1
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SettlementPublisher.d.mts +1 -1
- package/dist/durable/SettlementPublisher.mjs +3 -3
- package/dist/durable/SqlMemoryStore.mjs +5 -3
- package/dist/durable/SqlMemoryStore.mjs.map +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +11 -3
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +6 -6
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/Subscription.mjs +2 -2
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionInput.mjs +4 -4
- package/dist/durable/SubscriptionInput.mjs.map +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +3 -3
- package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -1
- package/dist/durable/SubscriptionTools.d.mts +2 -2
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/Subscriptions.mjs +3 -3
- package/dist/durable/Subscriptions.mjs.map +1 -1
- package/dist/durable/ThreadArchiveRange.d.mts +1 -1
- package/dist/durable/ThreadArchiveRange.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +2 -2
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
- package/dist/durable/ThreadImport.d.mts +1 -1
- package/dist/durable/ThreadImport.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +3 -3
- package/dist/durable/ThreadInvariants.mjs +5 -5
- package/dist/durable/ThreadInvariants.mjs.map +1 -1
- package/dist/durable/ThreadProjection.mjs +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadReader.d.mts +1 -1
- package/dist/durable/ThreadReader.mjs +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStore.mjs +2 -2
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.mjs +4 -4
- package/dist/durable/ThreadTransfer.d.mts +1 -1
- package/dist/durable/ThreadTransfer.mjs +1 -1
- package/dist/durable/ThreadWork.d.mts +2 -2
- package/dist/durable/ThreadWork.mjs +12 -6
- package/dist/durable/ThreadWork.mjs.map +1 -1
- package/dist/durable/ToolReconciler.mjs +1 -1
- package/dist/durable/WakeScheduler.mjs +23 -39
- package/dist/durable/WakeScheduler.mjs.map +1 -1
- package/dist/durable/WorkerAdmission.d.mts +1 -1
- package/dist/durable/WorkerAdmission.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +2 -2
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/MessagingHost.d.mts +1 -1
- package/dist/engine/MessagingHost.mjs +1 -1
- package/dist/engine/Output.d.mts +1 -1
- package/dist/engine/Output.mjs +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/SubagentHost.d.mts +1 -1
- package/dist/engine/ThreadHistory.d.mts +1 -1
- package/dist/engine/ThreadHistory.mjs +3 -2
- package/dist/engine/ThreadHistory.mjs.map +1 -1
- package/dist/index.d.mts +21 -21
- package/dist/index.mjs +16 -16
- package/dist/{output-contract-CMIhu4Cw.mjs → output-contract-DCnLYCdp.mjs} +12 -15
- package/dist/{output-contract-CMIhu4Cw.mjs.map → output-contract-DCnLYCdp.mjs.map} +1 -1
- package/dist/{run-context-reader-OcsZr4bk.d.mts → run-context-reader-DVhJZ1Qe.d.mts} +2 -2
- package/package.json +1 -1
- package/src/capabilities/Approval.ts +58 -60
- package/src/capabilities/BrowserUse.ts +89 -944
- package/src/capabilities/Budget.ts +8 -1
- package/src/capabilities/CodeMode.ts +57 -33
- package/src/capabilities/McpClient.ts +2 -2
- package/src/capabilities/Messaging.ts +51 -55
- package/src/capabilities/ModelContext.ts +5 -2
- package/src/capabilities/Redaction.ts +64 -34
- package/src/capabilities/RunHooks.ts +52 -55
- package/src/capabilities/Subagent.ts +33 -33
- package/src/capabilities/SubagentReservations.ts +9 -1
- package/src/capabilities/WebCapture.ts +6 -0
- package/src/capabilities/WebSearch.ts +10 -7
- package/src/capabilities/internal/subagent-background.ts +202 -158
- package/src/core/Agent.ts +11 -6
- package/src/core/AgentUpdates.ts +8 -8
- package/src/core/Thread.ts +142 -146
- package/src/core/Usage.ts +7 -8
- package/src/core/internal/agent-updates.ts +1 -0
- package/src/durable/DurableAgentRuntime.ts +1024 -829
- package/src/durable/EventSource.ts +15 -9
- package/src/durable/RecordFormat.ts +5 -3
- package/src/durable/RunContinuation.ts +316 -113
- package/src/durable/RunJournal.ts +106 -114
- package/src/durable/RunStorage.ts +129 -124
- package/src/durable/Scheduling.ts +639 -651
- package/src/durable/SqlMemoryStore.ts +8 -6
- package/src/durable/SubmissionLedger.ts +11 -0
- package/src/durable/SubscriptionInput.ts +5 -3
- package/src/durable/SubscriptionStoreConformance.ts +23 -23
- package/src/durable/Subscriptions.ts +18 -19
- package/src/durable/ThreadImport.ts +18 -19
- package/src/durable/ThreadInvariants.ts +2 -1
- package/src/durable/ThreadStore.ts +217 -111
- package/src/durable/ThreadWork.ts +11 -2
- package/src/durable/WakeScheduler.ts +34 -66
- package/src/durable/internal/StorageOwner.ts +10 -4
- package/src/durable/internal/agent-registration.ts +96 -89
- package/src/durable/internal/canonical-json.ts +61 -20
- package/src/durable/internal/prompt-history-cache.ts +13 -4
- package/src/durable/internal/record-encoding.ts +120 -64
- package/src/durable/internal/schedule-time.ts +6 -6
- package/src/durable/internal/usage-totals.ts +35 -0
- package/src/durable/internal/worker-host.ts +69 -74
- package/src/engine/MessagingHost.ts +4 -2
- package/src/engine/ThreadHistory.ts +47 -48
- package/src/engine/internal/agent-runtime.ts +1298 -1217
- package/src/engine/internal/output-contract.ts +15 -15
- package/src/engine/internal/primitive-delta.ts +2 -3
- package/src/engine/internal/provisional-text.ts +12 -10
- package/src/engine/internal/tool-exposure.ts +22 -18
- package/src/engine/internal/tool-telemetry.ts +15 -12
- package/dist/Agent-0WvBWWbM.mjs.map +0 -1
- package/dist/AgentRuntime-CQ-qcETl.mjs.map +0 -1
- package/dist/Digest-DCuPlhNk.mjs.map +0 -1
- package/dist/DurableAgentRuntime-BAmSkWYr.mjs.map +0 -1
- package/dist/MessagingHost-CRUK4JBi.mjs.map +0 -1
- package/dist/RunContinuation-DHYNAQFi.mjs.map +0 -1
- package/dist/RunJournal-kfKVxJj7.mjs.map +0 -1
- package/dist/RunStorage-uqPxps09.mjs.map +0 -1
- package/dist/Scheduling-CVyfXlBR.mjs.map +0 -1
- package/dist/Subagent-vpffemql.mjs.map +0 -1
- package/dist/ThreadImport-DckUMEqJ.mjs.map +0 -1
- package/dist/ThreadStore-CEekRa80.mjs.map +0 -1
- package/dist/agent-registration-ByMZ_cK5.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { a as Identifiers_d_exports } from "./Identifiers-CN2s30fF.mjs";
|
|
2
2
|
import { a as SubagentContract_d_exports } from "./SubagentContract-DdPzxYQj.mjs";
|
|
3
3
|
import { t as SubagentReservations_d_exports } from "./capabilities/SubagentReservations.mjs";
|
|
4
|
-
import { p as Thread_d_exports } from "./Thread-
|
|
4
|
+
import { p as Thread_d_exports } from "./Thread-DzdJAY4J.mjs";
|
|
5
5
|
import { o as Receipt_d_exports } from "./Receipt-BkM21Qiu.mjs";
|
|
6
6
|
import { t as AgentUpdates_d_exports } from "./AgentUpdates-DksV4D0A.mjs";
|
|
7
7
|
import { f as Usage_d_exports } from "./Usage-CzZJ6A2n.mjs";
|
|
8
8
|
import { d as RunEvent_d_exports } from "./RunEvent-C5jVQZ6K.mjs";
|
|
9
|
-
import { i as ThreadHistory_d_exports } from "./ThreadHistory-
|
|
9
|
+
import { i as ThreadHistory_d_exports } from "./ThreadHistory-KPPBJLJb.mjs";
|
|
10
10
|
import { t as InMemory_d_exports } from "./InMemory.mjs";
|
|
11
11
|
import { t as ToolExposure_d_exports } from "./ToolExposure.mjs";
|
|
12
12
|
import { t as Redaction_d_exports } from "./capabilities/Redaction.mjs";
|
|
13
13
|
import { t as Approval_d_exports } from "./capabilities/Approval.mjs";
|
|
14
|
-
import { t as BrowserUse_d_exports } from "./capabilities/BrowserUse.mjs";
|
|
15
|
-
import { t as Budget_d_exports } from "./capabilities/Budget.mjs";
|
|
16
|
-
import { p as ToolBroker_d_exports } from "./ToolBroker-P5t4ZN78.mjs";
|
|
17
14
|
import { D as Sandbox_d_exports } from "./Sandbox-CEsDWBLq.mjs";
|
|
18
15
|
import { t as CodeExecutor_d_exports } from "./sandbox/CodeExecutor.mjs";
|
|
16
|
+
import { p as ToolBroker_d_exports } from "./ToolBroker-P5t4ZN78.mjs";
|
|
19
17
|
import { t as CodeMode_d_exports } from "./capabilities/CodeMode.mjs";
|
|
18
|
+
import { t as BrowserUse_d_exports } from "./capabilities/BrowserUse.mjs";
|
|
19
|
+
import { t as Budget_d_exports } from "./capabilities/Budget.mjs";
|
|
20
20
|
import { a as FailureDiagnostic_d_exports } from "./FailureDiagnostic-DvHruCSJ.mjs";
|
|
21
21
|
import { i as AgentError_d_exports } from "./AgentError-CBH7_MjG.mjs";
|
|
22
22
|
import { r as ToolResult_d_exports } from "./ToolResult-5SdG8FE2.mjs";
|
|
23
23
|
import { r as AgentPolicy_d_exports } from "./AgentPolicy-B4lbCU2T.mjs";
|
|
24
|
-
import { t as Agent_d_exports } from "./Agent-
|
|
24
|
+
import { t as Agent_d_exports } from "./Agent-B39jRnFv.mjs";
|
|
25
25
|
import { c as MemoryReference_d_exports } from "./MemoryReference-B8Q3UJoJ.mjs";
|
|
26
26
|
import { n as RunPolicyUsage_d_exports } from "./RunPolicyUsage-QmYVw9z8.mjs";
|
|
27
27
|
import { x as Worker_d_exports } from "./Worker-CHRaIsWu.mjs";
|
|
28
28
|
import { s as ContextWindow_d_exports } from "./ContextWindow-Cvv8N9Xy.mjs";
|
|
29
29
|
import { s as ContextCompactor_d_exports } from "./ContextCompactor-Bz91grmO.mjs";
|
|
30
30
|
import { i as DurableStep_d_exports } from "./DurableStep-DXGn7KQ4.mjs";
|
|
31
|
-
import { F as RunOptions_d_exports } from "./RunOptions-
|
|
31
|
+
import { F as RunOptions_d_exports } from "./RunOptions-Be77lKVZ.mjs";
|
|
32
32
|
import { t as Commands_d_exports } from "./capabilities/Commands.mjs";
|
|
33
33
|
import { t as ContextHistory_d_exports } from "./engine/ContextHistory.mjs";
|
|
34
34
|
import { t as ContextTools_d_exports } from "./capabilities/ContextTools.mjs";
|
|
@@ -37,8 +37,8 @@ import { t as McpClient_d_exports } from "./capabilities/McpClient.mjs";
|
|
|
37
37
|
import { i as MemoryNamespace_d_exports } from "./MemoryNamespace-BbRW5p71.mjs";
|
|
38
38
|
import { t as MemoryStore_d_exports } from "./core/MemoryStore.mjs";
|
|
39
39
|
import { t as MemoryNotes_d_exports } from "./capabilities/MemoryNotes.mjs";
|
|
40
|
-
import { n as MessagingHost_d_exports } from "./MessagingHost-
|
|
41
|
-
import { t as Messaging_d_exports } from "./Messaging-
|
|
40
|
+
import { n as MessagingHost_d_exports } from "./MessagingHost-C6SOAcoG.mjs";
|
|
41
|
+
import { t as Messaging_d_exports } from "./Messaging-SVu6rWV8.mjs";
|
|
42
42
|
import { t as ModelContext_d_exports } from "./capabilities/ModelContext.mjs";
|
|
43
43
|
import { t as RememberingStore_d_exports } from "./core/RememberingStore.mjs";
|
|
44
44
|
import { t as Remembering_d_exports } from "./capabilities/Remembering.mjs";
|
|
@@ -47,10 +47,10 @@ import { t as MemoryRevalidation_d_exports } from "./core/MemoryRevalidation.mjs
|
|
|
47
47
|
import { t as SemanticMemoryIndex_d_exports } from "./core/SemanticMemoryIndex.mjs";
|
|
48
48
|
import { t as SemanticMemoryRevalidation_d_exports } from "./core/SemanticMemoryRevalidation.mjs";
|
|
49
49
|
import { t as SemanticMemory_d_exports } from "./capabilities/SemanticMemory.mjs";
|
|
50
|
-
import { s as SubagentHost_d_exports } from "./SubagentHost-
|
|
51
|
-
import { t as AgentRuntime_d_exports } from "./AgentRuntime-
|
|
50
|
+
import { s as SubagentHost_d_exports } from "./SubagentHost-D1xBgn9g.mjs";
|
|
51
|
+
import { t as AgentRuntime_d_exports } from "./AgentRuntime-CHDyRbSf.mjs";
|
|
52
52
|
import { i as RunEventSink_d_exports } from "./RunEventSink-shh6Qf9E.mjs";
|
|
53
|
-
import { v as Subagent_d_exports } from "./Subagent-
|
|
53
|
+
import { v as Subagent_d_exports } from "./Subagent-xhN_aD1r.mjs";
|
|
54
54
|
import { t as ToolDiscovery_d_exports } from "./capabilities/ToolDiscovery.mjs";
|
|
55
55
|
import { D as PageCapture_d_exports } from "./PageCapture-Df8Xwskw.mjs";
|
|
56
56
|
import { t as WebCapture_d_exports } from "./capabilities/WebCapture.mjs";
|
|
@@ -61,7 +61,7 @@ import { t as ProvisionalText_d_exports } from "./core/ProvisionalText.mjs";
|
|
|
61
61
|
import { nt as Records_d_exports } from "./Records-BTnGRdcf.mjs";
|
|
62
62
|
import { t as ActivityStore_d_exports } from "./durable/ActivityStore.mjs";
|
|
63
63
|
import { n as Digest_d_exports } from "./Digest-DjUgS5PG.mjs";
|
|
64
|
-
import { Ar as SubmissionStatus_d_exports,
|
|
64
|
+
import { Ar as SubmissionStatus_d_exports, Do as RunJournal_d_exports, Es as AgentRegistration_d_exports, Ta as ThreadWork_d_exports, Yn as DurableAgentRuntime_d_exports, fo as LifecyclePublication_d_exports, no as ThreadArchiveRange_d_exports, pn as SubmissionLedger_d_exports, q as Recovery_d_exports, qi as ThreadStore_d_exports, t as Admin_d_exports } from "./Admin-Qa3I1oA5.mjs";
|
|
65
65
|
import { t as DurableFailpoint_d_exports } from "./DurableFailpoint-BugHZKvJ.mjs";
|
|
66
66
|
import { a as OperationAuthorizer_d_exports } from "./OperationAuthorizer-TzcQtpX5.mjs";
|
|
67
67
|
import { s as RecordFormat_d_exports } from "./RecordFormat-BNiLpe43.mjs";
|
|
@@ -69,21 +69,21 @@ import { l as ToolReconciler_d_exports } from "./ToolReconciler-SrOHkvF8.mjs";
|
|
|
69
69
|
import { n as WakeScheduler_d_exports } from "./WakeScheduler-DJIMMf77.mjs";
|
|
70
70
|
import { t as CommittedActivity_d_exports } from "./durable/CommittedActivity.mjs";
|
|
71
71
|
import { R as Schedule_d_exports } from "./Schedule-CDgTz0vj.mjs";
|
|
72
|
-
import { k as Subscription_d_exports } from "./Subscription-
|
|
73
|
-
import { n as EventSource_d_exports } from "./EventSource-
|
|
74
|
-
import { n as PreparedInputAdmission_d_exports } from "./PreparedInputAdmission-
|
|
75
|
-
import { r as SubscriptionInput_d_exports } from "./SubscriptionInput-
|
|
72
|
+
import { k as Subscription_d_exports } from "./Subscription-DmIHlOJK.mjs";
|
|
73
|
+
import { n as EventSource_d_exports } from "./EventSource-BTu68yDW.mjs";
|
|
74
|
+
import { n as PreparedInputAdmission_d_exports } from "./PreparedInputAdmission-wgY4JMZY.mjs";
|
|
75
|
+
import { r as SubscriptionInput_d_exports } from "./SubscriptionInput-DgcQhvbe.mjs";
|
|
76
76
|
import { t as Subscriptions_d_exports } from "./durable/Subscriptions.mjs";
|
|
77
|
-
import { g as MessageDelivery_d_exports } from "./MessageDelivery-
|
|
77
|
+
import { g as MessageDelivery_d_exports } from "./MessageDelivery-DjAZJ4Fd.mjs";
|
|
78
78
|
import { t as PersistentHistory_d_exports } from "./durable/PersistentHistory.mjs";
|
|
79
|
-
import { i as RunContinuation_d_exports } from "./RunContinuation-
|
|
79
|
+
import { i as RunContinuation_d_exports } from "./RunContinuation-3jB5pULC.mjs";
|
|
80
80
|
import { t as ScheduleTransition_d_exports } from "./durable/ScheduleTransition.mjs";
|
|
81
81
|
import { t as Scheduling_d_exports } from "./durable/Scheduling.mjs";
|
|
82
82
|
import { t as SubscriptionTools_d_exports } from "./durable/SubscriptionTools.mjs";
|
|
83
83
|
import { t as SubscriptionTransition_d_exports } from "./durable/SubscriptionTransition.mjs";
|
|
84
84
|
import { t as ThreadContextHistory_d_exports } from "./durable/ThreadContextHistory.mjs";
|
|
85
85
|
import { t as ThreadContextHistoryProjection_d_exports } from "./durable/ThreadContextHistoryProjection.mjs";
|
|
86
|
-
import { l as ThreadImport_d_exports } from "./ThreadImport-
|
|
86
|
+
import { l as ThreadImport_d_exports } from "./ThreadImport-DP-vOk2F.mjs";
|
|
87
87
|
import { t as ThreadInvariants_d_exports } from "./durable/ThreadInvariants.mjs";
|
|
88
88
|
import { t as ThreadProjection_d_exports } from "./durable/ThreadProjection.mjs";
|
|
89
89
|
import { t as ThreadProjectionMaintenance_d_exports } from "./durable/ThreadProjectionMaintenance.mjs";
|
|
@@ -91,7 +91,7 @@ import { t as ThreadTransfer_d_exports } from "./durable/ThreadTransfer.mjs";
|
|
|
91
91
|
import { t as WorkerAdmission_d_exports } from "./durable/WorkerAdmission.mjs";
|
|
92
92
|
import { t as WorkerHost_d_exports } from "./durable/WorkerHost.mjs";
|
|
93
93
|
import { t as Compaction_d_exports } from "./engine/Compaction.mjs";
|
|
94
|
-
import { t as Output_d_exports } from "./Output-
|
|
94
|
+
import { t as Output_d_exports } from "./Output-CRamN1Fy.mjs";
|
|
95
95
|
import { t as PageScreenshot_d_exports } from "./sandbox/PageScreenshot.mjs";
|
|
96
96
|
import { t as InteractiveBrowser_d_exports } from "./sandbox/InteractiveBrowser.mjs";
|
|
97
97
|
import { t as PageCrawl_d_exports } from "./sandbox/PageCrawl.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { t as ToolResult_exports } from "./core/ToolResult.mjs";
|
|
|
3
3
|
import { t as AgentPolicy_exports } from "./core/AgentPolicy.mjs";
|
|
4
4
|
import { t as Receipt_exports } from "./core/Receipt.mjs";
|
|
5
5
|
import { t as AgentUpdates_exports } from "./core/AgentUpdates.mjs";
|
|
6
|
-
import { t as Agent_exports } from "./Agent-
|
|
6
|
+
import { t as Agent_exports } from "./Agent-BiRbr73L.mjs";
|
|
7
7
|
import { a as FailureDiagnostic_exports } from "./FailureDiagnostic-D9oW23Cn.mjs";
|
|
8
8
|
import { t as AgentError_exports } from "./core/AgentError.mjs";
|
|
9
9
|
import { t as IdGenerator_exports } from "./core/IdGenerator.mjs";
|
|
@@ -11,11 +11,11 @@ import { t as SubagentContract_exports } from "./core/SubagentContract.mjs";
|
|
|
11
11
|
import { t as Usage_exports } from "./core/Usage.mjs";
|
|
12
12
|
import { t as RunEvent_exports } from "./core/RunEvent.mjs";
|
|
13
13
|
import { x as Worker_exports } from "./Worker-DZjdMjZn.mjs";
|
|
14
|
-
import { n as MessagingHost_exports } from "./MessagingHost-
|
|
14
|
+
import { n as MessagingHost_exports } from "./MessagingHost-CZCyrnvJ.mjs";
|
|
15
15
|
import { t as SubagentHost_exports } from "./engine/SubagentHost.mjs";
|
|
16
16
|
import { t as Thread_exports } from "./core/Thread.mjs";
|
|
17
17
|
import { t as ThreadHistory_exports } from "./engine/ThreadHistory.mjs";
|
|
18
|
-
import { t as AgentRuntime_exports } from "./AgentRuntime-
|
|
18
|
+
import { t as AgentRuntime_exports } from "./AgentRuntime-DaDKMasp.mjs";
|
|
19
19
|
import { t as ProvisionalText_exports } from "./core/ProvisionalText.mjs";
|
|
20
20
|
import { t as ContextWindow_exports } from "./engine/ContextWindow.mjs";
|
|
21
21
|
import { t as DurableStep_exports } from "./engine/DurableStep.mjs";
|
|
@@ -27,11 +27,11 @@ import { t as RunOptions_exports } from "./engine/RunOptions.mjs";
|
|
|
27
27
|
import { t as ToolBroker_exports } from "./engine/ToolBroker.mjs";
|
|
28
28
|
import { t as Redaction_exports } from "./capabilities/Redaction.mjs";
|
|
29
29
|
import { t as Approval_exports } from "./capabilities/Approval.mjs";
|
|
30
|
-
import { t as BrowserUse_exports } from "./capabilities/BrowserUse.mjs";
|
|
31
|
-
import { t as Budget_exports } from "./capabilities/Budget.mjs";
|
|
32
30
|
import { t as Sandbox_exports } from "./sandbox/Sandbox.mjs";
|
|
33
31
|
import { t as CodeExecutor_exports } from "./sandbox/CodeExecutor.mjs";
|
|
34
32
|
import { t as CodeMode_exports } from "./capabilities/CodeMode.mjs";
|
|
33
|
+
import { t as BrowserUse_exports } from "./capabilities/BrowserUse.mjs";
|
|
34
|
+
import { t as Budget_exports } from "./capabilities/Budget.mjs";
|
|
35
35
|
import { t as Commands_exports } from "./capabilities/Commands.mjs";
|
|
36
36
|
import { t as Compaction_exports } from "./engine/Compaction.mjs";
|
|
37
37
|
import { t as ContextHistory_exports } from "./engine/ContextHistory.mjs";
|
|
@@ -58,21 +58,21 @@ import { t as RunHooks_exports } from "./capabilities/RunHooks.mjs";
|
|
|
58
58
|
import { t as SemanticMemoryIndex_exports } from "./core/SemanticMemoryIndex.mjs";
|
|
59
59
|
import { t as SemanticMemoryRevalidation_exports } from "./core/SemanticMemoryRevalidation.mjs";
|
|
60
60
|
import { t as SemanticMemory_exports } from "./capabilities/SemanticMemory.mjs";
|
|
61
|
-
import { r as Subagent_exports } from "./Subagent-
|
|
61
|
+
import { r as Subagent_exports } from "./Subagent-CexndZSp.mjs";
|
|
62
62
|
import { t as ToolDiscovery_exports } from "./capabilities/ToolDiscovery.mjs";
|
|
63
63
|
import { t as ToolExposure_exports } from "./ToolExposure.mjs";
|
|
64
64
|
import { t as WebCapture_exports } from "./capabilities/WebCapture.mjs";
|
|
65
65
|
import { t as WebSearch_exports } from "./capabilities/WebSearch.mjs";
|
|
66
|
-
import { $ as Records_exports } from "./Records-
|
|
66
|
+
import { $ as Records_exports } from "./Records-DzL4Kbtw.mjs";
|
|
67
67
|
import { t as ActivityStore_exports } from "./durable/ActivityStore.mjs";
|
|
68
|
-
import { n as Digest_exports } from "./Digest-
|
|
68
|
+
import { n as Digest_exports } from "./Digest-C3EODOee.mjs";
|
|
69
69
|
import { t as SubmissionLedger_exports } from "./durable/SubmissionLedger.mjs";
|
|
70
70
|
import { t as Recovery_exports } from "./durable/Recovery.mjs";
|
|
71
71
|
import { t as Admin_exports } from "./durable/Admin.mjs";
|
|
72
72
|
import { t as AgentRegistration_exports } from "./durable/AgentRegistration.mjs";
|
|
73
73
|
import { t as RecordFormat_exports } from "./durable/RecordFormat.mjs";
|
|
74
|
-
import { n as RunJournal_exports } from "./RunJournal-
|
|
75
|
-
import { Z as ThreadStore_exports } from "./ThreadStore-
|
|
74
|
+
import { n as RunJournal_exports } from "./RunJournal-CPMKcfd0.mjs";
|
|
75
|
+
import { Z as ThreadStore_exports } from "./ThreadStore-EuUilthA.mjs";
|
|
76
76
|
import { t as Schedule_exports } from "./durable/Schedule.mjs";
|
|
77
77
|
import { t as PreparedInputAdmission_exports } from "./durable/PreparedInputAdmission.mjs";
|
|
78
78
|
import { t as Subscription_exports } from "./durable/Subscription.mjs";
|
|
@@ -80,11 +80,11 @@ import { t as MessageDelivery_exports } from "./durable/MessageDelivery.mjs";
|
|
|
80
80
|
import { t as ThreadArchiveRange_exports } from "./durable/ThreadArchiveRange.mjs";
|
|
81
81
|
import { t as CommittedActivity_exports } from "./durable/CommittedActivity.mjs";
|
|
82
82
|
import { t as DurableFailpoint_exports } from "./durable/DurableFailpoint.mjs";
|
|
83
|
-
import { i as RunContinuation_exports } from "./RunContinuation-
|
|
83
|
+
import { i as RunContinuation_exports } from "./RunContinuation-BiyKJK32.mjs";
|
|
84
84
|
import { t as ThreadWork_exports } from "./durable/ThreadWork.mjs";
|
|
85
85
|
import { t as WakeScheduler_exports } from "./durable/WakeScheduler.mjs";
|
|
86
|
-
import { r as DurableAgentRuntime_exports } from "./DurableAgentRuntime-
|
|
87
|
-
import { i as WorkerAdmission_exports } from "./WorkerAdmission-
|
|
86
|
+
import { r as DurableAgentRuntime_exports } from "./DurableAgentRuntime-CPlw5_7e.mjs";
|
|
87
|
+
import { i as WorkerAdmission_exports } from "./WorkerAdmission-eBeXt_mu.mjs";
|
|
88
88
|
import { t as WorkerHost_exports } from "./durable/WorkerHost.mjs";
|
|
89
89
|
import { t as OperationAuthorizer_exports } from "./durable/OperationAuthorizer.mjs";
|
|
90
90
|
import { t as SubmissionStatus_exports } from "./durable/SubmissionStatus.mjs";
|
|
@@ -92,13 +92,13 @@ import { t as ToolReconciler_exports } from "./durable/ToolReconciler.mjs";
|
|
|
92
92
|
import { t as EventSource_exports } from "./durable/EventSource.mjs";
|
|
93
93
|
import { t as PersistentHistory_exports } from "./durable/PersistentHistory.mjs";
|
|
94
94
|
import { t as ScheduleTransition_exports } from "./durable/ScheduleTransition.mjs";
|
|
95
|
-
import { i as Scheduling_exports } from "./Scheduling-
|
|
95
|
+
import { i as Scheduling_exports } from "./Scheduling-07_dsGED.mjs";
|
|
96
96
|
import { t as SubscriptionInput_exports } from "./durable/SubscriptionInput.mjs";
|
|
97
97
|
import { t as Subscriptions_exports } from "./durable/Subscriptions.mjs";
|
|
98
98
|
import { t as SubscriptionTools_exports } from "./durable/SubscriptionTools.mjs";
|
|
99
99
|
import { t as SubscriptionTransition_exports } from "./durable/SubscriptionTransition.mjs";
|
|
100
|
-
import { o as ThreadImport_exports } from "./ThreadImport-
|
|
101
|
-
import { n as ThreadTransfer_exports } from "./ThreadTransfer-
|
|
100
|
+
import { o as ThreadImport_exports } from "./ThreadImport-CjlG57vH.mjs";
|
|
101
|
+
import { n as ThreadTransfer_exports } from "./ThreadTransfer-DB_zsrtJ.mjs";
|
|
102
102
|
import { t as ThreadInvariants_exports } from "./durable/ThreadInvariants.mjs";
|
|
103
103
|
import { t as ThreadProjection_exports } from "./durable/ThreadProjection.mjs";
|
|
104
104
|
import { t as ThreadProjectionMaintenance_exports } from "./durable/ThreadProjectionMaintenance.mjs";
|
|
@@ -75,6 +75,7 @@ const sameSystemMessage = Schema.toEquivalence(Prompt.SystemMessage);
|
|
|
75
75
|
const prepareModelPrompt = (prompt, contract, systemMessagesInHistory, staticInstructions) => {
|
|
76
76
|
if (systemMessagesInHistory) {
|
|
77
77
|
const content = [];
|
|
78
|
+
let pendingContract = contract;
|
|
78
79
|
let lastSystem;
|
|
79
80
|
let ordered = prompt.content;
|
|
80
81
|
if (staticInstructions !== void 0) {
|
|
@@ -100,37 +101,33 @@ const prepareModelPrompt = (prompt, contract, systemMessagesInHistory, staticIns
|
|
|
100
101
|
if (lastSystem !== void 0 && sameSystemMessage(lastSystem, message)) continue;
|
|
101
102
|
lastSystem = message;
|
|
102
103
|
}
|
|
104
|
+
if (message.role !== "system" && pendingContract !== void 0) {
|
|
105
|
+
content.push(pendingContract);
|
|
106
|
+
pendingContract = void 0;
|
|
107
|
+
}
|
|
103
108
|
content.push(message);
|
|
104
109
|
}
|
|
105
|
-
if (
|
|
106
|
-
const firstConversation = content.findIndex((message) => message.role !== "system");
|
|
107
|
-
content.splice(firstConversation === -1 ? content.length : firstConversation, 0, contract);
|
|
108
|
-
}
|
|
110
|
+
if (pendingContract !== void 0) content.push(pendingContract);
|
|
109
111
|
return Prompt.fromMessages(content);
|
|
110
112
|
}
|
|
111
113
|
const systems = [];
|
|
112
|
-
const conversation = [];
|
|
113
114
|
const seen = /* @__PURE__ */ new Map();
|
|
114
115
|
for (let index = prompt.content.length - 1; index >= 0; index -= 1) {
|
|
115
116
|
const message = prompt.content[index];
|
|
116
117
|
if (message === void 0) continue;
|
|
117
|
-
if (message.role !== "system")
|
|
118
|
-
conversation.push(message);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
118
|
+
if (message.role !== "system") continue;
|
|
121
119
|
const variants = seen.get(message.content);
|
|
122
120
|
if (variants?.some((previous) => sameSystemMessage(previous, message))) continue;
|
|
123
121
|
if (variants === void 0) seen.set(message.content, [message]);
|
|
124
122
|
else variants.push(message);
|
|
125
123
|
systems.push(message);
|
|
126
124
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
]);
|
|
125
|
+
const content = systems.reverse();
|
|
126
|
+
if (contract !== void 0) content.push(contract);
|
|
127
|
+
for (const message of prompt.content) if (message !== void 0 && message.role !== "system") content.push(message);
|
|
128
|
+
return Prompt.fromMessages(content);
|
|
132
129
|
};
|
|
133
130
|
//#endregion
|
|
134
131
|
export { textOutput as i, outputSchemaContract as n, prepareModelPrompt as r, isTextOutput as t };
|
|
135
132
|
|
|
136
|
-
//# sourceMappingURL=output-contract-
|
|
133
|
+
//# sourceMappingURL=output-contract-DCnLYCdp.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-contract-CMIhu4Cw.mjs","names":[],"sources":["../src/engine/internal/output-contract.ts"],"sourcesContent":["import * as Prompt from \"effect/ai/Prompt\";\nimport * as Tool from \"effect/ai/Tool\";\nimport * as Schema from \"effect/Schema\";\n\nimport type * as Agent from \"../../core/Agent.ts\";\n\nconst outputFormatAnnotation = \"@effect-agent/engine/Output/format\";\n\n/**\n * Declare ordinary assistant text as an Agent's final-output wire format. Apply this to the\n * complete output Schema after composing transformations. Its encoded type must be string;\n * decoding, checks, transformations, and service requirements remain owned by that Schema.\n * Text is preserved verbatim, including whitespace, quotes, and an empty reply when allowed.\n * Required completion Tools still take precedence. Unmarked Schemas use JSON final output.\n *\n * @example\n * ```ts\n * output: Output.text(Schema.String.check(Schema.isMaxLength(20_000)))\n * ```\n */\nexport const textOutput = <S extends Schema.Top & { readonly Encoded: string }>(\n schema: S,\n): S[\"Rebuild\"] => schema.annotate({ [outputFormatAnnotation]: \"text\" });\n\nexport const isTextOutput = (schema: Schema.Top): boolean =>\n Schema.resolveAnnotations(schema)?.[outputFormatAnnotation] === \"text\";\n\n/**\n * Model-visible final-output contract (RUN-028).\n *\n * For ordinary text completion, the interpreter's only output-conformance\n * point is `decodeFinalOutput`, which validates the final text after the\n * model has already finished. This module renders that Schema's wire contract\n * with the same Effect AI derivation the providers use for Tool parameters\n * and states it as one framework-owned system message on every model request.\n * A required completion Tool instead gets a native-tool directive: its Tool\n * parameter Schema is already carried by the provider request, and ordinary\n * final text is not an allowed completion path.\n *\n * The contract is a per-request projection of the immutable definition —\n * exactly like the Tool schemas the request already carries. It is inserted\n * at model-request materialization (after context preparation) and never\n * into official history, so canonical records, run events, and the committed\n * DN/DC golden are unchanged.\n *\n */\n\n/** Rendering outcome for one definition's output Schema. */\ntype OutputContract =\n | {\n readonly _tag: \"rendered\";\n /** The complete system-message text: directive plus the derived JSON Schema. */\n readonly message: string;\n readonly part: Prompt.SystemMessage;\n }\n | {\n readonly _tag: \"unrenderable\";\n /** Why Effect AI's JSON-Schema derivation rejected the output Schema. */\n readonly reason: string;\n };\n\nconst contractDirective = (definition: Agent.AnyDefinition): string =>\n definition.completion === undefined\n ? \"Final output contract: when the task is complete, the final assistant message must be only \" +\n \"JSON that is valid against this JSON Schema — no prose, no Markdown code fences, nothing \" +\n \"before or after the JSON.\"\n : `Final output contract: when the task is complete without calling the \"${definition.completion.tool}\" completion Tool, the final assistant message must be only ` +\n \"JSON that is valid against this JSON Schema — no prose, no Markdown code fences, nothing \" +\n `before or after the JSON. When calling the \"${definition.completion.tool}\" completion Tool, never place this private Agent output JSON in any Tool argument; follow the Tool's parameter schema instead. Call it as the sole application Tool Call, after receiving any other needed application Tool results. Completed provider Tool results may accompany it. The engine projects the successful completion Tool result into the Agent output.`;\n\nconst requiredCompletionDirective = (tool: string, hasAlternatives: boolean): string =>\n `Final output contract: ${hasAlternatives ? \"otherwise complete\" : \"complete only\"} by calling the required completion Tool ${JSON.stringify(tool)} ` +\n \"as the sole application Tool Call in its batch. Completed provider Tool results may accompany it. Do not emit an ordinary final assistant text answer. \" +\n \"The Tool's canonical parameters and successful result are projected and validated as the Agent output.\";\n\n/**\n * Render the model-visible final-output contract for one definition. The\n * derivation and message identity are stable for an immutable definition.\n * An output Schema the Effect AI derivation cannot represent is reported as\n * `unrenderable`; the caller falls back to the prior behavior — the contract\n * is guidance, and a Schema that decodes but does not render must not become\n * a new failure mode.\n */\nconst rendered = (message: string): OutputContract => ({\n _tag: \"rendered\",\n message,\n part: Prompt.makeMessage(\"system\", { content: message }),\n});\n\nconst renderOutputSchemaContract = (definition: Agent.AnyDefinition): OutputContract => {\n if (definition.completion?.required === true) {\n return rendered(\n requiredCompletionDirective(\n definition.completion.tool,\n (definition.completionFromTools?.length ?? 0) > 0,\n ),\n );\n }\n if (isTextOutput(definition.output)) {\n return rendered(\n \"Final output contract: write the final reply as ordinary assistant text, without JSON wrapping. \" +\n \"An empty reply is valid only when allowed by the output Schema and the task instructions.\" +\n (definition.completion === undefined\n ? \"\"\n : ` When calling the \"${definition.completion.tool}\" completion Tool, follow its parameter schema instead and call it as the sole application Tool Call, after receiving any other needed application Tool results; completed provider Tool results may accompany it; the engine projects its successful result into the Agent output.`),\n );\n }\n try {\n const jsonSchema = Tool.getJsonSchemaFromSchema(definition.output);\n\n return rendered(\n `${contractDirective(definition)}\\n\\n${JSON.stringify(jsonSchema, undefined, 2)}`,\n );\n } catch (cause) {\n return {\n _tag: \"unrenderable\",\n reason: cause instanceof Error ? cause.message : String(cause),\n };\n }\n};\n\n// Native incremental-response tracking recognizes message objects, not rendered text.\n// Weak keys retain neither discarded definitions nor their Schema graphs.\nconst outputContracts = new WeakMap<Agent.AnyDefinition, OutputContract>();\n\nexport const outputSchemaContract = (definition: Agent.AnyDefinition): OutputContract => {\n const cached = outputContracts.get(definition);\n\n if (cached !== undefined) return cached;\n const base = renderOutputSchemaContract(definition);\n const alternatives = definition.completionFromTools ?? [];\n\n const contract =\n base._tag === \"rendered\" && alternatives.length > 0\n ? rendered(\n `The following action Tools may complete the Run from their successful canonical result: ${alternatives.map((declaration) => JSON.stringify(declaration.tool)).join(\", \")}. ` +\n \"Call such a Tool as the sole application Tool Call, following its parameter schema. Completed provider Tool results may accompany it. It may complete the Run only when it satisfies the whole request. \" +\n \"An incomplete or pending result continues the Run. These actions are unavailable during finalization after budget exhaustion.\\n\\n\" +\n base.message,\n )\n : base;\n\n outputContracts.set(definition, contract);\n\n return contract;\n};\n\nconst sameSystemMessage = Schema.toEquivalence(Prompt.SystemMessage);\n\n/**\n * Keep supported system instructions in conversation order so changing late guidance\n * cannot invalidate the preceding user/tool cache prefix. Omit an exact repeat\n * only when no distinct system instruction intervened; returning to an earlier\n * instruction after a different one must preserve the new directive's precedence.\n * Anchor the immutable output contract after the initial system block.\n * Restore leading static instructions for caller-supplied conversation-only history.\n *\n * This runs after preparation and compaction. Canonical messages, protected\n * instruction/input spans and compaction coverage retain their original positions.\n * Adapters without this capability retain the grouped-system projection: keep the\n * last equivalent instruction with its native options, then the contract and\n * conversation. This prevents older Anthropic adapters from discarding system groups.\n */\nexport const prepareModelPrompt = (\n prompt: Prompt.Prompt,\n contract: Prompt.SystemMessage | undefined,\n systemMessagesInHistory: boolean,\n staticInstructions: Prompt.RawInput | undefined,\n): Prompt.Prompt => {\n if (systemMessagesInHistory) {\n const content: Array<Prompt.Message> = [];\n let lastSystem: Prompt.SystemMessage | undefined;\n let ordered = prompt.content;\n\n if (staticInstructions !== undefined) {\n const firstConversation = prompt.content.findIndex((message) => message.role !== \"system\");\n\n const leading = prompt.content.slice(\n 0,\n firstConversation === -1 ? prompt.content.length : firstConversation,\n );\n\n const restored: Array<Prompt.Message> = [];\n\n const instructions =\n typeof staticInstructions === \"string\"\n ? [Prompt.systemMessage({ content: staticInstructions })]\n : Prompt.make(staticInstructions).content;\n\n for (const message of instructions) {\n if (message.role !== \"system\") break;\n if (\n leading.some(\n (candidate) => candidate.role === \"system\" && sameSystemMessage(candidate, message),\n )\n )\n break;\n\n const original = prompt.content.find(\n (candidate) => candidate.role === \"system\" && sameSystemMessage(candidate, message),\n );\n\n if (original === undefined) break;\n restored.push(original);\n }\n if (restored.length > 0)\n ordered = [...leading, ...restored, ...prompt.content.slice(leading.length)];\n }\n\n for (const message of ordered) {\n if (message.role === \"system\") {\n if (lastSystem !== undefined && sameSystemMessage(lastSystem, message)) continue;\n lastSystem = message;\n }\n content.push(message);\n }\n if (contract !== undefined) {\n const firstConversation = content.findIndex((message) => message.role !== \"system\");\n\n content.splice(firstConversation === -1 ? content.length : firstConversation, 0, contract);\n }\n\n return Prompt.fromMessages(content);\n }\n\n const systems: Array<Prompt.SystemMessage> = [];\n const conversation: Array<Prompt.Message> = [];\n const seen = new Map<string, Array<Prompt.SystemMessage>>();\n\n for (let index = prompt.content.length - 1; index >= 0; index -= 1) {\n const message = prompt.content[index];\n\n if (message === undefined) continue;\n if (message.role !== \"system\") {\n conversation.push(message);\n continue;\n }\n const variants = seen.get(message.content);\n\n if (variants?.some((previous) => sameSystemMessage(previous, message))) continue;\n if (variants === undefined) seen.set(message.content, [message]);\n else variants.push(message);\n systems.push(message);\n }\n\n return Prompt.fromMessages([\n ...systems.reverse(),\n ...(contract === undefined ? [] : [contract]),\n ...conversation.reverse(),\n ]);\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"output-contract-DCnLYCdp.mjs","names":[],"sources":["../src/engine/internal/output-contract.ts"],"sourcesContent":["import * as Prompt from \"effect/ai/Prompt\";\nimport * as Tool from \"effect/ai/Tool\";\nimport * as Schema from \"effect/Schema\";\n\nimport type * as Agent from \"../../core/Agent.ts\";\n\nconst outputFormatAnnotation = \"@effect-agent/engine/Output/format\";\n\n/**\n * Declare ordinary assistant text as an Agent's final-output wire format. Apply this to the\n * complete output Schema after composing transformations. Its encoded type must be string;\n * decoding, checks, transformations, and service requirements remain owned by that Schema.\n * Text is preserved verbatim, including whitespace, quotes, and an empty reply when allowed.\n * Required completion Tools still take precedence. Unmarked Schemas use JSON final output.\n *\n * @example\n * ```ts\n * output: Output.text(Schema.String.check(Schema.isMaxLength(20_000)))\n * ```\n */\nexport const textOutput = <S extends Schema.Top & { readonly Encoded: string }>(\n schema: S,\n): S[\"Rebuild\"] => schema.annotate({ [outputFormatAnnotation]: \"text\" });\n\nexport const isTextOutput = (schema: Schema.Top): boolean =>\n Schema.resolveAnnotations(schema)?.[outputFormatAnnotation] === \"text\";\n\n/**\n * Model-visible final-output contract (RUN-028).\n *\n * For ordinary text completion, the interpreter's only output-conformance\n * point is `decodeFinalOutput`, which validates the final text after the\n * model has already finished. This module renders that Schema's wire contract\n * with the same Effect AI derivation the providers use for Tool parameters\n * and states it as one framework-owned system message on every model request.\n * A required completion Tool instead gets a native-tool directive: its Tool\n * parameter Schema is already carried by the provider request, and ordinary\n * final text is not an allowed completion path.\n *\n * The contract is a per-request projection of the immutable definition —\n * exactly like the Tool schemas the request already carries. It is inserted\n * at model-request materialization (after context preparation) and never\n * into official history, so canonical records, run events, and the committed\n * DN/DC golden are unchanged.\n *\n */\n\n/** Rendering outcome for one definition's output Schema. */\ntype OutputContract =\n | {\n readonly _tag: \"rendered\";\n /** The complete system-message text: directive plus the derived JSON Schema. */\n readonly message: string;\n readonly part: Prompt.SystemMessage;\n }\n | {\n readonly _tag: \"unrenderable\";\n /** Why Effect AI's JSON-Schema derivation rejected the output Schema. */\n readonly reason: string;\n };\n\nconst contractDirective = (definition: Agent.AnyDefinition): string =>\n definition.completion === undefined\n ? \"Final output contract: when the task is complete, the final assistant message must be only \" +\n \"JSON that is valid against this JSON Schema — no prose, no Markdown code fences, nothing \" +\n \"before or after the JSON.\"\n : `Final output contract: when the task is complete without calling the \"${definition.completion.tool}\" completion Tool, the final assistant message must be only ` +\n \"JSON that is valid against this JSON Schema — no prose, no Markdown code fences, nothing \" +\n `before or after the JSON. When calling the \"${definition.completion.tool}\" completion Tool, never place this private Agent output JSON in any Tool argument; follow the Tool's parameter schema instead. Call it as the sole application Tool Call, after receiving any other needed application Tool results. Completed provider Tool results may accompany it. The engine projects the successful completion Tool result into the Agent output.`;\n\nconst requiredCompletionDirective = (tool: string, hasAlternatives: boolean): string =>\n `Final output contract: ${hasAlternatives ? \"otherwise complete\" : \"complete only\"} by calling the required completion Tool ${JSON.stringify(tool)} ` +\n \"as the sole application Tool Call in its batch. Completed provider Tool results may accompany it. Do not emit an ordinary final assistant text answer. \" +\n \"The Tool's canonical parameters and successful result are projected and validated as the Agent output.\";\n\n/**\n * Render the model-visible final-output contract for one definition. The\n * derivation and message identity are stable for an immutable definition.\n * An output Schema the Effect AI derivation cannot represent is reported as\n * `unrenderable`; the caller falls back to the prior behavior — the contract\n * is guidance, and a Schema that decodes but does not render must not become\n * a new failure mode.\n */\nconst rendered = (message: string): OutputContract => ({\n _tag: \"rendered\",\n message,\n part: Prompt.makeMessage(\"system\", { content: message }),\n});\n\nconst renderOutputSchemaContract = (definition: Agent.AnyDefinition): OutputContract => {\n if (definition.completion?.required === true) {\n return rendered(\n requiredCompletionDirective(\n definition.completion.tool,\n (definition.completionFromTools?.length ?? 0) > 0,\n ),\n );\n }\n if (isTextOutput(definition.output)) {\n return rendered(\n \"Final output contract: write the final reply as ordinary assistant text, without JSON wrapping. \" +\n \"An empty reply is valid only when allowed by the output Schema and the task instructions.\" +\n (definition.completion === undefined\n ? \"\"\n : ` When calling the \"${definition.completion.tool}\" completion Tool, follow its parameter schema instead and call it as the sole application Tool Call, after receiving any other needed application Tool results; completed provider Tool results may accompany it; the engine projects its successful result into the Agent output.`),\n );\n }\n try {\n const jsonSchema = Tool.getJsonSchemaFromSchema(definition.output);\n\n return rendered(\n `${contractDirective(definition)}\\n\\n${JSON.stringify(jsonSchema, undefined, 2)}`,\n );\n } catch (cause) {\n return {\n _tag: \"unrenderable\",\n reason: cause instanceof Error ? cause.message : String(cause),\n };\n }\n};\n\n// Native incremental-response tracking recognizes message objects, not rendered text.\n// Weak keys retain neither discarded definitions nor their Schema graphs.\nconst outputContracts = new WeakMap<Agent.AnyDefinition, OutputContract>();\n\nexport const outputSchemaContract = (definition: Agent.AnyDefinition): OutputContract => {\n const cached = outputContracts.get(definition);\n\n if (cached !== undefined) return cached;\n const base = renderOutputSchemaContract(definition);\n const alternatives = definition.completionFromTools ?? [];\n\n const contract =\n base._tag === \"rendered\" && alternatives.length > 0\n ? rendered(\n `The following action Tools may complete the Run from their successful canonical result: ${alternatives.map((declaration) => JSON.stringify(declaration.tool)).join(\", \")}. ` +\n \"Call such a Tool as the sole application Tool Call, following its parameter schema. Completed provider Tool results may accompany it. It may complete the Run only when it satisfies the whole request. \" +\n \"An incomplete or pending result continues the Run. These actions are unavailable during finalization after budget exhaustion.\\n\\n\" +\n base.message,\n )\n : base;\n\n outputContracts.set(definition, contract);\n\n return contract;\n};\n\nconst sameSystemMessage = Schema.toEquivalence(Prompt.SystemMessage);\n\n/**\n * Keep supported system instructions in conversation order so changing late guidance\n * cannot invalidate the preceding user/tool cache prefix. Omit an exact repeat\n * only when no distinct system instruction intervened; returning to an earlier\n * instruction after a different one must preserve the new directive's precedence.\n * Anchor the immutable output contract after the initial system block.\n * Restore leading static instructions for caller-supplied conversation-only history.\n *\n * This runs after preparation and compaction. Canonical messages, protected\n * instruction/input spans and compaction coverage retain their original positions.\n * Adapters without this capability retain the grouped-system projection: keep the\n * last equivalent instruction with its native options, then the contract and\n * conversation. This prevents older Anthropic adapters from discarding system groups.\n */\nexport const prepareModelPrompt = (\n prompt: Prompt.Prompt,\n contract: Prompt.SystemMessage | undefined,\n systemMessagesInHistory: boolean,\n staticInstructions: Prompt.RawInput | undefined,\n): Prompt.Prompt => {\n if (systemMessagesInHistory) {\n const content: Array<Prompt.Message> = [];\n let pendingContract = contract;\n let lastSystem: Prompt.SystemMessage | undefined;\n let ordered = prompt.content;\n\n if (staticInstructions !== undefined) {\n const firstConversation = prompt.content.findIndex((message) => message.role !== \"system\");\n\n const leading = prompt.content.slice(\n 0,\n firstConversation === -1 ? prompt.content.length : firstConversation,\n );\n\n const restored: Array<Prompt.Message> = [];\n\n const instructions =\n typeof staticInstructions === \"string\"\n ? [Prompt.systemMessage({ content: staticInstructions })]\n : Prompt.make(staticInstructions).content;\n\n for (const message of instructions) {\n if (message.role !== \"system\") break;\n if (\n leading.some(\n (candidate) => candidate.role === \"system\" && sameSystemMessage(candidate, message),\n )\n )\n break;\n\n const original = prompt.content.find(\n (candidate) => candidate.role === \"system\" && sameSystemMessage(candidate, message),\n );\n\n if (original === undefined) break;\n restored.push(original);\n }\n if (restored.length > 0)\n ordered = [...leading, ...restored, ...prompt.content.slice(leading.length)];\n }\n\n for (const message of ordered) {\n if (message.role === \"system\") {\n if (lastSystem !== undefined && sameSystemMessage(lastSystem, message)) continue;\n lastSystem = message;\n }\n if (message.role !== \"system\" && pendingContract !== undefined) {\n content.push(pendingContract);\n pendingContract = undefined;\n }\n content.push(message);\n }\n if (pendingContract !== undefined) content.push(pendingContract);\n\n return Prompt.fromMessages(content);\n }\n\n const systems: Array<Prompt.SystemMessage> = [];\n const seen = new Map<string, Array<Prompt.SystemMessage>>();\n\n for (let index = prompt.content.length - 1; index >= 0; index -= 1) {\n const message = prompt.content[index];\n\n if (message === undefined) continue;\n if (message.role !== \"system\") continue;\n const variants = seen.get(message.content);\n\n if (variants?.some((previous) => sameSystemMessage(previous, message))) continue;\n if (variants === undefined) seen.set(message.content, [message]);\n else variants.push(message);\n systems.push(message);\n }\n\n const content: Array<Prompt.Message> = systems.reverse();\n\n if (contract !== undefined) content.push(contract);\n for (const message of prompt.content) {\n if (message !== undefined && message.role !== \"system\") content.push(message);\n }\n\n return Prompt.fromMessages(content);\n};\n"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
|
|
2
2
|
import { d as CanonicalRecordEnvelope, et as RecordId } from "./Records-BTnGRdcf.mjs";
|
|
3
|
-
import { Fi as ThreadPromptRead, Gi as ThreadStoreError, Mi as ThreadNotMaterialized, Ri as ThreadReader,
|
|
3
|
+
import { Fi as ThreadPromptRead, Gi as ThreadStoreError, Mi as ThreadNotMaterialized, Ri as ThreadReader, ws as JournalRecordEnvelope } from "./Admin-Qa3I1oA5.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Stream } from "effect";
|
|
5
5
|
//#region src/durable/internal/run-context-reader.d.ts
|
|
6
6
|
declare const RunContextReader_base: Context.ServiceClass<RunContextReader, "@effect-agent/thread/RunContextReader", {
|
|
@@ -14,4 +14,4 @@ declare class RunContextReader extends RunContextReader_base {
|
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
export { RunContextReader as t };
|
|
17
|
-
//# sourceMappingURL=run-context-reader-
|
|
17
|
+
//# sourceMappingURL=run-context-reader-DVhJZ1Qe.d.mts.map
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@yielded/agent","version":"0.1.0-beta.173","devDependencies":{"@effect/platform-node":"4.0.3","@effect/vitest":"4.0.3","effect":"4.0.3","typescript":"7.0.2","vite":"npm:@voidzero-dev/vite-plus-core@1.1.0","vite-plus":"1.1.0","vitest":"5.0.3"},"peerDependencies":{"effect":"^4.0.3"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./activity-store":{"types":"./dist/durable/ActivityStore.d.mts","default":"./dist/durable/ActivityStore.mjs"},"./admin":{"types":"./dist/durable/Admin.d.mts","default":"./dist/durable/Admin.mjs"},"./agent":{"types":"./dist/core/Agent.d.mts","default":"./dist/core/Agent.mjs"},"./agent-error":{"types":"./dist/core/AgentError.d.mts","default":"./dist/core/AgentError.mjs"},"./agent-policy":{"types":"./dist/core/AgentPolicy.d.mts","default":"./dist/core/AgentPolicy.mjs"},"./agent-registration":{"types":"./dist/durable/AgentRegistration.d.mts","default":"./dist/durable/AgentRegistration.mjs"},"./agent-runtime":{"types":"./dist/engine/AgentRuntime.d.mts","default":"./dist/engine/AgentRuntime.mjs"},"./agent-updates":{"types":"./dist/core/AgentUpdates.d.mts","default":"./dist/core/AgentUpdates.mjs"},"./approval":{"types":"./dist/capabilities/Approval.d.mts","default":"./dist/capabilities/Approval.mjs"},"./browser-use":{"types":"./dist/capabilities/BrowserUse.d.mts","default":"./dist/capabilities/BrowserUse.mjs"},"./budget":{"types":"./dist/capabilities/Budget.d.mts","default":"./dist/capabilities/Budget.mjs"},"./code-executor":{"types":"./dist/sandbox/CodeExecutor.d.mts","default":"./dist/sandbox/CodeExecutor.mjs"},"./code-mode":{"types":"./dist/capabilities/CodeMode.d.mts","default":"./dist/capabilities/CodeMode.mjs"},"./commands":{"types":"./dist/capabilities/Commands.d.mts","default":"./dist/capabilities/Commands.mjs"},"./committed-activity":{"types":"./dist/durable/CommittedActivity.d.mts","default":"./dist/durable/CommittedActivity.mjs"},"./compaction":{"types":"./dist/engine/Compaction.d.mts","default":"./dist/engine/Compaction.mjs"},"./context-compactor":{"types":"./dist/engine/ContextCompactor.d.mts","default":"./dist/engine/ContextCompactor.mjs"},"./context-history":{"types":"./dist/engine/ContextHistory.d.mts","default":"./dist/engine/ContextHistory.mjs"},"./context-tools":{"types":"./dist/capabilities/ContextTools.d.mts","default":"./dist/capabilities/ContextTools.mjs"},"./context-window":{"types":"./dist/engine/ContextWindow.d.mts","default":"./dist/engine/ContextWindow.mjs"},"./digest":{"types":"./dist/durable/Digest.d.mts","default":"./dist/durable/Digest.mjs"},"./durable-agent-runtime":{"types":"./dist/durable/DurableAgentRuntime.d.mts","default":"./dist/durable/DurableAgentRuntime.mjs"},"./durable-failpoint":{"types":"./dist/durable/DurableFailpoint.d.mts","default":"./dist/durable/DurableFailpoint.mjs"},"./durable-step":{"types":"./dist/engine/DurableStep.d.mts","default":"./dist/engine/DurableStep.mjs"},"./event-source":{"types":"./dist/durable/EventSource.d.mts","default":"./dist/durable/EventSource.mjs"},"./failure-diagnostic":{"types":"./dist/core/FailureDiagnostic.d.mts","default":"./dist/core/FailureDiagnostic.mjs"},"./git-hub-workflow-source":{"types":"./dist/durable/GitHubWorkflowSource.d.mts","default":"./dist/durable/GitHubWorkflowSource.mjs"},"./id-generator":{"types":"./dist/core/IdGenerator.d.mts","default":"./dist/core/IdGenerator.mjs"},"./identifiers":{"types":"./dist/core/Identifiers.d.mts","default":"./dist/core/Identifiers.mjs"},"./in-memory":{"types":"./dist/InMemory.d.mts","default":"./dist/InMemory.mjs"},"./interactive-browser":{"types":"./dist/sandbox/InteractiveBrowser.d.mts","default":"./dist/sandbox/InteractiveBrowser.mjs"},"./mcp":{"types":"./dist/capabilities/Mcp.d.mts","default":"./dist/capabilities/Mcp.mjs"},"./mcp-client":{"types":"./dist/capabilities/McpClient.d.mts","default":"./dist/capabilities/McpClient.mjs"},"./memory":{"types":"./dist/core/Memory.d.mts","default":"./dist/core/Memory.mjs"},"./memory-namespace":{"types":"./dist/core/MemoryNamespace.d.mts","default":"./dist/core/MemoryNamespace.mjs"},"./memory-notes":{"types":"./dist/capabilities/MemoryNotes.d.mts","default":"./dist/capabilities/MemoryNotes.mjs"},"./memory-reference":{"types":"./dist/core/MemoryReference.d.mts","default":"./dist/core/MemoryReference.mjs"},"./memory-revalidation":{"types":"./dist/core/MemoryRevalidation.d.mts","default":"./dist/core/MemoryRevalidation.mjs"},"./memory-store":{"types":"./dist/core/MemoryStore.d.mts","default":"./dist/core/MemoryStore.mjs"},"./message-delivery":{"types":"./dist/durable/MessageDelivery.d.mts","default":"./dist/durable/MessageDelivery.mjs"},"./messaging":{"types":"./dist/capabilities/Messaging.d.mts","default":"./dist/capabilities/Messaging.mjs"},"./messaging-host":{"types":"./dist/engine/MessagingHost.d.mts","default":"./dist/engine/MessagingHost.mjs"},"./model-context":{"types":"./dist/capabilities/ModelContext.d.mts","default":"./dist/capabilities/ModelContext.mjs"},"./operation-authorizer":{"types":"./dist/durable/OperationAuthorizer.d.mts","default":"./dist/durable/OperationAuthorizer.mjs"},"./output":{"types":"./dist/engine/Output.d.mts","default":"./dist/engine/Output.mjs"},"./page-capture":{"types":"./dist/sandbox/PageCapture.d.mts","default":"./dist/sandbox/PageCapture.mjs"},"./page-crawl":{"types":"./dist/sandbox/PageCrawl.d.mts","default":"./dist/sandbox/PageCrawl.mjs"},"./page-screenshot":{"types":"./dist/sandbox/PageScreenshot.d.mts","default":"./dist/sandbox/PageScreenshot.mjs"},"./persistent-history":{"types":"./dist/durable/PersistentHistory.d.mts","default":"./dist/durable/PersistentHistory.mjs"},"./prepared-input-admission":{"types":"./dist/durable/PreparedInputAdmission.d.mts","default":"./dist/durable/PreparedInputAdmission.mjs"},"./provisional-text":{"types":"./dist/core/ProvisionalText.d.mts","default":"./dist/core/ProvisionalText.mjs"},"./receipt":{"types":"./dist/core/Receipt.d.mts","default":"./dist/core/Receipt.mjs"},"./records":{"types":"./dist/durable/Records.d.mts","default":"./dist/durable/Records.mjs"},"./recovery":{"types":"./dist/durable/Recovery.d.mts","default":"./dist/durable/Recovery.mjs"},"./redaction":{"types":"./dist/capabilities/Redaction.d.mts","default":"./dist/capabilities/Redaction.mjs"},"./remembering":{"types":"./dist/capabilities/Remembering.d.mts","default":"./dist/capabilities/Remembering.mjs"},"./remembering-store":{"types":"./dist/core/RememberingStore.d.mts","default":"./dist/core/RememberingStore.mjs"},"./run-event":{"types":"./dist/core/RunEvent.d.mts","default":"./dist/core/RunEvent.mjs"},"./run-event-sink":{"types":"./dist/engine/RunEventSink.d.mts","default":"./dist/engine/RunEventSink.mjs"},"./run-hooks":{"types":"./dist/capabilities/RunHooks.d.mts","default":"./dist/capabilities/RunHooks.mjs"},"./run-journal":{"types":"./dist/durable/RunJournal.d.mts","default":"./dist/durable/RunJournal.mjs"},"./run-continuation":{"types":"./dist/durable/RunContinuation.d.mts","default":"./dist/durable/RunContinuation.mjs"},"./thread-work":{"types":"./dist/durable/ThreadWork.d.mts","default":"./dist/durable/ThreadWork.mjs"},"./run-options":{"types":"./dist/engine/RunOptions.d.mts","default":"./dist/engine/RunOptions.mjs"},"./run-policy-usage":{"types":"./dist/core/RunPolicyUsage.d.mts","default":"./dist/core/RunPolicyUsage.mjs"},"./run-storage":{"types":"./dist/durable/RunStorage.d.mts","default":"./dist/durable/RunStorage.mjs"},"./sandbox":{"types":"./dist/sandbox/Sandbox.d.mts","default":"./dist/sandbox/Sandbox.mjs"},"./schedule":{"types":"./dist/durable/Schedule.d.mts","default":"./dist/durable/Schedule.mjs"},"./schedule-transition":{"types":"./dist/durable/ScheduleTransition.d.mts","default":"./dist/durable/ScheduleTransition.mjs"},"./scheduling":{"types":"./dist/durable/Scheduling.d.mts","default":"./dist/durable/Scheduling.mjs"},"./semantic-memory":{"types":"./dist/capabilities/SemanticMemory.d.mts","default":"./dist/capabilities/SemanticMemory.mjs"},"./semantic-memory-index":{"types":"./dist/core/SemanticMemoryIndex.d.mts","default":"./dist/core/SemanticMemoryIndex.mjs"},"./semantic-memory-revalidation":{"types":"./dist/core/SemanticMemoryRevalidation.d.mts","default":"./dist/core/SemanticMemoryRevalidation.mjs"},"./settlement-publisher":{"types":"./dist/durable/SettlementPublisher.d.mts","default":"./dist/durable/SettlementPublisher.mjs"},"./sql-memory-store":{"types":"./dist/durable/SqlMemoryStore.d.mts","default":"./dist/durable/SqlMemoryStore.mjs"},"./subagent":{"types":"./dist/capabilities/Subagent.d.mts","default":"./dist/capabilities/Subagent.mjs"},"./subagent-contract":{"types":"./dist/core/SubagentContract.d.mts","default":"./dist/core/SubagentContract.mjs"},"./subagent-host":{"types":"./dist/engine/SubagentHost.d.mts","default":"./dist/engine/SubagentHost.mjs"},"./subagent-reservations":{"types":"./dist/capabilities/SubagentReservations.d.mts","default":"./dist/capabilities/SubagentReservations.mjs"},"./submission-ledger":{"types":"./dist/durable/SubmissionLedger.d.mts","default":"./dist/durable/SubmissionLedger.mjs"},"./submission-status":{"types":"./dist/durable/SubmissionStatus.d.mts","default":"./dist/durable/SubmissionStatus.mjs"},"./subscription":{"types":"./dist/durable/Subscription.d.mts","default":"./dist/durable/Subscription.mjs"},"./subscription-input":{"types":"./dist/durable/SubscriptionInput.d.mts","default":"./dist/durable/SubscriptionInput.mjs"},"./subscription-tools":{"types":"./dist/durable/SubscriptionTools.d.mts","default":"./dist/durable/SubscriptionTools.mjs"},"./subscription-transition":{"types":"./dist/durable/SubscriptionTransition.d.mts","default":"./dist/durable/SubscriptionTransition.mjs"},"./subscriptions":{"types":"./dist/durable/Subscriptions.d.mts","default":"./dist/durable/Subscriptions.mjs"},"./testing/certification":{"types":"./dist/durable/Certification.d.mts","default":"./dist/durable/Certification.mjs"},"./testing/durable-failpoint-test-control":{"types":"./dist/durable/DurableFailpointTestControl.d.mts","default":"./dist/durable/DurableFailpointTestControl.mjs"},"./testing/message-delivery-store-conformance":{"types":"./dist/durable/MessageDeliveryStoreConformance.d.mts","default":"./dist/durable/MessageDeliveryStoreConformance.mjs"},"./testing/schedule-store-conformance":{"types":"./dist/durable/ScheduleStoreConformance.d.mts","default":"./dist/durable/ScheduleStoreConformance.mjs"},"./testing/submission-ledger-conformance":{"types":"./dist/durable/SubmissionLedgerConformance.d.mts","default":"./dist/durable/SubmissionLedgerConformance.mjs"},"./testing/subscription-store-conformance":{"types":"./dist/durable/SubscriptionStoreConformance.d.mts","default":"./dist/durable/SubscriptionStoreConformance.mjs"},"./testing/thread-store-conformance":{"types":"./dist/durable/ThreadStoreConformance.d.mts","default":"./dist/durable/ThreadStoreConformance.mjs"},"./thread":{"types":"./dist/core/Thread.d.mts","default":"./dist/core/Thread.mjs"},"./thread-context-history":{"types":"./dist/durable/ThreadContextHistory.d.mts","default":"./dist/durable/ThreadContextHistory.mjs"},"./thread-context-history-projection":{"types":"./dist/durable/ThreadContextHistoryProjection.d.mts","default":"./dist/durable/ThreadContextHistoryProjection.mjs"},"./thread-history":{"types":"./dist/engine/ThreadHistory.d.mts","default":"./dist/engine/ThreadHistory.mjs"},"./thread-invariants":{"types":"./dist/durable/ThreadInvariants.d.mts","default":"./dist/durable/ThreadInvariants.mjs"},"./thread-projection":{"types":"./dist/durable/ThreadProjection.d.mts","default":"./dist/durable/ThreadProjection.mjs"},"./thread-projection-maintenance":{"types":"./dist/durable/ThreadProjectionMaintenance.d.mts","default":"./dist/durable/ThreadProjectionMaintenance.mjs"},"./thread-reader":{"types":"./dist/durable/ThreadReader.d.mts","default":"./dist/durable/ThreadReader.mjs"},"./thread-store":{"types":"./dist/durable/ThreadStore.d.mts","default":"./dist/durable/ThreadStore.mjs"},"./tool-broker":{"types":"./dist/engine/ToolBroker.d.mts","default":"./dist/engine/ToolBroker.mjs"},"./tool-discovery":{"types":"./dist/capabilities/ToolDiscovery.d.mts","default":"./dist/capabilities/ToolDiscovery.mjs"},"./tool-exposure":{"types":"./dist/ToolExposure.d.mts","default":"./dist/ToolExposure.mjs"},"./tool-reconciler":{"types":"./dist/durable/ToolReconciler.d.mts","default":"./dist/durable/ToolReconciler.mjs"},"./tool-result":{"types":"./dist/core/ToolResult.d.mts","default":"./dist/core/ToolResult.mjs"},"./usage":{"types":"./dist/core/Usage.d.mts","default":"./dist/core/Usage.mjs"},"./wake-scheduler":{"types":"./dist/durable/WakeScheduler.d.mts","default":"./dist/durable/WakeScheduler.mjs"},"./web-capture":{"types":"./dist/capabilities/WebCapture.d.mts","default":"./dist/capabilities/WebCapture.mjs"},"./web-search":{"types":"./dist/capabilities/WebSearch.d.mts","default":"./dist/capabilities/WebSearch.mjs"},"./worker":{"types":"./dist/core/Worker.d.mts","default":"./dist/core/Worker.mjs"},"./worker-admission":{"types":"./dist/durable/WorkerAdmission.d.mts","default":"./dist/durable/WorkerAdmission.mjs"},"./worker-host":{"types":"./dist/durable/WorkerHost.d.mts","default":"./dist/durable/WorkerHost.mjs"},"./lifecycle-publication":{"types":"./dist/durable/LifecyclePublication.d.mts","default":"./dist/durable/LifecyclePublication.mjs"},"./record-format":{"types":"./dist/durable/RecordFormat.d.mts","default":"./dist/durable/RecordFormat.mjs"},"./thread-import":{"types":"./dist/durable/ThreadImport.d.mts","default":"./dist/durable/ThreadImport.mjs"},"./thread-archive-range":{"types":"./dist/durable/ThreadArchiveRange.d.mts","default":"./dist/durable/ThreadArchiveRange.mjs"},"./thread-transfer":{"types":"./dist/durable/ThreadTransfer.d.mts","default":"./dist/durable/ThreadTransfer.mjs"}},"description":"Effect-native agents, execution, subagents, and sandbox contracts in one tree-shakeable package.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/agent.git","directory":"packages/effect-agent"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests"}}
|
|
1
|
+
{"name":"@yielded/agent","version":"0.1.0-beta.175","devDependencies":{"@effect/platform-node":"4.0.3","@effect/vitest":"4.0.3","effect":"4.0.3","typescript":"7.0.2","vite":"npm:@voidzero-dev/vite-plus-core@1.1.0","vite-plus":"1.1.0","vitest":"5.0.3"},"peerDependencies":{"effect":"^4.0.3"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./activity-store":{"types":"./dist/durable/ActivityStore.d.mts","default":"./dist/durable/ActivityStore.mjs"},"./admin":{"types":"./dist/durable/Admin.d.mts","default":"./dist/durable/Admin.mjs"},"./agent":{"types":"./dist/core/Agent.d.mts","default":"./dist/core/Agent.mjs"},"./agent-error":{"types":"./dist/core/AgentError.d.mts","default":"./dist/core/AgentError.mjs"},"./agent-policy":{"types":"./dist/core/AgentPolicy.d.mts","default":"./dist/core/AgentPolicy.mjs"},"./agent-registration":{"types":"./dist/durable/AgentRegistration.d.mts","default":"./dist/durable/AgentRegistration.mjs"},"./agent-runtime":{"types":"./dist/engine/AgentRuntime.d.mts","default":"./dist/engine/AgentRuntime.mjs"},"./agent-updates":{"types":"./dist/core/AgentUpdates.d.mts","default":"./dist/core/AgentUpdates.mjs"},"./approval":{"types":"./dist/capabilities/Approval.d.mts","default":"./dist/capabilities/Approval.mjs"},"./browser-use":{"types":"./dist/capabilities/BrowserUse.d.mts","default":"./dist/capabilities/BrowserUse.mjs"},"./budget":{"types":"./dist/capabilities/Budget.d.mts","default":"./dist/capabilities/Budget.mjs"},"./code-executor":{"types":"./dist/sandbox/CodeExecutor.d.mts","default":"./dist/sandbox/CodeExecutor.mjs"},"./code-mode":{"types":"./dist/capabilities/CodeMode.d.mts","default":"./dist/capabilities/CodeMode.mjs"},"./commands":{"types":"./dist/capabilities/Commands.d.mts","default":"./dist/capabilities/Commands.mjs"},"./committed-activity":{"types":"./dist/durable/CommittedActivity.d.mts","default":"./dist/durable/CommittedActivity.mjs"},"./compaction":{"types":"./dist/engine/Compaction.d.mts","default":"./dist/engine/Compaction.mjs"},"./context-compactor":{"types":"./dist/engine/ContextCompactor.d.mts","default":"./dist/engine/ContextCompactor.mjs"},"./context-history":{"types":"./dist/engine/ContextHistory.d.mts","default":"./dist/engine/ContextHistory.mjs"},"./context-tools":{"types":"./dist/capabilities/ContextTools.d.mts","default":"./dist/capabilities/ContextTools.mjs"},"./context-window":{"types":"./dist/engine/ContextWindow.d.mts","default":"./dist/engine/ContextWindow.mjs"},"./digest":{"types":"./dist/durable/Digest.d.mts","default":"./dist/durable/Digest.mjs"},"./durable-agent-runtime":{"types":"./dist/durable/DurableAgentRuntime.d.mts","default":"./dist/durable/DurableAgentRuntime.mjs"},"./durable-failpoint":{"types":"./dist/durable/DurableFailpoint.d.mts","default":"./dist/durable/DurableFailpoint.mjs"},"./durable-step":{"types":"./dist/engine/DurableStep.d.mts","default":"./dist/engine/DurableStep.mjs"},"./event-source":{"types":"./dist/durable/EventSource.d.mts","default":"./dist/durable/EventSource.mjs"},"./failure-diagnostic":{"types":"./dist/core/FailureDiagnostic.d.mts","default":"./dist/core/FailureDiagnostic.mjs"},"./git-hub-workflow-source":{"types":"./dist/durable/GitHubWorkflowSource.d.mts","default":"./dist/durable/GitHubWorkflowSource.mjs"},"./id-generator":{"types":"./dist/core/IdGenerator.d.mts","default":"./dist/core/IdGenerator.mjs"},"./identifiers":{"types":"./dist/core/Identifiers.d.mts","default":"./dist/core/Identifiers.mjs"},"./in-memory":{"types":"./dist/InMemory.d.mts","default":"./dist/InMemory.mjs"},"./interactive-browser":{"types":"./dist/sandbox/InteractiveBrowser.d.mts","default":"./dist/sandbox/InteractiveBrowser.mjs"},"./mcp":{"types":"./dist/capabilities/Mcp.d.mts","default":"./dist/capabilities/Mcp.mjs"},"./mcp-client":{"types":"./dist/capabilities/McpClient.d.mts","default":"./dist/capabilities/McpClient.mjs"},"./memory":{"types":"./dist/core/Memory.d.mts","default":"./dist/core/Memory.mjs"},"./memory-namespace":{"types":"./dist/core/MemoryNamespace.d.mts","default":"./dist/core/MemoryNamespace.mjs"},"./memory-notes":{"types":"./dist/capabilities/MemoryNotes.d.mts","default":"./dist/capabilities/MemoryNotes.mjs"},"./memory-reference":{"types":"./dist/core/MemoryReference.d.mts","default":"./dist/core/MemoryReference.mjs"},"./memory-revalidation":{"types":"./dist/core/MemoryRevalidation.d.mts","default":"./dist/core/MemoryRevalidation.mjs"},"./memory-store":{"types":"./dist/core/MemoryStore.d.mts","default":"./dist/core/MemoryStore.mjs"},"./message-delivery":{"types":"./dist/durable/MessageDelivery.d.mts","default":"./dist/durable/MessageDelivery.mjs"},"./messaging":{"types":"./dist/capabilities/Messaging.d.mts","default":"./dist/capabilities/Messaging.mjs"},"./messaging-host":{"types":"./dist/engine/MessagingHost.d.mts","default":"./dist/engine/MessagingHost.mjs"},"./model-context":{"types":"./dist/capabilities/ModelContext.d.mts","default":"./dist/capabilities/ModelContext.mjs"},"./operation-authorizer":{"types":"./dist/durable/OperationAuthorizer.d.mts","default":"./dist/durable/OperationAuthorizer.mjs"},"./output":{"types":"./dist/engine/Output.d.mts","default":"./dist/engine/Output.mjs"},"./page-capture":{"types":"./dist/sandbox/PageCapture.d.mts","default":"./dist/sandbox/PageCapture.mjs"},"./page-crawl":{"types":"./dist/sandbox/PageCrawl.d.mts","default":"./dist/sandbox/PageCrawl.mjs"},"./page-screenshot":{"types":"./dist/sandbox/PageScreenshot.d.mts","default":"./dist/sandbox/PageScreenshot.mjs"},"./persistent-history":{"types":"./dist/durable/PersistentHistory.d.mts","default":"./dist/durable/PersistentHistory.mjs"},"./prepared-input-admission":{"types":"./dist/durable/PreparedInputAdmission.d.mts","default":"./dist/durable/PreparedInputAdmission.mjs"},"./provisional-text":{"types":"./dist/core/ProvisionalText.d.mts","default":"./dist/core/ProvisionalText.mjs"},"./receipt":{"types":"./dist/core/Receipt.d.mts","default":"./dist/core/Receipt.mjs"},"./records":{"types":"./dist/durable/Records.d.mts","default":"./dist/durable/Records.mjs"},"./recovery":{"types":"./dist/durable/Recovery.d.mts","default":"./dist/durable/Recovery.mjs"},"./redaction":{"types":"./dist/capabilities/Redaction.d.mts","default":"./dist/capabilities/Redaction.mjs"},"./remembering":{"types":"./dist/capabilities/Remembering.d.mts","default":"./dist/capabilities/Remembering.mjs"},"./remembering-store":{"types":"./dist/core/RememberingStore.d.mts","default":"./dist/core/RememberingStore.mjs"},"./run-event":{"types":"./dist/core/RunEvent.d.mts","default":"./dist/core/RunEvent.mjs"},"./run-event-sink":{"types":"./dist/engine/RunEventSink.d.mts","default":"./dist/engine/RunEventSink.mjs"},"./run-hooks":{"types":"./dist/capabilities/RunHooks.d.mts","default":"./dist/capabilities/RunHooks.mjs"},"./run-journal":{"types":"./dist/durable/RunJournal.d.mts","default":"./dist/durable/RunJournal.mjs"},"./run-continuation":{"types":"./dist/durable/RunContinuation.d.mts","default":"./dist/durable/RunContinuation.mjs"},"./thread-work":{"types":"./dist/durable/ThreadWork.d.mts","default":"./dist/durable/ThreadWork.mjs"},"./run-options":{"types":"./dist/engine/RunOptions.d.mts","default":"./dist/engine/RunOptions.mjs"},"./run-policy-usage":{"types":"./dist/core/RunPolicyUsage.d.mts","default":"./dist/core/RunPolicyUsage.mjs"},"./run-storage":{"types":"./dist/durable/RunStorage.d.mts","default":"./dist/durable/RunStorage.mjs"},"./sandbox":{"types":"./dist/sandbox/Sandbox.d.mts","default":"./dist/sandbox/Sandbox.mjs"},"./schedule":{"types":"./dist/durable/Schedule.d.mts","default":"./dist/durable/Schedule.mjs"},"./schedule-transition":{"types":"./dist/durable/ScheduleTransition.d.mts","default":"./dist/durable/ScheduleTransition.mjs"},"./scheduling":{"types":"./dist/durable/Scheduling.d.mts","default":"./dist/durable/Scheduling.mjs"},"./semantic-memory":{"types":"./dist/capabilities/SemanticMemory.d.mts","default":"./dist/capabilities/SemanticMemory.mjs"},"./semantic-memory-index":{"types":"./dist/core/SemanticMemoryIndex.d.mts","default":"./dist/core/SemanticMemoryIndex.mjs"},"./semantic-memory-revalidation":{"types":"./dist/core/SemanticMemoryRevalidation.d.mts","default":"./dist/core/SemanticMemoryRevalidation.mjs"},"./settlement-publisher":{"types":"./dist/durable/SettlementPublisher.d.mts","default":"./dist/durable/SettlementPublisher.mjs"},"./sql-memory-store":{"types":"./dist/durable/SqlMemoryStore.d.mts","default":"./dist/durable/SqlMemoryStore.mjs"},"./subagent":{"types":"./dist/capabilities/Subagent.d.mts","default":"./dist/capabilities/Subagent.mjs"},"./subagent-contract":{"types":"./dist/core/SubagentContract.d.mts","default":"./dist/core/SubagentContract.mjs"},"./subagent-host":{"types":"./dist/engine/SubagentHost.d.mts","default":"./dist/engine/SubagentHost.mjs"},"./subagent-reservations":{"types":"./dist/capabilities/SubagentReservations.d.mts","default":"./dist/capabilities/SubagentReservations.mjs"},"./submission-ledger":{"types":"./dist/durable/SubmissionLedger.d.mts","default":"./dist/durable/SubmissionLedger.mjs"},"./submission-status":{"types":"./dist/durable/SubmissionStatus.d.mts","default":"./dist/durable/SubmissionStatus.mjs"},"./subscription":{"types":"./dist/durable/Subscription.d.mts","default":"./dist/durable/Subscription.mjs"},"./subscription-input":{"types":"./dist/durable/SubscriptionInput.d.mts","default":"./dist/durable/SubscriptionInput.mjs"},"./subscription-tools":{"types":"./dist/durable/SubscriptionTools.d.mts","default":"./dist/durable/SubscriptionTools.mjs"},"./subscription-transition":{"types":"./dist/durable/SubscriptionTransition.d.mts","default":"./dist/durable/SubscriptionTransition.mjs"},"./subscriptions":{"types":"./dist/durable/Subscriptions.d.mts","default":"./dist/durable/Subscriptions.mjs"},"./testing/certification":{"types":"./dist/durable/Certification.d.mts","default":"./dist/durable/Certification.mjs"},"./testing/durable-failpoint-test-control":{"types":"./dist/durable/DurableFailpointTestControl.d.mts","default":"./dist/durable/DurableFailpointTestControl.mjs"},"./testing/message-delivery-store-conformance":{"types":"./dist/durable/MessageDeliveryStoreConformance.d.mts","default":"./dist/durable/MessageDeliveryStoreConformance.mjs"},"./testing/schedule-store-conformance":{"types":"./dist/durable/ScheduleStoreConformance.d.mts","default":"./dist/durable/ScheduleStoreConformance.mjs"},"./testing/submission-ledger-conformance":{"types":"./dist/durable/SubmissionLedgerConformance.d.mts","default":"./dist/durable/SubmissionLedgerConformance.mjs"},"./testing/subscription-store-conformance":{"types":"./dist/durable/SubscriptionStoreConformance.d.mts","default":"./dist/durable/SubscriptionStoreConformance.mjs"},"./testing/thread-store-conformance":{"types":"./dist/durable/ThreadStoreConformance.d.mts","default":"./dist/durable/ThreadStoreConformance.mjs"},"./thread":{"types":"./dist/core/Thread.d.mts","default":"./dist/core/Thread.mjs"},"./thread-context-history":{"types":"./dist/durable/ThreadContextHistory.d.mts","default":"./dist/durable/ThreadContextHistory.mjs"},"./thread-context-history-projection":{"types":"./dist/durable/ThreadContextHistoryProjection.d.mts","default":"./dist/durable/ThreadContextHistoryProjection.mjs"},"./thread-history":{"types":"./dist/engine/ThreadHistory.d.mts","default":"./dist/engine/ThreadHistory.mjs"},"./thread-invariants":{"types":"./dist/durable/ThreadInvariants.d.mts","default":"./dist/durable/ThreadInvariants.mjs"},"./thread-projection":{"types":"./dist/durable/ThreadProjection.d.mts","default":"./dist/durable/ThreadProjection.mjs"},"./thread-projection-maintenance":{"types":"./dist/durable/ThreadProjectionMaintenance.d.mts","default":"./dist/durable/ThreadProjectionMaintenance.mjs"},"./thread-reader":{"types":"./dist/durable/ThreadReader.d.mts","default":"./dist/durable/ThreadReader.mjs"},"./thread-store":{"types":"./dist/durable/ThreadStore.d.mts","default":"./dist/durable/ThreadStore.mjs"},"./tool-broker":{"types":"./dist/engine/ToolBroker.d.mts","default":"./dist/engine/ToolBroker.mjs"},"./tool-discovery":{"types":"./dist/capabilities/ToolDiscovery.d.mts","default":"./dist/capabilities/ToolDiscovery.mjs"},"./tool-exposure":{"types":"./dist/ToolExposure.d.mts","default":"./dist/ToolExposure.mjs"},"./tool-reconciler":{"types":"./dist/durable/ToolReconciler.d.mts","default":"./dist/durable/ToolReconciler.mjs"},"./tool-result":{"types":"./dist/core/ToolResult.d.mts","default":"./dist/core/ToolResult.mjs"},"./usage":{"types":"./dist/core/Usage.d.mts","default":"./dist/core/Usage.mjs"},"./wake-scheduler":{"types":"./dist/durable/WakeScheduler.d.mts","default":"./dist/durable/WakeScheduler.mjs"},"./web-capture":{"types":"./dist/capabilities/WebCapture.d.mts","default":"./dist/capabilities/WebCapture.mjs"},"./web-search":{"types":"./dist/capabilities/WebSearch.d.mts","default":"./dist/capabilities/WebSearch.mjs"},"./worker":{"types":"./dist/core/Worker.d.mts","default":"./dist/core/Worker.mjs"},"./worker-admission":{"types":"./dist/durable/WorkerAdmission.d.mts","default":"./dist/durable/WorkerAdmission.mjs"},"./worker-host":{"types":"./dist/durable/WorkerHost.d.mts","default":"./dist/durable/WorkerHost.mjs"},"./lifecycle-publication":{"types":"./dist/durable/LifecyclePublication.d.mts","default":"./dist/durable/LifecyclePublication.mjs"},"./record-format":{"types":"./dist/durable/RecordFormat.d.mts","default":"./dist/durable/RecordFormat.mjs"},"./thread-import":{"types":"./dist/durable/ThreadImport.d.mts","default":"./dist/durable/ThreadImport.mjs"},"./thread-archive-range":{"types":"./dist/durable/ThreadArchiveRange.d.mts","default":"./dist/durable/ThreadArchiveRange.mjs"},"./thread-transfer":{"types":"./dist/durable/ThreadTransfer.d.mts","default":"./dist/durable/ThreadTransfer.mjs"}},"description":"Effect-native agents, execution, subagents, and sandbox contracts in one tree-shakeable package.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/agent.git","directory":"packages/effect-agent"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests"}}
|
|
@@ -150,76 +150,74 @@ export const ApprovalAuditMemoryLive = Layer.effect(
|
|
|
150
150
|
const state = yield* Ref.make<AuditState>({ events: [], pending: new Set() });
|
|
151
151
|
|
|
152
152
|
return ApprovalAudit.of({
|
|
153
|
-
recordRequest: (request)
|
|
154
|
-
|
|
155
|
-
const recordedAt = DateTime.toUtc(DateTime.makeUnsafe(yield* Clock.currentTimeMillis));
|
|
156
|
-
|
|
157
|
-
const error = yield* Ref.modify(state, (current) => {
|
|
158
|
-
// Each accepted request atomically reserves room for its decision.
|
|
159
|
-
const reservedSize = current.events.length + current.pending.size + 2;
|
|
160
|
-
|
|
161
|
-
if (reservedSize > MAX_APPROVAL_AUDIT_EVENTS) {
|
|
162
|
-
return [
|
|
163
|
-
ApprovalAuditLimitExceeded.make({
|
|
164
|
-
limitValue: MAX_APPROVAL_AUDIT_EVENTS,
|
|
165
|
-
observedValue: reservedSize,
|
|
166
|
-
}),
|
|
167
|
-
current,
|
|
168
|
-
] as const;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const event = ApprovalRequestRecorded.make({
|
|
172
|
-
sequence: current.events.length,
|
|
173
|
-
recordedAt,
|
|
174
|
-
request,
|
|
175
|
-
});
|
|
153
|
+
recordRequest: Effect.fnUntraced(function* (request) {
|
|
154
|
+
const recordedAt = DateTime.toUtc(DateTime.makeUnsafe(yield* Clock.currentTimeMillis));
|
|
176
155
|
|
|
156
|
+
const error = yield* Ref.modify(state, (current) => {
|
|
157
|
+
// Each accepted request atomically reserves room for its decision.
|
|
158
|
+
const reservedSize = current.events.length + current.pending.size + 2;
|
|
159
|
+
|
|
160
|
+
if (reservedSize > MAX_APPROVAL_AUDIT_EVENTS) {
|
|
177
161
|
return [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
162
|
+
ApprovalAuditLimitExceeded.make({
|
|
163
|
+
limitValue: MAX_APPROVAL_AUDIT_EVENTS,
|
|
164
|
+
observedValue: reservedSize,
|
|
165
|
+
}),
|
|
166
|
+
current,
|
|
183
167
|
] as const;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const event = ApprovalRequestRecorded.make({
|
|
171
|
+
sequence: current.events.length,
|
|
172
|
+
recordedAt,
|
|
173
|
+
request,
|
|
184
174
|
});
|
|
185
175
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
current,
|
|
200
|
-
] as const;
|
|
201
|
-
}
|
|
202
|
-
const pending = new Set(current.pending);
|
|
203
|
-
|
|
204
|
-
pending.delete(decision.requestId);
|
|
205
|
-
|
|
206
|
-
const event = ApprovalDecisionRecorded.make({
|
|
207
|
-
sequence: current.events.length,
|
|
208
|
-
recordedAt,
|
|
209
|
-
decision,
|
|
210
|
-
});
|
|
176
|
+
return [
|
|
177
|
+
undefined,
|
|
178
|
+
{
|
|
179
|
+
events: [...current.events, event],
|
|
180
|
+
pending: new Set(current.pending).add(request.requestId),
|
|
181
|
+
},
|
|
182
|
+
] as const;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
if (error !== undefined) return yield* error;
|
|
186
|
+
}),
|
|
187
|
+
recordDecision: Effect.fnUntraced(function* (decision) {
|
|
188
|
+
const recordedAt = DateTime.toUtc(DateTime.makeUnsafe(yield* Clock.currentTimeMillis));
|
|
211
189
|
|
|
190
|
+
const error = yield* Ref.modify(state, (current) => {
|
|
191
|
+
if (!current.pending.has(decision.requestId)) {
|
|
212
192
|
return [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
193
|
+
ApprovalDecisionMismatch.make({
|
|
194
|
+
expectedRequestId: [...current.pending][0] ?? "no-pending-request",
|
|
195
|
+
observedRequestId: decision.requestId,
|
|
196
|
+
}),
|
|
197
|
+
current,
|
|
218
198
|
] as const;
|
|
199
|
+
}
|
|
200
|
+
const pending = new Set(current.pending);
|
|
201
|
+
|
|
202
|
+
pending.delete(decision.requestId);
|
|
203
|
+
|
|
204
|
+
const event = ApprovalDecisionRecorded.make({
|
|
205
|
+
sequence: current.events.length,
|
|
206
|
+
recordedAt,
|
|
207
|
+
decision,
|
|
219
208
|
});
|
|
220
209
|
|
|
221
|
-
|
|
222
|
-
|
|
210
|
+
return [
|
|
211
|
+
undefined,
|
|
212
|
+
{
|
|
213
|
+
events: [...current.events, event],
|
|
214
|
+
pending,
|
|
215
|
+
},
|
|
216
|
+
] as const;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (error !== undefined) return yield* error;
|
|
220
|
+
}),
|
|
223
221
|
events: Ref.get(state).pipe(Effect.map((current) => current.events)),
|
|
224
222
|
});
|
|
225
223
|
}),
|