@agentshouse/mdruntime 0.1.0-cef76ea952695 → 0.1.0-cefb45338245d
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 +72 -158
- 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 +174 -75
- package/dist/adapter.d.ts +149 -34
- 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 -19
- 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 +3 -0
- 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 +22 -23
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -66
- 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 +87 -43
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +36 -27
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +25 -11
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +23 -11
- 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 +43 -11
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +312 -184
- 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 +22 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +91 -34
- package/dist/expectation.d.ts +25 -14
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +51 -20
- package/dist/failure.d.ts +2 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- 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 +102 -0
- package/dist/index.d.ts +23 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -8
- package/dist/install.d.ts +10 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +89 -108
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +74 -54
- package/dist/listing.d.ts +29 -22
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +71 -79
- package/dist/live.d.ts +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +94 -36
- 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 +10 -38
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +11 -23
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +167 -33
- package/dist/memory.d.ts +10 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +98 -37
- package/dist/messages.d.ts +17 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +34 -13
- 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 +94 -138
- 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 +206 -69
- 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 +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +21 -12
- 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 +4 -9
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -15
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +207 -96
- 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 +136 -78
- package/dist/query.d.ts +2 -2
- 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 +182 -38
- package/dist/react.d.ts +11 -5
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +28 -5
- package/dist/readiness.d.ts +20 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +17 -10
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +9 -4
- 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 +2 -4
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +16 -18
- 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 +30 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +275 -65
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +11 -6
- 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 +13 -19
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +43 -90
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +314 -223
- package/dist/saves.d.ts +6 -42
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +176 -718
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +4 -4
- package/dist/shown.d.ts +9 -5
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +93 -57
- 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 -1
- 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 +4 -14
- package/dist/source.d.ts +7 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +15 -2
- 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 +24 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +68 -22
- 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.d.ts +25 -15
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +50 -18
- package/dist/stored.d.ts +39 -14
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +217 -59
- package/dist/surface.d.ts +14 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +65 -34
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +127 -102
- package/dist/tables.d.ts +28 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +95 -326
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +1 -2
- 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 -4
- 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 -5
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -7
- 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 -44
- 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;AAiED,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,16 +1,16 @@
|
|
|
1
1
|
import { roomTarget, target } from '@agentshouse/mdmodel';
|
|
2
|
-
import { resendConversations } from './conversation.js';
|
|
2
|
+
import { CATCHING_UP, holdsSubmission, resendConversations } from './conversation.js';
|
|
3
3
|
import { listingNow } from './listing.js';
|
|
4
4
|
import { locked, lockedRooms } from './locks.js';
|
|
5
5
|
import { scoped } from './models.js';
|
|
6
|
-
import { ABSENT_TARGET,
|
|
6
|
+
import { ABSENT_TARGET, failure, historyAnswer, LOCKED_UNREADABLE, lockedRoom, handedOutcome, UNANSWERED, undeclared, UNCERTAIN, UNREADABLE, } from './outcome.js';
|
|
7
7
|
import { refuse } from './refusal.js';
|
|
8
8
|
function operationOf(input) {
|
|
9
9
|
const operation = input?.operation_id;
|
|
10
10
|
return typeof operation === 'string' ? operation : null;
|
|
11
11
|
}
|
|
12
12
|
export async function readHistory(runtime, locator, path, query = {}) {
|
|
13
|
-
const { store, socket,
|
|
13
|
+
const { store, socket, presence } = runtime;
|
|
14
14
|
const { session } = socket;
|
|
15
15
|
if (socket.closed() || session.now().refusal !== null)
|
|
16
16
|
return UNCERTAIN;
|
|
@@ -26,13 +26,7 @@ export async function readHistory(runtime, locator, path, query = {}) {
|
|
|
26
26
|
const { closed, authorization, refusal } = session.now();
|
|
27
27
|
if (closed || authorization === undefined || refusal !== null)
|
|
28
28
|
return UNCERTAIN;
|
|
29
|
-
const since =
|
|
30
|
-
const transfer = ['transfer', 'history', locator, path];
|
|
31
|
-
if (query.revision !== undefined)
|
|
32
|
-
transfer.push(query.revision);
|
|
33
|
-
if (query.pageToken !== undefined)
|
|
34
|
-
transfer.push(query.pageToken);
|
|
35
|
-
journal.record(transfer.join(' '));
|
|
29
|
+
const since = presence.losses();
|
|
36
30
|
try {
|
|
37
31
|
const result = await socket.history(authorization, {
|
|
38
32
|
locator,
|
|
@@ -40,20 +34,18 @@ export async function readHistory(runtime, locator, path, query = {}) {
|
|
|
40
34
|
...(query.revision === undefined ? {} : { revision: query.revision }),
|
|
41
35
|
...(query.pageToken === undefined ? {} : { pageToken: query.pageToken }),
|
|
42
36
|
});
|
|
43
|
-
|
|
44
|
-
if (store.fences.since(locator, since))
|
|
37
|
+
if (presence.lostSince(locator, since))
|
|
45
38
|
return failure({ kind: 'room-not-readable', locator });
|
|
46
39
|
if (result.kind === 'scoped-refusal') {
|
|
47
40
|
const room = await store.record(result.locator);
|
|
48
41
|
if (room !== undefined)
|
|
49
|
-
await scoped(runtime, result, room,
|
|
42
|
+
await scoped(runtime, result, room.locator, room.declaration);
|
|
50
43
|
}
|
|
51
44
|
if (result.kind === 'revoked-authorization')
|
|
52
45
|
await refuse(runtime, 'revoked-authorization');
|
|
53
46
|
return historyAnswer(result);
|
|
54
47
|
}
|
|
55
48
|
catch {
|
|
56
|
-
journal.record('outcome history transport-uncertainty');
|
|
57
49
|
return UNCERTAIN;
|
|
58
50
|
}
|
|
59
51
|
}
|
|
@@ -94,8 +86,16 @@ export async function resolveReference(runtime, room, path, destination) {
|
|
|
94
86
|
? { kind: 'deleted', ...at, revision: last }
|
|
95
87
|
: { kind: 'document', ...at };
|
|
96
88
|
}
|
|
97
|
-
async function
|
|
98
|
-
|
|
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)) {
|
|
99
99
|
for (const action of capability.actions ?? []) {
|
|
100
100
|
if (action.name === name)
|
|
101
101
|
return action;
|
|
@@ -103,69 +103,101 @@ async function declaredAction({ store }, name) {
|
|
|
103
103
|
}
|
|
104
104
|
return undefined;
|
|
105
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
|
+
}
|
|
127
|
+
const ROOM_TOP = /^\/rooms\/([^/]+)\/?$/u;
|
|
128
|
+
function namedRoom(path) {
|
|
129
|
+
return roomTarget(path)?.handle ?? ROOM_TOP.exec(path)?.[1] ?? null;
|
|
130
|
+
}
|
|
106
131
|
async function calledRooms(runtime, name, input) {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
132
|
+
const declared = await declaration(runtime, name);
|
|
133
|
+
if (declared === undefined || input === null || typeof input !== 'object')
|
|
109
134
|
return [];
|
|
110
|
-
const named =
|
|
111
|
-
|
|
135
|
+
const named = declared.room === undefined ? [] : strings(walked(input, declared.room.split('.')));
|
|
136
|
+
const handles = strings((declared.roomPaths ?? []).flatMap((selector) => walked(input, selector.split('.')))).flatMap((path) => namedRoom(path) ?? []);
|
|
137
|
+
if (handles.length === 0)
|
|
138
|
+
return named;
|
|
139
|
+
const listing = await listingNow(runtime);
|
|
140
|
+
return [
|
|
141
|
+
...named,
|
|
142
|
+
...[...listing.values()]
|
|
143
|
+
.filter((listed) => handles.includes(listed.handle) || handles.includes(listed.locator))
|
|
144
|
+
.map((listed) => listed.locator),
|
|
145
|
+
];
|
|
112
146
|
}
|
|
113
|
-
export async function invokeAction(runtime, name, input, dispatching) {
|
|
114
|
-
const { store, socket,
|
|
147
|
+
export async function invokeAction(runtime, name, input, { dispatching, attempt } = {}) {
|
|
148
|
+
const { store, socket, retries } = runtime;
|
|
115
149
|
const { session } = socket;
|
|
116
150
|
await socket.ready;
|
|
117
|
-
if (socket.closed() || session.now().refusal !== null)
|
|
118
|
-
return
|
|
119
|
-
|
|
120
|
-
|
|
151
|
+
if (socket.closed() || session.now().refusal !== null) {
|
|
152
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
153
|
+
}
|
|
154
|
+
if ((await declaredAction(runtime, name)) === undefined) {
|
|
155
|
+
return session.now().roomsNamed
|
|
156
|
+
? undeclared(name)
|
|
157
|
+
: handedOutcome(retries, attempt, UNANSWERED);
|
|
158
|
+
}
|
|
121
159
|
try {
|
|
122
160
|
await socket.authorize();
|
|
123
161
|
}
|
|
124
162
|
catch {
|
|
125
|
-
return
|
|
163
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
126
164
|
}
|
|
127
165
|
const { closed, authorization, refusal } = session.now();
|
|
128
|
-
if (closed || authorization === undefined || refusal !== null)
|
|
129
|
-
return
|
|
166
|
+
if (closed || authorization === undefined || refusal !== null) {
|
|
167
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
168
|
+
}
|
|
130
169
|
await dispatching?.();
|
|
131
|
-
journal.record(`transfer action ${name}`);
|
|
132
170
|
try {
|
|
133
171
|
const result = await socket.action(authorization, { name, input });
|
|
134
172
|
if (result.kind === 'scoped-refusal') {
|
|
135
173
|
const room = await store.record(result.locator);
|
|
136
174
|
if (room !== undefined)
|
|
137
|
-
await scoped(runtime, result, room,
|
|
175
|
+
await scoped(runtime, result, room.locator, room.declaration);
|
|
138
176
|
}
|
|
139
177
|
if (result.kind === 'revoked-authorization')
|
|
140
178
|
await refuse(runtime, 'revoked-authorization');
|
|
141
|
-
|
|
142
|
-
if (result.kind === 'rejected')
|
|
143
|
-
journal.record(`refusal rejected ${result.code}`);
|
|
144
|
-
return calledResult(result);
|
|
179
|
+
return handedOutcome(retries, attempt, result);
|
|
145
180
|
}
|
|
146
|
-
catch {
|
|
147
|
-
|
|
148
|
-
return UNCERTAIN;
|
|
181
|
+
catch (error) {
|
|
182
|
+
return handedOutcome(retries, attempt, { kind: 'transport-uncertainty', failure: error });
|
|
149
183
|
}
|
|
150
184
|
}
|
|
151
185
|
export async function readConversationHistory(runtime, request) {
|
|
152
|
-
const { socket,
|
|
186
|
+
const { socket, retries } = runtime;
|
|
187
|
+
const caught = { step: 'conversations', instance: CATCHING_UP };
|
|
153
188
|
await socket.ready;
|
|
154
189
|
const stream = socket.conversations();
|
|
155
190
|
if (socket.closed() || socket.session.now().refusal !== null || stream?.history === undefined) {
|
|
156
|
-
return
|
|
191
|
+
return handedOutcome(retries, caught, UNANSWERED);
|
|
157
192
|
}
|
|
158
|
-
journal.record('transfer conversation history');
|
|
159
193
|
try {
|
|
160
194
|
const result = await stream.history(request);
|
|
161
195
|
if (result.kind === 'revoked-authorization')
|
|
162
196
|
await refuse(runtime, 'revoked-authorization');
|
|
163
|
-
|
|
164
|
-
return calledResult(result);
|
|
197
|
+
return handedOutcome(retries, caught, result);
|
|
165
198
|
}
|
|
166
|
-
catch {
|
|
167
|
-
|
|
168
|
-
return UNCERTAIN;
|
|
199
|
+
catch (error) {
|
|
200
|
+
return handedOutcome(retries, caught, { kind: 'transport-uncertainty', failure: error });
|
|
169
201
|
}
|
|
170
202
|
}
|
|
171
203
|
function unsettled(result) {
|
|
@@ -173,59 +205,126 @@ function unsettled(result) {
|
|
|
173
205
|
return false;
|
|
174
206
|
return result.retryable && (result.kind !== 'rejected' || result.reset === undefined);
|
|
175
207
|
}
|
|
176
|
-
|
|
177
|
-
|
|
208
|
+
function numberedCall(runtime, name, input, operation, dispatching) {
|
|
209
|
+
return invokeAction(runtime, name, input, {
|
|
210
|
+
dispatching,
|
|
211
|
+
attempt: { step: 'sending', instance: `action ${operation}` },
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function keptSender(runtime, name, input, operation, resent = false) {
|
|
215
|
+
const { store, socket } = runtime;
|
|
178
216
|
const { lanes } = socket;
|
|
217
|
+
const dispatching = async () => (await store.open()).keepCall({ operation, name, input });
|
|
218
|
+
let waiting = [];
|
|
219
|
+
let last = UNCERTAIN;
|
|
220
|
+
let lost = resent;
|
|
221
|
+
const tell = (result) => {
|
|
222
|
+
last = result;
|
|
223
|
+
const told = waiting;
|
|
224
|
+
waiting = [];
|
|
225
|
+
for (const answer of told)
|
|
226
|
+
answer(result);
|
|
227
|
+
};
|
|
228
|
+
const sender = {
|
|
229
|
+
next: () => new Promise((answer) => waiting.push(answer)),
|
|
230
|
+
async send() {
|
|
231
|
+
let result;
|
|
232
|
+
try {
|
|
233
|
+
result = await numberedCall(runtime, name, input, operation, dispatching);
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
tell(last);
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
if (unsettled(result))
|
|
240
|
+
lost = true;
|
|
241
|
+
else {
|
|
242
|
+
await (await store.open()).dropCall(operation);
|
|
243
|
+
lanes.settle(operation, lost);
|
|
244
|
+
}
|
|
245
|
+
tell(result);
|
|
246
|
+
return result;
|
|
247
|
+
},
|
|
248
|
+
release() {
|
|
249
|
+
lanes.sent(operation, sender);
|
|
250
|
+
tell(last);
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
lanes.sending(operation, sender);
|
|
254
|
+
return sender;
|
|
255
|
+
}
|
|
256
|
+
async function recoveredAction(runtime, name, input, attempt) {
|
|
257
|
+
const { socket, recovery } = runtime;
|
|
179
258
|
const operation = operationOf(input);
|
|
180
259
|
if (operation === null)
|
|
181
|
-
return invokeAction(runtime, name, input);
|
|
182
|
-
const
|
|
183
|
-
|
|
260
|
+
return invokeAction(runtime, name, input, { attempt });
|
|
261
|
+
const held = socket.lanes.sender(operation);
|
|
262
|
+
if (held !== undefined)
|
|
263
|
+
return held.next();
|
|
264
|
+
const sender = keptSender(runtime, name, input, operation);
|
|
265
|
+
let first;
|
|
184
266
|
try {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (!socket.isOpen())
|
|
191
|
-
return 'again';
|
|
192
|
-
result = await invokeAction(runtime, name, input, kept);
|
|
193
|
-
return unsettled(result) ? 'again' : 'done';
|
|
194
|
-
}, { again: true });
|
|
195
|
-
}
|
|
196
|
-
if (!unsettled(result))
|
|
197
|
-
await (await store.open()).dropCall(operation);
|
|
198
|
-
return result;
|
|
267
|
+
first = await sender.send();
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
sender.release();
|
|
271
|
+
throw error;
|
|
199
272
|
}
|
|
200
|
-
|
|
201
|
-
|
|
273
|
+
if (!unsettled(first)) {
|
|
274
|
+
sender.release();
|
|
275
|
+
return first;
|
|
202
276
|
}
|
|
277
|
+
void recovery
|
|
278
|
+
.attempt(`action ${operation}`, async () => {
|
|
279
|
+
if (socket.closed() || socket.session.now().refusal !== null)
|
|
280
|
+
return 'done';
|
|
281
|
+
if (!socket.isOpen())
|
|
282
|
+
return 'again';
|
|
283
|
+
return unsettled(await sender.send()) ? 'again' : 'done';
|
|
284
|
+
}, { again: true })
|
|
285
|
+
.finally(() => sender.release());
|
|
286
|
+
return first;
|
|
203
287
|
}
|
|
204
|
-
export async function called(runtime, name, input) {
|
|
288
|
+
export async function called(runtime, name, input, attempt) {
|
|
205
289
|
await runtime.socket.ready;
|
|
206
290
|
const lockedNow = await lockedRooms(runtime);
|
|
207
291
|
const room = (await calledRooms(runtime, name, input)).find((one) => lockedNow.includes(one));
|
|
208
|
-
return room === undefined ? recoveredAction(runtime, name, input) : lockedRoom(room);
|
|
292
|
+
return room === undefined ? recoveredAction(runtime, name, input, attempt) : lockedRoom(room);
|
|
209
293
|
}
|
|
210
|
-
export async function
|
|
294
|
+
export async function answeredCall(runtime, operation) {
|
|
211
295
|
const { store, socket } = runtime;
|
|
212
296
|
const { lanes } = socket;
|
|
297
|
+
const held = () => lanes.sender(operation) !== undefined || lanes.unclaimed(operation);
|
|
298
|
+
if (!held()) {
|
|
299
|
+
const calls = await (await store.open()).calls();
|
|
300
|
+
const kept = calls.some((one) => one.operation === operation) ||
|
|
301
|
+
(await holdsSubmission(runtime.conversations, operation));
|
|
302
|
+
if (!held() && !kept)
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
await lanes.settled(operation);
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
export async function resendCalls(runtime, signal) {
|
|
309
|
+
const { store, socket } = runtime;
|
|
213
310
|
if (!socket.isOpen() || socket.closed() || socket.stopping())
|
|
214
311
|
return 'done';
|
|
215
312
|
const local = await store.open();
|
|
216
313
|
for (const held of await local.calls()) {
|
|
217
|
-
if (lanes.
|
|
314
|
+
if (socket.lanes.sender(held.operation) !== undefined)
|
|
218
315
|
continue;
|
|
219
316
|
if (socket.closed() || signal.aborted)
|
|
220
317
|
return 'done';
|
|
221
|
-
|
|
318
|
+
const name = runtime.renamedActions.get(held.name) ?? held.name;
|
|
319
|
+
const rewrite = runtime.rewrittenInputs.get(held.name) ?? runtime.rewrittenInputs.get(name);
|
|
320
|
+
const input = rewrite === undefined ? held.input : rewrite(held.input);
|
|
321
|
+
const sender = keptSender(runtime, name, input, held.operation, true);
|
|
222
322
|
try {
|
|
223
|
-
if (unsettled(await
|
|
323
|
+
if (unsettled(await sender.send()))
|
|
224
324
|
return 'again';
|
|
225
|
-
await local.dropCall(held.operation);
|
|
226
325
|
}
|
|
227
326
|
finally {
|
|
228
|
-
|
|
327
|
+
sender.release();
|
|
229
328
|
}
|
|
230
329
|
}
|
|
231
330
|
return 'done';
|