effect-agent 0.1.0-beta.157 → 0.1.0-beta.158
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/{AgentRuntime-GQACxY_m.mjs → AgentRuntime-D4eoBpIW.mjs} +12 -6
- package/dist/{AgentRuntime-GQACxY_m.mjs.map → AgentRuntime-D4eoBpIW.mjs.map} +1 -1
- package/dist/{DurableAgentRuntime-BAQvZK1e.mjs → DurableAgentRuntime-eImXoGqD.mjs} +50 -11
- package/dist/DurableAgentRuntime-eImXoGqD.mjs.map +1 -0
- package/dist/{Subagent-JjcidJ7q.mjs → Subagent-211Oz2IN.mjs} +2 -2
- package/dist/{Subagent-JjcidJ7q.mjs.map → Subagent-211Oz2IN.mjs.map} +1 -1
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/MessageDelivery.d.mts +20 -6
- package/dist/durable/MessageDelivery.mjs +49 -17
- package/dist/durable/MessageDelivery.mjs.map +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +40 -40
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/src/durable/DurableAgentRuntime.ts +79 -9
- package/src/durable/MessageDelivery.ts +64 -20
- package/src/engine/internal/agent-runtime.ts +23 -15
- package/dist/DurableAgentRuntime-BAQvZK1e.mjs.map +0 -1
|
@@ -15,7 +15,7 @@ import { a as PeerMessageCapacity, d as MessageAdmission, f as MessagingError, i
|
|
|
15
15
|
import { SubagentHost } from "./engine/SubagentHost.mjs";
|
|
16
16
|
import { ThreadHistory } from "./engine/ThreadHistory.mjs";
|
|
17
17
|
import { n as RunToolVisibility } from "./ToolExposure-9uF_Yo0T.mjs";
|
|
18
|
-
import { f as renderInputPrompt, n as AgentChildPending, y as streamWithUsageAccountingUnknown } from "./AgentRuntime-
|
|
18
|
+
import { f as renderInputPrompt, n as AgentChildPending, y as streamWithUsageAccountingUnknown } from "./AgentRuntime-D4eoBpIW.mjs";
|
|
19
19
|
import { ContextRolloverTool } from "./engine/ContextWindow.mjs";
|
|
20
20
|
import { getToolExecutionClass } from "./engine/DurableStep.mjs";
|
|
21
21
|
import { CompactionError, ContextCompactor } from "./engine/ContextCompactor.mjs";
|
|
@@ -2374,6 +2374,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
2374
2374
|
const ledger = yield* SubmissionLedger;
|
|
2375
2375
|
const submissionScheduling = yield* SubmissionScheduling;
|
|
2376
2376
|
const store = yield* ThreadStore;
|
|
2377
|
+
const deliveries = yield* Effect.serviceOption(MessageDeliveryStore);
|
|
2377
2378
|
let projectedJournal;
|
|
2378
2379
|
const wake = yield* WakeScheduler;
|
|
2379
2380
|
const failpoint = yield* DurableRuntimeFailpoint;
|
|
@@ -3337,7 +3338,45 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3337
3338
|
* notification for single-store parent re-suspension races; `ResumeWaitingParent` remains the
|
|
3338
3339
|
* repair for older data and any already-recorded canonical settlement.
|
|
3339
3340
|
*/
|
|
3340
|
-
const notifyParentOfChildSettlement = Effect.fn("DurableAgentRuntime.notifyParentOfChildSettlement")(function* (submission) {
|
|
3341
|
+
const notifyParentOfChildSettlement = Effect.fn("DurableAgentRuntime.notifyParentOfChildSettlement")(function* (submission, record) {
|
|
3342
|
+
const admission = submission.messageAdmission;
|
|
3343
|
+
const worker = submission.workerAdmission;
|
|
3344
|
+
const key = admission === void 0 ? worker === void 0 ? void 0 : {
|
|
3345
|
+
ownerThreadId: worker.origin.source.threadId,
|
|
3346
|
+
messageId: worker.messageId
|
|
3347
|
+
} : Schema.is(MessageAdmission)(admission) ? admission.message : {
|
|
3348
|
+
ownerThreadId: admission._tag === "WorkerCompletion" ? admission.report.worker.threadId : admission.worker.threadId,
|
|
3349
|
+
messageId: submission.idempotencyKey
|
|
3350
|
+
};
|
|
3351
|
+
if (key !== void 0 && Option.isSome(deliveries)) {
|
|
3352
|
+
const settled = yield* settlementPayloadFromRecord(record, submission.submissionId);
|
|
3353
|
+
yield* deliveries.value.change(key, {
|
|
3354
|
+
_tag: "Complete",
|
|
3355
|
+
nowMillis: yield* Clock.currentTimeMillis,
|
|
3356
|
+
admissionKey: submission.idempotencyKey,
|
|
3357
|
+
inputDigest: submission.inputDigest,
|
|
3358
|
+
receipt: Receipt.make({
|
|
3359
|
+
threadId: submission.threadId,
|
|
3360
|
+
submissionId: submission.submissionId,
|
|
3361
|
+
receiptId: submission.receiptId,
|
|
3362
|
+
queueSequence: submission.queueSequence
|
|
3363
|
+
}),
|
|
3364
|
+
settlement: Settlement.make({
|
|
3365
|
+
submissionId: settled.submissionId,
|
|
3366
|
+
receiptId: settled.receiptId,
|
|
3367
|
+
settlementId: settled.settlementId,
|
|
3368
|
+
outcome: settled.outcome,
|
|
3369
|
+
settledAt: record.createdAt,
|
|
3370
|
+
...settled.outcome === "failed" ? { failure: settled.result } : {},
|
|
3371
|
+
...settled.usageSummary === void 0 ? {} : { usageSummary: settled.usageSummary },
|
|
3372
|
+
...settled.runDisposition === void 0 ? {} : { runDisposition: settled.runDisposition }
|
|
3373
|
+
})
|
|
3374
|
+
}).pipe(Effect.catchCause((cause) => Effect.failCause(Cause.map(cause, (error) => LedgerError.make({
|
|
3375
|
+
operation: "delivery-completion",
|
|
3376
|
+
message: "Destination acknowledgement remains pending",
|
|
3377
|
+
cause: error
|
|
3378
|
+
})))));
|
|
3379
|
+
}
|
|
3341
3380
|
if (submission.workerAdmission?.origin.reporting?.mode === "standard") yield* updateRuntime.repair(submission.threadId).pipe(Effect.mapError(() => LedgerError.make({
|
|
3342
3381
|
operation: "update-delivery",
|
|
3343
3382
|
message: "Update delivery remains pending"
|
|
@@ -3396,13 +3435,13 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3396
3435
|
records: [record]
|
|
3397
3436
|
})).pipe(Effect.catchTag("AppendConflict", () => Effect.void), Effect.asVoid);
|
|
3398
3437
|
yield* hit("terminalize:after-canonical-append");
|
|
3399
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3438
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3400
3439
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3401
3440
|
submissionId,
|
|
3402
3441
|
settlementId
|
|
3403
3442
|
}));
|
|
3404
3443
|
yield* wake.notify(submission.threadId);
|
|
3405
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3444
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3406
3445
|
return settlement;
|
|
3407
3446
|
});
|
|
3408
3447
|
/**
|
|
@@ -3465,14 +3504,14 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3465
3504
|
records: [reserved.record]
|
|
3466
3505
|
})).pipe(Effect.catchTag("AppendConflict", () => Effect.void), Effect.asVoid);
|
|
3467
3506
|
yield* hit("terminalize:after-canonical-append");
|
|
3468
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3507
|
+
yield* notifyParentOfChildSettlement(submission, reserved.record);
|
|
3469
3508
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3470
3509
|
submissionId,
|
|
3471
3510
|
settlementId
|
|
3472
3511
|
}));
|
|
3473
3512
|
const canonicalSettlement = yield* settlementPayloadFromRecord(reserved.record, submissionId);
|
|
3474
3513
|
yield* wake.notify(submission.threadId);
|
|
3475
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3514
|
+
yield* notifyParentOfChildSettlement(submission, reserved.record);
|
|
3476
3515
|
yield* settleJoinedSubmissions(ctx, canonicalSettlement);
|
|
3477
3516
|
return materializeSettlement(settlement, reserved.record);
|
|
3478
3517
|
});
|
|
@@ -3486,28 +3525,28 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
3486
3525
|
})).pipe(Effect.catchTag("AppendConflict", () => Effect.void), Effect.asVoid);
|
|
3487
3526
|
yield* hit("terminalize:after-canonical-append");
|
|
3488
3527
|
}
|
|
3489
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3528
|
+
yield* notifyParentOfChildSettlement(submission, reservation.record);
|
|
3490
3529
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3491
3530
|
submissionId: submission.submissionId,
|
|
3492
3531
|
settlementId: reservation.settlementId
|
|
3493
3532
|
}));
|
|
3494
3533
|
const canonicalSettlement = yield* settlementPayloadFromRecord(reservation.record, submission.submissionId);
|
|
3495
3534
|
yield* wake.notify(submission.threadId);
|
|
3496
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3535
|
+
yield* notifyParentOfChildSettlement(submission, reservation.record);
|
|
3497
3536
|
yield* settleJoinedSubmissions(ctx, canonicalSettlement);
|
|
3498
3537
|
return materializeSettlement(settlement, reservation.record);
|
|
3499
3538
|
});
|
|
3500
3539
|
/** Canonical settlement exists: rebuild the ledger from history, never the reverse (DUR-015). */
|
|
3501
3540
|
const finalizeFromHistory = Effect.fn("DurableAgentRuntime.finalizeFromHistory")(function* (submission, record) {
|
|
3502
3541
|
const canonicalSettlement = yield* settlementPayloadFromRecord(record, submission.submissionId);
|
|
3503
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3542
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3504
3543
|
const settlement = yield* ledger.finalizeSettlement(SettlementFinalization.make({
|
|
3505
3544
|
submissionId: submission.submissionId,
|
|
3506
3545
|
settlementId: canonicalSettlement.settlementId
|
|
3507
3546
|
}));
|
|
3508
3547
|
const snapshot = yield* ledger.loadRecoverySnapshot(RecoverySnapshotRequest.make({ submissionId: submission.submissionId }));
|
|
3509
3548
|
yield* wake.notify(submission.threadId);
|
|
3510
|
-
yield* notifyParentOfChildSettlement(submission);
|
|
3549
|
+
yield* notifyParentOfChildSettlement(submission, record);
|
|
3511
3550
|
return materializeSettlement(settlement, snapshot.reservation?.record);
|
|
3512
3551
|
});
|
|
3513
3552
|
/**
|
|
@@ -7313,4 +7352,4 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
|
|
|
7313
7352
|
//#endregion
|
|
7314
7353
|
export { DurableApprovalSuspension as a, RecoveryFailure as c, childReservationIdFor as d, isolateRecovery as f, DurableApprovalResolver as i, RecoveryReport as l, recoveryRepairRecordId as m, DurableAgentRuntime as n, DurableRuntimeConfig as o, recoveryRepairBatchId as p, DurableAgentRuntime_exports as r, RecoveryBlocked as s, ApprovalSuspensionError as t, RecoverySweepResult as u };
|
|
7315
7354
|
|
|
7316
|
-
//# sourceMappingURL=DurableAgentRuntime-
|
|
7355
|
+
//# sourceMappingURL=DurableAgentRuntime-eImXoGqD.mjs.map
|