@rise-maritime/keelson-js 0.6.0-alpha.232.dev.1 → 0.6.0-alpha.255.dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -8
- package/dist/interfaces/Route.d.ts +24 -0
- package/dist/interfaces/Route.js +57 -2
- package/dist/interfaces/ScenarioControl.d.ts +3 -96
- package/dist/interfaces/ScenarioControl.js +37 -394
- package/dist/interfaces/VehicleSimulatorControl.d.ts +83 -0
- package/dist/interfaces/VehicleSimulatorControl.js +293 -1
- package/dist/interfaces/serviceRegistry.d.ts +8 -8
- package/dist/payloads/ChecklistEvent.d.ts +178 -0
- package/dist/payloads/ChecklistEvent.js +539 -0
- package/dist/payloads/ChecklistEvidence.d.ts +79 -0
- package/dist/payloads/ChecklistEvidence.js +287 -0
- package/dist/payloads/ChecklistPresence.d.ts +68 -0
- package/dist/payloads/ChecklistPresence.js +286 -0
- package/dist/payloads/ChecklistProcedure.d.ts +81 -0
- package/dist/payloads/ChecklistProcedure.js +364 -0
- package/dist/payloads/ChecklistState.d.ts +283 -0
- package/dist/payloads/ChecklistState.js +1100 -0
- package/dist/payloads/EnvelopeExceedance.d.ts +216 -0
- package/dist/payloads/EnvelopeExceedance.js +461 -0
- package/dist/payloads/Route.d.ts +24 -0
- package/dist/payloads/Route.js +57 -2
- package/dist/payloads/RouteExecution.d.ts +81 -1
- package/dist/payloads/RouteExecution.js +215 -1
- package/dist/payloads/ScenarioEvent.d.ts +90 -0
- package/dist/payloads/ScenarioEvent.js +294 -0
- package/dist/payloads/ScenarioTickAck.d.ts +95 -0
- package/dist/payloads/ScenarioTickAck.js +239 -0
- package/dist/payloads/index.foxglove.d.ts +1 -1
- package/dist/payloads/index.foxglove.js +1 -1
- package/dist/payloads/index.google.protobuf.d.ts +1 -1
- package/dist/payloads/index.google.protobuf.js +1 -1
- package/dist/payloads/index.keelson.d.ts +9 -1
- package/dist/payloads/index.keelson.js +9 -1
- package/dist/qos.json +13 -1
- package/dist/subjects.json +9 -1
- package/package.json +1 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { ChecklistItemEvidence } from "./ChecklistEvidence";
|
|
3
|
+
import { ChecklistProcedure_Item } from "./ChecklistProcedure";
|
|
4
|
+
/**
|
|
5
|
+
* Snapshot of one RUN of a checklist procedure, used to bootstrap late-joining operators.
|
|
6
|
+
* Published periodically and on state change for synchronization between ROC sites.
|
|
7
|
+
*
|
|
8
|
+
* The unit here is a run, not a procedure. A procedure is a template that may be executed many
|
|
9
|
+
* times; each execution is a run with its own id, its own progress and its own place in history.
|
|
10
|
+
* The key's last token is the `run_id`, which is globally unique — so it stays a single token and
|
|
11
|
+
* the storage's `.../checklist_state/*` expression keeps covering it, and two runs of the same
|
|
12
|
+
* procedure no longer overwrite each other.
|
|
13
|
+
*/
|
|
14
|
+
export interface ChecklistState {
|
|
15
|
+
$type: "keelson.ChecklistState";
|
|
16
|
+
timestamp: Date | undefined;
|
|
17
|
+
procedureId: string;
|
|
18
|
+
publishedByOperator: string;
|
|
19
|
+
publishedBySite: string;
|
|
20
|
+
/**
|
|
21
|
+
* Number of events this snapshot has incorporated. A STALENESS HINT, never arbitration.
|
|
22
|
+
*
|
|
23
|
+
* It orders two snapshots from the SAME publisher and nothing else, because it is a scalar: two
|
|
24
|
+
* sites that each applied a DIFFERENT twelve events both hold 12, so a receiver that discards
|
|
25
|
+
* the lower count rejects the other site's work — and that site, symmetrically, rejects its own.
|
|
26
|
+
* Neither ever converges. A receiver must therefore NOT ignore a snapshot for carrying a lower
|
|
27
|
+
* count than it has already applied. Convergence comes from the field-level merge rules
|
|
28
|
+
* in protocol-specification.md §7.2, which hold regardless of arrival order or of this number.
|
|
29
|
+
*
|
|
30
|
+
* (This comment used to open by mandating exactly that discard, and retract it a paragraph
|
|
31
|
+
* later. The opening was the harmful half: an implementer reading top-down had already written
|
|
32
|
+
* the deadlock before reaching the retraction.)
|
|
33
|
+
*
|
|
34
|
+
* See RISE-Maritime/keelson#204 for the key-layout fix that would let this become load-bearing
|
|
35
|
+
* again by giving every writer a key of its own.
|
|
36
|
+
*/
|
|
37
|
+
eventCount: number;
|
|
38
|
+
items: ChecklistState_ItemState[];
|
|
39
|
+
/** Globally unique, and the last token of this snapshot's key. */
|
|
40
|
+
runId: string;
|
|
41
|
+
status: ChecklistState_RunStatus;
|
|
42
|
+
startedAt: Date | undefined;
|
|
43
|
+
completedAt: Date | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* When a planned run is due. Optional — a run may be queued for this watch with no due time,
|
|
46
|
+
* which is the common case; only a run with a deadline carries one.
|
|
47
|
+
*/
|
|
48
|
+
scheduledFor: Date | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The procedure as it was when this run was created. Carried on every snapshot because a
|
|
51
|
+
* receiver may hold a run whose definition has not arrived off the bus yet, and a run with no
|
|
52
|
+
* title renders as a bare id in the tab strip and on the board.
|
|
53
|
+
*/
|
|
54
|
+
procedureTitle: string;
|
|
55
|
+
procedureVersion: string;
|
|
56
|
+
/**
|
|
57
|
+
* The item text this run was actually worked against, written ONLY on the terminal publish.
|
|
58
|
+
*
|
|
59
|
+
* Without it a historical run renders against whatever the template says TODAY: edit a
|
|
60
|
+
* procedure after a run completes and the archive silently shows the new wording beside the old
|
|
61
|
+
* completion timestamps — a plausible-looking record of something that did not happen. Live
|
|
62
|
+
* snapshots omit it because the storage keeps only the last value per key, so paying for it on
|
|
63
|
+
* every tick of an hour-long run buys nothing.
|
|
64
|
+
*
|
|
65
|
+
* Once a receiver has seen a snapshot carrying this, it must re-emit it on any subsequent
|
|
66
|
+
* publish of the same run, or a peer republishing the key strips the archive.
|
|
67
|
+
*/
|
|
68
|
+
itemsSnapshot: ChecklistProcedure_Item[];
|
|
69
|
+
/**
|
|
70
|
+
* Why a run was abandoned, as typed by the operator who stopped it.
|
|
71
|
+
*
|
|
72
|
+
* Abandoning is the one checklist act that DEMANDS a reason — completing early deliberately does
|
|
73
|
+
* not, because closing out early is a legitimate act while stopping without finishing is not
|
|
74
|
+
* self-explanatory. Without this field that reason lives only in the ChecklistEvent that
|
|
75
|
+
* announced it, and `checklist_event` has no router storage, so a station bootstrapping from a
|
|
76
|
+
* snapshot sees RUN_STATUS_ABANDONED with no reason and no way to ever recover one.
|
|
77
|
+
*
|
|
78
|
+
* Empty for every non-abandoned run, and empty is also legitimate for an abandoned one published
|
|
79
|
+
* by a client that did not collect a reason — a consumer must not read "" as "no reason given"
|
|
80
|
+
* versus "reason lost".
|
|
81
|
+
*/
|
|
82
|
+
abandonReason: string;
|
|
83
|
+
/**
|
|
84
|
+
* WHO CREATED THIS RUN, AND WHERE — as opposed to who last republished the snapshot.
|
|
85
|
+
*
|
|
86
|
+
* Without these a receiver has nothing to attribute a run to, and the obvious substitute is
|
|
87
|
+
* wrong in a way that is hard to see: `published_by_operator` / `published_by_site` name whoever
|
|
88
|
+
* ticked the 30 s timer. Crowsnest did exactly that, so authorship flipped to the last
|
|
89
|
+
* republisher on every snapshot — and because that station also used the field to decide which
|
|
90
|
+
* runs it republishes and who announces a run's end, the publish duty silently migrated with it.
|
|
91
|
+
* A wrong label is a display bug; a wrong publisher is a convergence bug.
|
|
92
|
+
*
|
|
93
|
+
* Empty from a publisher that predates these fields. A receiver MUST render that as unknown
|
|
94
|
+
* rather than falling back to the publisher — an absence is an absence, and naming the wrong
|
|
95
|
+
* operator on a safety record is worse than naming none.
|
|
96
|
+
*/
|
|
97
|
+
createdBy: string;
|
|
98
|
+
createdBySite: string;
|
|
99
|
+
/**
|
|
100
|
+
* When the run was created, which is NOT when it started.
|
|
101
|
+
*
|
|
102
|
+
* A PLANNED run has no `started_at` by definition, so a receiver with only that field has to
|
|
103
|
+
* reach for the snapshot's own `timestamp` — the publish tick — and a run queued last watch then
|
|
104
|
+
* sorts as if it were created moments ago. Carried separately so a planned board orders by when
|
|
105
|
+
* work was actually queued.
|
|
106
|
+
*/
|
|
107
|
+
createdAt: Date | undefined;
|
|
108
|
+
}
|
|
109
|
+
export declare enum ChecklistState_RunStatus {
|
|
110
|
+
RUN_STATUS_UNKNOWN = 0,
|
|
111
|
+
/**
|
|
112
|
+
* RUN_STATUS_PLANNED - Queued by an operator but not begun. Carries no item progress by definition, which is why
|
|
113
|
+
* a publisher must not treat "no items" as "nothing to say".
|
|
114
|
+
*/
|
|
115
|
+
RUN_STATUS_PLANNED = 1,
|
|
116
|
+
RUN_STATUS_ACTIVE = 2,
|
|
117
|
+
/** RUN_STATUS_COMPLETED - Terminal. Signed off with every required item done. */
|
|
118
|
+
RUN_STATUS_COMPLETED = 3,
|
|
119
|
+
/**
|
|
120
|
+
* RUN_STATUS_ABANDONED - Terminal. Stopped without completing; the reason is in `abandon_reason` below.
|
|
121
|
+
*
|
|
122
|
+
* It used to travel only in the announcing ChecklistEvent's `detail`, which is why
|
|
123
|
+
* `abandon_reason` exists: `checklist_event` has no router storage, so a station bootstrapping
|
|
124
|
+
* from a snapshot saw ABANDONED with no reason and no way to ever recover one.
|
|
125
|
+
*
|
|
126
|
+
* Loses to nothing. Where two sites end one run differently this is the side that stands —
|
|
127
|
+
* see §7.2, "both terminals at once".
|
|
128
|
+
*/
|
|
129
|
+
RUN_STATUS_ABANDONED = 4,
|
|
130
|
+
UNRECOGNIZED = -1
|
|
131
|
+
}
|
|
132
|
+
export declare function checklistState_RunStatusFromJSON(object: any): ChecklistState_RunStatus;
|
|
133
|
+
export declare function checklistState_RunStatusToJSON(object: ChecklistState_RunStatus): string;
|
|
134
|
+
export interface ChecklistState_ItemNote {
|
|
135
|
+
$type: "keelson.ChecklistState.ItemNote";
|
|
136
|
+
noteId: string;
|
|
137
|
+
text: string;
|
|
138
|
+
createdAt: Date | undefined;
|
|
139
|
+
author: string;
|
|
140
|
+
authorSite: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One flag on an item, from the moment it was raised to the moment it was cleared.
|
|
144
|
+
*
|
|
145
|
+
* A RECORD, not a current value, and that is the point. The five scalars on ItemState below say
|
|
146
|
+
* that an item is flagged, why, by whom and when — and say nothing at all once it is not. So the
|
|
147
|
+
* whole raise→resolve cycle lived only in `checklist_event`, which has no router storage, and a
|
|
148
|
+
* station bootstrapping from a snapshot could not learn that an issue had ever been raised on an
|
|
149
|
+
* item, who cleared it, or on what grounds. That is the same argument `abandon_reason` was added
|
|
150
|
+
* under, one level down.
|
|
151
|
+
*
|
|
152
|
+
* Modelled on ItemNote deliberately — id, text, time, author, site — because §7.2 already knows
|
|
153
|
+
* how to merge that shape and a third shape would need a third rule.
|
|
154
|
+
*
|
|
155
|
+
* `resolved_at` unset means the flag is OPEN. A consumer must treat absence as open rather than
|
|
156
|
+
* as unknown: an unresolved safety condition read as "no information" is the wrong way to fail.
|
|
157
|
+
*/
|
|
158
|
+
export interface ChecklistState_ItemFlag {
|
|
159
|
+
$type: "keelson.ChecklistState.ItemFlag";
|
|
160
|
+
/**
|
|
161
|
+
* Globally unique and a single token, like `note_id` and `evidence_id`. It is the union key in
|
|
162
|
+
* §7.2, and a union is only well defined because this exists.
|
|
163
|
+
*/
|
|
164
|
+
flagId: string;
|
|
165
|
+
/** Why it was raised. Required at every publisher this repo knows of. */
|
|
166
|
+
reason: string;
|
|
167
|
+
raisedAt: Date | undefined;
|
|
168
|
+
raisedBy: string;
|
|
169
|
+
raisedBySite: string;
|
|
170
|
+
/**
|
|
171
|
+
* Unset while the flag is open. Once set it is absorbing — see §7.2: a resolution must not be
|
|
172
|
+
* withdrawn by a peer that never saw it, and two resolutions are settled by the earlier time as
|
|
173
|
+
* a value, never by which snapshot arrived last.
|
|
174
|
+
*/
|
|
175
|
+
resolvedAt: Date | undefined;
|
|
176
|
+
resolvedBy: string;
|
|
177
|
+
resolvedBySite: string;
|
|
178
|
+
/**
|
|
179
|
+
* How it was cleared. The counterpart to `reason`, and the half that was previously
|
|
180
|
+
* unrecoverable — closing an open safety item is the part an auditor asks about.
|
|
181
|
+
*/
|
|
182
|
+
resolution: string;
|
|
183
|
+
}
|
|
184
|
+
export interface ChecklistState_ItemState {
|
|
185
|
+
$type: "keelson.ChecklistState.ItemState";
|
|
186
|
+
itemId: string;
|
|
187
|
+
status: ChecklistState_ItemState_ItemStatus;
|
|
188
|
+
startedAt: Date | undefined;
|
|
189
|
+
startedBy: string;
|
|
190
|
+
startedBySite: string;
|
|
191
|
+
completedAt: Date | undefined;
|
|
192
|
+
completedBy: string;
|
|
193
|
+
completedBySite: string;
|
|
194
|
+
notes: ChecklistState_ItemNote[];
|
|
195
|
+
flagged: boolean;
|
|
196
|
+
flagReason: string;
|
|
197
|
+
flaggedBy: string;
|
|
198
|
+
flaggedBySite: string;
|
|
199
|
+
/**
|
|
200
|
+
* Photos attached to this item — METADATA only; the bytes live on their own keys. See
|
|
201
|
+
* ChecklistEvidence.proto for why they are not inlined here.
|
|
202
|
+
*
|
|
203
|
+
* ADDITIVE, and a receiver must union it by evidence_id rather than replacing. A station that
|
|
204
|
+
* never saw the attaching event republishes this snapshot with an empty list, and a replacing
|
|
205
|
+
* merge would erase the evidence everywhere — the same hazard `items_snapshot` carries.
|
|
206
|
+
*/
|
|
207
|
+
evidence: ChecklistItemEvidence[];
|
|
208
|
+
/**
|
|
209
|
+
* When the flag was RAISED — not when this snapshot was published.
|
|
210
|
+
*
|
|
211
|
+
* `flagged`, `flag_reason`, `flagged_by` and `flagged_by_site` say an item is flagged, why, and
|
|
212
|
+
* by whom, but never when. A receiver
|
|
213
|
+
* bootstrapping from a snapshot therefore cannot date the flag at all, and a history built from
|
|
214
|
+
* it has to render an undated row beside rows that carry real times. Stamping it from the
|
|
215
|
+
* snapshot's own timestamp would be worse than leaving it empty: it would assert a time that is
|
|
216
|
+
* simply wrong, and look authoritative doing it.
|
|
217
|
+
*
|
|
218
|
+
* Unset while `flagged` is false, and unset is also what an older publisher sends — so a
|
|
219
|
+
* consumer must treat absence as "not known", never as "just now".
|
|
220
|
+
*/
|
|
221
|
+
flaggedAt: Date | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Every flag this item has carried, open and closed.
|
|
224
|
+
*
|
|
225
|
+
* WHY THIS EXISTS ALONGSIDE THE FIVE SCALARS ABOVE, which are not a second truth but a cache of
|
|
226
|
+
* this list — see §7.2. Two things were wrong and this fixes both:
|
|
227
|
+
*
|
|
228
|
+
* 1. The scalars had NO MERGE RULE. §7.2's table names a rule for `completed_at`, `status`,
|
|
229
|
+
* `evidence`, `notes`, `items_snapshot` and `event_count`, and the flag fell through to
|
|
230
|
+
* "anything else — the value from the snapshot with the later timestamp". That is plain
|
|
231
|
+
* assignment, which §7.2 opens by calling the single failure mode it exists to prevent, on
|
|
232
|
+
* the one field carrying a safety condition. A peer that never saw the flag could clear it
|
|
233
|
+
* on its 30 s tick.
|
|
234
|
+
* 2. Resolving cleared all five, so a closed flag left no trace anywhere durable. The cycle
|
|
235
|
+
* survived only in `checklist_event`, which has no router storage.
|
|
236
|
+
*
|
|
237
|
+
* MIGRATION, and the direction is what keeps the cache honest: a receiver that sees a non-empty
|
|
238
|
+
* `flags` derives the scalars from it and ignores what they say; the scalars are authoritative
|
|
239
|
+
* only from a publisher that sends no list. A publisher writes both while consumers catch up.
|
|
240
|
+
* The scalars are deprecated in the release that stops writing them, not before — Logline's
|
|
241
|
+
* `ChecklistSync.kt` and Crowsnest both read `flagged` today.
|
|
242
|
+
*/
|
|
243
|
+
flags: ChecklistState_ItemFlag[];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The only enum in this family whose zero value is not an UNKNOWN sentinel, and that is
|
|
247
|
+
* deliberate: an item has no unknown state. It has not been started, which is exactly what
|
|
248
|
+
* PENDING means, so unset and pending being indistinguishable is the truth rather than an
|
|
249
|
+
* ambiguity. Adding ITEM_STATUS_UNKNOWN = 0 would renumber every value and silently reinterpret
|
|
250
|
+
* every recording already on disk, to encode a state that cannot occur.
|
|
251
|
+
*/
|
|
252
|
+
export declare enum ChecklistState_ItemState_ItemStatus {
|
|
253
|
+
ITEM_STATUS_PENDING = 0,
|
|
254
|
+
ITEM_STATUS_IN_PROGRESS = 1,
|
|
255
|
+
ITEM_STATUS_COMPLETED = 2,
|
|
256
|
+
UNRECOGNIZED = -1
|
|
257
|
+
}
|
|
258
|
+
export declare function checklistState_ItemState_ItemStatusFromJSON(object: any): ChecklistState_ItemState_ItemStatus;
|
|
259
|
+
export declare function checklistState_ItemState_ItemStatusToJSON(object: ChecklistState_ItemState_ItemStatus): string;
|
|
260
|
+
export declare const ChecklistState: MessageFns<ChecklistState, "keelson.ChecklistState">;
|
|
261
|
+
export declare const ChecklistState_ItemNote: MessageFns<ChecklistState_ItemNote, "keelson.ChecklistState.ItemNote">;
|
|
262
|
+
export declare const ChecklistState_ItemFlag: MessageFns<ChecklistState_ItemFlag, "keelson.ChecklistState.ItemFlag">;
|
|
263
|
+
export declare const ChecklistState_ItemState: MessageFns<ChecklistState_ItemState, "keelson.ChecklistState.ItemState">;
|
|
264
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
265
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
266
|
+
[K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
|
|
267
|
+
} : Partial<T>;
|
|
268
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
269
|
+
type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
270
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
271
|
+
} & {
|
|
272
|
+
[K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never;
|
|
273
|
+
};
|
|
274
|
+
interface MessageFns<T, V extends string> {
|
|
275
|
+
readonly $type: V;
|
|
276
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
277
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
278
|
+
fromJSON(object: any): T;
|
|
279
|
+
toJSON(message: T): unknown;
|
|
280
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
281
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
282
|
+
}
|
|
283
|
+
export {};
|