@yielded/agent-platform-cloudflare 0.1.0-beta.185 → 0.1.0-beta.186
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/{Alarm-C257DCAJ.mjs → Alarm-BN-ADYcu.mjs} +87 -47
- package/dist/Alarm-BN-ADYcu.mjs.map +1 -0
- package/dist/Alarm.d.mts +10 -3
- package/dist/Alarm.mjs +1 -1
- package/dist/BrowserRestCapture.d.mts +2 -2
- package/dist/BrowserRestCapture.mjs +2 -2
- package/dist/BrowserRestCrawl.d.mts +1 -1
- package/dist/BrowserRestCrawl.mjs +1 -1
- package/dist/{BrowserSession-CfivQ5JY.mjs → BrowserSession-CTgTFKPh.mjs} +2 -2
- package/dist/{BrowserSession-CfivQ5JY.mjs.map → BrowserSession-CTgTFKPh.mjs.map} +1 -1
- package/dist/{BrowserSession-mKnLSc3p.d.mts → BrowserSession-DJ1Ey4Zv.d.mts} +2 -2
- package/dist/BrowserSession.d.mts +2 -2
- package/dist/BrowserSession.mjs +2 -2
- package/dist/BrowserUse.d.mts +1 -1
- package/dist/CloudflareBindings.d.mts +4 -1
- package/dist/CloudflareBindings.mjs +5 -1
- package/dist/CloudflareBindings.mjs.map +1 -1
- package/dist/{CloudflareBrowser-gu7gma0Y.d.mts → CloudflareBrowser-DS6GodKz.d.mts} +2 -2
- package/dist/{CloudflareBrowser-Vt8qTdYW.mjs → CloudflareBrowser-DrZQwovV.mjs} +2 -2
- package/dist/{CloudflareBrowser-Vt8qTdYW.mjs.map → CloudflareBrowser-DrZQwovV.mjs.map} +1 -1
- package/dist/CloudflareBrowser.d.mts +1 -1
- package/dist/CloudflareBrowser.mjs +1 -1
- package/dist/CloudflareCodeMode.d.mts +1 -1
- package/dist/CloudflareCodeMode.mjs +2 -2
- package/dist/{CloudflareConfig-C9MvPbX8.d.mts → CloudflareConfig-D_-BMp4q.d.mts} +12 -6
- package/dist/CloudflareConfig.d.mts +2 -2
- package/dist/CloudflareConfig.mjs +12 -5
- package/dist/CloudflareConfig.mjs.map +1 -1
- package/dist/CloudflareMemory.d.mts +1 -1
- package/dist/CloudflareMemory.mjs +1 -1
- package/dist/CloudflareScheduling.d.mts +1 -1
- package/dist/CloudflareScheduling.mjs +3 -3
- package/dist/CloudflareSubscriptions.d.mts +1 -1
- package/dist/CloudflareSubscriptions.mjs +3 -3
- package/dist/{CloudflareThreadClient-CnvMXPmV.mjs → CloudflareThreadClient-DgV_RBtF.mjs} +11 -3
- package/dist/CloudflareThreadClient-DgV_RBtF.mjs.map +1 -0
- package/dist/{CloudflareThreadClient-CmlojpjC.d.mts → CloudflareThreadClient-_RWtjnqM.d.mts} +188 -183
- package/dist/CloudflareThreadClient.d.mts +1 -1
- package/dist/CloudflareThreadClient.mjs +1 -1
- package/dist/{InteractiveBrowser-wV2Bti5e.d.mts → InteractiveBrowser-BJX3d8cP.d.mts} +2 -2
- package/dist/{InteractiveBrowser-nukKxc87.mjs → InteractiveBrowser-M887Mt3D.mjs} +2 -2
- package/dist/{InteractiveBrowser-nukKxc87.mjs.map → InteractiveBrowser-M887Mt3D.mjs.map} +1 -1
- package/dist/InteractiveBrowser.d.mts +1 -1
- package/dist/InteractiveBrowser.mjs +1 -1
- package/dist/{ThreadObject-Cr1CFWXb.mjs → ThreadObject-AP5CFiOw.mjs} +30 -9
- package/dist/ThreadObject-AP5CFiOw.mjs.map +1 -0
- package/dist/{ThreadObject-Osn-FmcF.d.mts → ThreadObject-CXUcI8j5.d.mts} +14 -6
- package/dist/ThreadObject.d.mts +1 -1
- package/dist/ThreadObject.mjs +1 -1
- package/dist/WakeScheduler.d.mts +1 -1
- package/dist/WakeScheduler.mjs +7 -3
- package/dist/WakeScheduler.mjs.map +1 -1
- package/dist/{boundary-BguazVkh.mjs → boundary-BLbZMBl2.mjs} +2 -2
- package/dist/boundary-BLbZMBl2.mjs.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{prepared-admission-w2Kq32_k.mjs → prepared-admission-DSuWZ5qK.mjs} +4 -3
- package/dist/prepared-admission-DSuWZ5qK.mjs.map +1 -0
- package/package.json +1 -1
- package/src/Alarm.ts +110 -64
- package/src/CloudflareBindings.ts +5 -1
- package/src/CloudflareConfig.ts +10 -3
- package/src/CloudflareThreadClient.ts +8 -1
- package/src/ThreadObject.ts +13 -8
- package/src/WakeScheduler.ts +5 -1
- package/src/internal/boundary.ts +1 -1
- package/src/internal/crypto.ts +4 -1
- package/src/internal/due-queue.ts +2 -1
- package/src/internal/layers.ts +29 -16
- package/src/internal/live-text-protocol.ts +1 -1
- package/src/internal/live-text.ts +4 -1
- package/src/internal/message-delivery.ts +7 -1
- package/src/internal/prepared-admission.ts +2 -1
- package/src/internal/progress-wait.ts +6 -1
- package/src/internal/transport.ts +2 -1
- package/dist/Alarm-C257DCAJ.mjs.map +0 -1
- package/dist/CloudflareThreadClient-CnvMXPmV.mjs.map +0 -1
- package/dist/ThreadObject-Cr1CFWXb.mjs.map +0 -1
- package/dist/boundary-BguazVkh.mjs.map +0 -1
- package/dist/prepared-admission-w2Kq32_k.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { DurableAlarmError, DurableObjectContext, ThreadObjectPlacement } from "./CloudflareBindings.mjs";
|
|
3
3
|
import { AuxiliaryDispatchMillis, CloudflareDurableRuntimeConfig } from "./CloudflareConfig.mjs";
|
|
4
|
-
import { r as safeCauseMessage } from "./boundary-
|
|
4
|
+
import { r as safeCauseMessage } from "./boundary-BLbZMBl2.mjs";
|
|
5
5
|
import { CurrentNativeSource } from "@yielded/agent-storage-cloudflare/port-routing";
|
|
6
6
|
import "@yielded/agent/agent-registration";
|
|
7
7
|
import { DurableAgentRuntime, DurableRuntimeConfig, RecoveryBlocked, RecoveryFailure, RecoverySweepResult, isolateRecovery } from "@yielded/agent/durable-agent-runtime";
|
|
@@ -9,10 +9,29 @@ import { SubmissionId, ThreadId } from "@yielded/agent/identifiers";
|
|
|
9
9
|
import { AbortIntentRequest, SubmissionLedger } from "@yielded/agent/submission-ledger";
|
|
10
10
|
import { ThreadProjectionMaintenance } from "@yielded/agent/thread-projection-maintenance";
|
|
11
11
|
import { WakeScheduler } from "@yielded/agent/wake-scheduler";
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
12
|
+
import { DurableObjectAlarm, DurableObjectState, DurableObjectStorage } from "effect-cf";
|
|
13
|
+
import * as Cause from "effect/Cause";
|
|
14
|
+
import * as Clock from "effect/Clock";
|
|
15
|
+
import * as Context from "effect/Context";
|
|
16
|
+
import * as DateTime from "effect/DateTime";
|
|
17
|
+
import * as Deferred from "effect/Deferred";
|
|
18
|
+
import * as Effect from "effect/Effect";
|
|
19
|
+
import * as ErrorReporter from "effect/ErrorReporter";
|
|
20
|
+
import * as Exit from "effect/Exit";
|
|
21
|
+
import * as Fiber from "effect/Fiber";
|
|
22
|
+
import * as Layer from "effect/Layer";
|
|
23
|
+
import * as Option from "effect/Option";
|
|
24
|
+
import * as Random from "effect/Random";
|
|
25
|
+
import * as Ref from "effect/Ref";
|
|
26
|
+
import * as Result from "effect/Result";
|
|
27
|
+
import * as Scheduler from "effect/Scheduler";
|
|
28
|
+
import * as Schema from "effect/Schema";
|
|
29
|
+
import * as Scope from "effect/Scope";
|
|
30
|
+
import * as Semaphore from "effect/Semaphore";
|
|
14
31
|
import { SqlClient } from "effect/sql/SqlClient";
|
|
15
32
|
import { SqlError, UnknownError } from "effect/sql/SqlError";
|
|
33
|
+
import * as Stream from "effect/Stream";
|
|
34
|
+
import * as Struct from "effect/Struct";
|
|
16
35
|
//#region src/internal/due-queue.ts
|
|
17
36
|
const LaneId = Schema.NonEmptyString.check(Schema.isMaxLength(256));
|
|
18
37
|
const HostLaneId = LaneId.check(Schema.isPattern(/^(?!effect-agent:)/, { message: "The effect-agent: namespace is reserved for framework maintenance lanes" }));
|
|
@@ -378,9 +397,9 @@ var DurableAlarmService = class DurableAlarmService extends Context.Service()("@
|
|
|
378
397
|
ensureScheduledBy: (at) => wrap("advance maintenance checkpoint", alarms.scheduleAlarmEarlier(maintenanceAlarmInput(at))),
|
|
379
398
|
scheduleNow: Ref.get(inlineWork).pipe(Effect.flatMap((active) => active > 0 ? Effect.void : wrap("hint maintenance checkpoint", Effect.gen(function* () {
|
|
380
399
|
const now = yield* Clock.currentTimeMillis;
|
|
381
|
-
const next$
|
|
382
|
-
if (!Number.isFinite(next$
|
|
383
|
-
const at = Math.max(now, next$
|
|
400
|
+
const next$4 = next(make(ctx.storage).read());
|
|
401
|
+
if (!Number.isFinite(next$4)) return;
|
|
402
|
+
const at = Math.max(now, next$4);
|
|
384
403
|
const scheduled = yield* alarms.getAlarmStatus(maintenanceAlarmRef);
|
|
385
404
|
if (scheduled !== void 0 && DateTime.toEpochMillis(scheduled.runAt) <= at) return;
|
|
386
405
|
yield* alarms.scheduleAlarmEarlier(maintenanceAlarmInput(at));
|
|
@@ -725,6 +744,7 @@ var ThreadMutationGate = class ThreadMutationGate extends Context.Service()("@ef
|
|
|
725
744
|
for (const listener of pending) listener();
|
|
726
745
|
});
|
|
727
746
|
const minimumAlarmDelay = Math.max(1, Math.ceil(config.alarmBackoffBase / 2));
|
|
747
|
+
const recoveryDelay = config.recoveryWindowMillis || minimumAlarmDelay;
|
|
728
748
|
const runTransaction = yield* makeStorageOperation;
|
|
729
749
|
const { run: runAlarmTransaction, withTransaction } = yield* makeAlarmOperation;
|
|
730
750
|
const validateSourceBoundary = Effect.flatMap(Effect.serviceOption(sql.transactionService), (current) => current._tag === "Some" && buffering(ctx.storage) && !ownsTransaction(ctx.storage, current.value[1]) ? Effect.fail(DurableAlarmError.make({
|
|
@@ -738,6 +758,7 @@ var ThreadMutationGate = class ThreadMutationGate extends Context.Service()("@ef
|
|
|
738
758
|
const schedule = Effect.fnUntraced(function* (id, dueAt, progressCursor) {
|
|
739
759
|
yield* validateSourceBoundary;
|
|
740
760
|
const now = yield* Clock.currentTimeMillis;
|
|
761
|
+
const scheduling = yield* DurableObjectAlarm.ScheduleConfiguration;
|
|
741
762
|
const enroll = async (transaction, checkpoint) => {
|
|
742
763
|
if (progressCursor === void 0) dueQueue.dirty(id, dueAt);
|
|
743
764
|
else if (dueQueue.progress(id, dueAt, progressCursor) && (id === "effect-agent:native" || id === "effect-agent:publication")) {
|
|
@@ -748,8 +769,8 @@ var ThreadMutationGate = class ThreadMutationGate extends Context.Service()("@ef
|
|
|
748
769
|
dirty: state.dirty + 1n
|
|
749
770
|
})));
|
|
750
771
|
}
|
|
751
|
-
const next$
|
|
752
|
-
if (Number.isFinite(next$
|
|
772
|
+
const next$3 = next(dueQueue.read());
|
|
773
|
+
if (Number.isFinite(next$3)) checkpoint.earlier(Math.max(next$3, now + (scheduling.dispatchAfterEvent === true ? 0 : minimumAlarmDelay)));
|
|
753
774
|
};
|
|
754
775
|
yield* runAlarmTransaction("schedule maintenance lane", enroll);
|
|
755
776
|
yield* notify;
|
|
@@ -771,7 +792,7 @@ var ThreadMutationGate = class ThreadMutationGate extends Context.Service()("@ef
|
|
|
771
792
|
dirty: state.dirty + (invalidatesRecovery && !nativeSource ? 1n : 0n)
|
|
772
793
|
})));
|
|
773
794
|
const deadline = next(dueQueue.read());
|
|
774
|
-
if (Number.isFinite(deadline)) checkpoint.earlier(Math.max(deadline, now +
|
|
795
|
+
if (Number.isFinite(deadline)) checkpoint.earlier(Math.max(deadline, now + recoveryDelay));
|
|
775
796
|
});
|
|
776
797
|
yield* failpoint.hit("maintenance:dirty:after");
|
|
777
798
|
yield* Ref.update(activeMutations, (active) => active + 1);
|
|
@@ -868,6 +889,7 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
868
889
|
const alarms = yield* ThreadMaintenanceAlarm;
|
|
869
890
|
const config = yield* CloudflareDurableRuntimeConfig;
|
|
870
891
|
const { ctx } = yield* DurableObjectContext;
|
|
892
|
+
const execution = DurableObjectState.fromDurableObjectState(ctx);
|
|
871
893
|
const dueQueue = make(ctx.storage);
|
|
872
894
|
const storage = DurableObjectStorage.fromDurableObjectStorage(ctx.storage);
|
|
873
895
|
const runStorage = yield* makeStorageEffect;
|
|
@@ -930,8 +952,8 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
930
952
|
const now = yield* Clock.currentTimeMillis;
|
|
931
953
|
const claimed = yield* runAlarmTransaction("charge maintenance attempt", async (_transaction, checkpoint) => {
|
|
932
954
|
const claimed = dueQueue.claim(selected, now);
|
|
933
|
-
const next$
|
|
934
|
-
if (Number.isFinite(next$
|
|
955
|
+
const next$5 = next(dueQueue.read());
|
|
956
|
+
if (Number.isFinite(next$5)) checkpoint.at(Math.max(now + minimumAlarmDelay, next$5));
|
|
935
957
|
else checkpoint.cancel();
|
|
936
958
|
return claimed;
|
|
937
959
|
});
|
|
@@ -1141,8 +1163,8 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1141
1163
|
if (!initialized) await transaction.put(MAINTENANCE_STATE_KEY, encodeMaintenanceState(state));
|
|
1142
1164
|
const native = state.dirty > state.processed ? state.retry?.generation === state.dirty ? state.retry.notBefore : rows.find((row) => row.id === "effect-agent:native")?.dueAt ?? now + minimumAlarmDelay : null;
|
|
1143
1165
|
dueQueue.checkpointNative(native);
|
|
1144
|
-
const next$
|
|
1145
|
-
if (Number.isFinite(next$
|
|
1166
|
+
const next$1 = next(dueQueue.read());
|
|
1167
|
+
if (Number.isFinite(next$1)) checkpoint.earlier(Math.max(now + minimumAlarmDelay, next$1));
|
|
1146
1168
|
});
|
|
1147
1169
|
yield* failpoint.hit("maintenance:ensure:after");
|
|
1148
1170
|
});
|
|
@@ -1216,8 +1238,8 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1216
1238
|
const charged = observed.charged.get(row.id) === row.revision ? row : dueQueue.claim(row, now);
|
|
1217
1239
|
if (charged !== void 0) dueQueue.complete(charged, now + backoffDelay(charged.stalls, jitter));
|
|
1218
1240
|
}
|
|
1219
|
-
const next$
|
|
1220
|
-
if (Number.isFinite(next$
|
|
1241
|
+
const next$6 = next(dueQueue.read());
|
|
1242
|
+
if (Number.isFinite(next$6)) checkpoint.at(Math.max(now + minimumAlarmDelay, next$6));
|
|
1221
1243
|
else checkpoint.cancel();
|
|
1222
1244
|
});
|
|
1223
1245
|
}));
|
|
@@ -1234,10 +1256,13 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1234
1256
|
activeAtStart
|
|
1235
1257
|
};
|
|
1236
1258
|
}));
|
|
1237
|
-
const attemptSelected = Effect.fnUntraced(function* (selected, previousWaits, yieldAfter, recovery) {
|
|
1238
|
-
yield* recoverThread(selected.threadId, recovery);
|
|
1259
|
+
const attemptSelected = Effect.fnUntraced(function* (selected, previousWaits, yieldAfter, recovery, admitted = false) {
|
|
1260
|
+
if (!admitted) yield* recoverThread(selected.threadId, recovery);
|
|
1239
1261
|
let bindingFailure;
|
|
1240
|
-
const settlement = recovery.faults.has(selected.threadId) ? Option.none() : yield* runtime.processThreadHead(selected.threadId, {
|
|
1262
|
+
const settlement = recovery.faults.has(selected.threadId) ? Option.none() : yield* runtime.processThreadHead(selected.threadId, {
|
|
1263
|
+
yieldAfter,
|
|
1264
|
+
...admitted ? { admittedSubmissionId: selected.submissionId } : {}
|
|
1265
|
+
}).pipe(Effect.provideService(CurrentNativeSource, true), Effect.catchTag("BindingUnavailable", (failure) => {
|
|
1241
1266
|
bindingFailure = failure;
|
|
1242
1267
|
return Effect.succeed(Option.none());
|
|
1243
1268
|
}));
|
|
@@ -1513,7 +1538,7 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1513
1538
|
message: `No handler registered for scheduled lane: ${row.id}`
|
|
1514
1539
|
});
|
|
1515
1540
|
});
|
|
1516
|
-
const dispatch = Effect.fnUntraced(function* (yieldAfter, dispatchUntil, observed) {
|
|
1541
|
+
const dispatch = Effect.fnUntraced(function* (yieldAfter, dispatchUntil, observed, admission) {
|
|
1517
1542
|
const leanSelection = framework.singleThreadRuntime === runtime && publication === emptyPublication && host.lanes.length === 0 && framework.lanes.length === 0;
|
|
1518
1543
|
const notified = leanSelection ? Effect.never : (yield* Stream.toPull(wakes.wakes)).pipe(Effect.asVoid, Effect.catch(() => Effect.never));
|
|
1519
1544
|
const started = yield* beginNative(observed);
|
|
@@ -1566,7 +1591,16 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1566
1591
|
let native;
|
|
1567
1592
|
let result;
|
|
1568
1593
|
let backlog;
|
|
1569
|
-
if (leanSelection) {
|
|
1594
|
+
if (leanSelection && admission !== void 0 && started._tag === "Actionable") {
|
|
1595
|
+
dispatch.dispatched++;
|
|
1596
|
+
dispatch.active.set(admission.threadId, yield* fork(attemptSelected(admission, [], yieldAfter, recovery, true)));
|
|
1597
|
+
result = {
|
|
1598
|
+
phase: "actionable",
|
|
1599
|
+
nonterminal: started.nonterminal,
|
|
1600
|
+
nextAttemptAt: void 0,
|
|
1601
|
+
dispatched: true
|
|
1602
|
+
};
|
|
1603
|
+
} else if (leanSelection) {
|
|
1570
1604
|
result = yield* advance(started, yieldAfter, observed, recovery, dispatch);
|
|
1571
1605
|
recovery.started = true;
|
|
1572
1606
|
yield* Deferred.succeed(recovery.queue, []);
|
|
@@ -1759,8 +1793,8 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1759
1793
|
settled: dispatch.settled
|
|
1760
1794
|
};
|
|
1761
1795
|
});
|
|
1762
|
-
const pass = Effect.fnUntraced(function* (yieldAfter, dispatchUntil, observed) {
|
|
1763
|
-
const concurrent = yield* Effect.exit(Effect.scoped(dispatch(yieldAfter, dispatchUntil, observed)).pipe(Effect.provideService(ThreadMutationGate, mutations)));
|
|
1796
|
+
const pass = Effect.fnUntraced(function* (yieldAfter, dispatchUntil, observed, admission) {
|
|
1797
|
+
const concurrent = yield* Effect.exit(Effect.scoped(dispatch(yieldAfter, dispatchUntil, observed, admission)).pipe(Effect.provideService(ThreadMutationGate, mutations)));
|
|
1764
1798
|
const afterNative = yield* Effect.gen(function* () {
|
|
1765
1799
|
const lanes = [
|
|
1766
1800
|
recoveryEventLane,
|
|
@@ -1831,9 +1865,13 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1831
1865
|
const { state } = await readMaintenanceState(transaction);
|
|
1832
1866
|
const native = active > 0 || state.dirty > state.processed ? state.retry?.generation === state.dirty && active === 0 ? Math.max(now + minimumAlarmDelay, state.retry.notBefore) : state.dirty === observed.generation && active === 0 ? result.nextAttemptAt ?? now + minimumAlarmDelay : now + minimumAlarmDelay : Infinity;
|
|
1833
1867
|
dueQueue.checkpointNative(Number.isFinite(native) ? native : null);
|
|
1834
|
-
const next$
|
|
1835
|
-
if (Number.isFinite(next$
|
|
1836
|
-
checkpoint.at(Math.max(now + minimumAlarmDelay, next$
|
|
1868
|
+
const next$2 = next(dueQueue.read());
|
|
1869
|
+
if (Number.isFinite(next$2)) {
|
|
1870
|
+
checkpoint.at(Math.max(now + minimumAlarmDelay, next$2));
|
|
1871
|
+
return "rearmed";
|
|
1872
|
+
}
|
|
1873
|
+
if (config.recoveryWindowMillis > 0 && observed.charged.size > 0) {
|
|
1874
|
+
checkpoint.at(now + config.recoveryWindowMillis);
|
|
1837
1875
|
return "rearmed";
|
|
1838
1876
|
}
|
|
1839
1877
|
checkpoint.cancel();
|
|
@@ -1857,28 +1895,30 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1857
1895
|
});
|
|
1858
1896
|
return report;
|
|
1859
1897
|
});
|
|
1898
|
+
const runPass = Effect.fnUntraced(function* (admission) {
|
|
1899
|
+
const now = yield* Clock.currentTimeMillis;
|
|
1900
|
+
const yieldAfter = DateTime.makeUnsafe(now + 6e5);
|
|
1901
|
+
const dispatchUntil = DateTime.makeUnsafe(now + 84e4);
|
|
1902
|
+
const observed = {
|
|
1903
|
+
nativeOnly: false,
|
|
1904
|
+
queue: /* @__PURE__ */ new Map(),
|
|
1905
|
+
charged: /* @__PURE__ */ new Map(),
|
|
1906
|
+
available: /* @__PURE__ */ new Map()
|
|
1907
|
+
};
|
|
1908
|
+
return yield* alarms.deferWakes(maintenancePassGate.withPermit(dueQueue.withView(Effect.scoped(pass(yieldAfter, dispatchUntil, observed, admission))).pipe(Effect.onErrorIf(() => true, () => rearmFailure(observed))))).pipe(hints.withHintsDeferred, Effect.catchTags({
|
|
1909
|
+
StorageOperationError: (error) => alarmFailure("defer maintenance wakes")(error),
|
|
1910
|
+
InvalidScheduleConfigurationError: (error) => alarmFailure("defer maintenance wakes")(error)
|
|
1911
|
+
}));
|
|
1912
|
+
}, Effect.timeoutOrElse({
|
|
1913
|
+
duration: "14 minutes",
|
|
1914
|
+
orElse: () => DurableAlarmError.make({
|
|
1915
|
+
operation: "maintenance pass deadline",
|
|
1916
|
+
message: "The maintenance event exceeded its 14 minute deadline; durable recovery remains pending"
|
|
1917
|
+
})
|
|
1918
|
+
}), Effect.ensuring(reportParked));
|
|
1860
1919
|
return ThreadMaintenance.of({
|
|
1861
|
-
pass:
|
|
1862
|
-
|
|
1863
|
-
const yieldAfter = DateTime.makeUnsafe(now + 6e5);
|
|
1864
|
-
const dispatchUntil = DateTime.makeUnsafe(now + 84e4);
|
|
1865
|
-
const observed = {
|
|
1866
|
-
nativeOnly: false,
|
|
1867
|
-
queue: /* @__PURE__ */ new Map(),
|
|
1868
|
-
charged: /* @__PURE__ */ new Map(),
|
|
1869
|
-
available: /* @__PURE__ */ new Map()
|
|
1870
|
-
};
|
|
1871
|
-
return yield* alarms.deferWakes(maintenancePassGate.withPermit(dueQueue.withView(Effect.scoped(pass(yieldAfter, dispatchUntil, observed))).pipe(Effect.onErrorIf(() => true, () => rearmFailure(observed))))).pipe(hints.withHintsDeferred, Effect.catchTags({
|
|
1872
|
-
StorageOperationError: (error) => alarmFailure("defer maintenance wakes")(error),
|
|
1873
|
-
InvalidScheduleConfigurationError: (error) => alarmFailure("defer maintenance wakes")(error)
|
|
1874
|
-
}));
|
|
1875
|
-
}).pipe(Effect.timeoutOrElse({
|
|
1876
|
-
duration: "14 minutes",
|
|
1877
|
-
orElse: () => DurableAlarmError.make({
|
|
1878
|
-
operation: "maintenance pass deadline",
|
|
1879
|
-
message: "The maintenance event exceeded its 14 minute deadline; durable recovery remains pending"
|
|
1880
|
-
})
|
|
1881
|
-
}), Effect.ensuring(reportParked)),
|
|
1920
|
+
pass: runPass(void 0),
|
|
1921
|
+
start: (admission) => execution.waitUntil(runPass(admission)),
|
|
1882
1922
|
ensureAlarm: mutations.withSnapshot(() => ensureAlarm()).pipe(Effect.tap(() => reportParked)),
|
|
1883
1923
|
withMutation: (body) => mutations.withMutation(body.pipe(Effect.tap(() => publishCommitted.pipe(Effect.provide(publicationContext)))))
|
|
1884
1924
|
});
|
|
@@ -1887,4 +1927,4 @@ var ThreadMaintenance = class ThreadMaintenance extends Context.Service()("@effe
|
|
|
1887
1927
|
//#endregion
|
|
1888
1928
|
export { Messages as _, ThreadMaintenance as a, Publication as b, ThreadMessageDelivery as c, ThreadPublication as d, ThreadRecoveryEvents as f, Lifecycle as g, HostLaneId as h, ThreadHostMaintenance as i, ThreadMutationGate as l, publishCommitted as m, DurableAlarmService as n, ThreadMaintenanceAlarm as o, ThreadRecoveryFaultEvent as p, MaintenancePassReport as r, ThreadMaintenanceFailpoint as s, Alarm_exports as t, ThreadNativeMaintenance as u, Native as v, Projection as y };
|
|
1889
1929
|
|
|
1890
|
-
//# sourceMappingURL=Alarm-
|
|
1930
|
+
//# sourceMappingURL=Alarm-BN-ADYcu.mjs.map
|