experimental-a2 0.17.0 → 0.18.1
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/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/dist/{actor-DBbe5xeE.d.ts → actor-C7b-1arn.d.ts} +5 -5
- package/dist/{actor-DBbe5xeE.d.ts.map → actor-C7b-1arn.d.ts.map} +1 -1
- package/dist/actor-client.d.ts +1 -1
- package/dist/actor-react.d.ts +3 -3
- package/dist/actor-react.js +1 -1
- package/dist/actor.d.ts +1 -1
- package/dist/actor.js +2 -2
- package/dist/{ai-vpGtcaCB.d.ts → ai-BMLlI2Ff.d.ts} +3 -3
- package/dist/{ai-vpGtcaCB.d.ts.map → ai-BMLlI2Ff.d.ts.map} +1 -1
- package/dist/{ai-UrWfKeuv.js → ai-D6mGlO8j.js} +2 -2
- package/dist/{ai-UrWfKeuv.js.map → ai-D6mGlO8j.js.map} +1 -1
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -2
- package/dist/ai-fx.browser.d.ts +1 -0
- package/dist/ai-fx.browser.js +6 -0
- package/dist/ai-fx.browser.js.map +1 -0
- package/dist/ai-fx.d.ts +10 -0
- package/dist/ai-fx.d.ts.map +1 -0
- package/dist/ai-fx.js +692 -0
- package/dist/ai-fx.js.map +1 -0
- package/dist/ai-harness-B2suP2Qh.d.ts +26 -0
- package/dist/ai-harness-B2suP2Qh.d.ts.map +1 -0
- package/dist/ai-harness-BuLh_EYi.js +273 -0
- package/dist/ai-harness-BuLh_EYi.js.map +1 -0
- package/dist/ai-pi.browser.d.ts +1 -0
- package/dist/ai-pi.browser.js +6 -0
- package/dist/ai-pi.browser.js.map +1 -0
- package/dist/ai-pi.d.ts +17 -0
- package/dist/ai-pi.d.ts.map +1 -0
- package/dist/ai-pi.js +950 -0
- package/dist/ai-pi.js.map +1 -0
- package/dist/ai-react.d.ts +5 -5
- package/dist/ai-react.js +2 -2
- package/dist/ai-server.d.ts +47 -25
- package/dist/ai-server.d.ts.map +1 -1
- package/dist/ai-server.js +113 -40
- package/dist/ai-server.js.map +1 -1
- package/dist/ai-tool-input-DmSqMUQi.js +40 -0
- package/dist/ai-tool-input-DmSqMUQi.js.map +1 -0
- package/dist/ai.d.ts +1 -1
- package/dist/ai.js +1 -1
- package/dist/bounded-cache-CPHWF-8h.js +41 -0
- package/dist/bounded-cache-CPHWF-8h.js.map +1 -0
- package/dist/{client-COaiaDub.js → client-BhHLoNKF.js} +3 -3
- package/dist/{client-COaiaDub.js.map → client-BhHLoNKF.js.map} +1 -1
- package/dist/{client-qRnRUzBS.d.ts → client-h_DKFAjj.d.ts} +3 -3
- package/dist/{client-qRnRUzBS.d.ts.map → client-h_DKFAjj.d.ts.map} +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/{initial-snapshot-BrLso5x_.d.ts → initial-snapshot-Bx-c0pDP.d.ts} +2 -2
- package/dist/{initial-snapshot-BrLso5x_.d.ts.map → initial-snapshot-Bx-c0pDP.d.ts.map} +1 -1
- package/dist/{internal-CbVvEwad.js → internal-CscSY7K_.js} +11 -3
- package/dist/internal-CscSY7K_.js.map +1 -0
- package/dist/otel.d.ts +1 -1
- package/dist/{react-BbJ-g6Uu.d.ts → react-BBXgHWFc.d.ts} +4 -4
- package/dist/{react-BbJ-g6Uu.d.ts.map → react-BBXgHWFc.d.ts.map} +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/reducer-BAXc8JyF.js.map +1 -1
- package/dist/{reducer-BYu6DT7h.d.ts → reducer-CqA59Q6U.d.ts} +2 -2
- package/dist/{reducer-BYu6DT7h.d.ts.map → reducer-CqA59Q6U.d.ts.map} +1 -1
- package/dist/scheduler-qstash.d.ts +2 -2
- package/dist/scheduler-qstash.js +3 -3
- package/dist/scheduler-qstash.js.map +1 -1
- package/dist/scheduler-vercel.d.ts +7 -7
- package/dist/scheduler-vercel.d.ts.map +1 -1
- package/dist/scheduler-vercel.js +9 -10
- package/dist/scheduler-vercel.js.map +1 -1
- package/dist/{server-Rj64fNvX.js → server-D-Y4pqwu.js} +126 -67
- package/dist/server-D-Y4pqwu.js.map +1 -0
- package/dist/{server-CGM8WzRG.d.ts → server-DYAATFuT.d.ts} +42 -7
- package/dist/server-DYAATFuT.d.ts.map +1 -0
- package/dist/server.d.ts +4 -4
- package/dist/server.js +1 -1
- package/dist/{session-clear-Dshpuhff.d.ts → session-clear-C-QwTXV1.d.ts} +2 -2
- package/dist/session-clear-C-QwTXV1.d.ts.map +1 -0
- package/dist/{store-Gpkq7WBo.d.ts → store-CyLUy86v.d.ts} +53 -5
- package/dist/store-CyLUy86v.d.ts.map +1 -0
- package/dist/store-N8PXxDAS.js.map +1 -1
- package/dist/store-memory.d.ts +1 -1
- package/dist/store-memory.js +56 -11
- package/dist/store-memory.js.map +1 -1
- package/dist/{store-polling-4_y8lETm.js → store-polling-7WJV0YWP.js} +2 -2
- package/dist/{store-polling-4_y8lETm.js.map → store-polling-7WJV0YWP.js.map} +1 -1
- package/dist/store-postgres.d.ts +1 -1
- package/dist/store-postgres.d.ts.map +1 -1
- package/dist/store-postgres.js +106 -25
- package/dist/store-postgres.js.map +1 -1
- package/dist/{store-presence-polling-Q1C-k2dd.js → store-presence-polling-B1ixeqIS.js} +3 -3
- package/dist/{store-presence-polling-Q1C-k2dd.js.map → store-presence-polling-B1ixeqIS.js.map} +1 -1
- package/dist/store-redis-http.d.ts +1 -1
- package/dist/store-redis-http.js +3 -3
- package/dist/{store-redis-notify-tqWNnMRu.js → store-redis-notify-CM0AfLY0.js} +271 -101
- package/dist/store-redis-notify-CM0AfLY0.js.map +1 -0
- package/dist/store-redis.d.ts +1 -1
- package/dist/store-redis.js +1 -1
- package/dist/store-sqlite.d.ts +1 -1
- package/dist/store-sqlite.js +66 -21
- package/dist/store-sqlite.js.map +1 -1
- package/dist/{telemetry-cZH-cibj.d.ts → telemetry-Cyfqo6Qt.d.ts} +2 -2
- package/dist/telemetry-Cyfqo6Qt.d.ts.map +1 -0
- package/dist/{wire-DjfHOvdW.js → wire-BKxH1vbP.js} +2 -2
- package/dist/{wire-DjfHOvdW.js.map → wire-BKxH1vbP.js.map} +1 -1
- package/docs/01-quickstart.mdx +49 -83
- package/docs/{guides/07-examples.mdx → 02-examples.mdx} +10 -20
- package/docs/actors/01-introduction.mdx +48 -86
- package/docs/actors/02-concurrency.mdx +43 -70
- package/docs/actors/03-timers.mdx +28 -42
- package/docs/actors/04-routes.mdx +110 -150
- package/docs/actors/meta.ts +1 -1
- package/docs/agents/01-introduction.mdx +257 -0
- package/docs/agents/02-tools.mdx +247 -0
- package/docs/agents/03-conversations.mdx +538 -0
- package/docs/agents/04-harnesses.mdx +136 -0
- package/docs/agents/meta.ts +1 -0
- package/docs/client/01-react.mdx +294 -0
- package/docs/client/02-transports.mdx +86 -0
- package/docs/client/03-presence.mdx +224 -0
- package/docs/client/meta.ts +1 -0
- package/docs/contract/01-events.mdx +57 -0
- package/docs/contract/02-state.mdx +142 -0
- package/docs/contract/03-sessions.mdx +175 -0
- package/docs/index.mdx +109 -145
- package/docs/reference/01-core.mdx +139 -0
- package/docs/reference/02-server.mdx +860 -0
- package/docs/reference/03-client.mdx +301 -0
- package/docs/reference/04-ai.mdx +731 -0
- package/docs/reference/05-adapters.mdx +351 -0
- package/docs/reference/06-errors.mdx +138 -0
- package/docs/reference/meta.ts +1 -1
- package/docs/server/01-handlers.mdx +200 -0
- package/docs/server/02-timers.mdx +130 -0
- package/docs/server/03-cancellation.mdx +142 -0
- package/docs/server/04-routes.mdx +243 -0
- package/docs/server/05-production.mdx +323 -0
- package/docs/server/06-guarantees.mdx +132 -0
- package/examples/playground/DEPLOY.md +3 -5
- package/examples/playground/app/a0/[appId]/page.tsx +12 -13
- package/examples/playground/app/a0/app-list.tsx +9 -2
- package/examples/playground/app/a0/app-view.tsx +9 -1
- package/examples/playground/app/a0/apps/[appId]/route.ts +10 -5
- package/examples/playground/app/a0/apps.test.ts +12 -0
- package/examples/playground/app/a0/apps.ts +22 -7
- package/examples/playground/app/a0/chat.tsx +47 -1
- package/examples/playground/app/a0/devtools.tsx +2 -8
- package/examples/playground/app/a0/fx/events/route.ts +9 -0
- package/examples/playground/app/a0/fx/scheduler/route.ts +7 -0
- package/examples/playground/app/a0/fx/short/events/route.ts +11 -0
- package/examples/playground/app/a0/model.test.ts +18 -1
- package/examples/playground/app/a0/model.ts +47 -10
- package/examples/playground/app/a0/no-photon.cjs +4 -0
- package/examples/playground/app/a0/no-quickjs.cjs +3 -0
- package/examples/playground/app/a0/pi/events/route.ts +9 -0
- package/examples/playground/app/a0/pi/scheduler/route.ts +7 -0
- package/examples/playground/app/a0/pi/short/events/route.ts +11 -0
- package/examples/playground/app/a0/sandbox-log.ts +10 -4
- package/examples/playground/app/a0/sandbox-session.ts +152 -0
- package/examples/playground/app/a0/scheduler/route.ts +2 -2
- package/examples/playground/app/a0/server.ts +98 -54
- package/examples/playground/app/a0/session.ts +17 -5
- package/examples/playground/app/a0/shell.tsx +11 -3
- package/examples/playground/app/agent/ingress.test.ts +6 -3
- package/examples/playground/app/agent/server.ts +9 -6
- package/examples/playground/app/agent/telemetry.test.ts +71 -50
- package/examples/playground/app/canvas/[canvasId]/canvas-client.tsx +1 -1
- package/examples/playground/app/chat/server.test.ts +30 -26
- package/examples/playground/app/chat/server.ts +46 -46
- package/examples/playground/next.config.ts +17 -5
- package/examples/playground/package.json +4 -1
- package/examples/playground/vercel.json +18 -0
- package/package.json +27 -3
- package/src/ai-agent.ts +271 -90
- package/src/ai-fx.browser.ts +5 -0
- package/src/ai-fx.ts +912 -0
- package/src/ai-harness.ts +518 -0
- package/src/ai-model-metadata.ts +11 -6
- package/src/ai-pi.browser.ts +5 -0
- package/src/ai-pi.ts +1322 -0
- package/src/ai-sdk-step.ts +2 -2
- package/src/ai-server.ts +3 -1
- package/src/ai-tool-input.ts +45 -0
- package/src/internal.ts +13 -0
- package/src/libfx.d.ts +34 -0
- package/src/reducer.ts +1 -1
- package/src/scheduler-qstash.ts +5 -5
- package/src/scheduler-vercel.ts +14 -15
- package/src/server.ts +233 -29
- package/src/store-memory.ts +92 -16
- package/src/store-postgres.ts +156 -25
- package/src/store-redis-core.ts +322 -110
- package/src/store-redis-notify.ts +2 -0
- package/src/store-sqlite.ts +121 -28
- package/src/store.ts +55 -3
- package/src/telemetry.ts +1 -0
- package/dist/internal-CbVvEwad.js.map +0 -1
- package/dist/server-CGM8WzRG.d.ts.map +0 -1
- package/dist/server-Rj64fNvX.js.map +0 -1
- package/dist/session-clear-Dshpuhff.d.ts.map +0 -1
- package/dist/store-Gpkq7WBo.d.ts.map +0 -1
- package/dist/store-redis-notify-tqWNnMRu.js.map +0 -1
- package/dist/telemetry-cZH-cibj.d.ts.map +0 -1
- package/docs/concepts/01-contracts.mdx +0 -237
- package/docs/concepts/02-handlers.mdx +0 -284
- package/docs/concepts/03-durability.mdx +0 -314
- package/docs/concepts/04-state.mdx +0 -209
- package/docs/guides/01-timers.mdx +0 -193
- package/docs/guides/02-cancellation.mdx +0 -161
- package/docs/guides/03-react.mdx +0 -324
- package/docs/guides/04-local-first.mdx +0 -47
- package/docs/guides/05-production.mdx +0 -534
- package/docs/guides/06-ai-agents.mdx +0 -1408
- package/docs/guides/08-application-data.mdx +0 -113
- package/docs/guides/09-presence.mdx +0 -262
- package/docs/guides/10-transports.mdx +0 -221
- package/docs/reference/01-api.mdx +0 -2358
- package/docs/reference/02-errors.mdx +0 -150
- /package/docs/{concepts → contract}/meta.ts +0 -0
- /package/docs/{guides → server}/meta.ts +0 -0
package/src/store-sqlite.ts
CHANGED
|
@@ -470,6 +470,22 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
+
/** A dead-lettered event's snapshot pins, and history no pin keeps. */
|
|
474
|
+
const releasePins = (sessionId: string, index: number): void => {
|
|
475
|
+
db.prepare(
|
|
476
|
+
'delete from a2_snapshot_pins where session_id = ? and event_index = ?',
|
|
477
|
+
).run(sessionId, index)
|
|
478
|
+
db.prepare(
|
|
479
|
+
`delete from a2_snapshot_history
|
|
480
|
+
where session_id = ?
|
|
481
|
+
and not exists (
|
|
482
|
+
select 1 from a2_snapshot_pins pin
|
|
483
|
+
where pin.session_id = a2_snapshot_history.session_id
|
|
484
|
+
and pin.reducer_name = a2_snapshot_history.reducer_name
|
|
485
|
+
and pin.up_to_index = a2_snapshot_history.up_to_index
|
|
486
|
+
)`,
|
|
487
|
+
).run(sessionId)
|
|
488
|
+
}
|
|
473
489
|
return {
|
|
474
490
|
async append(sessionId, events, appendOptions) {
|
|
475
491
|
if (events.length === 0) {
|
|
@@ -626,6 +642,7 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
626
642
|
ttlMs,
|
|
627
643
|
expiresAtMs,
|
|
628
644
|
excludeIndexes = [],
|
|
645
|
+
maxFailures,
|
|
629
646
|
}) {
|
|
630
647
|
return wrap(() =>
|
|
631
648
|
tx(() => {
|
|
@@ -638,7 +655,7 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
638
655
|
: `and event.idx not in (${excludeIndexes.map(() => '?').join(', ')})`
|
|
639
656
|
const eligible = db
|
|
640
657
|
.prepare(
|
|
641
|
-
`select event.idx
|
|
658
|
+
`select event.idx, event.claim_holder, event.failure_count
|
|
642
659
|
from a2_events event
|
|
643
660
|
where event.session_id = ?
|
|
644
661
|
and event.processed_at is null
|
|
@@ -656,11 +673,15 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
656
673
|
...excludeIndexes,
|
|
657
674
|
) as unknown as Array<{
|
|
658
675
|
idx: number | bigint
|
|
676
|
+
claim_holder: string | null
|
|
677
|
+
failure_count: number | bigint
|
|
659
678
|
}>
|
|
660
679
|
if (eligible.length > 0) {
|
|
661
680
|
const update = db.prepare(
|
|
662
681
|
`update a2_events set
|
|
663
682
|
attempt_count = attempt_count + 1,
|
|
683
|
+
failure_count = failure_count
|
|
684
|
+
+ case when claim_holder is null then 0 else 1 end,
|
|
664
685
|
first_claimed_at = coalesce(first_claimed_at, ?),
|
|
665
686
|
last_claimed_at = ?,
|
|
666
687
|
claim_holder = ?,
|
|
@@ -668,15 +689,30 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
668
689
|
where session_id = ? and idx = ?
|
|
669
690
|
returning *`,
|
|
670
691
|
)
|
|
692
|
+
// Advancing the attempt fences the lapsed one; nothing runs.
|
|
693
|
+
const deadLetter = () =>
|
|
694
|
+
db.prepare(
|
|
695
|
+
`update a2_events set
|
|
696
|
+
attempt_count = attempt_count + 1,
|
|
697
|
+
failure_count = failure_count + 1,
|
|
698
|
+
failed_at = ?,
|
|
699
|
+
claim_holder = null,
|
|
700
|
+
claim_expires_at = null
|
|
701
|
+
where session_id = ? and idx = ?
|
|
702
|
+
returning *`,
|
|
703
|
+
)
|
|
671
704
|
const events = eligible.map((row) => {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
705
|
+
// A lapsed claim's takeover that spends the last failed attempt.
|
|
706
|
+
const exhausted =
|
|
707
|
+
row.claim_holder !== null &&
|
|
708
|
+
maxFailures !== undefined &&
|
|
709
|
+
Number(row.failure_count) + 1 >= maxFailures
|
|
710
|
+
const claimed = (
|
|
711
|
+
exhausted
|
|
712
|
+
? deadLetter().get(now, sessionId, row.idx)
|
|
713
|
+
: update.get(now, now, holder, expiresAt, sessionId, row.idx)
|
|
679
714
|
) as EventRow
|
|
715
|
+
if (exhausted) releasePins(sessionId, Number(row.idx))
|
|
680
716
|
const stored = toStored(claimed)
|
|
681
717
|
if (clearIndex > 0) stored.clearIndex = clearIndex
|
|
682
718
|
return stored
|
|
@@ -687,15 +723,16 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
687
723
|
const active = db
|
|
688
724
|
.prepare(
|
|
689
725
|
`select min(claim_expires_at) as retry_at
|
|
690
|
-
from a2_events
|
|
726
|
+
from a2_events event
|
|
691
727
|
where session_id = ?
|
|
692
728
|
and processed_at is null
|
|
693
729
|
and failed_at is null
|
|
694
730
|
and lane_ready = 1
|
|
695
731
|
and idx > ?
|
|
696
|
-
and claim_expires_at >
|
|
732
|
+
and claim_expires_at > ?
|
|
733
|
+
${exclusion}`,
|
|
697
734
|
)
|
|
698
|
-
.get(sessionId, clearIndex, now) as {
|
|
735
|
+
.get(sessionId, clearIndex, now, ...excludeIndexes) as {
|
|
699
736
|
retry_at: number | bigint | null
|
|
700
737
|
}
|
|
701
738
|
return active.retry_at === null
|
|
@@ -908,7 +945,14 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
908
945
|
)
|
|
909
946
|
},
|
|
910
947
|
|
|
911
|
-
async failAttempt({
|
|
948
|
+
async failAttempt({
|
|
949
|
+
sessionId,
|
|
950
|
+
index,
|
|
951
|
+
attempt,
|
|
952
|
+
error,
|
|
953
|
+
maxFailures,
|
|
954
|
+
retryAfterMs,
|
|
955
|
+
}) {
|
|
912
956
|
return wrap(() =>
|
|
913
957
|
tx(() => {
|
|
914
958
|
if (index <= clearIndexOf(sessionId)) {
|
|
@@ -954,7 +998,7 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
954
998
|
last_failed_attempt = ?,
|
|
955
999
|
failed_at = ?,
|
|
956
1000
|
claim_holder = null,
|
|
957
|
-
claim_expires_at =
|
|
1001
|
+
claim_expires_at = ?
|
|
958
1002
|
where session_id = ? and idx = ?`,
|
|
959
1003
|
).run(
|
|
960
1004
|
nextFailureCount,
|
|
@@ -962,24 +1006,13 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
962
1006
|
now,
|
|
963
1007
|
attempt,
|
|
964
1008
|
deadLettered ? now : null,
|
|
1009
|
+
deadLettered || retryAfterMs === undefined
|
|
1010
|
+
? null
|
|
1011
|
+
: now + retryAfterMs,
|
|
965
1012
|
sessionId,
|
|
966
1013
|
index,
|
|
967
1014
|
)
|
|
968
|
-
if (deadLettered)
|
|
969
|
-
db.prepare(
|
|
970
|
-
'delete from a2_snapshot_pins where session_id = ? and event_index = ?',
|
|
971
|
-
).run(sessionId, index)
|
|
972
|
-
db.prepare(
|
|
973
|
-
`delete from a2_snapshot_history
|
|
974
|
-
where session_id = ?
|
|
975
|
-
and not exists (
|
|
976
|
-
select 1 from a2_snapshot_pins pin
|
|
977
|
-
where pin.session_id = a2_snapshot_history.session_id
|
|
978
|
-
and pin.reducer_name = a2_snapshot_history.reducer_name
|
|
979
|
-
and pin.up_to_index = a2_snapshot_history.up_to_index
|
|
980
|
-
)`,
|
|
981
|
-
).run(sessionId)
|
|
982
|
-
}
|
|
1015
|
+
if (deadLettered) releasePins(sessionId, index)
|
|
983
1016
|
return {
|
|
984
1017
|
outcome: deadLettered ? 'dead_lettered' : 'failed',
|
|
985
1018
|
failureCount: nextFailureCount,
|
|
@@ -988,6 +1021,66 @@ export function sqlite(options: SqliteStoreOptions = {}): SqliteStore {
|
|
|
988
1021
|
)
|
|
989
1022
|
},
|
|
990
1023
|
|
|
1024
|
+
async deadLetters(sessionId) {
|
|
1025
|
+
return wrap(() => {
|
|
1026
|
+
const rows = db
|
|
1027
|
+
.prepare(
|
|
1028
|
+
`select * from a2_events
|
|
1029
|
+
where session_id = ?
|
|
1030
|
+
and processed_at is null
|
|
1031
|
+
and failed_at is not null
|
|
1032
|
+
and idx > coalesce(
|
|
1033
|
+
(select clear_index from a2_clears where session_id = ?), 0
|
|
1034
|
+
)
|
|
1035
|
+
order by idx`,
|
|
1036
|
+
)
|
|
1037
|
+
.all(sessionId, sessionId) as unknown as EventRow[]
|
|
1038
|
+
return rows.map(toStored)
|
|
1039
|
+
})
|
|
1040
|
+
},
|
|
1041
|
+
|
|
1042
|
+
async redrive({ sessionId, index, action }) {
|
|
1043
|
+
return wrap(() =>
|
|
1044
|
+
tx(() => {
|
|
1045
|
+
const clearIndex = clearIndexOf(sessionId)
|
|
1046
|
+
const row =
|
|
1047
|
+
index > clearIndex
|
|
1048
|
+
? (db
|
|
1049
|
+
.prepare(
|
|
1050
|
+
'select lane, processed_at, failed_at from a2_events where session_id = ? and idx = ?',
|
|
1051
|
+
)
|
|
1052
|
+
.get(sessionId, index) as
|
|
1053
|
+
| Pick<EventRow, 'lane' | 'processed_at' | 'failed_at'>
|
|
1054
|
+
| undefined)
|
|
1055
|
+
: undefined
|
|
1056
|
+
const redriven =
|
|
1057
|
+
row !== undefined &&
|
|
1058
|
+
row.processed_at === null &&
|
|
1059
|
+
row.failed_at !== null
|
|
1060
|
+
if (redriven && action === 'skip') {
|
|
1061
|
+
db.prepare(
|
|
1062
|
+
`update a2_events set processed_at = ?, lane_ready = 0
|
|
1063
|
+
where session_id = ? and idx = ?`,
|
|
1064
|
+
).run(clock.now().getTime(), sessionId, index)
|
|
1065
|
+
if (row.lane !== null) {
|
|
1066
|
+
promoteLaneHead.run(sessionId, sessionId, row.lane, clearIndex)
|
|
1067
|
+
}
|
|
1068
|
+
} else if (redriven) {
|
|
1069
|
+
db.prepare(
|
|
1070
|
+
`update a2_events set failed_at = null, failure_count = 0
|
|
1071
|
+
where session_id = ? and idx = ?`,
|
|
1072
|
+
).run(sessionId, index)
|
|
1073
|
+
}
|
|
1074
|
+
const status = appendStatus.get(
|
|
1075
|
+
sessionId,
|
|
1076
|
+
sessionId,
|
|
1077
|
+
clearIndex,
|
|
1078
|
+
) as AppendStatusRow
|
|
1079
|
+
return { redriven, hasPending: Number(status.has_pending) === 1 }
|
|
1080
|
+
}),
|
|
1081
|
+
)
|
|
1082
|
+
},
|
|
1083
|
+
|
|
991
1084
|
async readState(sessionId, reducerName, stateOptions) {
|
|
992
1085
|
return wrap(() => {
|
|
993
1086
|
const throughIndex = stateOptions?.throughIndex ?? null
|
package/src/store.ts
CHANGED
|
@@ -53,9 +53,15 @@ export type StoredEvent = Event & {
|
|
|
53
53
|
attemptCount: number
|
|
54
54
|
/** Current dispatch holder; null when the event is not claimed. */
|
|
55
55
|
claimHolder: string | null
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Adapter clock expiry for the current dispatch claim, or, with no holder,
|
|
58
|
+
* the end of a failed attempt's retry hold.
|
|
59
|
+
*/
|
|
57
60
|
claimExpiresAt: Date | null
|
|
58
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Failed attempts: caught handler failures, and lapsed claims a later claim
|
|
63
|
+
* took over. This alone drives dead-lettering.
|
|
64
|
+
*/
|
|
59
65
|
failureCount: number
|
|
60
66
|
/** Adapter clock time recorded by the most recent caught handler failure. */
|
|
61
67
|
lastFailedAt: Date | null
|
|
@@ -174,6 +180,20 @@ export type StoreClearResult = {
|
|
|
174
180
|
|
|
175
181
|
export type StoreReclaimResult = { deleted: number; done: boolean }
|
|
176
182
|
|
|
183
|
+
export type StoreRedriveOptions = {
|
|
184
|
+
sessionId: string
|
|
185
|
+
index: number
|
|
186
|
+
/** `retry` clears the dead letter; `skip` settles it without a handler. */
|
|
187
|
+
action: 'retry' | 'skip'
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type StoreRedriveResult = {
|
|
191
|
+
/** Whether the event was dead-lettered and this operation resolved it. */
|
|
192
|
+
redriven: boolean
|
|
193
|
+
/** Whether the session contains an event without a completion marker. */
|
|
194
|
+
hasPending: boolean
|
|
195
|
+
}
|
|
196
|
+
|
|
177
197
|
/**
|
|
178
198
|
* An injectable clock. Adapters take one so tests can drive claim
|
|
179
199
|
* expiry, failure timestamps, and (later) stuck-session detection
|
|
@@ -241,6 +261,25 @@ export interface A2Store {
|
|
|
241
261
|
*/
|
|
242
262
|
reclaim?(sessionId: string): Promise<StoreReclaimResult>
|
|
243
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Optional with `redrive`. The session's dead-lettered events above the
|
|
266
|
+
* latest clear marker, oldest first.
|
|
267
|
+
*/
|
|
268
|
+
deadLetters?(sessionId: string): Promise<StoredEvent[]>
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Optional with `deadLetters`. Atomically resolves one dead-lettered event
|
|
272
|
+
* above the latest clear marker; any other event is untouched and reports
|
|
273
|
+
* `redriven: false`. `retry` clears `failedAt` and `failureCount`, so the
|
|
274
|
+
* event is claimable again with a fresh failure budget, keeping its claim
|
|
275
|
+
* history and last failure. `skip` records `processedAt` with no
|
|
276
|
+
* `processedByAttempt` or `returnedEventIds` and exposes the next event in
|
|
277
|
+
* its lane. Both serialize with `claimAvailable` and the handler-append
|
|
278
|
+
* parent fence; `skip` also serializes with lane promotion in `append` and
|
|
279
|
+
* `completeAttempt`. `hasPending` is read in the same step.
|
|
280
|
+
*/
|
|
281
|
+
redrive?(options: StoreRedriveOptions): Promise<StoreRedriveResult>
|
|
282
|
+
|
|
244
283
|
/** Events for one session, oldest first. Bounds form `(afterIndex, throughIndex]`. */
|
|
245
284
|
read(
|
|
246
285
|
sessionId: string,
|
|
@@ -266,6 +305,15 @@ export interface A2Store {
|
|
|
266
305
|
ttlMs: number
|
|
267
306
|
expiresAtMs?: number
|
|
268
307
|
excludeIndexes?: readonly number[]
|
|
308
|
+
/**
|
|
309
|
+
* Taking over a lapsed claim (one whose holder is still recorded, never
|
|
310
|
+
* completed or failed) adds one to `failureCount`. When that reaches
|
|
311
|
+
* `maxFailures`, the event dead-letters instead of being claimed: it
|
|
312
|
+
* comes back in `events` with `failedAt` set and no claim. Its
|
|
313
|
+
* `attemptCount` still advances, fencing the lapsed attempt, and its
|
|
314
|
+
* `lastFailedAttempt` is unchanged.
|
|
315
|
+
*/
|
|
316
|
+
maxFailures?: number
|
|
269
317
|
}): Promise<StoreClaimAvailableResult>
|
|
270
318
|
|
|
271
319
|
/**
|
|
@@ -300,7 +348,10 @@ export interface A2Store {
|
|
|
300
348
|
/**
|
|
301
349
|
* Atomically records a caught failure for one claimed attempt. A stale
|
|
302
350
|
* attempt cannot poison a processed event or a newer dispatch. Accepted
|
|
303
|
-
* failures record the operation's clock time.
|
|
351
|
+
* failures record the operation's clock time. A failure that does not
|
|
352
|
+
* dead-letter releases the claim and, with `retryAfterMs`, keeps the event
|
|
353
|
+
* unclaimable for that long: its claim expiry is set with no holder, so
|
|
354
|
+
* `claimAvailable` reports it `busy` until then.
|
|
304
355
|
*/
|
|
305
356
|
failAttempt(options: {
|
|
306
357
|
sessionId: string
|
|
@@ -308,6 +359,7 @@ export interface A2Store {
|
|
|
308
359
|
attempt: number
|
|
309
360
|
error: string
|
|
310
361
|
maxFailures: number
|
|
362
|
+
retryAfterMs?: number
|
|
311
363
|
}): Promise<FailAttemptResult>
|
|
312
364
|
|
|
313
365
|
/**
|
package/src/telemetry.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal-CbVvEwad.js","names":[],"sources":["../src/internal.ts"],"sourcesContent":["/**\n * Private seams shared by a2 entry points and a2's own tests. Not exported\n * from the package. Nothing here is public API.\n */\n\nimport type { ScheduledEvent } from './scheduler-task.ts'\nimport type { DrainableServer } from './server.ts'\nimport type { Event } from './store.ts'\n\nexport type DrainOutcome = 'busy' | 'stalled' | 'settled'\n\n/**\n * A null-prototype record for maps keyed by caller-controlled strings\n * (participant ids, presence field names). On a normal object,\n * assigning to '__proto__' rewrites the prototype instead of creating\n * an own property — the prototype-pollution class. Null-prototype\n * objects still satisfy Record types and JSON.stringify cleanly.\n */\nexport function nullProtoRecord<T extends object>(): T {\n return Object.create(null) as T\n}\n\n/**\n * ECMA-262's maximum Date value (±8.64e15 ms). A presence stamp past\n * it becomes an Invalid Date whose toISOString throws — one hostile\n * stamp would poison every subscriber's snapshot frame — so both\n * seams bound `at` to the representable range.\n */\nexport const MAX_DATE_MS = 8_640_000_000_000_000\n\n/**\n * Participant ids that collide with Object.prototype plumbing.\n * Null-prototype construction already defuses them, but they are\n * rejected at both seams (`parsePushBody`, `setPresence`) so a hostile\n * id never propagates into userland maps either.\n */\nexport const RESERVED_PARTICIPANT_IDS: ReadonlySet<string> = new Set([\n '__proto__',\n 'constructor',\n 'prototype',\n])\n\nexport type DrainResult = {\n settled: boolean\n outcome: DrainOutcome\n /** Existing successor arm a scheduler callback may join before acking. */\n schedulerArm?: Promise<void>\n}\n\nexport type ServerInternals = {\n /**\n * Await every in-flight background drain this machine has scheduled,\n * including ones scheduled while waiting. Lets tests flush the\n * fire-and-forget inline path deterministically — no sleeps.\n */\n settle(): Promise<void>\n /** The public `server.drain()` result deliberately remains `{ settled }`. */\n schedulerDrain(\n sessionId: string,\n opts?: { watchdogDueAt?: number },\n ): Promise<DrainResult>\n /** Deliver a scheduler-owned delayed append through the normal root path. */\n schedulerAppend(\n sessionId: string,\n events: readonly ScheduledEvent[],\n originIndex?: number,\n ): Promise<void>\n /** Deliver a scheduler-owned conditional clear, deletion included. */\n schedulerClear(sessionId: string, ifLastIndex: number): Promise<void>\n /** `session.history` with clear markers kept; reads start at the latest one. */\n historyWithMarkers(sessionId: string, gte: number): Promise<Event[]>\n}\n\nexport const serverInternals: WeakMap<object, ServerInternals> = new WeakMap()\n\nconst objectLike = (value: unknown): value is object =>\n (typeof value === 'object' && value !== null) || typeof value === 'function'\n\n/** The ambient value delivered to `handlerContext` during a tool execution. */\nexport type AmbientToolScope = {\n /** Executing server identity; a test scope from `runWithHandlerContext` has none. */\n contract?: { readonly name: string }\n context: unknown\n}\n\n/**\n * Structural AsyncLocalStorage surface for the ambient tool scope. The\n * instance is created by the server-only AI entry point (the only place\n * `node:async_hooks` may be imported) and shared through a global\n * symbol slot, so `handlerContext` in the isomorphic AI entry point and\n * independently bundled A2 copies all read the same scope.\n */\nexport type AmbientToolScopeStorage = {\n getStore(): AmbientToolScope | undefined\n run<R>(store: AmbientToolScope, callback: () => R): R\n}\n\nconst TOOL_SCOPE_STORAGE = Symbol.for('experimental-a2.ai.tool-scope')\n\nexport function ambientToolScopeStorage(): AmbientToolScopeStorage | undefined {\n const value = Reflect.get(globalThis, TOOL_SCOPE_STORAGE)\n if (\n !objectLike(value) ||\n typeof Reflect.get(value, 'getStore') !== 'function' ||\n typeof Reflect.get(value, 'run') !== 'function'\n ) {\n return undefined\n }\n return value as AmbientToolScopeStorage\n}\n\nexport function installAmbientToolScopeStorage(\n create: () => AmbientToolScopeStorage,\n): AmbientToolScopeStorage {\n const existing = ambientToolScopeStorage()\n if (existing !== undefined) return existing\n const storage = create()\n Reflect.set(globalThis, TOOL_SCOPE_STORAGE, storage)\n return storage\n}\n\nexport type SchedulerSendFailureDisposition = 'retryable' | 'terminal'\n\ntype SchedulerSendFailureMarker = {\n readonly version: 1\n readonly pending: SchedulerSendFailureDisposition[]\n readonly active: SchedulerSendFailureDisposition[]\n}\n\nconst SCHEDULER_SEND_FAILURE = Symbol.for(\n 'experimental-a2.scheduler.send-failure',\n)\n\nconst schedulerSendFailureMarker = (\n value: unknown,\n): SchedulerSendFailureMarker | undefined => {\n if (!objectLike(value)) return undefined\n const marker = Reflect.get(value, SCHEDULER_SEND_FAILURE)\n if (\n !objectLike(marker) ||\n Reflect.get(marker, 'version') !== 1 ||\n !Array.isArray(Reflect.get(marker, 'pending')) ||\n !Array.isArray(Reflect.get(marker, 'active'))\n ) {\n return undefined\n }\n return marker as SchedulerSendFailureMarker\n}\n\nconst schedulerFailureObject = (error: unknown): object => {\n if (\n objectLike(error) &&\n (schedulerSendFailureMarker(error) !== undefined ||\n Object.isExtensible(error))\n ) {\n return error\n }\n return new Error(String(error), { cause: error })\n}\n\nconst schedulerSendFailureState = (\n error: object,\n): SchedulerSendFailureMarker => {\n const existing = schedulerSendFailureMarker(error)\n if (existing !== undefined) return existing\n const marker: SchedulerSendFailureMarker = {\n version: 1,\n pending: [],\n active: [],\n }\n Object.defineProperty(error, SCHEDULER_SEND_FAILURE, {\n value: marker,\n enumerable: false,\n configurable: true,\n writable: false,\n })\n return marker\n}\n\nconst clearSchedulerSendFailureState = (\n error: object,\n marker: SchedulerSendFailureMarker,\n): void => {\n if (marker.pending.length === 0 && marker.active.length === 0) {\n Reflect.deleteProperty(error, SCHEDULER_SEND_FAILURE)\n }\n}\n\n/**\n * Classify an adapter error before throwing it. Unclassified adapter failures\n * are retryable because the caller cannot know whether a remote send landed.\n */\nexport function classifySchedulerSendFailure(\n error: unknown,\n disposition: SchedulerSendFailureDisposition,\n): unknown {\n const classified = schedulerFailureObject(error)\n schedulerSendFailureState(classified).pending.push(disposition)\n return classified\n}\n\n/** Consume a pending adapter classification and count this rejected send. */\nexport function markSchedulerSendFailure(error: unknown): unknown {\n const marked = schedulerFailureObject(error)\n const marker = schedulerSendFailureState(marked)\n marker.active.push(marker.pending.pop() ?? 'retryable')\n return marked\n}\n\nexport function consumeSchedulerSendFailure(\n error: unknown,\n): SchedulerSendFailureDisposition | undefined {\n if (!objectLike(error)) return undefined\n const marker = schedulerSendFailureMarker(error)\n const disposition = marker?.active.pop()\n if (marker !== undefined) clearSchedulerSendFailureState(error, marker)\n return disposition\n}\n\nconst isDrainableServer = (value: unknown): value is DrainableServer => {\n if (value === null || typeof value !== 'object') return false\n const contract = Reflect.get(value, 'contract')\n return (\n contract !== null &&\n typeof contract === 'object' &&\n typeof Reflect.get(contract, 'name') === 'string' &&\n typeof Reflect.get(value, 'drain') === 'function'\n )\n}\n\n/**\n * Validate the server list captured by a scheduler route at construction time.\n * The seam stays structural so custom scheduler integrations can supply their\n * own drainable targets.\n */\nexport function assertSchedulerTargets(\n servers: readonly unknown[],\n): asserts servers is readonly DrainableServer[] {\n const contracts = new Set<string>()\n for (const target of servers) {\n if (!isDrainableServer(target)) {\n throw new TypeError('a2 scheduler: expected a server from createServer()')\n }\n const name = target.contract.name\n if (contracts.has(name)) {\n throw new TypeError(\n `a2 scheduler: duplicate server contract '${name}' in one handler`,\n )\n }\n contracts.add(name)\n }\n}\n\n/**\n * Drain timing knobs. Mutable only as a white-box test seam. Claim\n * heartbeats run on real timers, so tests shrink these to keep suites\n * fast. Production always uses the defaults.\n */\nexport const DRAIN_TIMINGS: {\n /** How long a claim lives without renewal. */\n claimTtlMs: number\n /** Heartbeat cadence while a handler is running. */\n claimHeartbeatMs: number\n /** Base delay before retrying a failed renewal while the lease lives. */\n renewRetryMs: number\n /** Delay between a claim's expiry and its scheduler watchdog. */\n watchdogGraceMs: number\n /** Maximum time a top-level append waits for its initial scheduler arm. */\n schedulerArmTimeoutMs: number\n} = {\n claimTtlMs: 5_000,\n claimHeartbeatMs: 2_000,\n renewRetryMs: 400,\n watchdogGraceMs: 1_000,\n schedulerArmTimeoutMs: 2_000,\n}\n\n/**\n * Stream liveness knobs — the server-side SSE heartbeat and the\n * client-side stall watchdog. Paired by design: the client declares a\n * connection dead after roughly two missed heartbeats. Mutable only as\n * a white-box test seam; production always uses the defaults.\n */\n/**\n * Poll cadence for the poll-based store streams (sqlite, postgres) —\n * owned, not configurable: adaptive polling removed the operator's\n * reason to tune it (the floor keeps active streams smooth; the\n * ceiling bounds idle cost). Mutable only as a white-box test seam so\n * suites don't wait out real idle gaps.\n */\nexport const POLL_TIMINGS: {\n /** Gap between polls while a session is producing events. */\n activeFloorMs: number\n /** The idle ceiling — the longest gap between polls. */\n idleCeilingMs: number\n} = {\n activeFloorMs: 25,\n idleCeilingMs: 2_000,\n}\n\n/**\n * Safety-read cadence for the notify-driven redis live stream. A\n * parked feed re-reads the store at this interval even without a\n * pub/sub wake-up, so a lost notification (subscriber reconnect gap,\n * dropped PUBLISH) costs latency, never an event. Mutable only as a\n * white-box test seam.\n */\nexport const NOTIFY_TIMINGS: {\n safetyReadMs: number\n} = {\n safetyReadMs: 10_000,\n}\n\n/**\n * Bounds for each server instance's in-memory reducer-state cache. Sizes are\n * encoded JSON lengths, re-measured every `measureEvery` folded events, so\n * the byte budget is approximate. Mutable only as a white-box test seam.\n */\nexport const STATE_CACHE: {\n maxEntries: number\n maxBytes: number\n /** Events a cached state may advance before it writes a snapshot. */\n snapshotEvery: number\n /** Events a warm read may fold; longer tails read the stored snapshot. */\n maxTail: number\n /** Events folded between re-measuring a cached state's encoded size. */\n measureEvery: number\n} = {\n maxEntries: 1_000,\n maxBytes: 32 * 1024 * 1024,\n snapshotEvery: 128,\n maxTail: 255,\n measureEvery: 16,\n}\n\n/**\n * Warm state-read tails for stores that can serve one in a single request:\n * events from `fromIndex` (inclusive) through `throughIndex` or the newest\n * event, or null when that needs more than one request. Like every store\n * read, a tail starts no lower than the latest clear marker. Keyed by the exact\n * store object, so a wrapper built by spreading or proxying a store reads\n * through its own `readHistory` instead.\n */\nexport const stateTailReaders: WeakMap<\n object,\n (\n sessionId: string,\n fromIndex: number,\n throughIndex?: number,\n ) => Promise<Event[] | null>\n> = new WeakMap()\n\nexport const STREAM_TIMINGS: {\n /** Cadence of `: ping` comment frames from `sseResponse`. */\n sseHeartbeatMs: number\n /** How far ahead of an invocation deadline an SSE response closes. */\n sseDeadlineGraceMs: number\n /** Client: silence longer than this means the connection is dead. */\n stallTimeoutMs: number\n /** Client reconnect backoff: first retry delay, doubling per attempt. */\n reconnectBaseMs: number\n /** Client reconnect backoff ceiling. */\n reconnectMaxMs: number\n} = {\n sseHeartbeatMs: 15_000,\n sseDeadlineGraceMs: 1_000,\n stallTimeoutMs: 35_000,\n reconnectBaseMs: 500,\n reconnectMaxMs: 5_000,\n}\n\n/**\n * WebSocket down-pump backpressure — `sessionsSocket` parks its pull\n * loop while the socket reports more buffered bytes than the\n * high-water mark and re-checks on the poll cadence, so a slow reader\n * applies backpressure to the store subscription instead of buffering\n * without bound in the socket. Acks and heartbeats stay exempt: they\n * are small and correctness-relevant. Mutable only as a white-box test\n * seam.\n */\nexport const SOCKET_TIMINGS: {\n highWaterMarkBytes: number\n resumePollMs: number\n /** Up-lane bound: concurrent push/presence handlers per socket. POST\n * gets per-request platform limits for free; the socket must bring\n * its own. Over the cap, pushes are answered with a retryable error\n * ack and presence frames are shed (that plane repaints). */\n maxInFlightMessages: number\n /** Hard ceiling on `bufferedAmount`: past it the peer is a\n * non-reader (acks and pings are park-exempt, so only a peer that\n * never reads can reach it) and the socket closes 1008. */\n disconnectWaterMarkBytes: number\n} = {\n highWaterMarkBytes: 1_048_576,\n resumePollMs: 25,\n maxInFlightMessages: 32,\n disconnectWaterMarkBytes: 8_388_608,\n}\n\n/**\n * Client presence send cadence — a leading send immediately, then at\n * most one merged send per interval (~15Hz). Owned, not configurable\n * (decision #36's rule): coupling the cadence to the POST ack tied\n * remote cursor smoothness to RTT, and the ack serves no correctness\n * purpose on a fire-and-forget LWW plane. Mutable only as a white-box\n * test seam.\n */\nexport const PRESENCE_TIMINGS: {\n sendIntervalMs: number\n} = {\n sendIntervalMs: 66,\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgB,kBAAuC;CACrD,OAAO,OAAO,OAAO,IAAI;AAC3B;;;;;;;AAQA,MAAa,cAAc;;;;;;;AAQ3B,MAAa,2CAAgD,IAAI,IAAI;CACnE;CACA;CACA;AACF,CAAC;AAiCD,MAAa,kCAAoD,IAAI,QAAQ;AAE7E,MAAM,cAAc,UACjB,OAAO,UAAU,YAAY,UAAU,QAAS,OAAO,UAAU;AAqBpE,MAAM,qBAAqB,OAAO,IAAI,+BAA+B;AAErE,SAAgB,0BAA+D;CAC7E,MAAM,QAAQ,QAAQ,IAAI,YAAY,kBAAkB;CACxD,IACE,CAAC,WAAW,KAAK,KACjB,OAAO,QAAQ,IAAI,OAAO,UAAU,MAAM,cAC1C,OAAO,QAAQ,IAAI,OAAO,KAAK,MAAM,YAErC;CAEF,OAAO;AACT;AAEA,SAAgB,+BACd,QACyB;CACzB,MAAM,WAAW,wBAAwB;CACzC,IAAI,aAAa,KAAA,GAAW,OAAO;CACnC,MAAM,UAAU,OAAO;CACvB,QAAQ,IAAI,YAAY,oBAAoB,OAAO;CACnD,OAAO;AACT;AAUA,MAAM,yBAAyB,OAAO,IACpC,wCACF;AAEA,MAAM,8BACJ,UAC2C;CAC3C,IAAI,CAAC,WAAW,KAAK,GAAG,OAAO,KAAA;CAC/B,MAAM,SAAS,QAAQ,IAAI,OAAO,sBAAsB;CACxD,IACE,CAAC,WAAW,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8WzRG.d.ts","names":[],"sources":["../src/session-socket.ts","../src/server-fetch.ts","../src/scheduler-task.ts","../src/server.ts"],"mappings":";;;;;;;;;;;;KA2CY;EACV,KAAK;EACL,GAAG,kBAAkB,WAAW;EAChC,GAAG,gBAAgB;EACnB,GAAG,gBAAgB,WAAW;EAC9B,MAAM,eAAe;;;EAGrB;;;;KCjBG,mBAAmB,UAAU,oBACzB,wBAAwB;KAE5B,wBAAwB,UAAU,gBAAgB,YAClD,WAAW,2BAA0B;KAG9B,YAAY,UAAU,YAAY;WACnC,MAAM,mBAAmB;WACzB;WACA;;KAGC,eAAe,UAAU,eAAe;WACzC;WACA,QAAQ,wBAAwB;WAChC;WACA;;KAGC,YACV,UAAU,YAAY,WACtB,UAAU,eAAe;WAGZ;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA;WACA;WACA;;WAGA;WACA;WACA,iBAAiB,YAAY;WAC7B,WAAW,eAAe;WAC1B;;KAGH,oBACV,SAAS,QAAQ,sBACd,WAAW,QAAQ;KAEZ,mBACV,UAAU,YAAY,WACtB,UAAU,eAAe;EAEzB,aAAa,WAAW,YAAY,GAAG,iBAAiB;EACxD,mBAAmB;;EAEnB;;;;;KC1FU;EACV;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA;;EAEA;;;KAIU;EACV;EACA;;EAEA;EACA;EACA;;EAEA;EACA,iBAAiB;;EAEjB;;;KAIU;EACV;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA;;;KAIU,gBACV,qBAAqB,sBAAsB;;;KCqBxC,YAAY,uBAAuB,YAEpC;EAAY,oBAAoB;IAC9B;;KAiCM,eACV,UAAU,WACV,gBAAgB,mBAAmB,YACnC,UAAU,eAAe,sBACzB;;EAGA,OAAO,cAAc,GAAG;;EAExB;;EAEA,SAAS,QAAQ,GAAG,cAAc,IAAI,GAAG;;EAEzC,QAAQ;;KAGE,QACV,UAAU,WACV,gBAAgB,mBAAmB,YACnC,UAAU,eAAe,sBACzB,cAEA,KAAK,eAA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