@real-life/trust-protocol 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +143 -0
- package/README.md +48 -3
- package/dist/adapters/vti-mediator.d.ts +80 -5
- package/dist/adapters/vti-mediator.d.ts.map +1 -1
- package/dist/adapters/vti-mediator.js +280 -26
- package/dist/adapters/vti-mediator.js.map +1 -1
- package/dist/engine.d.ts +4 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +104 -8
- package/dist/engine.js.map +1 -1
- package/dist/holder-api.d.ts +7 -1
- package/dist/holder-api.d.ts.map +1 -1
- package/dist/holder-api.js +15 -0
- package/dist/holder-api.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/results.d.ts +37 -2
- package/dist/results.d.ts.map +1 -1
- package/dist/results.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,148 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
Takes up the VTI Mediator Adapter Profile 0.24: the sending form of §3a.
|
|
6
|
+
|
|
7
|
+
- **Two sending modes** (RLTP-VTI-3110 to 3140): `SendMode` is
|
|
8
|
+
`'routed' | 'egress-session'`. Every adapter instance starts in
|
|
9
|
+
`routed`; `MediatorWire.deposit(accessToken, bytes, egressDid, mode)`
|
|
10
|
+
now receives the mode of each deposit, read at the hand-over, so an
|
|
11
|
+
attempt begun before a switch ends in the mode it began in. A wire may
|
|
12
|
+
offer `queueEmpty()` (true when the mediator holds nothing more for
|
|
13
|
+
the connection). Closed: a wire without it never completes a
|
|
14
|
+
collection, and the adapter over it never switches. The consumer a
|
|
15
|
+
wire registers with `onDeliver` now answers a boolean: whether the
|
|
16
|
+
adapter took the frame (buffered, already held, or absorbed); `false`
|
|
17
|
+
(above `max-queue-bytes`, or a retired instance) leaves the frame with
|
|
18
|
+
the mediator, and a wire does not take its queue for drained until the
|
|
19
|
+
frame is offered again.
|
|
20
|
+
- **The send state** (RLTP-VTI-3130), per relationship: the mode and the
|
|
21
|
+
**open routed deposits** (`SendState.open`, each with digest and
|
|
22
|
+
acceptance instant): every document (an entry of kind `document` filed
|
|
23
|
+
by `reconcile`) accepted in `routed` and not yet answered.
|
|
24
|
+
Acknowledgements are no open deposits, so a side that only
|
|
25
|
+
acknowledges never switches by the deadline (profile Open Issue 9). A
|
|
26
|
+
document's acceptance instant is the adapter clock (the last port
|
|
27
|
+
instant) when its deposit resolved; without a port call in between it
|
|
28
|
+
is the hand-over instant. The send state travels in `AckState.send`
|
|
29
|
+
(new type `SendState`); a restore checks it fail-closed: exactly `mode`
|
|
30
|
+
and `open`, a known mode, each entry exactly digest and acceptance
|
|
31
|
+
instant, finite and not after the restore instant, each digest once,
|
|
32
|
+
nothing open in `egress-session` — any other field is refused, not
|
|
33
|
+
ignored. A snapshot without it starts in `routed`. `sendMode` reads the
|
|
34
|
+
current mode. A `submit()` without a digest opens nothing. An open
|
|
35
|
+
deposit falls `routedAckDeadlineMs` plus `duplicateWindowMs` after its
|
|
36
|
+
acceptance, also where no switch check runs; a restore cuts such
|
|
37
|
+
entries instead of refusing them. A routed attempt accepted after the
|
|
38
|
+
switch enters nothing.
|
|
39
|
+
- **Absorption for the give-up horizon** (profile §2, §4): the adapter
|
|
40
|
+
absorbs a byte-identical copy of a concluded item only within
|
|
41
|
+
`give-up-horizon` of its conclusion (or while an acknowledgement for it
|
|
42
|
+
is on the wire); a later copy is a new item for the holder, whose
|
|
43
|
+
absorption answers it with the stored acknowledgement (RLTP-DEL-6330,
|
|
44
|
+
6335); its new conclusion sets the conclusion instant anew. Buffered
|
|
45
|
+
and outstanding go before concluded, so a redelivery of such a copy is
|
|
46
|
+
ignored while the holder has it. The entry and its ack intent stand for
|
|
47
|
+
the duplicate window; while such a later copy waits in the buffer or is outstanding,
|
|
48
|
+
the standing intent is not sent, so it never deletes the copy before
|
|
49
|
+
the holder concluded it (hand off → await → ack).
|
|
50
|
+
- **"Nothing pending" is the binding's statement** (RLTP-VTI-7150):
|
|
51
|
+
`queueEmpty()` true; without it, no switch.
|
|
52
|
+
- **Answers and switch**: `acknowledged(id)`, `receiverRefused(id, code)`
|
|
53
|
+
and the new `answered(digest, now)` (an answer the holder hands a later
|
|
54
|
+
instance: a valid acknowledgement, a validated refusal or a validated
|
|
55
|
+
`idConflict`) answer the open deposit of that document's digest; a
|
|
56
|
+
verdict that outruns the acceptance (`answered` included) keeps the
|
|
57
|
+
document from being opened. An open acknowledgement is answered by nothing. Each answer
|
|
58
|
+
settles its own deposit only. `advance` switches one way to
|
|
59
|
+
`egress-session` when an open routed deposit was accepted
|
|
60
|
+
`DECLARED.routedAckDeadlineMs` (72 h, equal to the give-up horizon) or
|
|
61
|
+
more ago, checked only after the instance concluded a collection that
|
|
62
|
+
left nothing pending (an empty collection counts; `queueEmpty()` true,
|
|
63
|
+
nothing buffered or outstanding) and only while nothing is pending
|
|
64
|
+
again at the check, so an acknowledgement that arrived since is
|
|
65
|
+
collected and reported first. A deposit the wire refuses with the new
|
|
66
|
+
`WireError` kind `'routed-refused'` (a validated refusal of the routed
|
|
67
|
+
form) switches at once; the submission stays
|
|
68
|
+
`awaiting-transport(carrier-refused-retriable)` and goes in
|
|
69
|
+
`egress-session` at its next hand-over. This holds for an attempt the
|
|
70
|
+
holder withdrew while it ran as well: the refusal is evidence about the
|
|
71
|
+
mediator, not about the document. At the switch the open deposits
|
|
72
|
+
leave; nothing returns to `routed`. An accepted submission is never
|
|
73
|
+
deposited again; one still in the holder's custody goes in the new mode
|
|
74
|
+
at its next hand-over (RLTP-VTI-3135, 7130).
|
|
75
|
+
- **What the host owes**: the reports a collection carries are applied
|
|
76
|
+
before its `conclude`, at the latest before the next `advance`, since
|
|
77
|
+
the switch check counts them as applied. A host that persists only
|
|
78
|
+
`concluded` and `pending` starts every opening in `routed` with nothing
|
|
79
|
+
open, so a relationship whose openings last less than 72 hours never
|
|
80
|
+
switches by the deadline; the mode in a restored snapshot is as
|
|
81
|
+
trustworthy as the host's store.
|
|
82
|
+
- **`depositAddressing(mode, self, peerConnection, carrier)`**: the
|
|
83
|
+
addressing of both layers and the session per mode, as
|
|
84
|
+
`vectors/vti-routed-addressing.json` states it (RLTP-VTI-1110, 1120,
|
|
85
|
+
3110, 3115, 3120); the wire binding packs from it.
|
|
86
|
+
- **The app's transport contract**, stated and tested (it held before):
|
|
87
|
+
after a withdrawal by `reconcile` the adapter starts no deposit for that
|
|
88
|
+
submission, and an outcome that resolves late changes nothing, the send
|
|
89
|
+
state included, except a validated refusal of the routed form, which
|
|
90
|
+
switches; a wire call already running cannot be recalled and may
|
|
91
|
+
still land at the mediator (profile §6), and the copy that arrives is a
|
|
92
|
+
duplicate the receiver absorbs (Delivery §6.2). Every deposit is a
|
|
93
|
+
submission with an id of its own, a duplicate's answer included; the
|
|
94
|
+
report handed to the holder carries the digest, and the app pairs it
|
|
95
|
+
with its deposit through the submission id it polls.
|
|
96
|
+
- Breaking for wire implementations: `deposit` takes the mode as its
|
|
97
|
+
fourth argument. `AckState` gains the optional `send`.
|
|
98
|
+
|
|
99
|
+
## 0.6.1
|
|
100
|
+
|
|
101
|
+
One actId, one result.
|
|
102
|
+
|
|
103
|
+
- **`replay(actId, when)`**: the journaled result of a human act without
|
|
104
|
+
the act — `{ok: true, result: {actId, commitSeq, at, events, outbound}}`,
|
|
105
|
+
each document of the act with `live` (whether a repeat at `when` would
|
|
106
|
+
hand it out), or `{ok: false, code: 'unknown-act'}` (`actid-missing` for
|
|
107
|
+
an empty id). For `sendMessage` the `message.sent` event carries the
|
|
108
|
+
`mid` and the `digest`; `at` is the commit time the message's `sentAt`
|
|
109
|
+
was taken from. A pure read in the holder's queue: nothing runs, nothing
|
|
110
|
+
is given up, nothing commits, lastWhen included; no key is used, so it
|
|
111
|
+
answers on an opening whose keys are locked. New types `ReplayResult`,
|
|
112
|
+
`ActReplay`, `ReplayOutbound`.
|
|
113
|
+
- **The rule, stated and tested** (it held before; the engine takes one
|
|
114
|
+
path for every human act, and the tests cover `sendMessage`, `show`,
|
|
115
|
+
`scan`, `setProfile`, `foundGroup`, `block`, `unblock` and `trust`): a repeat under a journaled actId answers the
|
|
116
|
+
journaled events — for `sendMessage` the same `mid` — whatever the clock
|
|
117
|
+
says (ahead, set back), across `close()` and a new opening, with keys
|
|
118
|
+
that answer nothing, and after a commit whose outcome was unknown; it
|
|
119
|
+
never mints a second `mid`. Another input under the same actId stays
|
|
120
|
+
`actid-conflict`.
|
|
121
|
+
- **The journal keeps an act as long as its documents' completion**: the
|
|
122
|
+
retention max(P90D, the retry horizon) now runs from the act's commit
|
|
123
|
+
and from the last step of each of its documents (delivered or failed),
|
|
124
|
+
whichever is later; a document not yet terminal keeps the act. Before,
|
|
125
|
+
it ran from the commit alone, so an act delivered late left the journal
|
|
126
|
+
while its delivery status stayed. The bound is in holder time and of
|
|
127
|
+
time, not of count: one entry per human act, removed by the tick that is
|
|
128
|
+
due. A clock set ahead by more than the retention ends it early in real time; `replay` then answers `unknown-act`, and
|
|
129
|
+
a repeat under that actId would be a new act. An app asks `replay`
|
|
130
|
+
instead of repeating an act blind.
|
|
131
|
+
- **Fixes**: a tick that drops journal entries keeps an entry whose actId
|
|
132
|
+
is `__proto__` as an own member (it set the prototype of the kept
|
|
133
|
+
journal, and the commit failed the codec); the settling after an
|
|
134
|
+
`unknown-commit-outcome` counts the act as landed only when the journal
|
|
135
|
+
holds it with the same events, not another opening's commit of the same
|
|
136
|
+
actId at the same commitSeq; an act that issues documents names in
|
|
137
|
+
`nextDueAt` each one's first retry or send deadline, whichever comes
|
|
138
|
+
first (a repeat names its live documents' the same way), so a holder
|
|
139
|
+
whose timer had run out reaches the retries, the give-up and the
|
|
140
|
+
journal's end on the timers alone. An act without documents names no
|
|
141
|
+
journal deadline; the next `resume` names its entry's end, a `tick`
|
|
142
|
+
does not.
|
|
143
|
+
- The state and codec 3 are unchanged: the journal was already part of the
|
|
144
|
+
stored state.
|
|
145
|
+
|
|
3
146
|
## 0.6.0
|
|
4
147
|
|
|
5
148
|
Takes up Delivery Contract 0.83: the holder keeps custody of what waits
|
package/README.md
CHANGED
|
@@ -94,7 +94,33 @@ that the adapter holds it and ends nothing (RLTP-DEL-6330), and it stays
|
|
|
94
94
|
retained with its effect for a duplicate (6335).
|
|
95
95
|
`./adapters/vti-mediator` reconciles from the view
|
|
96
96
|
(`reconcile(view, holder, now)`); one adapter serves one opening, so the
|
|
97
|
-
next opening creates a new one.
|
|
97
|
+
next opening creates a new one. The app persists the adapter's
|
|
98
|
+
`ackState()`, which carries the relationship's send state, and restores it
|
|
99
|
+
into the next adapter; it hands that adapter, through `answered(digest,
|
|
100
|
+
now)`, the valid acknowledgements, validated refusals and validated
|
|
101
|
+
`idConflict` answers that arrive for documents an earlier adapter
|
|
102
|
+
deposited, before the adapter's next `advance`. The reports a
|
|
103
|
+
collection carries (`acknowledged`, `receiverRefused`, `answered`) are
|
|
104
|
+
applied before that collection's `conclude`, at the latest before the
|
|
105
|
+
next `advance`: the switch check counts them as applied, and one applied
|
|
106
|
+
late can let a relationship switch although its deposits were answered.
|
|
107
|
+
The send state holds the mode and the open routed deposits: this side's
|
|
108
|
+
documents accepted in `routed` and not yet answered (acknowledgements are
|
|
109
|
+
none, so a side that only acknowledges never switches by the deadline); an open
|
|
110
|
+
deposit 72 hours old switches the relationship to `egress-session`, and
|
|
111
|
+
so does a deposit the wire refuses as `'routed-refused'`, at once. A host
|
|
112
|
+
that persists only `concluded` and `pending` starts every opening in
|
|
113
|
+
`routed` with nothing open, so a relationship whose openings last less
|
|
114
|
+
than 72 hours never switches by the deadline; the mode in a restored
|
|
115
|
+
snapshot is as trustworthy as the host's store. The adapter absorbs a
|
|
116
|
+
byte-identical copy of a concluded item only for the give-up horizon
|
|
117
|
+
after its conclusion; a later copy reaches the holder, which absorbs it
|
|
118
|
+
and answers it with the stored acknowledgement. An open routed deposit
|
|
119
|
+
falls 72 hours plus the 30-day duplicate window after its acceptance, so
|
|
120
|
+
the send state stays bounded. A `submit()` without a
|
|
121
|
+
digest opens nothing: an app that sends only through `submit()` never
|
|
122
|
+
switches by the deadline. The consumer a wire registers with `onDeliver`
|
|
123
|
+
answers whether the adapter took the frame.
|
|
98
124
|
|
|
99
125
|
**The timer.** Every act, receive and resume may name `nextDueAt`: the
|
|
100
126
|
earliest time something is due, delivery work (retries, duties, acks)
|
|
@@ -118,7 +144,25 @@ consent to an introduction), `trust`, `untrust`, `pauseTrust`, `setClass`,
|
|
|
118
144
|
`addDevice`, `revokeDevice`. Not
|
|
119
145
|
human: `receive`, `report`, `resume`, `tick`, `recover`, `takeMessages`.
|
|
120
146
|
Reads: `contacts`, `contact`, `groups`, `profile`, `prompts`, `inbox`,
|
|
121
|
-
`deliveryStatus`, `deviceKey`, `snapshot`, `subscribe`.
|
|
147
|
+
`deliveryStatus`, `deviceKey`, `replay`, `snapshot`, `subscribe`.
|
|
148
|
+
|
|
149
|
+
One actId, one result: every human act is journaled under its actId with
|
|
150
|
+
its result. A repeat under the same actId answers the journaled events
|
|
151
|
+
(for `sendMessage` the same `mid`) at any clock and across a lock and a
|
|
152
|
+
new opening; it never runs the act again, and another input under the
|
|
153
|
+
same actId is `actid-conflict`. `replay(actId, when)` reads that result
|
|
154
|
+
without the act: `{ok: true, result: {actId, commitSeq, at, events,
|
|
155
|
+
outbound}}` (each document with `live`: whether a repeat at `when` would
|
|
156
|
+
hand it out), or `{ok: false, code: 'unknown-act'}`. It commits nothing and
|
|
157
|
+
needs no keys. The journal keeps an act for max(P90D, the retry horizon)
|
|
158
|
+
after its commit and after the last step of each of its documents
|
|
159
|
+
(delivered or failed; one not yet terminal keeps it), counted in holder
|
|
160
|
+
time and removed by the tick that is due (an act without documents
|
|
161
|
+
names no deadline of its own; the next `resume` names it, a `tick`
|
|
162
|
+
does not); after that its actId is unknown. An app that does not know whether an act committed (a crash, an
|
|
163
|
+
`unknown-commit-outcome`, a lock) asks `replay` and does not repeat the act
|
|
164
|
+
blind: `unknown-act` means the act did not commit or has left the
|
|
165
|
+
journal, and acting anew is the human's decision. Custody:
|
|
122
166
|
`pendingTransport`, `handOver`, `mayHandOver`, `close`, `closed`.
|
|
123
167
|
|
|
124
168
|
## What the root exports
|
|
@@ -150,7 +194,7 @@ Other entry points:
|
|
|
150
194
|
|---|---|
|
|
151
195
|
| `./testing` | `InMemoryStore`, `memoryLog`, `scriptedEntropy`, `storeContract`, `emptyState`, `stateBuilder`, `freezeDeep`, `sampleState`, `openPromptModule`, the invariant checks, `forgeMapping` (deniability, Trust 6.1), `SCHEMAS` and the generated `wire` types. For tests, vectors and adapter authors; not for production holders. |
|
|
152
196
|
| `./internal` | The structural `HolderState`, `encodeState` and the codec chain, the engine's module types, the pure view functions, the modules' factories and pure reads. For the library's own modules and tests; not an app contract. |
|
|
153
|
-
| `./adapters/vti-mediator` | The VTI mediator as a
|
|
197
|
+
| `./adapters/vti-mediator` | The VTI mediator as a transport adapter (profile 0.24): its submission states as `DeliveryReport`, collection and ack handling, the selective conclusion of a collection (`conclude(c, now, {keep})`, `concludable(result)`: a `failed(rate-limited)` item stays with the carrier), the sending form of §3a: every deposit names its `SendMode` (`routed`, or `egress-session` after the one-way switch of RLTP-VTI-3130), the send state (mode, open routed deposits) travels in `AckState.send` (a `submit()` without a digest opens nothing), a `WireError('routed-refused')` switches at once, a wire without `queueEmpty()` never completes a collection and so never switches, `answered(digest, now)` carries the holder's answers to a later instance, and `depositAddressing(mode, self, peerConnection, carrier)` gives both layers' addressing. |
|
|
154
198
|
|
|
155
199
|
## The modules and the rules they implement
|
|
156
200
|
|
|
@@ -270,6 +314,7 @@ This package uses its own semver; the specification uses castings.
|
|
|
270
314
|
| membership | Membership Tasks 0.20, Access 0.57 | the Access envelope (Membership 3.3: `access-operation/0.1` with `member.add` and the sealed welcome; this library sends its own `x-membership-welcome/0.1`); an admission prompt after the bound of RLTP-MT-3282; roster replication: a holder knows the members it admitted and the roster its welcome carried |
|
|
271
315
|
| introduction | Trust 0.31 §8 | how a requester learns the mediator's designator (8.3): this library's mediator sends `x-introduction-offer/0.1` |
|
|
272
316
|
| delivery | Delivery 0.83 | transport adapters beyond `./adapters/vti-mediator`; the block of the Trust Layer's types (Message Tasks 6240: their treatments wait for the next casting of the Trust Layer) |
|
|
317
|
+
| transport adapter | VTI Mediator Adapter Profile 0.24 | the TSP framing, which is the wire binding's (profile §7; `binding/` in the repository); a return from `egress-session` to `routed` (profile Open Issue 7) |
|
|
273
318
|
| message | Message Tasks 0.1 | holding a message unsent until its tuple is ready (5020): `sendMessage` answers `not-ready` and the app keeps the message; checking `replyTo` against the relationship's history (5120), which is the app's; multi-device (§9); `failed(task-expired)` for a message: reachable only with a retry horizon beyond P179D, which the engine does not admit (at most P90D), so an undelivered message ends as `failed(expired-by-adapter-policy)` |
|
|
274
319
|
| devices | Identity §5.5 | multi-device production: one writer per holder |
|
|
275
320
|
|
|
@@ -10,8 +10,37 @@ export declare const DECLARED: Readonly<{
|
|
|
10
10
|
readonly queueFloorBytes: 1048576;
|
|
11
11
|
readonly maxQueueBytes: 16777216;
|
|
12
12
|
readonly duplicateWindowMs: number;
|
|
13
|
+
readonly routedAckDeadlineMs: number;
|
|
13
14
|
}>;
|
|
14
|
-
|
|
15
|
+
/** How a deposit reaches the mediator (RLTP-VTI-3110, 3120). */
|
|
16
|
+
export type SendMode = 'routed' | 'egress-session';
|
|
17
|
+
/** One TSP layer's addressing (no keys, no bytes: those are the wire's). */
|
|
18
|
+
export interface LayerAddressing {
|
|
19
|
+
messageType: 'direct' | 'routed';
|
|
20
|
+
sender: string;
|
|
21
|
+
receiver: string;
|
|
22
|
+
route?: string[];
|
|
23
|
+
}
|
|
24
|
+
/** The addressing of a deposit in `mode` (RLTP-VTI-1110, 1120, 3110,
|
|
25
|
+
* 3115, 3120): the inner `direct` message from this side's egress
|
|
26
|
+
* identity to the counterpart's connection DID; in mode `routed` an
|
|
27
|
+
* outer routed message from this side's connection DID to the carrier
|
|
28
|
+
* `C` with the route [counterpart's connection DID], deposited on the
|
|
29
|
+
* connection DID's session; in mode `egress-session` no outer layer,
|
|
30
|
+
* deposited on the egress identity's send-only session. */
|
|
31
|
+
export declare function depositAddressing(mode: SendMode, self: {
|
|
32
|
+
connection: string;
|
|
33
|
+
egress: string;
|
|
34
|
+
}, peerConnection: string, carrier: string): {
|
|
35
|
+
inner: LayerAddressing;
|
|
36
|
+
outer: LayerAddressing | null;
|
|
37
|
+
session: string;
|
|
38
|
+
};
|
|
39
|
+
export type WireErrorKind = 'unreachable' | 'refused-retriable' | 'refused-admission' | 'oversize'
|
|
40
|
+
/** the mediator refused a routed deposit for its routed form, and the
|
|
41
|
+
* binding authenticated that refusal as the mediator's (RLTP-VTI-3130):
|
|
42
|
+
* the relationship switches to egress-session at once */
|
|
43
|
+
| 'routed-refused';
|
|
15
44
|
export declare class WireError extends Error {
|
|
16
45
|
kind: WireErrorKind;
|
|
17
46
|
constructor(kind: WireErrorKind, message?: string);
|
|
@@ -28,11 +57,23 @@ export interface MediatorWire {
|
|
|
28
57
|
}): Promise<TokenSet>;
|
|
29
58
|
refresh(refreshToken: string): Promise<TokenSet>;
|
|
30
59
|
keylistUpdate(accessToken: string, rkids: string[]): Promise<void>;
|
|
31
|
-
|
|
60
|
+
/** `mode` is the sending form of this deposit (profile §3a): the wire
|
|
61
|
+
* packs and sends it as depositAddressing(mode, …) describes. */
|
|
62
|
+
deposit(accessToken: string, bytes: Uint8Array, egressDid: string, mode: SendMode): Promise<void>;
|
|
32
63
|
ackReceived(accessToken: string, queueIds: string[]): Promise<void>;
|
|
33
|
-
|
|
64
|
+
/** The adapter's consumer answers whether it took the frame (buffered,
|
|
65
|
+
* already held, or absorbed as a duplicate): false means the frame is
|
|
66
|
+
* left with the mediator (above max-queue-bytes, or a retired
|
|
67
|
+
* instance), and a wire must not take its queue for drained until the
|
|
68
|
+
* frame is offered again (RLTP-VTI-3130, queueEmpty). */
|
|
69
|
+
onDeliver(cb: (bytes: Uint8Array) => Promise<boolean>): void;
|
|
34
70
|
/** Optional truthful connectivity signal; absent means unknown. */
|
|
35
71
|
offline?(): boolean;
|
|
72
|
+
/** Optional: true when the mediator holds nothing more for this
|
|
73
|
+
* connection (RLTP-VTI-3130: a conclusion that left no frame
|
|
74
|
+
* pending). Closed: absent, no collection counts as complete, so an
|
|
75
|
+
* adapter over a wire without it never switches to egress-session. */
|
|
76
|
+
queueEmpty?(): boolean;
|
|
36
77
|
}
|
|
37
78
|
export interface TokenSet {
|
|
38
79
|
accessToken: string;
|
|
@@ -82,6 +123,20 @@ export interface AckState {
|
|
|
82
123
|
concludedAt: number;
|
|
83
124
|
}>;
|
|
84
125
|
pending: string[];
|
|
126
|
+
/** the relationship's send state (RLTP-VTI-3130); absent → `routed` */
|
|
127
|
+
send?: SendState;
|
|
128
|
+
}
|
|
129
|
+
/** The send state of a relationship (profile §3a, RLTP-VTI-3130),
|
|
130
|
+
* persisted with the ack state: the mode and the open routed deposits —
|
|
131
|
+
* this side's documents accepted in routed and not yet answered, each
|
|
132
|
+
* with its digest and acceptance instant. Acknowledgements are no open
|
|
133
|
+
* deposits. In egress-session `open` is empty. */
|
|
134
|
+
export interface SendState {
|
|
135
|
+
mode: SendMode;
|
|
136
|
+
open: Array<{
|
|
137
|
+
digest: string;
|
|
138
|
+
acceptedAt: number;
|
|
139
|
+
}>;
|
|
85
140
|
}
|
|
86
141
|
/** The holder's side of a hand-over (lib 0.6.0): the holder itself.
|
|
87
142
|
* handOver checks the entry and calls `start` inside the holder's queue;
|
|
@@ -125,6 +180,15 @@ export declare class MediatorCarrierAdapter {
|
|
|
125
180
|
* submission filed without a digest (submit) has no report form. */
|
|
126
181
|
report(id: string): DeliveryReport | null;
|
|
127
182
|
has(id: string): boolean;
|
|
183
|
+
/** The current sending mode of the relationship (profile §3a). */
|
|
184
|
+
get sendMode(): SendMode;
|
|
185
|
+
/** An answer the holder hands this instance for a document an earlier
|
|
186
|
+
* instance deposited (RLTP-VTI-3130): a valid acknowledgement, a
|
|
187
|
+
* validated receiver refusal or a validated `idConflict` answer for
|
|
188
|
+
* `digest`. If the send state names the document as an open routed
|
|
189
|
+
* deposit, it is answered and leaves; otherwise it answers nothing. A
|
|
190
|
+
* no-op on a retired instance, like acknowledged. */
|
|
191
|
+
answered(digest: string, rawNow: number): void;
|
|
128
192
|
/** Host teardown aid, NOT a port operation (profile §6): awaits
|
|
129
193
|
* the in-flight background tasks so a host can drain before
|
|
130
194
|
* persisting ackState. On a hanging wire it waits as long as the
|
|
@@ -144,13 +208,20 @@ export declare class MediatorCarrierAdapter {
|
|
|
144
208
|
* (d) otherwise → no report yet (null)
|
|
145
209
|
* Terminal states and `accepted` are stored and stand. */
|
|
146
210
|
status(id: string): SubmissionState | null;
|
|
211
|
+
/** A valid acknowledgement for submission `id`. Reports that a
|
|
212
|
+
* collection carries are applied before that collection's conclude,
|
|
213
|
+
* at the latest before the next advance: the switch check of
|
|
214
|
+
* RLTP-VTI-3130 counts on them, and a report applied late can let the
|
|
215
|
+
* relationship switch although its deposits were answered. */
|
|
147
216
|
acknowledged(id: string): void;
|
|
148
217
|
/** Refusals act on live submissions only (§6.1 knows exactly one
|
|
149
218
|
* late correction — the valid ack). The code set is closed and
|
|
150
219
|
* TERMINAL: retryable counterpart conditions (unavailable,
|
|
151
220
|
* internalError) are transport outcomes, never receiver verdicts
|
|
152
221
|
* — they have no entry here, and an unknown code is refused
|
|
153
|
-
* fail-closed rather than minted into a verdict (R6-B2).
|
|
222
|
+
* fail-closed rather than minted into a verdict (R6-B2). Applied, like
|
|
223
|
+
* acknowledged, before the conclude of the collection that carried
|
|
224
|
+
* it (RLTP-VTI-3130). */
|
|
154
225
|
receiverRefused(id: string, code: ReceiverRefusalCode): void;
|
|
155
226
|
drainTransitions(): Array<{
|
|
156
227
|
id: string;
|
|
@@ -162,7 +233,11 @@ export declare class MediatorCarrierAdapter {
|
|
|
162
233
|
* is transient (Delivery RLTP-DEL-5810, 5820: `failed(rate-limited)`,
|
|
163
234
|
* or a transaction that could not commit, see `concludable`): they are
|
|
164
235
|
* not concluded and not acknowledged, they go back to the buffer and the
|
|
165
|
-
* next collect offers them again, and the mediator keeps its copy.
|
|
236
|
+
* next collect offers them again, and the mediator keeps its copy.
|
|
237
|
+
* The reports the collection carries (acknowledged, receiverRefused,
|
|
238
|
+
* answered) are applied BEFORE this call, at the latest before the next
|
|
239
|
+
* advance: a conclusion that leaves nothing pending opens the switch
|
|
240
|
+
* check of RLTP-VTI-3130, which counts them as applied. */
|
|
166
241
|
conclude(collection: {
|
|
167
242
|
id: string;
|
|
168
243
|
}, rawNow: number, opts?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vti-mediator.d.ts","sourceRoot":"","sources":["../../src/adapters/vti-mediator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vti-mediator.d.ts","sourceRoot":"","sources":["../../src/adapters/vti-mediator.ts"],"names":[],"mappings":"AAuFA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAItD,eAAO,MAAM,QAAQ;;;;;;;;EAQV,CAAA;AAGX,gEAAgE;AAChE,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,gBAAgB,CAAA;AAGlD,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK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