@agentshouse/mdruntime 0.1.0-c8f07dbee1c62 → 0.1.0-c8f16d1da438a
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 +21 -19
- package/dist/acceptance.d.ts +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +75 -165
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +171 -75
- package/dist/adapter.d.ts +147 -67
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -7
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +347 -0
- package/dist/binary.d.ts +6 -2
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +10 -3
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -18
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +6 -2
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +7 -2
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +2 -4
- package/dist/client.d.ts +23 -22
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +55 -68
- package/dist/collection.d.ts +27 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +34 -10
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts +4 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +100 -62
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +41 -27
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +149 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +259 -0
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +64 -49
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +987 -1035
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +47 -47
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +5 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +16 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +75 -30
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +8 -0
- package/dist/figures.d.ts +1 -0
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +6 -4
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +24 -4
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +108 -32
- package/dist/house-query.d.ts +24 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +82 -0
- package/dist/index.d.ts +24 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/install.d.ts +10 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +93 -116
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +79 -56
- package/dist/listing.d.ts +29 -22
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +71 -78
- package/dist/live.d.ts +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +97 -39
- package/dist/loaded.d.ts +7 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +46 -0
- package/dist/locks.d.ts +2 -4
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +12 -39
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +11 -23
- package/dist/media.d.ts +20 -4
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +170 -36
- package/dist/memory.d.ts +10 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +99 -37
- package/dist/messages.d.ts +17 -6
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +39 -38
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +4 -3
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +97 -137
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +217 -85
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +24 -11
- package/dist/outcome.d.ts +24 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +33 -3
- package/dist/overlay.d.ts +9 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +37 -24
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +5 -58
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +28 -110
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +22 -0
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +210 -92
- package/dist/presence.d.ts +58 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +231 -0
- package/dist/queries.d.ts +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +137 -79
- package/dist/query.d.ts +2 -3
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -8
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +480 -0
- package/dist/reach.d.ts +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +184 -40
- package/dist/react.d.ts +11 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -1
- package/dist/readiness.d.ts +20 -5
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +17 -10
- package/dist/reads.d.ts +5 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +33 -5
- package/dist/recovery.d.ts +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +31 -8
- package/dist/reference-forms.d.ts +4 -0
- package/dist/reference-forms.d.ts.map +1 -0
- package/dist/reference-forms.js +74 -0
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +6 -6
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +5 -6
- package/dist/replica.d.ts +5 -10
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +17 -19
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +31 -8
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +278 -68
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +28 -22
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +11 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +27 -14
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +15 -20
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +43 -86
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +324 -223
- package/dist/saves.d.ts +6 -42
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +177 -718
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +4 -5
- package/dist/shared.d.ts +0 -5
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +4 -90
- package/dist/shown.d.ts +9 -5
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +99 -67
- package/dist/socket/lanes.d.ts +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- package/dist/socket/session.d.ts +4 -2
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +4 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +6 -16
- package/dist/source.d.ts +7 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +20 -6
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +26 -9
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +92 -26
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store/space.d.ts +1 -1
- package/dist/store/space.d.ts.map +1 -1
- package/dist/store/space.js +0 -2
- package/dist/store/watchers.js +1 -2
- package/dist/store.d.ts +26 -16
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +50 -18
- package/dist/stored.d.ts +40 -15
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +236 -66
- package/dist/surface.d.ts +15 -9
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +71 -38
- package/dist/sync.d.ts +4 -3
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +136 -110
- package/dist/tables.d.ts +31 -58
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +100 -334
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +6 -7
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +51 -11
- package/dist/wire.d.ts +71 -12
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +30 -14
- package/package.json +4 -3
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/job.d.ts +0 -33
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -54
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/socket/rooms.d.ts +0 -43
- package/dist/socket/rooms.d.ts.map +0 -1
- package/dist/socket/rooms.js +0 -90
- package/dist/store/fences.d.ts +0 -16
- package/dist/store/fences.d.ts.map +0 -1
- package/dist/store/fences.js +0 -26
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { expectedList } from './expectation.js';
|
|
2
|
+
import { changeBatchIdentity } from './identity.js';
|
|
3
|
+
const IDLE = { busy: false, drawn: false, ended: null };
|
|
4
|
+
export function acting(rules) {
|
|
5
|
+
const { store, uncertain, ending, settles } = rules;
|
|
6
|
+
const mint = rules.mint ?? (() => changeBatchIdentity());
|
|
7
|
+
const identities = new Map();
|
|
8
|
+
const waiting = new Map();
|
|
9
|
+
const settling = new Map();
|
|
10
|
+
const blobs = new WeakMap();
|
|
11
|
+
let counted = 0;
|
|
12
|
+
let touches = 0;
|
|
13
|
+
const requestOf = (name, input) => {
|
|
14
|
+
const carried = [];
|
|
15
|
+
const json = JSON.stringify(input, (_key, value) => {
|
|
16
|
+
if (!(value instanceof Blob))
|
|
17
|
+
return value;
|
|
18
|
+
let one = blobs.get(value);
|
|
19
|
+
if (one === undefined) {
|
|
20
|
+
counted += 1;
|
|
21
|
+
one = counted;
|
|
22
|
+
blobs.set(value, one);
|
|
23
|
+
}
|
|
24
|
+
carried.push(one);
|
|
25
|
+
return null;
|
|
26
|
+
});
|
|
27
|
+
return `${name}\u0000${json}\u0000${carried.join(',')}`;
|
|
28
|
+
};
|
|
29
|
+
const identityOf = (request) => {
|
|
30
|
+
const held = identities.get(request);
|
|
31
|
+
if (held !== undefined)
|
|
32
|
+
return held;
|
|
33
|
+
const fresh = { operation: mint(), touched: 0, flying: 0 };
|
|
34
|
+
identities.set(request, fresh);
|
|
35
|
+
return fresh;
|
|
36
|
+
};
|
|
37
|
+
const settled = (act, ended, calls) => {
|
|
38
|
+
const released = new Map();
|
|
39
|
+
for (const { request, identity, ended: answered } of calls) {
|
|
40
|
+
const heard = answered === 'accepted' || answered === 'refused';
|
|
41
|
+
if (ended === 'accepted' && heard)
|
|
42
|
+
released.set(request, identity.touched);
|
|
43
|
+
else {
|
|
44
|
+
touches += 1;
|
|
45
|
+
identity.touched = touches;
|
|
46
|
+
identities.set(request, identity);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (ended === 'refused' || ended === 'unsent')
|
|
50
|
+
store.drop(act);
|
|
51
|
+
for (const { request, ended: answered } of calls) {
|
|
52
|
+
const earlier = waiting.get(request);
|
|
53
|
+
if (answered === 'unsent' && earlier !== undefined)
|
|
54
|
+
continue;
|
|
55
|
+
if (earlier !== undefined && earlier !== act)
|
|
56
|
+
store.drop(earlier);
|
|
57
|
+
if (ended === 'unanswered')
|
|
58
|
+
waiting.set(request, act);
|
|
59
|
+
else
|
|
60
|
+
waiting.delete(request);
|
|
61
|
+
}
|
|
62
|
+
if (ended === 'accepted' || calls.some((one) => one.ended === 'accepted'))
|
|
63
|
+
rules.acted?.();
|
|
64
|
+
return released;
|
|
65
|
+
};
|
|
66
|
+
const release = (released) => {
|
|
67
|
+
for (const [request, touched] of released) {
|
|
68
|
+
const held = identities.get(request);
|
|
69
|
+
if (held !== undefined && held.touched === touched && held.flying === 0) {
|
|
70
|
+
identities.delete(request);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
open() {
|
|
76
|
+
const listeners = new Set();
|
|
77
|
+
const releasing = new Map();
|
|
78
|
+
let tail = Promise.resolve();
|
|
79
|
+
let pressed = 0;
|
|
80
|
+
let drawing = 0;
|
|
81
|
+
let ended = null;
|
|
82
|
+
let held = null;
|
|
83
|
+
let presses = 0;
|
|
84
|
+
let shown = IDLE;
|
|
85
|
+
const show = () => {
|
|
86
|
+
const busy = pressed > 0;
|
|
87
|
+
const drawn = drawing > 0;
|
|
88
|
+
if (shown.busy === busy && shown.drawn === drawn && shown.ended === ended)
|
|
89
|
+
return;
|
|
90
|
+
shown = { busy, drawn, ended };
|
|
91
|
+
for (const listener of listeners)
|
|
92
|
+
listener();
|
|
93
|
+
};
|
|
94
|
+
const awaiting = (outcome, operations, heard, again) => new Promise((resolve) => {
|
|
95
|
+
const forgotten = () => {
|
|
96
|
+
for (const operation of operations)
|
|
97
|
+
if (settling.get(operation) === record)
|
|
98
|
+
settling.delete(operation);
|
|
99
|
+
};
|
|
100
|
+
const record = {
|
|
101
|
+
supersede() {
|
|
102
|
+
if (held !== record)
|
|
103
|
+
return;
|
|
104
|
+
held = null;
|
|
105
|
+
forgotten();
|
|
106
|
+
resolve(outcome);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
held = record;
|
|
110
|
+
for (const operation of operations)
|
|
111
|
+
settling.set(operation, record);
|
|
112
|
+
const answers = operations.map((operation) => heard(operation).then((answered) => {
|
|
113
|
+
if (!answered)
|
|
114
|
+
record.supersede();
|
|
115
|
+
return answered;
|
|
116
|
+
}));
|
|
117
|
+
void Promise.all(answers).then(() => {
|
|
118
|
+
if (held !== record)
|
|
119
|
+
return;
|
|
120
|
+
held = null;
|
|
121
|
+
forgotten();
|
|
122
|
+
resolve(again());
|
|
123
|
+
}, () => record.supersede());
|
|
124
|
+
});
|
|
125
|
+
const attempt = (steps, expected, press) => {
|
|
126
|
+
const act = store.begin();
|
|
127
|
+
let drew = false;
|
|
128
|
+
const expect = (more) => {
|
|
129
|
+
if (expectedList(more).length === 0)
|
|
130
|
+
return;
|
|
131
|
+
store.expect(act, more);
|
|
132
|
+
if (drew)
|
|
133
|
+
return;
|
|
134
|
+
drew = true;
|
|
135
|
+
drawing += 1;
|
|
136
|
+
show();
|
|
137
|
+
};
|
|
138
|
+
pressed += 1;
|
|
139
|
+
expect(expected);
|
|
140
|
+
show();
|
|
141
|
+
const calls = [];
|
|
142
|
+
const send = Object.assign(async (name, input, sending) => {
|
|
143
|
+
const request = requestOf(name, input);
|
|
144
|
+
const identity = identityOf(request);
|
|
145
|
+
settling.get(identity.operation)?.supersede();
|
|
146
|
+
const called = { request, identity, ended: null };
|
|
147
|
+
calls.push(called);
|
|
148
|
+
touches += 1;
|
|
149
|
+
identity.touched = touches;
|
|
150
|
+
identity.flying += 1;
|
|
151
|
+
let outcome;
|
|
152
|
+
try {
|
|
153
|
+
outcome = await sending(identity.operation);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
outcome = uncertain;
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
identity.flying -= 1;
|
|
160
|
+
}
|
|
161
|
+
called.ended = ending(outcome);
|
|
162
|
+
return outcome;
|
|
163
|
+
}, { expect });
|
|
164
|
+
const end = (outcome, how) => {
|
|
165
|
+
for (const [request, touched] of settled(act, how, calls))
|
|
166
|
+
releasing.set(request, touched);
|
|
167
|
+
pressed -= 1;
|
|
168
|
+
if (drew)
|
|
169
|
+
drawing -= 1;
|
|
170
|
+
ended = outcome;
|
|
171
|
+
if (pressed === 0) {
|
|
172
|
+
release(releasing);
|
|
173
|
+
releasing.clear();
|
|
174
|
+
}
|
|
175
|
+
show();
|
|
176
|
+
};
|
|
177
|
+
const turn = tail.then(async () => {
|
|
178
|
+
ended = null;
|
|
179
|
+
show();
|
|
180
|
+
let outcome;
|
|
181
|
+
try {
|
|
182
|
+
outcome = await steps(send);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
end(uncertain, 'unanswered');
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
const how = ending(outcome);
|
|
189
|
+
end(outcome, how);
|
|
190
|
+
return { outcome, how };
|
|
191
|
+
});
|
|
192
|
+
tail = turn.catch(() => undefined);
|
|
193
|
+
return turn.then(({ outcome, how }) => {
|
|
194
|
+
const lost = calls.flatMap(({ identity, ended: answered }) => answered === 'unanswered' ? [identity.operation] : []);
|
|
195
|
+
if (how !== 'unanswered' || lost.length === 0 || settles === undefined)
|
|
196
|
+
return outcome;
|
|
197
|
+
if (press !== presses)
|
|
198
|
+
return outcome;
|
|
199
|
+
return awaiting(outcome, lost, settles, () => attempt(steps, expected, press));
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
const run = (steps, expected = null) => {
|
|
203
|
+
held?.supersede();
|
|
204
|
+
presses += 1;
|
|
205
|
+
return attempt(steps, expected, presses);
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
run,
|
|
209
|
+
shown: () => shown,
|
|
210
|
+
subscribe(listener) {
|
|
211
|
+
listeners.add(listener);
|
|
212
|
+
return () => {
|
|
213
|
+
listeners.delete(listener);
|
|
214
|
+
};
|
|
215
|
+
},
|
|
216
|
+
forget() {
|
|
217
|
+
if (pressed > 0 || ended === null)
|
|
218
|
+
return;
|
|
219
|
+
ended = null;
|
|
220
|
+
show();
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
}
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ConversationHistoryRequest } from './adapter.js';
|
|
2
2
|
import { type CallResult, type HistoryAnswer, type Resolution } from './outcome.js';
|
|
3
3
|
import type { Attempted } from './recovery.js';
|
|
4
|
+
import type { Attempt } from './retried.js';
|
|
4
5
|
import type { Runtime } from './runtime.js';
|
|
5
6
|
export type HistoryQuery = {
|
|
6
7
|
revision?: string;
|
|
@@ -12,9 +13,14 @@ export declare function located(runtime: Runtime, room: string, path: string, de
|
|
|
12
13
|
path: string;
|
|
13
14
|
} | null>;
|
|
14
15
|
export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
|
|
15
|
-
export
|
|
16
|
+
export type Invoked = {
|
|
17
|
+
readonly dispatching?: () => Promise<void>;
|
|
18
|
+
readonly attempt?: Attempt;
|
|
19
|
+
};
|
|
20
|
+
export declare function invokeAction(runtime: Runtime, name: string, input: unknown, { dispatching, attempt }?: Invoked): Promise<CallResult>;
|
|
16
21
|
export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
|
|
17
|
-
export declare function called(runtime: Runtime, name: string, input: unknown): Promise<CallResult>;
|
|
22
|
+
export declare function called(runtime: Runtime, name: string, input: unknown, attempt?: Attempt): Promise<CallResult>;
|
|
23
|
+
export declare function answeredCall(runtime: Runtime, operation: string): Promise<boolean>;
|
|
18
24
|
export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
|
|
19
25
|
export declare function resendLater(runtime: Runtime): void;
|
|
20
26
|
//# sourceMappingURL=actions.d.ts.map
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAM3E,OAAO,EAWL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAOF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,YAAiB,GACvB,OAAO,CAAC,aAAa,CAAC,CA+BxB;AAED,wBAAsB,OAAO,CAC3B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAShD;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAuBrB;AA2DD,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,EAAE,WAAW,EAAE,OAAO,EAAE,GAAE,OAAY,GACrC,OAAO,CAAC,UAAU,CAAC,CAiCrB;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,UAAU,CAAC,CAerB;AA4GD,wBAAsB,MAAM,CAC1B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAaxF;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAkB3F;AAiBD,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAG3C"}
|
package/dist/actions.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { roomTarget, target } from '@agentshouse/mdmodel';
|
|
2
|
+
import { CATCHING_UP, holdsSubmission, resendConversations } from './conversation.js';
|
|
2
3
|
import { listingNow } from './listing.js';
|
|
3
4
|
import { locked, lockedRooms } from './locks.js';
|
|
4
5
|
import { scoped } from './models.js';
|
|
5
|
-
import { ABSENT_TARGET,
|
|
6
|
+
import { ABSENT_TARGET, failure, historyAnswer, LOCKED_UNREADABLE, lockedRoom, handedOutcome, UNANSWERED, undeclared, UNCERTAIN, UNREADABLE, } from './outcome.js';
|
|
6
7
|
import { refuse } from './refusal.js';
|
|
7
8
|
function operationOf(input) {
|
|
8
9
|
const operation = input?.operation_id;
|
|
9
10
|
return typeof operation === 'string' ? operation : null;
|
|
10
11
|
}
|
|
11
12
|
export async function readHistory(runtime, locator, path, query = {}) {
|
|
12
|
-
const { store, socket,
|
|
13
|
+
const { store, socket, presence } = runtime;
|
|
13
14
|
const { session } = socket;
|
|
14
15
|
if (socket.closed() || session.now().refusal !== null)
|
|
15
16
|
return UNCERTAIN;
|
|
@@ -25,13 +26,7 @@ export async function readHistory(runtime, locator, path, query = {}) {
|
|
|
25
26
|
const { closed, authorization, refusal } = session.now();
|
|
26
27
|
if (closed || authorization === undefined || refusal !== null)
|
|
27
28
|
return UNCERTAIN;
|
|
28
|
-
const since =
|
|
29
|
-
const transfer = ['transfer', 'history', locator, path];
|
|
30
|
-
if (query.revision !== undefined)
|
|
31
|
-
transfer.push(query.revision);
|
|
32
|
-
if (query.pageToken !== undefined)
|
|
33
|
-
transfer.push(query.pageToken);
|
|
34
|
-
journal.record(transfer.join(' '));
|
|
29
|
+
const since = presence.losses();
|
|
35
30
|
try {
|
|
36
31
|
const result = await socket.history(authorization, {
|
|
37
32
|
locator,
|
|
@@ -39,20 +34,18 @@ export async function readHistory(runtime, locator, path, query = {}) {
|
|
|
39
34
|
...(query.revision === undefined ? {} : { revision: query.revision }),
|
|
40
35
|
...(query.pageToken === undefined ? {} : { pageToken: query.pageToken }),
|
|
41
36
|
});
|
|
42
|
-
|
|
43
|
-
if (store.fences.since(locator, since))
|
|
37
|
+
if (presence.lostSince(locator, since))
|
|
44
38
|
return failure({ kind: 'room-not-readable', locator });
|
|
45
39
|
if (result.kind === 'scoped-refusal') {
|
|
46
40
|
const room = await store.record(result.locator);
|
|
47
41
|
if (room !== undefined)
|
|
48
|
-
await scoped(runtime, result, room,
|
|
42
|
+
await scoped(runtime, result, room.locator, room.declaration);
|
|
49
43
|
}
|
|
50
44
|
if (result.kind === 'revoked-authorization')
|
|
51
45
|
await refuse(runtime, 'revoked-authorization');
|
|
52
46
|
return historyAnswer(result);
|
|
53
47
|
}
|
|
54
48
|
catch {
|
|
55
|
-
journal.record('outcome history transport-uncertainty');
|
|
56
49
|
return UNCERTAIN;
|
|
57
50
|
}
|
|
58
51
|
}
|
|
@@ -93,8 +86,16 @@ export async function resolveReference(runtime, room, path, destination) {
|
|
|
93
86
|
? { kind: 'deleted', ...at, revision: last }
|
|
94
87
|
: { kind: 'document', ...at };
|
|
95
88
|
}
|
|
96
|
-
async function
|
|
97
|
-
|
|
89
|
+
async function declaredActions({ store, socket }) {
|
|
90
|
+
const { unstored } = socket.session.now();
|
|
91
|
+
if (unstored !== null)
|
|
92
|
+
return unstored.capabilities;
|
|
93
|
+
if (!store.needed())
|
|
94
|
+
return [];
|
|
95
|
+
return (await (await store.open()).facts()).capabilities;
|
|
96
|
+
}
|
|
97
|
+
async function declaredAction(runtime, name) {
|
|
98
|
+
for (const capability of await declaredActions(runtime)) {
|
|
98
99
|
for (const action of capability.actions ?? []) {
|
|
99
100
|
if (action.name === name)
|
|
100
101
|
return action;
|
|
@@ -102,69 +103,97 @@ async function declaredAction({ store }, name) {
|
|
|
102
103
|
}
|
|
103
104
|
return undefined;
|
|
104
105
|
}
|
|
106
|
+
async function declaration(runtime, name) {
|
|
107
|
+
const { socket } = runtime;
|
|
108
|
+
const declared = await declaredAction(runtime, name);
|
|
109
|
+
if (declared !== undefined || socket.streamed || socket.session.now().roomsNamed)
|
|
110
|
+
return declared;
|
|
111
|
+
await runtime.discover();
|
|
112
|
+
return declaredAction(runtime, name);
|
|
113
|
+
}
|
|
114
|
+
function walked(value, members) {
|
|
115
|
+
if (Array.isArray(value))
|
|
116
|
+
return value.flatMap((one) => walked(one, members));
|
|
117
|
+
const [member, ...rest] = members;
|
|
118
|
+
if (member === undefined)
|
|
119
|
+
return [value];
|
|
120
|
+
if (value === null || typeof value !== 'object')
|
|
121
|
+
return [];
|
|
122
|
+
return walked(value[member], rest);
|
|
123
|
+
}
|
|
124
|
+
function strings(values) {
|
|
125
|
+
return values.filter((value) => typeof value === 'string');
|
|
126
|
+
}
|
|
105
127
|
async function calledRooms(runtime, name, input) {
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
128
|
+
const declared = await declaration(runtime, name);
|
|
129
|
+
if (declared === undefined || input === null || typeof input !== 'object')
|
|
108
130
|
return [];
|
|
109
|
-
const named = input[
|
|
110
|
-
|
|
131
|
+
const named = declared.room === undefined ? [] : strings(walked(input, [declared.room]));
|
|
132
|
+
const handles = strings((declared.roomPaths ?? []).flatMap((selector) => walked(input, selector.split('.')))).flatMap((path) => roomTarget(path)?.handle ?? []);
|
|
133
|
+
if (handles.length === 0)
|
|
134
|
+
return named;
|
|
135
|
+
const listing = await listingNow(runtime);
|
|
136
|
+
return [
|
|
137
|
+
...named,
|
|
138
|
+
...[...listing.values()]
|
|
139
|
+
.filter((listed) => handles.includes(listed.handle))
|
|
140
|
+
.map((listed) => listed.locator),
|
|
141
|
+
];
|
|
111
142
|
}
|
|
112
|
-
export async function invokeAction(runtime, name, input, dispatching) {
|
|
113
|
-
const { store, socket,
|
|
143
|
+
export async function invokeAction(runtime, name, input, { dispatching, attempt } = {}) {
|
|
144
|
+
const { store, socket, retries } = runtime;
|
|
114
145
|
const { session } = socket;
|
|
115
146
|
await socket.ready;
|
|
116
|
-
if (socket.closed() || session.now().refusal !== null)
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
147
|
+
if (socket.closed() || session.now().refusal !== null) {
|
|
148
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
149
|
+
}
|
|
150
|
+
if ((await declaredAction(runtime, name)) === undefined) {
|
|
151
|
+
return session.now().roomsNamed
|
|
152
|
+
? undeclared(name)
|
|
153
|
+
: handedOutcome(retries, attempt, UNANSWERED);
|
|
154
|
+
}
|
|
120
155
|
try {
|
|
121
156
|
await socket.authorize();
|
|
122
157
|
}
|
|
123
158
|
catch {
|
|
124
|
-
return
|
|
159
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
125
160
|
}
|
|
126
161
|
const { closed, authorization, refusal } = session.now();
|
|
127
|
-
if (closed || authorization === undefined || refusal !== null)
|
|
128
|
-
return
|
|
162
|
+
if (closed || authorization === undefined || refusal !== null) {
|
|
163
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
164
|
+
}
|
|
129
165
|
await dispatching?.();
|
|
130
|
-
journal.record(`transfer action ${name}`);
|
|
131
166
|
try {
|
|
132
167
|
const result = await socket.action(authorization, { name, input });
|
|
133
168
|
if (result.kind === 'scoped-refusal') {
|
|
134
169
|
const room = await store.record(result.locator);
|
|
135
170
|
if (room !== undefined)
|
|
136
|
-
await scoped(runtime, result, room,
|
|
171
|
+
await scoped(runtime, result, room.locator, room.declaration);
|
|
137
172
|
}
|
|
138
173
|
if (result.kind === 'revoked-authorization')
|
|
139
174
|
await refuse(runtime, 'revoked-authorization');
|
|
140
|
-
|
|
141
|
-
if (result.kind === 'rejected')
|
|
142
|
-
journal.record(`refusal rejected ${result.code}`);
|
|
143
|
-
return calledResult(result);
|
|
175
|
+
return handedOutcome(retries, attempt, result);
|
|
144
176
|
}
|
|
145
|
-
catch {
|
|
146
|
-
|
|
147
|
-
return UNCERTAIN;
|
|
177
|
+
catch (error) {
|
|
178
|
+
return handedOutcome(retries, attempt, { kind: 'transport-uncertainty', failure: error });
|
|
148
179
|
}
|
|
149
180
|
}
|
|
150
181
|
export async function readConversationHistory(runtime, request) {
|
|
151
|
-
const { socket,
|
|
182
|
+
const { socket, retries } = runtime;
|
|
183
|
+
const caught = { step: 'conversations', instance: CATCHING_UP };
|
|
152
184
|
await socket.ready;
|
|
153
185
|
const stream = socket.conversations();
|
|
154
186
|
if (socket.closed() || socket.session.now().refusal !== null || stream?.history === undefined) {
|
|
155
|
-
return
|
|
187
|
+
return handedOutcome(retries, caught, UNANSWERED);
|
|
156
188
|
}
|
|
157
|
-
journal.record('transfer conversation history');
|
|
158
189
|
try {
|
|
159
190
|
const result = await stream.history(request);
|
|
160
191
|
if (result.kind === 'revoked-authorization')
|
|
161
192
|
await refuse(runtime, 'revoked-authorization');
|
|
162
|
-
|
|
163
|
-
return calledResult(result);
|
|
193
|
+
return handedOutcome(retries, caught, result);
|
|
164
194
|
}
|
|
165
|
-
catch {
|
|
166
|
-
|
|
167
|
-
return UNCERTAIN;
|
|
195
|
+
catch (error) {
|
|
196
|
+
return handedOutcome(retries, caught, { kind: 'transport-uncertainty', failure: error });
|
|
168
197
|
}
|
|
169
198
|
}
|
|
170
199
|
function unsettled(result) {
|
|
@@ -172,59 +201,126 @@ function unsettled(result) {
|
|
|
172
201
|
return false;
|
|
173
202
|
return result.retryable && (result.kind !== 'rejected' || result.reset === undefined);
|
|
174
203
|
}
|
|
175
|
-
|
|
176
|
-
|
|
204
|
+
function numberedCall(runtime, name, input, operation, dispatching) {
|
|
205
|
+
return invokeAction(runtime, name, input, {
|
|
206
|
+
dispatching,
|
|
207
|
+
attempt: { step: 'sending', instance: `action ${operation}` },
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function keptSender(runtime, name, input, operation, resent = false) {
|
|
211
|
+
const { store, socket } = runtime;
|
|
177
212
|
const { lanes } = socket;
|
|
213
|
+
const dispatching = async () => (await store.open()).keepCall({ operation, name, input });
|
|
214
|
+
let waiting = [];
|
|
215
|
+
let last = UNCERTAIN;
|
|
216
|
+
let lost = resent;
|
|
217
|
+
const tell = (result) => {
|
|
218
|
+
last = result;
|
|
219
|
+
const told = waiting;
|
|
220
|
+
waiting = [];
|
|
221
|
+
for (const answer of told)
|
|
222
|
+
answer(result);
|
|
223
|
+
};
|
|
224
|
+
const sender = {
|
|
225
|
+
next: () => new Promise((answer) => waiting.push(answer)),
|
|
226
|
+
async send() {
|
|
227
|
+
let result;
|
|
228
|
+
try {
|
|
229
|
+
result = await numberedCall(runtime, name, input, operation, dispatching);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
tell(last);
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
if (unsettled(result))
|
|
236
|
+
lost = true;
|
|
237
|
+
else {
|
|
238
|
+
await (await store.open()).dropCall(operation);
|
|
239
|
+
lanes.settle(operation, lost);
|
|
240
|
+
}
|
|
241
|
+
tell(result);
|
|
242
|
+
return result;
|
|
243
|
+
},
|
|
244
|
+
release() {
|
|
245
|
+
lanes.sent(operation, sender);
|
|
246
|
+
tell(last);
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
lanes.sending(operation, sender);
|
|
250
|
+
return sender;
|
|
251
|
+
}
|
|
252
|
+
async function recoveredAction(runtime, name, input, attempt) {
|
|
253
|
+
const { socket, recovery } = runtime;
|
|
178
254
|
const operation = operationOf(input);
|
|
179
255
|
if (operation === null)
|
|
180
|
-
return invokeAction(runtime, name, input);
|
|
181
|
-
const
|
|
182
|
-
|
|
256
|
+
return invokeAction(runtime, name, input, { attempt });
|
|
257
|
+
const held = socket.lanes.sender(operation);
|
|
258
|
+
if (held !== undefined)
|
|
259
|
+
return held.next();
|
|
260
|
+
const sender = keptSender(runtime, name, input, operation);
|
|
261
|
+
let first;
|
|
183
262
|
try {
|
|
184
|
-
|
|
185
|
-
if (unsettled(result)) {
|
|
186
|
-
await recovery.attempt(`action ${operation}`, async () => {
|
|
187
|
-
if (socket.closed() || socket.session.now().refusal !== null)
|
|
188
|
-
return 'done';
|
|
189
|
-
if (!socket.isOpen())
|
|
190
|
-
return 'again';
|
|
191
|
-
result = await invokeAction(runtime, name, input, kept);
|
|
192
|
-
return unsettled(result) ? 'again' : 'done';
|
|
193
|
-
}, { again: true });
|
|
194
|
-
}
|
|
195
|
-
if (!unsettled(result))
|
|
196
|
-
await (await store.open()).dropCall(operation);
|
|
197
|
-
return result;
|
|
263
|
+
first = await sender.send();
|
|
198
264
|
}
|
|
199
|
-
|
|
200
|
-
|
|
265
|
+
catch (error) {
|
|
266
|
+
sender.release();
|
|
267
|
+
throw error;
|
|
201
268
|
}
|
|
269
|
+
if (!unsettled(first)) {
|
|
270
|
+
sender.release();
|
|
271
|
+
return first;
|
|
272
|
+
}
|
|
273
|
+
void recovery
|
|
274
|
+
.attempt(`action ${operation}`, async () => {
|
|
275
|
+
if (socket.closed() || socket.session.now().refusal !== null)
|
|
276
|
+
return 'done';
|
|
277
|
+
if (!socket.isOpen())
|
|
278
|
+
return 'again';
|
|
279
|
+
return unsettled(await sender.send()) ? 'again' : 'done';
|
|
280
|
+
}, { again: true })
|
|
281
|
+
.finally(() => sender.release());
|
|
282
|
+
return first;
|
|
202
283
|
}
|
|
203
|
-
export async function called(runtime, name, input) {
|
|
284
|
+
export async function called(runtime, name, input, attempt) {
|
|
204
285
|
await runtime.socket.ready;
|
|
205
286
|
const lockedNow = await lockedRooms(runtime);
|
|
206
287
|
const room = (await calledRooms(runtime, name, input)).find((one) => lockedNow.includes(one));
|
|
207
|
-
return room === undefined ? recoveredAction(runtime, name, input) : lockedRoom(room);
|
|
288
|
+
return room === undefined ? recoveredAction(runtime, name, input, attempt) : lockedRoom(room);
|
|
208
289
|
}
|
|
209
|
-
export async function
|
|
290
|
+
export async function answeredCall(runtime, operation) {
|
|
210
291
|
const { store, socket } = runtime;
|
|
211
292
|
const { lanes } = socket;
|
|
293
|
+
const held = () => lanes.sender(operation) !== undefined || lanes.unclaimed(operation);
|
|
294
|
+
if (!held()) {
|
|
295
|
+
const calls = await (await store.open()).calls();
|
|
296
|
+
const kept = calls.some((one) => one.operation === operation) ||
|
|
297
|
+
(await holdsSubmission(runtime.conversations, operation));
|
|
298
|
+
if (!held() && !kept)
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
await lanes.settled(operation);
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
export async function resendCalls(runtime, signal) {
|
|
305
|
+
const { store, socket } = runtime;
|
|
212
306
|
if (!socket.isOpen() || socket.closed() || socket.stopping())
|
|
213
307
|
return 'done';
|
|
214
308
|
const local = await store.open();
|
|
215
309
|
for (const held of await local.calls()) {
|
|
216
|
-
if (lanes.
|
|
310
|
+
if (socket.lanes.sender(held.operation) !== undefined)
|
|
217
311
|
continue;
|
|
218
312
|
if (socket.closed() || signal.aborted)
|
|
219
313
|
return 'done';
|
|
220
|
-
|
|
314
|
+
const name = runtime.renamedActions.get(held.name) ?? held.name;
|
|
315
|
+
const rewrite = runtime.rewrittenInputs.get(name);
|
|
316
|
+
const input = rewrite === undefined ? held.input : rewrite(held.input);
|
|
317
|
+
const sender = keptSender(runtime, name, input, held.operation, true);
|
|
221
318
|
try {
|
|
222
|
-
if (unsettled(await
|
|
319
|
+
if (unsettled(await sender.send()))
|
|
223
320
|
return 'again';
|
|
224
|
-
await local.dropCall(held.operation);
|
|
225
321
|
}
|
|
226
322
|
finally {
|
|
227
|
-
|
|
323
|
+
sender.release();
|
|
228
324
|
}
|
|
229
325
|
}
|
|
230
326
|
return 'done';
|
|
@@ -234,7 +330,7 @@ async function resendPass({ socket, conversations }, signal) {
|
|
|
234
330
|
return 'done';
|
|
235
331
|
const reading = { complete: true, reachable: true };
|
|
236
332
|
try {
|
|
237
|
-
await conversations
|
|
333
|
+
await resendConversations(conversations, reading);
|
|
238
334
|
}
|
|
239
335
|
catch {
|
|
240
336
|
reading.reachable = false;
|