@agentshouse/mdruntime 0.1.0-cfbf80d8d4644 → 0.1.0-cfcf93be6310b
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/README.md +24 -11
- package/dist/adapter.d.ts +182 -47
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +53 -6
- package/dist/attempt.d.ts +16 -0
- package/dist/attempt.d.ts.map +1 -0
- package/dist/attempt.js +70 -0
- package/dist/binary.d.ts +18 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +33 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +202 -48
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -56
- package/dist/change.d.ts +45 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +34 -0
- package/dist/client.d.ts +38 -17
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +156 -20
- package/dist/collection.d.ts +13 -14
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +52 -56
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +789 -0
- package/dist/connection.d.ts +59 -20
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +4080 -879
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation.d.ts +51 -20
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +732 -242
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +4 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +152 -0
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -0
- package/dist/failure.d.ts +13 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +19 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/host.d.ts +11 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +128 -24
- package/dist/identity.d.ts +4 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +16 -1
- package/dist/index.d.ts +22 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +127 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +20 -7
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +253 -92
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +19 -4
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -2
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +22 -4
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +120 -14
- package/dist/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +72 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +81 -1
- package/dist/overlay.d.ts +15 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +136 -180
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/phrase.d.ts +3 -0
- package/dist/phrase.d.ts.map +1 -0
- package/dist/phrase.js +8 -0
- package/dist/query.d.ts +75 -5
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +119 -26
- package/dist/reach.d.ts +18 -4
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +234 -69
- package/dist/react.d.ts +32 -19
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +13 -21
- package/dist/readiness.d.ts +50 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +224 -0
- package/dist/refresh.d.ts +20 -7
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +167 -59
- package/dist/replica.d.ts +59 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +324 -157
- package/dist/room-draft.d.ts +59 -11
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +276 -80
- package/dist/rows.d.ts +40 -34
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +202 -80
- package/dist/save.d.ts +73 -4
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +825 -152
- package/dist/search.d.ts +15 -54
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -121
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +421 -0
- package/dist/status.d.ts +7 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -9
- package/dist/store.d.ts +118 -59
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +354 -344
- package/dist/stored.d.ts +162 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +549 -0
- package/dist/tables.d.ts +353 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +585 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +104 -0
- package/dist/windows.d.ts +22 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +89 -0
- package/dist/wire.d.ts +170 -33
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +69 -31
- package/package.json +26 -15
- package/AGENTS.md +0 -232
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
- package/dist/read-side.d.ts +0 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -377
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../src/readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC;AAEjF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ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AM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,SAAS,EACT,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAC1D,GAAG;IACF,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC;AAIF,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CA2B5D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const COMPLETE_ROOMS = new Set(['complete', 'unadmitted']);
|
|
2
|
+
export function readinessOf(facts) {
|
|
3
|
+
const { established, coverage: held, ...reported } = facts;
|
|
4
|
+
const settledConversations = held.conversations === 'complete' || held.conversations === 'undeclared';
|
|
5
|
+
const complete = held.listed &&
|
|
6
|
+
settledConversations &&
|
|
7
|
+
held.rooms.every((room) => COMPLETE_ROOMS.has(room.state));
|
|
8
|
+
const coverage = { ...held, complete };
|
|
9
|
+
const stored = facts.code === 'stored';
|
|
10
|
+
const ready = stored && complete;
|
|
11
|
+
const usable = stored && (ready || established);
|
|
12
|
+
const status = ready
|
|
13
|
+
? 'ready'
|
|
14
|
+
: facts.space !== null
|
|
15
|
+
? 'paused'
|
|
16
|
+
: facts.lost && !established
|
|
17
|
+
? 'lost'
|
|
18
|
+
: 'preparing';
|
|
19
|
+
return {
|
|
20
|
+
...reported,
|
|
21
|
+
coverage,
|
|
22
|
+
status,
|
|
23
|
+
ready,
|
|
24
|
+
usable,
|
|
25
|
+
durability: facts.persistence === 'granted' ? 'persistent' : 'best-effort',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type Attempted = 'done' | 'again' | {
|
|
2
|
+
readonly at: number;
|
|
3
|
+
};
|
|
4
|
+
export type Attempt = (signal: AbortSignal) => Promise<Attempted>;
|
|
5
|
+
export type AttemptOptions = {
|
|
6
|
+
readonly at?: number;
|
|
7
|
+
readonly again?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type RecoveryOptions = {
|
|
10
|
+
readonly firstMs?: number;
|
|
11
|
+
readonly maxMs?: number;
|
|
12
|
+
readonly attempts?: number;
|
|
13
|
+
readonly inFlight?: number;
|
|
14
|
+
};
|
|
15
|
+
export type Recovery = {
|
|
16
|
+
attempt(intent: string, run: Attempt, options?: AttemptOptions): Promise<boolean>;
|
|
17
|
+
pending(intent: string): boolean;
|
|
18
|
+
resume(): void;
|
|
19
|
+
cancel(intent: string): void;
|
|
20
|
+
scope(inFlight?: number): Recovery;
|
|
21
|
+
retire(): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
25
|
+
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
26
|
+
//# sourceMappingURL=recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../src/recovery.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,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,GAC5C,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAwKD,wBAAgB,cAAc,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAStE"}
|
package/dist/recovery.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// A first retry waits about a second, so a passing failure clears before the next attempt.
|
|
2
|
+
const FIRST_MS = 1_000;
|
|
3
|
+
// Waits stop doubling at half a minute, so work resumes soon after a long failure ends.
|
|
4
|
+
const MAX_MS = 30_000;
|
|
5
|
+
const ATTEMPTS = 8;
|
|
6
|
+
export function retryDelay(tries, firstMs = FIRST_MS, maxMs = MAX_MS) {
|
|
7
|
+
const longest = Math.min(maxMs, firstMs * 2 ** tries);
|
|
8
|
+
return longest / 2 + (Math.random() * longest) / 2;
|
|
9
|
+
}
|
|
10
|
+
export async function untilAnswered(ask, signal, answered = () => true) {
|
|
11
|
+
for (let tries = 0;; tries += 1) {
|
|
12
|
+
try {
|
|
13
|
+
const answer = await ask();
|
|
14
|
+
if (answered(answer) || signal.aborted)
|
|
15
|
+
return answer;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (signal.aborted)
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
await new Promise((resume) => {
|
|
22
|
+
const stop = () => {
|
|
23
|
+
clearTimeout(again);
|
|
24
|
+
resume();
|
|
25
|
+
};
|
|
26
|
+
// A read that failed is asked again on the doubling backoff, so its asker is answered once the failure clears.
|
|
27
|
+
const again = setTimeout(() => {
|
|
28
|
+
signal.removeEventListener('abort', stop);
|
|
29
|
+
resume();
|
|
30
|
+
}, retryDelay(tries));
|
|
31
|
+
signal.addEventListener('abort', stop, { once: true });
|
|
32
|
+
});
|
|
33
|
+
signal.throwIfAborted();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function owner(backoff, inFlight, release = () => { }) {
|
|
37
|
+
const intents = new Map();
|
|
38
|
+
const children = new Set();
|
|
39
|
+
const running = new Set();
|
|
40
|
+
const queued = [];
|
|
41
|
+
let free = inFlight;
|
|
42
|
+
let retired = false;
|
|
43
|
+
function finish(key, intent, done) {
|
|
44
|
+
if (intents.get(key) === intent)
|
|
45
|
+
intents.delete(key);
|
|
46
|
+
if (intent.timer !== null)
|
|
47
|
+
clearTimeout(intent.timer);
|
|
48
|
+
intent.timer = null;
|
|
49
|
+
intent.end(done);
|
|
50
|
+
}
|
|
51
|
+
function wait(key, intent, at, guided) {
|
|
52
|
+
if (intent.timer !== null)
|
|
53
|
+
clearTimeout(intent.timer);
|
|
54
|
+
intent.due = at;
|
|
55
|
+
intent.guided = guided;
|
|
56
|
+
intent.timer = setTimeout(() => {
|
|
57
|
+
intent.timer = null;
|
|
58
|
+
launch(key, intent);
|
|
59
|
+
}, Math.max(0, at - Date.now()));
|
|
60
|
+
}
|
|
61
|
+
function launch(key, intent) {
|
|
62
|
+
intent.due = null;
|
|
63
|
+
intent.guided = false;
|
|
64
|
+
const controller = new AbortController();
|
|
65
|
+
intent.controller = controller;
|
|
66
|
+
const run = start(key, intent, controller);
|
|
67
|
+
running.add(run);
|
|
68
|
+
void run.finally(() => running.delete(run));
|
|
69
|
+
}
|
|
70
|
+
async function start(key, intent, controller) {
|
|
71
|
+
while (free === 0)
|
|
72
|
+
await new Promise((admit) => queued.push(admit));
|
|
73
|
+
if (controller.signal.aborted) {
|
|
74
|
+
queued.shift()?.();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
free -= 1;
|
|
78
|
+
const abandoned = new Promise((resolve) => {
|
|
79
|
+
controller.signal.addEventListener('abort', () => resolve(null), { once: true });
|
|
80
|
+
});
|
|
81
|
+
let result;
|
|
82
|
+
try {
|
|
83
|
+
result = await Promise.race([intent.run(controller.signal), abandoned]);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
result = 'again';
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
free += 1;
|
|
90
|
+
queued.shift()?.();
|
|
91
|
+
}
|
|
92
|
+
if (result === null || controller.signal.aborted || intents.get(key) !== intent)
|
|
93
|
+
return;
|
|
94
|
+
intent.controller = null;
|
|
95
|
+
const again = intent.again;
|
|
96
|
+
intent.again = null;
|
|
97
|
+
if (result === 'done') {
|
|
98
|
+
intent.tries = 0;
|
|
99
|
+
if (again === null)
|
|
100
|
+
finish(key, intent, true);
|
|
101
|
+
else if (again === 'now')
|
|
102
|
+
launch(key, intent);
|
|
103
|
+
else
|
|
104
|
+
wait(key, intent, again, true);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
intent.tries += 1;
|
|
108
|
+
if (intent.tries >= backoff.attempts) {
|
|
109
|
+
finish(key, intent, false);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (result === 'again') {
|
|
113
|
+
// The next attempt waits the doubling backoff, up to its maximum.
|
|
114
|
+
const delay = retryDelay(intent.tries - 1, backoff.firstMs, backoff.maxMs);
|
|
115
|
+
wait(key, intent, Date.now() + delay, false);
|
|
116
|
+
}
|
|
117
|
+
else
|
|
118
|
+
wait(key, intent, result.at, true);
|
|
119
|
+
}
|
|
120
|
+
const recovery = {
|
|
121
|
+
attempt(key, run, options = {}) {
|
|
122
|
+
if (retired)
|
|
123
|
+
return Promise.resolve(false);
|
|
124
|
+
const held = intents.get(key);
|
|
125
|
+
if (held !== undefined) {
|
|
126
|
+
held.run = run;
|
|
127
|
+
if (held.controller !== null) {
|
|
128
|
+
const at = options.at;
|
|
129
|
+
held.again =
|
|
130
|
+
at === undefined || held.again === 'now'
|
|
131
|
+
? 'now'
|
|
132
|
+
: Math.min(at, held.again ?? Number.POSITIVE_INFINITY);
|
|
133
|
+
}
|
|
134
|
+
else if (held.due !== null && held.due <= Date.now()) {
|
|
135
|
+
if (held.timer !== null)
|
|
136
|
+
clearTimeout(held.timer);
|
|
137
|
+
held.timer = null;
|
|
138
|
+
launch(key, held);
|
|
139
|
+
}
|
|
140
|
+
else if (options.at !== undefined && (held.due === null || options.at < held.due)) {
|
|
141
|
+
wait(key, held, options.at, true);
|
|
142
|
+
}
|
|
143
|
+
return held.ended;
|
|
144
|
+
}
|
|
145
|
+
let end = () => { };
|
|
146
|
+
const ended = new Promise((resolve) => {
|
|
147
|
+
end = resolve;
|
|
148
|
+
});
|
|
149
|
+
const intent = {
|
|
150
|
+
run,
|
|
151
|
+
tries: 0,
|
|
152
|
+
timer: null,
|
|
153
|
+
due: null,
|
|
154
|
+
guided: false,
|
|
155
|
+
controller: null,
|
|
156
|
+
again: null,
|
|
157
|
+
ended,
|
|
158
|
+
end,
|
|
159
|
+
};
|
|
160
|
+
intents.set(key, intent);
|
|
161
|
+
if (options.at !== undefined)
|
|
162
|
+
wait(key, intent, options.at, true);
|
|
163
|
+
else if (options.again === true) {
|
|
164
|
+
intent.tries = 1;
|
|
165
|
+
wait(key, intent, Date.now() + retryDelay(0, backoff.firstMs, backoff.maxMs), false);
|
|
166
|
+
}
|
|
167
|
+
else
|
|
168
|
+
launch(key, intent);
|
|
169
|
+
return ended;
|
|
170
|
+
},
|
|
171
|
+
pending(key) {
|
|
172
|
+
const intent = intents.get(key);
|
|
173
|
+
return intent !== undefined && intent.controller === null;
|
|
174
|
+
},
|
|
175
|
+
resume() {
|
|
176
|
+
if (retired)
|
|
177
|
+
return;
|
|
178
|
+
for (const [key, intent] of [...intents]) {
|
|
179
|
+
if (intent.guided && intent.due !== null && intent.due > Date.now())
|
|
180
|
+
continue;
|
|
181
|
+
if (intent.timer !== null)
|
|
182
|
+
clearTimeout(intent.timer);
|
|
183
|
+
intent.timer = null;
|
|
184
|
+
intent.controller?.abort();
|
|
185
|
+
intent.again = null;
|
|
186
|
+
intent.tries = 0;
|
|
187
|
+
launch(key, intent);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
cancel(key) {
|
|
191
|
+
const intent = intents.get(key);
|
|
192
|
+
if (intent === undefined)
|
|
193
|
+
return;
|
|
194
|
+
intent.controller?.abort();
|
|
195
|
+
finish(key, intent, false);
|
|
196
|
+
},
|
|
197
|
+
scope(bound = Infinity) {
|
|
198
|
+
const child = owner(backoff, bound, () => children.delete(child));
|
|
199
|
+
if (retired)
|
|
200
|
+
void child.retire();
|
|
201
|
+
else
|
|
202
|
+
children.add(child);
|
|
203
|
+
return child;
|
|
204
|
+
},
|
|
205
|
+
async retire() {
|
|
206
|
+
retired = true;
|
|
207
|
+
release();
|
|
208
|
+
for (const [key, intent] of [...intents]) {
|
|
209
|
+
intent.controller?.abort();
|
|
210
|
+
finish(key, intent, false);
|
|
211
|
+
}
|
|
212
|
+
await Promise.all([...children].map((child) => child.retire()));
|
|
213
|
+
await Promise.all(running);
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
return recovery;
|
|
217
|
+
}
|
|
218
|
+
export function createRecovery(options = {}) {
|
|
219
|
+
return owner({
|
|
220
|
+
firstMs: options.firstMs ?? FIRST_MS,
|
|
221
|
+
maxMs: options.maxMs ?? MAX_MS,
|
|
222
|
+
attempts: options.attempts ?? ATTEMPTS,
|
|
223
|
+
}, options.inFlight ?? Infinity);
|
|
224
|
+
}
|
package/dist/refresh.d.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdapterFailure, Authorization, RefreshPage, RefreshRequest, RefreshResult, RetryableRefusal } from './adapter.js';
|
|
2
2
|
import type { Remodel } from './bootstrap.js';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
3
|
+
import type { ReplicaRecord } from './replica.js';
|
|
4
|
+
import type { RefreshedPage } from './store.js';
|
|
5
|
+
import type { HeldEntry, StoredEntry } from './tables.js';
|
|
6
|
+
import { type Unconfirmed } from './transfer.js';
|
|
7
|
+
export type Advancement = {
|
|
6
8
|
kind: 'still-current';
|
|
7
9
|
} | {
|
|
8
10
|
kind: 'advanced';
|
|
9
|
-
|
|
11
|
+
record: ReplicaRecord;
|
|
12
|
+
changed: ReadonlySet<string>;
|
|
10
13
|
} | {
|
|
11
14
|
kind: 'beyond-horizon';
|
|
12
|
-
} | RetryableRefusal | Unconfirmed |
|
|
13
|
-
export
|
|
15
|
+
} | RetryableRefusal | Unconfirmed | AdapterFailure;
|
|
16
|
+
export type Refresher = (authorization: Authorization, request: RefreshRequest) => Promise<RefreshResult>;
|
|
17
|
+
export type Refreshing = {
|
|
18
|
+
turn(): void;
|
|
19
|
+
prior(paths: readonly string[]): Promise<ReadonlyMap<string, HeldEntry>>;
|
|
20
|
+
later(paths: readonly string[], roomVersion: string): Promise<ReadonlySet<string>>;
|
|
21
|
+
stage(page: RefreshedPage): Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
type PageContent = Pick<RefreshPage, 'documents' | 'outlines' | 'revisions' | 'fileIds' | 'changes' | 'binaryFiles'>;
|
|
24
|
+
export declare function pageEntries(page: PageContent, removals: readonly string[], roomVersion: string, prior: (paths: readonly string[]) => Promise<ReadonlyMap<string, HeldEntry>>): Promise<StoredEntry[]>;
|
|
25
|
+
export declare function advancement(refresh: Refresher, authorization: Authorization, held: ReplicaRecord, remodel: Remodel, continuing: () => boolean, staging: Refreshing): Promise<Advancement>;
|
|
26
|
+
export {};
|
|
14
27
|
//# sourceMappingURL=refresh.d.ts.map
|
package/dist/refresh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../src/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../src/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,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,EAAE,SAAS,CAAC,CAAC,GAC3E,OAAO,CAAC,WAAW,EAAE,CAAC,CAKxB;AAgDD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,OAAO,EACzB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,WAAW,CAAC,CA8CtB"}
|
package/dist/refresh.js
CHANGED
|
@@ -1,61 +1,172 @@
|
|
|
1
|
-
import { declaredAttachments } from './attachment.js';
|
|
2
|
-
import { readStaged } from './replica.js';
|
|
3
1
|
import { unconfirmed } from './transfer.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
2
|
+
import { ROW_WEIGHT, stepped, yielded } from './turn.js';
|
|
3
|
+
function* listing(page, removals) {
|
|
4
|
+
const removed = new Set();
|
|
5
|
+
for (const path of removals) {
|
|
6
|
+
removed.add(path);
|
|
7
|
+
yield ROW_WEIGHT;
|
|
8
|
+
}
|
|
9
|
+
const documents = [];
|
|
10
|
+
const outlined = [];
|
|
11
|
+
const binaries = [];
|
|
12
|
+
const asked = [];
|
|
13
|
+
const written = new Set();
|
|
14
|
+
for (const [kept, named] of [
|
|
15
|
+
[documents, page.documents],
|
|
16
|
+
[outlined, page.outlines ?? {}],
|
|
17
|
+
[binaries, page.binaryFiles],
|
|
18
|
+
]) {
|
|
19
|
+
for (const path of Object.keys(named)) {
|
|
20
|
+
yield ROW_WEIGHT;
|
|
21
|
+
if (removed.has(path))
|
|
22
|
+
continue;
|
|
23
|
+
kept.push(path);
|
|
24
|
+
written.add(path);
|
|
25
|
+
if (page.revisions[path] === undefined)
|
|
26
|
+
asked.push(path);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const others = [];
|
|
30
|
+
const seen = new Set();
|
|
31
|
+
for (const named of [page.revisions, page.fileIds ?? {}, page.changes]) {
|
|
32
|
+
for (const path of Object.keys(named)) {
|
|
33
|
+
yield ROW_WEIGHT;
|
|
34
|
+
if (seen.has(path))
|
|
35
|
+
continue;
|
|
36
|
+
seen.add(path);
|
|
37
|
+
if (!written.has(path) && !removed.has(path))
|
|
38
|
+
others.push(path);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { documents, outlined, binaries, others, asked: [...asked, ...others] };
|
|
42
|
+
}
|
|
43
|
+
function* entering(page, roomVersion, listed, prior) {
|
|
44
|
+
const entries = [];
|
|
45
|
+
for (const path of listed.documents) {
|
|
46
|
+
yield ROW_WEIGHT;
|
|
47
|
+
entries.push({
|
|
48
|
+
path,
|
|
49
|
+
content: page.documents[path],
|
|
50
|
+
outline: null,
|
|
51
|
+
binary: null,
|
|
52
|
+
revision: page.revisions[path] ?? prior.get(path)?.revision ?? null,
|
|
53
|
+
fileId: page.fileIds?.[path] ?? null,
|
|
54
|
+
change: page.changes[path] ?? null,
|
|
55
|
+
written: roomVersion,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
for (const path of listed.outlined) {
|
|
59
|
+
yield ROW_WEIGHT;
|
|
60
|
+
entries.push({
|
|
61
|
+
path,
|
|
62
|
+
content: null,
|
|
63
|
+
outline: page.outlines[path],
|
|
64
|
+
binary: null,
|
|
65
|
+
revision: page.revisions[path] ?? prior.get(path)?.revision ?? null,
|
|
66
|
+
fileId: page.fileIds?.[path] ?? null,
|
|
67
|
+
change: page.changes[path] ?? null,
|
|
68
|
+
written: roomVersion,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
for (const path of listed.binaries) {
|
|
72
|
+
yield ROW_WEIGHT;
|
|
73
|
+
entries.push({
|
|
74
|
+
path,
|
|
75
|
+
content: null,
|
|
76
|
+
outline: null,
|
|
77
|
+
binary: { state: 'accepted', ...page.binaryFiles[path] },
|
|
78
|
+
revision: page.revisions[path] ?? prior.get(path)?.revision ?? null,
|
|
79
|
+
fileId: page.fileIds?.[path] ?? null,
|
|
80
|
+
change: page.changes[path] ?? null,
|
|
81
|
+
written: null,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
for (const path of listed.others) {
|
|
85
|
+
yield ROW_WEIGHT;
|
|
86
|
+
const held = prior.get(path);
|
|
87
|
+
if (held === undefined)
|
|
88
|
+
continue;
|
|
89
|
+
const { type: _type, ...kept } = held;
|
|
90
|
+
entries.push({
|
|
91
|
+
...kept,
|
|
92
|
+
revision: page.revisions[path] ?? held.revision,
|
|
93
|
+
fileId: page.fileIds?.[path] ?? held.fileId,
|
|
94
|
+
change: page.changes[path] ?? held.change,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return entries;
|
|
98
|
+
}
|
|
99
|
+
export async function pageEntries(page, removals, roomVersion, prior) {
|
|
100
|
+
await yielded();
|
|
101
|
+
const listed = await stepped(listing(page, removals));
|
|
102
|
+
const held = listed.asked.length === 0 ? new Map() : await prior(listed.asked);
|
|
103
|
+
return stepped(entering(page, roomVersion, listed, held));
|
|
104
|
+
}
|
|
105
|
+
function without(named, kept) {
|
|
106
|
+
return Object.fromEntries(Object.entries(named).filter(([path]) => !kept.has(path)));
|
|
107
|
+
}
|
|
108
|
+
function unwritten(page, kept) {
|
|
109
|
+
if (kept.size === 0)
|
|
110
|
+
return page;
|
|
111
|
+
return {
|
|
112
|
+
...page,
|
|
113
|
+
documents: without(page.documents, kept),
|
|
114
|
+
...(page.outlines === undefined ? {} : { outlines: without(page.outlines, kept) }),
|
|
115
|
+
revisions: without(page.revisions, kept),
|
|
116
|
+
...(page.fileIds === undefined ? {} : { fileIds: without(page.fileIds, kept) }),
|
|
117
|
+
changes: without(page.changes, kept),
|
|
118
|
+
binaryFiles: without(page.binaryFiles, kept),
|
|
119
|
+
removals: page.removals.filter((path) => !kept.has(path)),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function pageOf(answered, roomVersion, staging) {
|
|
123
|
+
const page = unwritten(answered, await staging.later([
|
|
124
|
+
...Object.keys(answered.documents),
|
|
125
|
+
...Object.keys(answered.outlines ?? {}),
|
|
126
|
+
...Object.keys(answered.binaryFiles),
|
|
127
|
+
...answered.removals,
|
|
128
|
+
], roomVersion));
|
|
129
|
+
return {
|
|
130
|
+
entries: await pageEntries(page, page.removals, roomVersion, (paths) => staging.prior(paths)),
|
|
131
|
+
removals: page.removals,
|
|
132
|
+
folders: page.folders ?? [],
|
|
133
|
+
folderRemovals: page.folderRemovals ?? [],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export async function advancement(refresh, authorization, held, remodel, continuing, staging) {
|
|
137
|
+
const locator = held.locator;
|
|
138
|
+
const fromRoomVersion = held.roomVersion;
|
|
139
|
+
staging.turn();
|
|
140
|
+
if (!continuing())
|
|
141
|
+
return unconfirmed;
|
|
142
|
+
const first = await refresh(authorization, {
|
|
8
143
|
locator,
|
|
9
|
-
selection:
|
|
144
|
+
selection: held.replica.selection,
|
|
10
145
|
fromRoomVersion,
|
|
11
146
|
});
|
|
12
147
|
if (first.kind !== 'net-advancement')
|
|
13
148
|
return first;
|
|
14
149
|
const roomVersion = first.roomVersion;
|
|
15
|
-
const models = remodel(first.models, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const attachments = [];
|
|
25
|
-
const stage = (page) => {
|
|
26
|
-
if (page.attachments !== undefined)
|
|
27
|
-
attachments.push(page.attachments);
|
|
28
|
-
Object.assign(documents, page.documents);
|
|
29
|
-
Object.assign(revisions, page.revisions);
|
|
30
|
-
for (const path of Object.keys(page.documents)) {
|
|
31
|
-
binaryTargets.delete(path);
|
|
32
|
-
delete changes[path];
|
|
33
|
-
written[path] = roomVersion;
|
|
34
|
-
}
|
|
35
|
-
for (const target of page.binaryTargets) {
|
|
36
|
-
delete documents[target];
|
|
37
|
-
delete revisions[target];
|
|
38
|
-
delete changes[target];
|
|
39
|
-
delete written[target];
|
|
40
|
-
binaryTargets.add(target);
|
|
41
|
-
}
|
|
42
|
-
Object.assign(changes, page.changes);
|
|
43
|
-
for (const path of page.removals) {
|
|
44
|
-
delete documents[path];
|
|
45
|
-
delete revisions[path];
|
|
46
|
-
delete changes[path];
|
|
47
|
-
delete written[path];
|
|
48
|
-
binaryTargets.delete(path);
|
|
49
|
-
}
|
|
150
|
+
const models = remodel(first.models, { collection: held.model });
|
|
151
|
+
const changed = new Set();
|
|
152
|
+
const staged = async (page) => {
|
|
153
|
+
const read = await pageOf(page, roomVersion, staging);
|
|
154
|
+
for (const { path } of read.entries)
|
|
155
|
+
changed.add(path);
|
|
156
|
+
for (const path of read.removals)
|
|
157
|
+
changed.add(path);
|
|
158
|
+
return staging.stage(read);
|
|
50
159
|
};
|
|
51
|
-
|
|
160
|
+
if (!(await staged(first)))
|
|
161
|
+
return unconfirmed;
|
|
52
162
|
let pageToken = first.pageToken;
|
|
53
163
|
while (pageToken !== undefined) {
|
|
164
|
+
await staging.turn();
|
|
54
165
|
if (!continuing())
|
|
55
166
|
return unconfirmed;
|
|
56
|
-
const page = await
|
|
167
|
+
const page = await refresh(authorization, {
|
|
57
168
|
locator,
|
|
58
|
-
selection:
|
|
169
|
+
selection: held.replica.selection,
|
|
59
170
|
fromRoomVersion,
|
|
60
171
|
pageToken,
|
|
61
172
|
});
|
|
@@ -65,20 +176,17 @@ export async function refreshRoom(adapter, authorization, confirmed, remodel, co
|
|
|
65
176
|
return page;
|
|
66
177
|
if (page.roomVersion !== roomVersion)
|
|
67
178
|
return unconfirmed;
|
|
68
|
-
|
|
179
|
+
if (!(await staged(page)))
|
|
180
|
+
return unconfirmed;
|
|
69
181
|
pageToken = page.pageToken;
|
|
70
182
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
written,
|
|
81
|
-
attachments: attachments.length === 0 ? confirmed.record.attachments : declaredAttachments(attachments),
|
|
82
|
-
}, confirmed);
|
|
83
|
-
return staged.kind === 'staged' ? { kind: 'advanced', confirmed: staged.confirmed } : staged;
|
|
183
|
+
return {
|
|
184
|
+
kind: 'advanced',
|
|
185
|
+
record: {
|
|
186
|
+
...held,
|
|
187
|
+
model: models.collection,
|
|
188
|
+
roomVersion,
|
|
189
|
+
},
|
|
190
|
+
changed,
|
|
191
|
+
};
|
|
84
192
|
}
|