@yielded/agent 0.1.0-beta.174 → 0.1.0-beta.176
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-BHmp2V9p.d.mts → Admin-DTDihBra.d.mts} +50 -13
- package/dist/{AgentRuntime-BD3ZHAMq.d.mts → AgentRuntime-CHDyRbSf.d.mts} +3 -3
- package/dist/{AgentRuntime-B6qZlD3f.mjs → AgentRuntime-DaDKMasp.mjs} +123 -114
- package/dist/AgentRuntime-DaDKMasp.mjs.map +1 -0
- package/dist/{Digest-EpeqWEdv.mjs → Digest-C3EODOee.mjs} +2 -2
- package/dist/{Digest-EpeqWEdv.mjs.map → Digest-C3EODOee.mjs.map} +1 -1
- package/dist/{DurableAgentRuntime-CBBjRNJN.mjs → DurableAgentRuntime-BJbuIqQq.mjs} +237 -114
- package/dist/DurableAgentRuntime-BJbuIqQq.mjs.map +1 -0
- package/dist/{EventSource-C9aaJaXT.d.mts → EventSource-Cc58uEso.d.mts} +2 -2
- package/dist/InMemory.d.mts +2 -2
- package/dist/{MessageDelivery-BGDm-c46.d.mts → MessageDelivery-ClHg7c0O.d.mts} +42 -42
- package/dist/{MessagingHost-CRUK4JBi.mjs → MessagingHost-CZCyrnvJ.mjs} +27 -26
- package/dist/MessagingHost-CZCyrnvJ.mjs.map +1 -0
- package/dist/{PreparedInputAdmission-BvDqlgiP.d.mts → PreparedInputAdmission-CjcX1OP0.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-4ZATcVLB.mjs → RunContinuation-CWHuciup.mjs} +74 -40
- package/dist/RunContinuation-CWHuciup.mjs.map +1 -0
- package/dist/{RunContinuation-CTJ1jGrO.d.mts → RunContinuation-DSnUTSSb.d.mts} +11 -5
- package/dist/{RunJournal-CNZqA3Ge.mjs → RunJournal-DGblbFas.mjs} +86 -81
- package/dist/RunJournal-DGblbFas.mjs.map +1 -0
- package/dist/{RunStorage-BHjuuERI.mjs → RunStorage-BF2YgWkg.mjs} +44 -33
- package/dist/RunStorage-BF2YgWkg.mjs.map +1 -0
- package/dist/{Scheduling-NG8slKdI.mjs → Scheduling-07_dsGED.mjs} +3 -3
- package/dist/{Scheduling-NG8slKdI.mjs.map → Scheduling-07_dsGED.mjs.map} +1 -1
- package/dist/{Subagent-CTIpnzlB.mjs → Subagent-CexndZSp.mjs} +2 -2
- package/dist/{Subagent-CTIpnzlB.mjs.map → Subagent-CexndZSp.mjs.map} +1 -1
- package/dist/{Subagent-DKhZA72u.d.mts → Subagent-xhN_aD1r.d.mts} +3 -3
- package/dist/{Subscription-BNg9VCRl.d.mts → Subscription-DuC_PcGx.d.mts} +2 -2
- package/dist/{SubscriptionInput-BUoXv-_K.d.mts → SubscriptionInput-B1IeAEDi.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-CMgzttvr.d.mts → ThreadImport-D_Biid6w.d.mts} +42 -42
- package/dist/{ThreadImport-CodYoJoa.mjs → ThreadImport-ZgWxf7bB.mjs} +8 -8
- package/dist/{ThreadImport-CodYoJoa.mjs.map → ThreadImport-ZgWxf7bB.mjs.map} +1 -1
- package/dist/{ThreadStore-59uDGXul.mjs → ThreadStore-BC4V-mY-.mjs} +42 -23
- package/dist/ThreadStore-BC4V-mY-.mjs.map +1 -0
- package/dist/{ThreadTransfer-3jigUl3g.mjs → ThreadTransfer-S7FnTRHt.mjs} +4 -4
- package/dist/{ThreadTransfer-3jigUl3g.mjs.map → ThreadTransfer-S7FnTRHt.mjs.map} +1 -1
- package/dist/{WorkerAdmission-DDYJdOsU.mjs → WorkerAdmission-C47Vy_cK.mjs} +5 -5
- package/dist/{WorkerAdmission-DDYJdOsU.mjs.map → WorkerAdmission-C47Vy_cK.mjs.map} +1 -1
- package/dist/{agent-registration-DRbyhAu-.mjs → agent-registration-a6QYaG3h.mjs} +4 -4
- package/dist/{agent-registration-DRbyhAu-.mjs.map → agent-registration-a6QYaG3h.mjs.map} +1 -1
- package/dist/capabilities/Messaging.mjs +1 -1
- package/dist/capabilities/ModelContext.d.mts +1 -1
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +1 -1
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/core/Thread.d.mts +2 -2
- package/dist/core/Thread.mjs +5 -3
- package/dist/core/Thread.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 +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 +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 +7 -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 +2 -2
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +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 +2 -2
- 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 +4 -4
- 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 +68 -68
- package/dist/durable/WorkerAdmission.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/engine/MessagingHost.mjs +1 -1
- package/dist/engine/Output.mjs +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 +12 -12
- package/dist/index.mjs +13 -13
- 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-CC7ZD95F.d.mts → run-context-reader-DvTEq2RC.d.mts} +2 -2
- package/package.json +1 -1
- package/src/core/Thread.ts +143 -146
- package/src/durable/DurableAgentRuntime.ts +549 -260
- package/src/durable/RunContinuation.ts +115 -64
- package/src/durable/RunJournal.ts +107 -112
- package/src/durable/RunStorage.ts +90 -61
- package/src/durable/SqlMemoryStore.ts +8 -6
- package/src/durable/SubmissionLedger.ts +15 -0
- package/src/durable/ThreadStore.ts +48 -26
- package/src/durable/ThreadWork.ts +10 -0
- package/src/durable/WakeScheduler.ts +34 -66
- package/src/durable/internal/initial-context.ts +17 -2
- package/src/durable/internal/prompt-history-cache.ts +13 -8
- package/src/durable/internal/usage-totals.ts +28 -31
- package/src/engine/MessagingHost.ts +4 -2
- package/src/engine/ThreadHistory.ts +47 -48
- package/src/engine/internal/agent-runtime.ts +234 -202
- package/src/engine/internal/output-contract.ts +15 -15
- package/src/engine/internal/primitive-delta.ts +2 -3
- package/src/engine/internal/tool-telemetry.ts +3 -5
- package/dist/AgentRuntime-B6qZlD3f.mjs.map +0 -1
- package/dist/DurableAgentRuntime-CBBjRNJN.mjs.map +0 -1
- package/dist/MessagingHost-CRUK4JBi.mjs.map +0 -1
- package/dist/RunContinuation-4ZATcVLB.mjs.map +0 -1
- package/dist/RunJournal-CNZqA3Ge.mjs.map +0 -1
- package/dist/RunStorage-BHjuuERI.mjs.map +0 -1
- package/dist/ThreadStore-59uDGXul.mjs.map +0 -1
|
@@ -3,7 +3,7 @@ import { a as Receipt } from "../Receipt-BkM21Qiu.mjs";
|
|
|
3
3
|
import { r as Update } from "../AgentUpdates-DksV4D0A.mjs";
|
|
4
4
|
import { t as AgentPolicy } from "../AgentPolicy-B4lbCU2T.mjs";
|
|
5
5
|
import { b as DefinitionDigests } from "../Records-BTnGRdcf.mjs";
|
|
6
|
-
import { Gi as ThreadStoreError, Gt as LedgerError, Jr as AppendConflict, Mi as ThreadNotMaterialized, Ui as ThreadStore, Xt as OwnershipLost, Zt as ParentLinkage, _t as AdmissionPolicyError, bt as AdmissionResult, dn as SubmissionLedger, ft as AdmissionConflict } from "../Admin-
|
|
6
|
+
import { Gi as ThreadStoreError, Gt as LedgerError, Jr as AppendConflict, Mi as ThreadNotMaterialized, Ui as ThreadStore, Xt as OwnershipLost, Zt as ParentLinkage, _t as AdmissionPolicyError, bt as AdmissionResult, dn as SubmissionLedger, ft as AdmissionConflict } from "../Admin-DTDihBra.mjs";
|
|
7
7
|
import { n as DurableRuntimeFailpoint, r as DurableRuntimeFailpointError } from "../DurableFailpoint-BugHZKvJ.mjs";
|
|
8
8
|
import { t as WakeScheduler } from "../WakeScheduler-DJIMMf77.mjs";
|
|
9
9
|
import { Context, Effect, Schema } from "effect";
|
|
@@ -11,6 +11,73 @@ declare namespace WorkerAdmission_d_exports {
|
|
|
11
11
|
export { WorkerAdmissionFailure, WorkerAdmissionPort, WorkerAdmissionRequest, admitWorker };
|
|
12
12
|
}
|
|
13
13
|
declare const WorkerAdmissionRequest_base: Schema.Class<WorkerAdmissionRequest, Schema.Struct<{
|
|
14
|
+
readonly workerAdmission: Schema.Struct<{
|
|
15
|
+
readonly origin: Schema.Struct<{
|
|
16
|
+
readonly worker: Schema.Struct<{
|
|
17
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
18
|
+
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
19
|
+
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
20
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
21
|
+
}>;
|
|
22
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
23
|
+
readonly _tag: Schema.Literal<"tool">;
|
|
24
|
+
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
25
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
26
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
27
|
+
readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly _tag: Schema.Literal<"programmatic">;
|
|
30
|
+
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
31
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
32
|
+
}>]>;
|
|
33
|
+
readonly continuationOf: Schema.optionalKey<Schema.Struct<{
|
|
34
|
+
readonly worker: Schema.Struct<{
|
|
35
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
36
|
+
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
37
|
+
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
38
|
+
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
39
|
+
}>;
|
|
40
|
+
readonly receipt: typeof Receipt;
|
|
41
|
+
readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
|
|
42
|
+
}>>;
|
|
43
|
+
readonly budgetScope: Schema.Literals<readonly ["source-subtree", "worker-run"]>;
|
|
44
|
+
readonly lifecycle: Schema.optionalKey<Schema.Literal<"assignment">>;
|
|
45
|
+
readonly targetDigests: typeof DefinitionDigests;
|
|
46
|
+
readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
|
|
47
|
+
readonly budget: Schema.Struct<{
|
|
48
|
+
readonly caps: typeof SubagentDelegationCaps;
|
|
49
|
+
readonly allocation: typeof SubagentReservationAmounts;
|
|
50
|
+
readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
|
|
51
|
+
}>;
|
|
52
|
+
readonly grant: typeof SubagentGrant;
|
|
53
|
+
readonly depth: Schema.Int;
|
|
54
|
+
readonly toolCallAllowance: Schema.optionalKey<Schema.Int>;
|
|
55
|
+
readonly firstMessageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
56
|
+
readonly createdAtMillis: Schema.Natural;
|
|
57
|
+
readonly expiresAtMillis: Schema.Natural;
|
|
58
|
+
readonly reporting: Schema.optionalKey<Schema.Struct<{
|
|
59
|
+
readonly mode: Schema.optionalKey<Schema.Literal<"standard">>;
|
|
60
|
+
readonly sourceDigests: typeof DefinitionDigests;
|
|
61
|
+
readonly destinationDelegationId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">>;
|
|
62
|
+
readonly returnAddress: Schema.optionalKey<Schema.Struct<{
|
|
63
|
+
readonly input: Schema.declare<Schema.Json, Schema.Json>;
|
|
64
|
+
readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
|
|
65
|
+
readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
|
|
66
|
+
readonly depth: Schema.Natural;
|
|
67
|
+
readonly grant: Schema.optionalKey<typeof SubagentGrant>;
|
|
68
|
+
readonly workerAdmission: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
|
|
69
|
+
}>>;
|
|
70
|
+
}>>;
|
|
71
|
+
}>;
|
|
72
|
+
readonly executionRunId: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">>;
|
|
73
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
74
|
+
readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
|
|
75
|
+
readonly createdAtMillis: Schema.Natural;
|
|
76
|
+
readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
|
|
77
|
+
readonly deliveryPrincipal: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">>;
|
|
78
|
+
readonly reportKind: Schema.optionalKey<Schema.Literal<"update">>;
|
|
79
|
+
}>;
|
|
80
|
+
readonly producerId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ProducerId">;
|
|
14
81
|
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
15
82
|
readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
|
|
16
83
|
readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
@@ -87,73 +154,6 @@ declare const WorkerAdmissionRequest_base: Schema.Class<WorkerAdmissionRequest,
|
|
|
87
154
|
readonly key: Schema.NonEmptyString;
|
|
88
155
|
readonly revision: Schema.NonEmptyString;
|
|
89
156
|
}>>;
|
|
90
|
-
readonly workerAdmission: Schema.Struct<{
|
|
91
|
-
readonly origin: Schema.Struct<{
|
|
92
|
-
readonly worker: Schema.Struct<{
|
|
93
|
-
readonly schemaVersion: Schema.Literal<1>;
|
|
94
|
-
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
95
|
-
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
96
|
-
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
97
|
-
}>;
|
|
98
|
-
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
99
|
-
readonly _tag: Schema.Literal<"tool">;
|
|
100
|
-
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
101
|
-
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
102
|
-
readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
|
|
103
|
-
readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
|
|
104
|
-
}>, Schema.Struct<{
|
|
105
|
-
readonly _tag: Schema.Literal<"programmatic">;
|
|
106
|
-
readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
107
|
-
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
108
|
-
}>]>;
|
|
109
|
-
readonly continuationOf: Schema.optionalKey<Schema.Struct<{
|
|
110
|
-
readonly worker: Schema.Struct<{
|
|
111
|
-
readonly schemaVersion: Schema.Literal<1>;
|
|
112
|
-
readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
|
|
113
|
-
readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
|
|
114
|
-
readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
|
|
115
|
-
}>;
|
|
116
|
-
readonly receipt: typeof Receipt;
|
|
117
|
-
readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
|
|
118
|
-
}>>;
|
|
119
|
-
readonly budgetScope: Schema.Literals<readonly ["source-subtree", "worker-run"]>;
|
|
120
|
-
readonly lifecycle: Schema.optionalKey<Schema.Literal<"assignment">>;
|
|
121
|
-
readonly targetDigests: typeof DefinitionDigests;
|
|
122
|
-
readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
|
|
123
|
-
readonly budget: Schema.Struct<{
|
|
124
|
-
readonly caps: typeof SubagentDelegationCaps;
|
|
125
|
-
readonly allocation: typeof SubagentReservationAmounts;
|
|
126
|
-
readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
|
|
127
|
-
}>;
|
|
128
|
-
readonly grant: typeof SubagentGrant;
|
|
129
|
-
readonly depth: Schema.Int;
|
|
130
|
-
readonly toolCallAllowance: Schema.optionalKey<Schema.Int>;
|
|
131
|
-
readonly firstMessageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
132
|
-
readonly createdAtMillis: Schema.Natural;
|
|
133
|
-
readonly expiresAtMillis: Schema.Natural;
|
|
134
|
-
readonly reporting: Schema.optionalKey<Schema.Struct<{
|
|
135
|
-
readonly mode: Schema.optionalKey<Schema.Literal<"standard">>;
|
|
136
|
-
readonly sourceDigests: typeof DefinitionDigests;
|
|
137
|
-
readonly destinationDelegationId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">>;
|
|
138
|
-
readonly returnAddress: Schema.optionalKey<Schema.Struct<{
|
|
139
|
-
readonly input: Schema.declare<Schema.Json, Schema.Json>;
|
|
140
|
-
readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
|
|
141
|
-
readonly policy: Schema.toCodecJson<typeof AgentPolicy>;
|
|
142
|
-
readonly depth: Schema.Natural;
|
|
143
|
-
readonly grant: Schema.optionalKey<typeof SubagentGrant>;
|
|
144
|
-
readonly workerAdmission: Schema.optionalKey<Schema.declare<Schema.Json, Schema.Json>>;
|
|
145
|
-
}>>;
|
|
146
|
-
}>>;
|
|
147
|
-
}>;
|
|
148
|
-
readonly executionRunId: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">>;
|
|
149
|
-
readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
|
|
150
|
-
readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
|
|
151
|
-
readonly createdAtMillis: Schema.Natural;
|
|
152
|
-
readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
|
|
153
|
-
readonly deliveryPrincipal: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">>;
|
|
154
|
-
readonly reportKind: Schema.optionalKey<Schema.Literal<"update">>;
|
|
155
|
-
}>;
|
|
156
|
-
readonly producerId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ProducerId">;
|
|
157
157
|
}>, {}>;
|
|
158
158
|
/**
|
|
159
159
|
* Storage admission after source authorization, input validation and capacity reservation.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as admitWorker, n as WorkerAdmissionPort, r as WorkerAdmissionRequest, t as WorkerAdmissionFailure } from "../WorkerAdmission-
|
|
1
|
+
import { a as admitWorker, n as WorkerAdmissionPort, r as WorkerAdmissionRequest, t as WorkerAdmissionFailure } from "../WorkerAdmission-C47Vy_cK.mjs";
|
|
2
2
|
export { WorkerAdmissionFailure, WorkerAdmissionPort, WorkerAdmissionRequest, admitWorker };
|
|
@@ -5,7 +5,7 @@ import { t as AgentPolicy } from "../AgentPolicy-B4lbCU2T.mjs";
|
|
|
5
5
|
import { r as AnyDefinition, t as Agent_d_exports } from "../Agent-B39jRnFv.mjs";
|
|
6
6
|
import { c as WorkerError, f as WorkerRef, h as WorkerSource } from "../Worker-CHRaIsWu.mjs";
|
|
7
7
|
import { Ft as WorkerContinuation, K as PersistedJson, S as Digest, b as DefinitionDigests, p as CanonicalSequence, zt as WorkerOrigin } from "../Records-BTnGRdcf.mjs";
|
|
8
|
-
import { vn as SubmissionSnapshot } from "../Admin-
|
|
8
|
+
import { vn as SubmissionSnapshot } from "../Admin-DTDihBra.mjs";
|
|
9
9
|
import { Context, Effect, Option, Schema } from "effect";
|
|
10
10
|
declare namespace WorkerHost_d_exports {
|
|
11
11
|
export { WorkerBudgetAuthorizer, WorkerConcurrencyLimit, WorkerConcurrencyResolver, WorkerHostAuthorizationRequest, WorkerHostAuthorizer, WorkerHostConfig, WorkerHostLimits, WorkerPolicyResolver, WorkerPolicySource, WorkerPolicyTarget, WorkerStartAdmission };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as runUnknown, C as decodeFinalOutput, D as projectCompletionOutput, E as projectCompletionFromToolOutput, F as streamWithUsageAccountingUnknown, I as withTerminalDefectEvent, M as startUnknown, N as stream, O as renderInputPrompt, P as streamUnknown, S as ToolCallWaiting, T as executeWithUsageAccountingUnknown, _ as SubagentDurability, a as AgentResultSchema, b as SubagentDurabilityError, c as AgentSpawner, d as DetachedRun, f as EngineProvidedToolServices, g as SpawnedChildRun, h as SpawnRunOptions, i as AgentResult, j as start, k as run, l as AgentSpawnerParent, m as SpawnDelegation, n as AgentChildPending, o as AgentRuntimeFailure, p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements, u as AgentSpawnerService, v as SubagentDurabilityDurable, w as encodeRunDisposition, x as SubagentDurabilityService, y as SubagentDurabilityEphemeral } from "../AgentRuntime-
|
|
1
|
+
import { A as runUnknown, C as decodeFinalOutput, D as projectCompletionOutput, E as projectCompletionFromToolOutput, F as streamWithUsageAccountingUnknown, I as withTerminalDefectEvent, M as startUnknown, N as stream, O as renderInputPrompt, P as streamUnknown, S as ToolCallWaiting, T as executeWithUsageAccountingUnknown, _ as SubagentDurability, a as AgentResultSchema, b as SubagentDurabilityError, c as AgentSpawner, d as DetachedRun, f as EngineProvidedToolServices, g as SpawnedChildRun, h as SpawnRunOptions, i as AgentResult, j as start, k as run, l as AgentSpawnerParent, m as SpawnDelegation, n as AgentChildPending, o as AgentRuntimeFailure, p as RuntimeBinding, r as AgentCompletionProjectionRequirements, s as AgentRuntimeRequirements, u as AgentSpawnerService, v as SubagentDurabilityDurable, w as encodeRunDisposition, x as SubagentDurabilityService, y as SubagentDurabilityEphemeral } from "../AgentRuntime-CHDyRbSf.mjs";
|
|
2
2
|
export { AgentChildPending, type AgentCompletionProjectionRequirements, type AgentResult, AgentResultSchema, type AgentRuntimeFailure, type AgentRuntimeRequirements, AgentSpawner, type AgentSpawnerParent, type AgentSpawnerService, type DetachedRun, type EngineProvidedToolServices, type RuntimeBinding, type SpawnDelegation, type SpawnRunOptions, type SpawnedChildRun, SubagentDurability, type SubagentDurabilityDurable, type SubagentDurabilityEphemeral, SubagentDurabilityError, type SubagentDurabilityService, ToolCallWaiting, decodeFinalOutput, encodeRunDisposition, executeWithUsageAccountingUnknown, projectCompletionFromToolOutput, projectCompletionOutput, renderInputPrompt, run, runUnknown, start, startUnknown, stream, streamUnknown, streamWithUsageAccountingUnknown, withTerminalDefectEvent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as startUnknown, a as SubagentDurability, b as streamWithUsageAccountingUnknown, c as decodeFinalOutput, d as projectCompletionFromToolOutput, f as projectCompletionOutput, g as start, h as runUnknown, i as AgentSpawner, l as encodeRunDisposition, m as run, n as AgentChildPending, o as SubagentDurabilityError, p as renderInputPrompt, r as AgentResultSchema, s as ToolCallWaiting, u as executeWithUsageAccountingUnknown, v as stream, x as withTerminalDefectEvent, y as streamUnknown } from "../AgentRuntime-
|
|
1
|
+
import { _ as startUnknown, a as SubagentDurability, b as streamWithUsageAccountingUnknown, c as decodeFinalOutput, d as projectCompletionFromToolOutput, f as projectCompletionOutput, g as start, h as runUnknown, i as AgentSpawner, l as encodeRunDisposition, m as run, n as AgentChildPending, o as SubagentDurabilityError, p as renderInputPrompt, r as AgentResultSchema, s as ToolCallWaiting, u as executeWithUsageAccountingUnknown, v as stream, x as withTerminalDefectEvent, y as streamUnknown } from "../AgentRuntime-DaDKMasp.mjs";
|
|
2
2
|
export { AgentChildPending, AgentResultSchema, AgentSpawner, SubagentDurability, SubagentDurabilityError, ToolCallWaiting, decodeFinalOutput, encodeRunDisposition, executeWithUsageAccountingUnknown, projectCompletionFromToolOutput, projectCompletionOutput, renderInputPrompt, run, runUnknown, start, startUnknown, stream, streamUnknown, streamWithUsageAccountingUnknown, withTerminalDefectEvent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PeerMessageCapacity, i as PeerDeliveryLifetime, o as PeerRoutes, r as PeerAuthorizer, t as MessagingHost } from "../MessagingHost-
|
|
1
|
+
import { a as PeerMessageCapacity, i as PeerDeliveryLifetime, o as PeerRoutes, r as PeerAuthorizer, t as MessagingHost } from "../MessagingHost-CZCyrnvJ.mjs";
|
|
2
2
|
export { MessagingHost, PeerAuthorizer, PeerDeliveryLifetime, PeerMessageCapacity, PeerRoutes };
|
package/dist/engine/Output.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { i as textOutput } from "../output-contract-
|
|
2
|
+
import { i as textOutput } from "../output-contract-DCnLYCdp.mjs";
|
|
3
3
|
//#region src/engine/Output.ts
|
|
4
4
|
var Output_exports = /* @__PURE__ */ __exportAll({ text: () => textOutput });
|
|
5
5
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as layer, n as ThreadHistoryError, r as ThreadHistoryRun, t as ThreadHistory } from "../ThreadHistory-
|
|
1
|
+
import { a as layer, n as ThreadHistoryError, r as ThreadHistoryRun, t as ThreadHistory } from "../ThreadHistory-KPPBJLJb.mjs";
|
|
2
2
|
export { ThreadHistory, ThreadHistoryError, ThreadHistoryRun, layer };
|
|
@@ -35,7 +35,7 @@ var ThreadHistoryError = class extends Schema.TaggedError()("ThreadHistoryError"
|
|
|
35
35
|
*/
|
|
36
36
|
var ThreadHistory = class ThreadHistory extends Context.Service()("@effect-agent/engine/ThreadHistory") {
|
|
37
37
|
/** Bind incremental history to the supplied Thread.Store, including scoped ownership views. */
|
|
38
|
-
static
|
|
38
|
+
static makeFromStore = Effect.gen(function* () {
|
|
39
39
|
const threads = yield* Store;
|
|
40
40
|
const historyError = (cause) => ThreadHistoryError.make({
|
|
41
41
|
threadId: cause.threadId,
|
|
@@ -57,7 +57,8 @@ var ThreadHistory = class ThreadHistory extends Context.Service()("@effect-agent
|
|
|
57
57
|
};
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
|
-
})
|
|
60
|
+
});
|
|
61
|
+
static layerFromStore = Layer.effect(ThreadHistory, ThreadHistory.makeFromStore);
|
|
61
62
|
/** Retain history for the application Scope, within message and host capacity. Separate Layer builds own separate stores. */
|
|
62
63
|
static layer = ThreadHistory.layerFromStore.pipe(Layer.provideMerge(layerMemory));
|
|
63
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadHistory.mjs","names":["ConversationStore"],"sources":["../../src/engine/ThreadHistory.ts"],"sourcesContent":["import type { Prompt } from \"effect/ai\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\n\nimport { ThreadId, type RunId } from \"../core/Identifiers.ts\";\nimport { type RunCompleted } from \"../core/RunEvent.ts\";\nimport {\n Store as ConversationStore,\n layerMemory,\n toPrompt,\n type ThreadError,\n} from \"../core/Thread.ts\";\n\n/** A history adapter rejected a read, staged value, or completed Run commit. */\nexport class ThreadHistoryError extends Schema.TaggedError<ThreadHistoryError>()(\n \"ThreadHistoryError\",\n {\n threadId: ThreadId,\n reason: Schema.Literals([\n \"not-found\",\n \"conflict\",\n \"fenced\",\n \"incompatible\",\n \"limit\",\n \"encoding\",\n \"storage\",\n ]),\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/**\n * One Run's history owner. Incremental adapters retain each stageHistory update; on-success\n * adapters stage privately until commit. Before commit, the interpreter\n * finishes run-owned work and closes resources acquired for that Run, then validates the result\n * for run/start.await. Shared model, provider, and client services supplied by an enclosing\n * application Layer remain owned by that application's Scope and may outlive multiple Runs.\n * Commit must succeed before RunCompleted becomes observable. Schema-encoded input is opaque\n * here; the adapter owns its persistence boundary. A failed commit may have reached storage;\n * callers must inspect history before retrying external execution.\n */\nexport interface ThreadHistoryRun {\n readonly prompt: Prompt.Prompt;\n readonly stageInput: (input: unknown) => Effect.Effect<void, ThreadHistoryError>;\n readonly stageHistory: (history: {\n /** Exact source messages; compaction changes only the model view. */\n readonly source: Prompt.Prompt;\n /** Retained context after native compaction, excluding transient recall. */\n readonly modelContext: Prompt.Prompt;\n }) => Effect.Effect<void, ThreadHistoryError>;\n readonly commit: (completed: RunCompleted) => Effect.Effect<void, ThreadHistoryError>;\n}\n\n/**\n * History shared by Runs with the same Thread ID. The default layer retains native messages\n * incrementally in memory for its application Scope, including completed updates before a failure.\n * PersistentHistory.layer from @yielded/agent/persistent-history instead commits successful\n * Runs to an explicit ThreadStore. Durable hosts retain history through their journal hooks.\n * No implementation may retry model or Tool execution or claim interrupted-work recovery.\n */\nexport class ThreadHistory extends Context.Service<\n ThreadHistory,\n {\n readonly retention: \"incremental\" | \"on-success\";\n /** Present only for the in-memory adapter; identifies its exact Store ownership view. */\n readonly memoryStore?: ConversationStore[\"Service\"];\n readonly open: (request: {\n readonly threadId: ThreadId;\n readonly runId: RunId;\n }) => Effect.Effect<ThreadHistoryRun, ThreadHistoryError>;\n readonly load: (threadId: ThreadId) => Effect.Effect<Prompt.Prompt, ThreadHistoryError>;\n }\n>()(\"@effect-agent/engine/ThreadHistory\") {\n /** Bind incremental history to the supplied Thread.Store, including scoped ownership views. */\n static readonly
|
|
1
|
+
{"version":3,"file":"ThreadHistory.mjs","names":["ConversationStore"],"sources":["../../src/engine/ThreadHistory.ts"],"sourcesContent":["import type { Prompt } from \"effect/ai\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\n\nimport { ThreadId, type RunId } from \"../core/Identifiers.ts\";\nimport { type RunCompleted } from \"../core/RunEvent.ts\";\nimport {\n Store as ConversationStore,\n layerMemory,\n toPrompt,\n type ThreadError,\n} from \"../core/Thread.ts\";\n\n/** A history adapter rejected a read, staged value, or completed Run commit. */\nexport class ThreadHistoryError extends Schema.TaggedError<ThreadHistoryError>()(\n \"ThreadHistoryError\",\n {\n threadId: ThreadId,\n reason: Schema.Literals([\n \"not-found\",\n \"conflict\",\n \"fenced\",\n \"incompatible\",\n \"limit\",\n \"encoding\",\n \"storage\",\n ]),\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/**\n * One Run's history owner. Incremental adapters retain each stageHistory update; on-success\n * adapters stage privately until commit. Before commit, the interpreter\n * finishes run-owned work and closes resources acquired for that Run, then validates the result\n * for run/start.await. Shared model, provider, and client services supplied by an enclosing\n * application Layer remain owned by that application's Scope and may outlive multiple Runs.\n * Commit must succeed before RunCompleted becomes observable. Schema-encoded input is opaque\n * here; the adapter owns its persistence boundary. A failed commit may have reached storage;\n * callers must inspect history before retrying external execution.\n */\nexport interface ThreadHistoryRun {\n readonly prompt: Prompt.Prompt;\n readonly stageInput: (input: unknown) => Effect.Effect<void, ThreadHistoryError>;\n readonly stageHistory: (history: {\n /** Exact source messages; compaction changes only the model view. */\n readonly source: Prompt.Prompt;\n /** Retained context after native compaction, excluding transient recall. */\n readonly modelContext: Prompt.Prompt;\n }) => Effect.Effect<void, ThreadHistoryError>;\n readonly commit: (completed: RunCompleted) => Effect.Effect<void, ThreadHistoryError>;\n}\n\n/**\n * History shared by Runs with the same Thread ID. The default layer retains native messages\n * incrementally in memory for its application Scope, including completed updates before a failure.\n * PersistentHistory.layer from @yielded/agent/persistent-history instead commits successful\n * Runs to an explicit ThreadStore. Durable hosts retain history through their journal hooks.\n * No implementation may retry model or Tool execution or claim interrupted-work recovery.\n */\nexport class ThreadHistory extends Context.Service<\n ThreadHistory,\n {\n readonly retention: \"incremental\" | \"on-success\";\n /** Present only for the in-memory adapter; identifies its exact Store ownership view. */\n readonly memoryStore?: ConversationStore[\"Service\"];\n readonly open: (request: {\n readonly threadId: ThreadId;\n readonly runId: RunId;\n }) => Effect.Effect<ThreadHistoryRun, ThreadHistoryError>;\n readonly load: (threadId: ThreadId) => Effect.Effect<Prompt.Prompt, ThreadHistoryError>;\n }\n>()(\"@effect-agent/engine/ThreadHistory\") {\n /** Bind incremental history to the supplied Thread.Store, including scoped ownership views. */\n static readonly makeFromStore = Effect.gen(function* () {\n const threads = yield* ConversationStore;\n\n const historyError = (cause: ThreadError): ThreadHistoryError =>\n ThreadHistoryError.make({\n threadId: cause.threadId,\n reason:\n cause._tag === \"ThreadNotFound\"\n ? \"not-found\"\n : cause._tag === \"ThreadLimitExceeded\"\n ? \"limit\"\n : cause._tag === \"ThreadHistoryDiverged\"\n ? \"conflict\"\n : cause._tag === \"ThreadOwnershipError\"\n ? cause.reason === \"closed\"\n ? \"fenced\"\n : \"conflict\"\n : \"encoding\",\n message:\n cause._tag === \"ThreadNotFound\"\n ? \"Thread history is not present in this application Scope\"\n : cause._tag === \"ThreadLimitExceeded\"\n ? `In-memory history exceeds the ${cause.limit} limit of ${cause.limitValue}`\n : cause.message,\n cause,\n });\n\n return ThreadHistory.of({\n retention: \"incremental\",\n memoryStore: threads,\n load: (threadId) =>\n threads.snapshot(threadId).pipe(Effect.map(toPrompt), Effect.mapError(historyError)),\n open: Effect.fnUntraced(function* ({ threadId, runId }) {\n const snapshot = yield* threads.create(threadId).pipe(Effect.mapError(historyError));\n\n return {\n prompt: toPrompt(snapshot),\n stageInput: () => Effect.void,\n stageHistory: ({ source }) =>\n threads\n .recordHistory(threadId, runId, source)\n .pipe(Effect.asVoid, Effect.mapError(historyError)),\n commit: () =>\n threads.snapshot(threadId).pipe(Effect.asVoid, Effect.mapError(historyError)),\n };\n }),\n });\n });\n\n static readonly layerFromStore = Layer.effect(ThreadHistory, ThreadHistory.makeFromStore);\n\n /** Retain history for the application Scope, within message and host capacity. Separate Layer builds own separate stores. */\n static readonly layer = ThreadHistory.layerFromStore.pipe(Layer.provideMerge(layerMemory));\n}\n\n/** Retain in-memory conversation history for the application Scope. */\nexport const layer = ThreadHistory.layer;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAa,qBAAb,cAAwC,OAAO,YAAgC,CAAC,CAC9E,sBACA;CACE,UAAU;CACV,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,SAAS,OAAO;CAChB,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;AAC3C,CACF,CAAC,CAAC,CAAC;;;;;;;;AA+BH,IAAa,gBAAb,MAAa,sBAAsB,QAAQ,QAYzC,CAAC,CAAC,oCAAoC,CAAC,CAAC;;CAExC,OAAgB,gBAAgB,OAAO,IAAI,aAAa;EACtD,MAAM,UAAU,OAAOA;EAEvB,MAAM,gBAAgB,UACpB,mBAAmB,KAAK;GACtB,UAAU,MAAM;GAChB,QACE,MAAM,SAAS,mBACX,cACA,MAAM,SAAS,wBACb,UACA,MAAM,SAAS,0BACb,aACA,MAAM,SAAS,yBACb,MAAM,WAAW,WACf,WACA,aACF;GACZ,SACE,MAAM,SAAS,mBACX,4DACA,MAAM,SAAS,wBACb,iCAAiC,MAAM,MAAM,YAAY,MAAM,eAC/D,MAAM;GACd;EACF,CAAC;EAEH,OAAO,cAAc,GAAG;GACtB,WAAW;GACX,aAAa;GACb,OAAO,aACL,QAAQ,SAAS,QAAQ,CAAC,CAAC,KAAK,OAAO,IAAI,QAAQ,GAAG,OAAO,SAAS,YAAY,CAAC;GACrF,MAAM,OAAO,WAAW,WAAW,EAAE,UAAU,SAAS;IACtD,MAAM,WAAW,OAAO,QAAQ,OAAO,QAAQ,CAAC,CAAC,KAAK,OAAO,SAAS,YAAY,CAAC;IAEnF,OAAO;KACL,QAAQ,SAAS,QAAQ;KACzB,kBAAkB,OAAO;KACzB,eAAe,EAAE,aACf,QACG,cAAc,UAAU,OAAO,MAAM,CAAC,CACtC,KAAK,OAAO,QAAQ,OAAO,SAAS,YAAY,CAAC;KACtD,cACE,QAAQ,SAAS,QAAQ,CAAC,CAAC,KAAK,OAAO,QAAQ,OAAO,SAAS,YAAY,CAAC;IAChF;GACF,CAAC;EACH,CAAC;CACH,CAAC;CAED,OAAgB,iBAAiB,MAAM,OAAO,eAAe,cAAc,aAAa;;CAGxF,OAAgB,QAAQ,cAAc,eAAe,KAAK,MAAM,aAAa,WAAW,CAAC;AAC3F;;AAGA,MAAa,QAAQ,cAAc"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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";
|
|
@@ -48,9 +48,9 @@ import { t as SemanticMemoryIndex_d_exports } from "./core/SemanticMemoryIndex.m
|
|
|
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
50
|
import { s as SubagentHost_d_exports } from "./SubagentHost-D1xBgn9g.mjs";
|
|
51
|
-
import { t as AgentRuntime_d_exports } from "./AgentRuntime-
|
|
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-DTDihBra.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-DuC_PcGx.mjs";
|
|
73
|
+
import { n as EventSource_d_exports } from "./EventSource-Cc58uEso.mjs";
|
|
74
|
+
import { n as PreparedInputAdmission_d_exports } from "./PreparedInputAdmission-CjcX1OP0.mjs";
|
|
75
|
+
import { r as SubscriptionInput_d_exports } from "./SubscriptionInput-B1IeAEDi.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-ClHg7c0O.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-DSnUTSSb.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-D_Biid6w.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";
|
package/dist/index.mjs
CHANGED
|
@@ -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";
|
|
@@ -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-DGblbFas.mjs";
|
|
75
|
+
import { Z as ThreadStore_exports } from "./ThreadStore-BC4V-mY-.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-CWHuciup.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-BJbuIqQq.mjs";
|
|
87
|
+
import { i as WorkerAdmission_exports } from "./WorkerAdmission-C47Vy_cK.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-ZgWxf7bB.mjs";
|
|
101
|
+
import { n as ThreadTransfer_exports } from "./ThreadTransfer-S7FnTRHt.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-DTDihBra.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-DvTEq2RC.d.mts.map
|