effect-agent 0.1.0-beta.148 → 0.1.0-beta.149
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-BzPfXvzC.d.mts → Admin-B8ISZyYf.d.mts} +3 -3
- package/dist/{AgentRuntime-DZdgNcBk.d.mts → AgentRuntime-sXpKcyxu.d.mts} +2 -2
- package/dist/{DurableAgentRuntime-N5Meflyt.mjs → DurableAgentRuntime-DLa4IwFi.mjs} +18 -8
- package/dist/DurableAgentRuntime-DLa4IwFi.mjs.map +1 -0
- package/dist/{EventSource-DJW_1kPY.d.mts → EventSource-CkN05NT3.d.mts} +2 -2
- package/dist/{PreparedInputAdmission-CNRSDoYu.d.mts → PreparedInputAdmission-fctZOTnn.d.mts} +3 -3
- package/dist/{RunOptions-Cy7CjrjS.d.mts → RunOptions-Bv9NpkPZ.d.mts} +9 -1
- package/dist/{Subagent-zS6prSK6.d.mts → Subagent-VHrANXFy.d.mts} +3 -3
- package/dist/{Subscription-C279AjM6.d.mts → Subscription-B16A-48F.d.mts} +2 -2
- package/dist/{SubscriptionInput-7R-Xrpxd.d.mts → SubscriptionInput-DIU7CiXE.d.mts} +2 -2
- package/dist/capabilities/Commands.d.mts +1 -1
- package/dist/capabilities/RunHooks.d.mts +1 -1
- package/dist/capabilities/Subagent.d.mts +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/LifecyclePublication.d.mts +1 -1
- package/dist/durable/MessageDelivery.d.mts +41 -41
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/Scheduling.d.mts +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionTools.d.mts +2 -2
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/engine/AgentRuntime.d.mts +1 -1
- package/dist/engine/RunOptions.d.mts +1 -1
- package/dist/engine/RunOptions.mjs.map +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/durable/DurableAgentRuntime.ts +36 -20
- package/src/engine/RunOptions.ts +8 -0
- package/dist/DurableAgentRuntime-N5Meflyt.mjs.map +0 -1
|
@@ -5517,17 +5517,20 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (
|
|
|
5517
5517
|
// Current instructions govern the continuation; the original user intent, steering and
|
|
5518
5518
|
// committed history survive. The pending Turn re-enters through the batch continuation,
|
|
5519
5519
|
// without duplicating the engine's freshly rendered input.
|
|
5520
|
+
// Retained immediate history can contain system messages. Its prefix stays untouched;
|
|
5521
|
+
// only this Run's instruction slots receive the freshly evaluated instructions.
|
|
5520
5522
|
const instructionView = (
|
|
5521
5523
|
messages: ReadonlyArray<Prompt.Message>,
|
|
5522
5524
|
instructions: ReadonlyArray<Prompt.Message>,
|
|
5523
5525
|
insertWhenAbsent: boolean,
|
|
5526
|
+
priorRunPrefixLength: number,
|
|
5524
5527
|
) => {
|
|
5525
5528
|
const projected: Array<Prompt.Message> = [];
|
|
5526
5529
|
const lengths = [0];
|
|
5527
5530
|
let inserted = false;
|
|
5528
5531
|
|
|
5529
|
-
for (const message of messages) {
|
|
5530
|
-
if (message.role === "system") {
|
|
5532
|
+
for (const [index, message] of messages.entries()) {
|
|
5533
|
+
if (index >= priorRunPrefixLength && message.role === "system") {
|
|
5531
5534
|
if (!inserted) projected.push(...instructions);
|
|
5532
5535
|
inserted = true;
|
|
5533
5536
|
} else projected.push(message);
|
|
@@ -5541,23 +5544,31 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (
|
|
|
5541
5544
|
};
|
|
5542
5545
|
};
|
|
5543
5546
|
|
|
5544
|
-
const resumeContext
|
|
5545
|
-
prepare: ({ source }) =>
|
|
5547
|
+
const resumeContext = {
|
|
5548
|
+
prepare: ({ source }: { readonly source: Prompt.Prompt }) =>
|
|
5546
5549
|
Ref.get(stateRef).pipe(
|
|
5547
|
-
Effect.map((state) =>
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5550
|
+
Effect.map((state) => {
|
|
5551
|
+
const view = instructionView(
|
|
5552
|
+
resumeProjection.prompt.content,
|
|
5553
|
+
source.content
|
|
5554
|
+
.slice(resumeProjection.historyBefore.content.length, state.baseLen)
|
|
5555
|
+
.filter((message) => message.role === "system"),
|
|
5556
|
+
true,
|
|
5557
|
+
resumeProjection.historyBefore.content.length,
|
|
5558
|
+
);
|
|
5559
|
+
|
|
5560
|
+
return {
|
|
5561
|
+
prompt: Prompt.fromMessages([
|
|
5562
|
+
...view.messages,
|
|
5563
|
+
...source.content.slice(state.baseLen ?? source.content.length),
|
|
5564
|
+
]),
|
|
5565
|
+
priorRunPrefixLength: view.prefixLength(
|
|
5566
|
+
resumeProjection.historyBefore.content.length,
|
|
5567
|
+
),
|
|
5568
|
+
};
|
|
5569
|
+
}),
|
|
5559
5570
|
),
|
|
5560
|
-
}
|
|
5571
|
+
} satisfies RunContextHook<never, never>;
|
|
5561
5572
|
|
|
5562
5573
|
const externalContext = runContextPreparation.hook;
|
|
5563
5574
|
|
|
@@ -5569,13 +5580,17 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (
|
|
|
5569
5580
|
: {
|
|
5570
5581
|
prepare: (request) =>
|
|
5571
5582
|
(journal.committedTurns === 0
|
|
5572
|
-
? Effect.succeed({
|
|
5583
|
+
? Effect.succeed({
|
|
5584
|
+
prompt: request.source,
|
|
5585
|
+
priorRunPrefixLength: journal.historyBefore.content.length,
|
|
5586
|
+
})
|
|
5573
5587
|
: resumeContext.prepare(request)
|
|
5574
5588
|
).pipe(
|
|
5575
|
-
Effect.flatMap(({ prompt }) =>
|
|
5589
|
+
Effect.flatMap(({ prompt, priorRunPrefixLength }) =>
|
|
5576
5590
|
externalContext.prepare({
|
|
5577
5591
|
...request,
|
|
5578
5592
|
source: prompt,
|
|
5593
|
+
priorRunPrefixLength,
|
|
5579
5594
|
}),
|
|
5580
5595
|
),
|
|
5581
5596
|
),
|
|
@@ -5870,9 +5885,10 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (
|
|
|
5870
5885
|
const comparisonView = instructionView(
|
|
5871
5886
|
sourceJournal.prompt.content,
|
|
5872
5887
|
state.history?.content
|
|
5873
|
-
.slice(
|
|
5888
|
+
.slice(resumeProjection.historyBefore.content.length, state.baseLen)
|
|
5874
5889
|
.filter((message) => message.role === "system") ?? [],
|
|
5875
5890
|
false,
|
|
5891
|
+
sourceJournal.historyBefore.content.length,
|
|
5876
5892
|
);
|
|
5877
5893
|
|
|
5878
5894
|
// Compare each visible message once. A transformed source can authorize only its
|
package/src/engine/RunOptions.ts
CHANGED
|
@@ -210,6 +210,14 @@ export interface RunContextRequest {
|
|
|
210
210
|
* identities rather than infer durable state from this Prompt alone.
|
|
211
211
|
*/
|
|
212
212
|
readonly source: Prompt.Prompt;
|
|
213
|
+
/**
|
|
214
|
+
* Durable coordinator's exact prior-Run prefix length in `source`. A preparation hook
|
|
215
|
+
* can replace `source.content.slice(0, priorRunPrefixLength)` with application context
|
|
216
|
+
* while preserving this Run's instructions, input, updates and recovered Tool exchanges.
|
|
217
|
+
* This is a model-only transformation: canonical records and retry receipts are retained.
|
|
218
|
+
* Absent for non-durable Runs; never infer this boundary from message roles or text.
|
|
219
|
+
*/
|
|
220
|
+
readonly priorRunPrefixLength?: number | undefined;
|
|
213
221
|
/**
|
|
214
222
|
* The exact model-visible final-output contract the engine appends to the
|
|
215
223
|
* prepared prompt after this hook returns (RUN-028), or
|